ソースを参照

相机树开发

gao.qiang 2 ヶ月 前
コミット
7aff9dc002

+ 39 - 40
hazard-admin/src/main/java/com/ozs/web/controller/accountmanagment/BaseCameraManagementController.java

@@ -116,45 +116,7 @@ public class BaseCameraManagementController extends BaseController {
         Long id = baseCameraManagementHomeVo.getId();
         String cameraCode = baseCameraManagementHomeVo.getCameraCode();
         // isLock  报警是否解除 1已解除2未解除
-        if (!StringUtils.isEmpty(isLock) && isLock == 1 && !StringUtils.isEmpty(id)) {
-            BaseCameraManagement baseCameraManagement = baseCameraManagementService.getById(id);
-            LambdaQueryWrapper<BaseRailwayManagement> queryWrapper = new LambdaQueryWrapper<BaseRailwayManagement>();
-            if (!ObjectUtils.isEmpty(baseCameraManagement.getRailwayCode())) {
-                queryWrapper.eq(BaseRailwayManagement::getRailwayCode, baseCameraManagement.getRailwayCode());
-            }
-            BaseRailwayManagement baseRailwayManagement = baseRailwayManagementService.getOne(queryWrapper);
-            SysDept sysDept = deptService.selectDeptById(baseCameraManagement.getDeptId());
-            baseCameraManagement.setDeptName(sysDept.getDeptName());
-            baseCameraManagement.setRailwayName(baseRailwayManagement.getRailwayName());
-            String mils = AppendUtils.stringAppend(baseCameraManagement.getInstallMile());
-            baseCameraManagement.setInstallMiles(mils);
-            if (!ObjectUtils.isEmpty(baseCameraManagement.getEndMile())) {
-                String end = AppendUtils.stringAppend(baseCameraManagement.getEndMile());
-                baseCameraManagement.setEndMiles(end);
-            }
-            if (!ObjectUtils.isEmpty(baseCameraManagement.getBeginMile())) {
-                String begin = AppendUtils.stringAppend(baseCameraManagement.getBeginMile());
-                baseCameraManagement.setBeginMiles(begin);
-            }
-            BaseDeviceDynamicManagement deviceDynamicManagement = baseDeviceDynamicManagementService.getOne(new LambdaQueryWrapper<BaseDeviceDynamicManagement>()
-                    .eq(BaseDeviceDynamicManagement::getCameraCode, cameraCode));
-            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());
-            double installLongitude = Double.parseDouble(baseCameraManagement.getInstallLongitude());
-            // 创建 DecimalFormat 对象,指定格式
-            DecimalFormat decimalFormat = new DecimalFormat("#.00");
-            // 格式化数字
-            baseCameraManagement.setInstallLatitude(decimalFormat.format(installLatitude));
-            baseCameraManagement.setInstallLongitude(decimalFormat.format(installLongitude));
-            return AjaxResult.success(baseCameraManagement);
-        } else if (!StringUtils.isEmpty(isLock) && isLock == 2 && !StringUtils.isEmpty(cameraCode)) {
+        if (!StringUtils.isEmpty(isLock) && isLock == 2 && !StringUtils.isEmpty(cameraCode)) {
             MsgAlarm msgAlarm = msgAlarmService.selectByCameraCode(cameraCode);
             LambdaQueryWrapper<BaseCameraManagement> lw = new LambdaQueryWrapper<BaseCameraManagement>();
             if (!ObjectUtils.isEmpty(msgAlarm.getCameraCode())) {
@@ -197,8 +159,45 @@ public class BaseCameraManagementController extends BaseController {
                 msgAlarmResp.setHeartTime(list.get(0).getCreateTime());
             }
             return AjaxResult.success(msgAlarmResp);
+        } else {
+            BaseCameraManagement baseCameraManagement = baseCameraManagementService.getById(id);
+            LambdaQueryWrapper<BaseRailwayManagement> queryWrapper = new LambdaQueryWrapper<BaseRailwayManagement>();
+            if (!ObjectUtils.isEmpty(baseCameraManagement.getRailwayCode())) {
+                queryWrapper.eq(BaseRailwayManagement::getRailwayCode, baseCameraManagement.getRailwayCode());
+            }
+            BaseRailwayManagement baseRailwayManagement = baseRailwayManagementService.getOne(queryWrapper);
+            SysDept sysDept = deptService.selectDeptById(baseCameraManagement.getDeptId());
+            baseCameraManagement.setDeptName(sysDept.getDeptName());
+            baseCameraManagement.setRailwayName(baseRailwayManagement.getRailwayName());
+            String mils = AppendUtils.stringAppend(baseCameraManagement.getInstallMile());
+            baseCameraManagement.setInstallMiles(mils);
+            if (!ObjectUtils.isEmpty(baseCameraManagement.getEndMile())) {
+                String end = AppendUtils.stringAppend(baseCameraManagement.getEndMile());
+                baseCameraManagement.setEndMiles(end);
+            }
+            if (!ObjectUtils.isEmpty(baseCameraManagement.getBeginMile())) {
+                String begin = AppendUtils.stringAppend(baseCameraManagement.getBeginMile());
+                baseCameraManagement.setBeginMiles(begin);
+            }
+            BaseDeviceDynamicManagement deviceDynamicManagement = baseDeviceDynamicManagementService.getOne(new LambdaQueryWrapper<BaseDeviceDynamicManagement>()
+                    .eq(BaseDeviceDynamicManagement::getCameraCode, cameraCode));
+            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());
+            double installLongitude = Double.parseDouble(baseCameraManagement.getInstallLongitude());
+            // 创建 DecimalFormat 对象,指定格式
+            DecimalFormat decimalFormat = new DecimalFormat("#.00");
+            // 格式化数字
+            baseCameraManagement.setInstallLatitude(decimalFormat.format(installLatitude));
+            baseCameraManagement.setInstallLongitude(decimalFormat.format(installLongitude));
+            return AjaxResult.success(baseCameraManagement);
         }
-        return null;
     }
 
     /**