فهرست منبع

心跳接口修改判断相机里程和报警里程的距离

gao.qiang 1 سال پیش
والد
کامیت
53eba5dc92

+ 1 - 1
business-service/src/main/java/com/ozs/utils/CameraUtil.java

@@ -844,7 +844,7 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
         };
 
         try {
-            String result = executor.submit(task).get(1, TimeUnit.SECONDS); // 设置5秒超时时间
+            String result = executor.submit(task).get(5, TimeUnit.SECONDS); // 设置5秒超时时间
             System.out.println("Response: " + result);
         } catch (InterruptedException | ExecutionException | TimeoutException e) {
             // 请求超时处理逻辑

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

@@ -682,10 +682,28 @@ public class GeoHazardMonitorTokenController {
                         log.info("-------baseCameraManagementList123111--------" + baseCameraManagementList);
                         List<AlarmListVo> listVos = new ArrayList<>();
                         if (baseCameraManagementList.size() > 0) {
-                            String playFlv1 = null;
-                            playFlv1 = cameraUtil.heartbeatgetPlayFlv(baseCameraManagementList.get(0).getCameraCode(), baseCameraManagementList.get(0).getChannel(), type);
+                            int minDifference = Integer.MAX_VALUE;
+                            String code=null;
+                            String channel=null;
+                            for (BaseCameraManagement baseCameraManagement : baseCameraManagementList) {
+                                log.info("------------baseCameraManagement.getInstallMile()-------"+baseCameraManagement.getInstallMile());
+                                log.info("------------list.get(0).getAlarmMile()-------"+list.get(0).getAlarmMile());
+                                int difference = Math.abs(baseCameraManagement.getInstallMile() - list.get(0).getAlarmMile());
+                                log.info("------------difference-------"+difference);
+                                log.info("------------minDifference-------"+minDifference);
+                                if (difference < minDifference) {
+                                    minDifference = difference;
+                                    log.info("------------minDifference变更-------"+minDifference);
+                                    code = baseCameraManagement.getCameraCode();
+                                    log.info("------------code-------"+code);
+                                    channel = baseCameraManagement.getChannel();
+                                    log.info("------------channel-------"+channel);
+                                }
+                            }
+                            String playFlv1;
+                            playFlv1 = cameraUtil.heartbeatgetPlayFlv(code, channel, type);
                             if (StringUtils.isEmpty(playFlv1)) {
-                                playFlv1 = cameraUtil.heartbeatgetUrl(baseCameraManagementList.get(0).getCameraCode(), baseCameraManagementList.get(0).getChannel(), type);
+                                playFlv1 = cameraUtil.heartbeatgetUrl(code, channel, type);
                             }
                             log.info("-------playFlv--------" + playFlv1);
 //                            //判断心跳相机日志表后两条数据是否包含该相机编码
@@ -804,12 +822,12 @@ public class GeoHazardMonitorTokenController {
                             //获取所有报警安装里程位置的相机
                             List<BaseCameraManagement> baseList = baseCameraManagementService.list(ment);
                             if (baseList.size() > 0) {
-                                //判断流媒体是否有流
-                                String playFlv = null;
-                                playFlv = cameraUtil.heartbeatgetPlayFlv(baseList.get(0).getCameraCode(), baseList.get(0).getChannel(), type);
-                                if (StringUtils.isEmpty(playFlv)) {
-                                    playFlv = cameraUtil.heartbeatgetUrl(baseList.get(0).getCameraCode(), baseList.get(0).getChannel(), type);
-                                }
+//                                //判断流媒体是否有流
+//                                String playFlv = null;
+//                                playFlv = cameraUtil.heartbeatgetPlayFlv(baseList.get(0).getCameraCode(), baseList.get(0).getChannel(), type);
+//                                if (StringUtils.isEmpty(playFlv)) {
+//                                    playFlv = cameraUtil.heartbeatgetUrl(baseList.get(0).getCameraCode(), baseList.get(0).getChannel(), type);
+//                                }
 //                                    //判断心跳相机日志表后两条数据是否包含该相机编码
 //                                    if (!ObjectUtils.isEmpty(codeList)) {
 //                                        if (!codeList.contains(baseList.get(o).getCameraCode())) {
@@ -825,7 +843,7 @@ public class GeoHazardMonitorTokenController {
 //                                    log.info("-----add1----" + add1);
                                 AlarmListVo alarmListVo = new AlarmListVo();
                                 //alarmList对象
-                                alarmListVo.setCameraStream(playFlv);
+                                alarmListVo.setCameraStream(null);
                                 alarmListVo.setCameraCode(baseList.get(0).getCameraCode());
                                 //alarmInfo对象
                                 AlarmInfoVo alarmInfoVo1 = new AlarmInfoVo();
@@ -849,13 +867,13 @@ public class GeoHazardMonitorTokenController {
                                 }
                                 alarmListVo.setAlarmInfo(alarmInfoVo1);
                                 listVos.add(alarmListVo);
-                                ArrayList<String> list3 = new ArrayList<>();
-                                ////添加缓存
-                                //List<String> stringList = redisCache.getCacheObject("heartbeat");
-                                String code = baseList.get(0).getCameraCode() + "/" + baseList.get(0).getChannel()+ "/h264_720";
-                                list3.add(code);
-                                log.info("--------------heartbeat--------------:" + list3);
-                                redisCache.setCacheObject("heartbeat", list3);
+//                                ArrayList<String> list3 = new ArrayList<>();
+//                                ////添加缓存
+//                                //List<String> stringList = redisCache.getCacheObject("heartbeat");
+//                                String code = baseList.get(0).getCameraCode() + "/" + baseList.get(0).getChannel()+ "/h264_720";
+//                                list3.add(code);
+//                                log.info("--------------heartbeat--------------:" + list3);
+//                                redisCache.setCacheObject("heartbeat", list3);
                                 break;
                                 ////获取缓冲
                                 //List<String> heartbeat = redisCache.getCacheObject("heartbeat");
@@ -929,14 +947,14 @@ public class GeoHazardMonitorTokenController {
                         }
                         ArrayList<String> list3 = new ArrayList<>();
                         //添加缓存
-                        List<String> stringList = redisCache.getCacheObject("heartbeat");
+//                        List<String> stringList = redisCache.getCacheObject("heartbeat");
                         for (BaseCameraManagement baseCameraManagement : list1) {
                             String code = baseCameraManagement.getCameraCode() + "/" + baseCameraManagement.getChannel() + "/h264_720";
                             list3.add(code);
                         }
-                        if (!ObjectUtils.isEmpty(stringList)) {
-                            list3.addAll(stringList);
-                        }
+//                        if (!ObjectUtils.isEmpty(stringList)) {
+//                            list3.addAll(stringList);
+//                        }
                         log.info("--------------heartbeat--------------:" + list3);
                         redisCache.setCacheObject("heartbeat", list3);
                         //获取缓冲
@@ -1750,6 +1768,7 @@ public class GeoHazardMonitorTokenController {
                     List<BaseCameraManagement> baseCameraManagementList = baseCameraManagementService.list(camera);
                     if (baseCameraManagementList.size() > 0) {
                         BaseCameraManagement baseCameraManagement = baseCameraManagementList.get(0);
+                        log.info("---------获取报警回放-------------");
                         String url = cameraUtil.streamConversion(baseCameraManagement.getCameraCode());
                         one.setReleasedUrl(url);
                         msgAlarmService.updateById(one);