Browse Source

高速云导出

develop
王兴琳 7 months ago
parent
commit
6052f2fb29
  1. 13
      zc-business/src/main/java/com/zc/business/controller/DcSdhsEventController.java
  2. 9
      zc-business/src/main/java/com/zc/business/mapper/DcSdhsEventMapper.java
  3. 4
      zc-business/src/main/java/com/zc/business/service/IDcSdhsEventService.java
  4. 463
      zc-business/src/main/java/com/zc/business/service/impl/DcSdhsEventServiceImpl.java
  5. 4
      zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java
  6. 17
      zc-business/src/main/resources/mapper/business/DcSdhsEventMapper.xml
  7. BIN
      zc-business/src/main/resources/wordTemplate/accidentModelAnalysis.docx
  8. BIN
      zc-business/src/main/resources/wordTemplate/frameDataAnalysis.docx
  9. BIN
      zc-business/src/main/resources/wordTemplate/tollGateEntrance.docx

13
zc-business/src/main/java/com/zc/business/controller/DcSdhsEventController.java

@ -4,6 +4,7 @@ import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.zc.business.domain.DcSdhsEvent;
import com.zc.business.domain.DcSdhsEventQuery;
@ -258,6 +259,9 @@ public class DcSdhsEventController extends BaseController {
@PostMapping("/accidentTimeAnalysis")
@ApiOperation("事故时间分析")
public AjaxResult accidentTimeAnalysis(@RequestBody DcSdhsEventQuery dcSdhsEventQuery){
if (StringUtils.isEmpty(dcSdhsEventQuery.getType()) || StringUtils.isEmpty(dcSdhsEventQuery.getThisTime()) || StringUtils.isEmpty(dcSdhsEventQuery.getLastTime())){
return AjaxResult.error("参数错误");
}
return AjaxResult.success( dcSdhsEventService.accidentTimeAnalysis(dcSdhsEventQuery));
}
/**
@ -268,6 +272,9 @@ public class DcSdhsEventController extends BaseController {
@PostMapping("/accidentModelAnalysis")
@ApiOperation("事故车型分析")
public AjaxResult accidentModelAnalysis(@RequestBody DcSdhsEventQuery dcSdhsEventQuery){
if (StringUtils.isEmpty(dcSdhsEventQuery.getType()) || StringUtils.isEmpty(dcSdhsEventQuery.getThisTime()) || StringUtils.isEmpty(dcSdhsEventQuery.getLastTime())){
return AjaxResult.error("参数错误");
}
return AjaxResult.success( dcSdhsEventService.accidentModelAnalysis(dcSdhsEventQuery));
} /**
* 收费站出入口分析
@ -277,6 +284,9 @@ public class DcSdhsEventController extends BaseController {
@PostMapping("/TollBoothStatisticsList")
@ApiOperation("收费站出入口分析")
public AjaxResult TollBoothStatisticsList(@RequestBody DcSdhsEventQuery dcSdhsEventQuery){
if (StringUtils.isEmpty(dcSdhsEventQuery.getType()) || StringUtils.isEmpty(dcSdhsEventQuery.getThisTime()) || StringUtils.isEmpty(dcSdhsEventQuery.getLastTime())){
return AjaxResult.error("参数错误");
}
return AjaxResult.success( dcSdhsEventService.TollBoothStatisticsList(dcSdhsEventQuery));
}
@ -288,6 +298,9 @@ public class DcSdhsEventController extends BaseController {
@PostMapping("/gantryAnalysis")
@ApiOperation("门架分析")
public AjaxResult gantryAnalysis(@RequestBody DcSdhsEventQuery dcSdhsEventQuery){
if (StringUtils.isEmpty(dcSdhsEventQuery.getType()) || StringUtils.isEmpty(dcSdhsEventQuery.getThisTime()) || StringUtils.isEmpty(dcSdhsEventQuery.getLastTime())){
return AjaxResult.error("参数错误");
}
return AjaxResult.success( dcSdhsEventService.trafficFlowStatistics(dcSdhsEventQuery));
}

9
zc-business/src/main/java/com/zc/business/mapper/DcSdhsEventMapper.java

@ -84,4 +84,13 @@ public interface DcSdhsEventMapper
List<String> getDataCalendar(@Param("month") String month);
/**
* 查询事故模型分析
*
* @param type 事故类型
* @param time 时间范围
* @return 事故模型分析事件列表
*/
List<DcSdhsEvent> selectAccidentModelAnalysis(@Param("type") String type, @Param("time") String time);
}

4
zc-business/src/main/java/com/zc/business/service/IDcSdhsEventService.java

@ -59,14 +59,14 @@ public interface IDcSdhsEventService
* @param dcSdhsEventQuery
* @return
*/
Map<String, Map<String, Integer>> accidentModelAnalysis(DcSdhsEventQuery dcSdhsEventQuery);
Map<String, Map<String, Map<String, Integer>>> accidentModelAnalysis(DcSdhsEventQuery dcSdhsEventQuery);
/**
* 事故时间分析
* @param dcSdhsEventQuery
* @return
*/
Map<String, Long> accidentTimeAnalysis(DcSdhsEventQuery dcSdhsEventQuery);
Map<String, Map<String, Long>> accidentTimeAnalysis(DcSdhsEventQuery dcSdhsEventQuery);
/**
* 事故时间

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

@ -39,6 +39,7 @@ import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.YearMonth;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
@ -190,13 +191,12 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
}
/**
* @Description 根据时间范围删除数据
*
* @author liuwenge
* @date 2024/9/9 11:58
* @param startTime
* @param endTime
* @return com.ruoyi.common.core.domain.AjaxResult
* @Description 根据时间范围删除数据
* @author liuwenge
* @date 2024/9/9 11:58
*/
@Override
public AjaxResult deleteData(String startTime, String endTime) {
@ -272,6 +272,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
}
return groupCountMap;
}
//事件类型分析
@Override
public Map<String, Integer> accidentTypeAnalysis(DcSdhsEventQuery dcSdhsEventQuery) {
@ -344,6 +345,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
}
return groupCountMap;
}
//事故拥堵时间
@Override
public Map<String, String> accidentCongestedTime(DcSdhsEventQuery dcSdhsEventQuery) {
@ -497,6 +499,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
}
}
//事故类型分析导出
@Override
public void accidentTypeAnalysisExport(XWPFDocument doc, DcSdhsEventQuery dcSdhsEventQuery) {
@ -558,6 +561,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
addDescription(doc, UniversalEnum.NO_DATA_AVAILABLE.getValue());
}
}
//事故拥堵时间导出
@Override
public void accidentCongestedTimeExport(XWPFDocument doc, DcSdhsEventQuery dcSdhsEventQuery) {
@ -613,6 +617,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
addDescription(doc, UniversalEnum.NO_DATA_AVAILABLE.getValue());
}
}
//事故拥堵地点导出
@Override
public void accidentCongestedLocationExport(XWPFDocument doc, DcSdhsEventQuery dcSdhsEventQuery) {
@ -756,8 +761,19 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
*/
@Override
public void exportAccidentModelAnalysis(XWPFDocument doc, DcSdhsEventQuery dcSdhsEventQuery) {
String type = dcSdhsEventQuery.getType();
String stringType = "";
if (type.equals("0")) {
stringType = "年";
} else if (type.equals("1")) {
stringType = "月";
} else {
stringType = "日";
}
// 初始化一个空的结果映射
Map<String, Map<String, Integer>> result = accidentModelAnalysis(dcSdhsEventQuery);
Map<String, Map<String, Map<String, Integer>>> map = accidentModelAnalysis(dcSdhsEventQuery);
Map<String, Map<String, Integer>> result = map.get(dcSdhsEventQuery.getThisTime());
Map<String, Map<String, Integer>> result2 = map.get(dcSdhsEventQuery.getLastTime());
PoiUtil.createHeading2(doc, "事故车型分析");
if (result != null && result.size() != UniversalEnum.ZERO.getNumber()) {
@ -778,12 +794,11 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
// 设置表头
XWPFTableRow headerRow = table.getRow(0);
setTableFonts(headerRow.getCell(0), ""); // 第一列是事件类型
setTableFonts(headerRow.getCell(0), dcSdhsEventQuery.getThisTime() + "(" + (stringType) + ")"); // 第一列是事件类型 dcSdhsEventQuery.getThisTime()
int colIdx = 1;
for (String vehicleType : vehicleTypes) {
table.getRow(0).getCell(colIdx++).setText(vehicleType);
}
// 填充表格内容
int rowIdx = 1;
for (Map.Entry<String, Map<String, Integer>> entry : result.entrySet()) {
@ -799,6 +814,33 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
}
}
// 创建第二个具有最大车辆类型数量的列的表格
XWPFTable table2 = doc.createTable(result2.size() + 1, maxVehicleTypes);
CTTblWidth infoTableWidth2 = table2.getCTTbl().addNewTblPr().addNewTblW();
infoTableWidth2.setType(STTblWidth.DXA);
infoTableWidth2.setW(BigInteger.valueOf(UniversalEnum.NINE_THOUSAND_AND_SEVENTY_TWO.getNumber()));
XWPFTableRow headerRow2 = table2.getRow(0);
setTableFonts(headerRow2.getCell(0), dcSdhsEventQuery.getLastTime() + "(" + (stringType) + ")"); // 第一列是事件类型 dcSdhsEventQuery.getThisTime()
int colIdx2 = 1;
for (String vehicleType : vehicleTypes) {
table2.getRow(0).getCell(colIdx2++).setText(vehicleType);
}
// 填充表格内容
int rowIdx2 = 1;
for (Map.Entry<String, Map<String, Integer>> entry : result2.entrySet()) {
XWPFTableRow row = table2.getRow(rowIdx2++);
setTableFonts(row.getCell(0), entry.getKey()); // 事件类型
int cellIdx = 1;
for (String vehicleType : vehicleTypes) {
Integer count = entry.getValue().get(vehicleType);
XWPFTableCell cell = row.getCell(cellIdx++);
XWPFRun run = cell.getParagraphs().get(0).createRun();
run.setText(String.valueOf(count != null ? count : 0)); // 如果该事件没有这种车辆类型,则设为0
}
}
// 创建柱状图
try {
// 复制Word模板
@ -806,13 +848,11 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
XWPFDocument copiedTemplate = new XWPFDocument(inputStream);
// 获取word中所有图表对象
List<XWPFChart> charts = copiedTemplate.getCharts();
XWPFChart chart = charts.get(0);
XSSFWorkbook workbook = chart.getWorkbook();
XSSFSheet sheet = workbook.getSheetAt(0);
// 系列信息
String[] singleBarSeriesNames = vehicleTypes.toArray(new String[0]);
// 填充表格内容
int rowId = 1; // 开始填充数据的行号
for (Map.Entry<String, Map<String, Integer>> entry : result.entrySet()) {
@ -821,18 +861,15 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
if (row == null) {
row = sheet.createRow(rowId); // 如果行不存在,则创建新行
}
// 获取当前行的第一个单元格
Cell cell1 = row.getCell(0);
// 如果单元格为 null,则创建一个新的单元格
if (cell1 == null) {
cell1 = row.createCell(0);
}
// 设置单元格的值
cell1.setCellValue(entry.getKey());
row.getCell(0).setCellValue(entry.getKey()); // 设置事件类型
row.getCell(0).setCellValue(entry.getKey() + dcSdhsEventQuery.getThisTime()); // 设置事件类型
int cellIdx = 1;
for (String vehicleType : vehicleTypes) {
Integer count = entry.getValue().get(vehicleType);
@ -849,15 +886,43 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
sheet.removeRow(sheet.getRow(i));
}
for (Map.Entry<String, Map<String, Integer>> entry2 : result2.entrySet()) {
XSSFRow row = sheet.getRow(rowId);
if (row == null) {
row = sheet.createRow(rowId); // 如果行不存在,则创建新行
}
// 获取当前行的第一个单元格
Cell cell1 = row.getCell(0);
// 如果单元格为 null,则创建一个新的单元格
if (cell1 == null) {
cell1 = row.createCell(0);
}
// 设置单元格的值
cell1.setCellValue(entry2.getKey());
row.getCell(0).setCellValue(entry2.getKey() + dcSdhsEventQuery.getLastTime()); // 设置事件类型
int cellIdx = 1;
for (String vehicleType : vehicleTypes) {
Integer count = entry2.getValue().get(vehicleType);
XSSFCell cell = row.getCell(cellIdx); // 获取或创建单元格
if (cell == null) {
cell = row.createCell(cellIdx); // 如果单元格不存在,则创建新单元格
}
cell.setCellValue(count != null ? count : 0); // 设置单元格值
cellIdx++;
}
rowId++; // 移动到下一行
}
for (int i = sheet.getLastRowNum(); i > result.size() + result2.size(); i--) {
sheet.removeRow(sheet.getRow(i));
}
// 创建柱状图
PoiUtil.wordExportChar(chart, "事故车型分析", singleBarSeriesNames, sheet);
// 追加到同一个Word文档中
mergeChart(chart, doc);
// 关闭复制的模板文档
copiedTemplate.close();
} catch (Exception e) {
e.printStackTrace();
}
@ -877,52 +942,23 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
* @return
*/
@Override
public Map<String, Map<String, Integer>> accidentModelAnalysis(DcSdhsEventQuery dcSdhsEventQuery) {
List<DcSdhsEvent> cacheList = redisCache.getCacheList(RedisKeyConstants.SDHS_EVENT);
// 将查询开始时间和结束时间转换为 LocalDateTime
ZoneId zoneId = ZoneId.systemDefault(); // 获取系统默认时区
LocalDateTime queryStart = dcSdhsEventQuery.getStartTime().toInstant().atZone(zoneId).toLocalDateTime();
LocalDateTime queryEnd = dcSdhsEventQuery.getEndTime().toInstant().atZone(zoneId).toLocalDateTime();
// 在指定时间范围内的事件
String direction = dcSdhsEventQuery.getDirection(); // 获取方向查询参数
List<DcSdhsEvent> filteredEvents = cacheList.stream()
.filter(event -> {
LocalDateTime eventTime = event.getStartTime().toInstant().atZone(zoneId).toLocalDateTime();
boolean timeCondition =
(eventTime.isAfter(queryStart) || eventTime.isEqual(queryStart)) &&
(eventTime.isBefore(queryEnd) || eventTime.isEqual(queryEnd));
public Map<String, Map<String, Map<String, Integer>>> accidentModelAnalysis(DcSdhsEventQuery dcSdhsEventQuery) {
// 如果 direction 不为空,则添加方向过滤条件
if (direction != null && !direction.isEmpty()) {
return timeCondition && direction.equals(event.getDirection());
} else {
return timeCondition;
}
})
.collect(Collectors.toList());
//本期数据
List<DcSdhsEvent> thisTimeList = dcSdhsEventMapper.selectAccidentModelAnalysis(dcSdhsEventQuery.getType(), dcSdhsEventQuery.getThisTime());
// 初始化一个空的结果映射
Map<String, Map<String, Integer>> result = new HashMap<>();
for (DcSdhsEvent event : filteredEvents) {
String eventType = event.getEventType();
if ("交通事故".equals(eventType)) {
for (DcSdhsEvent event : thisTimeList) {
String eventSubclass = event.getEventSubclass();
String carNums = event.getCarNum();
// 分割字符串,得到每种类型的车辆数量
List<String> carNumList = Arrays.asList(carNums.split(","));
// 如果结果映射中还没有这个事件子类,就初始化一个新的映射
if (!result.containsKey(eventSubclass)) {
result.put(eventSubclass, new HashMap<>());
}
// 统计每种类型的车辆数量
Map<String, Integer> carNumCount = result.get(eventSubclass);
for (String carNum : carNumList) {
// 检查字符串格式是否正确
int index = carNum.indexOf("辆");
@ -930,15 +966,42 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
// 提取车辆类型和数量
String carType = carNum.substring(0, index - 1); // 车辆类型
int carCount = Integer.parseInt(carNum.substring(index - 1, index)); // 数量
// 在映射中累加数量
carNumCount.merge(carType, carCount, Integer::sum);
}
}
}
//上一期数据
List<DcSdhsEvent> lastTimeList = dcSdhsEventMapper.selectAccidentModelAnalysis(dcSdhsEventQuery.getType(), dcSdhsEventQuery.getLastTime());
// 初始化一个空的结果映射
Map<String, Map<String, Integer>> resultLast = new HashMap<>();
for (DcSdhsEvent event : lastTimeList) {
String eventSubclass = event.getEventSubclass();
String carNums = event.getCarNum();
// 分割字符串,得到每种类型的车辆数量
List<String> carNumList = Arrays.asList(carNums.split(","));
// 如果结果映射中还没有这个事件子类,就初始化一个新的映射
if (!resultLast.containsKey(eventSubclass)) {
resultLast.put(eventSubclass, new HashMap<>());
}
return result;
// 统计每种类型的车辆数量
Map<String, Integer> carNumCount = resultLast.get(eventSubclass);
for (String carNum : carNumList) {
// 检查字符串格式是否正确
int index = carNum.indexOf("辆");
if (index > 0) { // 确保 "辆" 的索引大于 0,表示字符串中包含 "辆" 且前面有字符
// 提取车辆类型和数量
String carType = carNum.substring(0, index - 1); // 车辆类型
int carCount = Integer.parseInt(carNum.substring(index - 1, index)); // 数量
// 在映射中累加数量
carNumCount.merge(carType, carCount, Integer::sum);
}
}
}
Map<String, Map<String, Map<String, Integer>>> map = new HashMap<>();
map.put(dcSdhsEventQuery.getThisTime(), result);
map.put(dcSdhsEventQuery.getLastTime(), resultLast);
return map;
}
/**
@ -948,18 +1011,24 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
* @return
*/
@Override
public Map<String, Long> accidentTimeAnalysis(DcSdhsEventQuery dcSdhsEventQuery) {
List<DcSdhsEvent> cacheList = redisCache.getCacheList(RedisKeyConstants.SDHS_EVENT);
public Map<String, Map<String, Long>> accidentTimeAnalysis(DcSdhsEventQuery dcSdhsEventQuery) {
List<DcSdhsEvent> dcSdhsEventList = dcSdhsEventMapper.selectAccidentModelAnalysis(dcSdhsEventQuery.getType(), dcSdhsEventQuery.getThisTime());
Map<String, Long> thisAccidentTimeAnalysis = thisAccidentTimeAnalysis(dcSdhsEventList, dcSdhsEventQuery);
List<DcSdhsEvent> lastdcSdhsEventList = dcSdhsEventMapper.selectAccidentModelAnalysis(dcSdhsEventQuery.getType(), dcSdhsEventQuery.getLastTime());
Map<String, Long> lastAccidentTimeAnalysis = thisAccidentTimeAnalysis(lastdcSdhsEventList, dcSdhsEventQuery);
Map<String, Map<String, Long>> map = new HashMap<>();
map.put(dcSdhsEventQuery.getThisTime(), thisAccidentTimeAnalysis);
map.put(dcSdhsEventQuery.getLastTime(), lastAccidentTimeAnalysis);
return map;
}
public Map<String, Long>thisAccidentTimeAnalysis(List<DcSdhsEvent> dcSdhsEventList,DcSdhsEventQuery dcSdhsEventQuery) {
ZoneId zoneId = ZoneId.systemDefault(); // 获取系统默认时区
if (dcSdhsEventQuery.getType().equals("2")) {
// 将查询开始时间和结束时间转换为 LocalDateTime
LocalDateTime queryStart = dcSdhsEventQuery.getStartTime().toInstant().atZone(zoneId).toLocalDateTime();
// LocalDateTime endTime = dcSdhsEventQuery.getEndTime().toInstant().atZone(zoneId).toLocalDateTime();
// 计算当天的结束时间
LocalDateTime queryEnd = queryStart.withHour(23).withMinute(59).withSecond(59);
List<DcSdhsEvent> filteredEvents = getDcSdhsEvents(dcSdhsEventQuery, cacheList, zoneId, queryStart, queryEnd);
// 按小时分组并统计每个小时内的事件数量
Map<String, Long> hourlyCounts = filteredEvents.stream()
Map<String, Long> hourlyCounts = dcSdhsEventList.stream()
.collect(
Collectors.groupingBy(
event -> String.format("%02d", event.getStartTime().toInstant().atZone(zoneId).toLocalDateTime().getHour()),
@ -972,76 +1041,75 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
String hourString = String.format("%02d", hour);
hourlyCounts.merge(hourString, 0L, Long::sum);
}
Map<String, Long> hourlyCountsTreeMap = new TreeMap<>(hourlyCounts);
Map<String, Long> sortedMonthlyCounts = new LinkedHashMap<>();
return hourlyCountsTreeMap;
Map<Integer, Long> tempMap = new TreeMap<>();
hourlyCounts.forEach((key, value) -> tempMap.put(Integer.parseInt(key), value));
// 将排序后的数据重新放入LinkedHashMap
tempMap.forEach((key, value) -> {
String formattedKey = String.format("%02d", key);
sortedMonthlyCounts.put(formattedKey, value);
});
return sortedMonthlyCounts;
} 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);*/
List<DcSdhsEvent> filteredEvents = getDcSdhsEvents(dcSdhsEventQuery, cacheList, zoneId, queryStart, endOfMonth);
// 定义日期格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd");
// 按天分组并统计每一天内的事件数量
Map<String, Long> dailyCounts = filteredEvents.stream()
.collect(
Collectors.groupingBy(
// 定义日期格式
DateTimeFormatter monthYearFormatter = DateTimeFormatter.ofPattern("yyyy-MM");
// 解析月份
YearMonth startOfMonth = YearMonth.parse(dcSdhsEventQuery.getThisTime(), monthYearFormatter);
LocalDate startLocalDate = startOfMonth.atDay(1);
LocalDate endLocalDate = startOfMonth.atEndOfMonth();
// 创建初始化每个日期的事件计数为0
Map<String, Long> allDaysInMonth = new HashMap<>();
for (LocalDate date = startLocalDate; !date.isAfter(endLocalDate); date = date.plusDays(1)) {
allDaysInMonth.put(date.format(formatter), 0L);
}
Map<String, Long> dailyCounts = dcSdhsEventList.stream()
.collect(Collectors.groupingBy(
event -> event.getStartTime().toInstant().atZone(zoneId).toLocalDate().format(formatter),
Collectors.counting()
)
);
// 确保所有日期都出现在结果中
LocalDate queryStartLocalDate = queryStart.toLocalDate();
LocalDate queryEndLocalDate = endOfMonth.toLocalDate();
// 确保所有日期都出现在结果中
for (LocalDate date = queryStartLocalDate; date.isBefore(queryEndLocalDate.plusDays(1)); date = date.plusDays(1)) {
String dateString = date.format(formatter);
dailyCounts.merge(dateString, 0L, Long::sum);
}
// 将键值对放入TreeMap中,TreeMap会自动按键排序
Map<String, Long> dailyCountsTreeMap = new TreeMap<>(dailyCounts);
return dailyCountsTreeMap;
));
// 将统计结果合并,确保所有日期都有对应的计数值
dailyCounts.forEach((day, count) -> allDaysInMonth.merge(day, count, Long::sum));
Map<String, Long> sortedMonthlyCounts = new LinkedHashMap<>();
Map<Integer, Long> tempMap = new TreeMap<>();
allDaysInMonth.forEach((key, value) -> tempMap.put(Integer.parseInt(key), value));
// 将排序后的数据重新放入LinkedHashMap
tempMap.forEach((key, value) -> {
String formattedKey = String.format("%02d", key);
sortedMonthlyCounts.put(formattedKey, value);
});
return sortedMonthlyCounts;
} else {
// 将查询开始时间和结束时间转换为 LocalDateTime
LocalDateTime queryStart = dcSdhsEventQuery.getStartTime().toInstant().atZone(zoneId).toLocalDateTime();
// 获取该年的最后一天
LocalDate lastDayOfYear = queryStart.toLocalDate().with(TemporalAdjusters.lastDayOfYear());
// 构建该年的最后一刻(23:59:59)
// LocalDateTime endOfYear = LocalDateTime.of(lastDayOfYear, LocalTime.MAX);
LocalDateTime endOfYear = dcSdhsEventQuery.getEndTime().toInstant().atZone(zoneId).toLocalDateTime();
List<DcSdhsEvent> filteredEvents = getDcSdhsEvents(dcSdhsEventQuery, cacheList, zoneId, queryStart, endOfYear);
// 定义日期格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM");
// 按月分组并统计每个月内的事件数量
Map<String, Long> monthlyCounts = filteredEvents.stream()
Map<String, Long> monthlyCounts = dcSdhsEventList.stream()
.collect(
Collectors.groupingBy(
event -> event.getStartTime().toInstant().atZone(zoneId).toLocalDate().format(formatter),
Collectors.counting()
)
);
// 确保所有月份都出现在结果中
// 目标年的年末之后的一个月
LocalDate queryEnd = endOfYear.toLocalDate().plusMonths(0); // 确保包含结束月份
LocalDate currentMonth = queryStart.toLocalDate();
while (currentMonth.isBefore(queryEnd)) {
String monthString = currentMonth.format(formatter);
monthlyCounts.merge(monthString, 0L, Long::sum);
currentMonth = currentMonth.plusMonths(1);
// 创建一个包含指定年份所有月份的地图,并初始化每个月的事件计数为0
Map<String, Long> allMonthsOfYear = new HashMap<>();
for (int month = 1; month <= 12; month++) {
String monthStr = String.format("%02d", month); // 确保月份为两位数字
allMonthsOfYear.put(monthStr, 0L);
}
//
monthlyCounts.forEach((month, count) -> allMonthsOfYear.merge(month, count, Long::sum));
Map<String, Long> sortedMonthlyCounts = new LinkedHashMap<>();
Map<Integer, Long> tempMap = new TreeMap<>();
monthlyCounts.forEach((key, value) -> tempMap.put(Integer.parseInt(key), value));
allMonthsOfYear.forEach((key, value) -> tempMap.put(Integer.parseInt(key), value));
// 将排序后的数据重新放入LinkedHashMap
tempMap.forEach((key, value) -> {
String formattedKey = String.format("%02d", key);
@ -1050,9 +1118,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
return sortedMonthlyCounts;
}
}
/**
* // 在指定时间范围内的事件
*
@ -1063,7 +1129,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
* @param queryEnd
* @return
*/
private static List<DcSdhsEvent> getDcSdhsEvents(DcSdhsEventQuery dcSdhsEventQuery, List<DcSdhsEvent> cacheList, ZoneId zoneId, LocalDateTime queryStart, LocalDateTime queryEnd) {
private List<DcSdhsEvent> getDcSdhsEvents(DcSdhsEventQuery dcSdhsEventQuery, List<DcSdhsEvent> cacheList, ZoneId zoneId, LocalDateTime queryStart, LocalDateTime queryEnd) {
String direction = dcSdhsEventQuery.getDirection(); // 获取方向查询参数
List<DcSdhsEvent> filteredEvents = cacheList.stream()
@ -1092,9 +1158,9 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
*/
@Override
public void exportAccidentTimeAnalysis(XWPFDocument doc, DcSdhsEventQuery dcSdhsEventQuery) {
Map<String, Long> currentYearData = accidentTimeAnalysis(dcSdhsEventQuery);
// 获取一年前的日期
Map<String, Map<String, Long>> stringMapMap = accidentTimeAnalysis(dcSdhsEventQuery);
Map<String, Long> currentYearData = stringMapMap.get(dcSdhsEventQuery.getThisTime());
/* // 获取一年前的日期
Date startTime = dcSdhsEventQuery.getStartTime();
// 使用 Calendar 计算一年前的时间
Calendar calendar = Calendar.getInstance();
@ -1104,8 +1170,8 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
DcSdhsEventQuery dcSdhsEventQuery1 = new DcSdhsEventQuery();
dcSdhsEventQuery1.setStartTime(oneYearAgoStart);
dcSdhsEventQuery1.setType(dcSdhsEventQuery.getType());
dcSdhsEventQuery1.setEndTime(dcSdhsEventQuery.getEndTime());
Map<String, Long> lastYearData = accidentTimeAnalysis(dcSdhsEventQuery1);
dcSdhsEventQuery1.setEndTime(dcSdhsEventQuery.getEndTime());*/
Map<String, Long> lastYearData = stringMapMap.get(dcSdhsEventQuery.getLastTime());
String type = dcSdhsEventQuery.getType();
int rows = currentYearData.size() + 1;
@ -1136,8 +1202,8 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
// 表头
setTableFonts(table.getRow(0).getCell(0), "时段");
setTableFonts(table.getRow(0).getCell(1), "今年同期");
setTableFonts(table.getRow(0).getCell(2), "去年同期");
setTableFonts(table.getRow(0).getCell(1), dcSdhsEventQuery.getThisTime());
setTableFonts(table.getRow(0).getCell(2), dcSdhsEventQuery.getLastTime());
// 定义一个从数字到日期字符串的映射
Map<Integer, String> indexToDateMap = new HashMap<>();
for (int i = 0; i <= 32; i++) {
@ -1224,7 +1290,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
sheet.removeRow(sheet.getRow(i));
}
// 更新图表
PoiUtil.wordExportChar(chart, "事故时间分析", new String[]{"今年同期", "去年同期"}, sheet);
PoiUtil.wordExportChar(chart, "事故时间分析", new String[]{dcSdhsEventQuery.getThisTime(), dcSdhsEventQuery.getLastTime()}, sheet);
// 合并图表到Word文档
mergeChart(chart, doc);
@ -1748,12 +1814,11 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
}
/**
* @param
* @return com.ruoyi.common.core.domain.AjaxResult
* @Description 查询天气情况统计
*
* @author liuwenge
* @date 2024/8/21 17:14
* @param
* @return com.ruoyi.common.core.domain.AjaxResult
*/
@Override
public AjaxResult selectWeather() {
@ -1877,12 +1942,13 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
*/
@Override
public Map<String, List<DcTollStationStatisticsDataMap>> TollBoothStatisticsList(DcSdhsEventQuery dcSdhsEventQuery) {
Date startTime = dcSdhsEventQuery.getStartTime();
/* Date startTime = dcSdhsEventQuery.getStartTime();
LocalDateTime localDateTime = startTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
// 定义日期时间格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// 将 LocalDateTime 转换为字符串
String startDate = localDateTime.format(formatter);
// 将 LocalDateTime 转换为字符串*/
String startDate = dcSdhsEventQuery.getThisTime();
String lastTime = dcSdhsEventQuery.getLastTime();
String type = dcSdhsEventQuery.getType();
String periodType = "";
if (type.equals("2")) {
@ -1890,20 +1956,32 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
}
if (type.equals("1")) {
periodType = "3";
startDate=startDate+"-01";
}
if (type.equals("0")) {
periodType = "1";
startDate=startDate+"-01-01";
}
Map<String, List<DcTollStationStatisticsDataMap>> map = new HashMap<>();
//入口
List<DcTollStationStatisticsDataMap> entrance = dcTollStationStatisticsDataService.TollBoothStatisticsList(startDate, "1", periodType);
//出口
List<DcTollStationStatisticsDataMap> exit = dcTollStationStatisticsDataService.TollBoothStatisticsList(startDate, "2", periodType);
map.put("entrance", entrance);
map.put("exit", exit);
//lastTime入口
List<DcTollStationStatisticsDataMap> lastTimeEntrance = dcTollStationStatisticsDataService.TollBoothStatisticsList(lastTime, "1", periodType);
//lastTime出口
List<DcTollStationStatisticsDataMap> lastTimeExit = dcTollStationStatisticsDataService.TollBoothStatisticsList(lastTime, "2", periodType);
map.put(dcSdhsEventQuery.getThisTime()+"entrance", entrance);
map.put(dcSdhsEventQuery.getThisTime()+"exit", exit);
map.put(dcSdhsEventQuery.getLastTime()+"entrance", lastTimeEntrance);
map.put(dcSdhsEventQuery.getLastTime()+"exit", lastTimeExit);
return map;
}
/**
* 收费站出入口导出
*
@ -1913,8 +1991,12 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
@Override
public void exporttollGateEntrance(XWPFDocument doc, DcSdhsEventQuery dcSdhsEventQuery) {
Map<String, List<DcTollStationStatisticsDataMap>> map = TollBoothStatisticsList(dcSdhsEventQuery);
List<DcTollStationStatisticsDataMap> entrance = map.get("entrance");
List<DcTollStationStatisticsDataMap> exit = map.get("exit");
List<DcTollStationStatisticsDataMap> entrance = map.get(dcSdhsEventQuery.getThisTime()+"entrance");
List<DcTollStationStatisticsDataMap> exit = map.get(dcSdhsEventQuery.getThisTime()+"exit");
List<DcTollStationStatisticsDataMap> lastExit = map.get(dcSdhsEventQuery.getLastTime()+"exit");
List<DcTollStationStatisticsDataMap> lastEntrance = map.get(dcSdhsEventQuery.getLastTime()+"entrance");
int rows = entrance.size();
String name = "wordTemplate/tollGateEntrance.docx";
PoiUtil.createHeading2(doc, "收费站出入口车流量");
@ -1922,23 +2004,29 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
// 创建表格
XWPFTable table = doc.createTable(rows + 1, 3);
XWPFTable table = doc.createTable(rows + 1, 5);
CTTblWidth infoTableWidth = table.getCTTbl().addNewTblPr().addNewTblW();
infoTableWidth.setType(STTblWidth.DXA);
infoTableWidth.setW(BigInteger.valueOf(UniversalEnum.NINE_THOUSAND_AND_SEVENTY_TWO.getNumber()));
// 表头
setTableFonts(table.getRow(0).getCell(0), "收费站");
setTableFonts(table.getRow(0).getCell(1), "入口");
setTableFonts(table.getRow(0).getCell(2), "出口");
setTableFonts(table.getRow(0).getCell(1), dcSdhsEventQuery.getThisTime()+"(入口)");
setTableFonts(table.getRow(0).getCell(2), dcSdhsEventQuery.getLastTime()+"(入口)");
setTableFonts(table.getRow(0).getCell(3), dcSdhsEventQuery.getThisTime()+"(出口)");
setTableFonts(table.getRow(0).getCell(4), dcSdhsEventQuery.getLastTime()+"(出口)");
// 填充表格数据
for (int i = 0; i < rows; i++) {
setTableFonts(table.getRow(i + 1).getCell(0), (entrance.get(i).getFacilityName()));
Integer entranceValue = entrance.get(i).getTrafficVolume();
setTableFonts(table.getRow(i + 1).getCell(1), String.valueOf(entranceValue));
setTableFonts(table.getRow(i + 1).getCell(1), String.valueOf(entranceValue));//入口
Integer lastEntranceValue = lastEntrance.get(i).getTrafficVolume();
setTableFonts(table.getRow(i + 1).getCell(2), String.valueOf(lastEntranceValue));//last入口
Integer exitValue = exit.get(i).getTrafficVolume();
setTableFonts(table.getRow(i + 1).getCell(2), String.valueOf(exitValue));
setTableFonts(table.getRow(i + 1).getCell(3), String.valueOf(exitValue));//出口
Integer lastExitValue = lastExit.get(i).getTrafficVolume();
setTableFonts(table.getRow(i + 1).getCell(4), String.valueOf(lastExitValue));//last出口
}
// 图表部分
@ -1986,7 +2074,18 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
cell = row.createCell(UniversalEnum.TWO.getNumber(), CellType.NUMERIC);
}
sheet.getRow(i + 1).getCell(2).setCellValue(exit.get(i).getTrafficVolume());
//sheet.getRow(i+UniversalEnum.ONE.getNumber()).getCell(UniversalEnum.ONE.getNumber()).setCellValue(Long.parseLong(entries.get(i).getValue().toString()));
Cell cellThree = row.getCell(UniversalEnum.THREE.getNumber());
if (cellThree == null) {
// 通常情况下,getCell 会创建新的单元格,但这里我们显式地检查以防万一
cell = row.createCell(UniversalEnum.THREE.getNumber(), CellType.NUMERIC);
}
sheet.getRow(i + 1).getCell(3).setCellValue(lastEntrance.get(i).getTrafficVolume());
Cell cellFour = row.getCell(UniversalEnum.FOUR.getNumber());
if (cellFour == null) {
// 通常情况下,getCell 会创建新的单元格,但这里我们显式地检查以防万一
cell = row.createCell(UniversalEnum.FOUR.getNumber(), CellType.NUMERIC);
}
sheet.getRow(i + 1).getCell(4).setCellValue(lastExit.get(i).getTrafficVolume());
}
/* for (int i = 0; i < 24; i++) {
@ -1998,7 +2097,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
sheet.removeRow(sheet.getRow(i));
}
// 更新图表
PoiUtil.wordExportChar(chart, "收费站出入口车流量", new String[]{"入口", "出口"}, sheet);
PoiUtil.wordExportChar(chart, "收费站出入口车流量", new String[]{dcSdhsEventQuery.getThisTime()+"(入口)", dcSdhsEventQuery.getThisTime()+"(出口)",dcSdhsEventQuery.getLastTime()+"(入口)", dcSdhsEventQuery.getLastTime()+"(出口)"}, sheet);
// 合并图表到Word文档
mergeChart(chart, doc);
@ -2015,6 +2114,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
}
}
/**
* 收门架数据导出
*
@ -2024,8 +2124,11 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
@Override
public void exporFrameDataAnalysis(XWPFDocument doc, DcSdhsEventQuery dcSdhsEventQuery) {
Map<String, List<TrafficFlowStatisticsMap>> map = trafficFlowStatistics(dcSdhsEventQuery);
List<TrafficFlowStatisticsMap>entrance = map.get("hezeDirection");
List<TrafficFlowStatisticsMap> exit = map.get("jinanDirection");
List<TrafficFlowStatisticsMap> entrance = map.get(dcSdhsEventQuery.getThisTime()+"heze");
List<TrafficFlowStatisticsMap> exit = map.get(dcSdhsEventQuery.getThisTime()+"jinan");
List<TrafficFlowStatisticsMap> lastEntrance = map.get(dcSdhsEventQuery.getLastTime()+"heze");
List<TrafficFlowStatisticsMap> lastExit = map.get(dcSdhsEventQuery.getLastTime()+"jinan");
int rows = entrance.size();
String name = "wordTemplate/frameDataAnalysis.docx";
PoiUtil.createHeading2(doc, "门架车流量");
@ -2033,24 +2136,32 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
if (map != null && map.size() != UniversalEnum.ZERO.getNumber()) {
// 创建表格
XWPFTable table = doc.createTable(rows+1, 3);
XWPFTable table = doc.createTable(rows + 1, 5);
CTTblWidth infoTableWidth = table.getCTTbl().addNewTblPr().addNewTblW();
infoTableWidth.setType(STTblWidth.DXA);
infoTableWidth.setW(BigInteger.valueOf(UniversalEnum.NINE_THOUSAND_AND_SEVENTY_TWO.getNumber()));
// 表头
setTableFonts(table.getRow(0).getCell(0), "门架");
setTableFonts(table.getRow(0).getCell(1), "菏泽方向");
setTableFonts(table.getRow(0).getCell(2), "济南方向");
setTableFonts(table.getRow(0).getCell(1), dcSdhsEventQuery.getThisTime()+"(菏泽方向)");
setTableFonts(table.getRow(0).getCell(2), dcSdhsEventQuery.getLastTime()+"(菏泽方向)");
setTableFonts(table.getRow(0).getCell(3), dcSdhsEventQuery.getThisTime()+"(济南方向)");
setTableFonts(table.getRow(0).getCell(4), dcSdhsEventQuery.getLastTime()+"(济南方向)");
// 填充表格数据
for (int i = 0; i < rows; i++) {
setTableFonts(table.getRow(i + 1).getCell(0), (entrance.get(i).getFacilityName()));
Long entranceValue = entrance.get(i).getTrafficVolume() != null ? entrance.get(i).getTrafficVolume() : 0;
setTableFonts(table.getRow(i + 1).getCell(1), String.valueOf(entranceValue));
Long lastEntranceValue = lastEntrance.get(i).getTrafficVolume() != null ? lastEntrance.get(i).getTrafficVolume() : 0;
setTableFonts(table.getRow(i + 1).getCell(2), String.valueOf(lastEntranceValue));
Long exitValue = exit.get(i).getTrafficVolume() != null ? exit.get(i).getTrafficVolume() : 0;
setTableFonts(table.getRow(i + 1).getCell(2), String.valueOf(exitValue));
setTableFonts(table.getRow(i + 1).getCell(3), String.valueOf(exitValue));
Long lastExitValue = lastExit.get(i).getTrafficVolume() != null ? lastExit.get(i).getTrafficVolume() : 0;
setTableFonts(table.getRow(i + 1).getCell(4), String.valueOf(lastExitValue));
}
// 图表部分
@ -2098,6 +2209,19 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
cell = row.createCell(UniversalEnum.TWO.getNumber(), CellType.NUMERIC);
}
sheet.getRow(i + 1).getCell(2).setCellValue(exit.get(i).getTrafficVolume() != null ? exit.get(i).getTrafficVolume() : 0);
Cell cellThree = row.getCell(UniversalEnum.THREE.getNumber());
if (cellThree == null) {
// 通常情况下,getCell 会创建新的单元格,但这里我们显式地检查以防万一
cell = row.createCell(UniversalEnum.THREE.getNumber(), CellType.NUMERIC);
}
sheet.getRow(i + 1).getCell(3).setCellValue(lastEntrance.get(i).getTrafficVolume());
Cell cellFour = row.getCell(UniversalEnum.FOUR.getNumber());
if (cellFour == null) {
// 通常情况下,getCell 会创建新的单元格,但这里我们显式地检查以防万一
cell = row.createCell(UniversalEnum.FOUR.getNumber(), CellType.NUMERIC);
}
sheet.getRow(i + 1).getCell(4).setCellValue(lastExit.get(i).getTrafficVolume());
//sheet.getRow(i+UniversalEnum.ONE.getNumber()).getCell(UniversalEnum.ONE.getNumber()).setCellValue(Long.parseLong(entries.get(i).getValue().toString()));
}
/* for (int i = 0; i < 24; i++) {
@ -2110,7 +2234,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
sheet.removeRow(sheet.getRow(i));
}
// 更新图表
PoiUtil.wordExportChar(chart, "门架车流量", new String[]{"菏泽", "济南"}, sheet);
PoiUtil.wordExportChar(chart, "门架车流量", new String[]{dcSdhsEventQuery.getThisTime()+"(菏泽)",dcSdhsEventQuery.getLastTime()+"(菏泽)", dcSdhsEventQuery.getThisTime()+"(济南)",dcSdhsEventQuery.getLastTime()+"(济南)",}, sheet);
// 合并图表到Word文档
mergeChart(chart, doc);
@ -2130,17 +2254,14 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
/**
* 门架数据分析
*
* @param dcSdhsEventQuery
* @return
*/
@Override
public Map<String, List<TrafficFlowStatisticsMap>> trafficFlowStatistics(DcSdhsEventQuery dcSdhsEventQuery) {
Date startTime = dcSdhsEventQuery.getStartTime();
LocalDateTime localDateTime = startTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
// 定义日期时间格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// 将 LocalDateTime 转换为字符串
String startDate = localDateTime.format(formatter);
String startDate = dcSdhsEventQuery.getThisTime();
String lastTime = dcSdhsEventQuery.getLastTime();
String type = dcSdhsEventQuery.getType();
String periodType = "";
if (type.equals("2")) {
@ -2148,17 +2269,29 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
}
if (type.equals("1")) {
periodType = "3";
startDate=startDate+"-01";
lastTime=lastTime+"-01";
}
if (type.equals("0")) {
periodType = "1";
startDate=startDate+"-01-01";
lastTime=lastTime+"-01-01";
}
//菏泽方向
List<TrafficFlowStatisticsMap> hezeDirection = dcGantryStatisticsDataService.trafficFlowStatisticsAsc(startDate,startDate,"1",periodType);
List<TrafficFlowStatisticsMap> heze = dcGantryStatisticsDataService.trafficFlowStatisticsAsc(startDate, startDate, "1", periodType);
//济南方向
List<TrafficFlowStatisticsMap> jinan = dcGantryStatisticsDataService.trafficFlowStatisticsAsc(startDate, startDate, "3", periodType);
//菏泽方向
List<TrafficFlowStatisticsMap> lastHeze = dcGantryStatisticsDataService.trafficFlowStatisticsAsc(lastTime, lastTime, "1", periodType);
//济南方向
List<TrafficFlowStatisticsMap> jinanDirection = dcGantryStatisticsDataService.trafficFlowStatisticsAsc(startDate,startDate,"3",periodType);
List<TrafficFlowStatisticsMap> lastJinan = dcGantryStatisticsDataService.trafficFlowStatisticsAsc(lastTime, lastTime, "3", periodType);
Map<String, List<TrafficFlowStatisticsMap>> map = new HashMap<>();
map.put("hezeDirection",hezeDirection);
map.put("jinanDirection",jinanDirection);
map.put(dcSdhsEventQuery.getThisTime()+"heze", heze);
map.put(dcSdhsEventQuery.getThisTime()+"jinan", jinan);
map.put(dcSdhsEventQuery.getLastTime()+"heze", lastHeze);
map.put(dcSdhsEventQuery.getLastTime()+"jinan", lastJinan);
return map;
}
@ -2170,8 +2303,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
* @return 高速云事件
*/
@Override
public DcSdhsEvent selectDcSdhsEventById(Long id)
{
public DcSdhsEvent selectDcSdhsEventById(Long id) {
return dcSdhsEventMapper.selectDcSdhsEventById(id);
}
@ -2182,8 +2314,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
* @return 高速云事件
*/
@Override
public List<DcSdhsEvent> selectDcSdhsEventList(DcSdhsEvent dcSdhsEvent)
{
public List<DcSdhsEvent> selectDcSdhsEventList(DcSdhsEvent dcSdhsEvent) {
return dcSdhsEventMapper.selectDcSdhsEventList(dcSdhsEvent);
}
@ -2194,8 +2325,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
* @return 结果
*/
@Override
public int insertDcSdhsEvent(DcSdhsEvent dcSdhsEvent)
{
public int insertDcSdhsEvent(DcSdhsEvent dcSdhsEvent) {
return dcSdhsEventMapper.insertDcSdhsEvent(dcSdhsEvent);
}
@ -2206,8 +2336,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
* @return 结果
*/
@Override
public int updateDcSdhsEvent(DcSdhsEvent dcSdhsEvent)
{
public int updateDcSdhsEvent(DcSdhsEvent dcSdhsEvent) {
return dcSdhsEventMapper.updateDcSdhsEvent(dcSdhsEvent);
}
@ -2218,8 +2347,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
* @return 结果
*/
@Override
public int deleteDcSdhsEventByIds(Long[] ids)
{
public int deleteDcSdhsEventByIds(Long[] ids) {
return dcSdhsEventMapper.deleteDcSdhsEventByIds(ids);
}
@ -2230,8 +2358,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
* @return 结果
*/
@Override
public int deleteDcSdhsEventById(Long id)
{
public int deleteDcSdhsEventById(Long id) {
return dcSdhsEventMapper.deleteDcSdhsEventById(id);
}

4
zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java

@ -1245,8 +1245,8 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi
.filter(device -> device.getFacilitiesType() .equals("1"))
.filter(device -> {
int deviceStakeMarkMeters = StakeMarkUtils.stakeMarkToInt(device.getStakeMark());
//return deviceStakeMarkMeters >= StakeMarkUtils.stakeMarkToInt("K111+107") && deviceStakeMarkMeters <= StakeMarkUtils.stakeMarkToInt("K132+577") ;
return deviceStakeMarkMeters >= StakeMarkUtils.stakeMarkToInt(stakeMark) && deviceStakeMarkMeters <= StakeMarkUtils.stakeMarkToInt(jsonObject.get("endMark").toString()) ;
return deviceStakeMarkMeters >= StakeMarkUtils.stakeMarkToInt("K111+107") && deviceStakeMarkMeters <= StakeMarkUtils.stakeMarkToInt("K132+577") ;
// return deviceStakeMarkMeters >= StakeMarkUtils.stakeMarkToInt(stakeMark) && deviceStakeMarkMeters <= StakeMarkUtils.stakeMarkToInt(jsonObject.get("endMark").toString()) ;
})
.sorted(Comparator.comparingInt(device -> StakeMarkUtils.stakeMarkToInt(device.getStakeMark())))
.collect(Collectors.toList());

17
zc-business/src/main/resources/mapper/business/DcSdhsEventMapper.xml

@ -259,4 +259,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
delete from dc_sdhs_event
where start_time >= #{startTime} and start_time &lt;= #{endTime}
</delete>
<select id="selectAccidentModelAnalysis" resultType="com.zc.business.domain.DcSdhsEvent">
SELECT * FROM `dc_sdhs_event`
<where>
event_type = '交通事故'
<if test="type != null and type == '0'.toString">
and DATE_FORMAT(start_time,'%Y') = #{time}
</if>
<if test="type != null and type == '1'.toString">
and DATE_FORMAT(start_time,'%Y-%m') = #{time}
</if>
<if test="type != null and type == '2'.toString">
and DATE_FORMAT(start_time,'%Y-%m-%d') = #{time}
</if>
</where>
</select>
</mapper>

BIN
zc-business/src/main/resources/wordTemplate/accidentModelAnalysis.docx

Binary file not shown.

BIN
zc-business/src/main/resources/wordTemplate/frameDataAnalysis.docx

Binary file not shown.

BIN
zc-business/src/main/resources/wordTemplate/tollGateEntrance.docx

Binary file not shown.
Loading…
Cancel
Save