|
@@ -25,10 +25,12 @@ import com.ozs.entity.MsgAlarm;
|
|
import com.ozs.entity.MsgAlarmExt;
|
|
import com.ozs.entity.MsgAlarmExt;
|
|
import com.ozs.entity.MsgAlarmFrequency;
|
|
import com.ozs.entity.MsgAlarmFrequency;
|
|
import com.ozs.entity.MsgHeartbeatAlarmMessage;
|
|
import com.ozs.entity.MsgHeartbeatAlarmMessage;
|
|
|
|
+import com.ozs.entity.PreAlarm;
|
|
import com.ozs.entity.SkynetHeartbeatLog;
|
|
import com.ozs.entity.SkynetHeartbeatLog;
|
|
import com.ozs.entity.SvcAddress;
|
|
import com.ozs.entity.SvcAddress;
|
|
import com.ozs.entity.TerminalIgnoreAlarm;
|
|
import com.ozs.entity.TerminalIgnoreAlarm;
|
|
import com.ozs.entity.VehiclePosition;
|
|
import com.ozs.entity.VehiclePosition;
|
|
|
|
+import com.ozs.entity.response.PreAlarmResponse;
|
|
import com.ozs.entity.vo.AlarmFilesVo;
|
|
import com.ozs.entity.vo.AlarmFilesVo;
|
|
import com.ozs.entity.vo.AlarmHeartbeatLog;
|
|
import com.ozs.entity.vo.AlarmHeartbeatLog;
|
|
import com.ozs.entity.vo.AlarmInfoVo;
|
|
import com.ozs.entity.vo.AlarmInfoVo;
|
|
@@ -61,6 +63,7 @@ import com.ozs.service.BaseVehicleTerminalService;
|
|
import com.ozs.service.MsgAlarmExtService;
|
|
import com.ozs.service.MsgAlarmExtService;
|
|
import com.ozs.service.MsgAlarmFrequencyService;
|
|
import com.ozs.service.MsgAlarmFrequencyService;
|
|
import com.ozs.service.MsgAlarmService;
|
|
import com.ozs.service.MsgAlarmService;
|
|
|
|
+import com.ozs.service.PreAlarmService;
|
|
import com.ozs.service.SvcAddressService;
|
|
import com.ozs.service.SvcAddressService;
|
|
import com.ozs.service.TerminalIgnoreAlarmService;
|
|
import com.ozs.service.TerminalIgnoreAlarmService;
|
|
import com.ozs.service.VehiclePositionService;
|
|
import com.ozs.service.VehiclePositionService;
|
|
@@ -152,6 +155,8 @@ public class GeoHazardMonitorTokenController {
|
|
private ISysDictTypeService dictTypeService;
|
|
private ISysDictTypeService dictTypeService;
|
|
@Resource
|
|
@Resource
|
|
private BaseTerminalLogService baseTerminalLogService;
|
|
private BaseTerminalLogService baseTerminalLogService;
|
|
|
|
+ @Resource
|
|
|
|
+ private PreAlarmService preAlarmService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取web访问令牌
|
|
* 获取web访问令牌
|
|
@@ -1296,6 +1301,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}")
|
|
@GetMapping("/test/{key}")
|
|
public void test(@PathVariable String key) {
|
|
public void test(@PathVariable String key) {
|
|
String heartbeat = heartbeatUtils.getHeartbeat(key);
|
|
String heartbeat = heartbeatUtils.getHeartbeat(key);
|