|
@@ -28,10 +28,13 @@ import com.ozs.entity.MsgAlarm;
|
|
|
import com.ozs.entity.MsgAlarmExt;
|
|
|
import com.ozs.entity.MsgAlarmFrequency;
|
|
|
import com.ozs.entity.MsgHeartbeatAlarmMessage;
|
|
|
+import com.ozs.entity.PreAlarm;
|
|
|
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.PreAlarmListResponse;
|
|
|
+import com.ozs.entity.response.PreAlarmResponse;
|
|
|
import com.ozs.entity.vo.AlarmFilesVo;
|
|
|
import com.ozs.entity.vo.AlarmHeartbeatLog;
|
|
|
import com.ozs.entity.vo.AlarmInfoVo;
|
|
@@ -66,6 +69,7 @@ import com.ozs.service.BaseVideoTrainsService;
|
|
|
import com.ozs.service.MsgAlarmExtService;
|
|
|
import com.ozs.service.MsgAlarmFrequencyService;
|
|
|
import com.ozs.service.MsgAlarmService;
|
|
|
+import com.ozs.service.PreAlarmService;
|
|
|
import com.ozs.service.SvcAddressService;
|
|
|
import com.ozs.service.TerminalIgnoreAlarmService;
|
|
|
import com.ozs.service.VehiclePositionService;
|
|
@@ -163,6 +167,8 @@ public class GeoHazardMonitorTokenController {
|
|
|
private RedisCache redisCache;
|
|
|
@Autowired
|
|
|
private BaseVideoTrainsService baseVideoTrainsService;
|
|
|
+ @Resource
|
|
|
+ private PreAlarmService preAlarmService;
|
|
|
|
|
|
/**
|
|
|
* 获取web访问令牌
|
|
@@ -241,10 +247,6 @@ public class GeoHazardMonitorTokenController {
|
|
|
}
|
|
|
String s = SM4Utils.decryptData_ECB(parameterVo.getParameter(), key);
|
|
|
ReqMsgAlarmVo reqMsgAlarmVo = JSON.parseObject(s, ReqMsgAlarmVo.class);
|
|
|
- if (ObjectUtils.isEmpty(reqMsgAlarmVo.getAlarmAttr())) {
|
|
|
- AjaxResults1 = new AjaxResults(0, "你填写的报警病害属性不符合规则");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
- }
|
|
|
if (!reqMsgAlarmVo.getAlarmMile().toString().matches(PATTERNS)) {
|
|
|
AjaxResults1 = new AjaxResults(0, "报警里程位置填写错误");
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
@@ -522,7 +524,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
}
|
|
|
if (ObjectUtils.isEmpty(heartbeatVo.getLongitude())) {
|
|
|
- AjaxResults1 = new AjaxResults(0, "当前所在纬度不能为空");
|
|
|
+ AjaxResults1 = new AjaxResults(0, "当前所在经度不能为空");
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
}
|
|
|
LambdaQueryWrapper<BaseRailwayManagement> railway = new LambdaQueryWrapper<BaseRailwayManagement>();
|
|
@@ -592,6 +594,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();
|
|
@@ -687,7 +693,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);
|
|
@@ -695,6 +701,9 @@ public class GeoHazardMonitorTokenController {
|
|
|
respHeartbeatVo.setIsAlarm(1);
|
|
|
twoMap.put("currentStream", playFlv1);
|
|
|
twoMap.put("cameraCode", baseCameraManagementList.get(0).getCameraCode());
|
|
|
+ } else {
|
|
|
+ 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,6 +818,87 @@ public class GeoHazardMonitorTokenController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ }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.heartbeatgetPlayFlv(baseCameraManagement.getCameraCode(), baseCameraManagement.getChannel(), type));
|
|
|
+ responseList.add(preAlarmListResponse);
|
|
|
+ }
|
|
|
+ if (i == 0) {
|
|
|
+ playFlv1 =cameraUtil.heartbeatgetPlayFlv(code, channel, type);
|
|
|
+ if (StringUtils.isEmpty(playFlv1)) {
|
|
|
+ playFlv1 = cameraUtil.heartbeatgetUrl(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 {
|
|
|
+ AjaxResults1 = new AjaxResults(0, "前方没有摄像机",respHeartbeatVo);
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ respHeartbeatVo.setPreAlarmList(responseList);
|
|
|
} else {
|
|
|
//没有报警信息的时候
|
|
|
if (heartbeatVo.getLineDir() == 1) {
|
|
@@ -831,6 +921,10 @@ public class GeoHazardMonitorTokenController {
|
|
|
camera.eq(BaseCameraManagement::getEnableOrNot, 1);
|
|
|
camera.last("limit 2");
|
|
|
List<BaseCameraManagement> list1 = baseCameraManagementService.list(camera);
|
|
|
+ if (list1.size() <= 0) {
|
|
|
+ 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);
|
|
@@ -855,13 +949,12 @@ public class GeoHazardMonitorTokenController {
|
|
|
if (StringUtils.isEmpty(playFlv)) {
|
|
|
log.info("--------------->>已进入拉两路视频");
|
|
|
for (BaseCameraManagement baseCameraManagement : list1) {
|
|
|
- boolean finalType = type;
|
|
|
List<BaseCameraManagement> baseCameraManagementList1 = cameraUtil.getBaseCameraManagementList(baseCameraManagement.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);
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
@@ -915,6 +1008,87 @@ 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.heartbeatgetPlayFlv(baseCameraManagement.getCameraCode(), baseCameraManagement.getChannel(), type));
|
|
|
+ responseList.add(preAlarmListResponse);
|
|
|
+ }
|
|
|
+ if (i == 0) {
|
|
|
+ playFlv1 =cameraUtil.heartbeatgetPlayFlv(code, channel, type);
|
|
|
+ if (StringUtils.isEmpty(playFlv1)) {
|
|
|
+ playFlv1 = cameraUtil.heartbeatgetUrl(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 {
|
|
|
+ AjaxResults1 = new AjaxResults(0, "前方没有摄像机",respHeartbeatVo);
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ respHeartbeatVo.setPreAlarmList(responseList);
|
|
|
} else {
|
|
|
//没有报警信息的时候
|
|
|
LambdaQueryWrapper<BaseCameraManagement> base = new LambdaQueryWrapper<>();
|
|
@@ -937,6 +1111,10 @@ public class GeoHazardMonitorTokenController {
|
|
|
base.eq(BaseCameraManagement::getEnableOrNot, 1);
|
|
|
base.last("limit 2");
|
|
|
List<BaseCameraManagement> list1 = baseCameraManagementService.list(base);
|
|
|
+ if (list1.size() <= 0) {
|
|
|
+ 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);
|
|
@@ -1594,6 +1772,82 @@ public class GeoHazardMonitorTokenController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 预警信息接口定义
|
|
|
+ */
|
|
|
+ @PostMapping("/api/preAlarm")
|
|
|
+ public String preAlarm(@RequestBody ParameterVo parameterVo, HttpServletRequest request) {
|
|
|
+ String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
|
+ log.info("token:{}", token);
|
|
|
+ log.info("parameterVo:{}", parameterVo);
|
|
|
+ AjaxResults AjaxResults1 = null;
|
|
|
+ if (StringUtils.isNotEmpty(token)) {
|
|
|
+ String[] split = token.split("-");
|
|
|
+ String key = split[split.length - 1];
|
|
|
+ if (ObjectUtils.isEmpty(parameterVo)) {
|
|
|
+ AjaxResults1 = new AjaxResults(0, "parameterVo参数不能为空");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
+ }
|
|
|
+ String s = SM4Utils.decryptData_ECB(parameterVo.getParameter(), key);
|
|
|
+ PreAlarmResponse preAlarmResponse = JSON.parseObject(s, PreAlarmResponse.class);
|
|
|
+ if (ObjectUtils.isEmpty(preAlarmResponse.getTrainId())) {
|
|
|
+ AjaxResults1 = new AjaxResults(0, "机车号不能为空");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isEmpty(preAlarmResponse.getPreAlarmType())) {
|
|
|
+ AjaxResults1 = new AjaxResults(0, "预警病害类型不能为空");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isEmpty(preAlarmResponse.getPreAlarmNum())) {
|
|
|
+ AjaxResults1 = new AjaxResults(0, "预警目标个数不难为空");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isEmpty(preAlarmResponse.getPreAlarmTime())) {
|
|
|
+ AjaxResults1 = new AjaxResults(0, "预警时间不难为空");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isEmpty(preAlarmResponse.getPreAlarmList())) {
|
|
|
+ AjaxResults1 = new AjaxResults(0, "预警目标集合不难为空");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
+ }
|
|
|
+ for (PreAlarmResponse.PreAlarmList preAlarmList : preAlarmResponse.getPreAlarmList()) {
|
|
|
+ if (ObjectUtils.isEmpty(preAlarmList.getContent())) {
|
|
|
+ AjaxResults1 = new AjaxResults(0, "预警内容不难为空");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isEmpty(preAlarmList.getDistance())) {
|
|
|
+ AjaxResults1 = new AjaxResults(0, "目标点离机车的距离不难为空");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isEmpty(preAlarmList.getLevel())) {
|
|
|
+ AjaxResults1 = new AjaxResults(0, "预警级别不难为空");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isEmpty(preAlarmList.getTargetType())) {
|
|
|
+ AjaxResults1 = new AjaxResults(0, "预警目标点类型不难为空");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ PreAlarm preAlarm = new PreAlarm();
|
|
|
+ preAlarm.setTrainId(preAlarmResponse.getTrainId());
|
|
|
+ preAlarm.setPreAlarmNum(preAlarmResponse.getPreAlarmNum());
|
|
|
+ preAlarm.setPreAlarmTime(new Date(preAlarmResponse.getPreAlarmTime()));
|
|
|
+ preAlarm.setPreAlarmType(preAlarmResponse.getPreAlarmType());
|
|
|
+ preAlarm.setPreAlarmList(JSON.toJSONString(preAlarmResponse.getPreAlarmList()));
|
|
|
+ if (preAlarmService.save(preAlarm)) {
|
|
|
+ AjaxResults1 = new AjaxResults(1, "ok");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
+ } else {
|
|
|
+ AjaxResults1 = new AjaxResults(0, "新增失败");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ AjaxResults1 = new AjaxResults(2, "token验证失败");
|
|
|
+ return JSONObject.toJSONString(AjaxResults1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("/test/{key}")
|
|
|
public void test(@PathVariable String key) {
|
|
|
String heartbeat = heartbeatUtils.getHeartbeat(key);
|