From 0a3f49f3250424582ff0d9dcea1ef12d89c85e44 Mon Sep 17 00:00:00 2001
From: zhizhijie <zhizhijie@users.noreply.gitee.com>
Date: 星期六, 19 九月 2026 00:23:12 +0800
Subject: [PATCH] feat(报表): 新增客运站/物流站场投资明细表导出 + 中口径同比口径修复 + 隐藏网约车订单入口

---
 traffic-audit-server/src/main/java/com/trafficaudit/reportexport/calc/WycSplitCalc.java |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/traffic-audit-server/src/main/java/com/trafficaudit/reportexport/calc/WycSplitCalc.java b/traffic-audit-server/src/main/java/com/trafficaudit/reportexport/calc/WycSplitCalc.java
index baf3d26..903f103 100644
--- a/traffic-audit-server/src/main/java/com/trafficaudit/reportexport/calc/WycSplitCalc.java
+++ b/traffic-audit-server/src/main/java/com/trafficaudit/reportexport/calc/WycSplitCalc.java
@@ -3,7 +3,11 @@
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.trafficaudit.common.util.RegionUtil;
 import com.trafficaudit.dataimport.entity.CityTaxiMonthly;
+import com.trafficaudit.dataimport.entity.WycOrderMonthly;
+import com.trafficaudit.dataimport.entity.WycTotalMonthly;
 import com.trafficaudit.dataimport.mapper.CityTaxiMonthlyMapper;
+import com.trafficaudit.dataimport.mapper.WycOrderMonthlyMapper;
+import com.trafficaudit.dataimport.mapper.WycTotalMonthlyMapper;
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.CellType;
 import org.apache.poi.ss.usermodel.DataFormatter;
@@ -76,6 +80,10 @@
 
     @Resource
     private CityTaxiMonthlyMapper cityTaxiMapper;
+    @Resource
+    private WycOrderMonthlyMapper wycOrderMapper;
+    @Resource
+    private WycTotalMonthlyMapper wycTotalMapper;
     @Value("${city-passenger.template-dir:docs/鍩庡競瀹㈣繍}")
     private String templateDir;
 
@@ -190,6 +198,8 @@
 
     /** 璇诲彇 docs/鍩庡競瀹㈣繍/銆婄綉绾﹁溅璁㈠崟鍙婂叏鐪佹�婚噺.xlsx銆嬶細鎸� period(yyyy-MM) 琛屽彇 pin(B-E) 涓� 17 甯傚窞璁㈠崟(G-W) */
     private Map<String, Object> loadMonthlyInput(String period) throws Exception {
+        Map<String, Object> db = loadMonthlyInputFromDb(period);
+        if (db != null) return db;
         File f = findInput();
         try (InputStream in = new FileInputStream(f);
              Workbook wb = WorkbookFactory.create(in)) {
@@ -226,6 +236,54 @@
         }
     }
 
+    /** 浼樺厛浠庡簱鍙栨暟锛坵yc_order_monthly锛夛紱搴撻噷鏃犺鏈熸垨璁㈠崟鍏ㄧ┖鏃惰繑鍥� null锛屽洖閫�璇绘瘝鐗堟枃浠� */
+    private Map<String, Object> loadMonthlyInputFromDb(String period) {
+        WycOrderMonthly row = wycOrderMapper.selectOne(new LambdaQueryWrapper<WycOrderMonthly>()
+                .eq(WycOrderMonthly::getReportPeriod, period).last("LIMIT 1"));
+        if (row == null) return null;
+        List<String> cities = RegionUtil.cityList();
+        Double[] vals = {
+                row.getOrderWuhan(), row.getOrderHuangshi(), row.getOrderShiyan(), row.getOrderYichang(),
+                row.getOrderXiangyang(), row.getOrderEzhou(), row.getOrderJingmen(), row.getOrderXiaogan(),
+                row.getOrderJingzhou(), row.getOrderHuanggang(), row.getOrderXianning(), row.getOrderSuizhou(),
+                row.getOrderEnshi(), row.getOrderXiantao(), row.getOrderQianjiang(), row.getOrderTianmen(),
+                row.getOrderShennong()
+        };
+        double[] orders = new double[cities.size()];
+        double sum = 0.0;
+        for (int i = 0; i < orders.length && i < vals.length; i++) {
+            orders[i] = vals[i] == null ? 0.0 : vals[i];
+            sum += orders[i];
+        }
+        if (sum <= 0) return null;
+        double orderSum = sum;
+        if (row.getOrderSum() != null && row.getOrderSum() > 0) orderSum = row.getOrderSum();
+        double pinK = row.getPinK() == null ? 0.0 : row.getPinK();
+        double pinCK = row.getPinCK() == null ? 0.0 : row.getPinCK();
+        double pinZ = row.getPinZ() == null ? 0.0 : row.getPinZ();
+        double pinCZ = row.getPinCZ() == null ? 0.0 : row.getPinCZ();
+        boolean pinFix = false;
+        // pin 鍏滃簳锛氳鍗曡〃 pin 鍒椾负绌�/涓� 0 鏃跺洖钀� wyc_total_monthly锛坧in 涓撹〃锛�
+        if (pinK <= 0 || pinCK <= 0 || pinZ <= 0 || pinCZ <= 0) {
+            WycTotalMonthly tot = wycTotalMapper.selectOne(new LambdaQueryWrapper<WycTotalMonthly>()
+                    .eq(WycTotalMonthly::getReportPeriod, period).last("LIMIT 1"));
+            if (tot != null) {
+                if (pinK <= 0 && tot.getPinK() != null && tot.getPinK() > 0) { pinK = tot.getPinK(); pinFix = true; }
+                if (pinCK <= 0 && tot.getPinCK() != null && tot.getPinCK() > 0) { pinCK = tot.getPinCK(); pinFix = true; }
+                if (pinZ <= 0 && tot.getPinZ() != null && tot.getPinZ() > 0) { pinZ = tot.getPinZ(); pinFix = true; }
+                if (pinCZ <= 0 && tot.getPinCZ() != null && tot.getPinCZ() > 0) { pinCZ = tot.getPinCZ(); pinFix = true; }
+            }
+        }
+        Map<String, Object> map = new LinkedHashMap<>();
+        map.put("pinK", pinK);
+        map.put("pinCK", pinCK);
+        map.put("pinZ", pinZ);
+        map.put("pinCZ", pinCZ);
+        map.put("orders", orders);
+        map.put("orderSum", orderSum);
+        map.put("source", pinFix ? "db+wyc_total" : "db");
+        return map;
+    }
     private File findInput() throws Exception {
         String rel = templateDir;
         while (rel.startsWith("./")) rel = rel.substring(2);

--
Gitblit v1.9.1