|
@@ -903,6 +903,142 @@ public class GeoHazardMonitorTokenController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+// if(!"[]".equals(preAlarm.getPreAlarmList())) {
|
|
|
+// log.info("preAlarm.getPreAlarmList()------" + preAlarm.getPreAlarmList());
|
|
|
+// List<PreAlarmListResponse> responseList = new ArrayList<>();
|
|
|
+// List<PreAlarmResponse.PreAlarmList> preAlarmList = JSON.parseArray(preAlarm.getPreAlarmList(), PreAlarmResponse.PreAlarmList.class);
|
|
|
+// Comparator<PreAlarmResponse.PreAlarmList> distanceComparator = new Comparator<PreAlarmResponse.PreAlarmList>() {
|
|
|
+// @Override
|
|
|
+// public int compare(PreAlarmResponse.PreAlarmList o1, PreAlarmResponse.PreAlarmList o2) {
|
|
|
+// return Integer.compare(o1.getDistance(), o2.getDistance());
|
|
|
+// }
|
|
|
+// };
|
|
|
+// //排序
|
|
|
+// preAlarmList.sort(distanceComparator);
|
|
|
+// for (int i = 0; i < preAlarmList.size(); i++) {
|
|
|
+// PreAlarmListResponse preAlarmListResponse = new PreAlarmListResponse();
|
|
|
+// int mile1 = 0;
|
|
|
+// LambdaQueryWrapper<BaseCameraManagement> wrapper1 = new LambdaQueryWrapper<BaseCameraManagement>();
|
|
|
+// if (heartbeatVo.getLineDir() == 1) {
|
|
|
+// mile1 = preAlarmList.get(i).getDistance() + heartbeatVo.getCurrentMile();
|
|
|
+// wrapper1.ge(BaseCameraManagement::getEndMile, mile1);
|
|
|
+// wrapper1.le(BaseCameraManagement::getBeginMile, mile1);
|
|
|
+// wrapper1.in(BaseCameraManagement::getMonitoringDirection, 1, 3);
|
|
|
+// wrapper1.orderByAsc(BaseCameraManagement::getGrou).orderByAsc(BaseCameraManagement::getSort);
|
|
|
+// }
|
|
|
+// if (heartbeatVo.getLineDir() == 2) {
|
|
|
+// mile1 = heartbeatVo.getCurrentMile() - preAlarmList.get(i).getDistance();
|
|
|
+// wrapper1.ge(BaseCameraManagement::getEndMile, mile1);
|
|
|
+// wrapper1.le(BaseCameraManagement::getBeginMile, mile1);
|
|
|
+// wrapper1.in(BaseCameraManagement::getMonitoringDirection, 2, 3);
|
|
|
+// wrapper1.orderByDesc(BaseCameraManagement::getGrou).orderByDesc(BaseCameraManagement::getSort);
|
|
|
+// }
|
|
|
+// List<BaseCameraManagement> baseCameraManagementList2 = baseCameraManagementService.list(wrapper1);
|
|
|
+// log.info("-------baseCameraManagementList22223111--------" + baseCameraManagementList2);
|
|
|
+// if (!ObjectUtils.isEmpty(baseCameraManagementList2)) {
|
|
|
+// int minDifference = Integer.MAX_VALUE;
|
|
|
+// String code = null;
|
|
|
+// String graphicsCard = null;
|
|
|
+// for (BaseCameraManagement baseCameraManagement : baseCameraManagementList2) {
|
|
|
+// log.info("------------baseCameraManagement.getInstallMile()-------" + baseCameraManagement.getInstallMile());
|
|
|
+// log.info("------------list.get(0).getAlarmMile()-------" + mile1);
|
|
|
+// int difference = Math.abs(baseCameraManagement.getInstallMile() - mile1);
|
|
|
+// log.info("------------difference-------" + difference);
|
|
|
+// log.info("------------minDifference-------" + minDifference);
|
|
|
+// if (difference < minDifference) {
|
|
|
+// minDifference = difference;
|
|
|
+// log.info("------------minDifference变更-------" + minDifference);
|
|
|
+// code = baseCameraManagement.getCameraCode();
|
|
|
+// log.info("------------code-------" + code);
|
|
|
+// graphicsCard = baseCameraManagement.getGraphicsCard();
|
|
|
+// log.info("------------graphicsCard-------" + graphicsCard);
|
|
|
+// }
|
|
|
+// //添加预警信息
|
|
|
+// preAlarmListResponse.setCameraCode(baseCameraManagement.getCameraCode());
|
|
|
+// preAlarmListResponse.setCameraStream(CameraUtil.getPlayFlvRtsp(baseCameraManagement.getCameraCode(), baseCameraManagement.getGraphicsCard(), type, httpUrl));
|
|
|
+// }
|
|
|
+// if (i == 0) {
|
|
|
+// String finalCode = code;
|
|
|
+// String finalGraphicsCard = graphicsCard;
|
|
|
+// boolean finalType3 = type;
|
|
|
+// CompletableFuture.runAsync(() -> {
|
|
|
+// String playFlv = cameraUtil.heartbeatgetPlayFlv(finalCode, finalGraphicsCard, finalType3);
|
|
|
+// if (StringUtils.isEmpty(playFlv)) {
|
|
|
+// try {
|
|
|
+// cameraUtil.heartbeatgetUrl(finalCode, finalGraphicsCard, finalType3, httpUrl);
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// }
|
|
|
+// });
|
|
|
+// CameraVos cameraVos = new CameraVos();
|
|
|
+// cameraVos.setCameraCode(code);
|
|
|
+// cameraVos.setCurrentStream(CameraUtil.getPlayFlvRtsp(code, graphicsCard, type, httpUrl));
|
|
|
+// List<CameraVos> cameraVosList = new ArrayList<>();
|
|
|
+// cameraVosList.add(cameraVos);
|
|
|
+// respHeartbeatVo.setCameraList(cameraVosList);
|
|
|
+// respHeartbeatVo.setIsAlarm(1);
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// if (i == 0) {
|
|
|
+// LambdaQueryWrapper<BaseCameraManagement> base1 = new LambdaQueryWrapper<>();
|
|
|
+// if (heartbeatVo.getLineDir() == 1) {
|
|
|
+// distance = heartbeatVo.getVisualDistance() + heartbeatVo.getCurrentMile();
|
|
|
+// base1.ge(BaseCameraManagement::getInstallMile, distance);
|
|
|
+// base1.in(BaseCameraManagement::getMonitoringDirection, 1, 3);
|
|
|
+// base1.orderByAsc(BaseCameraManagement::getGrou).orderByAsc(BaseCameraManagement::getSort);
|
|
|
+// base1.le(BaseCameraManagement::getInstallMile, (heartbeatVo.getCurrentMile() + 10000));
|
|
|
+// }
|
|
|
+// if (heartbeatVo.getLineDir() == 2) {
|
|
|
+// distance = heartbeatVo.getCurrentMile() - heartbeatVo.getVisualDistance();
|
|
|
+// base1.le(BaseCameraManagement::getInstallMile, distance);
|
|
|
+// base1.ge(BaseCameraManagement::getInstallMile, (heartbeatVo.getCurrentMile() - 10000));
|
|
|
+// base1.in(BaseCameraManagement::getMonitoringDirection, 2, 3);
|
|
|
+// base1.orderByDesc(BaseCameraManagement::getGrou).orderByDesc(BaseCameraManagement::getSort);
|
|
|
+// }
|
|
|
+// base1.eq(BaseCameraManagement::getRailwayCode, heartbeatVo.getRailwayCode());
|
|
|
+// base1.eq(BaseCameraManagement::getOnline, 2);
|
|
|
+// base1.eq(BaseCameraManagement::getEnableOrNot, 1);
|
|
|
+// base1.last("limit 1");
|
|
|
+// List<BaseCameraManagement> list3 = baseCameraManagementService.list(base1);
|
|
|
+// CameraVos cameraVos = new CameraVos();
|
|
|
+// if (!ObjectUtils.isEmpty(list3)) {
|
|
|
+// cameraVos.setCameraCode(list3.get(0).getCameraCode());
|
|
|
+// cameraVos.setCurrentStream(cameraUtil.getPlayFlvRtsp(list3.get(0).getCameraCode(), list3.get(0).getGraphicsCard(), type, httpUrl));
|
|
|
+// boolean finalType6 = type;
|
|
|
+// CompletableFuture.runAsync(() -> {
|
|
|
+// String playFlv = cameraUtil.heartbeatgetPlayFlv(list3.get(0).getCameraCode(), list3.get(0).getGraphicsCard(), finalType6);
|
|
|
+// if (StringUtils.isEmpty(playFlv)) {
|
|
|
+// try {
|
|
|
+// cameraUtil.heartbeatgetUrl(list3.get(0).getCameraCode(), list3.get(0).getGraphicsCard(), finalType6, httpUrl);
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// }
|
|
|
+// });
|
|
|
+// } else {
|
|
|
+// cameraVos.setCameraCode("");
|
|
|
+// cameraVos.setCurrentStream("");
|
|
|
+// cameraVos.setCameraCode("该里程位置,没有可用的预警相机");
|
|
|
+// cameraVos.setCurrentStream("");
|
|
|
+// }
|
|
|
+// List<CameraVos> cameraVosList = new ArrayList<>();
|
|
|
+// cameraVosList.add(cameraVos);
|
|
|
+// respHeartbeatVo.setCameraList(cameraVosList);
|
|
|
+// respHeartbeatVo.setIsAlarm(1);
|
|
|
+// preAlarmListResponse.setCameraCode("");
|
|
|
+// preAlarmListResponse.setCameraStream("");
|
|
|
+// } else {
|
|
|
+// preAlarmListResponse.setCameraCode("");
|
|
|
+// preAlarmListResponse.setCameraStream("");
|
|
|
+// }
|
|
|
+// }
|
|
|
+// BeanUtils.copyProperties(preAlarmList.get(i), preAlarmListResponse);
|
|
|
+// preAlarmListResponse.setPreAlarmTime(preAlarm.getPreAlarmTime().getTime());
|
|
|
+// responseList.add(preAlarmListResponse);
|
|
|
+// }
|
|
|
+// respHeartbeatVo.setPreAlarmList(responseList);
|
|
|
+// }
|
|
|
} else if (!"[]".equals(preAlarm.getPreAlarmList())) {
|
|
|
log.info("preAlarm.getPreAlarmList()------" + preAlarm.getPreAlarmList());
|
|
|
List<PreAlarmListResponse> responseList = new ArrayList<>();
|