|
@@ -1040,174 +1040,176 @@ public class GeoHazardMonitorTokenController {
|
|
|
// }
|
|
|
// respHeartbeatVo.setPreAlarmList(responseList);
|
|
|
// }
|
|
|
- } else 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 mile = 0;
|
|
|
- LambdaQueryWrapper<BaseCameraManagement> wrapper1 = new LambdaQueryWrapper<BaseCameraManagement>();
|
|
|
- if (heartbeatVo.getLineDir() == 1) {
|
|
|
- mile = preAlarmList.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();
|
|
|
- wrapper1.ge(BaseCameraManagement::getEndMile, mile);
|
|
|
- wrapper1.le(BaseCameraManagement::getBeginMile, mile);
|
|
|
- wrapper1.in(BaseCameraManagement::getMonitoringDirection, 2, 3);
|
|
|
- wrapper1.orderByDesc(BaseCameraManagement::getGrou).orderByDesc(BaseCameraManagement::getSort);
|
|
|
- }
|
|
|
- List<BaseCameraManagement> baseCameraManagementList = baseCameraManagementService.list(wrapper1);
|
|
|
- log.info("-------baseCameraManagementList123111--------" + baseCameraManagementList);
|
|
|
- if (!ObjectUtils.isEmpty(baseCameraManagementList)) {
|
|
|
- int minDifference = Integer.MAX_VALUE;
|
|
|
- String code = null;
|
|
|
- String graphicsCard = null;
|
|
|
- for (BaseCameraManagement baseCameraManagement : baseCameraManagementList) {
|
|
|
- log.info("------------baseCameraManagement.getInstallMile()-------" + baseCameraManagement.getInstallMile());
|
|
|
- log.info("------------list.get(0).getAlarmMile()-------" + mile);
|
|
|
- int difference = Math.abs(baseCameraManagement.getInstallMile() - mile);
|
|
|
- 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));
|
|
|
+ } else if (!ObjectUtils.isEmpty(preAlarm.getPreAlarmList())) {
|
|
|
+ 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());
|
|
|
}
|
|
|
- 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);
|
|
|
+ };
|
|
|
+ //排序
|
|
|
+ preAlarmList.sort(distanceComparator);
|
|
|
+ for (int i = 0; i < preAlarmList.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();
|
|
|
+ wrapper1.ge(BaseCameraManagement::getEndMile, mile);
|
|
|
+ wrapper1.le(BaseCameraManagement::getBeginMile, mile);
|
|
|
+ wrapper1.in(BaseCameraManagement::getMonitoringDirection, 1, 3);
|
|
|
+ wrapper1.orderByAsc(BaseCameraManagement::getGrou).orderByAsc(BaseCameraManagement::getSort);
|
|
|
}
|
|
|
- } else {
|
|
|
- if (i == 0) {
|
|
|
- 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);
|
|
|
+ if (heartbeatVo.getLineDir() == 2) {
|
|
|
+ mile = heartbeatVo.getCurrentMile() - preAlarmList.get(i).getDistance();
|
|
|
+ wrapper1.ge(BaseCameraManagement::getEndMile, mile);
|
|
|
+ wrapper1.le(BaseCameraManagement::getBeginMile, mile);
|
|
|
+ wrapper1.in(BaseCameraManagement::getMonitoringDirection, 2, 3);
|
|
|
+ wrapper1.orderByDesc(BaseCameraManagement::getGrou).orderByDesc(BaseCameraManagement::getSort);
|
|
|
+ }
|
|
|
+ List<BaseCameraManagement> baseCameraManagementList = baseCameraManagementService.list(wrapper1);
|
|
|
+ log.info("-------baseCameraManagementList123111--------" + baseCameraManagementList);
|
|
|
+ if (!ObjectUtils.isEmpty(baseCameraManagementList)) {
|
|
|
+ int minDifference = Integer.MAX_VALUE;
|
|
|
+ String code = null;
|
|
|
+ String graphicsCard = null;
|
|
|
+ for (BaseCameraManagement baseCameraManagement : baseCameraManagementList) {
|
|
|
+ log.info("------------baseCameraManagement.getInstallMile()-------" + baseCameraManagement.getInstallMile());
|
|
|
+ log.info("------------list.get(0).getAlarmMile()-------" + mile);
|
|
|
+ int difference = Math.abs(baseCameraManagement.getInstallMile() - mile);
|
|
|
+ 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));
|
|
|
}
|
|
|
- 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;
|
|
|
+ if (i == 0) {
|
|
|
+ String finalCode = code;
|
|
|
+ String finalGraphicsCard = graphicsCard;
|
|
|
+ boolean finalType3 = type;
|
|
|
CompletableFuture.runAsync(() -> {
|
|
|
- String playFlv = cameraUtil.heartbeatgetPlayFlv(list1.get(0).getCameraCode(), list1.get(0).getGraphicsCard(), finalType6);
|
|
|
+ String playFlv = cameraUtil.heartbeatgetPlayFlv(finalCode, finalGraphicsCard, finalType3);
|
|
|
if (StringUtils.isEmpty(playFlv)) {
|
|
|
try {
|
|
|
- cameraUtil.heartbeatgetUrl(list1.get(0).getCameraCode(), list1.get(0).getGraphicsCard(), finalType6, httpUrl);
|
|
|
+ cameraUtil.heartbeatgetUrl(finalCode, finalGraphicsCard, finalType3, httpUrl);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- } else {
|
|
|
- cameraVos.setCameraCode("");
|
|
|
- cameraVos.setCurrentStream("");
|
|
|
- cameraVos.setCameraCode("该里程位置,没有可用的预警相机");
|
|
|
- cameraVos.setCurrentStream("");
|
|
|
+ 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);
|
|
|
}
|
|
|
- List<CameraVos> cameraVosList = new ArrayList<>();
|
|
|
- cameraVosList.add(cameraVos);
|
|
|
- respHeartbeatVo.setCameraList(cameraVosList);
|
|
|
- respHeartbeatVo.setIsAlarm(1);
|
|
|
- preAlarmListResponse.setCameraCode("");
|
|
|
- preAlarmListResponse.setCameraStream("");
|
|
|
} else {
|
|
|
- preAlarmListResponse.setCameraCode("");
|
|
|
- preAlarmListResponse.setCameraStream("");
|
|
|
+ if (i == 0) {
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } 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);
|
|
|
}
|
|
|
- BeanUtils.copyProperties(preAlarmList.get(i), preAlarmListResponse);
|
|
|
- preAlarmListResponse.setPreAlarmTime(preAlarm.getPreAlarmTime().getTime());
|
|
|
- responseList.add(preAlarmListResponse);
|
|
|
- }
|
|
|
- respHeartbeatVo.setPreAlarmList(responseList);
|
|
|
- //获取机车前一路视频
|
|
|
- int miles = heartbeatVo.getVisualDistance() + heartbeatVo.getCurrentMile();
|
|
|
- LambdaQueryWrapper<BaseCameraManagement> base = new LambdaQueryWrapper<>();
|
|
|
- if (heartbeatVo.getLineDir() == 1) {
|
|
|
- base.orderByAsc(BaseCameraManagement::getGrou).orderByAsc(BaseCameraManagement::getSort);
|
|
|
- base.gt(BaseCameraManagement::getInstallMile, miles);
|
|
|
- }
|
|
|
- if (heartbeatVo.getLineDir() == 2) {
|
|
|
- base.orderByDesc(BaseCameraManagement::getGrou).orderByDesc(BaseCameraManagement::getSort);
|
|
|
- base.lt(BaseCameraManagement::getInstallMile, miles);
|
|
|
- }
|
|
|
- base.eq(BaseCameraManagement::getRailwayCode, heartbeatVo.getRailwayCode());
|
|
|
- base.eq(BaseCameraManagement::getOnline, 2);
|
|
|
- base.eq(BaseCameraManagement::getEnableOrNot, 1);
|
|
|
- base.last("limit 2");
|
|
|
- List<BaseCameraManagement> list1 = baseCameraManagementService.list(base);
|
|
|
- //根据相机ID找出分组并排序
|
|
|
- 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();
|
|
|
+ respHeartbeatVo.setPreAlarmList(responseList);
|
|
|
+ //获取机车前一路视频
|
|
|
+ int miles = heartbeatVo.getVisualDistance() + heartbeatVo.getCurrentMile();
|
|
|
+ LambdaQueryWrapper<BaseCameraManagement> base = new LambdaQueryWrapper<>();
|
|
|
+ if (heartbeatVo.getLineDir() == 1) {
|
|
|
+ base.orderByAsc(BaseCameraManagement::getGrou).orderByAsc(BaseCameraManagement::getSort);
|
|
|
+ base.gt(BaseCameraManagement::getInstallMile, miles);
|
|
|
+ }
|
|
|
+ if (heartbeatVo.getLineDir() == 2) {
|
|
|
+ base.orderByDesc(BaseCameraManagement::getGrou).orderByDesc(BaseCameraManagement::getSort);
|
|
|
+ base.lt(BaseCameraManagement::getInstallMile, miles);
|
|
|
+ }
|
|
|
+ base.eq(BaseCameraManagement::getRailwayCode, heartbeatVo.getRailwayCode());
|
|
|
+ base.eq(BaseCameraManagement::getOnline, 2);
|
|
|
+ base.eq(BaseCameraManagement::getEnableOrNot, 1);
|
|
|
+ base.last("limit 2");
|
|
|
+ List<BaseCameraManagement> list1 = baseCameraManagementService.list(base);
|
|
|
+ //根据相机ID找出分组并排序
|
|
|
+ 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();
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1350,175 +1352,177 @@ public class GeoHazardMonitorTokenController {
|
|
|
}
|
|
|
respHeartbeatVo.setIsAlarm(2);
|
|
|
}
|
|
|
- } else 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 mile = 0;
|
|
|
- LambdaQueryWrapper<BaseCameraManagement> wrapper1 = new LambdaQueryWrapper<BaseCameraManagement>();
|
|
|
- if (heartbeatVo.getLineDir() == 1) {
|
|
|
- mile = preAlarmList.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();
|
|
|
- wrapper1.ge(BaseCameraManagement::getEndMile, mile);
|
|
|
- wrapper1.le(BaseCameraManagement::getBeginMile, mile);
|
|
|
- wrapper1.in(BaseCameraManagement::getMonitoringDirection, 2, 3);
|
|
|
- wrapper1.orderByDesc(BaseCameraManagement::getGrou).orderByDesc(BaseCameraManagement::getSort);
|
|
|
- }
|
|
|
- List<BaseCameraManagement> baseCameraManagementList = baseCameraManagementService.list(wrapper1);
|
|
|
- log.info("-------baseCameraManagementList123111--------" + baseCameraManagementList);
|
|
|
- if (!ObjectUtils.isEmpty(baseCameraManagementList)) {
|
|
|
- int minDifference = Integer.MAX_VALUE;
|
|
|
- String code = null;
|
|
|
- String graphicsCard = null;
|
|
|
- for (BaseCameraManagement baseCameraManagement : baseCameraManagementList) {
|
|
|
- log.info("------------baseCameraManagement.getInstallMile()-------" + baseCameraManagement.getInstallMile());
|
|
|
- log.info("------------list.get(0).getAlarmMile()-------" + mile);
|
|
|
- int difference = Math.abs(baseCameraManagement.getInstallMile() - mile);
|
|
|
- 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));
|
|
|
+ } else if (!ObjectUtils.isEmpty(preAlarm.getPreAlarmList())) {
|
|
|
+ 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());
|
|
|
}
|
|
|
- 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();
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- log.info("-------playFlv--------" + playFlv1);
|
|
|
- CameraVos cameraVos = new CameraVos();
|
|
|
- cameraVos.setCameraCode(code);
|
|
|
- cameraVos.setCurrentStream(cameraUtil.getPlayFlvRtsp(code, finalGraphicsCard, type, httpUrl));
|
|
|
- List<CameraVos> cameraVosList = new ArrayList<>();
|
|
|
- cameraVosList.add(cameraVos);
|
|
|
- respHeartbeatVo.setCameraList(cameraVosList);
|
|
|
- respHeartbeatVo.setIsAlarm(1);
|
|
|
+ };
|
|
|
+ //排序
|
|
|
+ preAlarmList.sort(distanceComparator);
|
|
|
+ for (int i = 0; i < preAlarmList.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();
|
|
|
+ wrapper1.ge(BaseCameraManagement::getEndMile, mile);
|
|
|
+ wrapper1.le(BaseCameraManagement::getBeginMile, mile);
|
|
|
+ wrapper1.in(BaseCameraManagement::getMonitoringDirection, 1, 3);
|
|
|
+ wrapper1.orderByAsc(BaseCameraManagement::getGrou).orderByAsc(BaseCameraManagement::getSort);
|
|
|
}
|
|
|
- } else {
|
|
|
- if (i == 0) {
|
|
|
- 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);
|
|
|
+ if (heartbeatVo.getLineDir() == 2) {
|
|
|
+ mile = heartbeatVo.getCurrentMile() - preAlarmList.get(i).getDistance();
|
|
|
+ wrapper1.ge(BaseCameraManagement::getEndMile, mile);
|
|
|
+ wrapper1.le(BaseCameraManagement::getBeginMile, mile);
|
|
|
+ wrapper1.in(BaseCameraManagement::getMonitoringDirection, 2, 3);
|
|
|
+ wrapper1.orderByDesc(BaseCameraManagement::getGrou).orderByDesc(BaseCameraManagement::getSort);
|
|
|
+ }
|
|
|
+ List<BaseCameraManagement> baseCameraManagementList = baseCameraManagementService.list(wrapper1);
|
|
|
+ log.info("-------baseCameraManagementList123111--------" + baseCameraManagementList);
|
|
|
+ if (!ObjectUtils.isEmpty(baseCameraManagementList)) {
|
|
|
+ int minDifference = Integer.MAX_VALUE;
|
|
|
+ String code = null;
|
|
|
+ String graphicsCard = null;
|
|
|
+ for (BaseCameraManagement baseCameraManagement : baseCameraManagementList) {
|
|
|
+ log.info("------------baseCameraManagement.getInstallMile()-------" + baseCameraManagement.getInstallMile());
|
|
|
+ log.info("------------list.get(0).getAlarmMile()-------" + mile);
|
|
|
+ int difference = Math.abs(baseCameraManagement.getInstallMile() - mile);
|
|
|
+ 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));
|
|
|
}
|
|
|
- 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;
|
|
|
+ if (i == 0) {
|
|
|
+ String finalCode = code;
|
|
|
+ String finalGraphicsCard = graphicsCard;
|
|
|
+ boolean finalType3 = type;
|
|
|
CompletableFuture.runAsync(() -> {
|
|
|
- String playFlv = cameraUtil.heartbeatgetPlayFlv(list1.get(0).getCameraCode(), list1.get(0).getGraphicsCard(), finalType6);
|
|
|
+ String playFlv = cameraUtil.heartbeatgetPlayFlv(finalCode, finalGraphicsCard, finalType3);
|
|
|
if (StringUtils.isEmpty(playFlv)) {
|
|
|
try {
|
|
|
- cameraUtil.heartbeatgetUrl(list1.get(0).getCameraCode(), list1.get(0).getGraphicsCard(), finalType6, httpUrl);
|
|
|
+ cameraUtil.heartbeatgetUrl(finalCode, finalGraphicsCard, finalType3, httpUrl);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- } else {
|
|
|
- cameraVos.setCameraCode("");
|
|
|
- cameraVos.setCurrentStream("");
|
|
|
- cameraVos.setCameraCode("该里程位置,没有可用的预警相机");
|
|
|
- cameraVos.setCurrentStream("");
|
|
|
+ log.info("-------playFlv--------" + playFlv1);
|
|
|
+ CameraVos cameraVos = new CameraVos();
|
|
|
+ cameraVos.setCameraCode(code);
|
|
|
+ cameraVos.setCurrentStream(cameraUtil.getPlayFlvRtsp(code, finalGraphicsCard, type, httpUrl));
|
|
|
+ List<CameraVos> cameraVosList = new ArrayList<>();
|
|
|
+ cameraVosList.add(cameraVos);
|
|
|
+ respHeartbeatVo.setCameraList(cameraVosList);
|
|
|
+ respHeartbeatVo.setIsAlarm(1);
|
|
|
}
|
|
|
- List<CameraVos> cameraVosList = new ArrayList<>();
|
|
|
- cameraVosList.add(cameraVos);
|
|
|
- respHeartbeatVo.setCameraList(cameraVosList);
|
|
|
- respHeartbeatVo.setIsAlarm(1);
|
|
|
- preAlarmListResponse.setCameraCode("");
|
|
|
- preAlarmListResponse.setCameraStream("");
|
|
|
} else {
|
|
|
- preAlarmListResponse.setCameraCode("");
|
|
|
- preAlarmListResponse.setCameraStream("");
|
|
|
+ if (i == 0) {
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } 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);
|
|
|
}
|
|
|
- BeanUtils.copyProperties(preAlarmList.get(i), preAlarmListResponse);
|
|
|
- preAlarmListResponse.setPreAlarmTime(preAlarm.getPreAlarmTime().getTime());
|
|
|
- responseList.add(preAlarmListResponse);
|
|
|
- }
|
|
|
- respHeartbeatVo.setPreAlarmList(responseList);
|
|
|
- //获取机车前一路视频
|
|
|
- int miles = heartbeatVo.getVisualDistance() + heartbeatVo.getCurrentMile();
|
|
|
- LambdaQueryWrapper<BaseCameraManagement> base = new LambdaQueryWrapper<>();
|
|
|
- if (heartbeatVo.getLineDir() == 1) {
|
|
|
- base.orderByAsc(BaseCameraManagement::getGrou).orderByAsc(BaseCameraManagement::getSort);
|
|
|
- base.gt(BaseCameraManagement::getInstallMile, miles);
|
|
|
- }
|
|
|
- if (heartbeatVo.getLineDir() == 2) {
|
|
|
- base.orderByDesc(BaseCameraManagement::getGrou).orderByDesc(BaseCameraManagement::getSort);
|
|
|
- base.lt(BaseCameraManagement::getInstallMile, miles);
|
|
|
- }
|
|
|
- base.eq(BaseCameraManagement::getRailwayCode, heartbeatVo.getRailwayCode());
|
|
|
- base.eq(BaseCameraManagement::getOnline, 2);
|
|
|
- base.eq(BaseCameraManagement::getEnableOrNot, 1);
|
|
|
- base.last("limit 2");
|
|
|
- List<BaseCameraManagement> list = baseCameraManagementService.list(base);
|
|
|
- //根据相机ID找出分组并排序
|
|
|
- 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();
|
|
|
+ respHeartbeatVo.setPreAlarmList(responseList);
|
|
|
+ //获取机车前一路视频
|
|
|
+ int miles = heartbeatVo.getVisualDistance() + heartbeatVo.getCurrentMile();
|
|
|
+ LambdaQueryWrapper<BaseCameraManagement> base = new LambdaQueryWrapper<>();
|
|
|
+ if (heartbeatVo.getLineDir() == 1) {
|
|
|
+ base.orderByAsc(BaseCameraManagement::getGrou).orderByAsc(BaseCameraManagement::getSort);
|
|
|
+ base.gt(BaseCameraManagement::getInstallMile, miles);
|
|
|
+ }
|
|
|
+ if (heartbeatVo.getLineDir() == 2) {
|
|
|
+ base.orderByDesc(BaseCameraManagement::getGrou).orderByDesc(BaseCameraManagement::getSort);
|
|
|
+ base.lt(BaseCameraManagement::getInstallMile, miles);
|
|
|
+ }
|
|
|
+ base.eq(BaseCameraManagement::getRailwayCode, heartbeatVo.getRailwayCode());
|
|
|
+ base.eq(BaseCameraManagement::getOnline, 2);
|
|
|
+ base.eq(BaseCameraManagement::getEnableOrNot, 1);
|
|
|
+ base.last("limit 2");
|
|
|
+ List<BaseCameraManagement> list = baseCameraManagementService.list(base);
|
|
|
+ //根据相机ID找出分组并排序
|
|
|
+ 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();
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2231,14 +2235,14 @@ public class GeoHazardMonitorTokenController {
|
|
|
terminal.eq(BaseTerminal::getTerminalCode, baseTerminalLog.getTerminalCode());
|
|
|
boolean update = baseTerminalService.update(baseTerminal1, terminal);
|
|
|
if (baseTerminalLogService.save(baseTerminalLog) && update) {
|
|
|
- if (!ObjectUtils.isEmpty(baseTerminalLog.getTrainNum())&&!ObjectUtils.isEmpty(baseTerminalLog.getFrontTrainNum())){
|
|
|
+ if (!ObjectUtils.isEmpty(baseTerminalLog.getTrainNum()) && !ObjectUtils.isEmpty(baseTerminalLog.getFrontTrainNum())) {
|
|
|
VehiclePosition vehiclePosition = vehiclePositionService.getOne(new LambdaQueryWrapper<VehiclePosition>().eq(VehiclePosition::getVehicleCode, baseTerminalLog.getTrainNum()).orderByDesc(VehiclePosition::getCreateTime).last("limit 1"));
|
|
|
VehiclePosition positionServiceOne = vehiclePositionService.getOne(new LambdaQueryWrapper<VehiclePosition>().eq(VehiclePosition::getVehicleCode, baseTerminalLog.getFrontTrainNum()).orderByDesc(VehiclePosition::getCreateTime).last("limit 1"));
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
- int dif= vehiclePosition.getTravelMile()-positionServiceOne.getTravelMile();
|
|
|
+ int dif = vehiclePosition.getTravelMile() - positionServiceOne.getTravelMile();
|
|
|
map.put("frontVehicleDistance", Math.abs(dif));
|
|
|
AjaxResults1 = new AjaxResults(1, "ok", map);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
AjaxResults1 = new AjaxResults(1, "ok");
|
|
|
}
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
@@ -2285,7 +2289,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
log.info("-------playFlv--------" + playFlv);
|
|
|
if (StringUtils.isEmpty(playFlv)) {
|
|
|
try {
|
|
|
- cameraUtil.heartbeatgetUrl(baseCameraManagement.getCameraCode(), baseCameraManagement.getGraphicsCard(),true, httpUrl);
|
|
|
+ cameraUtil.heartbeatgetUrl(baseCameraManagement.getCameraCode(), baseCameraManagement.getGraphicsCard(), true, httpUrl);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -2294,7 +2298,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
CameraVos cameraVos = new CameraVos();
|
|
|
cameraVos.setCameraCode(baseCameraManagement.getCameraCode());
|
|
|
cameraVos.setCurrentStream(CameraUtil.getPlayFlvRtsp(baseCameraManagement.getCameraCode(), baseCameraManagement.getGraphicsCard(), true, httpUrl));
|
|
|
- AjaxResults1 = new AjaxResults(1, "ok",cameraVos);
|
|
|
+ AjaxResults1 = new AjaxResults(1, "ok", cameraVos);
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
} else {
|
|
|
AjaxResults1 = new AjaxResults(0, "未查询到改车号的相机信息");
|