fix: 塘口控制器列表,只有开关关联,无溶解氧探头时,显示问题,bug修复。
This commit is contained in:
@@ -15,6 +15,7 @@ import com.intc.fishery.domain.DeviceCorrectRecord;
|
||||
import com.intc.fishery.domain.DeviceBindRecord;
|
||||
import com.intc.fishery.domain.DeviceErrorCode;
|
||||
import com.intc.fishery.domain.AquUser;
|
||||
import com.intc.fishery.constant.DefineDeviceWarnCode;
|
||||
import com.intc.fishery.domain.bo.*;
|
||||
import com.intc.fishery.domain.vo.DeviceSwitchVo;
|
||||
import com.intc.fishery.mapper.DeviceMapper;
|
||||
@@ -969,12 +970,12 @@ public class IotController extends BaseController {
|
||||
// 获取设备属性
|
||||
Map<String, Object> deviceProperties = iotDeviceService.queryDeviceProperties(iotId);
|
||||
|
||||
// 初始化警告码:默认探头离线且未校准 (0x0081)
|
||||
int warnCode = 0x0081;
|
||||
// 初始化警告码:默认探头未校准 (OxyDetectorNoCorrect)
|
||||
int warnCode = DefineDeviceWarnCode.OxyDetectorNoCorrect;
|
||||
|
||||
// 如果设备离线,添加设备离线警告
|
||||
if (status != null && "OFFLINE".equalsIgnoreCase(status)) {
|
||||
warnCode |= 0x0080; // 设备离线 (0x0080)
|
||||
warnCode |= DefineDeviceWarnCode.DeviceOffline;
|
||||
}
|
||||
|
||||
// 计算设备数量,用于生成设备名称
|
||||
@@ -997,7 +998,7 @@ public class IotController extends BaseController {
|
||||
} else {
|
||||
// 检查是否已过期
|
||||
if (device.getDeadTime() != null && now.after(device.getDeadTime())) {
|
||||
warnCode |= 0x0040; // 设备时间到期 (0x0040)
|
||||
warnCode |= DefineDeviceWarnCode.DeviceTimeDead;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1121,7 +1122,7 @@ public class IotController extends BaseController {
|
||||
try {
|
||||
int tcorrect = Integer.parseInt(value.toString());
|
||||
if (tcorrect == 1) {
|
||||
warnCode &= ~0x0001; // 清除未校准标记
|
||||
warnCode &= ~DefineDeviceWarnCode.OxyDetectorNoCorrect; // 清除未校准标记
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
log.warn("无法解析校准状态: {}", value);
|
||||
@@ -1239,7 +1240,7 @@ public class IotController extends BaseController {
|
||||
switchIndex = errorCode - 0x200B + 1;
|
||||
// 断电告警
|
||||
} else if (errorCode == 0x3001) {
|
||||
warnCode |= 0x0020; // ErrorPowerOff
|
||||
warnCode |= DefineDeviceWarnCode.ErrorPowerOff; // ErrorPowerOff
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1479,7 +1480,7 @@ public class IotController extends BaseController {
|
||||
try {
|
||||
int tcorrect = Integer.parseInt(value.toString());
|
||||
if (tcorrect == 1) {
|
||||
warnCode &= ~0x0001; // 清除未校准标记
|
||||
warnCode &= ~DefineDeviceWarnCode.OxyDetectorNoCorrect; // 清除未校准标记
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
log.warn("无法解析校准状态: {}", value);
|
||||
@@ -1612,8 +1613,8 @@ public class IotController extends BaseController {
|
||||
|
||||
// 更新设备警告码:清除未校准标记
|
||||
int warnCode = device.getWarnCode() != null ? device.getWarnCode() : 0;
|
||||
if ((warnCode & 0x0001) != 0) {
|
||||
warnCode &= ~0x0001; // 清除未校准标记
|
||||
if ((warnCode & DefineDeviceWarnCode.OxyDetectorNoCorrect) != 0) {
|
||||
warnCode &= ~DefineDeviceWarnCode.OxyDetectorNoCorrect; // 清除未校准标记
|
||||
}
|
||||
|
||||
// 更新设备
|
||||
|
||||
Reference in New Issue
Block a user