Browse Source

Merge remote-tracking branch 'origin/develop' into develop

develop
wangsixiang 3 months ago
parent
commit
58c0969baa
  1. 17
      zc-business/src/main/java/com/zc/business/service/impl/DcSdhsEventServiceImpl.java
  2. 29
      zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java

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

@ -957,10 +957,12 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
} else if (dcSdhsEventQuery.getType().equals("1")) { } else if (dcSdhsEventQuery.getType().equals("1")) {
// 将查询开始时间和结束时间转换为 LocalDateTime // 将查询开始时间和结束时间转换为 LocalDateTime
LocalDateTime queryStart = dcSdhsEventQuery.getStartTime().toInstant().atZone(zoneId).toLocalDateTime(); LocalDateTime queryStart = dcSdhsEventQuery.getStartTime().toInstant().atZone(zoneId).toLocalDateTime();
// 获取该月的最后一天 LocalDateTime endOfMonth = dcSdhsEventQuery.getEndTime().toInstant().atZone(zoneId).toLocalDateTime();
/* // 获取该月的最后一天
LocalDate lastDayOfMonth = queryStart.toLocalDate().with(TemporalAdjusters.lastDayOfMonth()); LocalDate lastDayOfMonth = queryStart.toLocalDate().with(TemporalAdjusters.lastDayOfMonth());
// 构建该月的最后一刻(23:59:59) // 构建该月的最后一刻(23:59:59)
LocalDateTime endOfMonth = LocalDateTime.of(lastDayOfMonth, LocalTime.MAX); LocalDateTime endOfMonth = LocalDateTime.of(lastDayOfMonth, LocalTime.MAX);*/
List<DcSdhsEvent> filteredEvents = getDcSdhsEvents(dcSdhsEventQuery, cacheList, zoneId, queryStart, endOfMonth); List<DcSdhsEvent> filteredEvents = getDcSdhsEvents(dcSdhsEventQuery, cacheList, zoneId, queryStart, endOfMonth);
// 定义日期格式 // 定义日期格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd");
@ -990,7 +992,8 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
// 获取该年的最后一天 // 获取该年的最后一天
LocalDate lastDayOfYear = queryStart.toLocalDate().with(TemporalAdjusters.lastDayOfYear()); LocalDate lastDayOfYear = queryStart.toLocalDate().with(TemporalAdjusters.lastDayOfYear());
// 构建该年的最后一刻(23:59:59) // 构建该年的最后一刻(23:59:59)
LocalDateTime endOfYear = LocalDateTime.of(lastDayOfYear, LocalTime.MAX); // LocalDateTime endOfYear = LocalDateTime.of(lastDayOfYear, LocalTime.MAX);
LocalDateTime endOfYear = dcSdhsEventQuery.getEndTime().toInstant().atZone(zoneId).toLocalDateTime();
List<DcSdhsEvent> filteredEvents = getDcSdhsEvents(dcSdhsEventQuery, cacheList, zoneId, queryStart, endOfYear); List<DcSdhsEvent> filteredEvents = getDcSdhsEvents(dcSdhsEventQuery, cacheList, zoneId, queryStart, endOfYear);
// 定义日期格式 // 定义日期格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM");
@ -1004,7 +1007,8 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
); );
// 确保所有月份都出现在结果中 // 确保所有月份都出现在结果中
LocalDate queryEnd = endOfYear.toLocalDate().plusMonths(1); // 确保包含结束月份 // 目标年的年末之后的一个月
LocalDate queryEnd = endOfYear.toLocalDate().plusMonths(0); // 确保包含结束月份
LocalDate currentMonth = queryStart.toLocalDate(); LocalDate currentMonth = queryStart.toLocalDate();
while (currentMonth.isBefore(queryEnd)) { while (currentMonth.isBefore(queryEnd)) {
String monthString = currentMonth.format(formatter); String monthString = currentMonth.format(formatter);
@ -1073,20 +1077,17 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
Map<String, Long> lastYearData = accidentTimeAnalysis(dcSdhsEventQuery1); Map<String, Long> lastYearData = accidentTimeAnalysis(dcSdhsEventQuery1);
String type = dcSdhsEventQuery.getType(); String type = dcSdhsEventQuery.getType();
int rows = 0; int rows = currentYearData.size()+1;
String stingType = ""; String stingType = "";
String name = ""; String name = "";
if (type.equals("2")) { if (type.equals("2")) {
rows = 25;
stingType = "点"; stingType = "点";
name = "wordTemplate/accidentTimeAnalysis.docx"; name = "wordTemplate/accidentTimeAnalysis.docx";
} else if (type.equals("1")) { } else if (type.equals("1")) {
rows = 32;
stingType = "日"; stingType = "日";
name = "wordTemplate/accidentTimeDayAnalysis.docx"; name = "wordTemplate/accidentTimeDayAnalysis.docx";
} else { } else {
rows = 13;
stingType = "月"; stingType = "月";
name = "wordTemplate/accidentTimeMonthAnalysis.docx"; name = "wordTemplate/accidentTimeMonthAnalysis.docx";

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