| | |
| | | return buildResponse(reportService.exportWycSplit(period, mode), String.format("生成_网约车客运量拆分表_%s.xlsx", period)); |
| | | } |
| | | |
| | | /** 生成_能运汇总表.xlsx(H204,全省 + 各市州 sheet) */ |
| | | @GetMapping("/export/energySummary") |
| | | public ResponseEntity<byte[]> exportEnergySummary(@RequestParam("period") String period) throws Exception { |
| | | logExport("生成_能运汇总表.xlsx", period); |
| | | return buildResponse(reportService.exportEnergySummary(period), "生成_能运汇总表.xlsx"); |
| | | /** 季度汇总测试版:所选季度 15 字段,插入到汇总表 B/C 列之间 */ |
| | | @GetMapping("/export/energyQuarterSummary") |
| | | public ResponseEntity<byte[]> exportEnergyQuarterSummary(@RequestParam("period") String period) throws Exception { |
| | | String fileName = "生成_" + energyPeriodCn(period) + "能运汇总表.xlsx"; |
| | | logExport(fileName, period); |
| | | return buildResponse(reportService.exportEnergyQuarterSummary(period), fileName); |
| | | } |
| | | |
| | | /** 领导版:10 字段简表,当前季度 + 去年同期 */ |
| | | @GetMapping("/export/energyLeader") |
| | | public ResponseEntity<byte[]> exportEnergyLeader(@RequestParam("period") String period) throws Exception { |
| | | String fileName = "生成_" + energyPeriodCn(period) + "能耗汇总表(领导版).xlsx"; |
| | | logExport(fileName, period); |
| | | return buildResponse(reportService.exportEnergyLeader(period), fileName); |
| | | } |
| | | /** 生成_城市公交客运量分市州明细.xlsx(城市客运第1步,公交) */ |
| | | @GetMapping("/export/cityBusDetail") |
| | |
| | | .body(data); |
| | | } |
| | | |
| | | /** 报表期 yyyy-MM -> 中文年月(2025-06 -> 2025年6月) */ |
| | | private String energyPeriodCn(String period) { |
| | | if (period == null || period.length() < 7) return period == null ? "" : period; |
| | | int year = Integer.parseInt(period.substring(0, 4)); |
| | | int month = Integer.parseInt(period.substring(5, 7)); |
| | | return year + "年" + month + "月"; |
| | | } |
| | | |
| | | private ResponseEntity<byte[]> buildResponse(byte[] data, String fileName) throws Exception { |
| | | String encoded = URLEncoder.encode(fileName, "UTF-8").replace("+", "%20"); |
| | | String type = fileName.toLowerCase().endsWith(".xls") |