|
@@ -35,6 +35,7 @@ import com.ozs.entity.VehiclePosition;
|
|
|
import com.ozs.entity.BaseVideoTrains;
|
|
|
import com.ozs.entity.response.PreAlarmListResponse;
|
|
|
import com.ozs.entity.response.PreAlarmResponse;
|
|
|
+import com.ozs.entity.response.VehicleVedioResponse;
|
|
|
import com.ozs.entity.vo.AlarmFilesVo;
|
|
|
import com.ozs.entity.vo.AlarmHeartbeatLog;
|
|
|
import com.ozs.entity.vo.AlarmInfoVo;
|
|
@@ -1736,8 +1737,23 @@ public class GeoHazardMonitorTokenController {
|
|
|
AjaxResults1 = new AjaxResults(0, "终端编码不能为空");
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
}
|
|
|
- if (baseTerminalLogService.save(baseTerminalLog)) {
|
|
|
- AjaxResults1 = new AjaxResults(1, "ok");
|
|
|
+ BaseTerminal baseTerminal1 = new BaseTerminal();
|
|
|
+ baseTerminal1.setTerminalLatitude(baseTerminalLog.getTerminalLatitude());
|
|
|
+ baseTerminal1.setTerminalLongitude(baseTerminalLog.getTerminalLongitude());
|
|
|
+ baseTerminal1.setStatus(1);
|
|
|
+ LambdaQueryWrapper<BaseTerminal> terminal = new LambdaQueryWrapper<>();
|
|
|
+ terminal.eq(BaseTerminal::getTerminalCode, baseTerminalLog.getTerminalCode());
|
|
|
+ boolean update = baseTerminalService.update(baseTerminal1, terminal);
|
|
|
+ if (baseTerminalLogService.save(baseTerminalLog) && update) {
|
|
|
+ if (!ObjectUtils.isEmpty(baseTerminalLog.getTrainNum())&&!ObjectUtils.isEmpty(baseTerminalLog.getFrontTrainNum())){
|
|
|
+ VehiclePosition vehiclePosition = vehiclePositionService.getOne(new LambdaQueryWrapper<VehiclePosition>().eq(VehiclePosition::getVehicleCode, baseTerminalLog.getTrainNum()).orderByDesc(VehiclePosition::getCreateTime).last("limit 1"));
|
|
|
+ VehiclePosition positionServiceOne = vehiclePositionService.getOne(new LambdaQueryWrapper<VehiclePosition>().eq(VehiclePosition::getVehicleCode, baseTerminalLog.getFrontTrainNum()).orderByDesc(VehiclePosition::getCreateTime).last("limit 1"));
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("frontVehicleDistance", vehiclePosition.getTravelMile()-positionServiceOne.getTravelMile());
|
|
|
+ AjaxResults1 = new AjaxResults(1, "ok", map);
|
|
|
+ }else {
|
|
|
+ AjaxResults1 = new AjaxResults(1, "ok");
|
|
|
+ }
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
} else {
|
|
|
AjaxResults1 = new AjaxResults(0, "新增失败");
|
|
@@ -1749,6 +1765,60 @@ public class GeoHazardMonitorTokenController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取机车前向摄像机视频
|
|
|
+ */
|
|
|
+ @PostMapping("/api/vehicle/vedio")
|
|
|
+ public String vehicleVedio(@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);
|
|
|
+ VehicleVedioResponse vehicleVedioResponse = JSON.parseObject(s, VehicleVedioResponse.class);
|
|
|
+ if (ObjectUtils.isEmpty(vehicleVedioResponse.getTerminalCode())) {
|
|
|
+ AjaxResults1 = new AjaxResults(0, "终端编码不能为空");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isEmpty(vehicleVedioResponse.getTrainNum())) {
|
|
|
+ AjaxResults1 = new AjaxResults(0, "车号不能为空");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
+ }
|
|
|
+ BaseCameraManagement baseCameraManagement = baseCameraManagementService.getOne(new LambdaQueryWrapper<BaseCameraManagement>().eq(BaseCameraManagement::getTrainNum, vehicleVedioResponse.getTrainNum()));
|
|
|
+ if (!ObjectUtils.isEmpty(baseCameraManagement)) {
|
|
|
+// CompletableFuture.runAsync(() -> {
|
|
|
+// String playFlv = cameraUtil.heartbeatgetPlayFlv(baseCameraManagement.getCameraCode(), baseCameraManagement.getGraphicsCard(), true);
|
|
|
+// log.info("-------playFlv--------" + playFlv);
|
|
|
+// if (StringUtils.isEmpty(playFlv)) {
|
|
|
+// try {
|
|
|
+// cameraUtil.heartbeatgetUrl(baseCameraManagement.getCameraCode(), baseCameraManagement.getGraphicsCard(),true, httpUrl);
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// }
|
|
|
+// });
|
|
|
+ CameraVos cameraVos = new CameraVos();
|
|
|
+ cameraVos.setCameraCode(baseCameraManagement.getCameraCode());
|
|
|
+ cameraVos.setCurrentStream("1111");
|
|
|
+ AjaxResults1 = new AjaxResults(1, "ok",cameraVos);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 预警信息接口定义
|