Browse Source

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

lixing 3 years ago
parent
commit
c239ff98e5
1 changed files with 8 additions and 2 deletions
  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;
     }