|
@ -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"; |
|
|
|
|
|
|
|
|