Commit b7118dce authored by chenzhao's avatar chenzhao

修改预警问题

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