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