Explorar o código

模拟预警信息接口开发

gao.qiang hai 5 meses
pai
achega
e097e28cb1

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

@@ -374,34 +374,34 @@ public class GeoHazardMonitorTokenController {
                 log.info("->>>>>>>>>>>>>>>>>>>>>>>>>>>>" + result);
                 log.info("result:{}", result);
                 if (!ObjectUtils.isEmpty(baseCameraManagementList)) {
-                    int minDifference = Integer.MAX_VALUE;
-                    String code = null;
-                    for (BaseCameraManagement baseCameraManagement : baseCameraManagementList) {
-                        int difference = Math.abs(baseCameraManagement.getInstallMile() - reqMsgAlarmVo.getAlarmMile());
-                        if (difference < minDifference) {
-                            minDifference = difference;
-                            code = baseCameraManagement.getCameraCode();
-                        }
-                    }
-                    List<SysDictData> frontValue = dictTypeService.selectDictDataByType("alarm_play_time_front_value");
-                    List<SysDictData> laterValue = dictTypeService.selectDictDataByType("alarm_play_time_later_value");
-                    String finalCode = code;
-                    log.info("frontValue.get(0)-----11-------->" + frontValue.get(0).getDictValue());
-                    log.info("frontValue.get(0)-------22------>" + laterValue.get(0).getDictValue());
-                    CompletableFuture.runAsync(() -> {
-                        cameraUtil.playbackURLs(finalCode, frontValue.get(0).getDictValue(), laterValue.get(0).getDictValue());
-                        String codes = HttpUtils.sendGet(CameraUtil.startRecording(finalCode, "playback"));
-                        log.info("codes------>" + codes);
-                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-                        // 使用SimpleDateFormat将Date对象格式化为指定样式的字符串
-                        String formattedDate = sdf.format(msgAlarmVice.getAlarmTime());
-                        log.info("-----formattedDate-----------" + formattedDate);
-                        String records = cameraUtil.getQueryRecords(finalCode + "/playback", formattedDate, "mp4", laterValue.get(0).getDictValue(), frontValue.get(0).getDictValue());
-                        log.info("-----records-----------" + records);
-                        MsgAlarm alarm1 = msgAlarmService.getById(msgAlarm.getId());
-                        alarm1.setReleasedUrl(records);
-                        msgAlarmService.updateById(alarm1);
-                    });
+//                    int minDifference = Integer.MAX_VALUE;
+//                    String code = null;
+//                    for (BaseCameraManagement baseCameraManagement : baseCameraManagementList) {
+//                        int difference = Math.abs(baseCameraManagement.getInstallMile() - reqMsgAlarmVo.getAlarmMile());
+//                        if (difference < minDifference) {
+//                            minDifference = difference;
+//                            code = baseCameraManagement.getCameraCode();
+//                        }
+//                    }
+//                    List<SysDictData> frontValue = dictTypeService.selectDictDataByType("alarm_play_time_front_value");
+//                    List<SysDictData> laterValue = dictTypeService.selectDictDataByType("alarm_play_time_later_value");
+//                    String finalCode = code;
+//                    log.info("frontValue.get(0)-----11-------->" + frontValue.get(0).getDictValue());
+//                    log.info("frontValue.get(0)-------22------>" + laterValue.get(0).getDictValue());
+//                    CompletableFuture.runAsync(() -> {
+//                        cameraUtil.playbackURLs(finalCode, frontValue.get(0).getDictValue(), laterValue.get(0).getDictValue());
+//                        String codes = HttpUtils.sendGet(CameraUtil.startRecording(finalCode, "playback"));
+//                        log.info("codes------>" + codes);
+//                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+//                        // 使用SimpleDateFormat将Date对象格式化为指定样式的字符串
+//                        String formattedDate = sdf.format(msgAlarmVice.getAlarmTime());
+//                        log.info("-----formattedDate-----------" + formattedDate);
+//                        String records = cameraUtil.getQueryRecords(finalCode + "/playback", formattedDate, "mp4", laterValue.get(0).getDictValue(), frontValue.get(0).getDictValue());
+//                        log.info("-----records-----------" + records);
+//                        MsgAlarm alarm1 = msgAlarmService.getById(msgAlarm.getId());
+//                        alarm1.setReleasedUrl(records);
+//                        msgAlarmService.updateById(alarm1);
+//                    });
 //                    String url = future.get();
 //                    if (url.contains("无视频")) {
 //                        jsonObject.put("resultCode", 0);
@@ -2353,6 +2353,7 @@ public class GeoHazardMonitorTokenController {
                 }
             } else {
                 wrapper.orderByAsc(BaseCameraManagement::getGrou).orderByAsc(BaseCameraManagement::getSort);
+                wrapper.eq(BaseCameraManagement::getEnableOrNot, 1);
             }
             List<BaseCameraManagement> list = baseCameraManagementService.list(wrapper);
             if (ObjectUtils.isEmpty(list)) {