From 598875b00f9dba475df188e4e7d865f81d479c17 Mon Sep 17 00:00:00 2001 From: tianyongbao Date: Tue, 14 Apr 2026 22:44:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=91=8A=E8=AD=A6=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E9=94=99=E8=AF=AF=EF=BC=8C=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../intc/iot/handler/DeviceDataHandler.java | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) 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 9a9ac06..aa6e11d 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 @@ -145,6 +145,8 @@ public class DeviceDataHandler { private static final int WARN_TYPE_TEMPERATURE = 2; // 温度 private static final int WARN_TYPE_BATTERY = 2; // 电池电量 private static final int WARN_TYPE_OFFLINE = 2; // 设备离线 + private static final int WARN_TYPE_CONTROLLER = 3; // 控制器告警 + private static final int WARN_TYPE_SWITCH = 4; // 开关告警 /** * 告警类型名称 @@ -1398,6 +1400,8 @@ public class DeviceDataHandler { String title = null; String message = null; int switchIndex = 0; + // 告警类型:默认为控制器告警(3),开关相关故障使用开关告警(4) + int warnType = WARN_TYPE_CONTROLLER; if (errorCode >= DefineDeviceErrorCode.Three_InputLosePhaseA && errorCode <= DefineDeviceErrorCode.Three_InputLosePhaseC) { @@ -1424,7 +1428,8 @@ public class DeviceDataHandler { } } else if (errorCode >= DefineDeviceErrorCode.Three_Switch1LosePhaseA && errorCode <= DefineDeviceErrorCode.Three_Switch4LosePhaseC) { - // 三相开关输出缺相 + // 三相开关输出缺相 - 开关告警 + warnType = WARN_TYPE_SWITCH; int tempIndex = errorCode - DefineDeviceErrorCode.Three_Switch1LosePhaseA; String phaseName = DefineDeviceErrorCode.getPhaseName(tempIndex % 3); switchIndex = tempIndex / 3 + 1; @@ -1441,7 +1446,8 @@ public class DeviceDataHandler { } } else if (errorCode >= DefineDeviceErrorCode.Three_Switch1OverElectricA && errorCode <= DefineDeviceErrorCode.Three_Switch4OverElectricC) { - // 三相过流 + // 三相过流 - 开关告警 + warnType = WARN_TYPE_SWITCH; int tempIndex = errorCode - DefineDeviceErrorCode.Three_Switch1OverElectricA; String phaseName = DefineDeviceErrorCode.getPhaseName(tempIndex % 3); switchIndex = tempIndex / 3 + 1; @@ -1457,7 +1463,8 @@ public class DeviceDataHandler { } } else if (errorCode >= DefineDeviceErrorCode.Three_Switch1UnderElectricA && errorCode <= DefineDeviceErrorCode.Three_Switch4UnderElectricC) { - // 三相欠流 + // 三相欠流 - 开关告警 + warnType = WARN_TYPE_SWITCH; int tempIndex = errorCode - DefineDeviceErrorCode.Three_Switch1UnderElectricA; String phaseName = DefineDeviceErrorCode.getPhaseName(tempIndex % 3); switchIndex = tempIndex / 3 + 1; @@ -1473,7 +1480,8 @@ public class DeviceDataHandler { } } else if (errorCode >= DefineDeviceErrorCode.Three_Switch1ElectricEmpty && errorCode <= DefineDeviceErrorCode.Three_Switch4ElectricEmpty) { - // 三相空载 + // 三相空载 - 开关告警 + warnType = WARN_TYPE_SWITCH; switchIndex = errorCode - DefineDeviceErrorCode.Three_Switch1ElectricEmpty + 1; DeviceSwitch sw = getDeviceSwitchByIndex(deviceId, switchIndex); boolean electricWarnOpen = sw != null && sw.getElectricWarnOpen() != null && sw.getElectricWarnOpen() == 1; @@ -1487,7 +1495,8 @@ public class DeviceDataHandler { } } else if (errorCode >= DefineDeviceErrorCode.One_Switch1OverElectric && errorCode <= DefineDeviceErrorCode.One_Switch4OverElectric) { - // 单相过流 + // 单相过流 - 开关告警 + warnType = WARN_TYPE_SWITCH; switchIndex = errorCode - DefineDeviceErrorCode.One_Switch1OverElectric + 1; DeviceSwitch sw = getDeviceSwitchByIndex(deviceId, switchIndex); boolean electricWarnOpen = sw != null && sw.getElectricWarnOpen() != null && sw.getElectricWarnOpen() == 1; @@ -1501,7 +1510,8 @@ public class DeviceDataHandler { } } else if (errorCode >= DefineDeviceErrorCode.One_Switch1UnderElectric && errorCode <= DefineDeviceErrorCode.One_Switch4UnderElectric) { - // 单相欠流 + // 单相欠流 - 开关告警 + warnType = WARN_TYPE_SWITCH; switchIndex = errorCode - DefineDeviceErrorCode.One_Switch1UnderElectric + 1; DeviceSwitch sw = getDeviceSwitchByIndex(deviceId, switchIndex); boolean electricWarnOpen = sw != null && sw.getElectricWarnOpen() != null && sw.getElectricWarnOpen() == 1; @@ -1515,7 +1525,8 @@ public class DeviceDataHandler { } } else if (errorCode >= DefineDeviceErrorCode.One_Switch1ElectricEmpty && errorCode <= DefineDeviceErrorCode.One_Switch4ElectricEmpty) { - // 单相空载 + // 单相空载 - 开关告警 + warnType = WARN_TYPE_SWITCH; switchIndex = errorCode - DefineDeviceErrorCode.One_Switch1ElectricEmpty + 1; DeviceSwitch sw = getDeviceSwitchByIndex(deviceId, switchIndex); boolean electricWarnOpen = sw != null && sw.getElectricWarnOpen() != null && sw.getElectricWarnOpen() == 1; @@ -1547,7 +1558,7 @@ public class DeviceDataHandler { if (warnTrigger && title != null && message != null) { Long userId = device.getUserId(); if (userId != null) { - MessageWarn warn = createMessageWarn(deviceId, userId, pondName, title, WARN_TYPE_DISSOLVED_OXYGEN, message); + MessageWarn warn = createMessageWarn(deviceId, userId, pondName, title, warnType, message); messageWarnMapper.insert(warn); // 创建电话通知记录(全局开关控制) if (aliyunIotProperties.isCallNoticeEnabled()) {