fix: 设备添加,默认告警码为0,告警消息排序修改,sensorErrorCode处理修改。
This commit is contained in:
@@ -1996,13 +1996,22 @@ public class DeviceDataHandler {
|
||||
*/
|
||||
private void handleSensorErrorCode(String deviceName, JSONObject params) {
|
||||
try {
|
||||
Integer rawCode = params.getInt("sensorErrorCode");
|
||||
if (rawCode == null) {
|
||||
// 部分设备/数据包不携带此字段,属于正常情况
|
||||
log.debug("[探头错误码] 设备上报数据不包含 sensorErrorCode 字段: {}", deviceName);
|
||||
// 判断字段是否存在
|
||||
if (!params.containsKey("sensorErrorCode")) {
|
||||
return;
|
||||
}
|
||||
int sensorErrorCode = rawCode;
|
||||
// 字段存在但为空字符串时,视为无故障(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;
|
||||
}
|
||||
|
||||
// 查询设备,需要 id / warnCode / isOxygenUsed / pondId / deadTime
|
||||
Device device = deviceMapper.selectOne(
|
||||
|
||||
Reference in New Issue
Block a user