Browse Source

1、优化报警记录

dev_mz
25604 2 weeks ago
parent
commit
f0ecb0f048
  1. 7
      mh-system/src/main/java/com/mh/system/service/operation/impl/AlarmRecordsServiceImpl.java

7
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);

Loading…
Cancel
Save