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
64b87016
Commit
64b87016
authored
Mar 12, 2024
by
wujiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改分析告警不准确
parent
57fd373a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
9 deletions
+14
-9
HealthStatusIndicatorServiceImpl.java
...op/biz/service/impl/HealthStatusIndicatorServiceImpl.java
+14
-9
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 @
64b87016
...
@@ -149,6 +149,9 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -149,6 +149,9 @@ public class HealthStatusIndicatorServiceImpl {
@Autowired
@Autowired
private
PvWaringRecordMapper
pvWaringRecordMapper
;
private
PvWaringRecordMapper
pvWaringRecordMapper
;
@Value
(
"${analyse.cycle.offset:1}"
)
private
Integer
AnalyseOffset
;
/***
/***
* 每一小时获取一次最大粒度内的指数异常数据
* 每一小时获取一次最大粒度内的指数异常数据
...
@@ -169,7 +172,7 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -169,7 +172,7 @@ public class HealthStatusIndicatorServiceImpl {
// calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-1);
// calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-1);
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
);
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
);
Integer
maxWaringCycle
=
idxBizPvWarningRuleSetMapper
.
getMaxWaringCycleOfMinutes
();
Integer
maxWaringCycle
=
idxBizPvWarningRuleSetMapper
.
getMaxWaringCycleOfMinutes
()
+
AnalyseOffset
;
Date
date
=
DateUtil
.
offsetHour
(
time
,-
8
);
Date
date
=
DateUtil
.
offsetHour
(
time
,-
8
);
date
=
DateUtil
.
offsetMinute
(
date
,
0
-(
maxWaringCycle
*
10
));
date
=
DateUtil
.
offsetMinute
(
date
,
0
-(
maxWaringCycle
*
10
));
LambdaQueryWrapper
<
PvHealthIndexMoment
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
PvHealthIndexMoment
>
wrapper
=
new
LambdaQueryWrapper
<>();
...
@@ -252,7 +255,7 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -252,7 +255,7 @@ public class HealthStatusIndicatorServiceImpl {
}
}
Double
finalHealthValueNotice
=
healthValueNotice
;
Double
finalHealthValueNotice
=
healthValueNotice
;
if
(
healthIndex
.
size
()>=
healthValueNoticeCount
){
if
(
healthIndex
.
size
()>=
healthValueNoticeCount
){
List
<
Double
>
healthIndexList
=
healthIndex
.
subList
(
healthIndex
.
size
()-
healthValue
Warn
Count
,
healthIndex
.
size
());
List
<
Double
>
healthIndexList
=
healthIndex
.
subList
(
healthIndex
.
size
()-
healthValue
Notice
Count
,
healthIndex
.
size
());
noticeNum
=
(
int
)
healthIndexList
.
stream
().
filter
(
e
->
e
<=
finalHealthValueNotice
).
count
();
noticeNum
=
(
int
)
healthIndexList
.
stream
().
filter
(
e
->
e
<=
finalHealthValueNotice
).
count
();
}
}
String
level
=
""
;
String
level
=
""
;
...
@@ -534,7 +537,7 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -534,7 +537,7 @@ public class HealthStatusIndicatorServiceImpl {
// Calendar calendar = Calendar.getInstance();
// Calendar calendar = Calendar.getInstance();
// calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-5);
// calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-5);
// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
Integer
maxWaringCycle
=
idxBizPvWarningRuleSetMapper
.
getMaxWaringCycleOfHour
();
Integer
maxWaringCycle
=
idxBizPvWarningRuleSetMapper
.
getMaxWaringCycleOfHour
()
+
AnalyseOffset
;
String
format
=
DateUtil
.
format
(
time
,
"yyyy-MM-dd HH:mm:00"
);
String
format
=
DateUtil
.
format
(
time
,
"yyyy-MM-dd HH:mm:00"
);
Date
date
=
DateUtil
.
offsetHour
(
time
,-
8
);
Date
date
=
DateUtil
.
offsetHour
(
time
,-
8
);
date
=
DateUtil
.
offsetHour
(
date
,
0
-
maxWaringCycle
);
date
=
DateUtil
.
offsetHour
(
date
,
0
-
maxWaringCycle
);
...
@@ -722,7 +725,7 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -722,7 +725,7 @@ public class HealthStatusIndicatorServiceImpl {
// Date date = DateUtils.dateAddHours(time, -80);
// Date date = DateUtils.dateAddHours(time, -80);
// calendar.set(Calendar.DAY_OF_MONTH,calendar.get(Calendar.DAY_OF_MONTH)-3);
// calendar.set(Calendar.DAY_OF_MONTH,calendar.get(Calendar.DAY_OF_MONTH)-3);
// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Integer
maxWaringCycle
=
idxBizPvWarningRuleSetMapper
.
getMaxWaringCycleOfDay
();
Integer
maxWaringCycle
=
idxBizPvWarningRuleSetMapper
.
getMaxWaringCycleOfDay
()
+
AnalyseOffset
;
String
format
=
DateUtil
.
format
(
time
,
"yyyy-MM-dd HH:mm:00"
);
String
format
=
DateUtil
.
format
(
time
,
"yyyy-MM-dd HH:mm:00"
);
Date
date
=
DateUtil
.
offsetHour
(
time
,-
8
);
Date
date
=
DateUtil
.
offsetHour
(
time
,-
8
);
date
=
DateUtil
.
offsetDay
(
date
,
0
-
maxWaringCycle
);
date
=
DateUtil
.
offsetDay
(
date
,
0
-
maxWaringCycle
);
...
@@ -907,7 +910,7 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -907,7 +910,7 @@ public class HealthStatusIndicatorServiceImpl {
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
);
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
);
// 用ts字段查询时需要减8小时
// 用ts字段查询时需要减8小时
// Date date = DateUtils.dateAddHours(time, -8);
// Date date = DateUtils.dateAddHours(time, -8);
Integer
maxWaringCycle
=
idxBizFanWarningRuleSetMapper
.
getMaxWaringCycleOfMinutes
();
Integer
maxWaringCycle
=
idxBizFanWarningRuleSetMapper
.
getMaxWaringCycleOfMinutes
()
+
AnalyseOffset
;
Date
date
=
DateUtil
.
offsetHour
(
time
,-
8
);
Date
date
=
DateUtil
.
offsetHour
(
time
,-
8
);
date
=
DateUtil
.
offsetMinute
(
date
,
0
-(
maxWaringCycle
*
10
));
date
=
DateUtil
.
offsetMinute
(
date
,
0
-(
maxWaringCycle
*
10
));
LambdaQueryWrapper
<
FanHealthIndexMoment
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
FanHealthIndexMoment
>
wrapper
=
new
LambdaQueryWrapper
<>();
...
@@ -915,6 +918,7 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -915,6 +918,7 @@ public class HealthStatusIndicatorServiceImpl {
wrapper
.
eq
(
FanHealthIndexMoment:
:
getAnalysisObjType
,
"测点"
);
wrapper
.
eq
(
FanHealthIndexMoment:
:
getAnalysisObjType
,
"测点"
);
wrapper
.
ge
(
FanHealthIndexMoment:
:
getTs
,
date
);
wrapper
.
ge
(
FanHealthIndexMoment:
:
getTs
,
date
);
wrapper
.
orderByDesc
(
FanHealthIndexMoment:
:
getTs
);
wrapper
.
orderByDesc
(
FanHealthIndexMoment:
:
getTs
);
//查询最大连续时间规则的测点对象
List
<
FanHealthIndexMoment
>
healthIndices
=
fanHealthIndexMomentMapper
.
selectList
(
wrapper
);
List
<
FanHealthIndexMoment
>
healthIndices
=
fanHealthIndexMomentMapper
.
selectList
(
wrapper
);
if
(
ObjectUtils
.
isEmpty
(
healthIndices
)){
if
(
ObjectUtils
.
isEmpty
(
healthIndices
)){
...
@@ -941,6 +945,7 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -941,6 +945,7 @@ public class HealthStatusIndicatorServiceImpl {
stationMap
.
put
(
gateWayId
,
stationBasic
);
stationMap
.
put
(
gateWayId
,
stationBasic
);
Map
<
String
,
List
<
FanHealthIndexMoment
>>
healthDataMaps
=
gateWayMaps
.
get
(
gateWayId
);
Map
<
String
,
List
<
FanHealthIndexMoment
>>
healthDataMaps
=
gateWayMaps
.
get
(
gateWayId
);
for
(
String
address
:
healthDataMaps
.
keySet
())
{
for
(
String
address
:
healthDataMaps
.
keySet
())
{
//获取指定测点的健康指数列表
List
<
FanHealthIndexMoment
>
idxBizFanHealthIndices
=
healthDataMaps
.
get
(
address
);
List
<
FanHealthIndexMoment
>
idxBizFanHealthIndices
=
healthDataMaps
.
get
(
address
);
List
<
IdxBizFanWarningRuleSet
>
idxBizPvWarningRuleSets
=
idxBizPvWarningRules
.
stream
().
filter
(
t
->
t
.
getAnalysisPointId
().
equals
(
idxBizFanHealthIndices
.
get
(
0
).
getAnalysisObjSeq
())).
collect
(
Collectors
.
toList
());
List
<
IdxBizFanWarningRuleSet
>
idxBizPvWarningRuleSets
=
idxBizPvWarningRules
.
stream
().
filter
(
t
->
t
.
getAnalysisPointId
().
equals
(
idxBizFanHealthIndices
.
get
(
0
).
getAnalysisObjSeq
())).
collect
(
Collectors
.
toList
());
...
@@ -981,7 +986,7 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -981,7 +986,7 @@ public class HealthStatusIndicatorServiceImpl {
}
}
//获取指定测点的健康指数列表
List
<
Double
>
healthIndex
=
idxBizFanHealthIndices
.
stream
().
map
(
FanHealthIndexMoment:
:
getHealthIndex
).
collect
(
Collectors
.
toList
());
List
<
Double
>
healthIndex
=
idxBizFanHealthIndices
.
stream
().
map
(
FanHealthIndexMoment:
:
getHealthIndex
).
collect
(
Collectors
.
toList
());
// Double finalHealthValueRisk = healthValueRisk;
// Double finalHealthValueRisk = healthValueRisk;
// long riskNum = healthIndex.subList(healthIndex.size()>healthValueRiskCount? (int) (healthIndex.size() - healthValueRiskCount) :0,healthIndex.size()).stream().filter(e -> e <= finalHealthValueRisk).count();
// long riskNum = healthIndex.subList(healthIndex.size()>healthValueRiskCount? (int) (healthIndex.size() - healthValueRiskCount) :0,healthIndex.size()).stream().filter(e -> e <= finalHealthValueRisk).count();
...
@@ -1001,7 +1006,7 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -1001,7 +1006,7 @@ public class HealthStatusIndicatorServiceImpl {
}
}
Double
finalHealthValueNotice
=
healthValueNotice
;
Double
finalHealthValueNotice
=
healthValueNotice
;
if
(
healthIndex
.
size
()>=
healthValueNoticeCount
){
if
(
healthIndex
.
size
()>=
healthValueNoticeCount
){
List
<
Double
>
healthIndexList
=
healthIndex
.
subList
(
healthIndex
.
size
()-
healthValue
Warn
Count
,
healthIndex
.
size
());
List
<
Double
>
healthIndexList
=
healthIndex
.
subList
(
healthIndex
.
size
()-
healthValue
Notice
Count
,
healthIndex
.
size
());
noticeNum
=
(
int
)
healthIndexList
.
stream
().
filter
(
e
->
e
<=
finalHealthValueNotice
).
count
();
noticeNum
=
(
int
)
healthIndexList
.
stream
().
filter
(
e
->
e
<=
finalHealthValueNotice
).
count
();
}
}
String
level
=
""
;
String
level
=
""
;
...
@@ -1105,7 +1110,7 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -1105,7 +1110,7 @@ public class HealthStatusIndicatorServiceImpl {
// Calendar calendar = Calendar.getInstance();
// Calendar calendar = Calendar.getInstance();
// calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-5);
// calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-5);
// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
Integer
maxWaringCycle
=
idxBizFanWarningRuleSetMapper
.
getMaxWaringCycleOfHour
();
Integer
maxWaringCycle
=
idxBizFanWarningRuleSetMapper
.
getMaxWaringCycleOfHour
()
+
AnalyseOffset
;
Date
date
=
DateUtil
.
offsetHour
(
time
,-
8
);
Date
date
=
DateUtil
.
offsetHour
(
time
,-
8
);
date
=
DateUtil
.
offsetHour
(
date
,
0
-(
maxWaringCycle
));
date
=
DateUtil
.
offsetHour
(
date
,
0
-(
maxWaringCycle
));
LambdaQueryWrapper
<
FanHealthIndexHour
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
FanHealthIndexHour
>
wrapper
=
new
LambdaQueryWrapper
<>();
...
@@ -1295,7 +1300,7 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -1295,7 +1300,7 @@ public class HealthStatusIndicatorServiceImpl {
// Calendar calendar = Calendar.getInstance();
// Calendar calendar = Calendar.getInstance();
// calendar.set(Calendar.DAY_OF_MONTH,calendar.get(Calendar.DAY_OF_MONTH)-3);
// calendar.set(Calendar.DAY_OF_MONTH,calendar.get(Calendar.DAY_OF_MONTH)-3);
// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Integer
maxWaringCycle
=
idxBizFanWarningRuleSetMapper
.
getMaxWaringCycleOfHour
();
Integer
maxWaringCycle
=
idxBizFanWarningRuleSetMapper
.
getMaxWaringCycleOfHour
()
+
AnalyseOffset
;
Date
date
=
DateUtil
.
offsetHour
(
time
,-
8
);
Date
date
=
DateUtil
.
offsetHour
(
time
,-
8
);
date
=
DateUtil
.
offsetDay
(
date
,
0
-(
maxWaringCycle
));
date
=
DateUtil
.
offsetDay
(
date
,
0
-(
maxWaringCycle
));
...
...
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