Browse Source

获取所有的相机列表修改

gao.qiang 10 months ago
parent
commit
14f5b33904

+ 20 - 24
business-service/src/main/java/com/ozs/service/impl/BaseCameraManagementServiceImpl.java

@@ -159,30 +159,26 @@ public class BaseCameraManagementServiceImpl extends ServiceImpl<BaseCameraManag
 //                                accountManagement.setInstallMile(accountManagement.getInstallMileBD() * 1000);
 //                                accountManagement.setEndMile(accountManagement.getEndMile() * 1000);
 //                                accountManagement.setBeginMile(accountManagement.getBeginMile() * 1000);
-                                if (accountManagement.getBeginMile() <= accountManagement.getEndMile()) {
-                                    if (!StringUtils.isEmpty(cameraManagementVos.getMonitoringDirectionName())) {
-                                        List<SysDictData> data = dictTypeService.selectDictDataByType("monitoring_direction");
-                                        for (SysDictData datum : data) {
-                                            if (datum.getDictLabel().equals(cameraManagementVos.getMonitoringDirectionName())) {
-                                                accountManagement.setMonitoringDirection(Integer.valueOf(datum.getDictValue()));
-                                            }
-                                        }
-                                    }
-                                    if (!StringUtils.isEmpty(cameraManagementVos.getEnableOrNotName())) {
-                                        accountManagement.setEnableOrNot(cameraManagementVos.getEnableOrNotName().equals("启用") ? 1 : 2);
+
+                            if (!StringUtils.isEmpty(cameraManagementVos.getMonitoringDirectionName())) {
+                                List<SysDictData> data = dictTypeService.selectDictDataByType("monitoring_direction");
+                                for (SysDictData datum : data) {
+                                    if (datum.getDictLabel().equals(cameraManagementVos.getMonitoringDirectionName())) {
+                                        accountManagement.setMonitoringDirection(Integer.valueOf(datum.getDictValue()));
                                     }
-                                    baseCameraManagementMapper.insert(accountManagement);
-                                    BaseDeviceDynamicManagement baseDeviceDynamicManagement = new BaseDeviceDynamicManagement();
-                                    baseDeviceDynamicManagement.setCameraCode(accountManagement.getCameraCode());
-                                    baseDeviceDynamicManagement.setUpdateBy(userId);
-                                    baseDeviceDynamicManagement.setCreateBy(userId);
-                                    baseDeviceDynamicManagementMapper.insert(baseDeviceDynamicManagement);
-                                    successNum++;
-                                    successMsg.append(successNum + "、相机编码 " + accountManagement.getCameraCode() + " 导入成功");
-                                } else {
-                                    failureNum++;
-                                    failureMsg.append(failureNum + "、相机编码为: " + accountManagement.getCameraCode() + "的数据,监控范围开始里程位置不能大于监控范围结束里程位置");
                                 }
+                            }
+                            if (!StringUtils.isEmpty(cameraManagementVos.getEnableOrNotName())) {
+                                accountManagement.setEnableOrNot(cameraManagementVos.getEnableOrNotName().equals("启用") ? 1 : 2);
+                            }
+                            baseCameraManagementMapper.insert(accountManagement);
+                            BaseDeviceDynamicManagement baseDeviceDynamicManagement = new BaseDeviceDynamicManagement();
+                            baseDeviceDynamicManagement.setCameraCode(accountManagement.getCameraCode());
+                            baseDeviceDynamicManagement.setUpdateBy(userId);
+                            baseDeviceDynamicManagement.setCreateBy(userId);
+                            baseDeviceDynamicManagementMapper.insert(baseDeviceDynamicManagement);
+                            successNum++;
+                            successMsg.append(successNum + "、相机编码 " + accountManagement.getCameraCode() + " 导入成功");
                         }
                     } else {
                         failureNum++;
@@ -434,7 +430,7 @@ public class BaseCameraManagementServiceImpl extends ServiceImpl<BaseCameraManag
                 camera.eq(BaseCameraManagement::getRailwayCode, msgAlarm.getRailwayCode());
                 camera.eq(BaseCameraManagement::getOnline, 2);
                 camera.eq(BaseCameraManagement::getEnableOrNot, 1);
-                if (StringUtils.isNotEmpty(cameraCode)){
+                if (StringUtils.isNotEmpty(cameraCode)) {
                     wrapper.eq("camera_code", cameraCode);
                 }
                 List<BaseCameraManagement> baseCameraManagementList = this.list(camera);
@@ -485,7 +481,7 @@ public class BaseCameraManagementServiceImpl extends ServiceImpl<BaseCameraManag
             List<BaseCameraManagement> list = new ArrayList<>(baseCameraManagementList);
             for (BaseCameraManagement baseCameraManagement : list) {
                 String flv = CameraUtil.getPlayFlv(baseCameraManagement.getCameraCode(), baseCameraManagement.getChannel());
-                BaseVehicleTerminalDto dto=new BaseVehicleTerminalDto();
+                BaseVehicleTerminalDto dto = new BaseVehicleTerminalDto();
                 dto.setUrl(flv);
                 dto.setCameraCode(baseCameraManagement.getCameraCode());
                 dto.setTime(new Date());

+ 15 - 15
vehicle-sdk/src/main/java/com/ozs/controller/upload/GeoHazardMonitorTokenController.java

@@ -1338,21 +1338,21 @@ public class GeoHazardMonitorTokenController {
                 }
                 baseCameraManagement.setRailwayName(baseRailwayManagement.getRailwayName());
             }
-            list.sort(new Comparator<BaseCameraManagement>() {
-                @Override
-                public int compare(BaseCameraManagement o1, BaseCameraManagement o2) {
-                    String name1 = ChineseToPingyin.convertHanziToPinyin(o1.getRailwayName());
-                    String substring1 = name1.substring(0, 1);
-                    String name2 = ChineseToPingyin.convertHanziToPinyin(o2.getRailwayName());
-                    String substring2 = name2.substring(0, 1);
-                    int i = substring1.compareTo(substring2);
-                    if (i == 0) {
-                        return -o1.getInstallMile() - o2.getInstallMile();
-                    } else {
-                        return i;
-                    }
-                }
-            });
+//            list.sort(new Comparator<BaseCameraManagement>() {
+//                @Override
+//                public int compare(BaseCameraManagement o1, BaseCameraManagement o2) {
+//                    String name1 = ChineseToPingyin.convertHanziToPinyin(o1.getRailwayName());
+//                    String substring1 = name1.substring(0, 1);
+//                    String name2 = ChineseToPingyin.convertHanziToPinyin(o2.getRailwayName());
+//                    String substring2 = name2.substring(0, 1);
+//                    int i = substring1.compareTo(substring2);
+//                    if (i == 0) {
+//                        return -o1.getInstallMile() - o2.getInstallMile();
+//                    } else {
+//                        return i;
+//                    }
+//                }
+//            });
             List<RespCameraVo> cameraVos = new ArrayList<>();
             for (BaseCameraManagement baseCameraManagement : list) {
                 RespCameraVo respCameraVo = new RespCameraVo();