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
41e750af
Commit
41e750af
authored
Oct 16, 2023
by
litengwei
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
67f763da
717cac69
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
111 additions
and
86 deletions
+111
-86
KsolarDataAcquisitionServiceImpl.java
...i/face/service/impl/KsolarDataAcquisitionServiceImpl.java
+1
-1
HealthStatusIndicatorServiceImpl.java
...op/biz/service/impl/HealthStatusIndicatorServiceImpl.java
+110
-85
No files found.
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/impl/KsolarDataAcquisitionServiceImpl.java
View file @
41e750af
...
...
@@ -168,7 +168,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
jpStation
.
setThirdCode
(
PVProducerInfoEnum
.
KSOLAR
.
getCode
());
// 业主姓名
jpStation
.
setUserName
(
ksolarStation
.
getUserName
());
jpStation
.
setState
(
KSolarConstant
.
station
Staus
.
get
(
String
.
valueOf
(
ksolarStation
.
getStatus
())));
jpStation
.
setState
(
KSolarConstant
.
collect
Staus
.
get
(
String
.
valueOf
(
ksolarStation
.
getStatus
())));
jpStation
.
setRealTimePower
(
ksolarStation
.
getPowerInter
());
jpStation
.
setDayGenerate
(
ksolarStation
.
getDayGeneration
()
*
KSolarConstant
.
kwhToMwh
);
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/HealthStatusIndicatorServiceImpl.java
View file @
41e750af
...
...
@@ -44,6 +44,11 @@ public class HealthStatusIndicatorServiceImpl {
@Autowired
IdxBizFanWarningRecordMapper
idxBizFanWarningRecordMapper
;
@Autowired
IdxBizPvWarningRecordServiceImpl
idxBizPvWarningRecordService
;
@Autowired
IdxBizFanWarningRecordServiceImpl
idxBizFanWarningRecordService
;
/***
* 每一小时获取一次最大粒度内的指数异常数据
* 判断一小时内数据是否符合预警规则 符合则报警并在redis中缓存 同一级别的预警记录下次不生成
...
...
@@ -81,25 +86,26 @@ public class HealthStatusIndicatorServiceImpl {
wrapper
.
ge
(
IdxBizPvHealthIndex:
:
getRecDate
,
df
.
format
(
calendar
.
getTime
()));
wrapper
.
orderByDesc
(
IdxBizPvHealthIndex:
:
getRecDate
);
List
<
IdxBizPvHealthIndex
>
healthIndices
=
idxBizPvHealthIndexMapper
.
selectList
(
wrapper
);
List
<
String
>
collect
=
healthIndices
.
stream
().
map
(
IdxBizPvHealthIndex:
:
getAnalysisObjSeq
).
collect
(
Collectors
.
toList
());
if
(
null
==
healthIndices
){
return
;
}
LambdaQueryWrapper
<
IdxBizPvWarningRuleSet
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
IdxBizPvWarningRuleSet:
:
getAnalysisType
,
"按时刻"
);
queryWrapper
.
in
(
IdxBizPvWarningRuleSet:
:
getAnalysisPointId
,
collect
);
List
<
IdxBizPvWarningRuleSet
>
idxBizPvWarningRules
=
idxBizPvWarningRuleSetMapper
.
selectList
(
queryWrapper
);
Map
<
String
,
Map
<
String
,
List
<
IdxBizPvHealthIndex
>>>
gateWayMaps
=
healthIndices
.
stream
().
collect
(
Collectors
.
groupingBy
(
IdxBizPvHealthIndex:
:
getGatewayId
,
Collectors
.
groupingBy
(
IdxBizPvHealthIndex:
:
getIndexAddress
)));
List
<
IdxBizPvWarningRecord
>
idxBizPvWarningRecordList
=
new
ArrayList
<>();
for
(
String
gateWayId
:
gateWayMaps
.
keySet
())
{
Map
<
String
,
List
<
IdxBizPvHealthIndex
>>
healthDataMaps
=
gateWayMaps
.
get
(
gateWayId
);
for
(
String
address
:
healthDataMaps
.
keySet
())
{
List
<
IdxBizPvHealthIndex
>
idxBizPvHealthIndices
=
healthDataMaps
.
get
(
address
);
LambdaQueryWrapper
<
IdxBizPvWarningRuleSet
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
IdxBizPvWarningRuleSet:
:
getAnalysisType
,
"按时刻"
);
queryWrapper
.
eq
(
IdxBizPvWarningRuleSet:
:
getAnalysisPointId
,
idxBizPvHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
List
<
IdxBizPvWarningRuleSet
>
idxBizPvWarningRuleSets
=
idxBizPvWarningRuleSetMapper
.
selectList
(
queryWrapper
);
List
<
IdxBizPvWarningRuleSet
>
idxBizPvWarningRuleSets
=
idxBizPvWarningRules
.
stream
().
filter
(
t
->
t
.
getAnalysisPointId
().
equals
(
idxBizPvHealthIndices
.
get
(
0
).
getAnalysisObjSeq
())).
collect
(
Collectors
.
toList
());
if
(
ObjectUtils
.
isEmpty
(
idxBizPvWarningRuleSets
)
){
continue
;
}
Double
healthValueWarn
=
0.0
;
Double
healthValueRisk
=
0.0
;
Double
healthValueNotice
=
0.0
;
...
...
@@ -138,17 +144,17 @@ public class HealthStatusIndicatorServiceImpl {
String
content
=
""
;
String
num
=
""
;
content
=
healthValueMinCount
*
10
+
"分钟"
;
if
(
riskNum
>=
healthValueMinCount
&&
!
redisUtils
.
hasKey
(
gateWayId
+
"_"
+
address
+
"_health_risk_minute"
)
){
redisUtils
.
set
(
gateWayId
+
"_"
+
address
+
"_health_risk_minute"
,
"risk"
);
if
(
riskNum
>=
healthValueMinCount
){
//
redisUtils.set(gateWayId+"_"+address+"_health_risk_minute","risk");
level
=
"危险"
;
num
=
""
+
healthValueRisk
;
}
else
if
(
warnNum
>=
healthValueMinCount
&&
!
redisUtils
.
hasKey
(
gateWayId
+
"_"
+
address
+
"_health_warn_minute"
)
){
redisUtils
.
set
(
gateWayId
+
"_"
+
address
+
"_health_warn_minute"
,
"warn"
);
}
else
if
(
warnNum
>=
healthValueMinCount
){
//
redisUtils.set(gateWayId+"_"+address+"_health_warn_minute","warn");
level
=
"警告"
;
num
=
""
+
healthValueWarn
;
}
else
if
(
noticeNum
>=
healthValueMinCount
&&
!
redisUtils
.
hasKey
(
gateWayId
+
"_"
+
address
+
"_health_notice_minute"
)
){
redisUtils
.
set
(
gateWayId
+
"_"
+
address
+
"_health_notice_minute"
,
"notice"
);
}
else
if
(
noticeNum
>=
healthValueMinCount
){
//
redisUtils.set(gateWayId+"_"+address+"_health_notice_minute","notice");
level
=
"注意"
;
num
=
""
+
healthValueNotice
;
}
...
...
@@ -180,10 +186,12 @@ public class HealthStatusIndicatorServiceImpl {
idxBizPvWarningRecord
.
setPointName
(
idxBizPvHealthIndices
.
get
(
0
).
getPointName
());
idxBizPvWarningRecord
.
setHealthIndexSeq
(
idxBizPvHealthIndices
.
get
(
0
).
getHealthIndex
().
toString
());
idxBizPvWarningRecord
.
setHealthLevel
(
idxBizPvHealthIndices
.
get
(
0
).
getHealthLevel
());
idxBizPvWarningRecordMapper
.
insert
(
idxBizPvWarningRecord
);
idxBizPvWarningRecordList
.
add
(
idxBizPvWarningRecord
);
// idxBizPvWarningRecordMapper.insert(idxBizPvWarningRecord);
}
}
}
idxBizPvWarningRecordService
.
saveBatch
(
idxBizPvWarningRecordList
);
}
/***
...
...
@@ -205,24 +213,23 @@ public class HealthStatusIndicatorServiceImpl {
wrapper
.
ge
(
IdxBizPvHealthIndex:
:
getRecDate
,
df
.
format
(
calendar
.
getTime
()));
wrapper
.
orderByDesc
(
IdxBizPvHealthIndex:
:
getRecDate
);
List
<
IdxBizPvHealthIndex
>
healthIndices
=
idxBizPvHealthIndexMapper
.
selectList
(
wrapper
);
List
<
String
>
collect
=
healthIndices
.
stream
().
map
(
IdxBizPvHealthIndex:
:
getAnalysisObjSeq
).
collect
(
Collectors
.
toList
());
if
(
null
==
healthIndices
){
return
;
}
LambdaQueryWrapper
<
IdxBizPvWarningRuleSet
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
IdxBizPvWarningRuleSet:
:
getAnalysisType
,
"按小时"
);
queryWrapper
.
in
(
IdxBizPvWarningRuleSet:
:
getAnalysisPointId
,
collect
);
List
<
IdxBizPvWarningRuleSet
>
idxBizPvWarningRules
=
idxBizPvWarningRuleSetMapper
.
selectList
(
queryWrapper
);
Map
<
String
,
Map
<
String
,
List
<
IdxBizPvHealthIndex
>>>
gateWayMaps
=
healthIndices
.
stream
().
collect
(
Collectors
.
groupingBy
(
IdxBizPvHealthIndex:
:
getGatewayId
,
Collectors
.
groupingBy
(
IdxBizPvHealthIndex:
:
getIndexAddress
)));
List
<
IdxBizPvWarningRecord
>
idxBizPvWarningRecordList
=
new
ArrayList
<>();
for
(
String
gateWayId
:
gateWayMaps
.
keySet
())
{
Map
<
String
,
List
<
IdxBizPvHealthIndex
>>
healthDataMaps
=
gateWayMaps
.
get
(
gateWayId
);
for
(
String
address
:
healthDataMaps
.
keySet
())
{
List
<
IdxBizPvHealthIndex
>
idxBizPvHealthIndices
=
healthDataMaps
.
get
(
address
);
LambdaQueryWrapper
<
IdxBizPvWarningRuleSet
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
IdxBizPvWarningRuleSet:
:
getAnalysisType
,
"按小时"
);
queryWrapper
.
eq
(
IdxBizPvWarningRuleSet:
:
getAnalysisPointId
,
idxBizPvHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
List
<
IdxBizPvWarningRuleSet
>
idxBizPvWarningRuleSets
=
idxBizPvWarningRuleSetMapper
.
selectList
(
queryWrapper
);
List
<
IdxBizPvWarningRuleSet
>
idxBizPvWarningRuleSets
=
idxBizPvWarningRules
.
stream
().
filter
(
t
->
t
.
getAnalysisPointId
().
equals
(
idxBizPvHealthIndices
.
get
(
0
).
getAnalysisObjSeq
())).
collect
(
Collectors
.
toList
());
if
(
ObjectUtils
.
isEmpty
(
idxBizPvWarningRuleSets
)
){
continue
;
}
...
...
@@ -266,17 +273,17 @@ public class HealthStatusIndicatorServiceImpl {
String
content
=
""
;
String
num
=
""
;
content
=
healthValueHourCount
+
"小时"
;
if
(
riskNum
>=
healthValueHourCount
&&
!
redisUtils
.
hasKey
(
gateWayId
+
"_"
+
address
+
"_health_risk_hour"
)
){
redisUtils
.
set
(
gateWayId
+
"_"
+
address
+
"_health_risk_hour"
,
"risk"
);
if
(
riskNum
>=
healthValueHourCount
){
level
=
"危险"
;
num
=
""
+
healthValueRisk
;
}
else
if
(
warnNum
>=
healthValueHourCount
&&
!
redisUtils
.
hasKey
(
gateWayId
+
"_"
+
address
+
"_health_risk_hour"
)
){
redisUtils
.
set
(
gateWayId
+
"_"
+
address
+
"_health_warn_hour"
,
"warn"
);
}
else
if
(
warnNum
>=
healthValueHourCount
){
level
=
"警告"
;
num
=
""
+
healthValueWarn
;
}
else
if
(
noticeNum
>=
healthValueHourCount
&&
!
redisUtils
.
hasKey
(
gateWayId
+
"_"
+
address
+
"_health_notice_hour"
)
){
redisUtils
.
set
(
gateWayId
+
"_"
+
address
+
"_health_notice_hour"
,
"notice"
);
}
else
if
(
noticeNum
>=
healthValueHourCount
){
level
=
"注意"
;
num
=
""
+
healthValueNotice
;
...
...
@@ -309,10 +316,12 @@ public class HealthStatusIndicatorServiceImpl {
idxBizPvWarningRecord
.
setPointName
(
idxBizPvHealthIndices
.
get
(
0
).
getPointName
());
idxBizPvWarningRecord
.
setHealthIndexSeq
(
idxBizPvHealthIndices
.
get
(
0
).
getHealthIndex
().
toString
());
idxBizPvWarningRecord
.
setHealthLevel
(
idxBizPvHealthIndices
.
get
(
0
).
getHealthLevel
());
idxBizPvWarningRecordMapper
.
insert
(
idxBizPvWarningRecord
);
idxBizPvWarningRecordList
.
add
(
idxBizPvWarningRecord
);
//idxBizPvWarningRecordMapper.insert(idxBizPvWarningRecord);
}
}
}
idxBizPvWarningRecordService
.
saveBatch
(
idxBizPvWarningRecordList
);
}
/***
...
...
@@ -335,28 +344,25 @@ public class HealthStatusIndicatorServiceImpl {
wrapper
.
orderByDesc
(
IdxBizPvHealthIndex:
:
getRecDate
);
List
<
IdxBizPvHealthIndex
>
healthIndices
=
idxBizPvHealthIndexMapper
.
selectList
(
wrapper
);
if
(
null
==
healthIndices
){
return
;
}
List
<
String
>
collect
=
healthIndices
.
stream
().
map
(
IdxBizPvHealthIndex:
:
getAnalysisObjSeq
).
collect
(
Collectors
.
toList
());
LambdaQueryWrapper
<
IdxBizPvWarningRuleSet
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
IdxBizPvWarningRuleSet:
:
getAnalysisType
,
"按天"
);
queryWrapper
.
in
(
IdxBizPvWarningRuleSet:
:
getAnalysisPointId
,
collect
);
List
<
IdxBizPvWarningRuleSet
>
idxBizPvWarningRules
=
idxBizPvWarningRuleSetMapper
.
selectList
(
queryWrapper
);
Map
<
String
,
Map
<
String
,
List
<
IdxBizPvHealthIndex
>>>
gateWayMaps
=
healthIndices
.
stream
().
collect
(
Collectors
.
groupingBy
(
IdxBizPvHealthIndex:
:
getGatewayId
,
Collectors
.
groupingBy
(
IdxBizPvHealthIndex:
:
getIndexAddress
)));
List
<
IdxBizPvWarningRecord
>
idxBizPvWarningRecordList
=
new
ArrayList
<>();
for
(
String
gateWayId
:
gateWayMaps
.
keySet
())
{
Map
<
String
,
List
<
IdxBizPvHealthIndex
>>
healthDataMaps
=
gateWayMaps
.
get
(
gateWayId
);
for
(
String
address
:
healthDataMaps
.
keySet
())
{
List
<
IdxBizPvHealthIndex
>
idxBizPvHealthIndices
=
healthDataMaps
.
get
(
address
);
LambdaQueryWrapper
<
IdxBizPvWarningRuleSet
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
IdxBizPvWarningRuleSet:
:
getAnalysisType
,
"按天"
);
queryWrapper
.
eq
(
IdxBizPvWarningRuleSet:
:
getAnalysisPointId
,
idxBizPvHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
List
<
IdxBizPvWarningRuleSet
>
idxBizPvWarningRuleSets
=
idxBizPvWarningRuleSetMapper
.
selectList
(
queryWrapper
);
List
<
IdxBizPvWarningRuleSet
>
idxBizPvWarningRuleSets
=
idxBizPvWarningRules
.
stream
().
filter
(
t
->
t
.
getAnalysisPointId
().
equals
(
idxBizPvHealthIndices
.
get
(
0
).
getAnalysisObjSeq
())).
collect
(
Collectors
.
toList
());
if
(
ObjectUtils
.
isEmpty
(
idxBizPvWarningRuleSets
)
){
continue
;
}
Double
healthValueWarn
=
0.0
;
Double
healthValueRisk
=
0.0
;
Double
healthValueNotice
=
0.0
;
...
...
@@ -395,16 +401,16 @@ public class HealthStatusIndicatorServiceImpl {
String
content
=
""
;
String
num
=
""
;
content
=
healthValueDayCount
+
"天"
;
if
(
riskNum
>=
healthValueDayCount
&&
!
redisUtils
.
hasKey
(
gateWayId
+
"_"
+
address
+
"_health_risk_day"
)
){
redisUtils
.
set
(
gateWayId
+
"_"
+
address
+
"_health_risk_day"
,
"risk"
);
if
(
riskNum
>=
healthValueDayCount
){
//
redisUtils.set(gateWayId+"_"+address+"_health_risk_day","risk");
level
=
"危险"
;
num
=
""
+
healthValueRisk
;
}
else
if
(
warnNum
>=
healthValueDayCount
&&
!
redisUtils
.
hasKey
(
gateWayId
+
"_"
+
address
+
"_health_warn_day"
)
){
redisUtils
.
set
(
gateWayId
+
"_"
+
address
+
"_health_warn_day"
,
"warn"
);
}
else
if
(
warnNum
>=
healthValueDayCount
){
//
redisUtils.set(gateWayId+"_"+address+"_health_warn_day","warn");
level
=
"警告"
;
num
=
""
+
healthValueWarn
;
}
else
if
(
noticeNum
>=
healthValueDayCount
&&
!
redisUtils
.
hasKey
(
gateWayId
+
"_"
+
address
+
"_health_notice_day"
)
){
redisUtils
.
set
(
gateWayId
+
"_"
+
address
+
"_health_notice_day"
,
"notice"
);
}
else
if
(
noticeNum
>=
healthValueDayCount
){
//
redisUtils.set(gateWayId+"_"+address+"_health_notice_day","notice");
level
=
"注意"
;
num
=
""
+
healthValueNotice
;
}
...
...
@@ -436,11 +442,12 @@ public class HealthStatusIndicatorServiceImpl {
idxBizPvWarningRecord
.
setPointName
(
idxBizPvHealthIndices
.
get
(
0
).
getPointName
());
idxBizPvWarningRecord
.
setHealthIndexSeq
(
idxBizPvHealthIndices
.
get
(
0
).
getHealthIndex
().
toString
());
idxBizPvWarningRecord
.
setHealthLevel
(
idxBizPvHealthIndices
.
get
(
0
).
getHealthLevel
());
idxBizPvWarningRecordMapper
.
insert
(
idxBizPvWarningRecord
);
idxBizPvWarningRecordList
.
add
(
idxBizPvWarningRecord
);
//
idxBizPvWarningRecordMapper.insert(idxBizPvWarningRecord);
}
}
}
idxBizPvWarningRecordService
.
saveBatch
(
idxBizPvWarningRecordList
);
}
...
...
@@ -461,18 +468,22 @@ public class HealthStatusIndicatorServiceImpl {
if
(
ObjectUtils
.
isEmpty
(
healthIndices
)){
return
;
}
List
<
String
>
collect
=
healthIndices
.
stream
().
map
(
IdxBizFanHealthIndex:
:
getAnalysisObjSeq
).
collect
(
Collectors
.
toList
());
LambdaQueryWrapper
<
IdxBizFanWarningRuleSet
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
IdxBizFanWarningRuleSet:
:
getAnalysisType
,
"按时刻"
);
queryWrapper
.
in
(
IdxBizFanWarningRuleSet:
:
getAnalysisPointId
,
collect
);
List
<
IdxBizFanWarningRuleSet
>
idxBizPvWarningRules
=
idxBizFanWarningRuleSetMapper
.
selectList
(
queryWrapper
);
Map
<
String
,
Map
<
String
,
List
<
IdxBizFanHealthIndex
>>>
gateWayMaps
=
healthIndices
.
stream
().
collect
(
Collectors
.
groupingBy
(
IdxBizFanHealthIndex:
:
getGatewayId
,
Collectors
.
groupingBy
(
IdxBizFanHealthIndex:
:
getIndexAddress
)));
List
<
IdxBizFanWarningRecord
>
idxBizFanWarningRecordList
=
new
ArrayList
<>();
for
(
String
gateWayId
:
gateWayMaps
.
keySet
())
{
Map
<
String
,
List
<
IdxBizFanHealthIndex
>>
healthDataMaps
=
gateWayMaps
.
get
(
gateWayId
);
for
(
String
address
:
healthDataMaps
.
keySet
())
{
List
<
IdxBizFanHealthIndex
>
idxBizFanHealthIndices
=
healthDataMaps
.
get
(
address
);
LambdaQueryWrapper
<
IdxBizFanWarningRuleSet
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
IdxBizFanWarningRuleSet:
:
getAnalysisType
,
"按时刻"
);
queryWrapper
.
eq
(
IdxBizFanWarningRuleSet:
:
getAnalysisPointId
,
idxBizFanHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
List
<
IdxBizFanWarningRuleSet
>
idxBizPvWarningRuleSets
=
idxBizFanWarningRuleSetMapper
.
selectList
(
queryWrapper
);
List
<
IdxBizFanWarningRuleSet
>
idxBizPvWarningRuleSets
=
idxBizPvWarningRules
.
stream
().
filter
(
t
->
t
.
getAnalysisPointId
().
equals
(
idxBizFanHealthIndices
.
get
(
0
).
getAnalysisObjSeq
())).
collect
(
Collectors
.
toList
());
if
(
ObjectUtils
.
isEmpty
(
idxBizPvWarningRuleSets
)
){
continue
;
...
...
@@ -519,17 +530,17 @@ public class HealthStatusIndicatorServiceImpl {
String
content
=
""
;
String
num
=
""
;
content
=
healthValueMinCount
*
10
+
"分钟"
;
if
(
riskNum
>=
healthValueMinCount
&&
!
redisUtils
.
hasKey
(
gateWayId
+
"_"
+
address
+
"_health_risk_minute"
)
){
redisUtils
.
set
(
gateWayId
+
"_"
+
address
+
"_health_risk_minute"
,
"risk"
);
if
(
riskNum
>=
healthValueMinCount
){
//
redisUtils.set(gateWayId+"_"+address+"_health_risk_minute","risk");
level
=
"危险"
;
num
=
""
+
healthValueRisk
;
}
else
if
(
warnNum
>=
healthValueMinCount
&&
!
redisUtils
.
hasKey
(
gateWayId
+
"_"
+
address
+
"_health_warn_minute"
)
){
redisUtils
.
set
(
gateWayId
+
"_"
+
address
+
"_health_warn_minute"
,
"warn"
);
}
else
if
(
warnNum
>=
healthValueMinCount
){
//
redisUtils.set(gateWayId+"_"+address+"_health_warn_minute","warn");
level
=
"警告"
;
num
=
""
+
healthValueWarn
;
}
else
if
(
noticeNum
>=
healthValueMinCount
&&
!
redisUtils
.
hasKey
(
gateWayId
+
"_"
+
address
+
"_health_notice_minute"
)
){
redisUtils
.
set
(
gateWayId
+
"_"
+
address
+
"_health_notice_minute"
,
"notice"
);
}
else
if
(
noticeNum
>=
healthValueMinCount
){
//
redisUtils.set(gateWayId+"_"+address+"_health_notice_minute","notice");
level
=
"注意"
;
num
=
""
+
healthValueNotice
;
}
...
...
@@ -561,10 +572,12 @@ public class HealthStatusIndicatorServiceImpl {
idxBizFanWarningRecord
.
setPointName
(
idxBizFanHealthIndices
.
get
(
0
).
getPointName
());
idxBizFanWarningRecord
.
setHealthIndexSeq
(
idxBizFanHealthIndices
.
get
(
0
).
getHealthIndex
().
toString
());
idxBizFanWarningRecord
.
setHealthLevel
(
idxBizFanHealthIndices
.
get
(
0
).
getHealthLevel
());
idxBizFanWarningRecordMapper
.
insert
(
idxBizFanWarningRecord
);
idxBizFanWarningRecordList
.
add
(
idxBizFanWarningRecord
);
//idxBizFanWarningRecordMapper.insert(idxBizFanWarningRecord);
}
}
}
idxBizFanWarningRecordService
.
saveBatch
(
idxBizFanWarningRecordList
);
}
/***
...
...
@@ -586,20 +599,24 @@ public class HealthStatusIndicatorServiceImpl {
wrapper
.
ge
(
IdxBizFanHealthIndex:
:
getRecDate
,
df
.
format
(
calendar
.
getTime
()));
wrapper
.
orderByDesc
(
IdxBizFanHealthIndex:
:
getRecDate
);
List
<
IdxBizFanHealthIndex
>
healthIndices
=
idxBizFanHealthIndexMapper
.
selectList
(
wrapper
);
if
(
ObjectUtils
.
isEmpty
(
healthIndices
)){
return
;
}
List
<
String
>
collect
=
healthIndices
.
stream
().
map
(
IdxBizFanHealthIndex:
:
getAnalysisObjSeq
).
collect
(
Collectors
.
toList
());
LambdaQueryWrapper
<
IdxBizFanWarningRuleSet
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
IdxBizFanWarningRuleSet:
:
getAnalysisType
,
"小时"
);
queryWrapper
.
in
(
IdxBizFanWarningRuleSet:
:
getAnalysisPointId
,
collect
);
List
<
IdxBizFanWarningRuleSet
>
idxBizPvWarningRules
=
idxBizFanWarningRuleSetMapper
.
selectList
(
queryWrapper
);
Map
<
String
,
Map
<
String
,
List
<
IdxBizFanHealthIndex
>>>
gateWayMaps
=
healthIndices
.
stream
().
collect
(
Collectors
.
groupingBy
(
IdxBizFanHealthIndex:
:
getGatewayId
,
Collectors
.
groupingBy
(
IdxBizFanHealthIndex:
:
getIndexAddress
)));
List
<
IdxBizFanWarningRecord
>
idxBizFanWarningRecordList
=
new
ArrayList
<>();
for
(
String
gateWayId
:
gateWayMaps
.
keySet
())
{
Map
<
String
,
List
<
IdxBizFanHealthIndex
>>
healthDataMaps
=
gateWayMaps
.
get
(
gateWayId
);
for
(
String
address
:
healthDataMaps
.
keySet
())
{
List
<
IdxBizFanHealthIndex
>
idxBizFanHealthIndices
=
healthDataMaps
.
get
(
address
);
LambdaQueryWrapper
<
IdxBizFanWarningRuleSet
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
IdxBizFanWarningRuleSet:
:
getAnalysisType
,
"按小时"
);
queryWrapper
.
eq
(
IdxBizFanWarningRuleSet:
:
getAnalysisPointId
,
idxBizFanHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
List
<
IdxBizFanWarningRuleSet
>
idxBizPvWarningRuleSets
=
idxBizFanWarningRuleSetMapper
.
selectList
(
queryWrapper
);
List
<
IdxBizFanWarningRuleSet
>
idxBizPvWarningRuleSets
=
idxBizPvWarningRules
.
stream
().
filter
(
t
->
t
.
getAnalysisPointId
().
equals
(
idxBizFanHealthIndices
.
get
(
0
).
getAnalysisObjSeq
())).
collect
(
Collectors
.
toList
());
if
(
ObjectUtils
.
isEmpty
(
idxBizPvWarningRuleSets
)
){
continue
;
...
...
@@ -644,17 +661,17 @@ public class HealthStatusIndicatorServiceImpl {
String
content
=
""
;
String
num
=
""
;
content
=
healthValueHourCount
+
"小时"
;
if
(
riskNum
>=
healthValueHourCount
&&
!
redisUtils
.
hasKey
(
gateWayId
+
"_"
+
address
+
"_health_risk_hour"
)
){
redisUtils
.
set
(
gateWayId
+
"_"
+
address
+
"_health_risk_hour"
,
"risk"
);
if
(
riskNum
>=
healthValueHourCount
){
level
=
"危险"
;
num
=
""
+
healthValueRisk
;
}
else
if
(
warnNum
>=
healthValueHourCount
&&
!
redisUtils
.
hasKey
(
gateWayId
+
"_"
+
address
+
"_health_risk_hour"
)
){
redisUtils
.
set
(
gateWayId
+
"_"
+
address
+
"_health_warn_hour"
,
"warn"
);
}
else
if
(
warnNum
>=
healthValueHourCount
){
level
=
"警告"
;
num
=
""
+
healthValueWarn
;
}
else
if
(
noticeNum
>=
healthValueHourCount
&&
!
redisUtils
.
hasKey
(
gateWayId
+
"_"
+
address
+
"_health_notice_hour"
)
){
redisUtils
.
set
(
gateWayId
+
"_"
+
address
+
"_health_notice_hour"
,
"notice"
);
}
else
if
(
noticeNum
>=
healthValueHourCount
){
level
=
"注意"
;
num
=
""
+
healthValueNotice
;
...
...
@@ -686,10 +703,12 @@ public class HealthStatusIndicatorServiceImpl {
idxBizFanWarningRecord
.
setHealthIndexSeq
(
idxBizFanHealthIndices
.
get
(
0
).
getHealthIndex
().
toString
());
idxBizFanWarningRecord
.
setHealthLevel
(
idxBizFanHealthIndices
.
get
(
0
).
getHealthLevel
());
idxBizFanWarningRecord
.
setPointName
(
idxBizFanHealthIndices
.
get
(
0
).
getPointName
());
idxBizFanWarningRecordMapper
.
insert
(
idxBizFanWarningRecord
);
idxBizFanWarningRecordList
.
add
(
idxBizFanWarningRecord
);
}
}
}
idxBizFanWarningRecordService
.
saveBatch
(
idxBizFanWarningRecordList
);
}
/***
...
...
@@ -714,16 +733,21 @@ public class HealthStatusIndicatorServiceImpl {
if
(
ObjectUtils
.
isEmpty
(
healthIndices
)){
return
;
}
List
<
String
>
collect
=
healthIndices
.
stream
().
map
(
IdxBizFanHealthIndex:
:
getAnalysisObjSeq
).
collect
(
Collectors
.
toList
());
LambdaQueryWrapper
<
IdxBizFanWarningRuleSet
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
IdxBizFanWarningRuleSet:
:
getAnalysisType
,
"按天"
);
queryWrapper
.
in
(
IdxBizFanWarningRuleSet:
:
getAnalysisPointId
,
collect
);
List
<
IdxBizFanWarningRuleSet
>
idxBizPvWarningRules
=
idxBizFanWarningRuleSetMapper
.
selectList
(
queryWrapper
);
Map
<
String
,
Map
<
String
,
List
<
IdxBizFanHealthIndex
>>>
gateWayMaps
=
healthIndices
.
stream
().
collect
(
Collectors
.
groupingBy
(
IdxBizFanHealthIndex:
:
getGatewayId
,
Collectors
.
groupingBy
(
IdxBizFanHealthIndex:
:
getIndexAddress
)));
List
<
IdxBizFanWarningRecord
>
idxBizFanWarningRecordList
=
new
ArrayList
<>();
for
(
String
gateWayId
:
gateWayMaps
.
keySet
())
{
Map
<
String
,
List
<
IdxBizFanHealthIndex
>>
healthDataMaps
=
gateWayMaps
.
get
(
gateWayId
);
for
(
String
address
:
healthDataMaps
.
keySet
())
{
List
<
IdxBizFanHealthIndex
>
idxBizFanHealthIndices
=
healthDataMaps
.
get
(
address
);
LambdaQueryWrapper
<
IdxBizFanWarningRuleSet
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
IdxBizFanWarningRuleSet:
:
getAnalysisType
,
"按天"
);
queryWrapper
.
eq
(
IdxBizFanWarningRuleSet:
:
getAnalysisPointId
,
idxBizFanHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
List
<
IdxBizFanWarningRuleSet
>
idxBizPvWarningRuleSets
=
idxBizFanWarningRuleSetMapper
.
selectList
(
queryWrapper
);
List
<
IdxBizFanWarningRuleSet
>
idxBizPvWarningRuleSets
=
idxBizPvWarningRules
.
stream
().
filter
(
t
->
t
.
getAnalysisPointId
().
equals
(
idxBizFanHealthIndices
.
get
(
0
).
getAnalysisObjSeq
())).
collect
(
Collectors
.
toList
());
if
(
ObjectUtils
.
isEmpty
(
idxBizPvWarningRuleSets
)
){
continue
;
...
...
@@ -768,16 +792,16 @@ public class HealthStatusIndicatorServiceImpl {
String
content
=
""
;
String
num
=
""
;
content
=
healthValueDayCount
+
"天"
;
if
(
riskNum
>=
healthValueDayCount
&&
!
redisUtils
.
hasKey
(
gateWayId
+
"_"
+
address
+
"_health_risk_day"
)
){
redisUtils
.
set
(
gateWayId
+
"_"
+
address
+
"_health_risk_day"
,
"risk"
);
if
(
riskNum
>=
healthValueDayCount
){
//
redisUtils.set(gateWayId+"_"+address+"_health_risk_day","risk");
level
=
"危险"
;
num
=
""
+
healthValueRisk
;
}
else
if
(
warnNum
>=
healthValueDayCount
&&
!
redisUtils
.
hasKey
(
gateWayId
+
"_"
+
address
+
"_health_warn_day"
)
){
redisUtils
.
set
(
gateWayId
+
"_"
+
address
+
"_health_warn_day"
,
"warn"
);
}
else
if
(
warnNum
>=
healthValueDayCount
){
//
redisUtils.set(gateWayId+"_"+address+"_health_warn_day","warn");
level
=
"警告"
;
num
=
""
+
healthValueWarn
;
}
else
if
(
noticeNum
>=
healthValueDayCount
&&
!
redisUtils
.
hasKey
(
gateWayId
+
"_"
+
address
+
"_health_notice_day"
)
){
redisUtils
.
set
(
gateWayId
+
"_"
+
address
+
"_health_notice_day"
,
"notice"
);
}
else
if
(
noticeNum
>=
healthValueDayCount
){
//
redisUtils.set(gateWayId+"_"+address+"_health_notice_day","notice");
level
=
"注意"
;
num
=
""
+
healthValueNotice
;
}
...
...
@@ -789,7 +813,6 @@ public class HealthStatusIndicatorServiceImpl {
List
<
IdxBizFanWarningRecord
>
idxBizFanWarningRecords
=
idxBizFanWarningRecordMapper
.
selectList
(
query
);
int
flag
=
ObjectUtils
.
isEmpty
(
idxBizFanWarningRecords
)
||
WarningNameEnum
.
getCode
(
level
)
>
WarningNameEnum
.
getCode
(
idxBizFanWarningRecords
.
get
(
0
).
getWarningName
())
?
0
:
1
;
if
(!
level
.
equals
(
""
)
&&
flag
==
0
){
IdxBizFanWarningRecord
idxBizFanWarningRecord
=
new
IdxBizFanWarningRecord
();
idxBizFanWarningRecord
.
setRecord
(
idxBizFanHealthIndices
.
get
(
0
).
getRecord
());
...
...
@@ -809,10 +832,12 @@ public class HealthStatusIndicatorServiceImpl {
idxBizFanWarningRecord
.
setHealthIndexSeq
(
idxBizFanHealthIndices
.
get
(
0
).
getHealthIndex
().
toString
());
idxBizFanWarningRecord
.
setHealthLevel
(
idxBizFanHealthIndices
.
get
(
0
).
getHealthLevel
());
idxBizFanWarningRecord
.
setPointName
(
idxBizFanHealthIndices
.
get
(
0
).
getPointName
());
idxBizFanWarningRecord
Mapper
.
insert
(
idxBizFanWarningRecord
);
idxBizFanWarningRecord
List
.
add
(
idxBizFanWarningRecord
);
}
}
}
idxBizFanWarningRecordService
.
saveBatch
(
idxBizFanWarningRecordList
);
}
}
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