|
@@ -490,7 +490,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
log.info("接受心跳时间: " + sdf.format(new Date(begin)));
|
|
|
Map<String, Object> twoMap = new HashMap<>();
|
|
|
- String playFlv1;
|
|
|
+ String playFlv1 = null;
|
|
|
int distance = 0;
|
|
|
boolean type = true;
|
|
|
RespHeartbeatVo respHeartbeatVo = new RespHeartbeatVo();
|
|
@@ -547,7 +547,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
}
|
|
|
VehiclePosition vehiclePosition = new VehiclePosition();
|
|
|
- BaseVideoTrains baseVideoTrains=new BaseVideoTrains();
|
|
|
+ BaseVideoTrains baseVideoTrains = new BaseVideoTrains();
|
|
|
BeanUtils.copyProperties(heartbeatVo, vehiclePosition);
|
|
|
LambdaQueryWrapper<BaseVehicleTerminal> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.eq(BaseVehicleTerminal::getTerminalCode, vehiclePosition.getTerminalCode());
|
|
@@ -695,37 +695,6 @@ public class GeoHazardMonitorTokenController {
|
|
|
respHeartbeatVo.setIsAlarm(1);
|
|
|
twoMap.put("currentStream", playFlv1);
|
|
|
twoMap.put("cameraCode", baseCameraManagementList.get(0).getCameraCode());
|
|
|
- } else {
|
|
|
- //赋值--股道
|
|
|
- List<BaseRouteMassage> baseRouteMassageList = baseRouteMassageService.list();
|
|
|
- if (!ObjectUtils.isEmpty(baseRouteMassageList)) {
|
|
|
- for (BaseRouteMassage baseRouteMassage : baseRouteMassageList) {
|
|
|
- if (heartbeatVo.getLineDir() == 1) {
|
|
|
- if (baseRouteMassage.getMileagePosition() - heartbeatVo.getCurrentMile() <= 1500 && baseRouteMassage.getMileagePosition() - heartbeatVo.getCurrentMile() >= 0) {
|
|
|
- respHeartbeatVo.setRouteTrack(baseRouteMassage.getRouteStationTrack().toString());
|
|
|
- respHeartbeatVo.setStationCode(baseRouteMassage.getStationCode());
|
|
|
- break;
|
|
|
- } else {
|
|
|
- respHeartbeatVo.setRouteTrack("");
|
|
|
- respHeartbeatVo.setStationCode("");
|
|
|
- }
|
|
|
- } else if (heartbeatVo.getLineDir() == 2) {
|
|
|
- if (heartbeatVo.getCurrentMile() - baseRouteMassage.getMileagePosition() <= 1500 && heartbeatVo.getCurrentMile() - baseRouteMassage.getMileagePosition() >= 0) {
|
|
|
- respHeartbeatVo.setRouteTrack(baseRouteMassage.getRouteStationTrack().toString());
|
|
|
- respHeartbeatVo.setStationCode(baseRouteMassage.getStationCode());
|
|
|
- break;
|
|
|
- } else {
|
|
|
- respHeartbeatVo.setRouteTrack("");
|
|
|
- respHeartbeatVo.setStationCode("");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- respHeartbeatVo.setRouteTrack("");
|
|
|
- respHeartbeatVo.setStationCode("");
|
|
|
- }
|
|
|
- AjaxResults1 = new AjaxResults(0, "报警里程无可用相机",respHeartbeatVo);
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
}
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
MsgHeartbeatAlarmMessage msgHearbeatAlarmMessage = new MsgHeartbeatAlarmMessage();
|
|
@@ -862,38 +831,6 @@ public class GeoHazardMonitorTokenController {
|
|
|
camera.eq(BaseCameraManagement::getEnableOrNot, 1);
|
|
|
camera.last("limit 2");
|
|
|
List<BaseCameraManagement> list1 = baseCameraManagementService.list(camera);
|
|
|
- if (list1.size() <= 0) {
|
|
|
- //赋值--股道
|
|
|
- List<BaseRouteMassage> baseRouteMassageList = baseRouteMassageService.list();
|
|
|
- if (!ObjectUtils.isEmpty(baseRouteMassageList)) {
|
|
|
- for (BaseRouteMassage baseRouteMassage : baseRouteMassageList) {
|
|
|
- if (heartbeatVo.getLineDir() == 1) {
|
|
|
- if (baseRouteMassage.getMileagePosition() - heartbeatVo.getCurrentMile() <= 1500 && baseRouteMassage.getMileagePosition() - heartbeatVo.getCurrentMile() >= 0) {
|
|
|
- respHeartbeatVo.setRouteTrack(baseRouteMassage.getRouteStationTrack().toString());
|
|
|
- respHeartbeatVo.setStationCode(baseRouteMassage.getStationCode());
|
|
|
- break;
|
|
|
- } else {
|
|
|
- respHeartbeatVo.setRouteTrack("");
|
|
|
- respHeartbeatVo.setStationCode("");
|
|
|
- }
|
|
|
- } else if (heartbeatVo.getLineDir() == 2) {
|
|
|
- if (heartbeatVo.getCurrentMile() - baseRouteMassage.getMileagePosition() <= 1500 && heartbeatVo.getCurrentMile() - baseRouteMassage.getMileagePosition() >= 0) {
|
|
|
- respHeartbeatVo.setRouteTrack(baseRouteMassage.getRouteStationTrack().toString());
|
|
|
- respHeartbeatVo.setStationCode(baseRouteMassage.getStationCode());
|
|
|
- break;
|
|
|
- } else {
|
|
|
- respHeartbeatVo.setRouteTrack("");
|
|
|
- respHeartbeatVo.setStationCode("");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- respHeartbeatVo.setRouteTrack("");
|
|
|
- respHeartbeatVo.setStationCode("");
|
|
|
- }
|
|
|
- AjaxResults1 = new AjaxResults(0, "前方没有摄像机",respHeartbeatVo);
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
- }
|
|
|
log.info("流程1----------------->");
|
|
|
//判断流媒体是否有流
|
|
|
String playFlv = cameraUtil.heartbeatgetPlayFlv(list1.get(0).getCameraCode(), list1.get(0).getChannel(), type);
|
|
@@ -901,17 +838,17 @@ public class GeoHazardMonitorTokenController {
|
|
|
baseVideoTrains.setVideoMile(list1.get(0).getInstallMile());
|
|
|
long delay = System.currentTimeMillis();
|
|
|
log.info("关联距离时间: " + sdf.format(new Date(delay)));
|
|
|
- long mile= delay - begin;
|
|
|
+ long mile = delay - begin;
|
|
|
log.info("关联距离请求用时时间:" + mile + "毫秒");
|
|
|
- baseVideoTrains.setDelay((int)mile);
|
|
|
+ baseVideoTrains.setDelay((int) mile);
|
|
|
if (heartbeatVo.getLineDir() == 1) {
|
|
|
baseVideoTrains.setDistance(list1.get(0).getInstallMile() - heartbeatVo.getCurrentMile());
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
baseVideoTrains.setDistance(heartbeatVo.getCurrentMile() - list1.get(0).getInstallMile());
|
|
|
}
|
|
|
- if (baseVideoTrains.getDistance()>=1000&&baseVideoTrains.getDistance()<=10000){
|
|
|
+ if (baseVideoTrains.getDistance() >= 1000 && baseVideoTrains.getDistance() <= 10000) {
|
|
|
baseVideoTrains.setIsAccuracy(1);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
baseVideoTrains.setIsAccuracy(2);
|
|
|
}
|
|
|
//拉两路视频
|
|
@@ -926,7 +863,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
if (StringUtils.isEmpty(flv)) {
|
|
|
String url = cameraUtil.heartbeatgetUrl(cameraManagement.getCameraCode(), cameraManagement.getChannel(), finalType);
|
|
|
if (url.contains("无视频")) {
|
|
|
- AjaxResults1 = new AjaxResults(0,url);
|
|
|
+ AjaxResults1 = new AjaxResults(0, url);
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
}
|
|
|
}
|
|
@@ -954,7 +891,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
if (StringUtils.isEmpty(flv)) {
|
|
|
String url = cameraUtil.heartbeatgetUrl(cameraManagement.getCameraCode(), cameraManagement.getChannel(), finalType);
|
|
|
if (url.contains("无视频")) {
|
|
|
- AjaxResults1 = new AjaxResults(0,url);
|
|
|
+ AjaxResults1 = new AjaxResults(0, url);
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
}
|
|
|
}
|
|
@@ -969,7 +906,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
CameraVos cameraVos = new CameraVos();
|
|
|
cameraVos.setCameraCode(baseCameraManagement.getCameraCode());
|
|
|
String cacheObject = redisCache.getCacheObject(baseCameraManagement.getCameraCode());
|
|
|
- cameraVos.setCurrentStream(CameraUtil.getPlayFlvRtsp(baseCameraManagement.getCameraCode(), baseCameraManagement.getChannel(), type,cacheObject));
|
|
|
+ cameraVos.setCurrentStream(CameraUtil.getPlayFlvRtsp(baseCameraManagement.getCameraCode(), baseCameraManagement.getChannel(), type, cacheObject));
|
|
|
cameraVosList.add(cameraVos);
|
|
|
}
|
|
|
respHeartbeatVo.setCameraList(cameraVosList);
|
|
@@ -1000,38 +937,6 @@ public class GeoHazardMonitorTokenController {
|
|
|
base.eq(BaseCameraManagement::getEnableOrNot, 1);
|
|
|
base.last("limit 2");
|
|
|
List<BaseCameraManagement> list1 = baseCameraManagementService.list(base);
|
|
|
- if (list1.size() <= 0) {
|
|
|
- //赋值--股道
|
|
|
- List<BaseRouteMassage> list = baseRouteMassageService.list();
|
|
|
- if (!ObjectUtils.isEmpty(list)) {
|
|
|
- for (BaseRouteMassage baseRouteMassage : list) {
|
|
|
- if (heartbeatVo.getLineDir() == 1) {
|
|
|
- if (baseRouteMassage.getMileagePosition() - heartbeatVo.getCurrentMile() <= 1500 && baseRouteMassage.getMileagePosition() - heartbeatVo.getCurrentMile() >= 0) {
|
|
|
- respHeartbeatVo.setRouteTrack(baseRouteMassage.getRouteStationTrack().toString());
|
|
|
- respHeartbeatVo.setStationCode(baseRouteMassage.getStationCode());
|
|
|
- break;
|
|
|
- } else {
|
|
|
- respHeartbeatVo.setRouteTrack("");
|
|
|
- respHeartbeatVo.setStationCode("");
|
|
|
- }
|
|
|
- } else if (heartbeatVo.getLineDir() == 2) {
|
|
|
- if (heartbeatVo.getCurrentMile() - baseRouteMassage.getMileagePosition() <= 1500 && heartbeatVo.getCurrentMile() - baseRouteMassage.getMileagePosition() >= 0) {
|
|
|
- respHeartbeatVo.setRouteTrack(baseRouteMassage.getRouteStationTrack().toString());
|
|
|
- respHeartbeatVo.setStationCode(baseRouteMassage.getStationCode());
|
|
|
- break;
|
|
|
- } else {
|
|
|
- respHeartbeatVo.setRouteTrack("");
|
|
|
- respHeartbeatVo.setStationCode("");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- respHeartbeatVo.setRouteTrack("");
|
|
|
- respHeartbeatVo.setStationCode("");
|
|
|
- }
|
|
|
- AjaxResults1 = new AjaxResults(0,"前方没有摄像机",respHeartbeatVo);
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
- }
|
|
|
log.info("流程2----------------->");
|
|
|
//判断流媒体是否有流
|
|
|
String playFlv = cameraUtil.heartbeatgetPlayFlv(list1.get(0).getCameraCode(), list1.get(0).getChannel(), type);
|
|
@@ -1039,17 +944,17 @@ public class GeoHazardMonitorTokenController {
|
|
|
baseVideoTrains.setVideoMile(list1.get(0).getInstallMile());
|
|
|
long delay = System.currentTimeMillis();
|
|
|
log.info("关联距离时间: " + sdf.format(new Date(delay)));
|
|
|
- long mile= delay - begin;
|
|
|
+ long mile = delay - begin;
|
|
|
log.info("关联距离请求用时时间:" + mile + "毫秒");
|
|
|
- baseVideoTrains.setDelay((int)mile);
|
|
|
+ baseVideoTrains.setDelay((int) mile);
|
|
|
if (heartbeatVo.getLineDir() == 1) {
|
|
|
baseVideoTrains.setDistance(list1.get(0).getInstallMile() - heartbeatVo.getCurrentMile());
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
baseVideoTrains.setDistance(heartbeatVo.getCurrentMile() - list1.get(0).getInstallMile());
|
|
|
}
|
|
|
- if (baseVideoTrains.getDistance()>=1000&&baseVideoTrains.getDistance()<=10000){
|
|
|
+ if (baseVideoTrains.getDistance() >= 1000 && baseVideoTrains.getDistance() <= 10000) {
|
|
|
baseVideoTrains.setIsAccuracy(1);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
baseVideoTrains.setIsAccuracy(2);
|
|
|
}
|
|
|
//拉两路视频
|
|
@@ -1064,7 +969,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
if (StringUtils.isEmpty(flv)) {
|
|
|
String url = cameraUtil.heartbeatgetUrl(cameraManagement.getCameraCode(), cameraManagement.getChannel(), finalType);
|
|
|
if (url.contains("无视频")) {
|
|
|
- AjaxResults1 = new AjaxResults(0,url);
|
|
|
+ AjaxResults1 = new AjaxResults(0, url);
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
}
|
|
|
}
|
|
@@ -1080,16 +985,14 @@ public class GeoHazardMonitorTokenController {
|
|
|
log.info("-------------->>已进入拉一路路视频");
|
|
|
log.info("list1-------------->>" + list1.size());
|
|
|
for (int i = 1; i < list1.size(); i++) {
|
|
|
- boolean finalType = type;
|
|
|
- int finalI = i;
|
|
|
- List<BaseCameraManagement> baseCameraManagementList1 = cameraUtil.getBaseCameraManagementList(list1.get(finalI).getId(), heartbeatVo.getLineDir());
|
|
|
+ List<BaseCameraManagement> baseCameraManagementList1 = cameraUtil.getBaseCameraManagementList(list1.get(i).getId(), heartbeatVo.getLineDir());
|
|
|
if (!ObjectUtils.isEmpty(baseCameraManagementList1)) {
|
|
|
for (BaseCameraManagement cameraManagement : baseCameraManagementList1) {
|
|
|
- String flv = cameraUtil.heartbeatgetPlayFlv(cameraManagement.getCameraCode(), cameraManagement.getChannel(), finalType);
|
|
|
+ String flv = cameraUtil.heartbeatgetPlayFlv(cameraManagement.getCameraCode(), cameraManagement.getChannel(), type);
|
|
|
if (StringUtils.isEmpty(flv)) {
|
|
|
- String url = cameraUtil.heartbeatgetUrl(cameraManagement.getCameraCode(), cameraManagement.getChannel(), finalType);
|
|
|
+ String url = cameraUtil.heartbeatgetUrl(cameraManagement.getCameraCode(), cameraManagement.getChannel(), type);
|
|
|
if (url.contains("无视频")) {
|
|
|
- AjaxResults1 = new AjaxResults(0,url);
|
|
|
+ AjaxResults1 = new AjaxResults(0, url);
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
}
|
|
|
}
|
|
@@ -1104,7 +1007,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
CameraVos cameraVos = new CameraVos();
|
|
|
cameraVos.setCameraCode(baseCameraManagement.getCameraCode());
|
|
|
String cacheObject = redisCache.getCacheObject(baseCameraManagement.getCameraCode());
|
|
|
- cameraVos.setCurrentStream(CameraUtil.getPlayFlvRtsp(baseCameraManagement.getCameraCode(), baseCameraManagement.getChannel(), type,cacheObject));
|
|
|
+ cameraVos.setCurrentStream(CameraUtil.getPlayFlvRtsp(baseCameraManagement.getCameraCode(), baseCameraManagement.getChannel(), type, cacheObject));
|
|
|
cameraVosList.add(cameraVos);
|
|
|
}
|
|
|
respHeartbeatVo.setCameraList(cameraVosList);
|
|
@@ -1112,43 +1015,43 @@ public class GeoHazardMonitorTokenController {
|
|
|
twoMap.put("currentStream", playFlv);
|
|
|
twoMap.put("cameraCode", list1.get(0).getCameraCode());
|
|
|
respHeartbeatVo.setIsAlarm(2);
|
|
|
- //赋值--股道
|
|
|
- List<BaseRouteMassage> list = baseRouteMassageService.list();
|
|
|
- if (!ObjectUtils.isEmpty(list)) {
|
|
|
- for (BaseRouteMassage baseRouteMassage : list) {
|
|
|
- if (heartbeatVo.getLineDir() == 1) {
|
|
|
- if (baseRouteMassage.getMileagePosition() - heartbeatVo.getCurrentMile() <= 1500 && baseRouteMassage.getMileagePosition() - heartbeatVo.getCurrentMile() >= 0) {
|
|
|
- respHeartbeatVo.setRouteTrack(baseRouteMassage.getRouteStationTrack().toString());
|
|
|
- respHeartbeatVo.setStationCode(baseRouteMassage.getStationCode());
|
|
|
- break;
|
|
|
- } else {
|
|
|
- respHeartbeatVo.setRouteTrack("");
|
|
|
- respHeartbeatVo.setStationCode("");
|
|
|
- }
|
|
|
- } else if (heartbeatVo.getLineDir() == 2) {
|
|
|
- if (heartbeatVo.getCurrentMile() - baseRouteMassage.getMileagePosition() <= 1500 && heartbeatVo.getCurrentMile() - baseRouteMassage.getMileagePosition() >= 0) {
|
|
|
- respHeartbeatVo.setRouteTrack(baseRouteMassage.getRouteStationTrack().toString());
|
|
|
- respHeartbeatVo.setStationCode(baseRouteMassage.getStationCode());
|
|
|
- break;
|
|
|
- } else {
|
|
|
- respHeartbeatVo.setRouteTrack("");
|
|
|
- respHeartbeatVo.setStationCode("");
|
|
|
- }
|
|
|
+ }
|
|
|
+ //赋值--股道
|
|
|
+ List<BaseRouteMassage> baseRouteMassageList = baseRouteMassageService.list();
|
|
|
+ if (!ObjectUtils.isEmpty(baseRouteMassageList)) {
|
|
|
+ for (BaseRouteMassage baseRouteMassage : baseRouteMassageList) {
|
|
|
+ if (heartbeatVo.getLineDir() == 1) {
|
|
|
+ if (baseRouteMassage.getMileagePosition() - heartbeatVo.getCurrentMile() <= 1500 && baseRouteMassage.getMileagePosition() - heartbeatVo.getCurrentMile() >= 0) {
|
|
|
+ respHeartbeatVo.setRouteTrack(baseRouteMassage.getRouteStationTrack().toString());
|
|
|
+ respHeartbeatVo.setStationCode(baseRouteMassage.getStationCode());
|
|
|
+ break;
|
|
|
+ } else {
|
|
|
+ respHeartbeatVo.setRouteTrack("");
|
|
|
+ respHeartbeatVo.setStationCode("");
|
|
|
+ }
|
|
|
+ } else if (heartbeatVo.getLineDir() == 2) {
|
|
|
+ if (heartbeatVo.getCurrentMile() - baseRouteMassage.getMileagePosition() <= 1500 && heartbeatVo.getCurrentMile() - baseRouteMassage.getMileagePosition() >= 0) {
|
|
|
+ respHeartbeatVo.setRouteTrack(baseRouteMassage.getRouteStationTrack().toString());
|
|
|
+ respHeartbeatVo.setStationCode(baseRouteMassage.getStationCode());
|
|
|
+ break;
|
|
|
+ } else {
|
|
|
+ respHeartbeatVo.setRouteTrack("");
|
|
|
+ respHeartbeatVo.setStationCode("");
|
|
|
}
|
|
|
}
|
|
|
- } else {
|
|
|
- respHeartbeatVo.setRouteTrack("");
|
|
|
- respHeartbeatVo.setStationCode("");
|
|
|
}
|
|
|
+ } else {
|
|
|
+ respHeartbeatVo.setRouteTrack("");
|
|
|
+ respHeartbeatVo.setStationCode("");
|
|
|
}
|
|
|
twoMap.put("visualDistance", heartbeatVo.getVisualDistance().toString());
|
|
|
String string = JSON.toJSONString(twoMap);
|
|
|
baseVideoTrainsService.save(baseVideoTrains);
|
|
|
heartbeatUtils.createHeartbeat(Constant.HERTBEA_KEY + heartbeatVo.getTerminalCode(), string);
|
|
|
log.info("---------data---结果-------" + respHeartbeatVo);
|
|
|
- AjaxResults1 = new AjaxResults(0,"视频加载中",respHeartbeatVo);
|
|
|
+ AjaxResults1 = new AjaxResults(0, "视频加载中", respHeartbeatVo);
|
|
|
if (StringUtils.isNotEmpty(respHeartbeatVo.getCameraList())) {
|
|
|
- AjaxResults1 = new AjaxResults(1,"ok",respHeartbeatVo);
|
|
|
+ AjaxResults1 = new AjaxResults(1, "ok", respHeartbeatVo);
|
|
|
} else {
|
|
|
}
|
|
|
long end = System.currentTimeMillis();
|
|
@@ -1156,11 +1059,11 @@ public class GeoHazardMonitorTokenController {
|
|
|
log.info("心跳接口请求用时时间:" + (end - begin) + "毫秒");
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
} else {
|
|
|
- AjaxResults1 = new AjaxResults(0,"心跳机制交互失败");
|
|
|
+ AjaxResults1 = new AjaxResults(0, "心跳机制交互失败");
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
}
|
|
|
} else {
|
|
|
- AjaxResults1 = new AjaxResults(2,"token验证失败");
|
|
|
+ AjaxResults1 = new AjaxResults(2, "token验证失败");
|
|
|
return JSONObject.toJSONString(AjaxResults1);
|
|
|
}
|
|
|
|