Browse Source

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

gao.qiang 8 months ago
parent
commit
6220764830

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

@@ -880,23 +880,26 @@ public class GeoHazardMonitorTokenController {
                         base.eq(BaseCameraManagement::getOnline, 2);
                         base.eq(BaseCameraManagement::getEnableOrNot, 1);
                         base.last("limit 2");
-                        BaseCameraManagement baseCameraManagement = baseCameraManagementService.getOne(base);
+
+                        List<BaseCameraManagement> list1 = baseCameraManagementService.list(base);
                         //根据相机ID找出分组并排序
-                        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();
+                        if (!ObjectUtils.isEmpty(list1)) {
+                            for (BaseCameraManagement baseCameraManagement : list1) {
+                                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();
+                                                }
                                             }
-                                        }
-                                    });
+                                        });
+                                    }
                                 }
                             }
                         }
@@ -1056,23 +1059,25 @@ public class GeoHazardMonitorTokenController {
                         if (respHeartbeatVo.getCameraList().get(0).getCurrentStream().equals("")) {
                             base.last("limit 2");
                         }
-                        BaseCameraManagement baseCameraManagement = baseCameraManagementService.getOne(base);
+                        List<BaseCameraManagement> list1 = baseCameraManagementService.list(base);
                         //根据相机ID找出分组并排序
-                        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();
+                        if (!ObjectUtils.isEmpty(list1)) {
+                            for (BaseCameraManagement baseCameraManagement : list1) {
+                                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();
+                                                }
                                             }
-                                        }
-                                    });
+                                        });
+                                    }
                                 }
                             }
                         }
@@ -1371,23 +1376,25 @@ public class GeoHazardMonitorTokenController {
                     if (respHeartbeatVo.getCameraList().get(0).getCurrentStream().equals("")) {
                         base.last("limit 2");
                     }
-                    BaseCameraManagement baseCameraManagement = baseCameraManagementService.getOne(base);
+                    List<BaseCameraManagement> list = baseCameraManagementService.list(base);
                     //根据相机ID找出分组并排序
-                    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();
+                    if (!ObjectUtils.isEmpty(list)) {
+                        for (BaseCameraManagement baseCameraManagement : list) {
+                            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();
+                                            }
                                         }
-                                    }
-                                });
+                                    });
+                                }
                             }
                         }
                     }