fix:告警类型错误,问题修复。
This commit is contained in:
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user