fix:设备过期,离线报警和溶解氧报警应不报警,sensorErrorCode逻辑问题修复。
This commit is contained in:
@@ -986,6 +986,12 @@ public class DeviceDataHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设备已过期,不触发告警
|
||||||
|
if (device.getDeadTime() != null && device.getDeadTime().before(new java.util.Date())) {
|
||||||
|
log.debug("[离线告警] 设备已过期,跳过: {}", deviceName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Long deviceId = device.getId();
|
Long deviceId = device.getId();
|
||||||
Long userId = device.getUserId();
|
Long userId = device.getUserId();
|
||||||
|
|
||||||
@@ -1254,6 +1260,12 @@ public class DeviceDataHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设备已过期,不触发告警
|
||||||
|
if (device.getDeadTime() != null && device.getDeadTime().before(new java.util.Date())) {
|
||||||
|
log.debug("[饱和度告警] 设备已过期,跳过: {}", deviceName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Long deviceId = device.getId();
|
Long deviceId = device.getId();
|
||||||
Long userId = device.getUserId();
|
Long userId = device.getUserId();
|
||||||
|
|
||||||
@@ -2000,18 +2012,17 @@ public class DeviceDataHandler {
|
|||||||
if (!params.containsKey("sensorErrorCode")) {
|
if (!params.containsKey("sensorErrorCode")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 字段存在但为空字符串时,视为无故障(0),清除探头相关告警位
|
// 字段存在但值为空/null时,说明设备未真正上报该字段,直接跳过(不能视为0)
|
||||||
Object rawValue = params.get("sensorErrorCode");
|
Object rawValue = params.get("sensorErrorCode");
|
||||||
int sensorErrorCode;
|
|
||||||
if (rawValue == null || "".equals(rawValue.toString().trim())) {
|
if (rawValue == null || "".equals(rawValue.toString().trim())) {
|
||||||
sensorErrorCode = 0;
|
log.debug("[探头错误码] sensorErrorCode为空值,跳过处理: {}", deviceName);
|
||||||
} else {
|
return;
|
||||||
Integer parsed = params.getInt("sensorErrorCode");
|
|
||||||
if (parsed == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sensorErrorCode = parsed;
|
|
||||||
}
|
}
|
||||||
|
Integer parsed = params.getInt("sensorErrorCode");
|
||||||
|
if (parsed == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int sensorErrorCode = parsed;
|
||||||
|
|
||||||
// 查询设备,需要 id / warnCode / isOxygenUsed / pondId / deadTime
|
// 查询设备,需要 id / warnCode / isOxygenUsed / pondId / deadTime
|
||||||
Device device = deviceMapper.selectOne(
|
Device device = deviceMapper.selectOne(
|
||||||
|
|||||||
Reference in New Issue
Block a user