Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
076ca9aa
Commit
076ca9aa
authored
Feb 24, 2023
by
高建强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
item:稳压泵统计与分析,优化接口调用
parent
24ba1713
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
44 deletions
+32
-44
EmergencyController.java
...m/yeejoin/equipmanage/controller/EmergencyController.java
+1
-1
IEmergencyService.java
...va/com/yeejoin/equipmanage/service/IEmergencyService.java
+1
-1
IPressurePumpService.java
...com/yeejoin/equipmanage/service/IPressurePumpService.java
+2
-1
EmergencyServiceImpl.java
...eejoin/equipmanage/service/impl/EmergencyServiceImpl.java
+22
-12
PressurePumpServiceImpl.java
...oin/equipmanage/service/impl/PressurePumpServiceImpl.java
+5
-28
SupervisionVideoServiceImpl.java
...equipmanage/service/impl/SupervisionVideoServiceImpl.java
+1
-1
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/EmergencyController.java
View file @
076ca9aa
...
...
@@ -633,7 +633,7 @@ public class EmergencyController extends AbstractBaseController {
@PersonIdentify
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/getPressurePumpDay"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"
四横八纵-稳压泵诊断分析"
,
notes
=
"四横八纵-稳压泵诊断分析
"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"
手动-存储昨日稳压泵启动次数"
,
notes
=
"手动-存储昨日稳压泵启动次数
"
)
public
ResponseModel
getPressurePumpDay
(
@RequestParam
(
required
=
false
)
String
bizOrgCode
)
{
if
(
StringUtils
.
isEmpty
(
bizOrgCode
))
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/IEmergencyService.java
View file @
076ca9aa
...
...
@@ -61,7 +61,7 @@ public interface IEmergencyService {
Page
<
Map
<
String
,
Object
>>
alarmList
(
Page
<
Map
<
String
,
Object
>>
page
,
String
bizOrgCode
,
List
<
String
>
types
,
List
<
String
>
emergencyLevels
,
String
name
,
Integer
cleanStatus
,
Integer
handleStatus
);
List
<
PressurePumpCountVo
>
getPressurePumpDay
(
String
bizOrgCode
);
Map
<
String
,
List
<
PressurePumpCountVo
>
>
getPressurePumpDay
(
String
bizOrgCode
);
/**
* 稳压泵启动统计
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/IPressurePumpService.java
View file @
076ca9aa
...
...
@@ -116,6 +116,7 @@ public interface IPressurePumpService {
/**
* 获取稳压泵数据,redis没有,从iot取
*
* @param pumpInfoList
* @param infoCode
* @param equipmentCode
* @param top
...
...
@@ -124,7 +125,7 @@ public interface IPressurePumpService {
* @param iotCode
* @return
*/
Map
<
String
,
List
<
IotDataVO
>>
getDataList
(
String
infoCode
,
String
equipmentCode
,
String
top
,
String
nameKey
,
String
bizOrgCode
,
String
iotCode
);
Map
<
String
,
List
<
IotDataVO
>>
getDataList
(
List
<
Map
<
String
,
Object
>>
pumpInfoList
,
String
infoCode
,
String
equipmentCode
,
String
top
,
String
nameKey
,
String
bizOrgCode
,
String
iotCode
);
/**
* map 转化为对象
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/EmergencyServiceImpl.java
View file @
076ca9aa
...
...
@@ -248,11 +248,11 @@ public class EmergencyServiceImpl implements IEmergencyService {
PressurePumpAnalysisEnum
.
PRESSURE_PUMP_FAULT
.
setValue
(
CollectionUtils
.
isEmpty
(
alarmLogList
)
?
PressurePumpRelateEnum
.
NOT_FAULT
.
getValue
()
:
PressurePumpRelateEnum
.
FAULT
.
getValue
());
// 获取稳压泵数据,redis没有,从iot取
List
<
Map
<
String
,
Object
>>
pumpInfoList
=
equipmentSpecificSerivce
.
getFirePumpInfoEQ
(
equipmentCode
,
bizOrgCode
);
Map
<
String
,
List
<
IotDataVO
>>
dataMap
=
pressurePumpService
.
getDataList
(
PressurePumpRelateEnum
.
PRESSURE_PUMP
.
getValue
(),
equipmentCode
,
top
,
pressurePumpStart
,
bizOrgCode
,
null
);
Map
<
String
,
List
<
IotDataVO
>>
dataMap
=
pressurePumpService
.
getDataList
(
pumpInfoList
,
PressurePumpRelateEnum
.
PRESSURE_PUMP
.
getValue
(),
equipmentCode
,
top
,
pressurePumpStart
,
bizOrgCode
,
null
);
List
<
IotDataVO
>
dataList
=
dataMap
.
get
(
"dataList"
);
List
<
IotDataVO
>
dataListFilterTrue
=
dataMap
.
get
(
"dataListFilterTrue"
);
List
<
IotDataVO
>
dataListFilterFalse
=
dataMap
.
get
(
"dataListFilterFalse"
);
Map
<
String
,
List
<
IotDataVO
>>
dataPipMap
=
pressurePumpService
.
getDataList
(
PressurePumpRelateEnum
.
PRESSURE_PUMP
.
getValue
(),
pipePressureEquipmentCode
,
top
,
pressurePumpPipePressure
,
bizOrgCode
,
null
);
Map
<
String
,
List
<
IotDataVO
>>
dataPipMap
=
pressurePumpService
.
getDataList
(
pumpInfoList
,
PressurePumpRelateEnum
.
PRESSURE_PUMP
.
getValue
(),
pipePressureEquipmentCode
,
top
,
pressurePumpPipePressure
,
bizOrgCode
,
null
);
List
<
IotDataVO
>
dataPipeList
=
dataPipMap
.
get
(
"dataList"
);
String
nowStrLong
=
DateUtils
.
getDateNowString
();
...
...
@@ -462,10 +462,10 @@ public class EmergencyServiceImpl implements IEmergencyService {
}
@Override
public
List
<
PressurePumpCountVo
>
getPressurePumpDay
(
String
bizOrgCode
)
{
public
Map
<
String
,
List
<
PressurePumpCountVo
>>
getPressurePumpDay
(
String
bizOrgCode
)
{
Map
<
String
,
List
<
PressurePumpCountVo
>>
dataMap
=
new
HashMap
<>();
// 从 json 配置文件获取配置信息
List
<
Map
>
infoList
=
pressurePumpService
.
getNameKeyInfoList
(
PressurePumpRelateEnum
.
PRESSURE_PUMP
.
getValue
());
List
<
PressurePumpCountVo
>
dataList
=
new
ArrayList
<>();
if
(!
CollectionUtils
.
isEmpty
(
infoList
))
{
try
{
Date
dateNow
=
DateUtils
.
convertStrToDate
(
DateUtils
.
getDateNowString
(),
DateUtils
.
DATE_PATTERN
);
...
...
@@ -473,18 +473,28 @@ public class EmergencyServiceImpl implements IEmergencyService {
// iot获取数据,返回并存储redis
String
startTime
=
DateUtils
.
convertDateToString
(
beforeDate
,
DateUtils
.
DATE_TIME_PATTERN
);
String
endTime
=
DateUtils
.
convertDateToString
(
dateNow
,
DateUtils
.
DATE_TIME_PATTERN
);
Map
m
ap
=
infoList
.
get
(
0
);
String
equipmentCode
=
m
ap
.
get
(
"equipmentCode"
).
toString
();
String
countRedisKey
=
m
ap
.
get
(
"countRedisKey"
).
toString
();
long
countExpire
=
Long
.
parseLong
(
m
ap
.
get
(
"countExpire"
).
toString
());
Map
infoM
ap
=
infoList
.
get
(
0
);
String
equipmentCode
=
infoM
ap
.
get
(
"equipmentCode"
).
toString
();
String
countRedisKey
=
infoM
ap
.
get
(
"countRedisKey"
).
toString
();
long
countExpire
=
Long
.
parseLong
(
infoM
ap
.
get
(
"countExpire"
).
toString
());
List
<
Map
<
String
,
Object
>>
pumpInfoList
=
equipmentSpecificSerivce
.
getFirePumpInfoEQ
(
equipmentCode
,
bizOrgCode
);
Object
iotCode
=
pumpInfoList
.
get
(
0
).
get
(
"iotCode"
);
String
prefix
=
ObjectUtils
.
isEmpty
(
iotCode
)
?
""
:
iotCode
.
toString
().
substring
(
0
,
8
);
dataList
=
pressurePumpService
.
getIotCountData
(
startTime
,
endTime
,
PressurePumpRelateEnum
.
PRESSURE_PUMP
.
getValue
(),
countRedisKey
,
prefix
,
null
,
PressurePumpRelateEnum
.
IOT_INDEX_VALUE_TRUE
.
getValue
(),
pressurePumpStart
,
countExpire
);
if
(!
CollectionUtils
.
isEmpty
(
pumpInfoList
)){
for
(
Map
<
String
,
Object
>
map
:
pumpInfoList
)
{
// iot获取数据,返回并存储redis
Object
iotCode
=
map
.
get
(
"iotCode"
);
if
(!
ObjectUtils
.
isEmpty
(
iotCode
))
{
String
iotCodeStr
=
iotCode
.
toString
();
String
prefix
=
ObjectUtils
.
isEmpty
(
iotCode
)
?
""
:
iotCodeStr
.
substring
(
0
,
8
);
String
suffix
=
ObjectUtils
.
isEmpty
(
iotCode
)
?
""
:
iotCodeStr
.
substring
(
8
);
List
<
PressurePumpCountVo
>
dataList
=
pressurePumpService
.
getIotCountData
(
startTime
,
endTime
,
PressurePumpRelateEnum
.
PRESSURE_PUMP
.
getValue
(),
countRedisKey
,
prefix
,
suffix
,
PressurePumpRelateEnum
.
IOT_INDEX_VALUE_TRUE
.
getValue
(),
pressurePumpStart
,
countExpire
);
dataMap
.
put
(
iotCodeStr
,
dataList
);
}
}
}
}
catch
(
ParseException
e
)
{
log
.
error
(
"redis存稳压泵昨天启动次数失败:{}"
,
e
.
getMessage
());
}
}
return
data
List
;
return
data
Map
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/PressurePumpServiceImpl.java
View file @
076ca9aa
...
...
@@ -9,7 +9,6 @@ import com.yeejoin.equipmanage.common.enums.PressurePumpRelateEnum;
import
com.yeejoin.equipmanage.common.vo.IotDataVO
;
import
com.yeejoin.equipmanage.common.vo.PressurePumpCountVo
;
import
com.yeejoin.equipmanage.fegin.IotFeign
;
import
com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce
;
import
com.yeejoin.equipmanage.service.IPressurePumpService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
...
...
@@ -37,9 +36,6 @@ import java.util.stream.Collectors;
public
class
PressurePumpServiceImpl
implements
IPressurePumpService
{
@Autowired
private
IEquipmentSpecificSerivce
equipmentSpecificSerivce
;
@Autowired
private
IotFeign
iotFeign
;
@Autowired
...
...
@@ -144,7 +140,7 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
}
catch
(
IOException
e
)
{
log
.
error
(
"获取指标JSON配置信息失败:{}"
,
e
.
getMessage
());
}
List
<
Map
>
list
=
JSON
Object
.
parseArray
(
json
,
Map
.
class
);
List
<
Map
>
list
=
JSON
.
parseArray
(
json
,
Map
.
class
);
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
return
list
.
stream
().
filter
(
x
->
code
.
equals
(
x
.
get
(
"code"
))).
collect
(
Collectors
.
toList
());
}
...
...
@@ -189,7 +185,7 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
}
@Override
public
Map
<
String
,
List
<
IotDataVO
>>
getDataList
(
String
infoCode
,
String
equipmentCode
,
String
top
,
String
nameKey
,
String
bizOrgCode
,
String
iotCode
)
{
public
Map
<
String
,
List
<
IotDataVO
>>
getDataList
(
List
<
Map
<
String
,
Object
>>
pumpInfoList
,
String
infoCode
,
String
equipmentCode
,
String
top
,
String
nameKey
,
String
bizOrgCode
,
String
iotCode
)
{
Map
<
String
,
List
<
IotDataVO
>>
map
=
new
HashMap
<>();
// 获取redis稳压泵缓存数据,默认JSON配置最近4小时
List
<
IotDataVO
>
dataList
=
getDataToRedis
(
infoCode
,
nameKey
,
iotCode
);
...
...
@@ -199,11 +195,11 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
//获取iot的数据
if
(
pressurePumpPipePressure
.
equalsIgnoreCase
(
nameKey
))
{
if
(
ObjectUtils
.
isEmpty
(
dataList
)
||
dataList
.
size
()
<
2
)
{
dataList
=
getIotData
(
top
,
nameKey
,
equipmentCode
,
bizOrgCode
);
dataList
=
getIotData
(
pumpInfoList
,
top
,
nameKey
);
}
}
else
{
if
(
ObjectUtils
.
isEmpty
(
dataList
)
||
ObjectUtils
.
isEmpty
(
dataListFilterTrue
)
||
ObjectUtils
.
isEmpty
(
dataListFilterFalse
))
{
dataList
=
getIotData
(
top
,
nameKey
,
equipmentCode
,
bizOrgCode
);
dataList
=
getIotData
(
pumpInfoList
,
top
,
nameKey
);
dataListFilterTrue
=
getDataListFilter
(
dataList
,
PressurePumpRelateEnum
.
IOT_INDEX_VALUE_TRUE
.
getValue
());
dataListFilterFalse
=
getDataListFilter
(
dataList
,
PressurePumpRelateEnum
.
IOT_INDEX_VALUE_FALSE
.
getValue
());
}
...
...
@@ -214,10 +210,9 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
return
map
;
}
private
List
<
IotDataVO
>
getIotData
(
String
top
,
String
nameKey
,
String
equipmentCode
,
String
bizOrgCode
)
{
private
List
<
IotDataVO
>
getIotData
(
List
<
Map
<
String
,
Object
>>
pumpInfoList
,
String
top
,
String
nameKey
)
{
List
<
IotDataVO
>
dataList
=
new
ArrayList
<>();
// 通过 equipmentCode 获取装备
List
<
Map
<
String
,
Object
>>
pumpInfoList
=
equipmentSpecificSerivce
.
getFirePumpInfoEQ
(
equipmentCode
,
bizOrgCode
);
if
(!
ObjectUtils
.
isEmpty
(
pumpInfoList
))
{
String
iotCode
=
pumpInfoList
.
get
(
0
).
get
(
"iotCode"
).
toString
();
if
(
iotCode
.
length
()
>
8
)
{
...
...
@@ -326,17 +321,6 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
return
Collections
.
emptyList
();
}
// private List<Map<String, String>> getIotDataFilterList(List<Map<String, String>> iotDataList, String value) {
// return iotDataList.stream().filter(x -> x.containsKey(PressurePumpRelateEnum.CREATED_TIME.getValue()) && value.equalsIgnoreCase(x.get(pressurePumpStart))).collect(Collectors.toList());
// }
//
// private List<IotDataVO> getDataListFilter(List<IotDataVO> dataList, String value, Date beforeDate) {
// if (beforeDate != null) {
// return dataList.stream().filter(x -> DateUtils.dateCompare(DateUtils.longStr2Date(x.getCreatedTime()), beforeDate) >= 0 && value.equalsIgnoreCase(x.getValue().toString())).collect(Collectors.toList());
// }
// return dataList.stream().filter(x -> value.equalsIgnoreCase(x.getValue().toString())).collect(Collectors.toList());
// }
private
List
<
IotDataVO
>
getDataListFilter
(
List
<
IotDataVO
>
dataList
,
Date
beforeDate
)
{
if
(
beforeDate
!=
null
)
{
return
dataList
.
stream
().
filter
(
x
->
DateUtils
.
dateCompare
(
DateUtils
.
longStr2Date
(
x
.
getCreatedTime
()),
beforeDate
)
>=
0
).
collect
(
Collectors
.
toList
());
...
...
@@ -344,13 +328,6 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
return
dataList
;
}
// private List<Map<String, String>> getIotDataFilterList(List<Map<String, String>> iotDataList, String value, Date beforeDate) {
// if (beforeDate != null) {
// return iotDataList.stream().filter(x -> x.containsKey(PressurePumpRelateEnum.CREATED_TIME.getValue()) && DateUtils.dateCompare(DateUtils.longStr2Date(x.get(PressurePumpRelateEnum.CREATED_TIME.getValue())), beforeDate) >= 0 && value.equalsIgnoreCase(x.get(pressurePumpPipePressure))).collect(Collectors.toList());
// }
// return iotDataList.stream().filter(x -> x.containsKey(PressurePumpRelateEnum.CREATED_TIME.getValue()) && value.equalsIgnoreCase(x.get(pressurePumpPipePressure))).collect(Collectors.toList());
// }
@Override
public
int
getAllPressurePumpStartFrequency
(
double
hour
,
List
<
IotDataVO
>
dataList
,
Date
dateNow
)
{
if
(
CollectionUtils
.
isNotEmpty
(
dataList
))
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/SupervisionVideoServiceImpl.java
View file @
076ca9aa
...
...
@@ -102,7 +102,7 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap
String
nowStrLong
=
DateUtils
.
getNowStrLong
();
// 获取稳压泵数据,redis没有,从iot取
List
<
Map
<
String
,
Object
>>
pumpInfoList
=
equipmentSpecificSerivce
.
getFirePumpInfoEQ
(
equipmentCode
,
bizOrgCode
);
Map
<
String
,
List
<
IotDataVO
>>
dataMap
=
pressurePumpService
.
getDataList
(
PressurePumpRelateEnum
.
PRESSURE_PUMP
.
getValue
(),
equipmentCode
,
top
,
pressurePumpStart
,
bizOrgCode
,
null
);
Map
<
String
,
List
<
IotDataVO
>>
dataMap
=
pressurePumpService
.
getDataList
(
pumpInfoList
,
PressurePumpRelateEnum
.
PRESSURE_PUMP
.
getValue
(),
equipmentCode
,
top
,
pressurePumpStart
,
bizOrgCode
,
null
);
List
<
IotDataVO
>
dataListFilterTrue
=
dataMap
.
get
(
"dataListFilterTrue"
);
List
<
IotDataVO
>
dataListFilterFalse
=
dataMap
.
get
(
"dataListFilterFalse"
);
Long
interval
=
0L
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment