Commit 00caab43 authored by chenzhao's avatar chenzhao

修改预警生成规则

parent b1f9ed9f
...@@ -162,8 +162,9 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -162,8 +162,9 @@ public class HealthStatusIndicatorServiceImpl {
Double healthValueRisk = 0.0; Double healthValueRisk = 0.0;
Double healthValueNotice = 0.0; Double healthValueNotice = 0.0;
long healthValueDayCount = 0; long healthValueWarnCount = 0;
long healthValueHourCount = 0; long healthValueRiskCount = 0;
long healthValueNoticeCount = 0;
long healthValueMinCount = 0; long healthValueMinCount = 0;
...@@ -171,15 +172,15 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -171,15 +172,15 @@ 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));
healthValueMinCount =Long.parseLong(e.getWarningCycle()); healthValueWarnCount =Long.parseLong(e.getWarningCycle());
break; break;
case "危险": case "危险":
healthValueRisk = Double.parseDouble(e.getWarningIf().substring(2)); healthValueRisk = Double.parseDouble(e.getWarningIf().substring(2));
healthValueMinCount =Long.parseLong(e.getWarningCycle()); healthValueRiskCount =Long.parseLong(e.getWarningCycle());
break; break;
case "注意": case "注意":
healthValueNotice = Double.parseDouble(e.getWarningIf().substring(2)); healthValueNotice = Double.parseDouble(e.getWarningIf().substring(2));
healthValueMinCount =Long.parseLong(e.getWarningCycle()); healthValueNoticeCount =Long.parseLong(e.getWarningCycle());
break; break;
} }
...@@ -195,19 +196,22 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -195,19 +196,22 @@ public class HealthStatusIndicatorServiceImpl {
String level = ""; String level = "";
String content = ""; String content = "";
String num = ""; String num = "";
content = healthValueMinCount*10 + "分钟"; if (noticeNum >= healthValueNoticeCount ){
if (noticeNum >= healthValueMinCount ){
// redisUtils.set(gateWayId+"_"+address+"_health_notice_minute","notice"); // redisUtils.set(gateWayId+"_"+address+"_health_notice_minute","notice");
level ="注意"; level ="注意";
num = ""+healthValueNotice; num = ""+healthValueNotice;
}else if (warnNum >= healthValueMinCount ){ content = healthValueNotice*10 + "分钟";
}else 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;
}else if (riskNum >= healthValueMinCount ){ content = healthValueWarnCount*10 + "分钟";
}else 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;
content = healthValueRiskCount*10 + "分钟";
} }
//库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成 //库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成
LambdaQueryWrapper<IdxBizPvWarningRecord> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizPvWarningRecord> query = new LambdaQueryWrapper<>();
...@@ -307,24 +311,26 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -307,24 +311,26 @@ public class HealthStatusIndicatorServiceImpl {
Double healthValueRisk = 0.0; Double healthValueRisk = 0.0;
Double healthValueNotice = 0.0; Double healthValueNotice = 0.0;
long healthValueDayCount = 0; long healthValueNoticeCount = 0;
long healthValueRiskCount = 0;
long healthValueWarnCount = 0;
long healthValueHourCount = 0; long healthValueHourCount = 0;
long healthValueMinCount = 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));
healthValueHourCount =Long.parseLong(e.getWarningCycle()); healthValueWarnCount =Long.parseLong(e.getWarningCycle());
break; break;
case "危险": case "危险":
healthValueRisk = Double.parseDouble(e.getWarningIf().substring(2)); healthValueRisk = Double.parseDouble(e.getWarningIf().substring(2));
healthValueHourCount =Long.parseLong(e.getWarningCycle()); healthValueRiskCount =Long.parseLong(e.getWarningCycle());
break; break;
case "注意": case "注意":
healthValueNotice = Double.parseDouble(e.getWarningIf().substring(2)); healthValueNotice = Double.parseDouble(e.getWarningIf().substring(2));
healthValueHourCount =Long.parseLong(e.getWarningCycle()); healthValueNoticeCount =Long.parseLong(e.getWarningCycle());
break; break;
} }
...@@ -341,21 +347,19 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -341,21 +347,19 @@ public class HealthStatusIndicatorServiceImpl {
String level = ""; String level = "";
String content = ""; String content = "";
String num = ""; String num = "";
content = healthValueHourCount + "小时"; if (noticeNum >= healthValueNoticeCount ){
if (noticeNum >= healthValueHourCount ){
level ="注意"; level ="注意";
num = ""+healthValueNotice; num = ""+healthValueNotice;
content = healthValueNoticeCount + "小时";
}else if (warnNum >= healthValueHourCount ){ }else if (warnNum >= healthValueWarnCount ){
level ="警告"; level ="警告";
num = ""+healthValueWarn; num = ""+healthValueWarn;
content = healthValueWarnCount + "小时";
}else if (riskNum >= healthValueHourCount ){ }else if (riskNum >= healthValueRiskCount ){
level ="危险"; level ="危险";
num = ""+healthValueRisk; num = ""+healthValueRisk;
content = healthValueRiskCount + "小时";
} }
//库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成 //库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成
LambdaQueryWrapper<IdxBizPvWarningRecord> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizPvWarningRecord> query = new LambdaQueryWrapper<>();
...@@ -453,23 +457,23 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -453,23 +457,23 @@ public class HealthStatusIndicatorServiceImpl {
Double healthValueNotice = 0.0; Double healthValueNotice = 0.0;
long healthValueDayCount = 0; long healthValueDayCount = 0;
long healthValueHourCount = 0; long healthValueNoticeCount = 0;
long healthValueMinCount = 0; long healthValueRiskCount = 0;
long healthValueWarnCount = 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));
healthValueDayCount =Long.parseLong(e.getWarningCycle()); healthValueWarnCount =Long.parseLong(e.getWarningCycle());
break; break;
case "危险": case "危险":
healthValueRisk = Double.parseDouble(e.getWarningIf().substring(2)); healthValueRisk = Double.parseDouble(e.getWarningIf().substring(2));
healthValueDayCount =Long.parseLong(e.getWarningCycle()); healthValueRiskCount =Long.parseLong(e.getWarningCycle());
break; break;
case "注意": case "注意":
healthValueNotice = Double.parseDouble(e.getWarningIf().substring(2)); healthValueNotice = Double.parseDouble(e.getWarningIf().substring(2));
healthValueDayCount =Long.parseLong(e.getWarningCycle()); healthValueNoticeCount =Long.parseLong(e.getWarningCycle());
break; break;
} }
...@@ -485,19 +489,22 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -485,19 +489,22 @@ public class HealthStatusIndicatorServiceImpl {
String level = ""; String level = "";
String content = ""; String content = "";
String num = ""; String num = "";
content = healthValueDayCount + "天";
if (noticeNum >= healthValueDayCount ){ if (noticeNum >= healthValueNoticeCount ){
// redisUtils.set(gateWayId+"_"+address+"_health_notice_day","notice"); // redisUtils.set(gateWayId+"_"+address+"_health_notice_day","notice");
level ="注意"; level ="注意";
num = ""+healthValueNotice; num = ""+healthValueNotice;
}else if (warnNum >= healthValueDayCount ){ content = healthValueNoticeCount + "天";
}else 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;
}else if (riskNum >= healthValueDayCount ){ content = healthValueWarnCount + "天";
}else 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;
content = healthValueRiskCount + "天";
} }
//库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成 //库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成
LambdaQueryWrapper<IdxBizPvWarningRecord> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizPvWarningRecord> query = new LambdaQueryWrapper<>();
...@@ -592,8 +599,9 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -592,8 +599,9 @@ public class HealthStatusIndicatorServiceImpl {
Double healthValueRisk = 0.0; Double healthValueRisk = 0.0;
Double healthValueNotice = 0.0; Double healthValueNotice = 0.0;
long healthValueDayCount = 0; long healthValueWarnCount = 0;
long healthValueHourCount = 0; long healthValueRiskCount = 0;
long healthValueNoticeCount = 0;
long healthValueMinCount = 0; long healthValueMinCount = 0;
...@@ -601,15 +609,15 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -601,15 +609,15 @@ 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));
healthValueMinCount =Long.parseLong(e.getWarningCycle()); healthValueWarnCount =Long.parseLong(e.getWarningCycle());
break; break;
case "危险": case "危险":
healthValueRisk = Double.parseDouble(e.getWarningIf().substring(2)); healthValueRisk = Double.parseDouble(e.getWarningIf().substring(2));
healthValueMinCount =Long.parseLong(e.getWarningCycle()); healthValueRiskCount =Long.parseLong(e.getWarningCycle());
break; break;
case "注意": case "注意":
healthValueNotice = Double.parseDouble(e.getWarningIf().substring(2)); healthValueNotice = Double.parseDouble(e.getWarningIf().substring(2));
healthValueMinCount =Long.parseLong(e.getWarningCycle()); healthValueNoticeCount =Long.parseLong(e.getWarningCycle());
break; break;
} }
...@@ -628,20 +636,22 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -628,20 +636,22 @@ public class HealthStatusIndicatorServiceImpl {
String level = ""; String level = "";
String content = ""; String content = "";
String num = ""; String num = "";
content = healthValueMinCount*10 + "分钟"; if (noticeNum >= healthValueNoticeCount ){
if (noticeNum >= healthValueMinCount ){
// redisUtils.set(gateWayId+"_"+address+"_health_notice_day","notice"); // redisUtils.set(gateWayId+"_"+address+"_health_notice_day","notice");
level ="注意"; level ="注意";
num = ""+healthValueNotice; num = ""+healthValueNotice;
content = healthValueNoticeCount*10 + "分钟";
} }
else if (warnNum >= healthValueMinCount ){ else 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;
}else if (riskNum >= healthValueMinCount ){ content = healthValueWarnCount*10 + "分钟";
}else 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;
content = healthValueRiskCount*10 + "分钟";
} }
//库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成 //库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成
LambdaQueryWrapper<IdxBizFanWarningRecord> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizFanWarningRecord> query = new LambdaQueryWrapper<>();
...@@ -740,24 +750,24 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -740,24 +750,24 @@ public class HealthStatusIndicatorServiceImpl {
Double healthValueRisk = 0.0; Double healthValueRisk = 0.0;
Double healthValueNotice = 0.0; Double healthValueNotice = 0.0;
long healthValueDayCount = 0; long healthValueNoticeCount = 0;
long healthValueHourCount = 0; long healthValueRiskCount = 0;
long healthValueMinCount = 0; long healthValueWarnCount = 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));
healthValueHourCount =Long.parseLong(e.getWarningCycle()); healthValueWarnCount =Long.parseLong(e.getWarningCycle());
break; break;
case "危险": case "危险":
healthValueRisk = Double.parseDouble(e.getWarningIf().substring(2)); healthValueRisk = Double.parseDouble(e.getWarningIf().substring(2));
healthValueHourCount =Long.parseLong(e.getWarningCycle()); healthValueRiskCount =Long.parseLong(e.getWarningCycle());
break; break;
case "注意": case "注意":
healthValueNotice = Double.parseDouble(e.getWarningIf().substring(2)); healthValueNotice = Double.parseDouble(e.getWarningIf().substring(2));
healthValueHourCount =Long.parseLong(e.getWarningCycle()); healthValueNoticeCount =Long.parseLong(e.getWarningCycle());
break; break;
} }
...@@ -775,17 +785,19 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -775,17 +785,19 @@ public class HealthStatusIndicatorServiceImpl {
String level = ""; String level = "";
String content = ""; String content = "";
String num = ""; String num = "";
content = healthValueHourCount + "小时"; if (noticeNum >= healthValueNoticeCount ){
if(noticeNum >= healthValueHourCount ){
level ="注意"; level ="注意";
num = ""+healthValueNotice; num = ""+healthValueNotice;
}else if (warnNum >= healthValueHourCount ){ content = healthValueNoticeCount + "小时";
}else if (warnNum >= healthValueWarnCount ){
level ="警告"; level ="警告";
num = ""+healthValueWarn; num = ""+healthValueWarn;
}else if (riskNum >= healthValueHourCount ){ content = healthValueWarnCount + "小时";
}else if (riskNum >= healthValueRiskCount ){
level ="危险"; level ="危险";
num = ""+healthValueRisk; num = ""+healthValueRisk;
content = healthValueRiskCount + "小时";
} }
LambdaQueryWrapper<IdxBizFanWarningRecord> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizFanWarningRecord> query = new LambdaQueryWrapper<>();
query.eq(IdxBizFanWarningRecord::getAnalysisPointId,idxBizFanHealthIndices.get(0).getAnalysisObjSeq()); query.eq(IdxBizFanWarningRecord::getAnalysisPointId,idxBizFanHealthIndices.get(0).getAnalysisObjSeq());
...@@ -882,23 +894,25 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -882,23 +894,25 @@ public class HealthStatusIndicatorServiceImpl {
Double healthValueRisk = 0.0; Double healthValueRisk = 0.0;
Double healthValueNotice = 0.0; Double healthValueNotice = 0.0;
long healthValueDayCount = 0; long healthValueNoticeCount = 0;
long healthValueWarnCount = 0;
long healthValueRiskCount = 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));
healthValueDayCount =Long.parseLong(e.getWarningCycle()); healthValueWarnCount =Long.parseLong(e.getWarningCycle());
break; break;
case "危险": case "危险":
healthValueRisk = Double.parseDouble(e.getWarningIf().substring(2)); healthValueRisk = Double.parseDouble(e.getWarningIf().substring(2));
healthValueDayCount =Long.parseLong(e.getWarningCycle()); healthValueRiskCount =Long.parseLong(e.getWarningCycle());
break; break;
case "注意": case "注意":
healthValueNotice = Double.parseDouble(e.getWarningIf().substring(2)); healthValueNotice = Double.parseDouble(e.getWarningIf().substring(2));
healthValueDayCount =Long.parseLong(e.getWarningCycle()); healthValueNoticeCount =Long.parseLong(e.getWarningCycle());
break; break;
} }
...@@ -917,20 +931,21 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -917,20 +931,21 @@ public class HealthStatusIndicatorServiceImpl {
String level = ""; String level = "";
String content = ""; String content = "";
String num = ""; String num = "";
content = healthValueDayCount + "天"; if (noticeNum >= healthValueNoticeCount ){
if (noticeNum >= healthValueDayCount ){
// redisUtils.set(gateWayId+"_"+address+"_health_notice_day","notice"); // redisUtils.set(gateWayId+"_"+address+"_health_notice_day","notice");
level ="注意"; level ="注意";
num = ""+healthValueNotice; num = ""+healthValueNotice;
} content = healthValueNoticeCount + "天";
else if (warnNum >= healthValueDayCount ){ }else 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;
}else if (riskNum >= healthValueDayCount ){ content = healthValueWarnCount + "天";
}else 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;
content = healthValueRiskCount + "天";
} }
LambdaQueryWrapper<IdxBizFanWarningRecord> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizFanWarningRecord> query = new LambdaQueryWrapper<>();
......
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