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
51444a13
Commit
51444a13
authored
Sep 26, 2023
by
chenzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改预警规则
parent
f84ef9ab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
274 additions
and
41 deletions
+274
-41
HealthStatusIndicatorServiceImpl.java
...op/biz/service/impl/HealthStatusIndicatorServiceImpl.java
+274
-41
No files found.
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 @
51444a13
...
...
@@ -7,27 +7,30 @@ import com.yeejoin.amos.boot.module.jxiop.biz.entity.*;
import
com.yeejoin.amos.boot.module.jxiop.biz.mapper2.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@EnableScheduling
@Service
public
class
HealthStatusIndicatorServiceImpl
{
@Value
(
"${healthValue_Warn}"
)
Double
healthValueWarn
;
@Value
(
"${healthValue_Risk}"
)
Double
healthValueRisk
;
@Value
(
"${healthValue_Notice}"
)
Double
healthValueNotice
;
//
@Value("${healthValue_Warn}")
//
Double healthValueWarn;
//
@Value("${healthValue_Risk}")
//
Double healthValueRisk;
//
@Value("${healthValue_Notice}")
//
Double healthValueNotice;
@Value
(
"${healthValue_DayCount}"
)
long
healthValueDayCount
;
@Value
(
"${healthValue_HourCount}"
)
long
healthValueHourCount
;
@Value
(
"${healthValue_MinCount}"
)
long
healthValueMinCount
;
//
@Value("${healthValue_DayCount}")
//
long healthValueDayCount;
//
@Value("${healthValue_HourCount}")
//
long healthValueHourCount;
//
@Value("${healthValue_MinCount}")
//
long healthValueMinCount;
@Autowired
private
RedisUtils
redisUtils
;
...
...
@@ -48,6 +51,10 @@ public class HealthStatusIndicatorServiceImpl {
@Autowired
IdxBizPvHealthIndexMapper
idxBizPvHealthIndexMapper
;
@Autowired
IdxBizPvWarningRuleSetMapper
idxBizPvWarningRuleSetMapper
;
@Autowired
IdxBizFanWarningRuleSetMapper
idxBizFanWarningRuleSetMapper
;
@Autowired
IdxBizPvWarningRecordMapper
idxBizPvWarningRecordMapper
;
...
...
@@ -66,7 +73,7 @@ public class HealthStatusIndicatorServiceImpl {
LambdaQueryWrapper
<
IdxBizPvHealthIndex
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
IdxBizPvHealthIndex:
:
getAnalysisType
,
"按时刻"
);
wrapper
.
le
(
IdxBizPvHealthIndex:
:
getHealthIndex
,
healthValueNotice
);
wrapper
.
ne
(
IdxBizPvHealthIndex:
:
getHealthLevel
,
"安全"
);
wrapper
.
ge
(
IdxBizPvHealthIndex:
:
getRecDate
,
df
.
format
(
calendar
.
getTime
()));
wrapper
.
orderByDesc
(
IdxBizPvHealthIndex:
:
getRecDate
);
List
<
IdxBizPvHealthIndex
>
healthIndices
=
idxBizPvHealthIndexMapper
.
selectList
(
wrapper
);
...
...
@@ -76,11 +83,46 @@ public class HealthStatusIndicatorServiceImpl {
Map
<
String
,
List
<
IdxBizPvHealthIndex
>>
healthDataMaps
=
gateWayMaps
.
get
(
gateWayId
);
for
(
String
address
:
healthDataMaps
.
keySet
())
{
List
<
IdxBizPvHealthIndex
>
idxBizPvHealthIndices
=
healthDataMaps
.
get
(
address
);
List
<
Double
>
healthIndex
=
idxBizPvHealthIndices
.
stream
().
map
(
IdxBizPvHealthIndex:
:
getHealthIndex
).
collect
(
Collectors
.
toList
());
long
riskNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
healthValueRisk
).
count
();
long
warnNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
healthValueWarn
).
count
();
long
noticeNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
healthValueNotice
).
count
();
LambdaQueryWrapper
<
IdxBizPvWarningRuleSet
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
IdxBizPvWarningRuleSet:
:
getAnalysisType
,
"按小时"
);
queryWrapper
.
eq
(
IdxBizPvWarningRuleSet:
:
getAnalysisPointId
,
idxBizPvHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
List
<
IdxBizPvWarningRuleSet
>
idxBizPvWarningRuleSets
=
idxBizPvWarningRuleSetMapper
.
selectList
(
queryWrapper
);
Double
healthValueWarn
=
0.0
;
Double
healthValueRisk
=
0.0
;
Double
healthValueNotice
=
0.0
;
long
healthValueDayCount
=
0
;
long
healthValueHourCount
=
0
;
long
healthValueMinCount
=
0
;
for
(
IdxBizPvWarningRuleSet
e
:
idxBizPvWarningRuleSets
)
{
switch
(
e
.
getWarningName
()){
case
"警告"
:
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueMinCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
case
"危险"
:
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueMinCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
case
"注意"
:
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueMinCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
}
}
List
<
Double
>
healthIndex
=
idxBizPvHealthIndices
.
stream
().
map
(
IdxBizPvHealthIndex:
:
getHealthIndex
).
collect
(
Collectors
.
toList
());
Double
finalHealthValueRisk
=
healthValueRisk
;
long
riskNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
finalHealthValueRisk
).
count
();
Double
finalHealthValueWarn
=
healthValueWarn
;
long
warnNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
finalHealthValueWarn
).
count
();
Double
finalHealthValueNotice
=
healthValueNotice
;
long
noticeNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
finalHealthValueNotice
).
count
();
String
level
=
""
;
String
content
=
""
;
String
num
=
""
;
...
...
@@ -134,7 +176,7 @@ public class HealthStatusIndicatorServiceImpl {
LambdaQueryWrapper
<
IdxBizPvHealthIndex
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
IdxBizPvHealthIndex:
:
getAnalysisType
,
"按小时"
);
wrapper
.
le
(
IdxBizPvHealthIndex:
:
getHealthIndex
,
healthValueNotice
);
wrapper
.
ne
(
IdxBizPvHealthIndex:
:
getHealthLevel
,
"安全"
);
wrapper
.
ge
(
IdxBizPvHealthIndex:
:
getRecDate
,
df
.
format
(
calendar
.
getTime
()));
wrapper
.
orderByDesc
(
IdxBizPvHealthIndex:
:
getRecDate
);
List
<
IdxBizPvHealthIndex
>
healthIndices
=
idxBizPvHealthIndexMapper
.
selectList
(
wrapper
);
...
...
@@ -144,10 +186,48 @@ public class HealthStatusIndicatorServiceImpl {
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
);
Double
healthValueWarn
=
0.0
;
Double
healthValueRisk
=
0.0
;
Double
healthValueNotice
=
0.0
;
long
healthValueDayCount
=
0
;
long
healthValueHourCount
=
0
;
long
healthValueMinCount
=
0
;
for
(
IdxBizPvWarningRuleSet
e
:
idxBizPvWarningRuleSets
)
{
switch
(
e
.
getWarningName
()){
case
"警告"
:
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueHourCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
case
"危险"
:
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueHourCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
case
"注意"
:
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueHourCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
}
}
List
<
Double
>
healthIndex
=
idxBizPvHealthIndices
.
stream
().
map
(
IdxBizPvHealthIndex:
:
getHealthIndex
).
collect
(
Collectors
.
toList
());
long
riskNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
healthValueRisk
).
count
();
long
warnNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
healthValueWarn
).
count
();
long
noticeNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
healthValueNotice
).
count
();
Double
finalHealthValueRisk
=
healthValueRisk
;
long
riskNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
finalHealthValueRisk
).
count
();
Double
finalHealthValueWarn
=
healthValueWarn
;
long
warnNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
finalHealthValueWarn
).
count
();
Double
finalHealthValueNotice
=
healthValueNotice
;
long
noticeNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
finalHealthValueNotice
).
count
();
String
level
=
""
;
String
content
=
""
;
...
...
@@ -203,7 +283,7 @@ public class HealthStatusIndicatorServiceImpl {
LambdaQueryWrapper
<
IdxBizPvHealthIndex
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
IdxBizPvHealthIndex:
:
getAnalysisType
,
"按天"
);
wrapper
.
le
(
IdxBizPvHealthIndex:
:
getHealthIndex
,
healthValueNotice
);
wrapper
.
ne
(
IdxBizPvHealthIndex:
:
getHealthLevel
,
"安全"
);
wrapper
.
ge
(
IdxBizPvHealthIndex:
:
getRecDate
,
df
.
format
(
calendar
.
getTime
()));
wrapper
.
orderByDesc
(
IdxBizPvHealthIndex:
:
getRecDate
);
List
<
IdxBizPvHealthIndex
>
healthIndices
=
idxBizPvHealthIndexMapper
.
selectList
(
wrapper
);
...
...
@@ -213,11 +293,48 @@ public class HealthStatusIndicatorServiceImpl {
Map
<
String
,
List
<
IdxBizPvHealthIndex
>>
healthDataMaps
=
gateWayMaps
.
get
(
gateWayId
);
for
(
String
address
:
healthDataMaps
.
keySet
())
{
List
<
IdxBizPvHealthIndex
>
idxBizPvHealthIndices
=
healthDataMaps
.
get
(
address
);
List
<
Double
>
healthIndex
=
idxBizPvHealthIndices
.
stream
().
map
(
IdxBizPvHealthIndex:
:
getHealthIndex
).
collect
(
Collectors
.
toList
());
long
riskNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
healthValueRisk
).
count
();
long
warnNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
healthValueWarn
).
count
();
long
noticeNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
healthValueNotice
).
count
();
LambdaQueryWrapper
<
IdxBizPvWarningRuleSet
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
IdxBizPvWarningRuleSet:
:
getAnalysisType
,
"按天"
);
queryWrapper
.
eq
(
IdxBizPvWarningRuleSet:
:
getAnalysisPointId
,
idxBizPvHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
List
<
IdxBizPvWarningRuleSet
>
idxBizPvWarningRuleSets
=
idxBizPvWarningRuleSetMapper
.
selectList
(
queryWrapper
);
Double
healthValueWarn
=
0.0
;
Double
healthValueRisk
=
0.0
;
Double
healthValueNotice
=
0.0
;
long
healthValueDayCount
=
0
;
long
healthValueHourCount
=
0
;
long
healthValueMinCount
=
0
;
for
(
IdxBizPvWarningRuleSet
e
:
idxBizPvWarningRuleSets
)
{
switch
(
e
.
getWarningName
()){
case
"警告"
:
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueDayCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
case
"危险"
:
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueDayCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
case
"注意"
:
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueDayCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
}
}
List
<
Double
>
healthIndex
=
idxBizPvHealthIndices
.
stream
().
map
(
IdxBizPvHealthIndex:
:
getHealthIndex
).
collect
(
Collectors
.
toList
());
Double
finalHealthValueRisk
=
healthValueRisk
;
long
riskNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
finalHealthValueRisk
).
count
();
Double
finalHealthValueWarn
=
healthValueWarn
;
long
warnNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
finalHealthValueWarn
).
count
();
Double
finalHealthValueNotice
=
healthValueNotice
;
long
noticeNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
finalHealthValueNotice
).
count
();
String
level
=
""
;
String
content
=
""
;
String
num
=
""
;
...
...
@@ -257,7 +374,7 @@ public class HealthStatusIndicatorServiceImpl {
}
@Scheduled
(
cron
=
"0 0
*/1
* * ?"
)
@Scheduled
(
cron
=
"0 0
/5 *
* * ?"
)
private
void
healthWarningMinute
()
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
set
(
Calendar
.
HOUR_OF_DAY
,
calendar
.
get
(
Calendar
.
HOUR_OF_DAY
)-
1
);
...
...
@@ -265,7 +382,7 @@ public class HealthStatusIndicatorServiceImpl {
LambdaQueryWrapper
<
IdxBizFanHealthIndex
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
IdxBizFanHealthIndex:
:
getAnalysisType
,
"按时刻"
);
wrapper
.
le
(
IdxBizFanHealthIndex:
:
getHealthIndex
,
healthValueNotice
);
wrapper
.
ne
(
IdxBizFanHealthIndex:
:
getHealthLevel
,
"安全"
);
wrapper
.
ge
(
IdxBizFanHealthIndex:
:
getRecDate
,
df
.
format
(
calendar
.
getTime
()));
wrapper
.
orderByDesc
(
IdxBizFanHealthIndex:
:
getRecDate
);
List
<
IdxBizFanHealthIndex
>
healthIndices
=
idxBizFanHealthIndexMapper
.
selectList
(
wrapper
);
...
...
@@ -275,10 +392,49 @@ public class HealthStatusIndicatorServiceImpl {
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
);
Double
healthValueWarn
=
0.0
;
Double
healthValueRisk
=
0.0
;
Double
healthValueNotice
=
0.0
;
long
healthValueDayCount
=
0
;
long
healthValueHourCount
=
0
;
long
healthValueMinCount
=
0
;
for
(
IdxBizFanWarningRuleSet
e
:
idxBizPvWarningRuleSets
)
{
switch
(
e
.
getWarningName
()){
case
"警告"
:
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueMinCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
case
"危险"
:
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueMinCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
case
"注意"
:
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueMinCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
}
}
List
<
Double
>
healthIndex
=
idxBizFanHealthIndices
.
stream
().
map
(
IdxBizFanHealthIndex:
:
getHealthIndex
).
collect
(
Collectors
.
toList
());
long
riskNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
healthValueRisk
).
count
();
long
warnNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
healthValueWarn
).
count
();
long
noticeNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
healthValueNotice
).
count
();
Double
finalHealthValueRisk
=
healthValueRisk
;
long
riskNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
finalHealthValueRisk
).
count
();
Double
finalHealthValueWarn
=
healthValueWarn
;
long
warnNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
finalHealthValueWarn
).
count
();
Double
finalHealthValueNotice
=
healthValueNotice
;
long
noticeNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
finalHealthValueNotice
).
count
();
String
level
=
""
;
String
content
=
""
;
...
...
@@ -333,7 +489,7 @@ public class HealthStatusIndicatorServiceImpl {
LambdaQueryWrapper
<
IdxBizFanHealthIndex
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
IdxBizFanHealthIndex:
:
getAnalysisType
,
"按小时"
);
wrapper
.
le
(
IdxBizFanHealthIndex:
:
getHealthIndex
,
healthValueNotice
);
wrapper
.
ne
(
IdxBizFanHealthIndex:
:
getHealthLevel
,
"安全"
);
wrapper
.
ge
(
IdxBizFanHealthIndex:
:
getRecDate
,
df
.
format
(
calendar
.
getTime
()));
wrapper
.
orderByDesc
(
IdxBizFanHealthIndex:
:
getRecDate
);
List
<
IdxBizFanHealthIndex
>
healthIndices
=
idxBizFanHealthIndexMapper
.
selectList
(
wrapper
);
...
...
@@ -343,11 +499,49 @@ public class HealthStatusIndicatorServiceImpl {
Map
<
String
,
List
<
IdxBizFanHealthIndex
>>
healthDataMaps
=
gateWayMaps
.
get
(
gateWayId
);
for
(
String
address
:
healthDataMaps
.
keySet
())
{
List
<
IdxBizFanHealthIndex
>
idxBizFanHealthIndices
=
healthDataMaps
.
get
(
address
);
List
<
Double
>
healthIndex
=
idxBizFanHealthIndices
.
stream
().
map
(
IdxBizFanHealthIndex:
:
getHealthIndex
).
collect
(
Collectors
.
toList
());
long
riskNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
healthValueRisk
).
count
();
long
warnNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
healthValueWarn
).
count
();
long
noticeNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
healthValueNotice
).
count
();
LambdaQueryWrapper
<
IdxBizFanWarningRuleSet
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
IdxBizFanWarningRuleSet:
:
getAnalysisType
,
"按小时"
);
queryWrapper
.
eq
(
IdxBizFanWarningRuleSet:
:
getAnalysisPointId
,
idxBizFanHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
List
<
IdxBizFanWarningRuleSet
>
idxBizPvWarningRuleSets
=
idxBizFanWarningRuleSetMapper
.
selectList
(
queryWrapper
);
Double
healthValueWarn
=
0.0
;
Double
healthValueRisk
=
0.0
;
Double
healthValueNotice
=
0.0
;
long
healthValueDayCount
=
0
;
long
healthValueHourCount
=
0
;
long
healthValueMinCount
=
0
;
for
(
IdxBizFanWarningRuleSet
e
:
idxBizPvWarningRuleSets
)
{
switch
(
e
.
getWarningName
()){
case
"警告"
:
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueHourCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
case
"危险"
:
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueHourCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
case
"注意"
:
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueHourCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
}
}
List
<
Double
>
healthIndex
=
idxBizFanHealthIndices
.
stream
().
map
(
IdxBizFanHealthIndex:
:
getHealthIndex
).
collect
(
Collectors
.
toList
());
Double
finalHealthValueRisk
=
healthValueRisk
;
long
riskNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
finalHealthValueRisk
).
count
();
Double
finalHealthValueWarn
=
healthValueWarn
;
long
warnNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
finalHealthValueWarn
).
count
();
Double
finalHealthValueNotice
=
healthValueNotice
;
long
noticeNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
finalHealthValueNotice
).
count
();
String
level
=
""
;
String
content
=
""
;
String
num
=
""
;
...
...
@@ -402,7 +596,7 @@ public class HealthStatusIndicatorServiceImpl {
LambdaQueryWrapper
<
IdxBizFanHealthIndex
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
IdxBizFanHealthIndex:
:
getAnalysisType
,
"按天"
);
wrapper
.
le
(
IdxBizFanHealthIndex:
:
getHealthIndex
,
healthValueNotice
);
wrapper
.
ne
(
IdxBizFanHealthIndex:
:
getHealthLevel
,
"安全"
);
wrapper
.
ge
(
IdxBizFanHealthIndex:
:
getRecDate
,
df
.
format
(
calendar
.
getTime
()));
wrapper
.
orderByDesc
(
IdxBizFanHealthIndex:
:
getRecDate
);
List
<
IdxBizFanHealthIndex
>
healthIndices
=
idxBizFanHealthIndexMapper
.
selectList
(
wrapper
);
...
...
@@ -412,10 +606,49 @@ public class HealthStatusIndicatorServiceImpl {
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
);
Double
healthValueWarn
=
0.0
;
Double
healthValueRisk
=
0.0
;
Double
healthValueNotice
=
0.0
;
long
healthValueDayCount
=
0
;
long
healthValueHourCount
=
0
;
long
healthValueMinCount
=
0
;
for
(
IdxBizFanWarningRuleSet
e
:
idxBizPvWarningRuleSets
)
{
switch
(
e
.
getWarningName
()){
case
"警告"
:
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueDayCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
case
"危险"
:
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueDayCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
case
"注意"
:
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
e
.
getWarningIf
().
length
()-
2
));
healthValueDayCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
break
;
}
}
List
<
Double
>
healthIndex
=
idxBizFanHealthIndices
.
stream
().
map
(
IdxBizFanHealthIndex:
:
getHealthIndex
).
collect
(
Collectors
.
toList
());
long
riskNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
healthValueRisk
).
count
();
long
warnNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
healthValueWarn
).
count
();
long
noticeNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
healthValueNotice
).
count
();
Double
finalHealthValueRisk
=
healthValueRisk
;
long
riskNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
finalHealthValueRisk
).
count
();
Double
finalHealthValueWarn
=
healthValueWarn
;
long
warnNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
finalHealthValueWarn
).
count
();
Double
finalHealthValueNotice
=
healthValueNotice
;
long
noticeNum
=
healthIndex
.
stream
().
filter
(
e
->
e
<=
finalHealthValueNotice
).
count
();
String
level
=
""
;
String
content
=
""
;
...
...
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