|
@@ -149,6 +149,8 @@ public class GeoHazardMonitorTokenController {
|
|
|
private ISysDictTypeService dictTypeService;
|
|
|
@Resource
|
|
|
private TerminalHeartbeatLogService terminalHeartbeatLogService;
|
|
|
+ @Autowired
|
|
|
+ private RedisCache redisCache;
|
|
|
|
|
|
/**
|
|
|
* 获取web访问令牌
|
|
@@ -843,53 +845,75 @@ public class GeoHazardMonitorTokenController {
|
|
|
//判断流媒体是否有流
|
|
|
String playFlv = cameraUtil.heartbeatgetPlayFlv(list1.get(0).getCameraCode(), list1.get(0).getChannel(), type);
|
|
|
log.info("playFlv------------>" + playFlv);
|
|
|
- //拉四路视频
|
|
|
+ //拉两路视频
|
|
|
if (StringUtils.isEmpty(playFlv)) {
|
|
|
- log.info("--------------->>已进入拉四路视频");
|
|
|
+ log.info("--------------->>已进入拉两路视频");
|
|
|
for (BaseCameraManagement baseCameraManagement : list1) {
|
|
|
boolean finalType = type;
|
|
|
CompletableFuture.runAsync(() -> {
|
|
|
cameraUtil.heartbeatgetUrl(baseCameraManagement.getCameraCode(), baseCameraManagement.getChannel(), finalType);
|
|
|
});
|
|
|
- //添加心跳相机日志信息
|
|
|
- int add3 = terminalHeartbeatLogService.add(baseCameraManagement.getCameraCode(), baseCameraManagement.getChannel());
|
|
|
- log.info("-----add3----" + add3);
|
|
|
+// //添加心跳相机日志信息
|
|
|
+// int add3 = terminalHeartbeatLogService.add(baseCameraManagement.getCameraCode(), baseCameraManagement.getChannel());
|
|
|
+// log.info("-----add3----" + add3);
|
|
|
}
|
|
|
- List<String> finalCodeList4 = codeList;
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
- //判断心跳相机日志表后两条数据是否包含该相机编码
|
|
|
- if (!ObjectUtils.isEmpty(finalCodeList4)) {
|
|
|
- if (!finalCodeList4.contains(list1.get(0).getCameraCode())) {
|
|
|
- //如果不包含此相机编码
|
|
|
- for (TerminalHeartbeatLog terminalHeartbeatLog : heartbeatLogList) {
|
|
|
- log.info("-----44444444----");
|
|
|
- cameraUtil.stopStream(terminalHeartbeatLog.getCameraCode(), terminalHeartbeatLog.getChannel());
|
|
|
- }
|
|
|
+ //获取缓冲
|
|
|
+ String code = redisCache.getCacheObject("heartbeat");
|
|
|
+ if (StringUtils.isNotEmpty(code)) {
|
|
|
+ log.info("--------------code--------------:" + code);
|
|
|
+ List<String> stringList = JSON.parseArray(code, List.class);
|
|
|
+ log.info("--------------list--------------:" + stringList);
|
|
|
+ List<String> rtspApiList = cameraUtil.rtspApiList();
|
|
|
+ log.info("--------------rtspApiList1111--------------:" + rtspApiList);
|
|
|
+ if (!ObjectUtils.isEmpty(rtspApiList)) {
|
|
|
+ rtspApiList.removeAll(stringList);
|
|
|
+ }
|
|
|
+ log.info("--------------rtspApiList2222--------------:" + rtspApiList);
|
|
|
+ if (!ObjectUtils.isEmpty(rtspApiList)) {
|
|
|
+ for (String str : rtspApiList) {
|
|
|
+ log.info("--------------str--------------:" + str);
|
|
|
+ String[] parts = str.split("/");
|
|
|
+ log.info("--------------parts--------------:" + parts);
|
|
|
+ cameraUtil.stopStream(parts[0], parts[1]);
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
+ }
|
|
|
+ //添加缓存
|
|
|
+ log.info("--------------heartbeat--------------:" + list1.stream().map(BaseCameraManagement::getCameraCode).collect(Collectors.toList()));
|
|
|
+ redisCache.setCacheObject("heartbeat", list1.stream().map(BaseCameraManagement::getCameraCode).collect(Collectors.toList()));
|
|
|
} else {
|
|
|
- log.info("-------------->>已进入拉三路路视频");
|
|
|
+ log.info("-------------->>已进入拉一路视频");
|
|
|
log.info("list1-------------->>" + list1.size());
|
|
|
for (int i = 1; i < list1.size(); i++) {
|
|
|
cameraUtil.heartbeatgetUrl(list1.get(i).getCameraCode(), list1.get(i).getChannel(), type);
|
|
|
- //添加心跳相机日志信息
|
|
|
- int add4 = terminalHeartbeatLogService.add(list1.get(i).getCameraCode(), list1.get(i).getChannel());
|
|
|
- log.info("-----add4----" + add4);
|
|
|
+// //添加心跳相机日志信息
|
|
|
+// int add4 = terminalHeartbeatLogService.add(list1.get(i).getCameraCode(), list1.get(i).getChannel());
|
|
|
+// log.info("-----add4----" + add4);
|
|
|
}
|
|
|
- log.info("-------------->>finalCodeList5-------" + codeList);
|
|
|
- if (!ObjectUtils.isEmpty(codeList)) {
|
|
|
- //判断心跳相机日志表后两条数据是否包含该相机编码
|
|
|
- log.info("-------------->>baseCameraManagement.getCameraCode()-------" + list1.get(0).getCameraCode());
|
|
|
- if (!codeList.contains(list1.get(0).getCameraCode())) {
|
|
|
- //如果不包含此相机编码
|
|
|
- log.info("-------------->>heartbeatLogList-------" + heartbeatLogList);
|
|
|
- for (TerminalHeartbeatLog terminalHeartbeatLog : heartbeatLogList) {
|
|
|
- log.info("-----5555555----");
|
|
|
- cameraUtil.stopStream(terminalHeartbeatLog.getCameraCode(), terminalHeartbeatLog.getChannel());
|
|
|
+ //获取缓冲
|
|
|
+ String code = redisCache.getCacheObject("heartbeat");
|
|
|
+ if (StringUtils.isNotEmpty(code)) {
|
|
|
+ log.info("--------------code--------------:" + code);
|
|
|
+ List<String> stringList = JSON.parseArray(code, List.class);
|
|
|
+ log.info("--------------list--------------:" + stringList);
|
|
|
+ List<String> rtspApiList = cameraUtil.rtspApiList();
|
|
|
+ log.info("--------------rtspApiList1111--------------:" + rtspApiList);
|
|
|
+ if (!ObjectUtils.isEmpty(rtspApiList)) {
|
|
|
+ rtspApiList.removeAll(stringList);
|
|
|
+ }
|
|
|
+ log.info("--------------rtspApiList2222--------------:" + rtspApiList);
|
|
|
+ if (!ObjectUtils.isEmpty(rtspApiList)) {
|
|
|
+ for (String str : rtspApiList) {
|
|
|
+ log.info("--------------str--------------:" + str);
|
|
|
+ String[] parts = str.split("/");
|
|
|
+ log.info("--------------parts--------------:" + parts);
|
|
|
+ cameraUtil.stopStream(parts[0], parts[1]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //添加缓存
|
|
|
+ log.info("--------------heartbeat--------------:" + list1.stream().map(BaseCameraManagement::getCameraCode).collect(Collectors.toList()));
|
|
|
+ redisCache.setCacheObject("heartbeat", list1.stream().map(BaseCameraManagement::getCameraCode).collect(Collectors.toList()));
|
|
|
}
|
|
|
twoMap.put("currentStream", playFlv);
|
|
|
twoMap.put("cameraCode", list1.get(0).getCameraCode());
|
|
@@ -929,56 +953,90 @@ public class GeoHazardMonitorTokenController {
|
|
|
//判断流媒体是否有流
|
|
|
String playFlv = cameraUtil.heartbeatgetPlayFlv(list1.get(0).getCameraCode(), list1.get(0).getChannel(), type);
|
|
|
log.info("playFlv------------>" + playFlv);
|
|
|
- //拉四路视频
|
|
|
+ //拉两路视频
|
|
|
if (StringUtils.isEmpty(playFlv)) {
|
|
|
- log.info("--------------->>已进入拉四路视频");
|
|
|
+ log.info("--------------->>已进入拉两路视频");
|
|
|
for (BaseCameraManagement baseCameraManagement : list1) {
|
|
|
boolean finalType2 = type;
|
|
|
CompletableFuture.runAsync(() -> {
|
|
|
cameraUtil.heartbeatgetUrl(baseCameraManagement.getCameraCode(), baseCameraManagement.getChannel(), finalType2);
|
|
|
-
|
|
|
- //添加心跳相机日志信息
|
|
|
});
|
|
|
- int add5 = terminalHeartbeatLogService.add(baseCameraManagement.getCameraCode(), baseCameraManagement.getChannel());
|
|
|
- log.info("-----add5----" + add5);
|
|
|
+ //添加心跳相机日志信息
|
|
|
+// int add5 = terminalHeartbeatLogService.add(baseCameraManagement.getCameraCode(), baseCameraManagement.getChannel());
|
|
|
+// log.info("-----add5----" + add5);
|
|
|
}
|
|
|
- List<String> finalCodeList2 = codeList;
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
- log.info("-------------->>finalCodeList2-------" + finalCodeList2);
|
|
|
- if (!ObjectUtils.isEmpty(finalCodeList2)) {
|
|
|
- //判断心跳相机日志表后两条数据是否包含该相机编码
|
|
|
- if (!finalCodeList2.contains(list1.get(0).getCameraCode())) {
|
|
|
- //如果不包含此相机编码
|
|
|
- for (TerminalHeartbeatLog terminalHeartbeatLog : heartbeatLogList) {
|
|
|
- log.info("-----6666666----");
|
|
|
- cameraUtil.stopStream(terminalHeartbeatLog.getCameraCode(), terminalHeartbeatLog.getChannel());
|
|
|
- }
|
|
|
+ //获取缓冲
|
|
|
+ String code = redisCache.getCacheObject("heartbeat");
|
|
|
+ if (StringUtils.isNotEmpty(code)) {
|
|
|
+ log.info("--------------code--------------:" + code);
|
|
|
+ List<String> list = JSON.parseArray(code, List.class);
|
|
|
+ log.info("--------------list--------------:" + list);
|
|
|
+ List<String> rtspApiList = cameraUtil.rtspApiList();
|
|
|
+ log.info("--------------rtspApiList1111--------------:" + rtspApiList);
|
|
|
+ if (!ObjectUtils.isEmpty(rtspApiList)) {
|
|
|
+ rtspApiList.removeAll(list);
|
|
|
+ }
|
|
|
+ log.info("--------------rtspApiList2222--------------:" + rtspApiList);
|
|
|
+ if (!ObjectUtils.isEmpty(rtspApiList)) {
|
|
|
+ for (String str : rtspApiList) {
|
|
|
+ log.info("--------------str--------------:" + str);
|
|
|
+ String[] parts = str.split("/");
|
|
|
+ log.info("--------------parts--------------:" + parts);
|
|
|
+ cameraUtil.stopStream(parts[0], parts[1]);
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
+ }
|
|
|
+ //添加缓存
|
|
|
+ log.info("--------------heartbeat--------------:" + list1.stream().map(BaseCameraManagement::getCameraCode).collect(Collectors.toList()));
|
|
|
+ redisCache.setCacheObject("heartbeat", list1.stream().map(BaseCameraManagement::getCameraCode).collect(Collectors.toList()));
|
|
|
+// List<String> finalCodeList2 = codeList;
|
|
|
+// CompletableFuture.runAsync(() -> {
|
|
|
+// log.info("-------------->>finalCodeList2-------" + finalCodeList2);
|
|
|
+// if (!ObjectUtils.isEmpty(finalCodeList2)) {
|
|
|
+// //判断心跳相机日志表后两条数据是否包含该相机编码
|
|
|
+// if (!finalCodeList2.contains(list1.get(0).getCameraCode())) {
|
|
|
+// //如果不包含此相机编码
|
|
|
+// for (TerminalHeartbeatLog terminalHeartbeatLog : heartbeatLogList) {
|
|
|
+// log.info("-----6666666----");
|
|
|
+// cameraUtil.stopStream(terminalHeartbeatLog.getCameraCode(), terminalHeartbeatLog.getChannel());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// });
|
|
|
} else {
|
|
|
log.info("-------------->>已进入拉三路路视频");
|
|
|
log.info("list1-------------->>" + list1.size());
|
|
|
for (int i = 1; i < list1.size(); i++) {
|
|
|
boolean finalType3 = type;
|
|
|
cameraUtil.heartbeatgetUrl(list1.get(i).getCameraCode(), list1.get(i).getChannel(), finalType3);
|
|
|
- //添加心跳相机日志信息
|
|
|
- int add6 = terminalHeartbeatLogService.add(list1.get(i).getCameraCode(), list1.get(i).getChannel());
|
|
|
- log.info("-----add6----" + add6);
|
|
|
+// //添加心跳相机日志信息
|
|
|
+// int add6 = terminalHeartbeatLogService.add(list1.get(i).getCameraCode(), list1.get(i).getChannel());
|
|
|
+// log.info("-----add6----" + add6);
|
|
|
}
|
|
|
- log.info("-------------->>codeList-------" + codeList);
|
|
|
- if (!ObjectUtils.isEmpty(codeList)) {
|
|
|
- //判断心跳相机日志表后两条数据是否包含该相机编码
|
|
|
- log.info("-------------->>baseCameraManagement.getCameraCode()-------" + list1.get(0).getCameraCode());
|
|
|
- if (!codeList.contains(list1.get(0).getCameraCode())) {
|
|
|
- //如果不包含此相机编码
|
|
|
- log.info("-------------->>heartbeatLogList-------" + heartbeatLogList);
|
|
|
- for (TerminalHeartbeatLog terminalHeartbeatLog : heartbeatLogList) {
|
|
|
- log.info("-----77777----");
|
|
|
- cameraUtil.stopStream(terminalHeartbeatLog.getCameraCode(), terminalHeartbeatLog.getChannel());
|
|
|
+ //获取缓冲
|
|
|
+ String code = redisCache.getCacheObject("heartbeat");
|
|
|
+ if (StringUtils.isNotEmpty(code)) {
|
|
|
+ log.info("--------------code--------------:" + code);
|
|
|
+ List<String> list = JSON.parseArray(code, List.class);
|
|
|
+ log.info("--------------list--------------:" + list);
|
|
|
+ List<String> rtspApiList = cameraUtil.rtspApiList();
|
|
|
+ log.info("--------------rtspApiList1111--------------:" + rtspApiList);
|
|
|
+ if (!ObjectUtils.isEmpty(rtspApiList)) {
|
|
|
+ rtspApiList.removeAll(list);
|
|
|
+ }
|
|
|
+ log.info("--------------rtspApiList2222--------------:" + rtspApiList);
|
|
|
+ if (!ObjectUtils.isEmpty(rtspApiList)) {
|
|
|
+ for (String str : rtspApiList) {
|
|
|
+ log.info("--------------str--------------:" + str);
|
|
|
+ String[] parts = str.split("/");
|
|
|
+ log.info("--------------parts--------------:" + parts);
|
|
|
+ cameraUtil.stopStream(parts[0], parts[1]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //添加缓存
|
|
|
+ log.info("--------------heartbeat--------------:" + list1.stream().map(BaseCameraManagement::getCameraCode).collect(Collectors.toList()));
|
|
|
+ redisCache.setCacheObject("heartbeat", list1.stream().map(BaseCameraManagement::getCameraCode).collect(Collectors.toList()));
|
|
|
}
|
|
|
twoMap.put("currentStream", playFlv);
|
|
|
twoMap.put("cameraCode", list1.get(0).getCameraCode());
|
|
@@ -1113,9 +1171,9 @@ public class GeoHazardMonitorTokenController {
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
|
|
|
}
|
|
|
LambdaQueryWrapper<BaseCameraManagement> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(BaseCameraManagement::getRailwayCode, cameraVo.getRailwayCode())
|
|
|
- .and(w1 ->w1.eq(BaseCameraManagement::getMonitoringDirection, cameraVo.getLineDir())
|
|
|
- .or(w2 -> w2.eq(BaseCameraManagement::getMonitoringDirection, 3)));
|
|
|
+ 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);
|
|
|
wrapper.orderByAsc(BaseCameraManagement::getInstallMile);
|
|
|
List<BaseCameraManagement> list = baseCameraManagementService.list(wrapper);
|