|
|
@ -642,7 +642,14 @@ public AjaxResult trafficFlowAtTollStationEntrance(String startDate, String endD |
|
|
|
@ApiOperation("全路段双向实时车流量") |
|
|
|
@GetMapping("/history/realTimeTrafficFlowHour") |
|
|
|
public AjaxResult realTimeTrafficFlowHour(String startDate,Long direction) throws HttpException, IOException{ |
|
|
|
List<Map<String,Object>> mapList = dcTrafficStatisticsService.realTimeTrafficFlowHour(startDate,direction); |
|
|
|
Map<String,List<Map<String, Object>>> mapList = dcTrafficStatisticsService.realTimeTrafficFlowHour(startDate,direction); |
|
|
|
// 将查询结果封装为成功响应并返回
|
|
|
|
return AjaxResult.success(mapList); |
|
|
|
} |
|
|
|
@ApiOperation("按照桩号查询门架数据 ") |
|
|
|
@GetMapping("/history/queryTheGantryDataByPileNumber") |
|
|
|
public AjaxResult queryTheGantryDataByPileNumber(String startDate,String stakeMark) throws HttpException, IOException{ |
|
|
|
List<Map<String,Object>> mapList = dcTrafficStatisticsService.queryTheGantryDataByPileNumber(startDate,stakeMark); |
|
|
|
// 将查询结果封装为成功响应并返回
|
|
|
|
return AjaxResult.success(mapList); |
|
|
|
} |
|
|
@ -663,133 +670,133 @@ public AjaxResult trafficFlowAtTollStationEntrance(String startDate, String endD |
|
|
|
/** |
|
|
|
* 导出全路段双向实时车流量 |
|
|
|
*/ |
|
|
|
@ApiOperation(value = "导出全路段双向实时车流量",tags = {"ECharts导出"}) |
|
|
|
@GetMapping("/history/exportRealTimeTrafficFlowHour") |
|
|
|
public AjaxResult exportRealTimeTrafficFlowHour(HttpServletResponse response) throws IOException, HttpException { |
|
|
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
|
|
|
LocalDate currentDate = LocalDate.now(); |
|
|
|
String now = currentDate.format(formatter); |
|
|
|
|
|
|
|
// 获取一年前的日期
|
|
|
|
LocalDate oneYearAgo = currentDate.minusYears(1); |
|
|
|
String lastYear = oneYearAgo.format(formatter); |
|
|
|
|
|
|
|
List<Map<String,Object>> thisYearHZ = dcTrafficStatisticsService.realTimeTrafficFlowHour(now,1L); |
|
|
|
List<Map<String,Object>> thisYearJN = dcTrafficStatisticsService.realTimeTrafficFlowHour(now,3L); |
|
|
|
List<Map<String,Object>> lastYearHZ = dcTrafficStatisticsService.realTimeTrafficFlowHour(lastYear,1L); |
|
|
|
List<Map<String,Object>> lastYearJN = dcTrafficStatisticsService.realTimeTrafficFlowHour(lastYear,3L); |
|
|
|
|
|
|
|
Workbook workbook = new XSSFWorkbook(); // 创建工作簿
|
|
|
|
Sheet sheet = workbook.createSheet("全路段双向实时车流量"); // 创建工作表
|
|
|
|
|
|
|
|
// 创建数据行样式
|
|
|
|
CellStyle dataStyle = workbook.createCellStyle(); |
|
|
|
dataStyle.setAlignment(HorizontalAlignment.CENTER); |
|
|
|
dataStyle.setVerticalAlignment(VerticalAlignment.CENTER); |
|
|
|
dataStyle.setBorderRight(BorderStyle.THIN); |
|
|
|
dataStyle.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
|
|
|
dataStyle.setBorderLeft(BorderStyle.THIN); |
|
|
|
dataStyle.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
|
|
|
dataStyle.setBorderTop(BorderStyle.THIN); |
|
|
|
dataStyle.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
|
|
|
dataStyle.setBorderBottom(BorderStyle.THIN); |
|
|
|
dataStyle.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
|
|
|
Font dataFont = workbook.createFont(); |
|
|
|
dataFont.setFontName("Arial"); |
|
|
|
dataFont.setFontHeightInPoints((short) 10); |
|
|
|
dataStyle.setFont(dataFont); |
|
|
|
|
|
|
|
// 创建表头样式
|
|
|
|
CellStyle headerStyle = workbook.createCellStyle(); |
|
|
|
headerStyle.cloneStyleFrom(dataStyle); |
|
|
|
headerStyle.setAlignment(HorizontalAlignment.CENTER); |
|
|
|
headerStyle.setVerticalAlignment(VerticalAlignment.CENTER); |
|
|
|
headerStyle.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
|
|
|
headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); |
|
|
|
Font headerFont = workbook.createFont(); |
|
|
|
headerFont.setFontName("Arial"); |
|
|
|
headerFont.setFontHeightInPoints((short) 10); |
|
|
|
headerFont.setBold(true); |
|
|
|
headerFont.setColor(IndexedColors.WHITE.getIndex()); |
|
|
|
headerStyle.setFont(headerFont); |
|
|
|
|
|
|
|
// 添加第一层级表头
|
|
|
|
Row row = sheet.createRow(0); |
|
|
|
Cell cell = row.createCell(0); |
|
|
|
cell.setCellValue("路段名称"); |
|
|
|
cell.setCellStyle(headerStyle); |
|
|
|
cell = row.createCell(1); |
|
|
|
cell.setCellValue("济南方向"); |
|
|
|
cell.setCellStyle(headerStyle); |
|
|
|
cell = row.createCell(2); |
|
|
|
cell.setCellValue(""); |
|
|
|
cell.setCellStyle(headerStyle);; |
|
|
|
cell = row.createCell(3); |
|
|
|
cell.setCellValue("菏泽方向"); |
|
|
|
cell.setCellStyle(headerStyle); |
|
|
|
cell = row.createCell(4); |
|
|
|
cell.setCellValue(""); |
|
|
|
cell.setCellStyle(headerStyle); |
|
|
|
|
|
|
|
// 添加第二层级表头(与第一层级对齐)
|
|
|
|
Row subHeaderRow1 = sheet.createRow(1); |
|
|
|
cell = subHeaderRow1.createCell(0); |
|
|
|
cell.setCellValue(""); |
|
|
|
cell.setCellStyle(headerStyle); |
|
|
|
cell = subHeaderRow1.createCell(1); |
|
|
|
cell.setCellValue("本期车流量"); |
|
|
|
cell.setCellStyle(headerStyle); |
|
|
|
|
|
|
|
cell = subHeaderRow1.createCell(2); |
|
|
|
cell.setCellValue("去年同期"); |
|
|
|
cell.setCellStyle(headerStyle); |
|
|
|
cell = subHeaderRow1.createCell(3); |
|
|
|
cell.setCellValue("本期车流量"); |
|
|
|
cell.setCellStyle(headerStyle); |
|
|
|
|
|
|
|
cell = subHeaderRow1.createCell(4); |
|
|
|
cell.setCellValue("去年同期"); |
|
|
|
cell.setCellStyle(headerStyle); |
|
|
|
|
|
|
|
//合并单元格,参数依次为起始行,结束行,起始列,结束列 (从0开始)
|
|
|
|
//路段名称
|
|
|
|
sheet.addMergedRegion(new CellRangeAddress(0, 1, 0, 0)); |
|
|
|
//济南方向
|
|
|
|
sheet.addMergedRegion(new CellRangeAddress(0, 0, 1, 2)); |
|
|
|
//菏泽方向
|
|
|
|
sheet.addMergedRegion(new CellRangeAddress(0, 0, 3, 4)); |
|
|
|
|
|
|
|
for (int i = 0; i < thisYearHZ.size(); i++) { |
|
|
|
Row subHeaderRow = sheet.createRow(i+2); |
|
|
|
cell = subHeaderRow.createCell(0); |
|
|
|
cell.setCellValue(thisYearJN.get(i).get("name").toString()); |
|
|
|
cell.setCellStyle(dataStyle); |
|
|
|
cell = subHeaderRow.createCell(1); |
|
|
|
cell.setCellValue(thisYearJN.get(i).get("totalFlow").toString()); |
|
|
|
cell.setCellStyle(dataStyle); |
|
|
|
cell = subHeaderRow.createCell(2); |
|
|
|
cell.setCellValue(lastYearJN.get(i).get("totalFlow").toString()); |
|
|
|
cell.setCellStyle(dataStyle); |
|
|
|
cell = subHeaderRow.createCell(3); |
|
|
|
cell.setCellValue(thisYearHZ.get(i).get("totalFlow").toString()); |
|
|
|
cell.setCellStyle(dataStyle); |
|
|
|
cell = subHeaderRow.createCell(4); |
|
|
|
cell.setCellValue(lastYearHZ.get(i).get("totalFlow").toString()); |
|
|
|
cell.setCellStyle(dataStyle); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 写入文件
|
|
|
|
try { |
|
|
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
|
|
|
response.setCharacterEncoding("utf-8"); |
|
|
|
workbook.write(response.getOutputStream()); |
|
|
|
} finally { |
|
|
|
workbook.close(); |
|
|
|
} |
|
|
|
|
|
|
|
return AjaxResult.success("导出感知事件多发时段成功"); |
|
|
|
} |
|
|
|
// @ApiOperation(value = "导出全路段双向实时车流量",tags = {"ECharts导出"})
|
|
|
|
// @GetMapping("/history/exportRealTimeTrafficFlowHour")
|
|
|
|
// public AjaxResult exportRealTimeTrafficFlowHour(HttpServletResponse response) throws IOException, HttpException {
|
|
|
|
//
|
|
|
|
// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
// LocalDate currentDate = LocalDate.now();
|
|
|
|
// String now = currentDate.format(formatter);
|
|
|
|
//
|
|
|
|
// // 获取一年前的日期
|
|
|
|
// LocalDate oneYearAgo = currentDate.minusYears(1);
|
|
|
|
// String lastYear = oneYearAgo.format(formatter);
|
|
|
|
//
|
|
|
|
// List<Map<String,Object>> thisYearHZ = dcTrafficStatisticsService.realTimeTrafficFlowHour(now,1L);
|
|
|
|
// List<Map<String,Object>> thisYearJN = dcTrafficStatisticsService.realTimeTrafficFlowHour(now,3L);
|
|
|
|
// List<Map<String,Object>> lastYearHZ = dcTrafficStatisticsService.realTimeTrafficFlowHour(lastYear,1L);
|
|
|
|
// List<Map<String,Object>> lastYearJN = dcTrafficStatisticsService.realTimeTrafficFlowHour(lastYear,3L);
|
|
|
|
//
|
|
|
|
// Workbook workbook = new XSSFWorkbook(); // 创建工作簿
|
|
|
|
// Sheet sheet = workbook.createSheet("全路段双向实时车流量"); // 创建工作表
|
|
|
|
//
|
|
|
|
// // 创建数据行样式
|
|
|
|
// CellStyle dataStyle = workbook.createCellStyle();
|
|
|
|
// dataStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
|
// dataStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
|
// dataStyle.setBorderRight(BorderStyle.THIN);
|
|
|
|
// dataStyle.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
|
|
|
|
// dataStyle.setBorderLeft(BorderStyle.THIN);
|
|
|
|
// dataStyle.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
|
|
|
|
// dataStyle.setBorderTop(BorderStyle.THIN);
|
|
|
|
// dataStyle.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
|
|
|
|
// dataStyle.setBorderBottom(BorderStyle.THIN);
|
|
|
|
// dataStyle.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
|
|
|
|
// Font dataFont = workbook.createFont();
|
|
|
|
// dataFont.setFontName("Arial");
|
|
|
|
// dataFont.setFontHeightInPoints((short) 10);
|
|
|
|
// dataStyle.setFont(dataFont);
|
|
|
|
//
|
|
|
|
// // 创建表头样式
|
|
|
|
// CellStyle headerStyle = workbook.createCellStyle();
|
|
|
|
// headerStyle.cloneStyleFrom(dataStyle);
|
|
|
|
// headerStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
|
// headerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
|
// headerStyle.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
|
|
|
|
// headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
|
|
|
// Font headerFont = workbook.createFont();
|
|
|
|
// headerFont.setFontName("Arial");
|
|
|
|
// headerFont.setFontHeightInPoints((short) 10);
|
|
|
|
// headerFont.setBold(true);
|
|
|
|
// headerFont.setColor(IndexedColors.WHITE.getIndex());
|
|
|
|
// headerStyle.setFont(headerFont);
|
|
|
|
//
|
|
|
|
// // 添加第一层级表头
|
|
|
|
// Row row = sheet.createRow(0);
|
|
|
|
// Cell cell = row.createCell(0);
|
|
|
|
// cell.setCellValue("路段名称");
|
|
|
|
// cell.setCellStyle(headerStyle);
|
|
|
|
// cell = row.createCell(1);
|
|
|
|
// cell.setCellValue("济南方向");
|
|
|
|
// cell.setCellStyle(headerStyle);
|
|
|
|
// cell = row.createCell(2);
|
|
|
|
// cell.setCellValue("");
|
|
|
|
// cell.setCellStyle(headerStyle);;
|
|
|
|
// cell = row.createCell(3);
|
|
|
|
// cell.setCellValue("菏泽方向");
|
|
|
|
// cell.setCellStyle(headerStyle);
|
|
|
|
// cell = row.createCell(4);
|
|
|
|
// cell.setCellValue("");
|
|
|
|
// cell.setCellStyle(headerStyle);
|
|
|
|
//
|
|
|
|
// // 添加第二层级表头(与第一层级对齐)
|
|
|
|
// Row subHeaderRow1 = sheet.createRow(1);
|
|
|
|
// cell = subHeaderRow1.createCell(0);
|
|
|
|
// cell.setCellValue("");
|
|
|
|
// cell.setCellStyle(headerStyle);
|
|
|
|
// cell = subHeaderRow1.createCell(1);
|
|
|
|
// cell.setCellValue("本期车流量");
|
|
|
|
// cell.setCellStyle(headerStyle);
|
|
|
|
//
|
|
|
|
// cell = subHeaderRow1.createCell(2);
|
|
|
|
// cell.setCellValue("去年同期");
|
|
|
|
// cell.setCellStyle(headerStyle);
|
|
|
|
// cell = subHeaderRow1.createCell(3);
|
|
|
|
// cell.setCellValue("本期车流量");
|
|
|
|
// cell.setCellStyle(headerStyle);
|
|
|
|
//
|
|
|
|
// cell = subHeaderRow1.createCell(4);
|
|
|
|
// cell.setCellValue("去年同期");
|
|
|
|
// cell.setCellStyle(headerStyle);
|
|
|
|
//
|
|
|
|
// //合并单元格,参数依次为起始行,结束行,起始列,结束列 (从0开始)
|
|
|
|
// //路段名称
|
|
|
|
// sheet.addMergedRegion(new CellRangeAddress(0, 1, 0, 0));
|
|
|
|
// //济南方向
|
|
|
|
// sheet.addMergedRegion(new CellRangeAddress(0, 0, 1, 2));
|
|
|
|
// //菏泽方向
|
|
|
|
// sheet.addMergedRegion(new CellRangeAddress(0, 0, 3, 4));
|
|
|
|
//
|
|
|
|
// for (int i = 0; i < thisYearHZ.size(); i++) {
|
|
|
|
// Row subHeaderRow = sheet.createRow(i+2);
|
|
|
|
// cell = subHeaderRow.createCell(0);
|
|
|
|
// cell.setCellValue(thisYearJN.get(i).get("name").toString());
|
|
|
|
// cell.setCellStyle(dataStyle);
|
|
|
|
// cell = subHeaderRow.createCell(1);
|
|
|
|
// cell.setCellValue(thisYearJN.get(i).get("totalFlow").toString());
|
|
|
|
// cell.setCellStyle(dataStyle);
|
|
|
|
// cell = subHeaderRow.createCell(2);
|
|
|
|
// cell.setCellValue(lastYearJN.get(i).get("totalFlow").toString());
|
|
|
|
// cell.setCellStyle(dataStyle);
|
|
|
|
// cell = subHeaderRow.createCell(3);
|
|
|
|
// cell.setCellValue(thisYearHZ.get(i).get("totalFlow").toString());
|
|
|
|
// cell.setCellStyle(dataStyle);
|
|
|
|
// cell = subHeaderRow.createCell(4);
|
|
|
|
// cell.setCellValue(lastYearHZ.get(i).get("totalFlow").toString());
|
|
|
|
// cell.setCellStyle(dataStyle);
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// // 写入文件
|
|
|
|
// try {
|
|
|
|
// response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
|
|
|
// response.setCharacterEncoding("utf-8");
|
|
|
|
// workbook.write(response.getOutputStream());
|
|
|
|
// } finally {
|
|
|
|
// workbook.close();
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// return AjaxResult.success("导出感知事件多发时段成功");
|
|
|
|
// }
|
|
|
|
|
|
|
|
} |