fix:设备过期,离线报警和溶解氧报警应不报警,sensorErrorCode逻辑问题修复。

This commit is contained in:
tianyongbao
2026-05-29 12:10:39 +08:00
parent 598f34eae2
commit 657df0a8be

View File

@@ -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(