Browse Source

雷达视频

develop
王兴琳 3 months ago
parent
commit
b0a0908e4d
  1. 29
      zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java

29
zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java

@ -1126,18 +1126,20 @@ public class DcWarningServiceImpl implements IDcWarningService {
*/ */
@Override @Override
public String getRadarIncidentVideo(String id) throws Exception { public String getRadarIncidentVideo(String id) throws Exception {
String msg = ""; String msg = "";
HashMap<String, Object> stringObjectHashMap = dcWarningMapper.selectDcWarningById(id); HashMap<String, Object> stringObjectHashMap = dcWarningMapper.selectDcWarningById(id);
// 时间 if (!stringObjectHashMap.isEmpty()) {
String givenTime = (String) stringObjectHashMap.get("warningTime"); // 时间
String givenTime = (String) stringObjectHashMap.get("warningTime");
// 定义日期时间格式 // 定义日期时间格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// 解析时间 // 解析时间
LocalDateTime currentTime = LocalDateTime.parse(givenTime, formatter); LocalDateTime currentTime = LocalDateTime.parse(givenTime, formatter);
// 计算 30 秒前的时间 // 计算 30 秒前的时间
LocalDateTime timeAfter30Seconds = currentTime.plus(Duration.ofSeconds(-30)); LocalDateTime timeAfter30Seconds = currentTime.plus(Duration.ofSeconds(-30));
// 格式化时间 // 格式化时间
String formattedTime = timeAfter30Seconds.format(formatter); String formattedTime = timeAfter30Seconds.format(formatter);
@ -1157,15 +1159,18 @@ public class DcWarningServiceImpl implements IDcWarningService {
String codestring = code.textValue(); String codestring = code.textValue();
com.alibaba.fastjson.JSONObject jsonObject = videoController.downloadCameraVideo(codestring, formattedTime, UniversalEnum.ONE.getNumber()); com.alibaba.fastjson.JSONObject jsonObject = videoController.downloadCameraVideo(codestring, formattedTime, UniversalEnum.ONE.getNumber());
if (jsonObject.get("code").toString().equals("500")) { if (jsonObject.get("code").toString().equals("500")) {
return null; return null;
} }
JsonNode data = objectMapper.readTree(jsonObject.get("data").toString()); JsonNode data = objectMapper.readTree(jsonObject.get("data").toString());
// 使用 textValue() 方法获取纯字符串 // 使用 textValue() 方法获取纯字符串
String fileUrl = data.get("fileUrl").textValue(); String fileUrl = data.get("fileUrl").textValue();
return fileUrl;
return fileUrl;
}else {
return "";
}
} }

Loading…
Cancel
Save