|
|
@ -39,7 +39,9 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.io.IOException; |
|
|
|
import java.time.Duration; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.Period; |
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
import java.time.temporal.ChronoUnit; |
|
|
|
import java.util.*; |
|
|
@ -1090,12 +1092,7 @@ public class DcWarningServiceImpl implements IDcWarningService { |
|
|
|
LocalDateTime currentTime = LocalDateTime.parse(givenTime, formatter); |
|
|
|
// 计算 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); |
|
|
|
|
|
|
@ -1113,13 +1110,17 @@ public class DcWarningServiceImpl implements IDcWarningService { |
|
|
|
// 使用 textValue() 方法获取纯字符串
|
|
|
|
String codestring = code.textValue(); |
|
|
|
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()); |
|
|
|
// 使用 textValue() 方法获取纯字符串
|
|
|
|
String fileUrl = data.get("fileUrl").textValue(); |
|
|
|
return fileUrl; |
|
|
|
} else { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|