Jelajahi Sumber

心跳预警增加预拉相机逻辑

gao.qiang 8 bulan lalu
induk
melakukan
0d9129bc41

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

@@ -716,10 +716,10 @@ public class GeoHazardMonitorTokenController {
                             respHeartbeatVo.setIsAlarm(1);
                         } else {
                             CameraVos cameraVos = new CameraVos();
-                            if (list.get(0).getAlarmType()==2){
+                            if (list.get(0).getAlarmType() == 2) {
                                 cameraVos.setCameraCode("huangkangyingshiyunxiangjibianma");
                                 cameraVos.setCurrentStream("https://rtmp01open.ys7.com:9188/v3/openlive/K38316196_1_1.flv?expire=1745409016&id=704781554165264384&t=477265ab4d36debe072836e0b16755ba50303c3b8eb165a628bc9c0a0328afb5&ev=100");
-                            }else {
+                            } else {
                                 LambdaQueryWrapper<BaseCameraManagement> base = new LambdaQueryWrapper<>();
                                 if (heartbeatVo.getLineDir() == 1) {
                                     distance = heartbeatVo.getVisualDistance() + heartbeatVo.getCurrentMile();
@@ -754,7 +754,7 @@ public class GeoHazardMonitorTokenController {
                                             }
                                         }
                                     });
-                                }else {
+                                } else {
                                     cameraVos.setCameraCode("");
                                     cameraVos.setCurrentStream("");
                                 }
@@ -829,9 +829,9 @@ public class GeoHazardMonitorTokenController {
                                 }
                             } else {
                                 if (i == 0) {
-                                    if (list.get(0).getAlarmType()==2){
+                                    if (list.get(0).getAlarmType() == 2) {
                                         alarmListVo.setCameraStream("https://rtmp01open.ys7.com:9188/v3/openlive/K38316196_1_1.flv?expire=1745409016&id=704781554165264384&t=477265ab4d36debe072836e0b16755ba50303c3b8eb165a628bc9c0a0328afb5&ev=100");
-                                    }else {
+                                    } else {
                                         alarmListVo.setCameraStream("");
                                     }
                                     alarmListVo.setCameraCode("huangkangyingshiyunxiangjibianma");
@@ -879,27 +879,29 @@ public class GeoHazardMonitorTokenController {
                         base.eq(BaseCameraManagement::getRailwayCode, heartbeatVo.getRailwayCode());
                         base.eq(BaseCameraManagement::getOnline, 2);
                         base.eq(BaseCameraManagement::getEnableOrNot, 1);
-                        if (array[0].getCameraStream().equals("")){
+                        if (array[0].getCameraStream().equals("")) {
                             base.last("limit 1");
-                        }else {
+                        } else {
                             base.last("limit 1,1");
                         }
                         BaseCameraManagement baseCameraManagement = baseCameraManagementService.getOne(base);
                         //根据相机ID找出分组并排序
-                        List<BaseCameraManagement> baseCameraManagementList1 = cameraUtil.getBaseCameraManagementList(baseCameraManagement.getId(), heartbeatVo.getLineDir());
-                        if (!ObjectUtils.isEmpty(baseCameraManagementList1)) {
-                            for (BaseCameraManagement cameraManagement : baseCameraManagementList1) {
-                                boolean finalType2 = type;
-                                CompletableFuture.runAsync(() -> {
-                                    String playFlv = cameraUtil.heartbeatgetPlayFlv(cameraManagement.getCameraCode(), cameraManagement.getGraphicsCard(), finalType2);
-                                    if (StringUtils.isEmpty(playFlv)) {
-                                        try {
-                                            cameraUtil.heartbeatgetUrl(cameraManagement.getCameraCode(), cameraManagement.getGraphicsCard(), finalType2, httpUrl);
-                                        } catch (Exception e) {
-                                            e.printStackTrace();
+                        if (!ObjectUtils.isEmpty(baseCameraManagement)) {
+                            List<BaseCameraManagement> baseCameraManagementList1 = cameraUtil.getBaseCameraManagementList(baseCameraManagement.getId(), heartbeatVo.getLineDir());
+                            if (!ObjectUtils.isEmpty(baseCameraManagementList1)) {
+                                for (BaseCameraManagement cameraManagement : baseCameraManagementList1) {
+                                    boolean finalType2 = type;
+                                    CompletableFuture.runAsync(() -> {
+                                        String playFlv = cameraUtil.heartbeatgetPlayFlv(cameraManagement.getCameraCode(), cameraManagement.getGraphicsCard(), finalType2);
+                                        if (StringUtils.isEmpty(playFlv)) {
+                                            try {
+                                                cameraUtil.heartbeatgetUrl(cameraManagement.getCameraCode(), cameraManagement.getGraphicsCard(), finalType2, httpUrl);
+                                            } catch (Exception e) {
+                                                e.printStackTrace();
+                                            }
                                         }
-                                    }
-                                });
+                                    });
+                                }
                             }
                         }
                     } else if (!"[]".equals(preAlarm.getPreAlarmList())) {
@@ -1051,27 +1053,29 @@ public class GeoHazardMonitorTokenController {
                                 base.eq(BaseCameraManagement::getRailwayCode, heartbeatVo.getRailwayCode());
                                 base.eq(BaseCameraManagement::getOnline, 2);
                                 base.eq(BaseCameraManagement::getEnableOrNot, 1);
-                                if (respHeartbeatVo.getCameraList().get(0).getCurrentStream().equals("")){
+                                if (respHeartbeatVo.getCameraList().get(0).getCurrentStream().equals("")) {
                                     base.last("limit 1");
-                                }else {
+                                } else {
                                     base.last("limit 1,1");
                                 }
                                 BaseCameraManagement baseCameraManagement = baseCameraManagementService.getOne(base);
                                 //根据相机ID找出分组并排序
-                                List<BaseCameraManagement> baseCameraManagementList1 = cameraUtil.getBaseCameraManagementList(baseCameraManagement.getId(), heartbeatVo.getLineDir());
-                                if (!ObjectUtils.isEmpty(baseCameraManagementList1)) {
-                                    for (BaseCameraManagement cameraManagement : baseCameraManagementList1) {
-                                        boolean finalType2 = type;
-                                        CompletableFuture.runAsync(() -> {
-                                            String playFlv = cameraUtil.heartbeatgetPlayFlv(cameraManagement.getCameraCode(), cameraManagement.getGraphicsCard(), finalType2);
-                                            if (StringUtils.isEmpty(playFlv)) {
-                                                try {
-                                                    cameraUtil.heartbeatgetUrl(cameraManagement.getCameraCode(), cameraManagement.getGraphicsCard(), finalType2, httpUrl);
-                                                } catch (Exception e) {
-                                                    e.printStackTrace();
+                                if (!ObjectUtils.isEmpty(baseCameraManagement)) {
+                                    List<BaseCameraManagement> baseCameraManagementList1 = cameraUtil.getBaseCameraManagementList(baseCameraManagement.getId(), heartbeatVo.getLineDir());
+                                    if (!ObjectUtils.isEmpty(baseCameraManagementList1)) {
+                                        for (BaseCameraManagement cameraManagement : baseCameraManagementList1) {
+                                            boolean finalType2 = type;
+                                            CompletableFuture.runAsync(() -> {
+                                                String playFlv = cameraUtil.heartbeatgetPlayFlv(cameraManagement.getCameraCode(), cameraManagement.getGraphicsCard(), finalType2);
+                                                if (StringUtils.isEmpty(playFlv)) {
+                                                    try {
+                                                        cameraUtil.heartbeatgetUrl(cameraManagement.getCameraCode(), cameraManagement.getGraphicsCard(), finalType2, httpUrl);
+                                                    } catch (Exception e) {
+                                                        e.printStackTrace();
+                                                    }
                                                 }
-                                            }
-                                        });
+                                            });
+                                        }
                                     }
                                 }
                             }
@@ -1366,27 +1370,29 @@ public class GeoHazardMonitorTokenController {
                             base.eq(BaseCameraManagement::getRailwayCode, heartbeatVo.getRailwayCode());
                             base.eq(BaseCameraManagement::getOnline, 2);
                             base.eq(BaseCameraManagement::getEnableOrNot, 1);
-                            if (respHeartbeatVo.getCameraList().get(0).getCurrentStream().equals("")){
+                            if (respHeartbeatVo.getCameraList().get(0).getCurrentStream().equals("")) {
                                 base.last("limit 1");
-                            }else {
+                            } else {
                                 base.last("limit 1,1");
                             }
                             BaseCameraManagement baseCameraManagement = baseCameraManagementService.getOne(base);
                             //根据相机ID找出分组并排序
-                            List<BaseCameraManagement> baseCameraManagementList1 = cameraUtil.getBaseCameraManagementList(baseCameraManagement.getId(), heartbeatVo.getLineDir());
-                            if (!ObjectUtils.isEmpty(baseCameraManagementList1)) {
-                                for (BaseCameraManagement cameraManagement : baseCameraManagementList1) {
-                                    boolean finalType2 = type;
-                                    CompletableFuture.runAsync(() -> {
-                                        String playFlv = cameraUtil.heartbeatgetPlayFlv(cameraManagement.getCameraCode(), cameraManagement.getGraphicsCard(), finalType2);
-                                        if (StringUtils.isEmpty(playFlv)) {
-                                            try {
-                                                cameraUtil.heartbeatgetUrl(cameraManagement.getCameraCode(), cameraManagement.getGraphicsCard(), finalType2, httpUrl);
-                                            } catch (Exception e) {
-                                                e.printStackTrace();
+                            if (!ObjectUtils.isEmpty(baseCameraManagement)) {
+                                List<BaseCameraManagement> baseCameraManagementList1 = cameraUtil.getBaseCameraManagementList(baseCameraManagement.getId(), heartbeatVo.getLineDir());
+                                if (!ObjectUtils.isEmpty(baseCameraManagementList1)) {
+                                    for (BaseCameraManagement cameraManagement : baseCameraManagementList1) {
+                                        boolean finalType2 = type;
+                                        CompletableFuture.runAsync(() -> {
+                                            String playFlv = cameraUtil.heartbeatgetPlayFlv(cameraManagement.getCameraCode(), cameraManagement.getGraphicsCard(), finalType2);
+                                            if (StringUtils.isEmpty(playFlv)) {
+                                                try {
+                                                    cameraUtil.heartbeatgetUrl(cameraManagement.getCameraCode(), cameraManagement.getGraphicsCard(), finalType2, httpUrl);
+                                                } catch (Exception e) {
+                                                    e.printStackTrace();
+                                                }
                                             }
-                                        }
-                                    });
+                                        });
+                                    }
                                 }
                             }
                         }