Jelajahi Sumber

Merge branch 'master' of http://124.70.58.209:3000/ytrd-project-management/GeoHazardMonitor

gao.qiang 2 tahun lalu
induk
melakukan
9bf62bc8da

+ 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>

+ 6 - 0
business-service/src/main/java/com/ozs/service/entity/vo/MsgAlarmVo.java

@@ -65,7 +65,13 @@ public class MsgAlarmVo extends PageVo implements Serializable {
      */
     private Integer isLock;
 
+    /**
+     * 用户userID
+     */
     private List<String> userIds;
 
+    /**
+     * 状态:1未读;2已读
+     */
     private Integer status;
 }

+ 0 - 3
business-service/src/main/java/com/ozs/service/service/impl/MsgWebPushServiceImpl.java

@@ -98,11 +98,8 @@ public class MsgWebPushServiceImpl extends ServiceImpl<MsgWebPushMapper, MsgWebP
                 .doSelectPage(() -> msgWebPushMapper.messageMore(msgAlarmVo));
         com.baomidou.mybatisplus.extension.plugins.pagination.Page<MsgAlarm> pageR =
                 new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(msgAlarmVo.getPageNum().intValue(), msgAlarmVo.getPageSize().intValue());
-
         pageR.setSize(page.size());
         pageR.setTotal(page.getTotal());
-
-
         // Page<MsgAlarm> page = PageUtils.getPages(msgAlarmVo.getPageNum().intValue(), msgAlarmVo.getPageSize().intValue(), webAlarm);
         if (!ObjectUtils.isEmpty(page) && !ObjectUtils.isEmpty(page.getResult())) {
             List<MsgAlarm> dto1 = page.getResult().stream().map(o -> {

+ 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) {

+ 1 - 0
hazard-admin/src/main/java/com/ozs/web/controller/websocket/WebSocketConteoller.java

@@ -54,6 +54,7 @@ public class WebSocketConteoller extends BaseController {
     @ResponseBody
     @PostMapping("/publish")
     public Map publish(@RequestBody MsgAlarm msgAlarm) {
+        log.info("消息推送:" + msgAlarm.toString());
         LambdaQueryWrapper<BaseCameraManagement> wrapper = new LambdaQueryWrapper<BaseCameraManagement>();
         if (!ObjectUtils.isEmpty(msgAlarm.getCameraCode())) {
             wrapper.eq(BaseCameraManagement::getCameraCode, msgAlarm.getCameraCode());