|
@@ -31,7 +31,8 @@ import com.ozs.entity.SkynetHeartbeatLog;
|
|
|
import com.ozs.entity.SvcAddress;
|
|
|
import com.ozs.entity.TerminalIgnoreAlarm;
|
|
|
import com.ozs.entity.VehiclePosition;
|
|
|
-import com.ozs.entity.response.BaseVideoTrains;
|
|
|
+import com.ozs.entity.BaseVideoTrains;
|
|
|
+import com.ozs.entity.response.PreAlarmListResponse;
|
|
|
import com.ozs.entity.response.PreAlarmResponse;
|
|
|
import com.ozs.entity.vo.AlarmFilesVo;
|
|
|
import com.ozs.entity.vo.AlarmHeartbeatLog;
|
|
@@ -93,7 +94,6 @@ import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
-import java.util.Collections;
|
|
|
import java.util.Comparator;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
@@ -455,7 +455,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();
|
|
@@ -512,7 +512,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());
|
|
@@ -557,6 +557,10 @@ public class GeoHazardMonitorTokenController {
|
|
|
queryWrapper.eq(MsgAlarm::getIsRelease, 2);
|
|
|
List<MsgAlarm> alarmsList = msgAlarmService.list(queryWrapper);
|
|
|
//根据终端编码 判断终端忽略报警信息记录表中的是否有忽略的报警
|
|
|
+ PreAlarm preAlarm = preAlarmService.getOne(new LambdaQueryWrapper<PreAlarm>()
|
|
|
+ .eq(PreAlarm::getTrainId, heartbeatVo.getTrainNum())
|
|
|
+ .orderByDesc(PreAlarm::getPreAlarmTime)
|
|
|
+ .last("limit 1"));
|
|
|
if (!ObjectUtils.isEmpty(alarmsList)) {
|
|
|
// 获取当前时间
|
|
|
LocalDateTime currentDateTime = LocalDateTime.now();
|
|
@@ -598,10 +602,6 @@ public class GeoHazardMonitorTokenController {
|
|
|
queryWrapper2.orderByDesc(MsgAlarm::getAlarmMile);
|
|
|
}
|
|
|
List<MsgAlarm> list = msgAlarmService.list(queryWrapper2);
|
|
|
- PreAlarm preAlarm = preAlarmService.getOne(new LambdaQueryWrapper<PreAlarm>()
|
|
|
- .eq(PreAlarm::getTrainId, heartbeatVo.getVehicleCode())
|
|
|
- .orderByDesc(PreAlarm::getPreAlarmTime)
|
|
|
- .last("limit 1"));
|
|
|
log.info("--------List<MsgAlarm>--------" + list);
|
|
|
//有报警信息的时候
|
|
|
LambdaQueryWrapper<BaseCameraManagement> camera = new LambdaQueryWrapper<BaseCameraManagement>();
|
|
@@ -656,7 +656,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
}
|
|
|
log.info("-------playFlv--------" + playFlv1);
|
|
|
CameraVos cameraVos = new CameraVos();
|
|
|
- cameraVos.setCameraCode(baseCameraManagementList.get(0).getCameraCode());
|
|
|
+ cameraVos.setCameraCode(code);
|
|
|
cameraVos.setCurrentStream(playFlv1);
|
|
|
List<CameraVos> cameraVosList = new ArrayList<>();
|
|
|
cameraVosList.add(cameraVos);
|
|
@@ -664,37 +664,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();
|
|
@@ -809,7 +778,8 @@ public class GeoHazardMonitorTokenController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- } else if (!ObjectUtils.isEmpty(preAlarm)){
|
|
|
+ } else if (!ObjectUtils.isEmpty(preAlarm)) {
|
|
|
+ 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
|
|
@@ -819,23 +789,74 @@ public class GeoHazardMonitorTokenController {
|
|
|
};
|
|
|
//排序
|
|
|
preAlarmList.sort(distanceComparator);
|
|
|
- for (PreAlarmResponse.PreAlarmList alarmList : preAlarmList) {
|
|
|
+ for (int i = 0; i < preAlarmList.size(); i++) {
|
|
|
+ int mile=0;
|
|
|
+ LambdaQueryWrapper<BaseCameraManagement> wrapper1 = new LambdaQueryWrapper<BaseCameraManagement>();
|
|
|
if (heartbeatVo.getLineDir() == 1) {
|
|
|
- int mile=alarmList.getDistance()+heartbeatVo.getCurrentMile();
|
|
|
- camera.ge(BaseCameraManagement::getEndMile, mile);
|
|
|
- camera.le(BaseCameraManagement::getBeginMile, mile);
|
|
|
- camera.in(BaseCameraManagement::getMonitoringDirection, 1, 3);
|
|
|
- camera.orderByAsc(BaseCameraManagement::getGrou).orderByAsc(BaseCameraManagement::getSort);
|
|
|
+ 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) {
|
|
|
- int mile=heartbeatVo.getCurrentMile()-alarmList.getDistance();
|
|
|
- camera.ge(BaseCameraManagement::getEndMile, mile);
|
|
|
- camera.le(BaseCameraManagement::getBeginMile, mile);
|
|
|
- camera.in(BaseCameraManagement::getMonitoringDirection, 2, 3);
|
|
|
- camera.orderByDesc(BaseCameraManagement::getGrou).orderByDesc(BaseCameraManagement::getSort);
|
|
|
+ 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 (baseCameraManagementList.size() > 0) {
|
|
|
+ int minDifference = Integer.MAX_VALUE;
|
|
|
+ String code = null;
|
|
|
+ String channel = 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);
|
|
|
+ channel = baseCameraManagement.getChannel();
|
|
|
+ log.info("------------channel-------" + channel);
|
|
|
+ }
|
|
|
+ //添加预警信息
|
|
|
+ PreAlarmListResponse preAlarmListResponse = new PreAlarmListResponse();
|
|
|
+ BeanUtils.copyProperties(preAlarmList.get(i), preAlarmListResponse);
|
|
|
+ preAlarmListResponse.setCameraCode(baseCameraManagement.getCameraCode());
|
|
|
+ preAlarmListResponse.setCameraStream(CameraUtil.getPlayFlvRtsp(baseCameraManagement.getCameraCode(), baseCameraManagement.getChannel(), type));
|
|
|
+ responseList.add(preAlarmListResponse);
|
|
|
+ }
|
|
|
+ if (i == 0) {
|
|
|
+ playFlv1 = CameraUtil.getPlayFlvRtsp(code, channel, type);
|
|
|
+ if (StringUtils.isEmpty(playFlv1)) {
|
|
|
+ playFlv1 = CameraUtil.getPlayFlvRtsp(code, channel, type);
|
|
|
+ if (playFlv1.contains("无视频")) {
|
|
|
+ AjaxResults1 = new AjaxResults(0, playFlv1);
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ log.info("-------playFlv--------" + playFlv1);
|
|
|
+ CameraVos cameraVos = new CameraVos();
|
|
|
+ cameraVos.setCameraCode(code);
|
|
|
+ cameraVos.setCurrentStream(playFlv1);
|
|
|
+ List<CameraVos> cameraVosList = new ArrayList<>();
|
|
|
+ cameraVosList.add(cameraVos);
|
|
|
+ respHeartbeatVo.setCameraList(cameraVosList);
|
|
|
+ respHeartbeatVo.setIsAlarm(2);
|
|
|
+ twoMap.put("currentStream", playFlv1);
|
|
|
+ twoMap.put("cameraCode", baseCameraManagementList.get(0).getCameraCode());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }else {
|
|
|
+ respHeartbeatVo.setPreAlarmList(responseList);
|
|
|
+ } else {
|
|
|
//没有报警信息的时候
|
|
|
if (heartbeatVo.getLineDir() == 1) {
|
|
|
distance = heartbeatVo.getVisualDistance() + heartbeatVo.getCurrentMile();
|
|
@@ -858,34 +879,6 @@ public class GeoHazardMonitorTokenController {
|
|
|
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);
|
|
|
}
|
|
@@ -896,17 +889,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);
|
|
|
}
|
|
|
//拉两路视频
|
|
@@ -920,7 +913,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
if (StringUtils.isEmpty(flv)) {
|
|
|
String url = CameraUtil.getPlayFlvRtsp(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);
|
|
|
}
|
|
|
}
|
|
@@ -946,7 +939,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
if (StringUtils.isEmpty(flv)) {
|
|
|
String url = CameraUtil.getPlayFlvRtsp(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);
|
|
|
}
|
|
|
}
|
|
@@ -969,6 +962,84 @@ public class GeoHazardMonitorTokenController {
|
|
|
twoMap.put("cameraCode", list1.get(0).getCameraCode());
|
|
|
respHeartbeatVo.setIsAlarm(2);
|
|
|
}
|
|
|
+ } else if (!ObjectUtils.isEmpty(preAlarm)) {
|
|
|
+ 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++) {
|
|
|
+ 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 (baseCameraManagementList.size() > 0) {
|
|
|
+ int minDifference = Integer.MAX_VALUE;
|
|
|
+ String code = null;
|
|
|
+ String channel = 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);
|
|
|
+ channel = baseCameraManagement.getChannel();
|
|
|
+ log.info("------------channel-------" + channel);
|
|
|
+ }
|
|
|
+ //添加预警信息
|
|
|
+ PreAlarmListResponse preAlarmListResponse = new PreAlarmListResponse();
|
|
|
+ BeanUtils.copyProperties(preAlarmList.get(i), preAlarmListResponse);
|
|
|
+ preAlarmListResponse.setCameraCode(baseCameraManagement.getCameraCode());
|
|
|
+ preAlarmListResponse.setCameraStream(CameraUtil.getPlayFlvRtsp(baseCameraManagement.getCameraCode(), baseCameraManagement.getChannel(), type));
|
|
|
+ responseList.add(preAlarmListResponse);
|
|
|
+ }
|
|
|
+ if (i == 0) {
|
|
|
+ playFlv1 = CameraUtil.getPlayFlvRtsp(code, channel, type);
|
|
|
+ if (StringUtils.isEmpty(playFlv1)) {
|
|
|
+ playFlv1 = CameraUtil.getPlayFlvRtsp(code, channel, type);
|
|
|
+ if (playFlv1.contains("无视频")) {
|
|
|
+ AjaxResults1 = new AjaxResults(0, playFlv1);
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ log.info("-------playFlv--------" + playFlv1);
|
|
|
+ CameraVos cameraVos = new CameraVos();
|
|
|
+ cameraVos.setCameraCode(code);
|
|
|
+ cameraVos.setCurrentStream(playFlv1);
|
|
|
+ List<CameraVos> cameraVosList = new ArrayList<>();
|
|
|
+ cameraVosList.add(cameraVos);
|
|
|
+ respHeartbeatVo.setCameraList(cameraVosList);
|
|
|
+ respHeartbeatVo.setIsAlarm(2);
|
|
|
+ twoMap.put("currentStream", playFlv1);
|
|
|
+ twoMap.put("cameraCode", baseCameraManagementList.get(0).getCameraCode());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ respHeartbeatVo.setPreAlarmList(responseList);
|
|
|
} else {
|
|
|
//没有报警信息的时候
|
|
|
LambdaQueryWrapper<BaseCameraManagement> base = new LambdaQueryWrapper<>();
|
|
@@ -992,37 +1063,10 @@ public class GeoHazardMonitorTokenController {
|
|
|
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.getPlayFlvRtsp(list1.get(0).getCameraCode(), list1.get(0).getChannel(), type);
|
|
@@ -1030,17 +1074,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);
|
|
|
}
|
|
|
//拉两路视频
|
|
@@ -1054,7 +1098,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
if (StringUtils.isEmpty(flv)) {
|
|
|
String url = CameraUtil.getPlayFlvRtsp(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);
|
|
|
}
|
|
|
}
|
|
@@ -1077,7 +1121,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
if (StringUtils.isEmpty(flv)) {
|
|
|
String url = CameraUtil.getPlayFlvRtsp(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);
|
|
|
}
|
|
|
}
|
|
@@ -1100,55 +1144,25 @@ 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("");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } 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);
|
|
|
if (StringUtils.isNotEmpty(respHeartbeatVo.getCameraList())) {
|
|
|
- AjaxResults1 = new AjaxResults(1,"ok",respHeartbeatVo);
|
|
|
- } else {
|
|
|
+ AjaxResults1 = new AjaxResults(1, "ok", respHeartbeatVo);
|
|
|
}
|
|
|
long end = System.currentTimeMillis();
|
|
|
log.info("结束心跳时间: " + sdf.format(new Date(end)));
|
|
|
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);
|
|
|
}
|
|
|
|
|
@@ -1192,7 +1206,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
MsgAlarm msgAlarm = msgAlarmService.getOne(wrapper);
|
|
|
if (ObjectUtils.isEmpty(msgAlarm)) {
|
|
|
map.put("isIgnore", 1);
|
|
|
- AjaxResults1 = new AjaxResults(0, "失败",map);
|
|
|
+ AjaxResults1 = new AjaxResults(0, "失败", map);
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
}
|
|
|
TerminalIgnoreAlarm terminalIgnoreAlarm = new TerminalIgnoreAlarm();
|
|
@@ -1205,11 +1219,11 @@ public class GeoHazardMonitorTokenController {
|
|
|
if (save) {
|
|
|
ignoreUtils.createIgnore("HL" + terminalIgnoreAlarm.getTerminalCode(), terminalIgnoreAlarm.getAlarmId());
|
|
|
map.put("isIgnore", 2);
|
|
|
- AjaxResults1 = new AjaxResults(1, "ok",map);
|
|
|
+ AjaxResults1 = new AjaxResults(1, "ok", map);
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
} else {
|
|
|
map.put("isIgnore", 3);
|
|
|
- AjaxResults1 = new AjaxResults(0, "失败",map);
|
|
|
+ AjaxResults1 = new AjaxResults(0, "失败", map);
|
|
|
}
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
} else {
|
|
@@ -1290,7 +1304,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
BeanUtils.copyProperties(baseCameraManagement, respCameraVo);
|
|
|
cameraVos.add(respCameraVo);
|
|
|
}
|
|
|
- AjaxResults1 = new AjaxResults(1, "ok",cameraVos);
|
|
|
+ AjaxResults1 = new AjaxResults(1, "ok", cameraVos);
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
} else {
|
|
|
AjaxResults1 = new AjaxResults(2, "token验证失败");
|
|
@@ -1347,7 +1361,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
}
|
|
|
map.put("url", playFlv);
|
|
|
- AjaxResults1 = new AjaxResults(1, "ok",map);
|
|
|
+ AjaxResults1 = new AjaxResults(1, "ok", map);
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
} else {
|
|
|
AjaxResults1 = new AjaxResults(2, "token验证失败");
|
|
@@ -1466,7 +1480,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
}
|
|
|
RespAlarmList[] array = listVos.toArray(new RespAlarmList[]{});
|
|
|
queryAlarmVo.setAlarmList(array);
|
|
|
- AjaxResults1 = new AjaxResults(1, "ok",queryAlarmVo);
|
|
|
+ AjaxResults1 = new AjaxResults(1, "ok", queryAlarmVo);
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
} else {
|
|
|
AjaxResults1 = new AjaxResults(2, "token验证失败");
|
|
@@ -1493,7 +1507,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
String[] split = token.split("-");
|
|
|
String key = split[split.length - 1];
|
|
|
if (ObjectUtils.isEmpty(parameterVo)) {
|
|
|
- AjaxResults1 = new AjaxResults(0, "parameterVo参数不能为空",AjaxResults1);
|
|
|
+ AjaxResults1 = new AjaxResults(0, "parameterVo参数不能为空", AjaxResults1);
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
}
|
|
|
String s = SM4Utils.decryptData_ECB(parameterVo.getParameter(), key);
|
|
@@ -1534,7 +1548,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
}
|
|
|
}
|
|
|
map.put("url", one.getReleasedUrl());
|
|
|
- AjaxResults1 = new AjaxResults(1, "ok",map);
|
|
|
+ AjaxResults1 = new AjaxResults(1, "ok", map);
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
} else {
|
|
|
AjaxResults1 = new AjaxResults(2, "token验证失败");
|
|
@@ -1593,7 +1607,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
if (synetHeartbeatLogMapper.insert(skynetHeartbeatLog) > 0) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("cameraCode", skynetHeartbeatVo.getCameraCode());
|
|
|
- AjaxResults1 = new AjaxResults(1, "ok",map);
|
|
|
+ AjaxResults1 = new AjaxResults(1, "ok", map);
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
} else {
|
|
|
AjaxResults1 = new AjaxResults(0, "新增失败");
|
|
@@ -1637,7 +1651,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
if (alarmHeartbeatLogMapper.insert(alarmHeartbeatLog) > 0) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("clientId", svcAddress.getClientId());
|
|
|
- AjaxResults1 = new AjaxResults(1, "ok",map);
|
|
|
+ AjaxResults1 = new AjaxResults(1, "ok", map);
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
} else {
|
|
|
AjaxResults1 = new AjaxResults(0, "新增失败");
|