|
@@ -12,6 +12,7 @@ import com.ozs.common.utils.HeartbeatUtils;
|
|
|
import com.ozs.common.utils.HttpClientUtil;
|
|
|
import com.ozs.common.utils.IgnoreUtils;
|
|
|
import com.ozs.common.utils.StringUtils;
|
|
|
+import com.ozs.common.utils.http.HttpUtils;
|
|
|
import com.ozs.common.utils.stateSecrets.SM4Utils;
|
|
|
import com.ozs.config.AjaxResults;
|
|
|
import com.ozs.config.Constant;
|
|
@@ -287,17 +288,23 @@ public class GeoHazardMonitorTokenController {
|
|
|
|
|
|
LambdaQueryWrapper<BaseCameraManagement> wrapper = new LambdaQueryWrapper<BaseCameraManagement>();
|
|
|
if (!ObjectUtils.isEmpty(reqMsgAlarmVo.getAlarmMile())) {
|
|
|
- wrapper.le(BaseCameraManagement::getBeginMile, reqMsgAlarmVo.getAlarmMile());
|
|
|
- wrapper.ge(BaseCameraManagement::getEndMile, reqMsgAlarmVo.getAlarmMile());
|
|
|
+ if (reqMsgAlarmVo.getLineDir() == 1) {
|
|
|
+ wrapper.ge(BaseCameraManagement::getEndMile, reqMsgAlarmVo.getAlarmMile());
|
|
|
+ wrapper.le(BaseCameraManagement::getBeginMile, reqMsgAlarmVo.getAlarmMile());
|
|
|
+ wrapper.in(BaseCameraManagement::getMonitoringDirection, 1, 3);
|
|
|
+ wrapper.orderByAsc(BaseCameraManagement::getInstallMile);
|
|
|
+ }
|
|
|
+ if (reqMsgAlarmVo.getLineDir() == 2) {
|
|
|
+ wrapper.ge(BaseCameraManagement::getEndMile, reqMsgAlarmVo.getAlarmMile());
|
|
|
+ wrapper.le(BaseCameraManagement::getBeginMile, reqMsgAlarmVo.getAlarmMile());
|
|
|
+ wrapper.in(BaseCameraManagement::getMonitoringDirection, 2, 3);
|
|
|
+ wrapper.orderByDesc(BaseCameraManagement::getInstallMile);
|
|
|
+ }
|
|
|
wrapper.eq(BaseCameraManagement::getRailwayCode, reqMsgAlarmVo.getAlarmRailway());
|
|
|
+ wrapper.eq(BaseCameraManagement::getOnline, 2);
|
|
|
wrapper.eq(BaseCameraManagement::getEnableOrNot, 1);
|
|
|
}
|
|
|
List<BaseCameraManagement> baseCameraManagementList = baseCameraManagementService.list(wrapper);
|
|
|
- //log.info("baseCameraManagement:{}", baseCameraManagementList);
|
|
|
- if (baseCameraManagementList.size() <= 0) {
|
|
|
- AjaxResults1 = new AjaxResults(0, "报警里程位置没有可用的相机!!!");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
- }
|
|
|
LambdaQueryWrapper<MsgAlarm> lw = new LambdaQueryWrapper<MsgAlarm>();
|
|
|
if (!ObjectUtils.isEmpty(reqMsgAlarmVo.getAlarmId())) {
|
|
|
lw.eq(MsgAlarm::getAlarmId, reqMsgAlarmVo.getAlarmId());
|
|
@@ -343,15 +350,39 @@ public class GeoHazardMonitorTokenController {
|
|
|
msgAlarmVice.setAlarmTime(new Date(reqMsgAlarmVo.getAlarmTime()));
|
|
|
msgAlarmFrequencyService.save(msgAlarmVice);
|
|
|
|
|
|
- //log.info("alarmJSON :{}", JSON.toJSONString(msgAlarm));
|
|
|
- //log.info("->>>>>>>>>>>>>>>>>>>>>>>>>>" + msgAlarm);
|
|
|
+ log.info("alarmJSON :{}", JSON.toJSONString(msgAlarm));
|
|
|
+ log.info("->>>>>>>>>>>>>>>>>>>>>>>>>>" + msgAlarm);
|
|
|
String result = HttpClientUtil.postJson(sdkUrl, JSON.toJSONString(msgAlarm));
|
|
|
- //log.info("->>>>>>>>>>>>>>>>>>>>>>>>>>>>" + result);
|
|
|
- //log.info("result:{}", result);
|
|
|
-
|
|
|
- List<String> collect = baseCameraManagementList.stream().map(BaseCameraManagement::getCameraCode).collect(Collectors.toList());
|
|
|
- List<SysDictData> data = dictTypeService.selectDictDataByType("alarm_play_time_value");
|
|
|
- CompletableFuture.runAsync(() -> cameraUtil.playbackURLs(collect, data.get(0).getDictValue()));
|
|
|
+ log.info("->>>>>>>>>>>>>>>>>>>>>>>>>>>>" + result);
|
|
|
+ log.info("result:{}", result);
|
|
|
+ if (!ObjectUtils.isEmpty(baseCameraManagementList)) {
|
|
|
+ int minDifference = Integer.MAX_VALUE;
|
|
|
+ String code = null;
|
|
|
+ for (BaseCameraManagement baseCameraManagement : baseCameraManagementList) {
|
|
|
+ int difference = Math.abs(baseCameraManagement.getInstallMile() - reqMsgAlarmVo.getAlarmMile());
|
|
|
+ if (difference < minDifference) {
|
|
|
+ minDifference = difference;
|
|
|
+ code = baseCameraManagement.getCameraCode();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<SysDictData> frontValue = dictTypeService.selectDictDataByType("alarm_play_time_front_value");
|
|
|
+ List<SysDictData> laterValue = dictTypeService.selectDictDataByType("alarm_play_time_later_value");
|
|
|
+ String finalCode = code;
|
|
|
+ CompletableFuture.runAsync(() -> {
|
|
|
+ String records = CameraUtil.getPlayFlvRtsp(finalCode, baseCameraManagementList.get(0).getChannel(),true);
|
|
|
+ log.info("-----records-----------" + records);
|
|
|
+ MsgAlarm alarm1 = msgAlarmService.getById(msgAlarm.getId());
|
|
|
+ alarm1.setReleasedUrl(records);
|
|
|
+ msgAlarmService.updateById(alarm1);
|
|
|
+ });
|
|
|
+// String url = future.get();
|
|
|
+// if (url.contains("无视频")) {
|
|
|
+// jsonObject.put("resultCode", 0);
|
|
|
+// jsonObject.put("message", url);
|
|
|
+// return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
|
|
|
+// }else {
|
|
|
+// }
|
|
|
+ }
|
|
|
} else {
|
|
|
BeanUtils.copyProperties(reqMsgAlarmVo, msgAlarmVice);
|
|
|
msgAlarmVice.setCreateBy(admin.getUserId());
|
|
@@ -1142,6 +1173,34 @@ public class GeoHazardMonitorTokenController {
|
|
|
twoMap.put("cameraCode", list1.get(0).getCameraCode());
|
|
|
respHeartbeatVo.setIsAlarm(2);
|
|
|
}
|
|
|
+ //赋值--股道
|
|
|
+ List<BaseRouteMassage> baseRouteMassageList = baseRouteMassageService.list();
|
|
|
+ if (!ObjectUtils.isEmpty(baseRouteMassageList)) {
|
|
|
+ for (BaseRouteMassage baseRouteMassage : baseRouteMassageList) {
|
|
|
+ if (heartbeatVo.getLineDir() == 1) {
|
|
|
+ if (baseRouteMassage.getMileagePosition() - heartbeatVo.getCurrentMile() <= 1500 && baseRouteMassage.getMileagePosition() - heartbeatVo.getCurrentMile() >= 0) {
|
|
|
+ respHeartbeatVo.setRouteTrack(baseRouteMassage.getRouteStationTrack().toString());
|
|
|
+ respHeartbeatVo.setStationCode(baseRouteMassage.getStationCode());
|
|
|
+ break;
|
|
|
+ } else {
|
|
|
+ respHeartbeatVo.setRouteTrack("");
|
|
|
+ respHeartbeatVo.setStationCode("");
|
|
|
+ }
|
|
|
+ } else if (heartbeatVo.getLineDir() == 2) {
|
|
|
+ if (heartbeatVo.getCurrentMile() - baseRouteMassage.getMileagePosition() <= 1500 && heartbeatVo.getCurrentMile() - baseRouteMassage.getMileagePosition() >= 0) {
|
|
|
+ respHeartbeatVo.setRouteTrack(baseRouteMassage.getRouteStationTrack().toString());
|
|
|
+ respHeartbeatVo.setStationCode(baseRouteMassage.getStationCode());
|
|
|
+ break;
|
|
|
+ } else {
|
|
|
+ respHeartbeatVo.setRouteTrack("");
|
|
|
+ respHeartbeatVo.setStationCode("");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ respHeartbeatVo.setRouteTrack("");
|
|
|
+ respHeartbeatVo.setStationCode("");
|
|
|
+ }
|
|
|
twoMap.put("visualDistance", heartbeatVo.getVisualDistance().toString());
|
|
|
String string = JSON.toJSONString(twoMap);
|
|
|
baseVideoTrainsService.save(baseVideoTrains);
|
|
@@ -1260,9 +1319,15 @@ public class GeoHazardMonitorTokenController {
|
|
|
wrapper.eq(BaseCameraManagement::getRailwayCode, cameraVo.getRailwayCode())
|
|
|
.and(w1 -> w1.eq(BaseCameraManagement::getMonitoringDirection, cameraVo.getLineDir())
|
|
|
.or(w2 -> w2.eq(BaseCameraManagement::getMonitoringDirection, 3)));
|
|
|
+ wrapper.eq(BaseCameraManagement::getEnableOrNot, 1);
|
|
|
+ if (cameraVo.getLineDir() == 1) {
|
|
|
+ wrapper.orderByAsc(BaseCameraManagement::getGrou).orderByAsc(BaseCameraManagement::getSort);
|
|
|
+ } else {
|
|
|
+ wrapper.orderByDesc(BaseCameraManagement::getGrou).orderByDesc(BaseCameraManagement::getSort);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ wrapper.orderByAsc(BaseCameraManagement::getGrou).orderByAsc(BaseCameraManagement::getSort);
|
|
|
}
|
|
|
- wrapper.eq(BaseCameraManagement::getEnableOrNot, 1);
|
|
|
- wrapper.orderByAsc(BaseCameraManagement::getInstallMile);
|
|
|
List<BaseCameraManagement> list = baseCameraManagementService.list(wrapper);
|
|
|
if (list.size() <= 0) {
|
|
|
AjaxResults1 = new AjaxResults(0, "没有该线路编码或行别的相机信息");
|
|
@@ -1342,21 +1407,22 @@ public class GeoHazardMonitorTokenController {
|
|
|
}
|
|
|
LambdaQueryWrapper<BaseCameraManagement> lw = new LambdaQueryWrapper<BaseCameraManagement>();
|
|
|
lw.eq(BaseCameraManagement::getCameraCode, cameraPlayVo.getCameraCode());
|
|
|
+ lw.eq(BaseCameraManagement::getOnline, 2);
|
|
|
lw.eq(BaseCameraManagement::getEnableOrNot, 1);
|
|
|
BaseCameraManagement one = baseCameraManagementService.getOne(lw);
|
|
|
if (ObjectUtils.isEmpty(one)) {
|
|
|
AjaxResults1 = new AjaxResults(0, "没有该相机编码的相机或已离线");
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
}
|
|
|
- //获取视频点播地址
|
|
|
- CamerasVo camerasVo = new CamerasVo();
|
|
|
- camerasVo.setStreamType(0);
|
|
|
- camerasVo.setCameraIndexCode(one.getCameraCode());
|
|
|
- String playFlv = cameraUtil.apiPreviewURLs(camerasVo);
|
|
|
- if ("1".equals(playFlv)) {
|
|
|
- AjaxResults1 = new AjaxResults(0, "天网实时流接口调用失败");
|
|
|
+ String playFlv = CameraUtil.getPlayFlvRtsp(one.getCameraCode(), one.getChannel(), false);
|
|
|
+ if (playFlv.contains("无视频")) {
|
|
|
+ AjaxResults1 = new AjaxResults(0, playFlv);
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
}
|
|
|
+ ArrayList<String> list3 = new ArrayList<>();
|
|
|
+ String code = one.getCameraCode() + "/" + one.getChannel();
|
|
|
+ list3.add(code);
|
|
|
+ log.info("--------------cameraPlay--------------:" + list3);
|
|
|
map.put("url", playFlv);
|
|
|
AjaxResults1 = new AjaxResults(1, "ok", map);
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
@@ -1459,6 +1525,8 @@ public class GeoHazardMonitorTokenController {
|
|
|
alarmInfoVo1.setAlarmTime(msgAlarm.getAlarmTime().getTime());
|
|
|
alarmInfoVo1.setAlarmType(msgAlarm.getAlarmType());
|
|
|
alarmInfoVo1.setAlarmLevel(msgAlarm.getAlarmLevel());
|
|
|
+ alarmInfoVo1.setLineDirStr(msgAlarm.getLineDir() == 1 ? "上行" : "下行");
|
|
|
+ alarmInfoVo1.setIsRelease(msgAlarm.getIsRelease());
|
|
|
LambdaQueryWrapper<MsgAlarmExt> alarm = new LambdaQueryWrapper<>();
|
|
|
alarm.eq(MsgAlarmExt::getAlarmId, msgAlarm.getAlarmId());
|
|
|
List<MsgAlarmExt> list1 = msgAlarmExtService.list(alarm);
|
|
@@ -1524,24 +1592,9 @@ public class GeoHazardMonitorTokenController {
|
|
|
AjaxResults1 = new AjaxResults(0, "没有该报警唯一UUID的报警数据");
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
} else {
|
|
|
- if (ObjectUtils.isEmpty(one.getReleasedUrl())) {
|
|
|
- //获取报警里程所监控的所有相机
|
|
|
- LambdaQueryWrapper<BaseCameraManagement> camera = new LambdaQueryWrapper<BaseCameraManagement>();
|
|
|
- camera.le(BaseCameraManagement::getBeginMile, one.getAlarmMile());
|
|
|
- camera.ge(BaseCameraManagement::getEndMile, one.getAlarmMile());
|
|
|
- camera.eq(BaseCameraManagement::getLineDir, one.getLineDir());
|
|
|
- camera.orderByAsc(BaseCameraManagement::getInstallMile);
|
|
|
- camera.eq(BaseCameraManagement::getEnableOrNot, 1);
|
|
|
- List<BaseCameraManagement> baseCameraManagementList = baseCameraManagementService.list(camera);
|
|
|
- if (baseCameraManagementList.size() > 0) {
|
|
|
- BaseCameraManagement baseCameraManagement = baseCameraManagementList.get(0);
|
|
|
- String url = cameraUtil.streamConversion(baseCameraManagement.getCameraCode());
|
|
|
- one.setReleasedUrl(url);
|
|
|
- msgAlarmService.updateById(one);
|
|
|
- } else {
|
|
|
- AjaxResults1 = new AjaxResults(0, "没有该报警里程位置的相机");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
- }
|
|
|
+ if (StringUtils.isEmpty(one.getReleasedUrl())) {
|
|
|
+ AjaxResults1 = new AjaxResults(0, "该报警还未生成报警回放视频");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
|
|
|
}
|
|
|
}
|
|
|
map.put("url", one.getReleasedUrl());
|