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
53741f60
Commit
53741f60
authored
Mar 06, 2024
by
tangwei
Browse files
Options
Browse Files
Download
Plain Diff
解决冲突
parents
4291182c
3ad8fdb8
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
536 additions
and
154 deletions
+536
-154
WarningRecordStatusMessage.java
...oot/module/jxiop/biz/emqx/WarningRecordStatusMessage.java
+84
-37
AlarmInfoDetailServiceImpl.java
...le/jxiop/biz/service/impl/AlarmInfoDetailServiceImpl.java
+34
-10
CommonServiceImpl.java
...boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
+1
-1
HealthStatusIndicatorServiceImpl.java
...op/biz/service/impl/HealthStatusIndicatorServiceImpl.java
+409
-100
McbWarningFeign.java
...oin/amos/boot/module/jxiop/api/feign/McbWarningFeign.java
+6
-4
MonitorFanIdxController.java
.../module/jxiop/biz/controller/MonitorFanIdxController.java
+2
-2
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/emqx/WarningRecordStatusMessage.java
View file @
53741f60
...
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
...
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.FanWarningRecordServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.FanWarningRecordServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.HealthStatusIndicatorServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.HealthStatusIndicatorServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.PvWarningRecordServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.PvWarningRecordServiceImpl
;
...
@@ -28,25 +29,21 @@ import java.util.stream.Collectors;
...
@@ -28,25 +29,21 @@ import java.util.stream.Collectors;
@Slf4j
@Slf4j
public
class
WarningRecordStatusMessage
extends
EmqxListener
{
public
class
WarningRecordStatusMessage
extends
EmqxListener
{
@Autowired
protected
EmqKeeper
emqKeeper
;
/**
/**
* 预警状态修改消息 - 标准化
* 预警状态修改消息 - 标准化
*/
*/
public
static
final
String
WARNING_CHANGE_MESSAGE
=
"+/warning/change"
;
// public static final String WARNING_CHANGE_MESSAGE = "+/warning/change";
public
static
final
String
WARNING_CHANGE_MESSAGE
=
"warningchangetest"
;
@Autowired
private
FanWaringRecordMapper
fanWaringRecordMapper
;
@Autowired
@Autowired
private
PvWaringRecordMapper
pvWaringRecordMapper
;
protected
EmqKeeper
emqKeeper
;
@Autowired
@Autowired
FanWarningRecordServiceImpl
fanWarningRecordService
;
FanWarningRecordServiceImpl
fanWarningRecordService
;
@Autowired
@Autowired
PvWarningRecordServiceImpl
pvWarningRecordService
;
PvWarningRecordServiceImpl
pvWarningRecordService
;
@Autowired
private
FanWaringRecordMapper
fanWaringRecordMapper
;
@Autowired
private
PvWaringRecordMapper
pvWaringRecordMapper
;
@PostConstruct
@PostConstruct
void
init
()
throws
Exception
{
void
init
()
throws
Exception
{
...
@@ -71,7 +68,29 @@ public class WarningRecordStatusMessage extends EmqxListener {
...
@@ -71,7 +68,29 @@ public class WarningRecordStatusMessage extends EmqxListener {
public
void
jxIopUpdateFan
(
JSONArray
analysisResult
)
{
public
void
jxIopUpdateFan
(
JSONArray
analysisResult
)
{
log
.
info
(
"修改预警状态信息:{}"
,
analysisResult
);
log
.
info
(
"修改预警状态信息:{}"
,
analysisResult
);
List
<
JSONObject
>
taskList
=
JSONObject
.
parseArray
(
analysisResult
.
toJSONString
(),
JSONObject
.
class
);
List
<
JSONObject
>
taskList
=
JSONObject
.
parseArray
(
analysisResult
.
toJSONString
(),
JSONObject
.
class
);
List
<
String
>
traceIds
=
taskList
.
stream
().
map
(
t
->
t
.
get
(
"extAttr1"
).
toString
()).
collect
(
Collectors
.
toList
());
taskList
=
taskList
.
stream
().
filter
(
t
->
"2"
.
equals
(
t
.
getString
(
"processingStatus"
))).
collect
(
Collectors
.
toList
());
taskList
.
stream
().
forEach
(
jsonObject
->
{
String
[]
params
=
jsonObject
.
getString
(
"extAttr1"
).
split
(
"@"
);
QueryWrapper
<
FanWarningRecord
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"station"
,
jsonObject
.
getString
(
"sourceAttributionDesc"
));
queryWrapper
.
eq
(
"equipment_name"
,
jsonObject
.
getString
(
"objectName"
));
queryWrapper
.
eq
(
"point_name"
,
jsonObject
.
getString
(
"objectIndexValue"
));
queryWrapper
.
eq
(
"kks"
,
jsonObject
.
getString
(
"objectId"
));
if
(
params
.
length
==
3
){
queryWrapper
.
eq
(
"sub_system"
,
params
[
0
]);
queryWrapper
.
eq
(
"health_level"
,
params
[
1
]);
queryWrapper
.
eq
(
"warning_period"
,
params
[
2
]);
}
List
<
FanWarningRecord
>
fanWarningRecords
=
fanWaringRecordMapper
.
selectList
(
queryWrapper
);
fanWarningRecords
.
stream
().
forEach
(
fanWarningRecord
->
{
fanWarningRecord
.
setDisposotionDate
(
DateUtil
.
now
());
fanWarningRecord
.
setStatus
(
"1"
);
fanWarningRecord
.
setDisposotionState
(
"已确认"
);
fanWaringRecordMapper
.
insert
(
fanWarningRecord
);
});
});
// List<String> traceIds = taskList.stream().map(t -> t.get("extAttr1").toString()).collect(Collectors.toList());
// LambdaUpdateWrapper<IdxBizFanWarningRecord> lambda = new LambdaUpdateWrapper<>();
// LambdaUpdateWrapper<IdxBizFanWarningRecord> lambda = new LambdaUpdateWrapper<>();
// lambda.set(IdxBizFanWarningRecord::getDisposotionState, "已确认");
// lambda.set(IdxBizFanWarningRecord::getDisposotionState, "已确认");
// lambda.set(IdxBizFanWarningRecord::getStatus, "1");
// lambda.set(IdxBizFanWarningRecord::getStatus, "1");
...
@@ -79,16 +98,19 @@ public class WarningRecordStatusMessage extends EmqxListener {
...
@@ -79,16 +98,19 @@ public class WarningRecordStatusMessage extends EmqxListener {
// lambda.in(IdxBizFanWarningRecord::getSequenceNbr, traceIds);
// lambda.in(IdxBizFanWarningRecord::getSequenceNbr, traceIds);
// idxBizFanWarningRecordService.update(lambda);
// idxBizFanWarningRecordService.update(lambda);
List
<
FanWarningRecord
>
list
=
new
ArrayList
<>();
// List<FanWarningRecord> list = new ArrayList<>();
for
(
String
traceId
:
traceIds
)
{
// for (String traceId : traceIds) {
FanWarningRecord
fanWarningRecord
=
new
FanWarningRecord
();
// FanWarningRecord fanWarningRecord = new FanWarningRecord();
fanWarningRecord
.
setTs
(
Long
.
valueOf
(
traceId
));
// fanWarningRecord.setTs(Long.valueOf(traceId));
fanWarningRecord
.
setDisposotionDate
(
DateUtil
.
now
());
// fanWarningRecord.setDisposotionDate(DateUtil.now());
fanWarningRecord
.
setStatus
(
"1"
);
// fanWarningRecord.setStatus("1");
fanWarningRecord
.
setDisposotionState
(
"已确认"
);
// fanWarningRecord.setDisposotionState("已确认");
list
.
add
(
fanWarningRecord
);
// list.add(fanWarningRecord);
}
// }
fanWaringRecordMapper
.
updateStatusByTs
(
list
);
// if(list.size()>0){
// log.info("XXXXXXXXXXXX风电修改预警状态XXXXXXXXXXXXXXXXXX",JSON.toJSONString(list));
// fanWaringRecordMapper.updateStatusByTs(list);
// }
}
}
...
@@ -96,23 +118,48 @@ public class WarningRecordStatusMessage extends EmqxListener {
...
@@ -96,23 +118,48 @@ public class WarningRecordStatusMessage extends EmqxListener {
public
void
jxIopUpdatePv
(
JSONArray
analysisResult
)
{
public
void
jxIopUpdatePv
(
JSONArray
analysisResult
)
{
log
.
info
(
"修改预警状态信息:{}"
,
analysisResult
);
log
.
info
(
"修改预警状态信息:{}"
,
analysisResult
);
List
<
JSONObject
>
taskList
=
JSONObject
.
parseArray
(
analysisResult
.
toJSONString
(),
JSONObject
.
class
);
List
<
JSONObject
>
taskList
=
JSONObject
.
parseArray
(
analysisResult
.
toJSONString
(),
JSONObject
.
class
);
List
<
String
>
traceIds
=
taskList
.
stream
().
map
(
t
->
t
.
get
(
"extAttr1"
).
toString
()).
collect
(
Collectors
.
toList
());
taskList
=
taskList
.
stream
().
filter
(
t
->
"2"
.
equals
(
t
.
getString
(
"processingStatus"
))).
collect
(
Collectors
.
toList
());
// LambdaUpdateWrapper<IdxBizPvWarningRecord> lambda = new LambdaUpdateWrapper<>();
// lambda.set(IdxBizPvWarningRecord::getDisposotionState, "已处置");
taskList
.
stream
().
forEach
(
jsonObject
->
{
// lambda.set(IdxBizPvWarningRecord::getStatus, "1");
String
[]
params
=
jsonObject
.
getString
(
"extAttr1"
).
split
(
"@"
);
// lambda.set(IdxBizPvWarningRecord::getDisposotionDate, new Date());
QueryWrapper
<
PvWarningRecord
>
queryWrapper
=
new
QueryWrapper
<>();
// lambda.in(IdxBizPvWarningRecord::getSequenceNbr, traceIds);
queryWrapper
.
eq
(
"station"
,
jsonObject
.
getString
(
"sourceAttributionDesc"
));
// idxBizPvWarningRecordService.update(lambda);
queryWrapper
.
eq
(
"equipment_name"
,
jsonObject
.
getString
(
"objectName"
));
// td
queryWrapper
.
eq
(
"point_name"
,
jsonObject
.
getString
(
"objectIndexValue"
));
List
<
PvWarningRecord
>
list
=
new
ArrayList
<>();
queryWrapper
.
eq
(
"kks"
,
jsonObject
.
getString
(
"objectId"
));
for
(
String
traceId
:
traceIds
)
{
if
(
params
.
length
==
3
){
PvWarningRecord
pvWarningRecord
=
new
PvWarningRecord
();
queryWrapper
.
eq
(
"subarray"
,
params
[
0
]);
pvWarningRecord
.
setTs
(
Long
.
valueOf
(
traceId
));
queryWrapper
.
eq
(
"health_level"
,
params
[
1
]);
queryWrapper
.
eq
(
"warning_period"
,
params
[
2
]);
}
List
<
PvWarningRecord
>
pvWarningRecords
=
pvWaringRecordMapper
.
selectList
(
queryWrapper
);
pvWarningRecords
.
stream
().
forEach
(
pvWarningRecord
->
{
pvWarningRecord
.
setDisposotionDate
(
DateUtil
.
now
());
pvWarningRecord
.
setDisposotionDate
(
DateUtil
.
now
());
pvWarningRecord
.
setStatus
(
"1"
);
pvWarningRecord
.
setStatus
(
"1"
);
pvWarningRecord
.
setDisposotionState
(
"已确认"
);
pvWarningRecord
.
setDisposotionState
(
"已确认"
);
list
.
add
(
pvWarningRecord
);
pvWaringRecordMapper
.
insert
(
pvWarningRecord
);
}
});
pvWaringRecordMapper
.
updateStatusByTs
(
list
);
});
// List<String> traceIds = taskList.stream().map(t -> t.get("extAttr1").toString()).collect(Collectors.toList());
//// LambdaUpdateWrapper<IdxBizPvWarningRecord> lambda = new LambdaUpdateWrapper<>();
//// lambda.set(IdxBizPvWarningRecord::getDisposotionState, "已处置");
//// lambda.set(IdxBizPvWarningRecord::getStatus, "1");
//// lambda.set(IdxBizPvWarningRecord::getDisposotionDate, new Date());
//// lambda.in(IdxBizPvWarningRecord::getSequenceNbr, traceIds);
//// idxBizPvWarningRecordService.update(lambda);
// // td
// List<PvWarningRecord> list = new ArrayList<>();
// for (String traceId : traceIds) {
// PvWarningRecord pvWarningRecord = new PvWarningRecord();
// pvWarningRecord.setTs(Long.valueOf(traceId));
// pvWarningRecord.setDisposotionDate(DateUtil.now());
// pvWarningRecord.setStatus("1");
// pvWarningRecord.setDisposotionState("已确认");
// list.add(pvWarningRecord);
// }
// if (list.size() > 0) {
// log.info("XXXXXXXXXXXX光伏修改预警状态XXXXXXXXXXXXXXXXXX", JSON.toJSONString(list));
// pvWaringRecordMapper.updateStatusByTs(list);
// }
}
}
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/AlarmInfoDetailServiceImpl.java
View file @
53741f60
...
@@ -211,10 +211,10 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService {
...
@@ -211,10 +211,10 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService {
for
(
int
i
=
idxBizFanHealthIndexListSize
-
1
;
i
>=
0
;
i
--)
{
for
(
int
i
=
idxBizFanHealthIndexListSize
-
1
;
i
>=
0
;
i
--)
{
HashMap
<
String
,
String
>
alarmAbnormalityItem
=
new
HashMap
<>();
HashMap
<
String
,
String
>
alarmAbnormalityItem
=
new
HashMap
<>();
FanHealthIndex
idxBizFanHealthIndex
=
idxBizFanHealthIndexList
.
get
(
i
);
FanHealthIndex
idxBizFanHealthIndex
=
idxBizFanHealthIndexList
.
get
(
i
);
xDatas
.
add
(
idxBizFanHealthIndex
.
get
AnalysisTim
e
());
xDatas
.
add
(
idxBizFanHealthIndex
.
get
RecDat
e
());
yDatas
.
add
(
Double
.
valueOf
(
keepOneKeepDecimalPlace
(
idxBizFanHealthIndex
.
getHealthIndex
())));
yDatas
.
add
(
Double
.
valueOf
(
keepOneKeepDecimalPlace
(
idxBizFanHealthIndex
.
getHealthIndex
())));
alarmAbnormalityItem
.
put
(
"sort"
,
String
.
valueOf
(
i
));
alarmAbnormalityItem
.
put
(
"sort"
,
String
.
valueOf
(
i
));
alarmAbnormalityItem
.
put
(
"time"
,
idxBizFanHealthIndex
.
get
AnalysisTim
e
());
alarmAbnormalityItem
.
put
(
"time"
,
idxBizFanHealthIndex
.
get
RecDat
e
());
alarmAbnormalityItem
.
put
(
"abnormal"
,
keepOneKeepDecimalPlace
(
idxBizFanHealthIndex
.
getAnomaly
()));
alarmAbnormalityItem
.
put
(
"abnormal"
,
keepOneKeepDecimalPlace
(
idxBizFanHealthIndex
.
getAnomaly
()));
alarmAbnormalityItem
.
put
(
"healthValue"
,
keepOneKeepDecimalPlace
(
idxBizFanHealthIndex
.
getHealthIndex
()));
alarmAbnormalityItem
.
put
(
"healthValue"
,
keepOneKeepDecimalPlace
(
idxBizFanHealthIndex
.
getHealthIndex
()));
alarmAbnormalityList
.
add
(
alarmAbnormalityItem
);
alarmAbnormalityList
.
add
(
alarmAbnormalityItem
);
...
@@ -264,32 +264,32 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService {
...
@@ -264,32 +264,32 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService {
for
(
int
i
=
idxBizPvHealthIndexList
.
size
()
-
1
;
i
>=
0
;
i
--)
{
for
(
int
i
=
idxBizPvHealthIndexList
.
size
()
-
1
;
i
>=
0
;
i
--)
{
HashMap
<
String
,
String
>
alarmAbnormalityItem
=
new
HashMap
<>();
HashMap
<
String
,
String
>
alarmAbnormalityItem
=
new
HashMap
<>();
PvHealthIndex
idxBizPvHealthIndex
=
idxBizPvHealthIndexList
.
get
(
i
);
PvHealthIndex
idxBizPvHealthIndex
=
idxBizPvHealthIndexList
.
get
(
i
);
xDatas
.
add
(
idxBizPvHealthIndex
.
get
AnalysisTim
e
());
xDatas
.
add
(
idxBizPvHealthIndex
.
get
RecDat
e
());
yDatas
.
add
(
Double
.
valueOf
(
keepOneKeepDecimalPlace
(
idxBizPvHealthIndex
.
getHealthIndex
())));
yDatas
.
add
(
Double
.
valueOf
(
keepOneKeepDecimalPlace
(
idxBizPvHealthIndex
.
getHealthIndex
())));
alarmAbnormalityItem
.
put
(
"sort"
,
String
.
valueOf
(
i
));
alarmAbnormalityItem
.
put
(
"sort"
,
String
.
valueOf
(
i
));
alarmAbnormalityItem
.
put
(
"time"
,
idxBizPvHealthIndex
.
get
AnalysisTim
e
());
alarmAbnormalityItem
.
put
(
"time"
,
idxBizPvHealthIndex
.
get
RecDat
e
());
alarmAbnormalityItem
.
put
(
"abnormal"
,
keepOneKeepDecimalPlace
(
idxBizPvHealthIndex
.
getAnomaly
()));
alarmAbnormalityItem
.
put
(
"abnormal"
,
keepOneKeepDecimalPlace
(
idxBizPvHealthIndex
.
getAnomaly
()));
alarmAbnormalityItem
.
put
(
"healthValue"
,
keepOneKeepDecimalPlace
(
idxBizPvHealthIndex
.
getHealthIndex
()));
alarmAbnormalityItem
.
put
(
"healthValue"
,
keepOneKeepDecimalPlace
(
idxBizPvHealthIndex
.
getHealthIndex
()));
if
(
idxBizPvHealthIndexListSize
>=
3
)
{
if
(
idxBizPvHealthIndexListSize
>=
3
)
{
if
(
i
==
0
)
{
if
(
i
==
0
)
{
endTime
=
handlerDateStr
(
idxBizPvHealthIndex
.
get
AnalysisTim
e
(),
-
8
,
5
);
endTime
=
handlerDateStr
(
idxBizPvHealthIndex
.
get
RecDat
e
(),
-
8
,
5
);
}
}
if
(
i
==
2
)
{
if
(
i
==
2
)
{
startTime
=
handlerDateStr
(
idxBizPvHealthIndex
.
get
AnalysisTim
e
(),
-
8
,
-
5
);
startTime
=
handlerDateStr
(
idxBizPvHealthIndex
.
get
RecDat
e
(),
-
8
,
-
5
);
}
}
}
}
if
(
idxBizPvHealthIndexListSize
==
2
)
{
if
(
idxBizPvHealthIndexListSize
==
2
)
{
if
(
i
==
0
)
{
if
(
i
==
0
)
{
endTime
=
handlerDateStr
(
idxBizPvHealthIndex
.
get
AnalysisTim
e
(),
-
8
,
5
);
endTime
=
handlerDateStr
(
idxBizPvHealthIndex
.
get
RecDat
e
(),
-
8
,
5
);
}
}
if
(
i
==
1
)
{
if
(
i
==
1
)
{
startTime
=
handlerDateStr
(
idxBizPvHealthIndex
.
get
AnalysisTim
e
(),
-
8
,
-
5
);
startTime
=
handlerDateStr
(
idxBizPvHealthIndex
.
get
RecDat
e
(),
-
8
,
-
5
);
}
}
}
}
if
(
idxBizPvHealthIndexListSize
==
1
)
{
if
(
idxBizPvHealthIndexListSize
==
1
)
{
if
(
i
==
0
)
{
if
(
i
==
0
)
{
endTime
=
handlerDateStr
(
idxBizPvHealthIndex
.
get
AnalysisTim
e
(),
-
8
,
5
);
endTime
=
handlerDateStr
(
idxBizPvHealthIndex
.
get
RecDat
e
(),
-
8
,
5
);
startTime
=
handlerDateStr
(
idxBizPvHealthIndex
.
get
AnalysisTim
e
(),
-
8
,
-
5
);
startTime
=
handlerDateStr
(
idxBizPvHealthIndex
.
get
RecDat
e
(),
-
8
,
-
5
);
}
}
}
}
alarmAbnormalityList
.
add
(
alarmAbnormalityItem
);
alarmAbnormalityList
.
add
(
alarmAbnormalityItem
);
...
@@ -540,9 +540,21 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService {
...
@@ -540,9 +540,21 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService {
Double
processValue1
=
indicatorDataListMap
.
get
(
s
+
"_"
+
process1Address
);
Double
processValue1
=
indicatorDataListMap
.
get
(
s
+
"_"
+
process1Address
);
Double
processValue2
=
indicatorDataListMap
.
get
(
s
+
"_"
+
process2Address
);
Double
processValue2
=
indicatorDataListMap
.
get
(
s
+
"_"
+
process2Address
);
Double
processValue3
=
indicatorDataListMap
.
get
(
s
+
"_"
+
process3Address
);
Double
processValue3
=
indicatorDataListMap
.
get
(
s
+
"_"
+
process3Address
);
if
(
ObjectUtils
.
isEmpty
(
analyseValue
)){
analyseValue
=
0.0
;
}
currentValueMap
.
put
(
"analyseValue"
,
keepOneKeepDecimalPlace
(
analyseValue
));
currentValueMap
.
put
(
"analyseValue"
,
keepOneKeepDecimalPlace
(
analyseValue
));
if
(
ObjectUtils
.
isEmpty
(
processValue1
)){
processValue1
=
0.0
;
}
currentValueMap
.
put
(
"processValue1"
,
keepOneKeepDecimalPlace
(
processValue1
));
currentValueMap
.
put
(
"processValue1"
,
keepOneKeepDecimalPlace
(
processValue1
));
if
(
ObjectUtils
.
isEmpty
(
processValue2
)){
processValue2
=
0.0
;
}
currentValueMap
.
put
(
"processValue2"
,
keepOneKeepDecimalPlace
(
processValue2
));
currentValueMap
.
put
(
"processValue2"
,
keepOneKeepDecimalPlace
(
processValue2
));
if
(
ObjectUtils
.
isEmpty
(
processValue3
)){
processValue3
=
0.0
;
}
currentValueMap
.
put
(
"processValue3"
,
keepOneKeepDecimalPlace
(
processValue3
));
currentValueMap
.
put
(
"processValue3"
,
keepOneKeepDecimalPlace
(
processValue3
));
HashMap
<
String
,
String
>
trainValueMap
=
getWorkingConditionCombinationIntervalFan
(
processValue1
,
processValue2
,
processValue3
,
idxBizFanPointVarCentralValueList
);
HashMap
<
String
,
String
>
trainValueMap
=
getWorkingConditionCombinationIntervalFan
(
processValue1
,
processValue2
,
processValue3
,
idxBizFanPointVarCentralValueList
);
trainValueMap
.
put
(
"time"
,
s
);
trainValueMap
.
put
(
"time"
,
s
);
...
@@ -599,9 +611,21 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService {
...
@@ -599,9 +611,21 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService {
Double
processValue1
=
indicatorDataListMap
.
get
(
s
+
"_"
+
process1Address
);
Double
processValue1
=
indicatorDataListMap
.
get
(
s
+
"_"
+
process1Address
);
Double
processValue2
=
indicatorDataListMap
.
get
(
s
+
"_"
+
process2Address
);
Double
processValue2
=
indicatorDataListMap
.
get
(
s
+
"_"
+
process2Address
);
Double
processValue3
=
indicatorDataListMap
.
get
(
s
+
"_"
+
process3Address
);
Double
processValue3
=
indicatorDataListMap
.
get
(
s
+
"_"
+
process3Address
);
if
(
ObjectUtils
.
isEmpty
(
analyseValue
)){
analyseValue
=
0.0
;
}
currentValueMap
.
put
(
"analyseValue"
,
keepOneKeepDecimalPlace
(
analyseValue
));
currentValueMap
.
put
(
"analyseValue"
,
keepOneKeepDecimalPlace
(
analyseValue
));
if
(
ObjectUtils
.
isEmpty
(
processValue1
)){
processValue1
=
0.0
;
}
currentValueMap
.
put
(
"processValue1"
,
keepOneKeepDecimalPlace
(
processValue1
));
currentValueMap
.
put
(
"processValue1"
,
keepOneKeepDecimalPlace
(
processValue1
));
if
(
ObjectUtils
.
isEmpty
(
analyseValue
)){
processValue2
=
0.0
;
}
currentValueMap
.
put
(
"processValue2"
,
keepOneKeepDecimalPlace
(
processValue2
));
currentValueMap
.
put
(
"processValue2"
,
keepOneKeepDecimalPlace
(
processValue2
));
if
(
ObjectUtils
.
isEmpty
(
processValue3
)){
processValue3
=
0.0
;
}
currentValueMap
.
put
(
"processValue3"
,
keepOneKeepDecimalPlace
(
processValue3
));
currentValueMap
.
put
(
"processValue3"
,
keepOneKeepDecimalPlace
(
processValue3
));
HashMap
<
String
,
String
>
trainValueMap
=
getWorkingConditionCombinationIntervalPv
(
processValue1
,
processValue2
,
processValue3
,
idxBizPvPointVarCentralValueList
);
HashMap
<
String
,
String
>
trainValueMap
=
getWorkingConditionCombinationIntervalPv
(
processValue1
,
processValue2
,
processValue3
,
idxBizPvPointVarCentralValueList
);
trainValueMap
.
put
(
"time"
,
s
);
trainValueMap
.
put
(
"time"
,
s
);
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
View file @
53741f60
...
@@ -2030,7 +2030,7 @@ public class CommonServiceImpl {
...
@@ -2030,7 +2030,7 @@ public class CommonServiceImpl {
insertPvDataTDEngine
(
fanHealthIndices1
,
format
,
"按时刻"
);
insertPvDataTDEngine
(
fanHealthIndices1
,
format
,
"按时刻"
);
}
}
try
{
try
{
logger
.
info
(
"--------------------response: "
+
response
);
//
logger.info("--------------------response: " + response);
logger
.
info
(
"------------------------------------------调用光伏健康指数计算算法结束----------------------------------------"
);
logger
.
info
(
"------------------------------------------调用光伏健康指数计算算法结束----------------------------------------"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
...
...
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 @
53741f60
...
@@ -211,25 +211,29 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -211,25 +211,29 @@ public class HealthStatusIndicatorServiceImpl {
Double
healthValueRisk
=
0.0
;
Double
healthValueRisk
=
0.0
;
Double
healthValueNotice
=
0.0
;
Double
healthValueNotice
=
0.0
;
long
healthValueWarnCount
=
0
;
int
healthValueWarnCount
=
0
;
long
healthValueRiskCount
=
0
;
int
healthValueRiskCount
=
0
;
long
healthValueNoticeCount
=
0
;
int
healthValueNoticeCount
=
0
;
long
healthValueMinCount
=
0
;
int
healthValueMinCount
=
0
;
int
riskNum
=
0
;
int
warnNum
=
0
;
int
noticeNum
=
0
;
for
(
IdxBizPvWarningRuleSet
e
:
idxBizPvWarningRuleSets
)
{
for
(
IdxBizPvWarningRuleSet
e
:
idxBizPvWarningRuleSets
)
{
switch
(
e
.
getWarningName
()){
switch
(
e
.
getWarningName
()){
case
"警告"
:
case
"警告"
:
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueWarnCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueWarnCount
=
Integer
.
parseInt
(
e
.
getWarningCycle
());
break
;
break
;
case
"危险"
:
case
"危险"
:
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueRiskCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueRiskCount
=
Integer
.
parseInt
(
e
.
getWarningCycle
());
break
;
break
;
case
"注意"
:
case
"注意"
:
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueNoticeCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueNoticeCount
=
Integer
.
parseInt
(
e
.
getWarningCycle
());
break
;
break
;
}
}
...
@@ -237,11 +241,20 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -237,11 +241,20 @@ public class HealthStatusIndicatorServiceImpl {
List
<
Double
>
healthIndex
=
idxBizPvHealthIndices
.
stream
().
map
(
PvHealthIndexMoment:
:
getHealthIndex
).
collect
(
Collectors
.
toList
());
List
<
Double
>
healthIndex
=
idxBizPvHealthIndices
.
stream
().
map
(
PvHealthIndexMoment:
:
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
();
if
(
healthIndex
.
size
()>=
healthValueRiskCount
){
List
<
Double
>
healthIndexList
=
healthIndex
.
subList
(
healthIndex
.
size
()-
healthValueRiskCount
,
healthIndex
.
size
());
riskNum
=
(
int
)
healthIndexList
.
stream
().
filter
(
e
->
e
<=
finalHealthValueRisk
).
count
();
}
Double
finalHealthValueWarn
=
healthValueWarn
;
Double
finalHealthValueWarn
=
healthValueWarn
;
long
warnNum
=
healthIndex
.
subList
(
healthIndex
.
size
()>
healthValueWarnCount
?
(
int
)
(
healthIndex
.
size
()
-
healthValueWarnCount
)
:
0
,
healthIndex
.
size
()).
stream
().
filter
(
e
->
e
<=
finalHealthValueWarn
).
count
();
if
(
healthIndex
.
size
()>=
healthValueWarnCount
){
List
<
Double
>
healthIndexList
=
healthIndex
.
subList
(
healthIndex
.
size
()-
healthValueWarnCount
,
healthIndex
.
size
());
warnNum
=
(
int
)
healthIndexList
.
stream
().
filter
(
e
->
e
<=
finalHealthValueWarn
).
count
();
}
Double
finalHealthValueNotice
=
healthValueNotice
;
Double
finalHealthValueNotice
=
healthValueNotice
;
long
noticeNum
=
healthIndex
.
subList
(
healthIndex
.
size
()>
healthValueNoticeCount
?
(
int
)
(
healthIndex
.
size
()
-
healthValueNoticeCount
)
:
0
,
healthIndex
.
size
()).
stream
().
filter
(
e
->
e
<=
finalHealthValueNotice
).
count
();
if
(
healthIndex
.
size
()>=
healthValueNoticeCount
){
List
<
Double
>
healthIndexList
=
healthIndex
.
subList
(
healthIndex
.
size
()-
healthValueWarnCount
,
healthIndex
.
size
());
noticeNum
=
(
int
)
healthIndexList
.
stream
().
filter
(
e
->
e
<=
finalHealthValueNotice
).
count
();
}
String
level
=
""
;
String
level
=
""
;
String
content
=
""
;
String
content
=
""
;
String
num
=
""
;
String
num
=
""
;
...
@@ -250,12 +263,14 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -250,12 +263,14 @@ public class HealthStatusIndicatorServiceImpl {
level
=
"注意"
;
level
=
"注意"
;
num
=
""
+
healthValueNotice
;
num
=
""
+
healthValueNotice
;
content
=
healthValueNoticeCount
*
10
+
"分钟"
;
content
=
healthValueNoticeCount
*
10
+
"分钟"
;
}
else
if
(
warnNum
==
healthValueWarnCount
){
}
if
(
warnNum
==
healthValueWarnCount
){
// redisUtils.set(gateWayId+"_"+address+"_health_warn_minute","warn");
// redisUtils.set(gateWayId+"_"+address+"_health_warn_minute","warn");
level
=
"警告"
;
level
=
"警告"
;
num
=
""
+
healthValueWarn
;
num
=
""
+
healthValueWarn
;
content
=
healthValueWarnCount
*
10
+
"分钟"
;
content
=
healthValueWarnCount
*
10
+
"分钟"
;
}
else
if
(
riskNum
==
healthValueRiskCount
){
}
if
(
riskNum
==
healthValueRiskCount
){
// redisUtils.set(gateWayId+"_"+address+"_health_risk_minute","risk");
// redisUtils.set(gateWayId+"_"+address+"_health_risk_minute","risk");
level
=
"危险"
;
level
=
"危险"
;
num
=
""
+
healthValueRisk
;
num
=
""
+
healthValueRisk
;
...
@@ -265,13 +280,14 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -265,13 +280,14 @@ public class HealthStatusIndicatorServiceImpl {
//库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成
//库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成
LambdaQueryWrapper
<
PvWarningRecord
>
query
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
PvWarningRecord
>
query
=
new
LambdaQueryWrapper
<>();
query
.
eq
(
PvWarningRecord:
:
getAnalysisPointId
,
idxBizPvHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
query
.
eq
(
PvWarningRecord:
:
getAnalysisPointId
,
idxBizPvHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
query
.
eq
(
PvWarningRecord:
:
getStatus
,
0
);
query
.
eq
(
PvWarningRecord:
:
getStatus
,
"0"
);
query
.
isNull
(
PvWarningRecord:
:
getDisposotionDate
);
query
.
orderByDesc
(
PvWarningRecord:
:
getTs
);
query
.
orderByDesc
(
PvWarningRecord:
:
getTs
);
List
<
PvWarningRecord
>
idxBizPvWarningRecords
=
pvWaringRecordMapper
.
selectList
(
query
);
List
<
PvWarningRecord
>
idxBizPvWarningRecords
=
pvWaringRecordMapper
.
selectList
(
query
);
int
flag
=
ObjectUtils
.
isEmpty
(
idxBizPvWarningRecords
)
||
WarningNameEnum
.
getCode
(
level
)
>
WarningNameEnum
.
getCode
(
idxBizPvWarningRecords
.
get
(
0
).
getWarningName
())
?
0
:
1
;
int
flag
=
ObjectUtils
.
isEmpty
(
idxBizPvWarningRecords
)
||
WarningNameEnum
.
getCode
(
level
)
>
WarningNameEnum
.
getCode
(
idxBizPvWarningRecords
.
get
(
0
).
getWarningName
())
?
0
:
1
;
Boolean
timeFlag
=
format
.
equals
(
idxBizPvHealthIndices
.
get
(
0
).
getRecDate
());
if
(!
level
.
equals
(
""
)
&&
flag
==
0
){
if
(!
level
.
equals
(
""
)
&&
flag
==
0
&&
timeFlag
){
IdxBizPvWarningRecord
idxBizPvWarningRecord
=
new
IdxBizPvWarningRecord
();
IdxBizPvWarningRecord
idxBizPvWarningRecord
=
new
IdxBizPvWarningRecord
();
idxBizPvWarningRecord
.
setKks
(
idxBizPvHealthIndices
.
get
(
0
).
getKks
());
idxBizPvWarningRecord
.
setKks
(
idxBizPvHealthIndices
.
get
(
0
).
getKks
());
idxBizPvWarningRecord
.
setArae
(
idxBizPvHealthIndices
.
get
(
0
).
getArea
());
idxBizPvWarningRecord
.
setArae
(
idxBizPvHealthIndices
.
get
(
0
).
getArea
());
...
@@ -310,6 +326,7 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -310,6 +326,7 @@ public class HealthStatusIndicatorServiceImpl {
// idxBizPvWarningRecordService.saveBatch(idxBizPvWarningRecordList);
// idxBizPvWarningRecordService.saveBatch(idxBizPvWarningRecordList);
if
(
CollUtil
.
isNotEmpty
(
tdPvWarningRecordList
))
{
if
(
CollUtil
.
isNotEmpty
(
tdPvWarningRecordList
))
{
log
.
info
(
"==================光伏按时刻产生预警数据成功"
,
JSON
.
toJSONString
(
tdPvWarningRecordList
));
// tdengine插入
// tdengine插入
pvWaringRecordMapper
.
saveBatchWarningRecords
(
tdPvWarningRecordList
);
pvWaringRecordMapper
.
saveBatchWarningRecords
(
tdPvWarningRecordList
);
}
}
...
@@ -318,6 +335,187 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -318,6 +335,187 @@ public class HealthStatusIndicatorServiceImpl {
}
}
// @Scheduled(cron = "0 0/5 * * * ?")
// @Async("async")
// public void healthWarningMinuteNoArg( ) {
// Date time = new Date();
//// if (!openHealth){
//// return;
//// }
// String format = DateUtil.format(time, "yyyy-MM-dd HH:mm:00");
//// Date date = DateUtils.dateAddHours(time, -8);
// log.info("光伏---------------------预警时间----"+time);
// // Calendar calendar = Calendar.getInstance();
//// calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-1);
// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
//
// Integer maxWaringCycle = idxBizPvWarningRuleSetMapper.getMaxWaringCycleOfMinutes();
// Date date =DateUtil.offsetHour(time,-8);
// date =DateUtil.offsetMinute(date,0-(maxWaringCycle*10));
// LambdaQueryWrapper<PvHealthIndexMoment> wrapper = new LambdaQueryWrapper<>();
// wrapper.ne(PvHealthIndexMoment::getHealthLevel,"安全");
// wrapper.ge(PvHealthIndexMoment::getTs,date);
// wrapper.eq(PvHealthIndexMoment::getAnalysisObjType, "测点");
// wrapper.orderByDesc(PvHealthIndexMoment::getTs);
// List<PvHealthIndexMoment> healthIndices = pvHealthIndexMomentMapper.selectList(wrapper);
// List<String> collect = healthIndices.stream().map(PvHealthIndexMoment::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<PvHealthIndexMoment>>> gateWayMaps = healthIndices.stream().collect(Collectors.groupingBy(PvHealthIndexMoment::getGatewayId, Collectors.groupingBy(PvHealthIndexMoment::getIndexAddress)));
// List<IdxBizPvWarningRecord> idxBizPvWarningRecordList = new ArrayList<>();
// List<PvWarningRecord> tdPvWarningRecordList = new ArrayList<>();
// HashMap<String, StationBasic> stationMap = new HashMap<>();
// for (String gateWayId : gateWayMaps.keySet()) {
//
// LambdaQueryWrapper<StationBasic> basicLambdaQueryWrapper = new LambdaQueryWrapper<>();
// basicLambdaQueryWrapper.eq(StationBasic::getFanGatewayId, gateWayId);
// basicLambdaQueryWrapper.last("limit 1");
// StationBasic stationBasic = stationBasicMapper.selectOne(basicLambdaQueryWrapper);
// stationMap.put(gateWayId, stationBasic);
//
// Map<String, List<PvHealthIndexMoment>> healthDataMaps = gateWayMaps.get(gateWayId);
// for (String address : healthDataMaps.keySet()) {
// List<PvHealthIndexMoment> idxBizPvHealthIndices = healthDataMaps.get(address);
// 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;
//
// int healthValueWarnCount = 0;
// int healthValueRiskCount = 0;
// int healthValueNoticeCount = 0;
// int healthValueMinCount = 0;
// int riskNum=0;
// int warnNum=0;
// int noticeNum=0;
//
//
//
// for (IdxBizPvWarningRuleSet e : idxBizPvWarningRuleSets) {
// switch (e.getWarningName()){
// case "警告":
// healthValueWarn = Double.parseDouble(e.getWarningIf().substring(2));
// healthValueWarnCount =Integer.parseInt(e.getWarningCycle());
// break;
// case "危险":
// healthValueRisk = Double.parseDouble(e.getWarningIf().substring(2));
// healthValueRiskCount =Integer.parseInt(e.getWarningCycle());
// break;
// case "注意":
// healthValueNotice = Double.parseDouble(e.getWarningIf().substring(2));
// healthValueNoticeCount =Integer.parseInt(e.getWarningCycle());
// break;
// }
//
// }
//
// List<Double> healthIndex = idxBizPvHealthIndices.stream().map(PvHealthIndexMoment::getHealthIndex).collect(Collectors.toList());
// Double finalHealthValueRisk = healthValueRisk;
// if(healthIndex.size()>=healthValueRiskCount){
// List<Double> healthIndexList = healthIndex.subList(healthIndex.size()-healthValueRiskCount,healthIndex.size());
// riskNum = (int) healthIndexList.stream().filter(e -> e <= finalHealthValueRisk).count();
// }
// Double finalHealthValueWarn = healthValueWarn;
// if(healthIndex.size()>=healthValueWarnCount){
// List<Double> healthIndexList = healthIndex.subList(healthIndex.size()-healthValueWarnCount,healthIndex.size());
// warnNum = (int) healthIndexList.stream().filter(e -> e <= finalHealthValueWarn).count();
// }
// Double finalHealthValueNotice = healthValueNotice;
// if(healthIndex.size()>=healthValueNoticeCount){
// List<Double> healthIndexList = healthIndex.subList(healthIndex.size()-healthValueWarnCount,healthIndex.size());
// noticeNum = (int) healthIndexList.stream().filter(e -> e <= finalHealthValueNotice).count();
// }
// String level = "";
// String content = "";
// String num = "";
// if (noticeNum == healthValueNoticeCount ){
// // redisUtils.set(gateWayId+"_"+address+"_health_notice_minute","notice");
// level ="注意";
// num = ""+healthValueNotice;
// content = healthValueNoticeCount*10 + "分钟";
// }
// if (warnNum == healthValueWarnCount ){
// // redisUtils.set(gateWayId+"_"+address+"_health_warn_minute","warn");
// level ="警告";
// num = ""+healthValueWarn;
// content = healthValueWarnCount*10 + "分钟";
// }
// if (riskNum == healthValueRiskCount ){
// // redisUtils.set(gateWayId+"_"+address+"_health_risk_minute","risk");
// level ="危险";
// num = ""+healthValueRisk;
// content = healthValueRiskCount*10 + "分钟";
//
// }
// //库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成
// LambdaQueryWrapper<PvWarningRecord> query = new LambdaQueryWrapper<>();
// query.eq(PvWarningRecord::getAnalysisPointId,idxBizPvHealthIndices.get(0).getAnalysisObjSeq());
// query.isNotNull(PvWarningRecord::getDisposotionDate);
// query.orderByDesc(PvWarningRecord::getTs);
// List<PvWarningRecord> idxBizPvWarningRecords = pvWaringRecordMapper.selectList(query);
//
// int flag = ObjectUtils.isEmpty(idxBizPvWarningRecords) || WarningNameEnum.getCode(level) > WarningNameEnum.getCode(idxBizPvWarningRecords.get(0).getWarningName()) ? 0 :1;
//
// if (!level.equals("") && flag == 0){
// IdxBizPvWarningRecord idxBizPvWarningRecord = new IdxBizPvWarningRecord();
// idxBizPvWarningRecord.setKks(idxBizPvHealthIndices.get(0).getKks());
// idxBizPvWarningRecord.setArae(idxBizPvHealthIndices.get(0).getArea());
// idxBizPvWarningRecord.setStation(idxBizPvHealthIndices.get(0).getStation());
// idxBizPvWarningRecord.setSubarray(idxBizPvHealthIndices.get(0).getSubarray());
// idxBizPvWarningRecord.setGatewayId(gateWayId);
// idxBizPvWarningRecord.setIndexAddress(address);
// idxBizPvWarningRecord.setEquipmentName(idxBizPvHealthIndices.get(0).getEquipmentName());
// idxBizPvWarningRecord.setAnalysisPointId(idxBizPvHealthIndices.get(0).getAnalysisObjSeq());
// idxBizPvWarningRecord.setDisposotionState("待确认");
// idxBizPvWarningRecord.setStatus("0");
// idxBizPvWarningRecord.setWarningName(level);
// idxBizPvWarningRecord.setCONTENT(idxBizPvHealthIndices.get(0).getPointName() + "连续"+content+"健康指数≤"+num );
// idxBizPvWarningRecord.setRecDate(time);
// idxBizPvWarningRecord.setWarningPeriod("按时刻");
// idxBizPvWarningRecord.setManufacturer(idxBizPvHealthIndices.get(0).getManufacturer());
// idxBizPvWarningRecord.setPointName(idxBizPvHealthIndices.get(0).getPointName());
// idxBizPvWarningRecord.setHealthIndexSeq(idxBizPvHealthIndices.get(0).getHealthIndex().toString());
// idxBizPvWarningRecord.setHealthLevel(idxBizPvHealthIndices.get(0).getHealthLevel());
// idxBizPvWarningRecordList.add(idxBizPvWarningRecord);
// long currentTimeMillis = System.currentTimeMillis();
// long nanoTime = System.nanoTime();
// long timestamp = currentTimeMillis * 1000000 + nanoTime % 1000000;
// PvWarningRecord pvWarningRecord = new PvWarningRecord();
// BeanUtils.copyProperties(idxBizPvWarningRecord, pvWarningRecord, "disposotionDate", "recDate", "CONTENT");
// pvWarningRecord.setContent(idxBizPvWarningRecord.getCONTENT());
// pvWarningRecord.setRecDate(format);
// pvWarningRecord.setTs(timestamp);
// pvWarningRecord.setHealthIndex(String.format(CommonConstans.Onedecimalplaces,idxBizPvHealthIndices.get(0).getHealthIndex()));
// pvWarningRecord.setOrgCode(idxBizPvHealthIndices.get(0).getOrgCode());
// tdPvWarningRecordList.add(pvWarningRecord);
// // idxBizPvWarningRecordMapper.insert(idxBizPvWarningRecord);
// }
// }
// }
//// idxBizPvWarningRecordService.saveBatch(idxBizPvWarningRecordList);
//
// if (CollUtil.isNotEmpty(tdPvWarningRecordList)) {
// log.info("==================光伏按时刻产生预警数据成功",JSON.toJSONString(tdPvWarningRecordList));
// // tdengine插入
//// pvWaringRecordMapper.saveBatchWarningRecords(tdPvWarningRecordList);
// }
// // 触发风险模型生成预警处置模块的预警记录
// fetchDataPv(tdPvWarningRecordList, stationMap);
//
// }
/***
/***
* 每五小时获取一次最大粒度内的指数异常数据
* 每五小时获取一次最大粒度内的指数异常数据
* 判断五小时内数据是否符合预警规则 符合则报警并在redis中缓存 同一级别的预警记录下次不生成
* 判断五小时内数据是否符合预警规则 符合则报警并在redis中缓存 同一级别的预警记录下次不生成
...
@@ -328,9 +526,9 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -328,9 +526,9 @@ public class HealthStatusIndicatorServiceImpl {
// @Scheduled(cron = "0 0/5 * * * ?")
// @Scheduled(cron = "0 0/5 * * * ?")
@Async
(
"async"
)
@Async
(
"async"
)
public
void
healthWarningHourGF
()
{
public
void
healthWarningHourGF
()
{
//
if (!openHealth){
if
(!
openHealth
){
//
return;
return
;
//
}
}
Date
time
=
new
Date
();
Date
time
=
new
Date
();
// Date date = DateUtils.dateAddHours(time, -13);
// Date date = DateUtils.dateAddHours(time, -13);
// Calendar calendar = Calendar.getInstance();
// Calendar calendar = Calendar.getInstance();
...
@@ -381,10 +579,13 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -381,10 +579,13 @@ public class HealthStatusIndicatorServiceImpl {
Double
healthValueRisk
=
0.0
;
Double
healthValueRisk
=
0.0
;
Double
healthValueNotice
=
0.0
;
Double
healthValueNotice
=
0.0
;
long
healthValueNoticeCount
=
0
;
int
healthValueWarnCount
=
0
;
long
healthValueRiskCount
=
0
;
int
healthValueRiskCount
=
0
;
long
healthValueWarnCount
=
0
;
int
healthValueNoticeCount
=
0
;
long
healthValueHourCount
=
0
;
int
healthValueMinCount
=
0
;
int
riskNum
=
0
;
int
warnNum
=
0
;
int
noticeNum
=
0
;
...
@@ -392,27 +593,41 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -392,27 +593,41 @@ public class HealthStatusIndicatorServiceImpl {
switch
(
e
.
getWarningName
()){
switch
(
e
.
getWarningName
()){
case
"警告"
:
case
"警告"
:
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueWarnCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueWarnCount
=
Integer
.
parseInt
(
e
.
getWarningCycle
());
break
;
break
;
case
"危险"
:
case
"危险"
:
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueRiskCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueRiskCount
=
Integer
.
parseInt
(
e
.
getWarningCycle
());
break
;
break
;
case
"注意"
:
case
"注意"
:
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueNoticeCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueNoticeCount
=
Integer
.
parseInt
(
e
.
getWarningCycle
());
break
;
break
;
}
}
}
}
List
<
Double
>
healthIndex
=
idxBizPvHealthIndices
.
stream
().
map
(
PvHealthIndexHour:
:
getHealthIndex
).
collect
(
Collectors
.
toList
());
List
<
Double
>
healthIndex
=
idxBizPvHealthIndices
.
stream
().
map
(
PvHealthIndexHour:
:
getHealthIndex
).
collect
(
Collectors
.
toList
());
// Double finalHealthValueRisk = healthValueRisk;
// long riskNum = healthIndex.subList(healthIndex.size()>healthValueRiskCount? (int) (healthIndex.size() - healthValueRiskCount) :0,healthIndex.size()).stream().filter(e -> e <= finalHealthValueRisk).count();
// Double finalHealthValueWarn = healthValueWarn;
// long warnNum = healthIndex.subList(healthIndex.size()>healthValueWarnCount? (int) (healthIndex.size() - healthValueWarnCount) :0,healthIndex.size()).stream().filter(e -> e <= finalHealthValueWarn).count();
// Double finalHealthValueNotice = healthValueNotice;
// long noticeNum = healthIndex.subList(healthIndex.size()>healthValueNoticeCount? (int) (healthIndex.size() - healthValueNoticeCount) :0,healthIndex.size()).stream().filter(e -> e <= finalHealthValueNotice).count();
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
();
if
(
healthIndex
.
size
()>=
healthValueRiskCount
){
List
<
Double
>
healthIndexList
=
healthIndex
.
subList
(
healthIndex
.
size
()-
healthValueRiskCount
,
healthIndex
.
size
());
riskNum
=
(
int
)
healthIndexList
.
stream
().
filter
(
e
->
e
<=
finalHealthValueRisk
).
count
();
}
Double
finalHealthValueWarn
=
healthValueWarn
;
Double
finalHealthValueWarn
=
healthValueWarn
;
long
warnNum
=
healthIndex
.
subList
(
healthIndex
.
size
()>
healthValueWarnCount
?
(
int
)
(
healthIndex
.
size
()
-
healthValueWarnCount
)
:
0
,
healthIndex
.
size
()).
stream
().
filter
(
e
->
e
<=
finalHealthValueWarn
).
count
();
if
(
healthIndex
.
size
()>=
healthValueWarnCount
){
List
<
Double
>
healthIndexList
=
healthIndex
.
subList
(
healthIndex
.
size
()-
healthValueWarnCount
,
healthIndex
.
size
());
warnNum
=
(
int
)
healthIndexList
.
stream
().
filter
(
e
->
e
<=
finalHealthValueWarn
).
count
();
}
Double
finalHealthValueNotice
=
healthValueNotice
;
Double
finalHealthValueNotice
=
healthValueNotice
;
long
noticeNum
=
healthIndex
.
subList
(
healthIndex
.
size
()>
healthValueNoticeCount
?
(
int
)
(
healthIndex
.
size
()
-
healthValueNoticeCount
)
:
0
,
healthIndex
.
size
()).
stream
().
filter
(
e
->
e
<=
finalHealthValueNotice
).
count
();
if
(
healthIndex
.
size
()>=
healthValueNoticeCount
){
List
<
Double
>
healthIndexList
=
healthIndex
.
subList
(
healthIndex
.
size
()-
healthValueWarnCount
,
healthIndex
.
size
());
noticeNum
=
(
int
)
healthIndexList
.
stream
().
filter
(
e
->
e
<=
finalHealthValueNotice
).
count
();
}
String
level
=
""
;
String
level
=
""
;
String
content
=
""
;
String
content
=
""
;
String
num
=
""
;
String
num
=
""
;
...
@@ -420,12 +635,14 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -420,12 +635,14 @@ public class HealthStatusIndicatorServiceImpl {
level
=
"注意"
;
level
=
"注意"
;
num
=
""
+
healthValueNotice
;
num
=
""
+
healthValueNotice
;
content
=
healthValueNoticeCount
+
"小时"
;
content
=
healthValueNoticeCount
+
"小时"
;
}
else
if
(
warnNum
==
healthValueWarnCount
){
}
if
(
warnNum
==
healthValueWarnCount
){
level
=
"警告"
;
level
=
"警告"
;
num
=
""
+
healthValueWarn
;
num
=
""
+
healthValueWarn
;
content
=
healthValueWarnCount
+
"小时"
;
content
=
healthValueWarnCount
+
"小时"
;
}
else
if
(
riskNum
==
healthValueRiskCount
){
}
if
(
riskNum
==
healthValueRiskCount
){
level
=
"危险"
;
level
=
"危险"
;
num
=
""
+
healthValueRisk
;
num
=
""
+
healthValueRisk
;
content
=
healthValueRiskCount
+
"小时"
;
content
=
healthValueRiskCount
+
"小时"
;
...
@@ -433,13 +650,14 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -433,13 +650,14 @@ public class HealthStatusIndicatorServiceImpl {
//库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成
//库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成
LambdaQueryWrapper
<
PvWarningRecord
>
query
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
PvWarningRecord
>
query
=
new
LambdaQueryWrapper
<>();
query
.
eq
(
PvWarningRecord:
:
getAnalysisPointId
,
idxBizPvHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
query
.
eq
(
PvWarningRecord:
:
getAnalysisPointId
,
idxBizPvHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
query
.
eq
(
PvWarningRecord:
:
getStatus
,
0
);
query
.
eq
(
PvWarningRecord:
:
getStatus
,
"0"
);
query
.
isNull
(
PvWarningRecord:
:
getDisposotionDate
);
query
.
orderByDesc
(
PvWarningRecord:
:
getRecDate
);
query
.
orderByDesc
(
PvWarningRecord:
:
getRecDate
);
List
<
PvWarningRecord
>
idxBizPvWarningRecords
=
pvWaringRecordMapper
.
selectList
(
query
);
List
<
PvWarningRecord
>
idxBizPvWarningRecords
=
pvWaringRecordMapper
.
selectList
(
query
);
int
flag
=
ObjectUtils
.
isEmpty
(
idxBizPvWarningRecords
)
||
WarningNameEnum
.
getCode
(
level
)
>
WarningNameEnum
.
getCode
(
idxBizPvWarningRecords
.
get
(
0
).
getWarningName
())
?
0
:
1
;
int
flag
=
ObjectUtils
.
isEmpty
(
idxBizPvWarningRecords
)
||
WarningNameEnum
.
getCode
(
level
)
>
WarningNameEnum
.
getCode
(
idxBizPvWarningRecords
.
get
(
0
).
getWarningName
())
?
0
:
1
;
Boolean
timeFlag
=
format
.
equals
(
idxBizPvHealthIndices
.
get
(
0
).
getRecDate
());
if
(!
level
.
equals
(
""
)
&&
flag
==
0
){
if
(!
level
.
equals
(
""
)
&&
flag
==
0
&&
timeFlag
){
IdxBizPvWarningRecord
idxBizPvWarningRecord
=
new
IdxBizPvWarningRecord
();
IdxBizPvWarningRecord
idxBizPvWarningRecord
=
new
IdxBizPvWarningRecord
();
idxBizPvWarningRecord
.
setKks
(
idxBizPvHealthIndices
.
get
(
0
).
getKks
());
idxBizPvWarningRecord
.
setKks
(
idxBizPvHealthIndices
.
get
(
0
).
getKks
());
idxBizPvWarningRecord
.
setArae
(
idxBizPvHealthIndices
.
get
(
0
).
getArea
());
idxBizPvWarningRecord
.
setArae
(
idxBizPvHealthIndices
.
get
(
0
).
getArea
());
...
@@ -479,6 +697,7 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -479,6 +697,7 @@ public class HealthStatusIndicatorServiceImpl {
// idxBizPvWarningRecordService.saveBatch(idxBizPvWarningRecordList);
// idxBizPvWarningRecordService.saveBatch(idxBizPvWarningRecordList);
if
(
CollUtil
.
isNotEmpty
(
tdPvWarningRecordList
))
{
if
(
CollUtil
.
isNotEmpty
(
tdPvWarningRecordList
))
{
// tdengine插入
// tdengine插入
log
.
info
(
"==================光伏按小时产生预警数据成功"
,
JSON
.
toJSONString
(
tdPvWarningRecordList
));
pvWaringRecordMapper
.
saveBatchWarningRecords
(
tdPvWarningRecordList
);
pvWaringRecordMapper
.
saveBatchWarningRecords
(
tdPvWarningRecordList
);
}
}
// 触发风险模型生成预警处置模块的预警记录
// 触发风险模型生成预警处置模块的预警记录
...
@@ -546,36 +765,54 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -546,36 +765,54 @@ public class HealthStatusIndicatorServiceImpl {
Double
healthValueRisk
=
0.0
;
Double
healthValueRisk
=
0.0
;
Double
healthValueNotice
=
0.0
;
Double
healthValueNotice
=
0.0
;
long
healthValueDayCount
=
0
;
int
healthValueWarnCount
=
0
;
long
healthValueNoticeCount
=
0
;
int
healthValueRiskCount
=
0
;
long
healthValueRiskCount
=
0
;
int
healthValueNoticeCount
=
0
;
long
healthValueWarnCount
=
0
;
int
healthValueMinCount
=
0
;
int
riskNum
=
0
;
int
warnNum
=
0
;
int
noticeNum
=
0
;
for
(
IdxBizPvWarningRuleSet
e
:
idxBizPvWarningRuleSets
)
{
for
(
IdxBizPvWarningRuleSet
e
:
idxBizPvWarningRuleSets
)
{
switch
(
e
.
getWarningName
()){
switch
(
e
.
getWarningName
()){
case
"警告"
:
case
"警告"
:
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueWarnCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueWarnCount
=
Integer
.
parseInt
(
e
.
getWarningCycle
());
break
;
break
;
case
"危险"
:
case
"危险"
:
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueRiskCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueRiskCount
=
Integer
.
parseInt
(
e
.
getWarningCycle
());
break
;
break
;
case
"注意"
:
case
"注意"
:
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueNoticeCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueNoticeCount
=
Integer
.
parseInt
(
e
.
getWarningCycle
());
break
;
break
;
}
}
}
}
List
<
Double
>
healthIndex
=
idxBizPvHealthIndices
.
stream
().
map
(
PvHealthIndexDay:
:
getHealthIndex
).
collect
(
Collectors
.
toList
());
List
<
Double
>
healthIndex
=
idxBizPvHealthIndices
.
stream
().
map
(
PvHealthIndexDay:
:
getHealthIndex
).
collect
(
Collectors
.
toList
());
// Double finalHealthValueRisk = healthValueRisk;
// long riskNum = healthIndex.subList(healthIndex.size()>healthValueRiskCount? (int) (healthIndex.size() - healthValueRiskCount) :0,healthIndex.size()).stream().filter(e -> e <= finalHealthValueRisk).count();
// Double finalHealthValueWarn = healthValueWarn;
// long warnNum = healthIndex.subList(healthIndex.size()>healthValueWarnCount? (int) (healthIndex.size() - healthValueWarnCount) :0,healthIndex.size()).stream().filter(e -> e <= finalHealthValueWarn).count();
// Double finalHealthValueNotice = healthValueNotice;
// long noticeNum = healthIndex.subList(healthIndex.size()>healthValueNoticeCount? (int) (healthIndex.size() - healthValueNoticeCount) :0,healthIndex.size()).stream().filter(e -> e <= finalHealthValueNotice).count();
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
();
if
(
healthIndex
.
size
()>=
healthValueRiskCount
){
List
<
Double
>
healthIndexList
=
healthIndex
.
subList
(
healthIndex
.
size
()-
healthValueRiskCount
,
healthIndex
.
size
());
riskNum
=
(
int
)
healthIndexList
.
stream
().
filter
(
e
->
e
<=
finalHealthValueRisk
).
count
();
}
Double
finalHealthValueWarn
=
healthValueWarn
;
Double
finalHealthValueWarn
=
healthValueWarn
;
long
warnNum
=
healthIndex
.
subList
(
healthIndex
.
size
()>
healthValueWarnCount
?
(
int
)
(
healthIndex
.
size
()
-
healthValueWarnCount
)
:
0
,
healthIndex
.
size
()).
stream
().
filter
(
e
->
e
<=
finalHealthValueWarn
).
count
();
if
(
healthIndex
.
size
()>=
healthValueWarnCount
){
List
<
Double
>
healthIndexList
=
healthIndex
.
subList
(
healthIndex
.
size
()-
healthValueWarnCount
,
healthIndex
.
size
());
warnNum
=
(
int
)
healthIndexList
.
stream
().
filter
(
e
->
e
<=
finalHealthValueWarn
).
count
();
}
Double
finalHealthValueNotice
=
healthValueNotice
;
Double
finalHealthValueNotice
=
healthValueNotice
;
long
noticeNum
=
healthIndex
.
subList
(
healthIndex
.
size
()>
healthValueNoticeCount
?
(
int
)
(
healthIndex
.
size
()
-
healthValueNoticeCount
)
:
0
,
healthIndex
.
size
()).
stream
().
filter
(
e
->
e
<=
finalHealthValueNotice
).
count
();
if
(
healthIndex
.
size
()>=
healthValueNoticeCount
){
List
<
Double
>
healthIndexList
=
healthIndex
.
subList
(
healthIndex
.
size
()-
healthValueWarnCount
,
healthIndex
.
size
());
noticeNum
=
(
int
)
healthIndexList
.
stream
().
filter
(
e
->
e
<=
finalHealthValueNotice
).
count
();
}
String
level
=
""
;
String
level
=
""
;
String
content
=
""
;
String
content
=
""
;
String
num
=
""
;
String
num
=
""
;
...
@@ -585,12 +822,14 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -585,12 +822,14 @@ public class HealthStatusIndicatorServiceImpl {
level
=
"注意"
;
level
=
"注意"
;
num
=
""
+
healthValueNotice
;
num
=
""
+
healthValueNotice
;
content
=
healthValueNoticeCount
+
"天"
;
content
=
healthValueNoticeCount
+
"天"
;
}
else
if
(
warnNum
==
healthValueWarnCount
){
}
if
(
warnNum
==
healthValueWarnCount
){
// redisUtils.set(gateWayId+"_"+address+"_health_warn_day","warn");
// redisUtils.set(gateWayId+"_"+address+"_health_warn_day","warn");
level
=
"警告"
;
level
=
"警告"
;
num
=
""
+
healthValueWarn
;
num
=
""
+
healthValueWarn
;
content
=
healthValueWarnCount
+
"天"
;
content
=
healthValueWarnCount
+
"天"
;
}
else
if
(
riskNum
==
healthValueRiskCount
){
}
if
(
riskNum
==
healthValueRiskCount
){
// redisUtils.set(gateWayId+"_"+address+"_health_risk_day","risk");
// redisUtils.set(gateWayId+"_"+address+"_health_risk_day","risk");
level
=
"危险"
;
level
=
"危险"
;
num
=
""
+
healthValueRisk
;
num
=
""
+
healthValueRisk
;
...
@@ -599,13 +838,14 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -599,13 +838,14 @@ public class HealthStatusIndicatorServiceImpl {
//库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成
//库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成
LambdaQueryWrapper
<
PvWarningRecord
>
query
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
PvWarningRecord
>
query
=
new
LambdaQueryWrapper
<>();
query
.
eq
(
PvWarningRecord:
:
getAnalysisPointId
,
idxBizPvHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
query
.
eq
(
PvWarningRecord:
:
getAnalysisPointId
,
idxBizPvHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
query
.
eq
(
PvWarningRecord:
:
getStatus
,
0
);
query
.
eq
(
PvWarningRecord:
:
getStatus
,
"0"
);
query
.
isNull
(
PvWarningRecord:
:
getDisposotionDate
);
query
.
orderByDesc
(
PvWarningRecord:
:
getTs
);
query
.
orderByDesc
(
PvWarningRecord:
:
getTs
);
List
<
PvWarningRecord
>
idxBizPvWarningRecords
=
pvWaringRecordMapper
.
selectList
(
query
);
List
<
PvWarningRecord
>
idxBizPvWarningRecords
=
pvWaringRecordMapper
.
selectList
(
query
);
int
flag
=
ObjectUtils
.
isEmpty
(
idxBizPvWarningRecords
)
||
WarningNameEnum
.
getCode
(
level
)
>
WarningNameEnum
.
getCode
(
idxBizPvWarningRecords
.
get
(
0
).
getWarningName
())
?
0
:
1
;
int
flag
=
ObjectUtils
.
isEmpty
(
idxBizPvWarningRecords
)
||
WarningNameEnum
.
getCode
(
level
)
>
WarningNameEnum
.
getCode
(
idxBizPvWarningRecords
.
get
(
0
).
getWarningName
())
?
0
:
1
;
Boolean
timeFlag
=
format
.
equals
(
idxBizPvHealthIndices
.
get
(
0
).
getRecDate
());
if
(!
level
.
equals
(
""
)
&&
flag
==
0
){
if
(!
level
.
equals
(
""
)
&&
flag
==
0
&&
timeFlag
){
IdxBizPvWarningRecord
idxBizPvWarningRecord
=
new
IdxBizPvWarningRecord
();
IdxBizPvWarningRecord
idxBizPvWarningRecord
=
new
IdxBizPvWarningRecord
();
idxBizPvWarningRecord
.
setKks
(
idxBizPvHealthIndices
.
get
(
0
).
getKks
());
idxBizPvWarningRecord
.
setKks
(
idxBizPvHealthIndices
.
get
(
0
).
getKks
());
idxBizPvWarningRecord
.
setArae
(
idxBizPvHealthIndices
.
get
(
0
).
getArea
());
idxBizPvWarningRecord
.
setArae
(
idxBizPvHealthIndices
.
get
(
0
).
getArea
());
...
@@ -644,6 +884,7 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -644,6 +884,7 @@ public class HealthStatusIndicatorServiceImpl {
}
}
// idxBizPvWarningRecordService.saveBatch(idxBizPvWarningRecordList);
// idxBizPvWarningRecordService.saveBatch(idxBizPvWarningRecordList);
if
(
CollUtil
.
isNotEmpty
(
tdPvWarningRecordList
))
{
if
(
CollUtil
.
isNotEmpty
(
tdPvWarningRecordList
))
{
log
.
info
(
"==================光伏按天产生预警数据成功"
,
JSON
.
toJSONString
(
tdPvWarningRecordList
));
// tdengine插入
// tdengine插入
pvWaringRecordMapper
.
saveBatchWarningRecords
(
tdPvWarningRecordList
);
pvWaringRecordMapper
.
saveBatchWarningRecords
(
tdPvWarningRecordList
);
}
}
...
@@ -712,25 +953,28 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -712,25 +953,28 @@ public class HealthStatusIndicatorServiceImpl {
Double
healthValueRisk
=
0.0
;
Double
healthValueRisk
=
0.0
;
Double
healthValueNotice
=
0.0
;
Double
healthValueNotice
=
0.0
;
long
healthValueWarnCount
=
0
;
int
healthValueWarnCount
=
0
;
long
healthValueRiskCount
=
0
;
int
healthValueRiskCount
=
0
;
long
healthValueNoticeCount
=
0
;
int
healthValueNoticeCount
=
0
;
long
healthValueMinCount
=
0
;
int
healthValueMinCount
=
0
;
int
riskNum
=
0
;
int
warnNum
=
0
;
int
noticeNum
=
0
;
for
(
IdxBizFanWarningRuleSet
e
:
idxBizPvWarningRuleSets
)
{
for
(
IdxBizFanWarningRuleSet
e
:
idxBizPvWarningRuleSets
)
{
switch
(
e
.
getWarningName
()){
switch
(
e
.
getWarningName
()){
case
"警告"
:
case
"警告"
:
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueWarnCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueWarnCount
=
Integer
.
parseInt
(
e
.
getWarningCycle
());
break
;
break
;
case
"危险"
:
case
"危险"
:
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueRiskCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueRiskCount
=
Integer
.
parseInt
(
e
.
getWarningCycle
());
break
;
break
;
case
"注意"
:
case
"注意"
:
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueNoticeCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueNoticeCount
=
Integer
.
parseInt
(
e
.
getWarningCycle
());
break
;
break
;
}
}
...
@@ -739,13 +983,27 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -739,13 +983,27 @@ 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;
// long riskNum = healthIndex.subList(healthIndex.size()>healthValueRiskCount? (int) (healthIndex.size() - healthValueRiskCount) :0,healthIndex.size()).stream().filter(e -> e <= finalHealthValueRisk).count();
// Double finalHealthValueWarn = healthValueWarn;
// long warnNum = healthIndex.subList(healthIndex.size()>healthValueWarnCount? (int) (healthIndex.size() - healthValueWarnCount) :0,healthIndex.size()).stream().filter(e -> e <= finalHealthValueWarn).count();
// Double finalHealthValueNotice = healthValueNotice;
// long noticeNum = healthIndex.subList(healthIndex.size()>healthValueNoticeCount? (int) (healthIndex.size() - healthValueNoticeCount) :0,healthIndex.size()).stream().filter(e -> e <= finalHealthValueNotice).count();
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
();
if
(
healthIndex
.
size
()>=
healthValueRiskCount
){
List
<
Double
>
healthIndexList
=
healthIndex
.
subList
(
healthIndex
.
size
()-
healthValueRiskCount
,
healthIndex
.
size
());
riskNum
=
(
int
)
healthIndexList
.
stream
().
filter
(
e
->
e
<=
finalHealthValueRisk
).
count
();
}
Double
finalHealthValueWarn
=
healthValueWarn
;
Double
finalHealthValueWarn
=
healthValueWarn
;
long
warnNum
=
healthIndex
.
subList
(
healthIndex
.
size
()>
healthValueWarnCount
?
(
int
)
(
healthIndex
.
size
()
-
healthValueWarnCount
)
:
0
,
healthIndex
.
size
()).
stream
().
filter
(
e
->
e
<=
finalHealthValueWarn
).
count
();
if
(
healthIndex
.
size
()>=
healthValueWarnCount
){
List
<
Double
>
healthIndexList
=
healthIndex
.
subList
(
healthIndex
.
size
()-
healthValueWarnCount
,
healthIndex
.
size
());
warnNum
=
(
int
)
healthIndexList
.
stream
().
filter
(
e
->
e
<=
finalHealthValueWarn
).
count
();
}
Double
finalHealthValueNotice
=
healthValueNotice
;
Double
finalHealthValueNotice
=
healthValueNotice
;
long
noticeNum
=
healthIndex
.
subList
(
healthIndex
.
size
()>
healthValueNoticeCount
?
(
int
)
(
healthIndex
.
size
()
-
healthValueNoticeCount
)
:
0
,
healthIndex
.
size
()).
stream
().
filter
(
e
->
e
<=
finalHealthValueNotice
).
count
();
if
(
healthIndex
.
size
()>=
healthValueNoticeCount
){
List
<
Double
>
healthIndexList
=
healthIndex
.
subList
(
healthIndex
.
size
()-
healthValueWarnCount
,
healthIndex
.
size
());
noticeNum
=
(
int
)
healthIndexList
.
stream
().
filter
(
e
->
e
<=
finalHealthValueNotice
).
count
();
}
String
level
=
""
;
String
level
=
""
;
String
content
=
""
;
String
content
=
""
;
String
num
=
""
;
String
num
=
""
;
...
@@ -755,12 +1013,13 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -755,12 +1013,13 @@ public class HealthStatusIndicatorServiceImpl {
num
=
""
+
healthValueNotice
;
num
=
""
+
healthValueNotice
;
content
=
healthValueNoticeCount
*
10
+
"分钟"
;
content
=
healthValueNoticeCount
*
10
+
"分钟"
;
}
}
else
if
(
warnNum
==
healthValueWarnCount
){
if
(
warnNum
==
healthValueWarnCount
){
// redisUtils.set(gateWayId+"_"+address+"_health_warn_day","warn");
// redisUtils.set(gateWayId+"_"+address+"_health_warn_day","warn");
level
=
"警告"
;
level
=
"警告"
;
num
=
""
+
healthValueWarn
;
num
=
""
+
healthValueWarn
;
content
=
healthValueWarnCount
*
10
+
"分钟"
;
content
=
healthValueWarnCount
*
10
+
"分钟"
;
}
else
if
(
riskNum
==
healthValueRiskCount
){
}
if
(
riskNum
==
healthValueRiskCount
){
// redisUtils.set(gateWayId+"_"+address+"_health_risk_day","risk");
// redisUtils.set(gateWayId+"_"+address+"_health_risk_day","risk");
level
=
"危险"
;
level
=
"危险"
;
num
=
""
+
healthValueRisk
;
num
=
""
+
healthValueRisk
;
...
@@ -769,13 +1028,14 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -769,13 +1028,14 @@ public class HealthStatusIndicatorServiceImpl {
//库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成
//库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成
LambdaQueryWrapper
<
FanWarningRecord
>
query
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
FanWarningRecord
>
query
=
new
LambdaQueryWrapper
<>();
query
.
eq
(
FanWarningRecord:
:
getAnalysisPointId
,
idxBizFanHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
query
.
eq
(
FanWarningRecord:
:
getAnalysisPointId
,
idxBizFanHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
query
.
eq
(
FanWarningRecord:
:
getStatus
,
0
);
query
.
eq
(
FanWarningRecord:
:
getStatus
,
"0"
);
query
.
isNull
(
FanWarningRecord:
:
getDisposotionDate
);
query
.
orderByDesc
(
FanWarningRecord:
:
getTs
);
query
.
orderByDesc
(
FanWarningRecord:
:
getTs
);
List
<
FanWarningRecord
>
idxBizFanWarningRecords
=
fanWaringRecordMapper
.
selectList
(
query
);
List
<
FanWarningRecord
>
idxBizFanWarningRecords
=
fanWaringRecordMapper
.
selectList
(
query
);
int
flag
=
ObjectUtils
.
isEmpty
(
idxBizFanWarningRecords
)
||
WarningNameEnum
.
getCode
(
level
)
>
WarningNameEnum
.
getCode
(
idxBizFanWarningRecords
.
get
(
0
).
getWarningName
())
?
0
:
1
;
int
flag
=
ObjectUtils
.
isEmpty
(
idxBizFanWarningRecords
)
||
WarningNameEnum
.
getCode
(
level
)
>
WarningNameEnum
.
getCode
(
idxBizFanWarningRecords
.
get
(
0
).
getWarningName
())
?
0
:
1
;
Boolean
timeFlag
=
format
.
equals
(
idxBizFanHealthIndices
.
get
(
0
).
getRecDate
());
if
(!
level
.
equals
(
""
)
&&
flag
==
0
){
if
(!
level
.
equals
(
""
)
&&
flag
==
0
&&
timeFlag
){
IdxBizFanWarningRecord
idxBizFanWarningRecord
=
new
IdxBizFanWarningRecord
();
IdxBizFanWarningRecord
idxBizFanWarningRecord
=
new
IdxBizFanWarningRecord
();
idxBizFanWarningRecord
.
setKks
(
idxBizFanHealthIndices
.
get
(
0
).
getKks
());
idxBizFanWarningRecord
.
setKks
(
idxBizFanHealthIndices
.
get
(
0
).
getKks
());
idxBizFanWarningRecord
.
setArae
(
idxBizFanHealthIndices
.
get
(
0
).
getArea
());
idxBizFanWarningRecord
.
setArae
(
idxBizFanHealthIndices
.
get
(
0
).
getArea
());
...
@@ -889,36 +1149,58 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -889,36 +1149,58 @@ public class HealthStatusIndicatorServiceImpl {
Double
healthValueRisk
=
0.0
;
Double
healthValueRisk
=
0.0
;
Double
healthValueNotice
=
0.0
;
Double
healthValueNotice
=
0.0
;
long
healthValueNoticeCount
=
0
;
// long healthValueNoticeCount = 0;
long
healthValueRiskCount
=
0
;
// long healthValueRiskCount = 0;
long
healthValueWarnCount
=
0
;
// long healthValueWarnCount = 0;
int
healthValueWarnCount
=
0
;
int
healthValueRiskCount
=
0
;
int
healthValueNoticeCount
=
0
;
int
healthValueMinCount
=
0
;
int
riskNum
=
0
;
int
warnNum
=
0
;
int
noticeNum
=
0
;
for
(
IdxBizFanWarningRuleSet
e
:
idxBizPvWarningRuleSets
)
{
for
(
IdxBizFanWarningRuleSet
e
:
idxBizPvWarningRuleSets
)
{
switch
(
e
.
getWarningName
()){
switch
(
e
.
getWarningName
()){
case
"警告"
:
case
"警告"
:
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueWarnCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueWarnCount
=
Integer
.
parseInt
(
e
.
getWarningCycle
());
break
;
break
;
case
"危险"
:
case
"危险"
:
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueRiskCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueRiskCount
=
Integer
.
parseInt
(
e
.
getWarningCycle
());
break
;
break
;
case
"注意"
:
case
"注意"
:
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueNoticeCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueNoticeCount
=
Integer
.
parseInt
(
e
.
getWarningCycle
());
break
;
break
;
}
}
}
}
List
<
Double
>
healthIndex
=
idxBizFanHealthIndices
.
stream
().
map
(
FanHealthIndexHour:
:
getHealthIndex
).
collect
(
Collectors
.
toList
());
List
<
Double
>
healthIndex
=
idxBizFanHealthIndices
.
stream
().
map
(
FanHealthIndexHour:
:
getHealthIndex
).
collect
(
Collectors
.
toList
());
// Double finalHealthValueRisk = healthValueRisk;
// long riskNum = healthIndex.subList(healthIndex.size()>healthValueRiskCount? (int) (healthIndex.size() - healthValueRiskCount) :0,healthIndex.size()).stream().filter(e -> e <= finalHealthValueRisk).count();
// Double finalHealthValueWarn = healthValueWarn;
// long warnNum = healthIndex.subList(healthIndex.size()>healthValueWarnCount? (int) (healthIndex.size() - healthValueWarnCount) :0,healthIndex.size()).stream().filter(e -> e <= finalHealthValueWarn).count();
// Double finalHealthValueNotice = healthValueNotice;
// long noticeNum = healthIndex.subList(healthIndex.size()>healthValueNoticeCount? (int) (healthIndex.size() - healthValueNoticeCount) :0,healthIndex.size()).stream().filter(e -> e <= finalHealthValueNotice).count();
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
();
if
(
healthIndex
.
size
()>=
healthValueRiskCount
){
List
<
Double
>
healthIndexList
=
healthIndex
.
subList
(
healthIndex
.
size
()-
healthValueRiskCount
,
healthIndex
.
size
());
riskNum
=
(
int
)
healthIndexList
.
stream
().
filter
(
e
->
e
<=
finalHealthValueRisk
).
count
();
}
Double
finalHealthValueWarn
=
healthValueWarn
;
Double
finalHealthValueWarn
=
healthValueWarn
;
long
warnNum
=
healthIndex
.
subList
(
healthIndex
.
size
()>
healthValueWarnCount
?
(
int
)
(
healthIndex
.
size
()
-
healthValueWarnCount
)
:
0
,
healthIndex
.
size
()).
stream
().
filter
(
e
->
e
<=
finalHealthValueWarn
).
count
();
if
(
healthIndex
.
size
()>=
healthValueWarnCount
){
List
<
Double
>
healthIndexList
=
healthIndex
.
subList
(
healthIndex
.
size
()-
healthValueWarnCount
,
healthIndex
.
size
());
warnNum
=
(
int
)
healthIndexList
.
stream
().
filter
(
e
->
e
<=
finalHealthValueWarn
).
count
();
}
Double
finalHealthValueNotice
=
healthValueNotice
;
Double
finalHealthValueNotice
=
healthValueNotice
;
long
noticeNum
=
healthIndex
.
subList
(
healthIndex
.
size
()>
healthValueNoticeCount
?
(
int
)
(
healthIndex
.
size
()
-
healthValueNoticeCount
)
:
0
,
healthIndex
.
size
()).
stream
().
filter
(
e
->
e
<=
finalHealthValueNotice
).
count
();
if
(
healthIndex
.
size
()>=
healthValueNoticeCount
){
List
<
Double
>
healthIndexList
=
healthIndex
.
subList
(
healthIndex
.
size
()-
healthValueWarnCount
,
healthIndex
.
size
());
noticeNum
=
(
int
)
healthIndexList
.
stream
().
filter
(
e
->
e
<=
finalHealthValueNotice
).
count
();
}
String
level
=
""
;
String
level
=
""
;
String
content
=
""
;
String
content
=
""
;
String
num
=
""
;
String
num
=
""
;
...
@@ -926,25 +1208,28 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -926,25 +1208,28 @@ public class HealthStatusIndicatorServiceImpl {
level
=
"注意"
;
level
=
"注意"
;
num
=
""
+
healthValueNotice
;
num
=
""
+
healthValueNotice
;
content
=
healthValueNoticeCount
+
"小时"
;
content
=
healthValueNoticeCount
+
"小时"
;
}
else
if
(
warnNum
==
healthValueWarnCount
){
}
if
(
warnNum
==
healthValueWarnCount
){
level
=
"警告"
;
level
=
"警告"
;
num
=
""
+
healthValueWarn
;
num
=
""
+
healthValueWarn
;
content
=
healthValueWarnCount
+
"小时"
;
content
=
healthValueWarnCount
+
"小时"
;
}
else
if
(
riskNum
==
healthValueRiskCount
){
}
if
(
riskNum
==
healthValueRiskCount
){
level
=
"危险"
;
level
=
"危险"
;
num
=
""
+
healthValueRisk
;
num
=
""
+
healthValueRisk
;
content
=
healthValueRiskCount
+
"小时"
;
content
=
healthValueRiskCount
+
"小时"
;
}
}
LambdaQueryWrapper
<
FanWarningRecord
>
query
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
FanWarningRecord
>
query
=
new
LambdaQueryWrapper
<>();
query
.
eq
(
FanWarningRecord:
:
getAnalysisPointId
,
idxBizFanHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
query
.
eq
(
FanWarningRecord:
:
getAnalysisPointId
,
idxBizFanHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
query
.
eq
(
FanWarningRecord:
:
getStatus
,
0
);
query
.
eq
(
FanWarningRecord:
:
getStatus
,
"0"
);
query
.
isNull
(
FanWarningRecord:
:
getDisposotionDate
);
query
.
orderByDesc
(
FanWarningRecord:
:
getTs
);
query
.
orderByDesc
(
FanWarningRecord:
:
getTs
);
List
<
FanWarningRecord
>
idxBizFanWarningRecords
=
fanWaringRecordMapper
.
selectList
(
query
);
List
<
FanWarningRecord
>
idxBizFanWarningRecords
=
fanWaringRecordMapper
.
selectList
(
query
);
int
flag
=
ObjectUtils
.
isEmpty
(
idxBizFanWarningRecords
)
||
WarningNameEnum
.
getCode
(
level
)
>
WarningNameEnum
.
getCode
(
idxBizFanWarningRecords
.
get
(
0
).
getWarningName
())
?
0
:
1
;
int
flag
=
ObjectUtils
.
isEmpty
(
idxBizFanWarningRecords
)
||
WarningNameEnum
.
getCode
(
level
)
>
WarningNameEnum
.
getCode
(
idxBizFanWarningRecords
.
get
(
0
).
getWarningName
())
?
0
:
1
;
Boolean
timeFlag
=
format
.
equals
(
idxBizFanHealthIndices
.
get
(
0
).
getRecDate
());
if
(!
level
.
equals
(
""
)
&&
flag
==
0
){
if
(!
level
.
equals
(
""
)
&&
flag
==
0
&&
timeFlag
){
IdxBizFanWarningRecord
idxBizFanWarningRecord
=
new
IdxBizFanWarningRecord
();
IdxBizFanWarningRecord
idxBizFanWarningRecord
=
new
IdxBizFanWarningRecord
();
idxBizFanWarningRecord
.
setKks
(
idxBizFanHealthIndices
.
get
(
0
).
getKks
());
idxBizFanWarningRecord
.
setKks
(
idxBizFanHealthIndices
.
get
(
0
).
getKks
());
idxBizFanWarningRecord
.
setArae
(
idxBizFanHealthIndices
.
get
(
0
).
getArea
());
idxBizFanWarningRecord
.
setArae
(
idxBizFanHealthIndices
.
get
(
0
).
getArea
());
...
@@ -1055,25 +1340,31 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -1055,25 +1340,31 @@ public class HealthStatusIndicatorServiceImpl {
Double
healthValueRisk
=
0.0
;
Double
healthValueRisk
=
0.0
;
Double
healthValueNotice
=
0.0
;
Double
healthValueNotice
=
0.0
;
long
healthValueNoticeCount
=
0
;
// long healthValueNoticeCount = 0;
long
healthValueWarnCount
=
0
;
// long healthValueWarnCount = 0;
long
healthValueRiskCount
=
0
;
// long healthValueRiskCount = 0;
int
healthValueWarnCount
=
0
;
int
healthValueRiskCount
=
0
;
int
healthValueNoticeCount
=
0
;
int
healthValueMinCount
=
0
;
int
riskNum
=
0
;
int
warnNum
=
0
;
int
noticeNum
=
0
;
for
(
IdxBizFanWarningRuleSet
e
:
idxBizPvWarningRuleSets
)
{
for
(
IdxBizFanWarningRuleSet
e
:
idxBizPvWarningRuleSets
)
{
switch
(
e
.
getWarningName
()){
switch
(
e
.
getWarningName
()){
case
"警告"
:
case
"警告"
:
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueWarn
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueWarnCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueWarnCount
=
Integer
.
parseInt
(
e
.
getWarningCycle
());
break
;
break
;
case
"危险"
:
case
"危险"
:
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueRisk
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueRiskCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueRiskCount
=
Integer
.
parseInt
(
e
.
getWarningCycle
());
break
;
break
;
case
"注意"
:
case
"注意"
:
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueNotice
=
Double
.
parseDouble
(
e
.
getWarningIf
().
substring
(
2
));
healthValueNoticeCount
=
Long
.
parseLong
(
e
.
getWarningCycle
());
healthValueNoticeCount
=
Integer
.
parseInt
(
e
.
getWarningCycle
());
break
;
break
;
}
}
...
@@ -1082,13 +1373,27 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -1082,13 +1373,27 @@ public class HealthStatusIndicatorServiceImpl {
List
<
Double
>
healthIndex
=
idxBizFanHealthIndices
.
stream
().
map
(
FanHealthIndexDay:
:
getHealthIndex
).
collect
(
Collectors
.
toList
());
List
<
Double
>
healthIndex
=
idxBizFanHealthIndices
.
stream
().
map
(
FanHealthIndexDay:
:
getHealthIndex
).
collect
(
Collectors
.
toList
());
// Double finalHealthValueRisk = healthValueRisk;
// long riskNum = healthIndex.subList(healthIndex.size()>healthValueRiskCount? (int) (healthIndex.size() - healthValueRiskCount) :0,healthIndex.size()).stream().filter(e -> e <= finalHealthValueRisk).count();
// Double finalHealthValueWarn = healthValueWarn;
// long warnNum = healthIndex.subList(healthIndex.size()>healthValueWarnCount? (int) (healthIndex.size() - healthValueWarnCount) :0,healthIndex.size()).stream().filter(e -> e <= finalHealthValueWarn).count();
// Double finalHealthValueNotice = healthValueNotice;
// long noticeNum = healthIndex.subList(healthIndex.size()>healthValueNoticeCount? (int) (healthIndex.size() - healthValueNoticeCount) :0,healthIndex.size()).stream().filter(e -> e <= finalHealthValueNotice).count();
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
();
if
(
healthIndex
.
size
()>=
healthValueRiskCount
){
List
<
Double
>
healthIndexList
=
healthIndex
.
subList
(
healthIndex
.
size
()-
healthValueRiskCount
,
healthIndex
.
size
());
riskNum
=
(
int
)
healthIndexList
.
stream
().
filter
(
e
->
e
<=
finalHealthValueRisk
).
count
();
}
Double
finalHealthValueWarn
=
healthValueWarn
;
Double
finalHealthValueWarn
=
healthValueWarn
;
long
warnNum
=
healthIndex
.
subList
(
healthIndex
.
size
()>
healthValueWarnCount
?
(
int
)
(
healthIndex
.
size
()
-
healthValueWarnCount
)
:
0
,
healthIndex
.
size
()).
stream
().
filter
(
e
->
e
<=
finalHealthValueWarn
).
count
();
if
(
healthIndex
.
size
()>=
healthValueWarnCount
){
List
<
Double
>
healthIndexList
=
healthIndex
.
subList
(
healthIndex
.
size
()-
healthValueWarnCount
,
healthIndex
.
size
());
warnNum
=
(
int
)
healthIndexList
.
stream
().
filter
(
e
->
e
<=
finalHealthValueWarn
).
count
();
}
Double
finalHealthValueNotice
=
healthValueNotice
;
Double
finalHealthValueNotice
=
healthValueNotice
;
long
noticeNum
=
healthIndex
.
subList
(
healthIndex
.
size
()>
healthValueNoticeCount
?
(
int
)
(
healthIndex
.
size
()
-
healthValueNoticeCount
)
:
0
,
healthIndex
.
size
()).
stream
().
filter
(
e
->
e
<=
finalHealthValueNotice
).
count
();
if
(
healthIndex
.
size
()>=
healthValueNoticeCount
){
List
<
Double
>
healthIndexList
=
healthIndex
.
subList
(
healthIndex
.
size
()-
healthValueWarnCount
,
healthIndex
.
size
());
noticeNum
=
(
int
)
healthIndexList
.
stream
().
filter
(
e
->
e
<=
finalHealthValueNotice
).
count
();
}
String
level
=
""
;
String
level
=
""
;
String
content
=
""
;
String
content
=
""
;
String
num
=
""
;
String
num
=
""
;
...
@@ -1097,12 +1402,14 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -1097,12 +1402,14 @@ public class HealthStatusIndicatorServiceImpl {
level
=
"注意"
;
level
=
"注意"
;
num
=
""
+
healthValueNotice
;
num
=
""
+
healthValueNotice
;
content
=
healthValueNoticeCount
+
"天"
;
content
=
healthValueNoticeCount
+
"天"
;
}
else
if
(
warnNum
==
healthValueWarnCount
){
}
if
(
warnNum
==
healthValueWarnCount
){
// redisUtils.set(gateWayId+"_"+address+"_health_warn_day","warn");
// redisUtils.set(gateWayId+"_"+address+"_health_warn_day","warn");
level
=
"警告"
;
level
=
"警告"
;
num
=
""
+
healthValueWarn
;
num
=
""
+
healthValueWarn
;
content
=
healthValueWarnCount
+
"天"
;
content
=
healthValueWarnCount
+
"天"
;
}
else
if
(
riskNum
==
healthValueRiskCount
){
}
if
(
riskNum
==
healthValueRiskCount
){
// redisUtils.set(gateWayId+"_"+address+"_health_risk_day","risk");
// redisUtils.set(gateWayId+"_"+address+"_health_risk_day","risk");
level
=
"危险"
;
level
=
"危险"
;
num
=
""
+
healthValueRisk
;
num
=
""
+
healthValueRisk
;
...
@@ -1111,12 +1418,14 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -1111,12 +1418,14 @@ public class HealthStatusIndicatorServiceImpl {
LambdaQueryWrapper
<
FanWarningRecord
>
query
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
FanWarningRecord
>
query
=
new
LambdaQueryWrapper
<>();
query
.
eq
(
FanWarningRecord:
:
getAnalysisPointId
,
idxBizFanHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
query
.
eq
(
FanWarningRecord:
:
getAnalysisPointId
,
idxBizFanHealthIndices
.
get
(
0
).
getAnalysisObjSeq
());
query
.
eq
(
FanWarningRecord:
:
getStatus
,
0
);
query
.
eq
(
FanWarningRecord:
:
getStatus
,
"0"
);
query
.
isNull
(
FanWarningRecord:
:
getDisposotionDate
);
query
.
orderByDesc
(
FanWarningRecord:
:
getTs
);
query
.
orderByDesc
(
FanWarningRecord:
:
getTs
);
List
<
FanWarningRecord
>
idxBizFanWarningRecords
=
fanWaringRecordMapper
.
selectList
(
query
);
List
<
FanWarningRecord
>
idxBizFanWarningRecords
=
fanWaringRecordMapper
.
selectList
(
query
);
int
flag
=
ObjectUtils
.
isEmpty
(
idxBizFanWarningRecords
)
||
WarningNameEnum
.
getCode
(
level
)
>
WarningNameEnum
.
getCode
(
idxBizFanWarningRecords
.
get
(
0
).
getWarningName
())
?
0
:
1
;
int
flag
=
ObjectUtils
.
isEmpty
(
idxBizFanWarningRecords
)
||
WarningNameEnum
.
getCode
(
level
)
>
WarningNameEnum
.
getCode
(
idxBizFanWarningRecords
.
get
(
0
).
getWarningName
())
?
0
:
1
;
if
(!
level
.
equals
(
""
)
&&
flag
==
0
)
{
Boolean
timeFlag
=
format
.
equals
(
idxBizFanHealthIndices
.
get
(
0
).
getRecDate
());
if
(!
level
.
equals
(
""
)
&&
flag
==
0
&&
timeFlag
)
{
IdxBizFanWarningRecord
idxBizFanWarningRecord
=
new
IdxBizFanWarningRecord
();
IdxBizFanWarningRecord
idxBizFanWarningRecord
=
new
IdxBizFanWarningRecord
();
idxBizFanWarningRecord
.
setKks
(
idxBizFanHealthIndices
.
get
(
0
).
getKks
());
idxBizFanWarningRecord
.
setKks
(
idxBizFanHealthIndices
.
get
(
0
).
getKks
());
idxBizFanWarningRecord
.
setArae
(
idxBizFanHealthIndices
.
get
(
0
).
getArea
());
idxBizFanWarningRecord
.
setArae
(
idxBizFanHealthIndices
.
get
(
0
).
getArea
());
...
@@ -1234,14 +1543,12 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -1234,14 +1543,12 @@ public class HealthStatusIndicatorServiceImpl {
tabContent
.
add
(
tableContentVo10
);
tabContent
.
add
(
tableContentVo10
);
tabContent
.
add
(
tableContentVo11
);
tabContent
.
add
(
tableContentVo11
);
dynamicDetailsVo
.
setTabContent
(
tabContent
);
dynamicDetailsVo
.
setTabContent
(
tabContent
);
detailsVos
.
add
(
dynamicDetailsVo
);
detailsVos
.
add
(
dynamicDetailsVo
);
riskBizInfoVo
.
setDynamicDetails
(
detailsVos
);
riskBizInfoVo
.
setDynamicDetails
(
detailsVos
);
bizMessage
.
setBizInfo
(
riskBizInfoVo
);
bizMessage
.
setBizInfo
(
riskBizInfoVo
);
bizMessage
.
setTraceId2
(
idxBizPvWarningRecord
.
getTs
().
toString
());
// 子系统@健康指数@预警周期
String
traceId2
=
idxBizPvWarningRecord
.
getSubarray
()+
"@"
+
idxBizPvWarningRecord
.
getHealthLevel
()+
"@"
+
idxBizPvWarningRecord
.
getWarningPeriod
();
bizMessage
.
setTraceId2
(
traceId2
);
try
{
try
{
emqKeeper
.
getMqttClient
().
publish
(
SMART_ANALYSE_PV
+
"/data/analysis"
,
JSON
.
toJSONString
(
bizMessage
).
getBytes
(
StandardCharsets
.
UTF_8
),
2
,
false
);
emqKeeper
.
getMqttClient
().
publish
(
SMART_ANALYSE_PV
+
"/data/analysis"
,
JSON
.
toJSONString
(
bizMessage
).
getBytes
(
StandardCharsets
.
UTF_8
),
2
,
false
);
}
catch
(
MqttException
e
)
{
}
catch
(
MqttException
e
)
{
...
@@ -1301,7 +1608,9 @@ public class HealthStatusIndicatorServiceImpl {
...
@@ -1301,7 +1608,9 @@ public class HealthStatusIndicatorServiceImpl {
detailsVos
.
add
(
dynamicDetailsVo
);
detailsVos
.
add
(
dynamicDetailsVo
);
riskBizInfoVo
.
setDynamicDetails
(
detailsVos
);
riskBizInfoVo
.
setDynamicDetails
(
detailsVos
);
bizMessage
.
setBizInfo
(
riskBizInfoVo
);
bizMessage
.
setBizInfo
(
riskBizInfoVo
);
bizMessage
.
setTraceId2
(
idxBizFanWarningRecord
.
getTs
().
toString
());
// 子系统@健康指数@预警周期
String
traceId2
=
idxBizFanWarningRecord
.
getSubSystem
()+
"@"
+
idxBizFanWarningRecord
.
getHealthLevel
()+
"@"
+
idxBizFanWarningRecord
.
getWarningPeriod
();
bizMessage
.
setTraceId2
(
traceId2
);
try
{
try
{
emqKeeper
.
getMqttClient
().
publish
(
SMART_ANALYSE_FAN
+
"/data/analysis"
,
JSON
.
toJSONString
(
bizMessage
).
getBytes
(
StandardCharsets
.
UTF_8
),
2
,
false
);
emqKeeper
.
getMqttClient
().
publish
(
SMART_ANALYSE_FAN
+
"/data/analysis"
,
JSON
.
toJSONString
(
bizMessage
).
getBytes
(
StandardCharsets
.
UTF_8
),
2
,
false
);
}
catch
(
MqttException
e
)
{
}
catch
(
MqttException
e
)
{
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/feign/McbWarningFeign.java
View file @
53741f60
...
@@ -7,6 +7,8 @@ import com.yeejoin.amos.component.feign.model.FeignClientResult;
...
@@ -7,6 +7,8 @@ import com.yeejoin.amos.component.feign.model.FeignClientResult;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.List
;
import
java.util.List
;
...
@@ -85,19 +87,19 @@ public interface McbWarningFeign {
...
@@ -85,19 +87,19 @@ public interface McbWarningFeign {
/**
/**
* 跑马灯列表数据分页查询
* 跑马灯列表数据分页查询
*/
*/
@GetMapping
(
"/monitor/overview/getLampListPage"
)
@GetMapping
(
value
=
"/monitor/overview/getLampListPage"
)
FeignClientResult
getLampListPage
(
@RequestParam
String
questionRectificationStatus
,
FeignClientResult
getLampListPage
(
@RequestParam
String
questionRectificationStatus
,
@RequestParam
(
"codes"
)
List
<
String
>
codes
,
@RequestParam
(
"codes"
)
List
<
String
>
codes
,
@RequestParam
(
value
=
"operator"
,
defaultValue
=
"="
)
String
operator
,
@RequestParam
(
value
=
"operator"
,
defaultValue
=
"="
)
String
operator
,
Page
page
);
@RequestParam
Page
page
);
/**
/**
* 跑马灯列表数据查询
* 跑马灯列表数据查询
*/
*/
@GetMapping
(
"/monitor/overview/getLampList
List
"
)
@GetMapping
(
"/monitor/overview/getLampList"
)
FeignClientResult
getLampList
List
(
@RequestParam
String
questionRectificationStatus
,
FeignClientResult
getLampList
(
@RequestParam
String
questionRectificationStatus
,
@RequestParam
(
"codes"
)
List
<
String
>
codes
,
@RequestParam
(
"codes"
)
List
<
String
>
codes
,
@RequestParam
(
value
=
"operator"
,
defaultValue
=
"="
)
String
operator
);
@RequestParam
(
value
=
"operator"
,
defaultValue
=
"="
)
String
operator
);
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/MonitorFanIdxController.java
View file @
53741f60
...
@@ -510,7 +510,7 @@ public class MonitorFanIdxController extends BaseController {
...
@@ -510,7 +510,7 @@ public class MonitorFanIdxController extends BaseController {
return
ResponseHelper
.
buildResponse
(
resultsData
);
return
ResponseHelper
.
buildResponse
(
resultsData
);
}
}
//
@Scheduled(cron = "0/15 * * * * ? ")
@Scheduled
(
cron
=
"0/15 * * * * ? "
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"模拟量列表消息"
)
@ApiOperation
(
value
=
"模拟量列表消息"
)
@GetMapping
(
"/getAnalogQuantityInfo"
)
@GetMapping
(
"/getAnalogQuantityInfo"
)
...
@@ -521,7 +521,7 @@ public class MonitorFanIdxController extends BaseController {
...
@@ -521,7 +521,7 @@ public class MonitorFanIdxController extends BaseController {
return
CommonResponseUtil
.
success
();
return
CommonResponseUtil
.
success
();
}
}
//
@Scheduled(cron = "0/15 * * * * ? ")
@Scheduled
(
cron
=
"0/15 * * * * ? "
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"升压站主屏消息接口"
)
@ApiOperation
(
value
=
"升压站主屏消息接口"
)
@GetMapping
(
"/getMajorAnalogQuantityByPage"
)
@GetMapping
(
"/getMajorAnalogQuantityByPage"
)
...
...
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