Pārlūkot izejas kodu

相机树开发

gao.qiang 3 mēneši atpakaļ
vecāks
revīzija
99a95a9bef

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

@@ -214,6 +214,7 @@ public class BaseCameraManagement extends BaseEntity implements Serializable ,Co
     private String remark;
 
     @TableField(exist = false)
+    @Excel(name = "线路类型",readConverterExp = "1=高铁,2=普铁")
     private Integer railwayType;
 
     @TableField(exist = false)

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

@@ -18,8 +18,10 @@ public class CameraTree implements Serializable,Comparable<CameraTree> {
     private static final long serialVersionUID = 1L;
     String code;
     String name;
+    String railwayName;
     boolean flay;
     Integer mileage;
+    Integer number;
     /**
      * 所属工务段
      */

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

@@ -53,5 +53,8 @@ public class BaseCameraManagementDto extends BaseEntity implements Serializable
      */
     @Excel(name = "线路编码")
     private String railwayCode;
-    
+
+
+    private String lineNumber;
+
 }

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

@@ -43,6 +43,8 @@ public class DeviceStateResp extends PageVo implements Serializable {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date updateTime;
+    @Excel(name = "线路类型",readConverterExp = "1=高铁,2=普铁")
+    private Integer railwayType;
     private String railwayCode;
     private String deptId;
     /**

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

@@ -12,6 +12,7 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 
 import java.io.Serializable;
+import java.time.LocalDateTime;
 import java.util.Date;
 import java.util.List;
 
@@ -160,4 +161,10 @@ public class MsgAlarmResp implements Serializable {
 
     private String cameraSn;
 
+    private Integer isDisable;
+
+    private LocalDateTime heartTime;
+
+    private Integer electricity;
+
 }

+ 12 - 5
business-service/src/main/java/com/ozs/service/service/impl/BaseDeviceDynamicManagementServiceImpl.java

@@ -55,13 +55,19 @@ public class BaseDeviceDynamicManagementServiceImpl extends ServiceImpl<BaseDevi
                 }
 
                 // 线路
-                CameraTree build = CameraTree.builder()
+                CameraTree.CameraTreeBuilder builder  = CameraTree.builder()
                         .code(o.getRailwayCode())
-                        .name(o.getRailwayName())
+                        .name(o.getLineNumber()+o.getRailwayName())
+                        .railwayName(o.getRailwayName())
+                        .number(Integer.valueOf(o.getLineNumber()))
                         .flay(true)
                         .publicWorksSection(o.getPublicWorksSection())
-                        .children(new ArrayList<>())
-                        .build();
+                        .children(new ArrayList<>());
+                if (o.getLineNumber() != null && !o.getLineNumber().isEmpty()) {
+                    builder.number(Integer.valueOf(o.getLineNumber()));
+                }
+
+                CameraTree build = builder.build();
                 if (!cameraTree.getChildren().stream()
                         .map(CameraTree::getCode)
                         .collect(Collectors.toList())
@@ -72,7 +78,8 @@ public class BaseDeviceDynamicManagementServiceImpl extends ServiceImpl<BaseDevi
                //工务段
                 CameraTree build3 = CameraTree.builder()
                         .code(o.getRailwayCode())
-                        .name(o.getRailwayName())
+                        .name(o.getLineNumber()+o.getRailwayName())
+                        .railwayName(o.getRailwayName())
                         .flay(true)
                         .publicWorksSection(o.getPublicWorksSection())
                         .children(new ArrayList<>())

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

@@ -126,6 +126,7 @@
         ca.install_mile AS installMile,
         ca.measure_point_name AS measurePointName,
         ra.railway_name AS railwayName,
+        ra.railway_type AS railwayType,
         de.dept_name AS deptName,
         CASE
         line_dir
@@ -173,6 +174,9 @@
             <if test="lineDir != null and lineDir != 0">
                 and ca.line_dir =#{lineDir}
             </if>
+            <if test="railwayType != null and railwayType != 0">
+                and ca.railway_type =#{railwayType}
+            </if>
             <if test="deptId != null and deptId != 0">
                 and ca.dept_id =#{deptId}
             </if>

+ 1 - 0
business-service/src/main/resources/mapper/service/BaseDeviceDynamicManagementMapper.xml

@@ -11,6 +11,7 @@
 			a.install_mile AS installMile, 
 			a.id AS id,
 			a.dept_id,
+		    l.line_number AS lineNumber,
 			d.dept_name as publicWorksSection
 		FROM base_camera_management AS a
 		    inner join sys_dept as d on a.dept_id = d.dept_id

+ 34 - 13
hazard-admin/src/main/java/com/ozs/web/controller/accountmanagment/BaseCameraManagementController.java

@@ -138,14 +138,12 @@ public class BaseCameraManagementController extends BaseController {
             }
             BaseDeviceDynamicManagement deviceDynamicManagement = baseDeviceDynamicManagementService.getOne(new LambdaQueryWrapper<BaseDeviceDynamicManagement>()
                     .eq(BaseDeviceDynamicManagement::getCameraCode, cameraCode));
-            if (deviceDynamicManagement.getIsDisable()==2) {
-                baseCameraManagement.setIsDisable(deviceDynamicManagement.getIsDisable());
-                baseCameraManagement.setElectricity(deviceDynamicManagement.getElectricity());
-                List<MqLog> list = mqLogService.list(new LambdaQueryWrapper<MqLog>()
-                        .eq(MqLog::getCameraCode, cameraCode));
-                if (!ObjectUtils.isEmpty(list)) {
-                    baseCameraManagement.setHeartTime(list.get(0).getCreateTime());
-                }
+            baseCameraManagement.setIsDisable(deviceDynamicManagement.getIsDisable());
+            baseCameraManagement.setElectricity(deviceDynamicManagement.getElectricity());
+            List<MqLog> list = mqLogService.list(new LambdaQueryWrapper<MqLog>()
+                    .eq(MqLog::getCameraCode, cameraCode));
+            if (!ObjectUtils.isEmpty(list)) {
+                baseCameraManagement.setHeartTime(list.get(0).getCreateTime());
             }
             // 将字符串转换为浮点数
             double installLatitude = Double.parseDouble(baseCameraManagement.getInstallLatitude());
@@ -189,6 +187,15 @@ public class BaseCameraManagementController extends BaseController {
             String[] split = msgAlarm.getImageUrl().split(";");
             ArrayList<String> objects = new ArrayList<>(Arrays.asList(split));
             msgAlarmResp.setImageUrls(objects);
+            BaseDeviceDynamicManagement deviceDynamicManagement = baseDeviceDynamicManagementService.getOne(new LambdaQueryWrapper<BaseDeviceDynamicManagement>()
+                    .eq(BaseDeviceDynamicManagement::getCameraCode, cameraCode));
+            msgAlarmResp.setIsDisable(deviceDynamicManagement.getIsDisable());
+            msgAlarmResp.setElectricity(deviceDynamicManagement.getElectricity());
+            List<MqLog> list = mqLogService.list(new LambdaQueryWrapper<MqLog>()
+                    .eq(MqLog::getCameraCode, cameraCode));
+            if (!ObjectUtils.isEmpty(list)) {
+                msgAlarmResp.setHeartTime(list.get(0).getCreateTime());
+            }
             return AjaxResult.success(msgAlarmResp);
         }
         return null;
@@ -588,6 +595,7 @@ public class BaseCameraManagementController extends BaseController {
             }
             BaseRailwayManagement baseRailwayManagement = baseRailwayManagementService.getOne(queryWrapper);
             baseCameraManagement.setRailwayName(baseRailwayManagement.getRailwayName());
+            baseCameraManagement.setRailwayType(baseRailwayManagement.getRailwayType());
             String mils = AppendUtils.stringAppend(baseCameraManagement.getInstallMile());
             baseCameraManagement.setInstallMiles(mils);
             if (!ObjectUtils.isEmpty(baseCameraManagement.getEndMile())) {
@@ -753,11 +761,24 @@ public class BaseCameraManagementController extends BaseController {
         children.sort(new Comparator<CameraTree>() {
             @Override
             public int compare(CameraTree o1, CameraTree o2) {
-                String name1 = PolyphoneHandler.getPolyphonePinyin(o1.getName());
-                String substring1 = name1.substring(0, 1);
-                String name2 = PolyphoneHandler.getPolyphonePinyin(o2.getName());
-                String substring2 = name2.substring(0, 1);
-                return substring1.compareTo(substring2);
+                if (ObjectUtils.isEmpty(o1.getNumber())&& ObjectUtils.isEmpty(o2.getNumber())) {
+                    int mileageDiff = o1.getNumber() - o2.getNumber();
+                    if (mileageDiff == 0) {
+                        String name1 = ChineseToPingyin.convertHanziToPinyin(o1.getRailwayName());
+                        String substring1 = name1.substring(0, 1);
+                        String name2 = ChineseToPingyin.convertHanziToPinyin(o2.getRailwayName());
+                        String substring2 = name2.substring(0, 1);
+                        return substring1.compareTo(substring2);
+                    } else {
+                        return mileageDiff;
+                    }
+                }else {
+                    String name1 = ChineseToPingyin.convertHanziToPinyin(o1.getRailwayName());
+                    String substring1 = name1.substring(0, 1);
+                    String name2 = ChineseToPingyin.convertHanziToPinyin(o2.getRailwayName());
+                    String substring2 = name2.substring(0, 1);
+                    return substring1.compareTo(substring2);
+                }
             }
         });
         for (CameraTree child : children) {