Переглянути джерело

开发调取天网相机接口

gao.qiang 8 місяців тому
батько
коміт
4ceca1af3c

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

@@ -715,46 +715,47 @@ public class GeoHazardMonitorTokenController {
                             respHeartbeatVo.setCameraList(cameraVosList);
                             respHeartbeatVo.setIsAlarm(1);
                         } else {
-                            LambdaQueryWrapper<BaseCameraManagement> base = new LambdaQueryWrapper<>();
-                            if (heartbeatVo.getLineDir() == 1) {
-                                distance = heartbeatVo.getVisualDistance() + heartbeatVo.getCurrentMile();
-                                base.ge(BaseCameraManagement::getInstallMile, distance);
-                                base.in(BaseCameraManagement::getMonitoringDirection, 1, 3);
-                                base.orderByAsc(BaseCameraManagement::getGrou).orderByAsc(BaseCameraManagement::getSort);
-                                base.le(BaseCameraManagement::getInstallMile, (heartbeatVo.getCurrentMile() + 10000));
-                            }
-                            if (heartbeatVo.getLineDir() == 2) {
-                                distance = heartbeatVo.getCurrentMile() - heartbeatVo.getVisualDistance();
-                                base.le(BaseCameraManagement::getInstallMile, distance);
-                                base.ge(BaseCameraManagement::getInstallMile, (heartbeatVo.getCurrentMile() - 10000));
-                                base.in(BaseCameraManagement::getMonitoringDirection, 2, 3);
-                                base.orderByDesc(BaseCameraManagement::getGrou).orderByDesc(BaseCameraManagement::getSort);
-                            }
-                            base.eq(BaseCameraManagement::getRailwayCode, heartbeatVo.getRailwayCode());
-                            base.eq(BaseCameraManagement::getOnline, 2);
-                            base.eq(BaseCameraManagement::getEnableOrNot, 1);
-                            base.last("limit 1");
-                            List<BaseCameraManagement> list1 = baseCameraManagementService.list(base);
                             CameraVos cameraVos = new CameraVos();
-                            if (!ObjectUtils.isEmpty(list1)) {
-                                cameraVos.setCameraCode(list1.get(0).getCameraCode());
-                                cameraVos.setCurrentStream(cameraUtil.getPlayFlvRtsp(list1.get(0).getCameraCode(), list1.get(0).getGraphicsCard(), type, httpUrl));
-                                boolean finalType6 = type;
-                                CompletableFuture.runAsync(() -> {
-                                    String playFlv = cameraUtil.heartbeatgetPlayFlv(list1.get(0).getCameraCode(), list1.get(0).getGraphicsCard(), finalType6);
-                                    if (StringUtils.isEmpty(playFlv)) {
-                                        try {
-                                            cameraUtil.heartbeatgetUrl(list1.get(0).getCameraCode(), list1.get(0).getGraphicsCard(), finalType6, httpUrl);
-                                        } catch (Exception e) {
-                                            e.printStackTrace();
+                            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 {
+                                LambdaQueryWrapper<BaseCameraManagement> base = new LambdaQueryWrapper<>();
+                                if (heartbeatVo.getLineDir() == 1) {
+                                    distance = heartbeatVo.getVisualDistance() + heartbeatVo.getCurrentMile();
+                                    base.ge(BaseCameraManagement::getInstallMile, distance);
+                                    base.in(BaseCameraManagement::getMonitoringDirection, 1, 3);
+                                    base.orderByAsc(BaseCameraManagement::getGrou).orderByAsc(BaseCameraManagement::getSort);
+                                    base.le(BaseCameraManagement::getInstallMile, (heartbeatVo.getCurrentMile() + 10000));
+                                }
+                                if (heartbeatVo.getLineDir() == 2) {
+                                    distance = heartbeatVo.getCurrentMile() - heartbeatVo.getVisualDistance();
+                                    base.le(BaseCameraManagement::getInstallMile, distance);
+                                    base.ge(BaseCameraManagement::getInstallMile, (heartbeatVo.getCurrentMile() - 10000));
+                                    base.in(BaseCameraManagement::getMonitoringDirection, 2, 3);
+                                    base.orderByDesc(BaseCameraManagement::getGrou).orderByDesc(BaseCameraManagement::getSort);
+                                }
+                                base.eq(BaseCameraManagement::getRailwayCode, heartbeatVo.getRailwayCode());
+                                base.eq(BaseCameraManagement::getOnline, 2);
+                                base.eq(BaseCameraManagement::getEnableOrNot, 1);
+                                base.last("limit 1");
+                                List<BaseCameraManagement> list1 = baseCameraManagementService.list(base);
+                                if (!ObjectUtils.isEmpty(list1)) {
+                                    cameraVos.setCameraCode(list1.get(0).getCameraCode());
+                                    cameraVos.setCurrentStream(cameraUtil.getPlayFlvRtsp(list1.get(0).getCameraCode(), list1.get(0).getGraphicsCard(), type, httpUrl));
+                                    boolean finalType6 = type;
+                                    CompletableFuture.runAsync(() -> {
+                                        String playFlv = cameraUtil.heartbeatgetPlayFlv(list1.get(0).getCameraCode(), list1.get(0).getGraphicsCard(), finalType6);
+                                        if (StringUtils.isEmpty(playFlv)) {
+                                            try {
+                                                cameraUtil.heartbeatgetUrl(list1.get(0).getCameraCode(), list1.get(0).getGraphicsCard(), finalType6, httpUrl);
+                                            } catch (Exception e) {
+                                                e.printStackTrace();
+                                            }
                                         }
-                                    }
-                                });
-                            } else {
-                                cameraVos.setCameraCode("");
-                                if (list.get(0).getAlarmType()==2){
-                                    cameraVos.setCurrentStream("https://rtmp01open.ys7.com:9188/v3/openlive/K38316196_1_1.flv?expire=1745409016&id=704781554165264384&t=477265ab4d36debe072836e0b16755ba50303c3b8eb165a628bc9c0a0328afb5&ev=100");
+                                    });
                                 }else {
+                                    cameraVos.setCameraCode("");
                                     cameraVos.setCurrentStream("");
                                 }
                             }
@@ -833,7 +834,7 @@ public class GeoHazardMonitorTokenController {
                                     }else {
                                         alarmListVo.setCameraStream("");
                                     }
-                                    alarmListVo.setCameraCode("");
+                                    alarmListVo.setCameraCode("huangkangyingshiyunxiangjibianma");
                                 }
                             }
                             //alarmInfo对象