Browse Source

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

develop
wangsixiang 3 months ago
parent
commit
27ddf30551
  1. 26
      zc-business/src/main/java/com/zc/business/service/impl/DcSdhsEventServiceImpl.java

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

@ -737,6 +737,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
public void exportAccidentModelAnalysis(XWPFDocument doc, DcSdhsEventQuery dcSdhsEventQuery) { public void exportAccidentModelAnalysis(XWPFDocument doc, DcSdhsEventQuery dcSdhsEventQuery) {
// 初始化一个空的结果映射 // 初始化一个空的结果映射
Map<String, Map<String, Integer>> result = accidentModelAnalysis(dcSdhsEventQuery); Map<String, Map<String, Integer>> result = accidentModelAnalysis(dcSdhsEventQuery);
if (result != null && result.size() != UniversalEnum.ZERO.getNumber()) {
// 计算最大车辆类型数量 // 计算最大车辆类型数量
int maxVehicleTypes = 5; int maxVehicleTypes = 5;
@ -839,7 +840,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
// 换行 // 换行
createLineBreak(doc); createLineBreak(doc);
}
} }
/** /**
@ -944,7 +945,9 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
String hourString = String.format("%02d", hour); String hourString = String.format("%02d", hour);
hourlyCounts.merge(hourString, 0L, Long::sum); hourlyCounts.merge(hourString, 0L, Long::sum);
} }
return hourlyCounts; Map<String, Long> hourlyCountsTreeMap = new TreeMap<>(hourlyCounts);
return hourlyCountsTreeMap;
} 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();
@ -972,7 +975,9 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
String dateString = date.format(formatter); String dateString = date.format(formatter);
dailyCounts.merge(dateString, 0L, Long::sum); dailyCounts.merge(dateString, 0L, Long::sum);
} }
return dailyCounts; // 将键值对放入TreeMap中,TreeMap会自动按键排序
Map<String, Long> dailyCountsTreeMap = new TreeMap<>(dailyCounts);
return dailyCountsTreeMap;
} else { } else {
// 将查询开始时间和结束时间转换为 LocalDateTime // 将查询开始时间和结束时间转换为 LocalDateTime
LocalDateTime queryStart = dcSdhsEventQuery.getStartTime().toInstant().atZone(zoneId).toLocalDateTime(); LocalDateTime queryStart = dcSdhsEventQuery.getStartTime().toInstant().atZone(zoneId).toLocalDateTime();
@ -1000,7 +1005,9 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
monthlyCounts.merge(monthString, 0L, Long::sum); monthlyCounts.merge(monthString, 0L, Long::sum);
currentMonth = currentMonth.plusMonths(1); currentMonth = currentMonth.plusMonths(1);
} }
return monthlyCounts; // 将键值对放入TreeMap中,TreeMap会自动按键排序
Map<String, Long> monthlyCountsTreeMap = new TreeMap<>(monthlyCounts);
return monthlyCountsTreeMap;
} }
} }
@ -1074,6 +1081,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
name = "wordTemplate/accidentTimeMonthAnalysis.docx"; name = "wordTemplate/accidentTimeMonthAnalysis.docx";
} }
if (currentYearData != null && currentYearData.size() != UniversalEnum.ZERO.getNumber()) {
// 创建表格 // 创建表格
@ -1185,7 +1193,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
//换行 //换行
createLineBreak(doc); createLineBreak(doc);
}
} }
@ -1871,6 +1879,9 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
List<DcTollStationStatisticsDataMap> exit = map.get("exit"); List<DcTollStationStatisticsDataMap> exit = map.get("exit");
int rows = entrance.size(); int rows = entrance.size();
String name = "wordTemplate/tollGateEntrance.docx"; String name = "wordTemplate/tollGateEntrance.docx";
if (map != null && map.size() != UniversalEnum.ZERO.getNumber()) {
PoiUtil.createHeading2(doc, "收费站出入口车流量");
// 创建表格 // 创建表格
XWPFTable table = doc.createTable(rows + 1, 3); XWPFTable table = doc.createTable(rows + 1, 3);
@ -1961,7 +1972,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
} }
//换行 //换行
createLineBreak(doc); createLineBreak(doc);
}
} }
/** /**
@ -1977,6 +1988,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
List<TrafficFlowStatisticsMap> exit = map.get("jinanDirection"); List<TrafficFlowStatisticsMap> exit = map.get("jinanDirection");
int rows = entrance.size(); int rows = entrance.size();
String name = "wordTemplate/frameDataAnalysis.docx"; String name = "wordTemplate/frameDataAnalysis.docx";
if (map != null && map.size() != UniversalEnum.ZERO.getNumber()) {
// 创建表格 // 创建表格
XWPFTable table = doc.createTable(rows+1, 3); XWPFTable table = doc.createTable(rows+1, 3);
@ -2068,7 +2080,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
} }
//换行 //换行
createLineBreak(doc); createLineBreak(doc);
}
} }

Loading…
Cancel
Save