Commit 41e750af authored by litengwei's avatar litengwei

Merge remote-tracking branch 'origin/developer' into developer

parents 67f763da 717cac69
......@@ -168,7 +168,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
jpStation.setThirdCode(PVProducerInfoEnum.KSOLAR.getCode());
// 业主姓名
jpStation.setUserName(ksolarStation.getUserName());
jpStation.setState(KSolarConstant.stationStaus.get(String.valueOf(ksolarStation.getStatus())));
jpStation.setState(KSolarConstant.collectStaus.get(String.valueOf(ksolarStation.getStatus())));
jpStation.setRealTimePower(ksolarStation.getPowerInter());
jpStation.setDayGenerate(ksolarStation.getDayGeneration() * KSolarConstant.kwhToMwh);
......
......@@ -44,6 +44,11 @@ public class HealthStatusIndicatorServiceImpl {
@Autowired
IdxBizFanWarningRecordMapper idxBizFanWarningRecordMapper;
@Autowired
IdxBizPvWarningRecordServiceImpl idxBizPvWarningRecordService;
@Autowired
IdxBizFanWarningRecordServiceImpl idxBizFanWarningRecordService;
/***
* 每一小时获取一次最大粒度内的指数异常数据
* 判断一小时内数据是否符合预警规则 符合则报警并在redis中缓存 同一级别的预警记录下次不生成
......@@ -81,25 +86,26 @@ public class HealthStatusIndicatorServiceImpl {
wrapper.ge(IdxBizPvHealthIndex::getRecDate,df.format(calendar.getTime()));
wrapper.orderByDesc(IdxBizPvHealthIndex::getRecDate);
List<IdxBizPvHealthIndex> healthIndices = idxBizPvHealthIndexMapper.selectList(wrapper);
List<String> collect = healthIndices.stream().map(IdxBizPvHealthIndex::getAnalysisObjSeq).collect(Collectors.toList());
if (null == healthIndices ){
return;
}
LambdaQueryWrapper<IdxBizPvWarningRuleSet> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IdxBizPvWarningRuleSet::getAnalysisType,"按时刻");
queryWrapper.in(IdxBizPvWarningRuleSet::getAnalysisPointId, collect);
List<IdxBizPvWarningRuleSet> idxBizPvWarningRules = idxBizPvWarningRuleSetMapper.selectList(queryWrapper);
Map<String, Map<String, List<IdxBizPvHealthIndex>>> gateWayMaps = healthIndices.stream().collect(Collectors.groupingBy(IdxBizPvHealthIndex::getGatewayId, Collectors.groupingBy(IdxBizPvHealthIndex::getIndexAddress)));
List<IdxBizPvWarningRecord> idxBizPvWarningRecordList = new ArrayList<>();
for (String gateWayId : gateWayMaps.keySet()) {
Map<String, List<IdxBizPvHealthIndex>> healthDataMaps = gateWayMaps.get(gateWayId);
for (String address : healthDataMaps.keySet()) {
List<IdxBizPvHealthIndex> idxBizPvHealthIndices = healthDataMaps.get(address);
LambdaQueryWrapper<IdxBizPvWarningRuleSet> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IdxBizPvWarningRuleSet::getAnalysisType,"按时刻");
queryWrapper.eq(IdxBizPvWarningRuleSet::getAnalysisPointId,idxBizPvHealthIndices.get(0).getAnalysisObjSeq());
List<IdxBizPvWarningRuleSet> idxBizPvWarningRuleSets = idxBizPvWarningRuleSetMapper.selectList(queryWrapper);
List<IdxBizPvWarningRuleSet> idxBizPvWarningRuleSets = idxBizPvWarningRules.stream().filter(t -> t.getAnalysisPointId().equals(idxBizPvHealthIndices.get(0).getAnalysisObjSeq())).collect(Collectors.toList());
if (ObjectUtils.isEmpty(idxBizPvWarningRuleSets) ){
continue;
}
Double healthValueWarn = 0.0;
Double healthValueRisk = 0.0;
Double healthValueNotice = 0.0;
......@@ -138,17 +144,17 @@ public class HealthStatusIndicatorServiceImpl {
String content = "";
String num = "";
content = healthValueMinCount*10 + "分钟";
if (riskNum >= healthValueMinCount && !redisUtils.hasKey(gateWayId+"_"+address+"_health_risk_minute")){
redisUtils.set(gateWayId+"_"+address+"_health_risk_minute","risk");
if (riskNum >= healthValueMinCount ){
// redisUtils.set(gateWayId+"_"+address+"_health_risk_minute","risk");
level ="危险";
num = ""+healthValueRisk;
}else if (warnNum >= healthValueMinCount && !redisUtils.hasKey(gateWayId+"_"+address+"_health_warn_minute") ){
redisUtils.set(gateWayId+"_"+address+"_health_warn_minute","warn");
}else if (warnNum >= healthValueMinCount ){
// redisUtils.set(gateWayId+"_"+address+"_health_warn_minute","warn");
level ="警告";
num = ""+healthValueWarn;
}else if (noticeNum >= healthValueMinCount && !redisUtils.hasKey(gateWayId+"_"+address+"_health_notice_minute")){
redisUtils.set(gateWayId+"_"+address+"_health_notice_minute","notice");
}else if (noticeNum >= healthValueMinCount ){
// redisUtils.set(gateWayId+"_"+address+"_health_notice_minute","notice");
level ="注意";
num = ""+healthValueNotice;
}
......@@ -180,10 +186,12 @@ public class HealthStatusIndicatorServiceImpl {
idxBizPvWarningRecord.setPointName(idxBizPvHealthIndices.get(0).getPointName());
idxBizPvWarningRecord.setHealthIndexSeq(idxBizPvHealthIndices.get(0).getHealthIndex().toString());
idxBizPvWarningRecord.setHealthLevel(idxBizPvHealthIndices.get(0).getHealthLevel());
idxBizPvWarningRecordMapper.insert(idxBizPvWarningRecord);
idxBizPvWarningRecordList.add(idxBizPvWarningRecord);
// idxBizPvWarningRecordMapper.insert(idxBizPvWarningRecord);
}
}
}
idxBizPvWarningRecordService.saveBatch(idxBizPvWarningRecordList);
}
/***
......@@ -205,24 +213,23 @@ public class HealthStatusIndicatorServiceImpl {
wrapper.ge(IdxBizPvHealthIndex::getRecDate,df.format(calendar.getTime()));
wrapper.orderByDesc(IdxBizPvHealthIndex::getRecDate);
List<IdxBizPvHealthIndex> healthIndices = idxBizPvHealthIndexMapper.selectList(wrapper);
List<String> collect = healthIndices.stream().map(IdxBizPvHealthIndex::getAnalysisObjSeq).collect(Collectors.toList());
if (null == healthIndices ){
return;
}
LambdaQueryWrapper<IdxBizPvWarningRuleSet> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IdxBizPvWarningRuleSet::getAnalysisType,"按小时");
queryWrapper.in(IdxBizPvWarningRuleSet::getAnalysisPointId, collect);
List<IdxBizPvWarningRuleSet> idxBizPvWarningRules = idxBizPvWarningRuleSetMapper.selectList(queryWrapper);
Map<String, Map<String, List<IdxBizPvHealthIndex>>> gateWayMaps = healthIndices.stream().collect(Collectors.groupingBy(IdxBizPvHealthIndex::getGatewayId, Collectors.groupingBy(IdxBizPvHealthIndex::getIndexAddress)));
List<IdxBizPvWarningRecord> idxBizPvWarningRecordList = new ArrayList<>();
for (String gateWayId : gateWayMaps.keySet()) {
Map<String, List<IdxBizPvHealthIndex>> healthDataMaps = gateWayMaps.get(gateWayId);
for (String address : healthDataMaps.keySet()) {
List<IdxBizPvHealthIndex> idxBizPvHealthIndices = healthDataMaps.get(address);
LambdaQueryWrapper<IdxBizPvWarningRuleSet> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IdxBizPvWarningRuleSet::getAnalysisType,"按小时");
queryWrapper.eq(IdxBizPvWarningRuleSet::getAnalysisPointId,idxBizPvHealthIndices.get(0).getAnalysisObjSeq());
List<IdxBizPvWarningRuleSet> idxBizPvWarningRuleSets = idxBizPvWarningRuleSetMapper.selectList(queryWrapper);
List<IdxBizPvWarningRuleSet> idxBizPvWarningRuleSets = idxBizPvWarningRules.stream().filter(t -> t.getAnalysisPointId().equals(idxBizPvHealthIndices.get(0).getAnalysisObjSeq())).collect(Collectors.toList());
if (ObjectUtils.isEmpty(idxBizPvWarningRuleSets) ){
continue;
}
......@@ -266,17 +273,17 @@ public class HealthStatusIndicatorServiceImpl {
String content = "";
String num = "";
content = healthValueHourCount + "小时";
if (riskNum >= healthValueHourCount && !redisUtils.hasKey(gateWayId+"_"+address+"_health_risk_hour")){
redisUtils.set(gateWayId+"_"+address+"_health_risk_hour","risk");
if (riskNum >= healthValueHourCount ){
level ="危险";
num = ""+healthValueRisk;
}else if (warnNum >= healthValueHourCount && !redisUtils.hasKey(gateWayId+"_"+address+"_health_risk_hour") ){
redisUtils.set(gateWayId+"_"+address+"_health_warn_hour","warn");
}else if (warnNum >= healthValueHourCount ){
level ="警告";
num = ""+healthValueWarn;
}else if (noticeNum >= healthValueHourCount && !redisUtils.hasKey(gateWayId+"_"+address+"_health_notice_hour")){
redisUtils.set(gateWayId+"_"+address+"_health_notice_hour","notice");
}else if (noticeNum >= healthValueHourCount ){
level ="注意";
num = ""+healthValueNotice;
......@@ -309,10 +316,12 @@ public class HealthStatusIndicatorServiceImpl {
idxBizPvWarningRecord.setPointName(idxBizPvHealthIndices.get(0).getPointName());
idxBizPvWarningRecord.setHealthIndexSeq(idxBizPvHealthIndices.get(0).getHealthIndex().toString());
idxBizPvWarningRecord.setHealthLevel(idxBizPvHealthIndices.get(0).getHealthLevel());
idxBizPvWarningRecordMapper.insert(idxBizPvWarningRecord);
idxBizPvWarningRecordList.add(idxBizPvWarningRecord);
//idxBizPvWarningRecordMapper.insert(idxBizPvWarningRecord);
}
}
}
idxBizPvWarningRecordService.saveBatch(idxBizPvWarningRecordList);
}
/***
......@@ -335,28 +344,25 @@ public class HealthStatusIndicatorServiceImpl {
wrapper.orderByDesc(IdxBizPvHealthIndex::getRecDate);
List<IdxBizPvHealthIndex> healthIndices = idxBizPvHealthIndexMapper.selectList(wrapper);
if (null == healthIndices ){
return;
}
List<String> collect = healthIndices.stream().map(IdxBizPvHealthIndex::getAnalysisObjSeq).collect(Collectors.toList());
LambdaQueryWrapper<IdxBizPvWarningRuleSet> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IdxBizPvWarningRuleSet::getAnalysisType,"按天");
queryWrapper.in(IdxBizPvWarningRuleSet::getAnalysisPointId, collect);
List<IdxBizPvWarningRuleSet> idxBizPvWarningRules = idxBizPvWarningRuleSetMapper.selectList(queryWrapper);
Map<String, Map<String, List<IdxBizPvHealthIndex>>> gateWayMaps = healthIndices.stream().collect(Collectors.groupingBy(IdxBizPvHealthIndex::getGatewayId, Collectors.groupingBy(IdxBizPvHealthIndex::getIndexAddress)));
List<IdxBizPvWarningRecord> idxBizPvWarningRecordList = new ArrayList<>();
for (String gateWayId : gateWayMaps.keySet()) {
Map<String, List<IdxBizPvHealthIndex>> healthDataMaps = gateWayMaps.get(gateWayId);
for (String address : healthDataMaps.keySet()) {
List<IdxBizPvHealthIndex> idxBizPvHealthIndices = healthDataMaps.get(address);
LambdaQueryWrapper<IdxBizPvWarningRuleSet> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IdxBizPvWarningRuleSet::getAnalysisType,"按天");
queryWrapper.eq(IdxBizPvWarningRuleSet::getAnalysisPointId,idxBizPvHealthIndices.get(0).getAnalysisObjSeq());
List<IdxBizPvWarningRuleSet> idxBizPvWarningRuleSets = idxBizPvWarningRuleSetMapper.selectList(queryWrapper);
List<IdxBizPvWarningRuleSet> idxBizPvWarningRuleSets = idxBizPvWarningRules.stream().filter(t -> t.getAnalysisPointId().equals(idxBizPvHealthIndices.get(0).getAnalysisObjSeq())).collect(Collectors.toList());
if (ObjectUtils.isEmpty(idxBizPvWarningRuleSets) ){
continue;
}
Double healthValueWarn = 0.0;
Double healthValueRisk = 0.0;
Double healthValueNotice = 0.0;
......@@ -395,16 +401,16 @@ public class HealthStatusIndicatorServiceImpl {
String content = "";
String num = "";
content = healthValueDayCount + "天";
if (riskNum >= healthValueDayCount && !redisUtils.hasKey(gateWayId+"_"+address+"_health_risk_day")){
redisUtils.set(gateWayId+"_"+address+"_health_risk_day","risk");
if (riskNum >= healthValueDayCount ){
// redisUtils.set(gateWayId+"_"+address+"_health_risk_day","risk");
level ="危险";
num = ""+healthValueRisk;
}else if (warnNum >= healthValueDayCount && !redisUtils.hasKey(gateWayId+"_"+address+"_health_warn_day") ){
redisUtils.set(gateWayId+"_"+address+"_health_warn_day","warn");
}else if (warnNum >= healthValueDayCount ){
// redisUtils.set(gateWayId+"_"+address+"_health_warn_day","warn");
level ="警告";
num = ""+healthValueWarn;
}else if (noticeNum >= healthValueDayCount && !redisUtils.hasKey(gateWayId+"_"+address+"_health_notice_day")){
redisUtils.set(gateWayId+"_"+address+"_health_notice_day","notice");
}else if (noticeNum >= healthValueDayCount ){
// redisUtils.set(gateWayId+"_"+address+"_health_notice_day","notice");
level ="注意";
num = ""+healthValueNotice;
}
......@@ -436,11 +442,12 @@ public class HealthStatusIndicatorServiceImpl {
idxBizPvWarningRecord.setPointName(idxBizPvHealthIndices.get(0).getPointName());
idxBizPvWarningRecord.setHealthIndexSeq(idxBizPvHealthIndices.get(0).getHealthIndex().toString());
idxBizPvWarningRecord.setHealthLevel(idxBizPvHealthIndices.get(0).getHealthLevel());
idxBizPvWarningRecordMapper.insert(idxBizPvWarningRecord);
idxBizPvWarningRecordList.add(idxBizPvWarningRecord);
//idxBizPvWarningRecordMapper.insert(idxBizPvWarningRecord);
}
}
}
idxBizPvWarningRecordService.saveBatch(idxBizPvWarningRecordList);
}
......@@ -461,18 +468,22 @@ public class HealthStatusIndicatorServiceImpl {
if (ObjectUtils.isEmpty(healthIndices)){
return;
}
List<String> collect = healthIndices.stream().map(IdxBizFanHealthIndex::getAnalysisObjSeq).collect(Collectors.toList());
LambdaQueryWrapper<IdxBizFanWarningRuleSet> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IdxBizFanWarningRuleSet::getAnalysisType,"按时刻");
queryWrapper.in(IdxBizFanWarningRuleSet::getAnalysisPointId,collect);
List<IdxBizFanWarningRuleSet> idxBizPvWarningRules = idxBizFanWarningRuleSetMapper.selectList(queryWrapper);
Map<String, Map<String, List<IdxBizFanHealthIndex>>> gateWayMaps = healthIndices.stream().collect(Collectors.groupingBy(IdxBizFanHealthIndex::getGatewayId, Collectors.groupingBy(IdxBizFanHealthIndex::getIndexAddress)));
List<IdxBizFanWarningRecord> idxBizFanWarningRecordList = new ArrayList<>();
for (String gateWayId : gateWayMaps.keySet()) {
Map<String, List<IdxBizFanHealthIndex>> healthDataMaps = gateWayMaps.get(gateWayId);
for (String address : healthDataMaps.keySet()) {
List<IdxBizFanHealthIndex> idxBizFanHealthIndices = healthDataMaps.get(address);
LambdaQueryWrapper<IdxBizFanWarningRuleSet> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IdxBizFanWarningRuleSet::getAnalysisType,"按时刻");
queryWrapper.eq(IdxBizFanWarningRuleSet::getAnalysisPointId,idxBizFanHealthIndices.get(0).getAnalysisObjSeq());
List<IdxBizFanWarningRuleSet> idxBizPvWarningRuleSets = idxBizFanWarningRuleSetMapper.selectList(queryWrapper);
List<IdxBizFanWarningRuleSet> idxBizPvWarningRuleSets = idxBizPvWarningRules.stream().filter(t -> t.getAnalysisPointId().equals(idxBizFanHealthIndices.get(0).getAnalysisObjSeq())).collect(Collectors.toList());
if (ObjectUtils.isEmpty(idxBizPvWarningRuleSets) ){
continue;
......@@ -519,17 +530,17 @@ public class HealthStatusIndicatorServiceImpl {
String content = "";
String num = "";
content = healthValueMinCount*10 + "分钟";
if (riskNum >= healthValueMinCount && !redisUtils.hasKey(gateWayId+"_"+address+"_health_risk_minute")){
redisUtils.set(gateWayId+"_"+address+"_health_risk_minute","risk");
if (riskNum >= healthValueMinCount ){
// redisUtils.set(gateWayId+"_"+address+"_health_risk_minute","risk");
level ="危险";
num = ""+healthValueRisk;
}else if (warnNum >= healthValueMinCount && !redisUtils.hasKey(gateWayId+"_"+address+"_health_warn_minute") ){
redisUtils.set(gateWayId+"_"+address+"_health_warn_minute","warn");
}else if (warnNum >= healthValueMinCount ){
// redisUtils.set(gateWayId+"_"+address+"_health_warn_minute","warn");
level ="警告";
num = ""+healthValueWarn;
}else if (noticeNum >= healthValueMinCount && !redisUtils.hasKey(gateWayId+"_"+address+"_health_notice_minute")){
redisUtils.set(gateWayId+"_"+address+"_health_notice_minute","notice");
}else if (noticeNum >= healthValueMinCount ){
// redisUtils.set(gateWayId+"_"+address+"_health_notice_minute","notice");
level ="注意";
num = ""+healthValueNotice;
}
......@@ -561,10 +572,12 @@ public class HealthStatusIndicatorServiceImpl {
idxBizFanWarningRecord.setPointName(idxBizFanHealthIndices.get(0).getPointName());
idxBizFanWarningRecord.setHealthIndexSeq(idxBizFanHealthIndices.get(0).getHealthIndex().toString());
idxBizFanWarningRecord.setHealthLevel(idxBizFanHealthIndices.get(0).getHealthLevel());
idxBizFanWarningRecordMapper.insert(idxBizFanWarningRecord);
idxBizFanWarningRecordList.add(idxBizFanWarningRecord);
//idxBizFanWarningRecordMapper.insert(idxBizFanWarningRecord);
}
}
}
idxBizFanWarningRecordService.saveBatch(idxBizFanWarningRecordList);
}
/***
......@@ -586,20 +599,24 @@ public class HealthStatusIndicatorServiceImpl {
wrapper.ge(IdxBizFanHealthIndex::getRecDate,df.format(calendar.getTime()));
wrapper.orderByDesc(IdxBizFanHealthIndex::getRecDate);
List<IdxBizFanHealthIndex> healthIndices = idxBizFanHealthIndexMapper.selectList(wrapper);
if (ObjectUtils.isEmpty(healthIndices)){
return;
}
List<String> collect = healthIndices.stream().map(IdxBizFanHealthIndex::getAnalysisObjSeq).collect(Collectors.toList());
LambdaQueryWrapper<IdxBizFanWarningRuleSet> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IdxBizFanWarningRuleSet::getAnalysisType,"小时");
queryWrapper.in(IdxBizFanWarningRuleSet::getAnalysisPointId,collect);
List<IdxBizFanWarningRuleSet> idxBizPvWarningRules = idxBizFanWarningRuleSetMapper.selectList(queryWrapper);
Map<String, Map<String, List<IdxBizFanHealthIndex>>> gateWayMaps = healthIndices.stream().collect(Collectors.groupingBy(IdxBizFanHealthIndex::getGatewayId, Collectors.groupingBy(IdxBizFanHealthIndex::getIndexAddress)));
List<IdxBizFanWarningRecord> idxBizFanWarningRecordList = new ArrayList<>();
for (String gateWayId : gateWayMaps.keySet()) {
Map<String, List<IdxBizFanHealthIndex>> healthDataMaps = gateWayMaps.get(gateWayId);
for (String address : healthDataMaps.keySet()) {
List<IdxBizFanHealthIndex> idxBizFanHealthIndices = healthDataMaps.get(address);
LambdaQueryWrapper<IdxBizFanWarningRuleSet> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IdxBizFanWarningRuleSet::getAnalysisType,"按小时");
queryWrapper.eq(IdxBizFanWarningRuleSet::getAnalysisPointId,idxBizFanHealthIndices.get(0).getAnalysisObjSeq());
List<IdxBizFanWarningRuleSet> idxBizPvWarningRuleSets = idxBizFanWarningRuleSetMapper.selectList(queryWrapper);
List<IdxBizFanWarningRuleSet> idxBizPvWarningRuleSets = idxBizPvWarningRules.stream().filter(t -> t.getAnalysisPointId().equals(idxBizFanHealthIndices.get(0).getAnalysisObjSeq())).collect(Collectors.toList());
if (ObjectUtils.isEmpty(idxBizPvWarningRuleSets) ){
continue;
......@@ -644,17 +661,17 @@ public class HealthStatusIndicatorServiceImpl {
String content = "";
String num = "";
content = healthValueHourCount + "小时";
if (riskNum >= healthValueHourCount && !redisUtils.hasKey(gateWayId+"_"+address+"_health_risk_hour")){
redisUtils.set(gateWayId+"_"+address+"_health_risk_hour","risk");
if (riskNum >= healthValueHourCount ){
level ="危险";
num = ""+healthValueRisk;
}else if (warnNum >= healthValueHourCount && !redisUtils.hasKey(gateWayId+"_"+address+"_health_risk_hour") ){
redisUtils.set(gateWayId+"_"+address+"_health_warn_hour","warn");
}else if (warnNum >= healthValueHourCount ){
level ="警告";
num = ""+healthValueWarn;
}else if (noticeNum >= healthValueHourCount && !redisUtils.hasKey(gateWayId+"_"+address+"_health_notice_hour")){
redisUtils.set(gateWayId+"_"+address+"_health_notice_hour","notice");
}else if (noticeNum >= healthValueHourCount ){
level ="注意";
num = ""+healthValueNotice;
......@@ -686,10 +703,12 @@ public class HealthStatusIndicatorServiceImpl {
idxBizFanWarningRecord.setHealthIndexSeq(idxBizFanHealthIndices.get(0).getHealthIndex().toString());
idxBizFanWarningRecord.setHealthLevel(idxBizFanHealthIndices.get(0).getHealthLevel());
idxBizFanWarningRecord.setPointName(idxBizFanHealthIndices.get(0).getPointName());
idxBizFanWarningRecordMapper.insert(idxBizFanWarningRecord);
idxBizFanWarningRecordList.add(idxBizFanWarningRecord);
}
}
}
idxBizFanWarningRecordService.saveBatch(idxBizFanWarningRecordList);
}
/***
......@@ -714,16 +733,21 @@ public class HealthStatusIndicatorServiceImpl {
if (ObjectUtils.isEmpty(healthIndices)){
return;
}
List<String> collect = healthIndices.stream().map(IdxBizFanHealthIndex::getAnalysisObjSeq).collect(Collectors.toList());
LambdaQueryWrapper<IdxBizFanWarningRuleSet> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IdxBizFanWarningRuleSet::getAnalysisType,"按天");
queryWrapper.in(IdxBizFanWarningRuleSet::getAnalysisPointId,collect);
List<IdxBizFanWarningRuleSet> idxBizPvWarningRules = idxBizFanWarningRuleSetMapper.selectList(queryWrapper);
Map<String, Map<String, List<IdxBizFanHealthIndex>>> gateWayMaps = healthIndices.stream().collect(Collectors.groupingBy(IdxBizFanHealthIndex::getGatewayId, Collectors.groupingBy(IdxBizFanHealthIndex::getIndexAddress)));
List<IdxBizFanWarningRecord> idxBizFanWarningRecordList = new ArrayList<>();
for (String gateWayId : gateWayMaps.keySet()) {
Map<String, List<IdxBizFanHealthIndex>> healthDataMaps = gateWayMaps.get(gateWayId);
for (String address : healthDataMaps.keySet()) {
List<IdxBizFanHealthIndex> idxBizFanHealthIndices = healthDataMaps.get(address);
LambdaQueryWrapper<IdxBizFanWarningRuleSet> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IdxBizFanWarningRuleSet::getAnalysisType,"按天");
queryWrapper.eq(IdxBizFanWarningRuleSet::getAnalysisPointId,idxBizFanHealthIndices.get(0).getAnalysisObjSeq());
List<IdxBizFanWarningRuleSet> idxBizPvWarningRuleSets = idxBizFanWarningRuleSetMapper.selectList(queryWrapper);
List<IdxBizFanWarningRuleSet> idxBizPvWarningRuleSets = idxBizPvWarningRules.stream().filter(t -> t.getAnalysisPointId().equals(idxBizFanHealthIndices.get(0).getAnalysisObjSeq())).collect(Collectors.toList());
if (ObjectUtils.isEmpty(idxBizPvWarningRuleSets) ){
continue;
......@@ -768,16 +792,16 @@ public class HealthStatusIndicatorServiceImpl {
String content = "";
String num = "";
content = healthValueDayCount + "天";
if (riskNum >= healthValueDayCount && !redisUtils.hasKey(gateWayId+"_"+address+"_health_risk_day")){
redisUtils.set(gateWayId+"_"+address+"_health_risk_day","risk");
if (riskNum >= healthValueDayCount ){
// redisUtils.set(gateWayId+"_"+address+"_health_risk_day","risk");
level ="危险";
num = ""+healthValueRisk;
}else if (warnNum >= healthValueDayCount && !redisUtils.hasKey(gateWayId+"_"+address+"_health_warn_day") ){
redisUtils.set(gateWayId+"_"+address+"_health_warn_day","warn");
}else if (warnNum >= healthValueDayCount ){
// redisUtils.set(gateWayId+"_"+address+"_health_warn_day","warn");
level ="警告";
num = ""+healthValueWarn;
}else if (noticeNum >= healthValueDayCount && !redisUtils.hasKey(gateWayId+"_"+address+"_health_notice_day")){
redisUtils.set(gateWayId+"_"+address+"_health_notice_day","notice");
}else if (noticeNum >= healthValueDayCount ){
// redisUtils.set(gateWayId+"_"+address+"_health_notice_day","notice");
level ="注意";
num = ""+healthValueNotice;
}
......@@ -789,7 +813,6 @@ public class HealthStatusIndicatorServiceImpl {
List<IdxBizFanWarningRecord> idxBizFanWarningRecords = idxBizFanWarningRecordMapper.selectList(query);
int flag = ObjectUtils.isEmpty(idxBizFanWarningRecords) || WarningNameEnum.getCode(level) > WarningNameEnum.getCode(idxBizFanWarningRecords.get(0).getWarningName()) ? 0 :1;
if (!level.equals("") && flag == 0){
IdxBizFanWarningRecord idxBizFanWarningRecord = new IdxBizFanWarningRecord();
idxBizFanWarningRecord.setRecord(idxBizFanHealthIndices.get(0).getRecord());
......@@ -809,10 +832,12 @@ public class HealthStatusIndicatorServiceImpl {
idxBizFanWarningRecord.setHealthIndexSeq(idxBizFanHealthIndices.get(0).getHealthIndex().toString());
idxBizFanWarningRecord.setHealthLevel(idxBizFanHealthIndices.get(0).getHealthLevel());
idxBizFanWarningRecord.setPointName(idxBizFanHealthIndices.get(0).getPointName());
idxBizFanWarningRecordMapper.insert(idxBizFanWarningRecord);
idxBizFanWarningRecordList.add(idxBizFanWarningRecord);
}
}
}
idxBizFanWarningRecordService.saveBatch(idxBizFanWarningRecordList);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment