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 5af8d08..2c802a8 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 @@ -229,14 +229,14 @@ public class DeviceDataHandler { try { // 如果是控制器,需要区分处理 if (isController) { + // 控制器故障码处理(独立于开关数据判断,确保只有故障码时也能处理) + if (params.containsKey("errorCode")) { + handleControllerErrorCode(deviceName, params); + } // 判断数据类型(开关数据和传感器数据不会同时出现) if (hasSwitchData(params)) { // 开关数据:更新开关状态和电压电流 handleSwitchData(deviceName, params); - // 控制器故障码处理(C# itemController.errorCode) - if (params.containsKey("errorCode")) { - handleControllerErrorCode(deviceName, params); - } } else if (hasSensorData(params)) { // 传感器数据:写入TDengine sensorData = convertToSensorData(productKey, deviceName, params);