|
@@ -20,6 +20,7 @@ import com.ozs.entity.BaseCameraManagement;
|
|
|
import com.ozs.entity.BaseRailwayManagement;
|
|
|
import com.ozs.entity.BaseRouteMassage;
|
|
|
import com.ozs.entity.BaseTerminal;
|
|
|
+import com.ozs.entity.BaseTerminalLog;
|
|
|
import com.ozs.entity.BaseUser;
|
|
|
import com.ozs.entity.BaseVehicleTerminal;
|
|
|
import com.ozs.entity.MsgAlarm;
|
|
@@ -57,6 +58,7 @@ import com.ozs.mapper.SkynetHeartbeatLogMapper;
|
|
|
import com.ozs.service.BaseCameraManagementService;
|
|
|
import com.ozs.service.BaseRailwayManagementService;
|
|
|
import com.ozs.service.BaseRouteMassageService;
|
|
|
+import com.ozs.service.BaseTerminalLogService;
|
|
|
import com.ozs.service.BaseTerminalService;
|
|
|
import com.ozs.service.BaseUserService;
|
|
|
import com.ozs.service.BaseVehicleTerminalService;
|
|
@@ -163,10 +165,9 @@ public class GeoHazardMonitorTokenController {
|
|
|
@Autowired
|
|
|
private ISysDictTypeService dictTypeService;
|
|
|
@Resource
|
|
|
- private TerminalHeartbeatLogService terminalHeartbeatLogService;
|
|
|
+ private BaseTerminalLogService baseTerminalLogService;
|
|
|
@Autowired
|
|
|
private RedisCache redisCache;
|
|
|
-
|
|
|
/**
|
|
|
* 获取web访问令牌
|
|
|
*
|
|
@@ -1791,6 +1792,52 @@ public class GeoHazardMonitorTokenController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 车载心跳监测接口定义
|
|
|
+ */
|
|
|
+ @PostMapping("/api/terminal/heartbeatHeartbeat")
|
|
|
+ public String heartbeatHeartbeat(@RequestBody ParameterVo parameterVo, HttpServletRequest request) {
|
|
|
+ String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
|
+ log.info("token:{}", token);
|
|
|
+ log.info("parameterVo:{}", parameterVo);
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ if (StringUtils.isNotEmpty(token)) {
|
|
|
+ String[] split = token.split("-");
|
|
|
+ String key = split[split.length - 1];
|
|
|
+ if (ObjectUtils.isEmpty(parameterVo)) {
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
+ jsonObject.put("message", "parameterVo参数不能为空");
|
|
|
+ jsonObject.put("data", "");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
|
|
|
+ }
|
|
|
+ String s = SM4Utils.decryptData_ECB(parameterVo.getParameter(), key);
|
|
|
+ BaseTerminalLog baseTerminalLog = JSON.parseObject(s, BaseTerminalLog.class);
|
|
|
+ if (ObjectUtils.isEmpty(baseTerminalLog.getTerminalCode())) {
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
+ jsonObject.put("message", "终端编码不能为空");
|
|
|
+ jsonObject.put("data", "");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
|
|
|
+ }
|
|
|
+ if (baseTerminalLogService.save(baseTerminalLog)) {
|
|
|
+ jsonObject.put("resultCode", 1);
|
|
|
+ jsonObject.put("message", "ok");
|
|
|
+ jsonObject.put("data", "");
|
|
|
+ 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", "token验证失败");
|
|
|
+ jsonObject.put("data", "");
|
|
|
+ return JSONObject.toJSONString(jsonObject);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("/test/{key}")
|
|
|
public void test(@PathVariable String key) {
|
|
|
String heartbeat = heartbeatUtils.getHeartbeat(key);
|