Explorar o código

预警信息容错

wyyay %!s(int64=2) %!d(string=hai) anos
pai
achega
6c15bba302

+ 12 - 12
.idea/jarRepositories.xml

@@ -2,8 +2,8 @@
 <project version="4">
   <component name="RemoteRepositoriesConfiguration">
     <remote-repository>
-      <option name="id" value="public" />
-      <option name="name" value="aliyun nexus" />
+      <option name="id" value="central" />
+      <option name="name" value="Central Repository" />
       <option name="url" value="https://maven.aliyun.com/repository/public" />
     </remote-repository>
     <remote-repository>
@@ -11,6 +11,16 @@
       <option name="name" value="Central Repository" />
       <option name="url" value="https://repo.maven.apache.org/maven2" />
     </remote-repository>
+    <remote-repository>
+      <option name="id" value="public" />
+      <option name="name" value="aliyun nexus" />
+      <option name="url" value="https://maven.aliyun.com/repository/public" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="central" />
+      <option name="name" value="Maven Central repository" />
+      <option name="url" value="https://repo1.maven.org/maven2" />
+    </remote-repository>
     <remote-repository>
       <option name="id" value="central" />
       <option name="name" value="Central Repository" />
@@ -26,11 +36,6 @@
       <option name="name" value="Central Repository" />
       <option name="url" value="http://maven.aliyun.com/nexus/content/repositories/central/" />
     </remote-repository>
-    <remote-repository>
-      <option name="id" value="central" />
-      <option name="name" value="Maven Central repository" />
-      <option name="url" value="https://repo1.maven.org/maven2" />
-    </remote-repository>
     <remote-repository>
       <option name="id" value="custom_group" />
       <option name="name" value="Nexus Repository" />
@@ -41,10 +46,5 @@
       <option name="name" value="JBoss Community repository" />
       <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
     </remote-repository>
-    <remote-repository>
-      <option name="id" value="central" />
-      <option name="name" value="Central Repository" />
-      <option name="url" value="https://maven.aliyun.com/repository/public" />
-    </remote-repository>
   </component>
 </project>

+ 38 - 26
hazard-admin/src/main/java/com/ozs/web/controller/accountmanagment/MsgAlarmController.java

@@ -33,6 +33,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.util.CollectionUtils;
 import org.springframework.util.ObjectUtils;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
@@ -285,9 +286,11 @@ public class MsgAlarmController extends BaseController {
                 alarmStatisticResVo.getEndMonth(), alarmStatisticResVo.getAlarmType(), userId);
         List<Integer> numbs = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12));
         List<Integer> list1 = new ArrayList<>();
-        list.forEach(l -> {
-            list1.add(l.getMonthsta());
-        });
+        if (!CollectionUtils.isEmpty(list) && Objects.nonNull(list.get(0))) {
+            list.forEach(l -> {
+                list1.add(l.getMonthsta());
+            });
+        }
         AlarmStatisticMonthDto dto;
         for (int i = 0; i < numbs.size(); i++) {
             if (!list1.contains(numbs.get(i))) {
@@ -297,13 +300,15 @@ public class MsgAlarmController extends BaseController {
                 list.add(dto);
             }
         }
-        Collections.sort(list, new Comparator<AlarmStatisticMonthDto>() {
-            @Override
-            public int compare(AlarmStatisticMonthDto o1, AlarmStatisticMonthDto o2) {
+        if (!CollectionUtils.isEmpty(list) && Objects.nonNull(list.get(0))) {
+            Collections.sort(list, new Comparator<AlarmStatisticMonthDto>() {
+                @Override
+                public int compare(AlarmStatisticMonthDto o1, AlarmStatisticMonthDto o2) {
 
-                return o1.getMonthsta().compareTo(o2.getMonthsta());
-            }
-        });
+                    return o1.getMonthsta().compareTo(o2.getMonthsta());
+                }
+            });
+        }
         return AjaxResult.success(list);
     }
 
@@ -330,16 +335,19 @@ public class MsgAlarmController extends BaseController {
         }
         try {
             List<AlarmStatisticDto> list = msgAlarmService.exportExcel(alarmStatisticResVo, userId);
-            list.forEach(l -> {
-                String alarmType = l.getAlarmType();
-                String alarmTypeValue = dictDataService.selectDictLabel("sys_alarm_type", alarmType);
-                l.setAlarmTypeValue(alarmTypeValue);
+            if (!CollectionUtils.isEmpty(list) && Objects.nonNull(list.get(0))) {
+                list.forEach(l -> {
+                    String alarmType = l.getAlarmType();
+                    String alarmTypeValue = dictDataService.selectDictLabel("sys_alarm_type", alarmType);
+                    l.setAlarmTypeValue(alarmTypeValue);
 
-                String lineDir = l.getLineDir();
-                String lineDirValue = dictDataService.selectDictLabel("sys_line_dir", lineDir);
-                l.setLineDirValue(lineDirValue);
+                    String lineDir = l.getLineDir();
+                    String lineDirValue = dictDataService.selectDictLabel("sys_line_dir", lineDir);
+                    l.setLineDirValue(lineDirValue);
+
+                });
+            }
 
-            });
             ExcelUtil<AlarmStatisticDto> util = new ExcelUtil<>(AlarmStatisticDto.class);
             util.exportExcel(response, list, "报警数据详情");
         } catch (Exception e) {
@@ -372,9 +380,11 @@ public class MsgAlarmController extends BaseController {
             List<AlarmStatisticMonthDto> list = msgAlarmService.exportExcelMonth(alarmStatisticResVo, userId);
             List<Integer> numbs = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12));
             List<Integer> list1 = new ArrayList<>();
-            list.forEach(l -> {
-                list1.add(l.getMonthsta());
-            });
+            if (!CollectionUtils.isEmpty(list) && Objects.nonNull(list.get(0))) {
+                list.forEach(l -> {
+                    list1.add(l.getMonthsta());
+                });
+            }
             AlarmStatisticMonthDto dto;
             for (int i = 0; i < numbs.size(); i++) {
                 if (!list1.contains(numbs.get(i))) {
@@ -384,13 +394,15 @@ public class MsgAlarmController extends BaseController {
                     list.add(dto);
                 }
             }
-            Collections.sort(list, new Comparator<AlarmStatisticMonthDto>() {
-                @Override
-                public int compare(AlarmStatisticMonthDto o1, AlarmStatisticMonthDto o2) {
+            if (!CollectionUtils.isEmpty(list) && Objects.nonNull(list.get(0))) {
+                Collections.sort(list, new Comparator<AlarmStatisticMonthDto>() {
+                    @Override
+                    public int compare(AlarmStatisticMonthDto o1, AlarmStatisticMonthDto o2) {
 
-                    return o1.getMonthsta().compareTo(o2.getMonthsta());
-                }
-            });
+                        return o1.getMonthsta().compareTo(o2.getMonthsta());
+                    }
+                });
+            }
             ExcelUtil<AlarmStatisticMonthDto> util = new ExcelUtil<>(AlarmStatisticMonthDto.class);
             util.exportExcel(response, list, "报警月统计数据");
         } catch (Exception e) {