From f241309ef7b1750a1a6e899f09eb8c2c3c761860 Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期三, 11 十一月 2026 20:07:39 +0800
Subject: [PATCH] fix(公路旅客): 修正个体客运模板路径和月份匹配
---
traffic-audit-server/src/main/java/com/trafficaudit/dataimport/controller/DataImportController.java | 93 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 93 insertions(+), 0 deletions(-)
diff --git a/traffic-audit-server/src/main/java/com/trafficaudit/dataimport/controller/DataImportController.java b/traffic-audit-server/src/main/java/com/trafficaudit/dataimport/controller/DataImportController.java
index 18e657b..672845c 100644
--- a/traffic-audit-server/src/main/java/com/trafficaudit/dataimport/controller/DataImportController.java
+++ b/traffic-audit-server/src/main/java/com/trafficaudit/dataimport/controller/DataImportController.java
@@ -42,6 +42,20 @@
}
}
+ /** H202 highway freight operating vehicle ownership. */
+ @PostMapping("/h202")
+ public Result<String> importH202(@RequestParam("file") MultipartFile file,
+ @RequestParam("period") String period) {
+ try {
+ ImportResult result = importService.importH202(file, period);
+ return Result.ok("\u516c\u8def\u8d27\u7269\u8425\u8fd0\u8f66\u8f86\u62e5\u6709\u60c5\u51b5(H202)\u5bfc\u5165\u6210\u529f\uff0c\u5171 "
+ + result.getSuccess() + " \u4e2a\u6307\u6807");
+ } catch (Exception e) {
+ log.error("H202 import error", e);
+ return Result.error("\u5bfc\u5165\u5931\u8d25: " + e.getMessage());
+ }
+ }
+
private String buildH2032Message(ImportResult r) {
if (r.getFail() == 0) {
return "H2032鏈堟姤瀵煎叆鎴愬姛锛屽叡 " + r.getSuccess() + " 鏉¤褰�";
@@ -75,6 +89,17 @@
}
if (details.size() > shown) {
msg += "\n鈥︹�﹀叡 " + details.size() + " 琛屽け璐�";
+ }
+ }
+ if (result.getWarnings() != null && !result.getWarnings().isEmpty()) {
+ java.util.List<String> warnings = result.getWarnings();
+ msg += "\n浠ヤ笅 " + warnings.size() + " 澶勪负鎻愰啋锛堜笉褰卞搷瀵煎叆锛夛細";
+ int shownWarn = Math.min(warnings.size(), 100);
+ for (int i = 0; i < shownWarn; i++) {
+ msg += "\n" + warnings.get(i);
+ }
+ if (warnings.size() > shownWarn) {
+ msg += "\n鈥︹�﹀彟鏈� " + (warnings.size() - shownWarn) + " 澶勬彁閱�";
}
}
return Result.ok(msg);
@@ -238,6 +263,51 @@
return Result.ok("鍑虹杞﹁繍鏀胯溅杈嗗鍏ユ垚鍔�, 鍏� " + count + " 鏉¤褰�");
} catch (Exception e) {
log.error("cityTaxiAuth import error", e);
+ return Result.error("瀵煎叆澶辫触: " + e.getMessage());
+ }
+ }
+
+
+ /** 缃戠害杞︽�绘暟锛堟湀搴﹀叏鐪� pin锛氭ā鏉縚缃戠害杞︽�绘暟.xlsx锛� */
+ @PostMapping("/wycTotal")
+ public Result<String> importWycTotal(@RequestParam("file") MultipartFile file,
+ @RequestParam("period") String period) {
+ try {
+ int count = importService.importWycTotal(file, period);
+ return Result.ok("缃戠害杞︽�绘暟瀵煎叆鎴愬姛, 鍏� " + count + " 鏈�");
+ } catch (Exception e) {
+ log.error("wycTotal import error", e);
+ return Result.error("瀵煎叆澶辫触: " + e.getMessage());
+ }
+ }
+
+ /** 缃戠害杞﹁鍗曞強鍏ㄧ渷鎬婚噺锛堟ā鏉縚缃戠害杞﹁鍗曞強鍏ㄧ渷鎬婚噺.xlsx锛� */
+ @PostMapping("/wycOrder")
+ public Result<String> importWycOrder(@RequestParam("file") MultipartFile file,
+ @RequestParam("period") String period) {
+ try {
+ int count = importService.importWycOrder(file, period);
+ return Result.ok("缃戠害杞﹁鍗曞強鍏ㄧ渷鎬婚噺瀵煎叆鎴愬姛, 鍏� " + count + " 鏈�");
+ } catch (Exception e) {
+ log.error("wycOrder import error", e);
+ return Result.error("瀵煎叆澶辫触: " + e.getMessage());
+ }
+ }
+
+ /** 缃戠害杞﹁鍗曡繍琛岀洃娴嬪垎鏋愭姤鍛婏紙docx锛氥�婄綉绾﹁溅琛屼笟YYYY骞碝鏈堣繍琛岀洃娴嬫儏鍐靛垎鏋愭姤鍛娿�嬶級 */
+ @PostMapping("/wycOrderReport")
+ public Result<String> importWycOrderReport(@RequestParam("file") MultipartFile file,
+ @RequestParam("period") String period) {
+ try {
+ DataImportService.WycOrderReportResult r = importService.importWycOrderReport(file, period);
+ StringBuilder msg = new StringBuilder("缃戠害杞﹁鍗曟姤鍛婂鍏ユ垚鍔燂細鎶ヨ〃鏈� " + r.getPeriod()
+ + "锛岃鍗曞悎璁� " + String.format("%,.0f", r.getOrderSum()) + " 鍗曪紝宸插啓鍏� " + r.getCityCount() + " 涓競宸�");
+ if (!r.getMissingCities().isEmpty()) {
+ msg.append("锛涗互涓嬪競宸炴湭鍦ㄦ姤鍛婁腑瑙f瀽鍒帮紝鏈啓鍏ワ細").append(String.join("銆�", r.getMissingCities()));
+ }
+ return Result.ok(msg.toString());
+ } catch (Exception e) {
+ log.error("wycOrderReport import error", e);
return Result.error("瀵煎叆澶辫触: " + e.getMessage());
}
}
@@ -416,4 +486,27 @@
return Result.ok(result);
}
+ /**
+ * 娓呯┖鎸囧畾鎶ヨ〃鏈熷凡瀵煎叆鏁版嵁涓庡鏍哥粨鏋滐紙鏁版嵁瀵煎叆椤�"娓呯┖鏁版嵁"鍏ュ彛璋冪敤锛夛紝渚夸簬鏁存湀閲嶆柊瀵煎叆銆�
+ * types 涓虹┖琛ㄧず娓呯┖璇ユ姤琛ㄦ湡鍏ㄩ儴绫诲瀷锛涘惁鍒欏彧娓呯┖鎸囧畾鏁版嵁绫诲瀷锛堥�楀彿鍒嗛殧锛屽 h2032,cityBus锛夈��
+ */
+ @PostMapping("/clear")
+ public Result<Map<String, Object>> clearData(@RequestParam("period") String period,
+ @RequestParam(value = "types", required = false) String types) {
+ try {
+ List<String> typeList = new java.util.ArrayList<>();
+ if (types != null) {
+ for (String t : types.split(",")) {
+ String s = t.trim();
+ if (!s.isEmpty()) typeList.add(s);
+ }
+ }
+ Map<String, Object> stats = importService.clearPeriod(period, typeList);
+ return Result.ok(stats);
+ } catch (Exception e) {
+ log.error("clear period {} types {} error", period, types, e);
+ return Result.error("娓呯┖澶辫触: " + e.getMessage());
+ }
+ }
+
}
--
Gitblit v1.9.1