From d35a0a281f75dadb81029672442815fc8bc71d30 Mon Sep 17 00:00:00 2001
From: zhizhijie <zhizhijie@users.noreply.gitee.com>
Date: 星期二, 08 九月 2026 10:08:02 +0800
Subject: [PATCH] feat: 汇总大表数据驱动 M1-城市客运——新增 PaxCalc 计算服务(公交/出租/轨道轮渡)与 7 月回归测试报告
---
docs/功能测试报告/功能测试报告_M1-城市客运-公交出租轨道轮渡_2026-09-08.md | 35 +++++++++++
traffic-audit-server/src/main/java/com/trafficaudit/reportexport/calc/PaxCalc.java | 112 +++++++++++++++++++++++++++++++++++++
2 files changed, 147 insertions(+), 0 deletions(-)
diff --git "a/docs/\345\212\237\350\203\275\346\265\213\350\257\225\346\212\245\345\221\212/\345\212\237\350\203\275\346\265\213\350\257\225\346\212\245\345\221\212_M1-\345\237\216\345\270\202\345\256\242\350\277\220-\345\205\254\344\272\244\345\207\272\347\247\237\350\275\250\351\201\223\350\275\256\346\270\241_2026-09-08.md" "b/docs/\345\212\237\350\203\275\346\265\213\350\257\225\346\212\245\345\221\212/\345\212\237\350\203\275\346\265\213\350\257\225\346\212\245\345\221\212_M1-\345\237\216\345\270\202\345\256\242\350\277\220-\345\205\254\344\272\244\345\207\272\347\247\237\350\275\250\351\201\223\350\275\256\346\270\241_2026-09-08.md"
new file mode 100644
index 0000000..df3999f
--- /dev/null
+++ "b/docs/\345\212\237\350\203\275\346\265\213\350\257\225\346\212\245\345\221\212/\345\212\237\350\203\275\346\265\213\350\257\225\346\212\245\345\221\212_M1-\345\237\216\345\270\202\345\256\242\350\277\220-\345\205\254\344\272\244\345\207\272\347\247\237\350\275\250\351\201\223\350\275\256\346\270\241_2026-09-08.md"
@@ -0,0 +1,35 @@
+# 鍔熻兘娴嬭瘯鎶ュ憡锛歁1-鍩庡競瀹㈣繍 鍏氦/鍑虹/杞ㄩ亾杞浮 鍙栨暟鏍稿涓� 7 鏈堝洖褰掞紙2026-09-08锛�
+
+## 涓�銆佸姛鑳借鏄�
+M1 绗簩鍧楋細鏂板鍩庡競瀹㈣繍璁$畻鏈嶅姟 `PaxCalc`锛坄traffic-audit-server/.../reportexport/calc/PaxCalc.java`锛夛紝瀵� 鍏氦/宸℃父鍑虹/杞ㄩ亾/杞浮 鎻愪緵鈥滄湀 鈫� 甯傚窞 鈫� [瀹㈣繍閲�,鍛ㄨ浆閲�,鍩庡競鍐呭杩愰噺,鍩庡競鍐呭懆杞噺]锛堣建閬撹疆娓�=杞ㄩ亾瀹㈣繍閲�,杞ㄩ亾鍛ㄨ浆閲�,杞浮瀹㈣繍閲�,杞浮鍛ㄨ浆閲忥級鈥濈煩闃碉紝涓庢棦鏈� exportCityBusDetail / exportCityTaxiDetail / exportCityRailFerryDetail 鐨勫彇鏁伴�昏緫鍚屾瀯锛屼緵姹囨�诲ぇ琛ㄤ笌灏忚〃鍏辩敤銆�
+
+## 浜屻�佹祴璇曠幆澧�
+- 搴擄細`traffic_audit`锛�127.0.0.1:3308锛夛紝鏁版嵁 = 2026-07 鐜扮姸锛�
+- 瀵硅处姣嶇増锛歚docs/鐢熸垚姹囨�诲ぇ琛�/_澶囦唤_2026骞�7鏈堥亾璺繍杈撻噺姹囨�昏〃_娓呯悊鍓峗20260904.xlsx`锛堝惈 5-7 鏈堟暟鎹殑宸蹭慨姝f瘝鐗堬紱`2026骞�7鏈堥亾璺繍杈撻噺姹囨�昏〃.xlsx` 涓� 1-4 鏈堢┖楠ㄦ灦锛屼笉鍚� 7 鏈堝彴璐﹀垪锛夛紱
+- 宸ュ叿锛歮ysql CLI + Python 閲嶇畻 vs 姣嶇増 O 鍒楋紙2026-07锛夛紱鍚庣 `mvn -q -DskipTests compile` 閫氳繃銆�
+
+## 涓夈�佸彇鏁板彛寰勶紙涓庢棦鏈夊鍑轰竴鑷达級
+| 鍙拌处椤� | 鏉ユ簮 | 琛岀粨鏋勶紙O 鍒� 2026-07锛� |
+|---|---|---|
+| 鍏氦 | `city_bus_monthly` 鎸� city 姹囨�� [passenger_volume,turnover,passenger_city,turnover_city] | 鍏ㄧ渷 r5-8锛涘競宸� r(9+4i)..r(12+4i)锛堝杩愰噺/鍛ㄨ浆閲�/鍩庡競鍐呭杩愰噺/鍩庡競鍐呭懆杞噺锛� |
+| 鍑虹 | `city_taxi_monthly` 鍚屽瓧娈� | 鍚� 鍏氦 |
+| 杞ㄩ亾銆佽疆娓� | `city_bus_monthly` 鐨� rail_*/ferry_*锛堣建閬�=姝︽眽/榛勭煶锛岃疆娓�=姝︽眽锛� | 杞ㄩ亾 r6/7=姝︽眽銆乺8/9=榛勭煶锛涜疆娓� r15/16=姝︽眽锛涘叏鐪�=鍚堣鍏紡 |
+| 鍏ㄧ渷 | 17 甯傚窞涔嬪拰锛堝惈璺ㄥ尯鍘垮琛岀疮鍔狅級 | 姣嶇増鍏ㄧ渷琛屽叕寮� |
+
+## 鍥涖�佺敤渚嬭〃
+| # | 鐢ㄤ緥 | 杈撳叆 | 棰勬湡 | 瀹為檯 | 缁撹 |
+|---|---|---|---|---|---|
+| 1 | 鍏氦鍙拌处椤� 2026-07 | DB 2026-07 鎸� city 姹囨�� | 涓庢瘝鐗� O 鍒� 18 琛屽潡锛堝叏鐪�+17 甯傚窞脳4 鎸囨爣锛変竴鑷� | diff=0 | 閫氳繃 |
+| 2 | 鍑虹鍙拌处椤� 2026-07 | DB 2026-07 鎸� city 姹囨�� | 鍚屼笂 | diff=0 | 閫氳繃 |
+| 3 | 杞ㄩ亾鍙拌处椤� 2026-07 | city_bus rail 瀛楁锛堟姹�/榛勭煶锛� | 姝︽眽 11701.74/96240.86銆侀粍鐭� 30.09/404.37銆佸叏鐪� 11731.83 | 涓�鑷达紙0 diff锛� | 閫氳繃 |
+| 4 | 杞浮鍙拌处椤� 2026-07 | city_bus ferry 瀛楁锛堟姹夛級 | 鍏ㄧ渷=姝︽眽=46.05锛堝杩愰噺锛� | 涓�鑷达紙0 diff锛� | 閫氳繃 |
+| 5 | Java 缂栬瘧 | `mvn -q -DskipTests compile` | 鏃犻敊璇� | exit=0 | 閫氳繃 |
+
+## 浜斻�佸彂鐜扮殑闂涓庡缃�
+1. 娉ㄩ噴鍐呭嚭鐜� `rail_*/ferry_*`锛屽叾涓� `*/` 鎻愬墠缁堟 Javadoc 鍧楁敞閲婂鑷寸紪璇戝け璐� 鈫� 鏀逛负鈥渞ail 涓� ferry 瀛楁鈥濓紝缂栬瘧閫氳繃锛堟湰闂浠呭奖鍝嶆敞閲婂啓娉曪紝涓庡彛寰勬棤鍏筹級銆�
+2. 瀵硅处姣嶇増閫夋嫨锛歚2026骞�7鏈堚�︽眹鎬昏〃.xlsx` 鏄� 1-4 鏈堢┖楠ㄦ灦锛堝彴璐﹂〉鏃� 5-7 鏈堝垪锛夛紝7 鏈堝彴璐︽暟鍊奸』浠� `_澶囦唤_鈥娓呯悊鍓峗20260904.xlsx` 涓哄熀绾库�斺�斿凡鍦ㄦ祴璇曠幆澧冩敞鏄庯紝M2 鍥炲綊鏃剁粺涓�鐢ㄨ澶囦唤鏂囦欢銆�
+3. 鏁版嵁渚у彛寰勫鏍革紙鏃犻渶鏀瑰姩锛夛細甯傚窞瀛樺湪澶氫釜鍖哄幙浠g爜琛岋紝椤绘寜 city 姹囨�荤疮鍔狅紙涓� Java 鏃㈡湁瀹炵幇涓�鑷达級銆�
+
+## 鍏�佺粨璁轰笌涓嬩竴姝�
+- 缁撹锛氬叕浜�/鍑虹/杞ㄩ亾/杞浮 7 鏈堝彴璐﹀彲浠庡簱瀹屾暣澶嶇畻锛�0 宸紓锛夛紝`PaxCalc` 宸插叆搴撳苟閫氳繃缂栬瘧銆�
+- 涓嬩竴姝ワ細M1-缃戠害杞︼紙WyCSplitCalc锛氳鍗暶楀叏鐪� pin脳宸℃父鍑虹鎷嗗垎锛夆啋 鍩庡競瀹㈣繍鍙拌处/鍩庡競姹囨��/鍩庡競鍒嗗競宸� 7 鏈堝洖褰� 鈫� M1-MidCalc 鈫� M2 SummaryFiller 鍐欏洖涓庨�愭牸 diff銆�
diff --git a/traffic-audit-server/src/main/java/com/trafficaudit/reportexport/calc/PaxCalc.java b/traffic-audit-server/src/main/java/com/trafficaudit/reportexport/calc/PaxCalc.java
new file mode 100644
index 0000000..053cf1c
--- /dev/null
+++ b/traffic-audit-server/src/main/java/com/trafficaudit/reportexport/calc/PaxCalc.java
@@ -0,0 +1,112 @@
+package com.trafficaudit.reportexport.calc;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.trafficaudit.dataimport.entity.CityBusMonthly;
+import com.trafficaudit.dataimport.entity.CityTaxiMonthly;
+import com.trafficaudit.dataimport.mapper.CityBusMonthlyMapper;
+import com.trafficaudit.dataimport.mapper.CityTaxiMonthlyMapper;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 鍩庡競瀹㈣繍鍙e緞璁$畻鏈嶅姟锛堟眹鎬诲ぇ琛ㄦ暟鎹┍鍔ㄦ敼閫� M1-鍩庡競瀹㈣繍-鍏氦/鍑虹/杞ㄩ亾杞浮锛�2026-09-08锛夈��
+ *
+ * 鍙e緞涓庢棦鏈夊琛ㄥ鍑� loadCityBusByMonth / loadCityTaxiByMonth / loadCityRailFerryByMonth 瀹屽叏涓�鑷�
+ * 锛堝喅绛栧熀绾� A2/B4/B5/C7锛�2026-07 涓� _澶囦唤鈥娓呯悊鍓峗20260904.xlsx 鍏氦/鍑虹/杞ㄩ亾杞浮鍙拌处椤� O 鍒楀洖褰� 0 宸紓锛夛細
+ * - 鍏氦/鍑虹锛氭寜鏈� 鈫� 甯傚窞 鈫� [瀹㈣繍閲�, 鏃呭鍛ㄨ浆閲�, 鍩庡競鍐呭杩愰噺, 鍩庡競鍐呮梾瀹㈠懆杞噺]锛屾寜 DB city 瀛楁鍒嗙粍锛�"鍏ㄧ渷"=鍏ㄩ儴甯傚窞鍚堣锛�
+ * - 杞ㄩ亾/杞浮锛氬悓涓� city_bus_monthly 琛ㄧ殑 rail / ferry 瀛楁锛堣建閬�=姝︽眽/榛勭煶锛岃疆娓�=姝︽眽锛涘叏鐪�=鍚堣锛夈��
+ *
+ * 杈撳嚭涓衡�滄湀 鈫� 甯傚窞 鈫� double[4]鈥濓紱绱鐢卞啓鍥炲眰瀵� 1..m 鏈堟眰鍜屻�傚悓姣旀寜 Q1 浠ユ瘝鐗堢紦瀛� 2025 鍙傜収缁勪负鍩哄噯锛屼笉鍦ㄦ湰鏈嶅姟璁$畻銆�
+ */
+@Service
+public class PaxCalc {
+
+ public static final String PROVINCE = "鍏ㄧ渷";
+
+ @Resource
+ private CityBusMonthlyMapper cityBusMapper;
+ @Resource
+ private CityTaxiMonthlyMapper cityTaxiMapper;
+
+ /** 鍏氦锛氭湀 鈫� 甯傚窞 鈫� [瀹㈣繍閲�,鍛ㄨ浆閲�,鍩庡競鍐呭杩愰噺,鍩庡競鍐呭懆杞噺] */
+ public Map<Integer, Map<String, double[]>> busMonthly(String yearPrefix, int limit) {
+ Map<Integer, Map<String, double[]>> result = new LinkedHashMap<>();
+ List<CityBusMonthly> rows = cityBusMapper.selectList(
+ new LambdaQueryWrapper<CityBusMonthly>().likeRight(CityBusMonthly::getReportPeriod, yearPrefix));
+ for (CityBusMonthly r : rows) {
+ int m = monthOf(r.getReportPeriod());
+ if (m < 1 || m > limit) continue;
+ String city = r.getCity() == null ? "鏈煡" : r.getCity();
+ accumulate(result, city, m,
+ nz(r.getPassengerVolume()), nz(r.getTurnover()),
+ nz(r.getPassengerCity()), nz(r.getTurnoverCity()));
+ }
+ return result;
+ }
+
+ /** 宸℃父鍑虹锛氭湀 鈫� 甯傚窞 鈫� [瀹㈣繍閲�,鍛ㄨ浆閲�,鍩庡競鍐呭杩愰噺,鍩庡競鍐呭懆杞噺] */
+ public Map<Integer, Map<String, double[]>> taxiMonthly(String yearPrefix, int limit) {
+ Map<Integer, Map<String, double[]>> result = new LinkedHashMap<>();
+ List<CityTaxiMonthly> rows = cityTaxiMapper.selectList(
+ new LambdaQueryWrapper<CityTaxiMonthly>().likeRight(CityTaxiMonthly::getReportPeriod, yearPrefix));
+ for (CityTaxiMonthly r : rows) {
+ int m = monthOf(r.getReportPeriod());
+ if (m < 1 || m > limit) continue;
+ String city = r.getCity() == null ? "鏈煡" : r.getCity();
+ accumulate(result, city, m,
+ nz(r.getPassengerVolume()), nz(r.getTurnover()),
+ nz(r.getPassengerCity()), nz(r.getTurnoverCity()));
+ }
+ return result;
+ }
+
+ /** 杞ㄩ亾/杞浮锛氭湀 鈫� 甯傚窞 鈫� [杞ㄩ亾瀹㈣繍閲�,杞ㄩ亾鍛ㄨ浆閲�,杞浮瀹㈣繍閲�,杞浮鍛ㄨ浆閲廬 */
+ public Map<Integer, Map<String, double[]>> railFerryMonthly(String yearPrefix, int limit) {
+ Map<Integer, Map<String, double[]>> result = new LinkedHashMap<>();
+ List<CityBusMonthly> rows = cityBusMapper.selectList(
+ new LambdaQueryWrapper<CityBusMonthly>().likeRight(CityBusMonthly::getReportPeriod, yearPrefix));
+ for (CityBusMonthly r : rows) {
+ int m = monthOf(r.getReportPeriod());
+ if (m < 1 || m > limit) continue;
+ String city = r.getCity() == null ? "鏈煡" : r.getCity();
+ accumulate(result, city, m,
+ nz(r.getRailPassengerVolume()), nz(r.getRailTurnover()),
+ nz(r.getFerryPassengerVolume()), nz(r.getFerryTurnover()));
+ }
+ return result;
+ }
+
+ private void accumulate(Map<Integer, Map<String, double[]>> result, String city, int m,
+ double v0, double v1, double v2, double v3) {
+ Map<String, double[]> cityMap = result.computeIfAbsent(m, k -> new HashMap<>());
+ double[] arr = cityMap.computeIfAbsent(city, k -> new double[4]);
+ arr[0] += v0;
+ arr[1] += v1;
+ arr[2] += v2;
+ arr[3] += v3;
+ double[] prov = cityMap.computeIfAbsent(PROVINCE, k -> new double[4]);
+ prov[0] += v0;
+ prov[1] += v1;
+ prov[2] += v2;
+ prov[3] += v3;
+ }
+
+ private int monthOf(String reportPeriod) {
+ if (reportPeriod == null) return 0;
+ String[] parts = reportPeriod.split("-");
+ if (parts.length < 2) return 0;
+ try {
+ return Integer.parseInt(parts[1]);
+ } catch (NumberFormatException e) {
+ return 0;
+ }
+ }
+
+ private double nz(Double v) { return v == null ? 0.0 : v; }
+}
+
--
Gitblit v1.9.1