|
@@ -20,6 +20,7 @@ import com.ozs.entity.MsgAlarm;
|
|
|
import com.ozs.entity.MsgAlarmExt;
|
|
|
import com.ozs.entity.MsgAlarmFrequency;
|
|
|
import com.ozs.entity.SvcAddress;
|
|
|
+import com.ozs.entity.SkynetHeartbeatLog;
|
|
|
import com.ozs.entity.TerminalIgnoreAlarm;
|
|
|
import com.ozs.entity.VehiclePosition;
|
|
|
import com.ozs.entity.vo.AlarmFilesVo;
|
|
@@ -37,9 +38,10 @@ import com.ozs.entity.vo.RespAlarmList;
|
|
|
import com.ozs.entity.vo.RespCameraVo;
|
|
|
import com.ozs.entity.vo.RespGeoHazardMonitorVo;
|
|
|
import com.ozs.entity.vo.RespHeartbeatVo;
|
|
|
-import com.ozs.entity.vo.RespMsgAlarmVo;
|
|
|
+import com.ozs.entity.vo.SkynetHeartbeatVo;
|
|
|
import com.ozs.entity.vo.TerminalIgnoreVo;
|
|
|
import com.ozs.framework.config.ServerConfig;
|
|
|
+import com.ozs.mapper.SkynetHeartbeatLogMapper;
|
|
|
import com.ozs.service.BaseCameraManagementService;
|
|
|
import com.ozs.service.BaseRailwayManagementService;
|
|
|
import com.ozs.service.BaseVehicleTerminalService;
|
|
@@ -132,6 +134,8 @@ public class GeoHazardMonitorTokenController {
|
|
|
private SysUserMapper sysUserMapper;
|
|
|
@Autowired
|
|
|
WebSocketCommon webSocketCommon;
|
|
|
+ @Resource
|
|
|
+ private SkynetHeartbeatLogMapper synetHeartbeatLogMapper;
|
|
|
@Value("${base.env}")
|
|
|
private String env;
|
|
|
|
|
@@ -1151,6 +1155,85 @@ public class GeoHazardMonitorTokenController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 天网相机心跳监测接口定义
|
|
|
+ */
|
|
|
+ @PostMapping("/api/skynet/heartbeat")
|
|
|
+ @Transactional
|
|
|
+ public String skynetHeartbeat(@RequestBody ParameterVo parameterVo, HttpServletRequest request) {
|
|
|
+ String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
|
+ log.info("token:{}", token);
|
|
|
+ log.info("parameter:{}", parameterVo);
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ if (StringUtils.isNotEmpty(token)) {
|
|
|
+ String[] split = token.split("-");
|
|
|
+ String key = split[split.length - 1];
|
|
|
+ String s = SM4Utils.decryptData_ECB(parameterVo.getParameter(), key);
|
|
|
+ SkynetHeartbeatVo skynetHeartbeatVo = JSON.parseObject(s, SkynetHeartbeatVo.class);
|
|
|
+ if (ObjectUtils.isEmpty(skynetHeartbeatVo.getRailwayCode())) {
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
+ jsonObject.put("data", "线路编码不能为空");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isEmpty(skynetHeartbeatVo.getLineDir())) {
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
+ jsonObject.put("data", "行别不能为空");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
|
|
|
+ }
|
|
|
+ if (skynetHeartbeatVo.getLineDir() != 1 && skynetHeartbeatVo.getLineDir() != 2) {
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
+ jsonObject.put("data", "行别填写错误");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isEmpty(skynetHeartbeatVo.getInstallMile())) {
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
+ jsonObject.put("data", "安装里程位置不能为空");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
|
|
|
+ }
|
|
|
+ if (!skynetHeartbeatVo.getInstallMile().toString().matches(PATTERNS)) {
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
+ jsonObject.put("data", "里程位置填写错误,只能填写数字");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isEmpty(skynetHeartbeatVo.getCameraCode())) {
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
+ jsonObject.put("data", "相机编码不能为空");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
|
|
|
+ }
|
|
|
+ SkynetHeartbeatLog skynetHeartbeatLog =new SkynetHeartbeatLog();
|
|
|
+ skynetHeartbeatLog.setCameraCode(skynetHeartbeatVo.getCameraCode());
|
|
|
+ skynetHeartbeatLog.setInstallMile(skynetHeartbeatVo.getInstallMile());
|
|
|
+ skynetHeartbeatLog.setRailwayCode(skynetHeartbeatVo.getRailwayCode());
|
|
|
+ skynetHeartbeatLog.setLineDir(skynetHeartbeatVo.getLineDir());
|
|
|
+ if (synetHeartbeatLogMapper.insert(skynetHeartbeatLog)>0){
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("cameraCode", skynetHeartbeatVo.getCameraCode());
|
|
|
+ jsonObject.put("resultCode", 1);
|
|
|
+ jsonObject.put("message", "ok");
|
|
|
+ jsonObject.put("data", map);
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
|
|
|
+ }else {
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
+ jsonObject.put("data", "新增失败");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ jsonObject.put("resultCode", 2);
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
+ jsonObject.put("data", "token验证失败");
|
|
|
+ return JSONObject.toJSONString(jsonObject);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("/test/{key}")
|
|
|
public void test(@PathVariable String key) {
|
|
|
String heartbeat = heartbeatUtils.getHeartbeat(key);
|
|
@@ -1180,10 +1263,10 @@ public class GeoHazardMonitorTokenController {
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
JSONObject res = new JSONObject();
|
|
|
- res.put("alarmId", "42010001541320001115");
|
|
|
- res.put("releaseTime", 1681200512L);
|
|
|
- res.put("releaseContent", "已处理");
|
|
|
- res.put("operator", 1);
|
|
|
+ res.put("railwayCode", "SHTL");
|
|
|
+ res.put("lineDir", 1);
|
|
|
+ res.put("cameraCode", "42010001541320000023");
|
|
|
+ res.put("installMile", 3000);
|
|
|
String s = SM4Utils.encryptData_ECB(JSONObject.toJSONString(res), "4370780c9a8c43e5");
|
|
|
System.out.println(s);
|
|
|
}
|