Commit b7118dce authored by chenzhao's avatar chenzhao

修改预警问题

parent e17e8ecc
...@@ -132,6 +132,9 @@ public class CommonServiceImpl { ...@@ -132,6 +132,9 @@ public class CommonServiceImpl {
@Autowired @Autowired
IdxBizPvPointVarCentralValueMapper idxBizPvPointVarCentralValueMapper; IdxBizPvPointVarCentralValueMapper idxBizPvPointVarCentralValueMapper;
@Autowired
HealthStatusIndicatorServiceImpl healthStatusIndicatorService;
/** /**
* @return * @return
* @deprecated 获取工况变量列表风机 * @deprecated 获取工况变量列表风机
...@@ -1462,6 +1465,7 @@ public class CommonServiceImpl { ...@@ -1462,6 +1465,7 @@ public class CommonServiceImpl {
@Async("async") @Async("async")
public void healthWarningMinuteByFan() { public void healthWarningMinuteByFan() {
Date time = new Date(); Date time = new Date();
Calendar calendar = Calendar.getInstance();
List<IdxBizFanPointProcessVariableClassificationDto> data = idxBizFanPointProcessVariableClassificationMapper.getInfluxDBData(); List<IdxBizFanPointProcessVariableClassificationDto> data = idxBizFanPointProcessVariableClassificationMapper.getInfluxDBData();
Map<String, List<IdxBizFanPointProcessVariableClassificationDto>> maps = data.stream().collect(Collectors.groupingBy(IdxBizFanPointProcessVariableClassificationDto::getGatewayId)); Map<String, List<IdxBizFanPointProcessVariableClassificationDto>> maps = data.stream().collect(Collectors.groupingBy(IdxBizFanPointProcessVariableClassificationDto::getGatewayId));
BoolQueryBuilder boolMustAll = QueryBuilders.boolQuery(); BoolQueryBuilder boolMustAll = QueryBuilders.boolQuery();
...@@ -1603,6 +1607,10 @@ public class CommonServiceImpl { ...@@ -1603,6 +1607,10 @@ public class CommonServiceImpl {
try { try {
logger.info("--------------------response: " + response); logger.info("--------------------response: " + response);
logger.info("------------------------------------------调用健康指数计算算法结束----------------------------------------"); logger.info("------------------------------------------调用健康指数计算算法结束----------------------------------------");
logger.info("------------------------------------------开始计算预警----------------------------------------");
healthStatusIndicatorService.healthWarningMinute(calendar);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
...@@ -1613,6 +1621,7 @@ public class CommonServiceImpl { ...@@ -1613,6 +1621,7 @@ public class CommonServiceImpl {
@Scheduled(cron = "0 0/10 * * * ?") @Scheduled(cron = "0 0/10 * * * ?")
@Async("async") @Async("async")
public void healthWarningMinuteByPv() { public void healthWarningMinuteByPv() {
Calendar calendar = Calendar.getInstance();
Date time = new Date(); Date time = new Date();
List<IdxBizPvPointProcessVariableClassificationDto> data = idxBizPvPointProcessVariableClassificationMapper.getInfluxDBData(); List<IdxBizPvPointProcessVariableClassificationDto> data = idxBizPvPointProcessVariableClassificationMapper.getInfluxDBData();
Map<String, List<IdxBizPvPointProcessVariableClassificationDto>> maps = data.stream().collect(Collectors.groupingBy(IdxBizPvPointProcessVariableClassificationDto::getGatewayId)); Map<String, List<IdxBizPvPointProcessVariableClassificationDto>> maps = data.stream().collect(Collectors.groupingBy(IdxBizPvPointProcessVariableClassificationDto::getGatewayId));
...@@ -1744,6 +1753,8 @@ public class CommonServiceImpl { ...@@ -1744,6 +1753,8 @@ public class CommonServiceImpl {
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
healthStatusIndicatorService.healthWarningMinuteGF(calendar);
} }
......
...@@ -67,10 +67,10 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -67,10 +67,10 @@ public class HealthStatusIndicatorServiceImpl {
* *
*/ */
@Scheduled(cron = "0 0 */1 * * ?") // @Scheduled(cron = "0 0 */1 * * ?")
@Async("async") @Async("async")
public void healthWarningMinuteGF() { public void healthWarningMinuteGF(Calendar calendar ) {
Calendar calendar = Calendar.getInstance(); // Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-1); calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-1);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm"); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
...@@ -183,7 +183,7 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -183,7 +183,7 @@ public class HealthStatusIndicatorServiceImpl {
* *
*/ */
@Scheduled(cron = "0 0 */5 * * ?") @Scheduled(cron = "0 0 0/1 * * ?")
@Async("async") @Async("async")
public void healthWarningHourGF() { public void healthWarningHourGF() {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
...@@ -230,15 +230,15 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -230,15 +230,15 @@ public class HealthStatusIndicatorServiceImpl {
for (IdxBizPvWarningRuleSet e : idxBizPvWarningRuleSets) { for (IdxBizPvWarningRuleSet e : idxBizPvWarningRuleSets) {
switch (e.getWarningName()){ switch (e.getWarningName()){
case "警告": case "警告":
healthValueWarn = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2)); healthValueWarn = Double.parseDouble(e.getWarningIf().substring(2));
healthValueHourCount =Long.parseLong(e.getWarningCycle()); healthValueHourCount =Long.parseLong(e.getWarningCycle());
break; break;
case "危险": case "危险":
healthValueRisk = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2)); healthValueRisk = Double.parseDouble(e.getWarningIf().substring(2));
healthValueHourCount =Long.parseLong(e.getWarningCycle()); healthValueHourCount =Long.parseLong(e.getWarningCycle());
break; break;
case "注意": case "注意":
healthValueNotice = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2)); healthValueNotice = Double.parseDouble(e.getWarningIf().substring(2));
healthValueHourCount =Long.parseLong(e.getWarningCycle()); healthValueHourCount =Long.parseLong(e.getWarningCycle());
break; break;
} }
...@@ -304,7 +304,7 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -304,7 +304,7 @@ public class HealthStatusIndicatorServiceImpl {
* *
*/ */
@Scheduled(cron = "0 0 0 */3 * ? ") @Scheduled(cron = "0 0 0 0/1 * ? ")
@Async("async") @Async("async")
public void healthWarningDayGF() { public void healthWarningDayGF() {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
...@@ -352,15 +352,15 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -352,15 +352,15 @@ public class HealthStatusIndicatorServiceImpl {
for (IdxBizPvWarningRuleSet e : idxBizPvWarningRuleSets) { for (IdxBizPvWarningRuleSet e : idxBizPvWarningRuleSets) {
switch (e.getWarningName()){ switch (e.getWarningName()){
case "警告": case "警告":
healthValueWarn = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2)); healthValueWarn = Double.parseDouble(e.getWarningIf().substring(2));
healthValueDayCount =Long.parseLong(e.getWarningCycle()); healthValueDayCount =Long.parseLong(e.getWarningCycle());
break; break;
case "危险": case "危险":
healthValueRisk = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2)); healthValueRisk = Double.parseDouble(e.getWarningIf().substring(2));
healthValueDayCount =Long.parseLong(e.getWarningCycle()); healthValueDayCount =Long.parseLong(e.getWarningCycle());
break; break;
case "注意": case "注意":
healthValueNotice = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2)); healthValueNotice = Double.parseDouble(e.getWarningIf().substring(2));
healthValueDayCount =Long.parseLong(e.getWarningCycle()); healthValueDayCount =Long.parseLong(e.getWarningCycle());
break; break;
} }
...@@ -419,10 +419,10 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -419,10 +419,10 @@ public class HealthStatusIndicatorServiceImpl {
} }
@Scheduled(cron = "0 0 */1 * * ?") // @Scheduled(cron = "0 0 */1 * * ?")
@Async("async") @Async("async")
public void healthWarningMinute() { public void healthWarningMinute(Calendar calendar ) {
Calendar calendar = Calendar.getInstance(); // Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-1); calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-1);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm"); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
...@@ -540,7 +540,7 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -540,7 +540,7 @@ public class HealthStatusIndicatorServiceImpl {
* *
*/ */
@Scheduled(cron = "0 0 */5 * * ?") @Scheduled(cron = "0 0 0/1 * * ?")
@Async("async") @Async("async")
public void healthWarningHour() { public void healthWarningHour() {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
...@@ -583,15 +583,15 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -583,15 +583,15 @@ public class HealthStatusIndicatorServiceImpl {
for (IdxBizFanWarningRuleSet e : idxBizPvWarningRuleSets) { for (IdxBizFanWarningRuleSet e : idxBizPvWarningRuleSets) {
switch (e.getWarningName()){ switch (e.getWarningName()){
case "警告": case "警告":
healthValueWarn = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2)); healthValueWarn = Double.parseDouble(e.getWarningIf().substring(2));
healthValueHourCount =Long.parseLong(e.getWarningCycle()); healthValueHourCount =Long.parseLong(e.getWarningCycle());
break; break;
case "危险": case "危险":
healthValueRisk = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2)); healthValueRisk = Double.parseDouble(e.getWarningIf().substring(2));
healthValueHourCount =Long.parseLong(e.getWarningCycle()); healthValueHourCount =Long.parseLong(e.getWarningCycle());
break; break;
case "注意": case "注意":
healthValueNotice = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2)); healthValueNotice = Double.parseDouble(e.getWarningIf().substring(2));
healthValueHourCount =Long.parseLong(e.getWarningCycle()); healthValueHourCount =Long.parseLong(e.getWarningCycle());
break; break;
} }
...@@ -658,7 +658,7 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -658,7 +658,7 @@ public class HealthStatusIndicatorServiceImpl {
* *
*/ */
@Scheduled(cron = "0 0 0 */3 * ? ") @Scheduled(cron = "0 0 0 0/1 * ? ")
@Async("async") @Async("async")
public void healthWarningDay() { public void healthWarningDay() {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
...@@ -693,22 +693,21 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -693,22 +693,21 @@ public class HealthStatusIndicatorServiceImpl {
Double healthValueNotice = 0.0; Double healthValueNotice = 0.0;
long healthValueDayCount = 0; long healthValueDayCount = 0;
long healthValueHourCount = 0;
long healthValueMinCount = 0;
for (IdxBizFanWarningRuleSet e : idxBizPvWarningRuleSets) { for (IdxBizFanWarningRuleSet e : idxBizPvWarningRuleSets) {
switch (e.getWarningName()){ switch (e.getWarningName()){
case "警告": case "警告":
healthValueWarn = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2)); healthValueWarn = Double.parseDouble(e.getWarningIf().substring(2));
healthValueDayCount =Long.parseLong(e.getWarningCycle()); healthValueDayCount =Long.parseLong(e.getWarningCycle());
break; break;
case "危险": case "危险":
healthValueRisk = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2)); healthValueRisk = Double.parseDouble(e.getWarningIf().substring(2));
healthValueDayCount =Long.parseLong(e.getWarningCycle()); healthValueDayCount =Long.parseLong(e.getWarningCycle());
break; break;
case "注意": case "注意":
healthValueNotice = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2)); healthValueNotice = Double.parseDouble(e.getWarningIf().substring(2));
healthValueDayCount =Long.parseLong(e.getWarningCycle()); healthValueDayCount =Long.parseLong(e.getWarningCycle());
break; break;
} }
......
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