Browse Source

首页报警统计查询bug修改

‘xugp 2 years ago
parent
commit
9727d80a00

+ 6 - 3
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/service/AlarmSnapService.java

@@ -530,7 +530,7 @@ public class AlarmSnapService extends ServiceImpl<AlarmSnapMapper, AlarmSnap> {
         wrapper.in("CATEGORY1",strings);
         //设置时间范围
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
-        String strDate = sdf.format(DateUtil.addDays(new Date(),-14));
+        String strDate = sdf.format(DateUtil.addDays(new Date(),-1));
         Date dtStart = sdf.parse(strDate);
         Date dtEnd = new Date();
         wrapper.ge("lastUpdateTime",dtStart);
@@ -553,9 +553,12 @@ public class AlarmSnapService extends ServiceImpl<AlarmSnapMapper, AlarmSnap> {
                 }
                 stringListMap.put(entry.getKey(), alarmHomes);
             }
-        }else {
+        }
+        if (!stringListMap.containsKey("SYZ")){
             stringListMap.put("SYZ",new ArrayList<>());
-            stringListMap.put("winturbine",new ArrayList<>());
+        }
+        if (!stringListMap.containsKey("windturbine")){
+            stringListMap.put("windturbine",new ArrayList<>());
         }
         return stringListMap;
     }

+ 5 - 2
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/service/RiskSnapService.java

@@ -32,7 +32,7 @@ public class RiskSnapService extends ServiceImpl<RiskSnapMapper, RiskSnap> {
         wrapper.eq("OPENED",1);
         //设置时间范围
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
-        String strDate = sdf.format(DateUtil.addDays(new Date(),-14));
+        String strDate = sdf.format(DateUtil.addDays(new Date(),-1));
         Date dtStart = sdf.parse(strDate);
         Date dtEnd = new Date();
         wrapper.ge("lastUpdateTime",dtStart);
@@ -54,8 +54,11 @@ public class RiskSnapService extends ServiceImpl<RiskSnapMapper, RiskSnap> {
                 }
                 stringListMap.put(entry.getKey().toString(), alarmHomes);
             }
-        }else {
+        }
+        if (!stringListMap.containsKey("1")){
             stringListMap.put("1",new ArrayList<>());
+        }
+        if (!stringListMap.containsKey("2")){
             stringListMap.put("2",new ArrayList<>());
         }
         return stringListMap;