gao.qiang 4 mēneši atpakaļ
vecāks
revīzija
443f8a5755

+ 31 - 20
vehicle-sdk/src/main/java/com/ozs/controller/upload/GeoHazardMonitorTokenController.java

@@ -728,9 +728,13 @@ public class GeoHazardMonitorTokenController {
                             if (list.get(0).getAlarmType() == 2) {
                                 cameraVos.setCameraCode("huangkangyingshiyunxiangjibianma");
                                 List<SysDictData> dictDataList = dictTypeService.selectDictDataByType("alarm_url");
-                                if (ObjectUtils.isEmpty(dictDataList)){
-                                    List<SysDictData> dataList = dictDataList.stream().filter(vp -> vp.getDictLabel().equals(list.get(0).getAlarmMile())).collect(Collectors.toList());
-                                    if (ObjectUtils.isEmpty(dataList)){
+                                log.info("dictDataList------------->" + dictDataList);
+                                if (!ObjectUtils.isEmpty(dictDataList)) {
+                                    log.info("list.get(0).getAlarmMile()------------->" + list.get(0).getAlarmMile());
+                                    List<SysDictData> dataList = dictDataList.stream().filter(vp -> vp.getDictLabel().equals(list.get(0).getAlarmMile().toString())).collect(Collectors.toList());
+                                    log.info("dataList------------->" + dataList);
+                                    if (!ObjectUtils.isEmpty(dataList)) {
+                                        log.info("dataList.get(0).getDictValue()------------->" + dataList.get(0).getDictValue());
                                         cameraVos.setCurrentStream(dataList.get(0).getDictValue());
                                     }
                                 }
@@ -856,9 +860,9 @@ public class GeoHazardMonitorTokenController {
 //                                            alarmListVo.setCameraStream("https://open.ys7.com/v3/openlive/K38316196_1_1.m3u8?expire=1751534158&id=730472262217506816&t=ced78480529e3591e83dda8045d54bada503eafdae547b43b789741cc3e67717&ev=100");
 //                                        }
                                         List<SysDictData> dictDataList = dictTypeService.selectDictDataByType("alarm_url");
-                                        if (ObjectUtils.isEmpty(dictDataList)){
-                                            List<SysDictData> dataList = dictDataList.stream().filter(vp -> vp.getDictLabel().equals(list.get(0).getAlarmMile())).collect(Collectors.toList());
-                                            if (ObjectUtils.isEmpty(dataList)){
+                                        if (!ObjectUtils.isEmpty(dictDataList)) {
+                                            List<SysDictData> dataList = dictDataList.stream().filter(vp -> vp.getDictLabel().equals(list.get(0).getAlarmMile().toString())).collect(Collectors.toList());
+                                            if (!ObjectUtils.isEmpty(dataList)) {
                                                 alarmListVo.setCameraStream(dataList.get(0).getDictValue());
                                             }
                                         }
@@ -1075,6 +1079,9 @@ public class GeoHazardMonitorTokenController {
                             log.info("preAlarm.getPreAlarmList()------" + preAlarmLists.get(0).getPreAlarmList());
                             List<PreAlarmListResponse> responseList = new ArrayList<>();
                             List<PreAlarmResponse.PreAlarmList> preAlarmList = JSON.parseArray(preAlarmLists.get(0).getPreAlarmList(), PreAlarmResponse.PreAlarmList.class);
+                            List<PreAlarmResponse.PreAlarmList> filteredList = preAlarmList.stream()
+                                    .filter(item -> item.getTargetType() != 4)
+                                    .collect(Collectors.toList());
                             Comparator<PreAlarmResponse.PreAlarmList> distanceComparator = new Comparator<PreAlarmResponse.PreAlarmList>() {
                                 @Override
                                 public int compare(PreAlarmResponse.PreAlarmList o1, PreAlarmResponse.PreAlarmList o2) {
@@ -1082,20 +1089,20 @@ public class GeoHazardMonitorTokenController {
                                 }
                             };
                             //排序
-                            preAlarmList.sort(distanceComparator);
-                            for (int i = 0; i < preAlarmList.size(); i++) {
+                            filteredList.sort(distanceComparator);
+                            for (int i = 0; i < filteredList.size(); i++) {
                                 PreAlarmListResponse preAlarmListResponse = new PreAlarmListResponse();
                                 int mile = 0;
                                 LambdaQueryWrapper<BaseCameraManagement> wrapper1 = new LambdaQueryWrapper<BaseCameraManagement>();
                                 if (heartbeatVo.getLineDir() == 1) {
-                                    mile = preAlarmList.get(i).getDistance() + heartbeatVo.getCurrentMile();
+                                    mile = filteredList.get(i).getDistance() + heartbeatVo.getCurrentMile();
                                     wrapper1.ge(BaseCameraManagement::getEndMile, mile);
                                     wrapper1.le(BaseCameraManagement::getBeginMile, mile);
                                     wrapper1.in(BaseCameraManagement::getMonitoringDirection, 1, 3);
                                     wrapper1.orderByAsc(BaseCameraManagement::getGrou).orderByAsc(BaseCameraManagement::getSort);
                                 }
                                 if (heartbeatVo.getLineDir() == 2) {
-                                    mile = heartbeatVo.getCurrentMile() - preAlarmList.get(i).getDistance();
+                                    mile = heartbeatVo.getCurrentMile() - filteredList.get(i).getDistance();
                                     wrapper1.ge(BaseCameraManagement::getEndMile, mile);
                                     wrapper1.le(BaseCameraManagement::getBeginMile, mile);
                                     wrapper1.in(BaseCameraManagement::getMonitoringDirection, 2, 3);
@@ -1201,10 +1208,11 @@ public class GeoHazardMonitorTokenController {
                                         preAlarmListResponse.setCameraStream("");
                                     }
                                 }
-                                BeanUtils.copyProperties(preAlarmList.get(i), preAlarmListResponse);
+                                BeanUtils.copyProperties(filteredList.get(i), preAlarmListResponse);
                                 preAlarmListResponse.setPreAlarmTime(preAlarmLists.get(0).getPreAlarmTime().getTime());
                                 responseList.add(preAlarmListResponse);
                             }
+
                             respHeartbeatVo.setPreAlarmList(responseList);
                             //获取机车前一路视频
                             int miles = heartbeatVo.getVisualDistance() + heartbeatVo.getCurrentMile();
@@ -1245,7 +1253,7 @@ public class GeoHazardMonitorTokenController {
                             }
                         } else {
                             //没有报警信息的时候
-                            BaseCameraManagementReq baseCameraManagementReq=new BaseCameraManagementReq();
+                            BaseCameraManagementReq baseCameraManagementReq = new BaseCameraManagementReq();
                             if (heartbeatVo.getLineDir() == 1) {
                                 distance = heartbeatVo.getVisualDistance() + heartbeatVo.getCurrentMile();
                                 baseCameraManagementReq.setInstallMile(heartbeatVo.getCurrentMile() + 10000);
@@ -1372,7 +1380,7 @@ public class GeoHazardMonitorTokenController {
                         }
                     } else {
                         //没有报警信息的时候
-                        BaseCameraManagementReq baseCameraManagementReq=new BaseCameraManagementReq();
+                        BaseCameraManagementReq baseCameraManagementReq = new BaseCameraManagementReq();
                         if (heartbeatVo.getLineDir() == 1) {
                             distance = heartbeatVo.getVisualDistance() + heartbeatVo.getCurrentMile();
                             baseCameraManagementReq.setInstallMile(heartbeatVo.getCurrentMile() + 10000);
@@ -1506,6 +1514,9 @@ public class GeoHazardMonitorTokenController {
                         log.info("preAlarm.getPreAlarmList()------" + preAlarmLists.get(0).getPreAlarmList());
                         List<PreAlarmListResponse> responseList = new ArrayList<>();
                         List<PreAlarmResponse.PreAlarmList> preAlarmList = JSON.parseArray(preAlarmLists.get(0).getPreAlarmList(), PreAlarmResponse.PreAlarmList.class);
+                        List<PreAlarmResponse.PreAlarmList> filteredList = preAlarmList.stream()
+                                .filter(item -> item.getTargetType() != 4)
+                                .collect(Collectors.toList());
                         Comparator<PreAlarmResponse.PreAlarmList> distanceComparator = new Comparator<PreAlarmResponse.PreAlarmList>() {
                             @Override
                             public int compare(PreAlarmResponse.PreAlarmList o1, PreAlarmResponse.PreAlarmList o2) {
@@ -1513,20 +1524,20 @@ public class GeoHazardMonitorTokenController {
                             }
                         };
                         //排序
-                        preAlarmList.sort(distanceComparator);
-                        for (int i = 0; i < preAlarmList.size(); i++) {
+                        filteredList.sort(distanceComparator);
+                        for (int i = 0; i < filteredList.size(); i++) {
                             PreAlarmListResponse preAlarmListResponse = new PreAlarmListResponse();
                             int mile = 0;
                             LambdaQueryWrapper<BaseCameraManagement> wrapper1 = new LambdaQueryWrapper<BaseCameraManagement>();
                             if (heartbeatVo.getLineDir() == 1) {
-                                mile = preAlarmList.get(i).getDistance() + heartbeatVo.getCurrentMile();
+                                mile = filteredList.get(i).getDistance() + heartbeatVo.getCurrentMile();
                                 wrapper1.ge(BaseCameraManagement::getEndMile, mile);
                                 wrapper1.le(BaseCameraManagement::getBeginMile, mile);
                                 wrapper1.in(BaseCameraManagement::getMonitoringDirection, 1, 3);
                                 wrapper1.orderByAsc(BaseCameraManagement::getGrou).orderByAsc(BaseCameraManagement::getSort);
                             }
                             if (heartbeatVo.getLineDir() == 2) {
-                                mile = heartbeatVo.getCurrentMile() - preAlarmList.get(i).getDistance();
+                                mile = heartbeatVo.getCurrentMile() - filteredList.get(i).getDistance();
                                 wrapper1.ge(BaseCameraManagement::getEndMile, mile);
                                 wrapper1.le(BaseCameraManagement::getBeginMile, mile);
                                 wrapper1.in(BaseCameraManagement::getMonitoringDirection, 2, 3);
@@ -1633,7 +1644,7 @@ public class GeoHazardMonitorTokenController {
                                     preAlarmListResponse.setCameraStream("");
                                 }
                             }
-                            BeanUtils.copyProperties(preAlarmList.get(i), preAlarmListResponse);
+                            BeanUtils.copyProperties(filteredList.get(i), preAlarmListResponse);
                             preAlarmListResponse.setPreAlarmTime(preAlarmLists.get(0).getPreAlarmTime().getTime());
                             responseList.add(preAlarmListResponse);
                         }
@@ -1677,7 +1688,7 @@ public class GeoHazardMonitorTokenController {
                         }
                     } else {
                         //没有报警信息的时候
-                        BaseCameraManagementReq baseCameraManagementReq=new BaseCameraManagementReq();
+                        BaseCameraManagementReq baseCameraManagementReq = new BaseCameraManagementReq();
                         if (heartbeatVo.getLineDir() == 1) {
                             distance = heartbeatVo.getVisualDistance() + heartbeatVo.getCurrentMile();
                             baseCameraManagementReq.setInstallMile(heartbeatVo.getCurrentMile() + 10000);
@@ -1804,7 +1815,7 @@ public class GeoHazardMonitorTokenController {
                     }
                 } else {
                     //没有报警信息的时候
-                    BaseCameraManagementReq baseCameraManagementReq=new BaseCameraManagementReq();
+                    BaseCameraManagementReq baseCameraManagementReq = new BaseCameraManagementReq();
                     if (heartbeatVo.getLineDir() == 1) {
                         distance = heartbeatVo.getVisualDistance() + heartbeatVo.getCurrentMile();
                         baseCameraManagementReq.setInstallMile(heartbeatVo.getCurrentMile() + 10000);