|
@@ -35,6 +35,7 @@ import com.ozs.entity.TerminalIgnoreAlarm;
|
|
import com.ozs.entity.VehiclePosition;
|
|
import com.ozs.entity.VehiclePosition;
|
|
import com.ozs.entity.response.PreAlarmListResponse;
|
|
import com.ozs.entity.response.PreAlarmListResponse;
|
|
import com.ozs.entity.response.PreAlarmResponse;
|
|
import com.ozs.entity.response.PreAlarmResponse;
|
|
|
|
+import com.ozs.entity.response.VehicleVedioResponse;
|
|
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;
|
|
@@ -2230,6 +2231,13 @@ public class GeoHazardMonitorTokenController {
|
|
terminal.eq(BaseTerminal::getTerminalCode, baseTerminalLog.getTerminalCode());
|
|
terminal.eq(BaseTerminal::getTerminalCode, baseTerminalLog.getTerminalCode());
|
|
boolean update = baseTerminalService.update(baseTerminal1, terminal);
|
|
boolean update = baseTerminalService.update(baseTerminal1, terminal);
|
|
if (baseTerminalLogService.save(baseTerminalLog) && update) {
|
|
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);
|
|
|
|
+ }
|
|
AjaxResults1 = new AjaxResults(1, "ok");
|
|
AjaxResults1 = new AjaxResults(1, "ok");
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
} else {
|
|
} else {
|
|
@@ -2242,6 +2250,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(CameraUtil.getPlayFlvRtsp(baseCameraManagement.getCameraCode(), baseCameraManagement.getGraphicsCard(), true, httpUrl));
|
|
|
|
+ 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);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* 预警信息接口定义
|
|
* 预警信息接口定义
|