diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcSdhsEventServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcSdhsEventServiceImpl.java index 18177e59..bad631f7 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcSdhsEventServiceImpl.java +++ b/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")) { // 将查询开始时间和结束时间转换为 LocalDateTime LocalDateTime queryStart = dcSdhsEventQuery.getStartTime().toInstant().atZone(zoneId).toLocalDateTime(); - // 获取该月的最后一天 + LocalDateTime endOfMonth = dcSdhsEventQuery.getEndTime().toInstant().atZone(zoneId).toLocalDateTime(); + /* // 获取该月的最后一天 LocalDate lastDayOfMonth = queryStart.toLocalDate().with(TemporalAdjusters.lastDayOfMonth()); // 构建该月的最后一刻(23:59:59) - LocalDateTime endOfMonth = LocalDateTime.of(lastDayOfMonth, LocalTime.MAX); + LocalDateTime endOfMonth = LocalDateTime.of(lastDayOfMonth, LocalTime.MAX);*/ + List filteredEvents = getDcSdhsEvents(dcSdhsEventQuery, cacheList, zoneId, queryStart, endOfMonth); // 定义日期格式 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd"); @@ -990,7 +992,8 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService { // 获取该年的最后一天 LocalDate lastDayOfYear = queryStart.toLocalDate().with(TemporalAdjusters.lastDayOfYear()); // 构建该年的最后一刻(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 filteredEvents = getDcSdhsEvents(dcSdhsEventQuery, cacheList, zoneId, queryStart, endOfYear); // 定义日期格式 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(); while (currentMonth.isBefore(queryEnd)) { String monthString = currentMonth.format(formatter); @@ -1073,20 +1077,17 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService { Map lastYearData = accidentTimeAnalysis(dcSdhsEventQuery1); String type = dcSdhsEventQuery.getType(); - int rows = 0; + int rows = currentYearData.size()+1; String stingType = ""; String name = ""; if (type.equals("2")) { - rows = 25; stingType = "点"; name = "wordTemplate/accidentTimeAnalysis.docx"; } else if (type.equals("1")) { - rows = 32; stingType = "日"; name = "wordTemplate/accidentTimeDayAnalysis.docx"; } else { - rows = 13; stingType = "月"; name = "wordTemplate/accidentTimeMonthAnalysis.docx"; diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java index 6177fa35..2f11a374 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java @@ -1126,18 +1126,20 @@ public class DcWarningServiceImpl implements IDcWarningService { */ @Override public String getRadarIncidentVideo(String id) throws Exception { + String msg = ""; HashMap 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 ""; + } }