Browse Source

相机树开发

gao.qiang 3 months ago
parent
commit
1bbf86ea23

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

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.annotation.FieldStrategy;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ozs.common.annotation.Excel;
 import com.ozs.common.core.domain.BaseEntity;
 import com.ozs.common.core.domain.entity.SysMenu;
@@ -224,13 +225,14 @@ public class BaseCameraManagement extends BaseEntity implements Serializable ,Co
      * 最后心跳时间
      */
     @TableField(exist = false)
-    private LocalDateTime heartTime;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date heartTime;
 
     /**
      * 剩余电量
      */
     @TableField(exist = false)
-    private Integer electricity;
+    private String electricity;
 
     @Override
     public int compareTo(BaseCameraManagement o) {

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

@@ -55,17 +55,18 @@ public class BaseDeviceDynamicManagementServiceImpl extends ServiceImpl<BaseDevi
                 }
 
                 // 线路
-                CameraTree.CameraTreeBuilder builder  = CameraTree.builder()
+                CameraTree.CameraTreeBuilder builder = CameraTree.builder()
                         .code(o.getRailwayCode())
-                        .name(o.getLineNumber()+o.getRailwayName())
                         .railwayName(o.getRailwayName())
                         .flay(true)
                         .publicWorksSection(o.getPublicWorksSection())
                         .children(new ArrayList<>());
                 if (o.getLineNumber() != null && !o.getLineNumber().isEmpty()) {
                     builder.number(Integer.valueOf(o.getLineNumber()));
+                    builder.name(o.getLineNumber()+o.getRailwayName());
+                }else {
+                    builder.name(o.getRailwayName());
                 }
-
                 CameraTree build = builder.build();
                 if (!cameraTree.getChildren().stream()
                         .map(CameraTree::getCode)
@@ -74,17 +75,17 @@ public class BaseDeviceDynamicManagementServiceImpl extends ServiceImpl<BaseDevi
                     cameraTree.getChildren().add(build);
                     map.put(o.getRailwayCode(), build);
                 }
-               //工务段
+                //工务段
                 CameraTree build3 = CameraTree.builder()
                         .code(o.getRailwayCode())
-                        .name(o.getLineNumber()+o.getRailwayName())
+                        .name(o.getLineNumber() + o.getRailwayName())
                         .railwayName(o.getRailwayName())
                         .flay(true)
                         .publicWorksSection(o.getPublicWorksSection())
                         .children(new ArrayList<>())
                         .build();
                 if (!ObjectUtils.isEmpty(map.get(o.getRailwayCode()))) {
-                    CameraTree cameraTree3=map.get(o.getRailwayCode()+"-"+o.getPublicWorksSection());
+                    CameraTree cameraTree3 = map.get(o.getRailwayCode() + "-" + o.getPublicWorksSection());
                     if (ObjectUtils.isEmpty(cameraTree3)) {
                         map.put(o.getRailwayCode() + "-" + o.getPublicWorksSection(), build3);
                         map.get(o.getRailwayCode()).getChildren().add(build3);
@@ -101,11 +102,11 @@ public class BaseDeviceDynamicManagementServiceImpl extends ServiceImpl<BaseDevi
                         .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() + "-" + lineDirName);
+                if (!ObjectUtils.isEmpty(map.get(o.getRailwayCode() + "-" + o.getPublicWorksSection()))) {
+                    CameraTree cameraTree1 = map.get(o.getRailwayCode() + "-" + o.getPublicWorksSection() + "-" + o.getInstallMile() + "-" + lineDirName);
                     if (ObjectUtils.isEmpty(cameraTree1)) {
-                        map.put(o.getRailwayCode()+"-"+o.getPublicWorksSection()+"-"+o.getInstallMile() + "-" + lineDirName, build1);
-                        map.get(o.getRailwayCode()+"-"+o.getPublicWorksSection()).getChildren().add(build1);
+                        map.put(o.getRailwayCode() + "-" + o.getPublicWorksSection() + "-" + o.getInstallMile() + "-" + lineDirName, build1);
+                        map.get(o.getRailwayCode() + "-" + o.getPublicWorksSection()).getChildren().add(build1);
                     }
                 }
                 // 摄像头
@@ -116,8 +117,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() + "-" + lineDirName))) {
-                    map.get(o.getRailwayCode()+"-"+o.getPublicWorksSection()+"-"+o.getInstallMile() + "-" + lineDirName).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 - 2
hazard-admin/src/main/java/com/ozs/web/controller/accountmanagment/BaseCameraManagementController.java

@@ -139,7 +139,7 @@ public class BaseCameraManagementController extends BaseController {
             BaseDeviceDynamicManagement deviceDynamicManagement = baseDeviceDynamicManagementService.getOne(new LambdaQueryWrapper<BaseDeviceDynamicManagement>()
                     .eq(BaseDeviceDynamicManagement::getCameraCode, cameraCode));
             baseCameraManagement.setIsDisable(deviceDynamicManagement.getIsDisable());
-            baseCameraManagement.setElectricity(deviceDynamicManagement.getElectricity());
+            baseCameraManagement.setElectricity(deviceDynamicManagement.getElectricity()+"%");
             List<MqLog> list = mqLogService.list(new LambdaQueryWrapper<MqLog>()
                     .eq(MqLog::getCameraCode, cameraCode));
             if (!ObjectUtils.isEmpty(list)) {
@@ -190,7 +190,7 @@ public class BaseCameraManagementController extends BaseController {
             BaseDeviceDynamicManagement deviceDynamicManagement = baseDeviceDynamicManagementService.getOne(new LambdaQueryWrapper<BaseDeviceDynamicManagement>()
                     .eq(BaseDeviceDynamicManagement::getCameraCode, cameraCode));
             msgAlarmResp.setIsDisable(deviceDynamicManagement.getIsDisable());
-            msgAlarmResp.setElectricity(deviceDynamicManagement.getElectricity());
+            msgAlarmResp.setElectricity(deviceDynamicManagement.getElectricity()+"%");
             List<MqLog> list = mqLogService.list(new LambdaQueryWrapper<MqLog>()
                     .eq(MqLog::getCameraCode, cameraCode));
             if (!ObjectUtils.isEmpty(list)) {