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
b0dd3c67
Commit
b0dd3c67
authored
Feb 23, 2023
by
高建强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
item:稳压泵今日累计提交
parent
a96501c6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
14 deletions
+18
-14
IPressurePumpService.java
...com/yeejoin/equipmanage/service/IPressurePumpService.java
+1
-1
EmergencyServiceImpl.java
...eejoin/equipmanage/service/impl/EmergencyServiceImpl.java
+3
-2
PressurePumpServiceImpl.java
...oin/equipmanage/service/impl/PressurePumpServiceImpl.java
+11
-10
nameKeyInfo.json
...oot-system-equip/src/main/resources/json/nameKeyInfo.json
+3
-1
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/IPressurePumpService.java
View file @
b0dd3c67
...
...
@@ -134,5 +134,5 @@ public interface IPressurePumpService {
*/
Object
mapToObject
(
Map
<
String
,
String
>
map
,
Class
<?>
aClass
,
String
indexKey
)
throws
IllegalAccessException
,
InstantiationException
;
List
<
PressurePumpCountVo
>
getDayAvgDataList
(
List
<
Map
<
String
,
Object
>>
pumpInfoList
,
String
infoCode
,
String
equipmentCode
,
String
nameKey
,
String
bizOrgCode
,
long
countExpire
);
List
<
PressurePumpCountVo
>
getDayAvgDataList
(
List
<
Map
<
String
,
Object
>>
pumpInfoList
,
String
infoCode
,
String
countRedisKey
,
String
equipmentCode
,
String
nameKey
,
String
bizOrgCode
,
long
countExpire
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/EmergencyServiceImpl.java
View file @
b0dd3c67
...
...
@@ -233,6 +233,7 @@ public class EmergencyServiceImpl implements IEmergencyService {
String
pipePressureEquipmentCode
=
map
.
get
(
"pipePressureEquipmentCode"
).
toString
();
String
faultNameKey
=
map
.
get
(
"faultNameKey"
).
toString
();
String
top
=
map
.
get
(
"top"
).
toString
();
String
countRedisKey
=
map
.
get
(
"countRedisKey"
).
toString
();
long
countExpire
=
Long
.
parseLong
(
map
.
get
(
"countExpire"
).
toString
());
// 1. 判断稳压泵整体是否故障
List
<
EquipmentSpecificAlarmLog
>
alarmLogList
=
equipmentSpecificAlarmLogService
.
getAlarmLogInfoList
(
equipmentCode
,
faultNameKey
,
PressurePumpRelateEnum
.
IOT_INDEX_VALUE_TRUE
.
getValue
(),
PressurePumpRelateEnum
.
UN_CLEAN_TIME
.
getValue
(),
bizOrgCode
);
...
...
@@ -262,13 +263,13 @@ public class EmergencyServiceImpl implements IEmergencyService {
// PressurePumpAnalysisEnum.PRESSURE_PUMP_TWO.setValue(twoFrequency);
// 5. 今日启动次数,前3天启动次数的均值
// 获取稳压泵数据,redis没有,从iot取
List
<
PressurePumpCountVo
>
dayAvgDataList
=
pressurePumpService
.
getDayAvgDataList
(
pumpInfoList
,
PressurePumpRelateEnum
.
PRESSURE_PUMP
.
getValue
(),
equipmentCode
,
pressurePumpStart
,
bizOrgCode
,
countExpire
);
List
<
PressurePumpCountVo
>
dayAvgDataList
=
pressurePumpService
.
getDayAvgDataList
(
pumpInfoList
,
PressurePumpRelateEnum
.
PRESSURE_PUMP
.
getValue
(),
countRedisKey
,
equipmentCode
,
pressurePumpStart
,
bizOrgCode
,
countExpire
);
AtomicInteger
dayAvgFrequency
=
new
AtomicInteger
();
if
(!
CollectionUtils
.
isEmpty
(
dayAvgDataList
))
{
dayAvgDataList
.
forEach
(
x
->
dayAvgFrequency
.
addAndGet
(
x
.
getValue
()));
}
// int dayAvgFrequency = pressurePumpService.getAllPressurePumpStartDayAvgFrequency(Double.parseDouble(PressurePumpRelateEnum.DAY_AVG.getValue()), dataListFilterTrue, dateNow);
PressurePumpAnalysisEnum
.
PRESSURE_PUMP_DAY_AVG
.
setValue
(
dayAvgFrequency
.
get
(
));
PressurePumpAnalysisEnum
.
PRESSURE_PUMP_DAY_AVG
.
setValue
(
Math
.
round
(
dayAvgFrequency
.
get
()
/
Math
.
abs
(
Integer
.
parseInt
(
PressurePumpRelateEnum
.
DAY_AVG
.
getValue
()))
));
// 6. 管网压力状态
double
pressureDiff
=
pressurePumpService
.
getAllPressurePumpPipePressureDiff
(
dataList
,
dataPipeList
,
PressurePumpRelateEnum
.
PRESSURE_PUMP_START_BEFORE_MINUTE
.
getValue
());
PressurePumpAnalysisEnum
.
PRESSURE_PUMP_PIPE
.
setValue
(
pressureDiff
>
Double
.
parseDouble
(
PressurePumpRelateEnum
.
PIPE_PRESSURE_DIFF
.
getValue
())
?
PressurePumpRelateEnum
.
PIPE_PRESSURE_ABNORMAL_STATUS
.
getValue
()
:
PressurePumpRelateEnum
.
PIPE_PRESSURE_NORMAL_STATUS
.
getValue
());
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/PressurePumpServiceImpl.java
View file @
b0dd3c67
...
...
@@ -129,9 +129,9 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
return
list
;
}
public
List
<
PressurePumpCountVo
>
getCountDataToRedisByDateBetween
(
String
infoCode
,
String
nameKey
,
String
iotCode
,
Date
startDate
,
Date
endDate
)
{
public
List
<
PressurePumpCountVo
>
getCountDataToRedisByDateBetween
(
String
infoCode
,
String
countRedisKey
,
String
nameKey
,
String
iotCode
,
Date
startDate
,
Date
endDate
)
{
List
<
PressurePumpCountVo
>
list
=
new
ArrayList
<>();
Set
<
String
>
keys
=
redisUtils
.
getKeys
(
String
.
join
(
":"
,
infoCode
,
nameKey
,
StringUtils
.
isNotEmpty
(
iotCode
)
?
iotCode
:
""
));
Set
<
String
>
keys
=
redisUtils
.
getKeys
(
String
.
join
(
":"
,
infoCode
,
countRedisKey
,
nameKey
,
StringUtils
.
isNotEmpty
(
iotCode
)
?
iotCode
:
""
));
if
(
CollectionUtils
.
isNotEmpty
(
keys
))
{
keys
.
forEach
(
x
->
{
String
[]
split
=
x
.
split
(
":"
);
...
...
@@ -290,18 +290,18 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
}
@Override
public
List
<
PressurePumpCountVo
>
getDayAvgDataList
(
List
<
Map
<
String
,
Object
>>
pumpInfoList
,
String
infoCode
,
String
equipmentCode
,
String
nameKey
,
String
bizOrgCode
,
long
countExpire
)
{
public
List
<
PressurePumpCountVo
>
getDayAvgDataList
(
List
<
Map
<
String
,
Object
>>
pumpInfoList
,
String
infoCode
,
String
countRedisKey
,
String
equipmentCode
,
String
nameKey
,
String
bizOrgCode
,
long
countExpire
)
{
try
{
Date
dateNow
=
DateUtils
.
convertStrToDate
(
DateUtils
.
getDateNowString
(),
DateUtils
.
DATE_PATTERN
);
Date
beforeDate
=
DateUtils
.
dateAddDays
(
dateNow
,
Integer
.
parseInt
(
PressurePumpRelateEnum
.
DAY_AVG
.
getValue
()));
List
<
PressurePumpCountVo
>
dataList
=
getCountDataToRedisByDateBetween
(
PressurePumpRelateEnum
.
PRESSURE_PUMP
.
getValue
(),
nameKey
,
null
,
beforeDate
,
dateNow
);
List
<
PressurePumpCountVo
>
dataList
=
getCountDataToRedisByDateBetween
(
PressurePumpRelateEnum
.
PRESSURE_PUMP
.
getValue
(),
countRedisKey
,
nameKey
,
null
,
beforeDate
,
dateNow
);
if
(
CollectionUtils
.
isNotEmpty
(
pumpInfoList
)
&&
(
CollectionUtils
.
isEmpty
(
dataList
)
||
dataList
.
size
()
<
Math
.
abs
(
Integer
.
parseInt
(
PressurePumpRelateEnum
.
DAY_AVG
.
getValue
()))))
{
// iot获取数据,返回并存储redis
String
startTime
=
DateUtils
.
convertDateToString
(
dateNow
,
DateUtils
.
DAT
E_PATTERN
);
String
endTime
=
DateUtils
.
convertDateToString
(
beforeDate
,
DateUtils
.
DAT
E_PATTERN
);
String
startTime
=
DateUtils
.
convertDateToString
(
beforeDate
,
DateUtils
.
DATE_TIM
E_PATTERN
);
String
endTime
=
DateUtils
.
convertDateToString
(
dateNow
,
DateUtils
.
DATE_TIM
E_PATTERN
);
Object
iotCode
=
pumpInfoList
.
get
(
0
).
get
(
"iotCode"
);
String
prefix
=
ObjectUtils
.
isEmpty
(
iotCode
)
?
""
:
iotCode
.
toString
().
substring
(
0
,
8
);
dataList
=
getIotCountData
(
startTime
,
endTime
,
infoCode
,
prefix
,
null
,
PressurePumpRelateEnum
.
IOT_INDEX_VALUE_TRUE
.
getValue
(),
nameKey
,
countExpire
);
dataList
=
getIotCountData
(
startTime
,
endTime
,
infoCode
,
countRedisKey
,
prefix
,
null
,
PressurePumpRelateEnum
.
IOT_INDEX_VALUE_TRUE
.
getValue
(),
nameKey
,
countExpire
);
}
return
dataList
;
}
catch
(
ParseException
e
)
{
...
...
@@ -310,7 +310,7 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
return
Collections
.
emptyList
();
}
private
List
<
PressurePumpCountVo
>
getIotCountData
(
String
startTime
,
String
endTime
,
String
infoCode
,
String
prefix
,
String
suffix
,
String
key
,
String
fieldKey
,
long
expire
)
{
private
List
<
PressurePumpCountVo
>
getIotCountData
(
String
startTime
,
String
endTime
,
String
infoCode
,
String
countRedisKey
,
String
prefix
,
String
suffix
,
String
key
,
String
fieldKey
,
long
expire
)
{
List
<
Map
<
String
,
String
>>
dataMapList
=
getIotCommonListData
(
startTime
,
endTime
,
prefix
,
suffix
,
key
,
fieldKey
);
if
(
CollectionUtils
.
isNotEmpty
(
dataMapList
)
&&
StringUtils
.
isNotBlank
(
key
))
{
Map
<
String
,
List
<
Map
<
String
,
String
>>>
dataMap
=
dataMapList
.
stream
().
filter
(
y
->
y
.
containsKey
(
PressurePumpRelateEnum
.
CREATED_TIME
.
getValue
())
&&
y
.
get
(
fieldKey
)
!=
null
&&
key
.
equalsIgnoreCase
(
y
.
get
(
fieldKey
))).
collect
(
Collectors
.
groupingBy
(
e
->
e
.
get
(
PressurePumpRelateEnum
.
CREATED_TIME
.
getValue
()).
substring
(
0
,
10
)));
...
...
@@ -320,10 +320,11 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
for
(
String
time
:
dataMap
.
keySet
())
{
PressurePumpCountVo
countVo
=
new
PressurePumpCountVo
();
countVo
.
setTime
(
time
);
countVo
.
setValue
(
dataMap
.
get
(
key
).
size
());
countVo
.
setValue
(
dataMap
.
get
(
time
).
size
());
// 获取的数据存储到redis
String
topic
=
String
.
join
(
":"
,
infoCode
,
fieldKey
,
iotCode
,
time
);
String
topic
=
String
.
join
(
":"
,
infoCode
,
countRedisKey
,
fieldKey
,
iotCode
,
time
);
redisUtils
.
set
(
topic
,
JSON
.
toJSONString
(
countVo
),
expire
);
dataList
.
add
(
countVo
);
}
return
dataList
;
}
...
...
amos-boot-system-equip/src/main/resources/json/nameKeyInfo.json
View file @
b0dd3c67
...
...
@@ -8,6 +8,7 @@
"countExpire"
:
1209600
,
"equipmentCode"
:
"92010800KAL44"
,
"pipePressureEquipmentCode"
:
"92011000T5Q44"
,
"top"
:
"100"
"top"
:
"100"
,
"countRedisKey"
:
"Count"
}
]
\ No newline at end of file
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