|
@@ -4,7 +4,6 @@ import com.alibaba.fastjson2.JSON;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.ozs.common.core.domain.entity.SysDictData;
|
|
|
-import com.ozs.common.core.redis.RedisCache;
|
|
|
import com.ozs.common.utils.ApiTokenUtils;
|
|
|
import com.ozs.common.utils.AppendUtils;
|
|
|
import com.ozs.common.utils.ChineseToPingyin;
|
|
@@ -18,6 +17,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;
|
|
@@ -53,6 +53,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;
|
|
@@ -62,7 +63,6 @@ import com.ozs.service.MsgAlarmService;
|
|
|
import com.ozs.service.SvcAddressService;
|
|
|
import com.ozs.service.TerminalIgnoreAlarmService;
|
|
|
import com.ozs.service.VehiclePositionService;
|
|
|
-import com.ozs.system.service.ISysDictDataService;
|
|
|
import com.ozs.system.service.ISysDictTypeService;
|
|
|
import com.ozs.utils.CameraUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -80,7 +80,6 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
-import java.io.IOException;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.ArrayList;
|
|
@@ -150,6 +149,8 @@ public class GeoHazardMonitorTokenController {
|
|
|
private String sdkUrl;
|
|
|
@Autowired
|
|
|
private ISysDictTypeService dictTypeService;
|
|
|
+ @Resource
|
|
|
+ private BaseTerminalLogService baseTerminalLogService;
|
|
|
|
|
|
/**
|
|
|
* 获取web访问令牌
|
|
@@ -1451,6 +1452,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);
|