Browse Source

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

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

32
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) {
// 初始化一个空的结果映射
Map<String, Map<String, Integer>> result = accidentModelAnalysis(dcSdhsEventQuery);
if (result != null && result.size() != UniversalEnum.ZERO.getNumber()) {
// 计算最大车辆类型数量
int maxVehicleTypes = 5;
@ -839,7 +840,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
// 换行
createLineBreak(doc);
}
}
/**
@ -944,7 +945,9 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
String hourString = String.format("%02d", hour);
hourlyCounts.merge(hourString, 0L, Long::sum);
}
return hourlyCounts;
Map<String, Long> hourlyCountsTreeMap = new TreeMap<>(hourlyCounts);
return hourlyCountsTreeMap;
} else if (dcSdhsEventQuery.getType().equals("1")) {
// 将查询开始时间和结束时间转换为 LocalDateTime
LocalDateTime queryStart = dcSdhsEventQuery.getStartTime().toInstant().atZone(zoneId).toLocalDateTime();
@ -972,7 +975,9 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
String dateString = date.format(formatter);
dailyCounts.merge(dateString, 0L, Long::sum);
}
return dailyCounts;
// 将键值对放入TreeMap中,TreeMap会自动按键排序
Map<String, Long> dailyCountsTreeMap = new TreeMap<>(dailyCounts);
return dailyCountsTreeMap;
} else {
// 将查询开始时间和结束时间转换为 LocalDateTime
LocalDateTime queryStart = dcSdhsEventQuery.getStartTime().toInstant().atZone(zoneId).toLocalDateTime();
@ -1000,7 +1005,9 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
monthlyCounts.merge(monthString, 0L, Long::sum);
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";
}
if (currentYearData != null && currentYearData.size() != UniversalEnum.ZERO.getNumber()) {
// 创建表格
@ -1185,7 +1193,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
//换行
createLineBreak(doc);
}
}
@ -1871,9 +1879,12 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
List<DcTollStationStatisticsDataMap> exit = map.get("exit");
int rows = entrance.size();
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);
CTTblWidth infoTableWidth = table.getCTTbl().addNewTblPr().addNewTblW();
infoTableWidth.setType(STTblWidth.DXA);
infoTableWidth.setW(BigInteger.valueOf(UniversalEnum.NINE_THOUSAND_AND_SEVENTY_TWO.getNumber()));
@ -1883,7 +1894,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
setTableFonts(table.getRow(0).getCell(1), "入口");
setTableFonts(table.getRow(0).getCell(2), "出口");
// 填充表格数据
for (int i = 0; i < rows ; i++) {
for (int i = 0; i < rows; i++) {
setTableFonts(table.getRow(i + 1).getCell(0), (entrance.get(i).getFacilityName()));
Integer entranceValue = entrance.get(i).getTrafficVolume();
@ -1922,7 +1933,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
cell = row.createCell(UniversalEnum.ONE.getNumber(), CellType.NUMERIC);
}
// 设置单元格的值
sheet.getRow(i + 1).getCell(1).setCellValue( entrance.get(i).getTrafficVolume());
sheet.getRow(i + 1).getCell(1).setCellValue(entrance.get(i).getTrafficVolume());
int rowIndexTwo = i + 1 + UniversalEnum.ONE.getNumber(); // 计算行索引
Row rowTwo = sheet.getRow(rowIndexTwo);
if (rowTwo == null) {
@ -1961,7 +1972,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
}
//换行
createLineBreak(doc);
}
}
/**
@ -1977,6 +1988,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
List<TrafficFlowStatisticsMap> exit = map.get("jinanDirection");
int rows = entrance.size();
String name = "wordTemplate/frameDataAnalysis.docx";
if (map != null && map.size() != UniversalEnum.ZERO.getNumber()) {
// 创建表格
XWPFTable table = doc.createTable(rows+1, 3);
@ -2068,7 +2080,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
}
//换行
createLineBreak(doc);
}
}

Loading…
Cancel
Save