diff --git a/mh-system/src/main/java/com/mh/system/service/operation/impl/AlarmRecordsServiceImpl.java b/mh-system/src/main/java/com/mh/system/service/operation/impl/AlarmRecordsServiceImpl.java index e5bffc0..4870425 100644 --- a/mh-system/src/main/java/com/mh/system/service/operation/impl/AlarmRecordsServiceImpl.java +++ b/mh-system/src/main/java/com/mh/system/service/operation/impl/AlarmRecordsServiceImpl.java @@ -229,6 +229,10 @@ public class AlarmRecordsServiceImpl implements IAlarmRecordsService { AlarmRecords alarmRecords = new AlarmRecords(); BigDecimal curValue = collectionParamsManage.getCurValue(); Date curTime = collectionParamsManage.getCurTime(); + // 判断时间是否是今天 + if (!DateUtils.isSameDay(curTime, new Date())) { + continue; + } // 阈值 String threshold1 = alarmRule.getThreshold1(); String threshold2 = alarmRule.getThreshold2(); @@ -264,6 +268,9 @@ public class AlarmRecordsServiceImpl implements IAlarmRecordsService { if (compare) { handleAlarmRecord(alarmRule, alarmCode, curValue, threshold1, alarmRecords, collectionParamsManage, "#{setValue}", alarmRule.getCondition1() + threshold1); } + if (alarmRule.getCondition2() == null || threshold2.isEmpty()) { + return; + } boolean compare1 = BigDecimalUtils.compare(alarmRule.getCondition2(), curValue, new BigDecimal(threshold2)); if (compare1) { handleAlarmRecord(alarmRule, alarmCode, curValue, threshold2, alarmRecords, collectionParamsManage, "#{setValue}", alarmRule.getCondition2() + threshold2);