From f0ecb0f048363ca3d6b2e46cef99f7cf21d4dbbf Mon Sep 17 00:00:00 2001 From: 25604 Date: Fri, 3 Oct 2025 10:05:52 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BC=98=E5=8C=96=E6=8A=A5=E8=AD=A6?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/operation/impl/AlarmRecordsServiceImpl.java | 7 +++++++ 1 file changed, 7 insertions(+) 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);