Explorar o código

兼容报警恢复时间未设置的情况

lixing %!s(int64=3) %!d(string=hai) anos
pai
achega
c239ff98e5
Modificáronse 1 ficheiros con 8 adicións e 2 borrados
  1. 8 2
      src/main/java/com/persagy/entity/AlarmDefine.java

+ 8 - 2
src/main/java/com/persagy/entity/AlarmDefine.java

@@ -132,8 +132,14 @@ public class AlarmDefine {
         condition.setTrigger(alarmCondition.getTriggerBackend());
         condition.setEnd(alarmCondition.getEndBackend());
         // 时间转换为秒
-        condition.setTriggerUphold(alarmCondition.getTriggerUphold() * 60);
-        condition.setEndUphold(alarmCondition.getEndUphold() * 60);
+        condition.setTriggerUphold(0);
+        if (alarmCondition.getTriggerUphold() != null) {
+            condition.setTriggerUphold(alarmCondition.getTriggerUphold() * 60);
+        }
+        condition.setEndUphold(0);
+        if (alarmCondition.getEndUphold() != null) {
+            condition.setEndUphold(alarmCondition.getEndUphold() * 60);
+        }
         alarmDefine.setCondition(condition);
         return alarmDefine;
     }