From 657df0a8be24210c920beda22b3e5c0725f9709b Mon Sep 17 00:00:00 2001 From: tianyongbao Date: Fri, 29 May 2026 12:10:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=AE=BE=E5=A4=87=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=EF=BC=8C=E7=A6=BB=E7=BA=BF=E6=8A=A5=E8=AD=A6=E5=92=8C=E6=BA=B6?= =?UTF-8?q?=E8=A7=A3=E6=B0=A7=E6=8A=A5=E8=AD=A6=E5=BA=94=E4=B8=8D=E6=8A=A5?= =?UTF-8?q?=E8=AD=A6=EF=BC=8CsensorErrorCode=E9=80=BB=E8=BE=91=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E5=A4=8D=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../intc/iot/handler/DeviceDataHandler.java | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/intc-modules/intc-iot/src/main/java/com/intc/iot/handler/DeviceDataHandler.java b/intc-modules/intc-iot/src/main/java/com/intc/iot/handler/DeviceDataHandler.java index 5495449..6f599ab 100644 --- a/intc-modules/intc-iot/src/main/java/com/intc/iot/handler/DeviceDataHandler.java +++ b/intc-modules/intc-iot/src/main/java/com/intc/iot/handler/DeviceDataHandler.java @@ -986,6 +986,12 @@ public class DeviceDataHandler { return; } + // 设备已过期,不触发告警 + if (device.getDeadTime() != null && device.getDeadTime().before(new java.util.Date())) { + log.debug("[离线告警] 设备已过期,跳过: {}", deviceName); + return; + } + Long deviceId = device.getId(); Long userId = device.getUserId(); @@ -1254,6 +1260,12 @@ public class DeviceDataHandler { return; } + // 设备已过期,不触发告警 + if (device.getDeadTime() != null && device.getDeadTime().before(new java.util.Date())) { + log.debug("[饱和度告警] 设备已过期,跳过: {}", deviceName); + return; + } + Long deviceId = device.getId(); Long userId = device.getUserId(); @@ -2000,18 +2012,17 @@ public class DeviceDataHandler { if (!params.containsKey("sensorErrorCode")) { return; } - // 字段存在但为空字符串时,视为无故障(0),清除探头相关告警位 + // 字段存在但值为空/null时,说明设备未真正上报该字段,直接跳过(不能视为0) Object rawValue = params.get("sensorErrorCode"); - int sensorErrorCode; if (rawValue == null || "".equals(rawValue.toString().trim())) { - sensorErrorCode = 0; - } else { - Integer parsed = params.getInt("sensorErrorCode"); - if (parsed == null) { - return; - } - sensorErrorCode = parsed; + log.debug("[探头错误码] sensorErrorCode为空值,跳过处理: {}", deviceName); + return; } + Integer parsed = params.getInt("sensorErrorCode"); + if (parsed == null) { + return; + } + int sensorErrorCode = parsed; // 查询设备,需要 id / warnCode / isOxygenUsed / pondId / deadTime Device device = deviceMapper.selectOne(