Browse Source

雷达关联监控点查询接口

develop
王兴琳 7 months ago
parent
commit
29103fa424
  1. 17
      zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java

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

@ -39,7 +39,9 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.time.Duration; import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.Period;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.*; import java.util.*;
@ -1090,12 +1092,7 @@ public class DcWarningServiceImpl implements IDcWarningService {
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));
// 获取当前时间
LocalDateTime now = LocalDateTime.now();
// 判断时间与当前时间不能超过两个月
boolean isWithinTwoMonths = ChronoUnit.MONTHS.between(now, currentTime) <= 2;
if (isWithinTwoMonths) {
// 格式化时间 // 格式化时间
String formattedTime = timeAfter30Seconds.format(formatter); String formattedTime = timeAfter30Seconds.format(formatter);
@ -1113,13 +1110,17 @@ public class DcWarningServiceImpl implements IDcWarningService {
// 使用 textValue() 方法获取纯字符串 // 使用 textValue() 方法获取纯字符串
String codestring = code.textValue(); String codestring = code.textValue();
com.alibaba.fastjson.JSONObject jsonObject = videoController.downloadCameraVideo(codestring, formattedTime, 1); com.alibaba.fastjson.JSONObject jsonObject = videoController.downloadCameraVideo(codestring, formattedTime, 1);
if (jsonObject.get("code").toString().equals("500")) {
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 null;
}
} }
/** /**

Loading…
Cancel
Save