瀏覽代碼

行别增加3上下行

gao.qiang 2 月之前
父節點
當前提交
db41854f6e

+ 2 - 2
business-service/src/main/java/com/ozs/service/entity/BaseCameraManagement.java

@@ -62,9 +62,9 @@ public class BaseCameraManagement extends BaseEntity implements Serializable ,Co
     private String deptName;
 
     /**
-     * 行别(1上行2下行)
+     * 行别(1上行2下行3上下行
      */
-    @Excel(name = "行别",readConverterExp = "1=上行,2=下行")
+    @Excel(name = "行别",readConverterExp = "1=上行,2=下行,3=上下行")
     private Integer lineDir;
 
     /**

+ 2 - 2
business-service/src/main/java/com/ozs/service/entity/MsgAlarm.java

@@ -74,7 +74,7 @@ public class MsgAlarm extends BaseEntity implements Serializable {
     private Integer alarmConfidence;
 
     /**
-     * 报警行别(1上行2下行)
+     * 报警行别(1上行2下行3上下行)
      */
     private Integer lineDir;
 
@@ -222,7 +222,7 @@ public class MsgAlarm extends BaseEntity implements Serializable {
     private String msgId;
 
     /**
-     * 报警行别字符串(1上行2下行)
+     * 报警行别字符串(1上行2下行3上下行)
      */
     @TableField(exist = false)
     @Excel(name = "报警行别")

+ 2 - 2
business-service/src/main/java/com/ozs/service/entity/vo/AlarmStatisticVo.java

@@ -76,12 +76,12 @@ public class AlarmStatisticVo {
     private Integer alarmConfidence;
 
     /**
-     * 报警行别(1上行2下行)
+     * 报警行别(1上行2下行3上下行)
      */
     private Integer lineDir;
 
     /**
-     * 报警行别字符串(1上行2下行)
+     * 报警行别字符串(1上行2下行3上下行)
      */
     private String lineDirName;
 

+ 1 - 1
business-service/src/main/java/com/ozs/service/entity/vo/BaseCameraManagementHomeVo.java

@@ -53,7 +53,7 @@ public class BaseCameraManagementHomeVo extends BaseEntity implements Serializab
     private Long deptId;
 
     /**
-     * 行别(1上行2下行)
+     * 行别(1上行2下行3上下行
      */
     @Excel(name = "行别")
     private Integer lineDir;

+ 2 - 2
business-service/src/main/java/com/ozs/service/entity/vo/BaseCameraManagementVos.java

@@ -39,9 +39,9 @@ public class BaseCameraManagementVos implements Serializable {
 
 
     /**
-     * 行别(1上行2下行)
+     * 行别(1上行2下行3上下行
      */
-    @Excel(name = "行别",readConverterExp = "1=上行,2=下行")
+    @Excel(name = "行别",readConverterExp = "1=上行,2=下行,3=上下行")
     private Integer lineDir;
 
     /**

+ 1 - 1
business-service/src/main/java/com/ozs/service/entity/vo/MsgAlarmResp.java

@@ -51,7 +51,7 @@ public class MsgAlarmResp implements Serializable {
     private Integer alarmType;
 
     /**
-     * 报警行别(1上行2下行)
+     * 报警行别(1上行2下行3上下行)
      */
     private Integer lineDir;
     private String lineDirStr;

+ 1 - 1
business-service/src/main/java/com/ozs/service/entity/vo/MsgAppPushVo.java

@@ -34,7 +34,7 @@ public class MsgAppPushVo extends PageVo implements Serializable {
     private Integer railwayType;
 
     /**
-     * 报警行别(1上行2下行)
+     * 报警行别(1上行2下行3上下行)
      */
     private Integer lineDir;
 

+ 16 - 6
business-service/src/main/java/com/ozs/service/service/impl/BaseDeviceDynamicManagementServiceImpl.java

@@ -44,6 +44,16 @@ public class BaseDeviceDynamicManagementServiceImpl extends ServiceImpl<BaseDevi
         List<BaseCameraManagementDto> list = baseDeviceDynamicManagementMapper.list(cameraTreeVo);
         if (list.size() > 0) {
             for (BaseCameraManagementDto o : list) {
+                //行别字符串
+                String lineDirName = "";
+                if ("1".equals(o.getLineDir())) {
+                    lineDirName = "上行";
+                } else if ("2".equals(o.getLineDir())) {
+                    lineDirName = "下行";
+                } else if ("3".equals(o.getLineDir())) {
+                    lineDirName = "上下行";
+                }
+
                 // 线路
                 CameraTree build = CameraTree.builder()
                         .code(o.getRailwayCode())
@@ -78,17 +88,17 @@ public class BaseDeviceDynamicManagementServiceImpl extends ServiceImpl<BaseDevi
                 // 里程
                 String mils = AppendUtils.stringAppend(o.getInstallMile());
                 CameraTree build1 = CameraTree.builder()
-                        .code(mils + "-" + (o.getLineDir().equals("1") ? "上行" : "下行"))
-                        .name(mils + "-" + (o.getLineDir().equals("1") ? "上行" : "下行"))
+                        .code(mils + "-" + lineDirName)
+                        .name(mils + "-" + lineDirName)
                         .flay(true)
                         .publicWorksSection(o.getPublicWorksSection())
                         .mileage(o.getInstallMile())
                         .children(new ArrayList<>())
                         .build();
                 if (!ObjectUtils.isEmpty(map.get(o.getRailwayCode()+"-"+o.getPublicWorksSection()))) {
-                    CameraTree cameraTree1 = map.get(o.getRailwayCode()+"-"+o.getPublicWorksSection()+"-"+o.getInstallMile() + "-" + (o.getLineDir().equals("1") ? "上行" : "下行"));
+                    CameraTree cameraTree1 = map.get(o.getRailwayCode()+"-"+o.getPublicWorksSection()+"-"+o.getInstallMile() + "-" + lineDirName);
                     if (ObjectUtils.isEmpty(cameraTree1)) {
-                        map.put(o.getRailwayCode()+"-"+o.getPublicWorksSection()+"-"+o.getInstallMile() + "-" + (o.getLineDir().equals("1") ? "上行" : "下行"), build1);
+                        map.put(o.getRailwayCode()+"-"+o.getPublicWorksSection()+"-"+o.getInstallMile() + "-" + lineDirName, build1);
                         map.get(o.getRailwayCode()+"-"+o.getPublicWorksSection()).getChildren().add(build1);
                     }
                 }
@@ -100,8 +110,8 @@ public class BaseDeviceDynamicManagementServiceImpl extends ServiceImpl<BaseDevi
                         .publicWorksSection(o.getPublicWorksSection())
                         .children(new ArrayList<>())
                         .build();
-                if (!ObjectUtils.isEmpty(map.get(o.getRailwayCode()+"-"+o.getPublicWorksSection()+"-"+o.getInstallMile() + "-" + (o.getLineDir().equals("1") ? "上行" : "下行")))) {
-                    map.get(o.getRailwayCode()+"-"+o.getPublicWorksSection()+"-"+o.getInstallMile() + "-" + (o.getLineDir().equals("1") ? "上行" : "下行")).getChildren().add(build2);
+                if (!ObjectUtils.isEmpty(map.get(o.getRailwayCode()+"-"+o.getPublicWorksSection()+"-"+o.getInstallMile() + "-" + lineDirName))) {
+                    map.get(o.getRailwayCode()+"-"+o.getPublicWorksSection()+"-"+o.getInstallMile() + "-" + lineDirName).getChildren().add(build2);
                 }
             }
         }

+ 2 - 0
business-service/src/main/resources/mapper/service/BaseCameraManagementMapper.xml

@@ -130,6 +130,8 @@
         '上行'
         WHEN 2 THEN
         '下行'
+        WHEN 3 THEN
+        '上下行'
         END AS lineDir,
         CASE
         man.is_disable

+ 25 - 5
hazard-admin/src/main/java/com/ozs/web/controller/accountmanagment/BaseCameraManagementController.java

@@ -749,12 +749,19 @@ public class BaseCameraManagementController extends BaseController {
                 cameraTreeList.sort(new Comparator<CameraTree>() {
                     @Override
                     public int compare(CameraTree o1, CameraTree o2) {
-                        int i = o1.getMileage() - o2.getMileage();
-                        if (i == 0) {
-                            String[] split = o1.getName().split("-");
-                            return "上行".equals(split[1]) ? -1 : 1;
+                        int mileageDiff  = o1.getMileage() - o2.getMileage();
+                        // 如果里程相同,则比较方向
+                        if (mileageDiff == 0) {
+                            String[] split1 = o1.getName().split("-");
+                            String[] split2 = o2.getName().split("-");
+
+                            // 根据方向给予优先级
+                            int priority1 = getDirectionPriority(split1[1]);
+                            int priority2 = getDirectionPriority(split2[1]);
+
+                            return Integer.compare(priority1, priority2);
                         } else {
-                            return i;
+                            return mileageDiff;
                         }
                     }
                 });
@@ -777,6 +784,19 @@ public class BaseCameraManagementController extends BaseController {
         return success(cameraTree);
     }
 
+    private int getDirectionPriority(String direction) {
+        switch (direction) {
+            case "上行":
+                return 1; // 高优先级
+            case "下行":
+                return 2; // 次优先级
+            case "上下行":
+                return 3; // 低优先级
+            default:
+                return Integer.MAX_VALUE; // 未知方向,最低优先级
+        }
+    }
+
     @GetMapping("/endRecording/{id}")
     @Log(title = "相机台账管理", businessType = BusinessType.OTHER)
     public AjaxResult endRecording(@PathVariable Long id) {

+ 16 - 2
hazard-admin/src/main/java/com/ozs/web/controller/accountmanagment/MsgAlarmController.java

@@ -361,7 +361,15 @@ public class MsgAlarmController extends BaseController {
             if (!ObjectUtils.isEmpty(msgAlarm.getReleasedType())) {
                 msgAlarm.setReleasedTypeName(msgAlarm.getReleasedType() == 1 ? "实报" : "误报");
             }
-            msgAlarm.setLineDirName(msgAlarm.getLineDir() == 1 ? "上行" : "下行");
+            if (msgAlarm.getLineDir() == 1) {
+                msgAlarm.setLineDirName("上行");
+            } else if (msgAlarm.getLineDir() == 2) {
+                msgAlarm.setLineDirName( "下行");
+            } else if (msgAlarm.getLineDir() == 3) {
+                msgAlarm.setLineDirName( "上下行");
+            }
+
+
             msgAlarm.setIsLockName(msgAlarm.getIsLock() == 1 ? "已解除" : "未解除");
             LambdaQueryWrapper<SysDictData> dict = new LambdaQueryWrapper<>();
             dict.eq(SysDictData::getDictType, "sys_alarm_type");
@@ -607,7 +615,13 @@ public class MsgAlarmController extends BaseController {
                     o.setReleasedTypeName(o.getReleasedType() == 1 ? "实报" : "误报");
                 }
                 if (!ObjectUtils.isEmpty(o.getLineDir())) {
-                    o.setLineDirName(o.getLineDir() == 1 ? "上行" : "下行");
+                    if (o.getLineDir() == 1) {
+                        o.setLineDirName("上行");
+                    } else if (o.getLineDir() == 2) {
+                        o.setLineDirName( "下行");
+                    } else if (o.getLineDir() == 3) {
+                        o.setLineDirName( "上下行");
+                    }
                 }
                 if (!ObjectUtils.isEmpty(o.getAlarmType())) {
                     o.setAlarmTypeName(dictDataService.selectDictLabel("sys_alarm_type", String.valueOf(o.getAlarmType())));

+ 17 - 2
hazard-admin/src/main/java/com/ozs/web/controller/websocket/WebSocketConteoller.java

@@ -152,7 +152,13 @@ public class WebSocketConteoller extends BaseController {
         
         String cameraName = baseRailwayManagementService.getCameraNameByCameraCode(cameraCode);
         msgAlarmResp.setRailwayName(cameraName != null ? cameraName : "");
-        msgAlarmResp.setLineDirStr(baseCameraManagement.getLineDir() == 1 ? "上行" : "下行");
+        if (baseCameraManagement.getLineDir() == 1) {
+            msgAlarmResp.setLineDirStr("上行");
+        } else if (baseCameraManagement.getLineDir() == 2) {
+            msgAlarmResp.setLineDirStr( "下行");
+        } else if (baseCameraManagement.getLineDir() == 3) {
+            msgAlarmResp.setLineDirStr( "上下行");
+        }
         msgAlarmResp.setAlarmTime(msgAlarm.getAlarmTime() != null ? msgAlarm.getAlarmTime() : new Date());
         // 图片
         if (!StringUtils.isEmpty(msgAlarm.getImageUrl())) {
@@ -240,13 +246,22 @@ public class WebSocketConteoller extends BaseController {
                     boolean userOnline = webSocketServer.userOnline(userRegistrationid.getUserId());
                     log.info("userOnline-userOnline-userOnline-userOnline-----::::::" + userOnline);
                     if (userOnline) {
+                        //行别字符串
+                        String lineDirName = "";
+                        if (baseCameraManagement.getLineDir() == 1) {
+                            lineDirName = "上行";
+                        } else if (baseCameraManagement.getLineDir() == 2) {
+                            lineDirName = "下行";
+                        } else if (baseCameraManagement.getLineDir() == 3) {
+                            lineDirName = "上下行";
+                        }
                         List<String> userList = new ArrayList<>();
                         userList.add(userRegistrationid.getRegistrationId());
                         JPushUtil.sendToRegistrationId(
                                 userList,
                                 "报警通知!", cameraName != null ? cameraName : "",
                                 // content,
-                                formatDate + "     " + (msgAlarmResp.getAlarmType() == 1 ? "泥石流" : msgAlarmResp.getAlarmType()) + "     " + (baseCameraManagement.getLineDir() == 1 ? "上行" : "下行") + "     " + mile + "     " + endMile,
+                                formatDate + "     " + (msgAlarmResp.getAlarmType() == 1 ? "泥石流" : msgAlarmResp.getAlarmType()) + "     " + lineDirName + "     " + mile + "     " + endMile,
                                 content);
                         msgAppPush.setOnline("1");
                     } else {