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(