From a267825e23a5389713e42fde9d308df5f621e949 Mon Sep 17 00:00:00 2001
From: zhizhijie <zhizhijie@users.noreply.gitee.com>
Date: 星期六, 10 十月 2026 09:33:53 +0800
Subject: [PATCH] feat(汇总大表): 按月扩列器(8月→9月版式)与只读扩列接口(待验收)

---
 traffic-audit-server/src/main/java/com/trafficaudit/reportexport/service/ReportExportService.java |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/traffic-audit-server/src/main/java/com/trafficaudit/reportexport/service/ReportExportService.java b/traffic-audit-server/src/main/java/com/trafficaudit/reportexport/service/ReportExportService.java
index 67a22b4..1888c3d 100644
--- a/traffic-audit-server/src/main/java/com/trafficaudit/reportexport/service/ReportExportService.java
+++ b/traffic-audit-server/src/main/java/com/trafficaudit/reportexport/service/ReportExportService.java
@@ -34,6 +34,7 @@
 import com.trafficaudit.reportexport.calc.MidCalc;
 import com.trafficaudit.reportexport.calc.PaxCalc;
 import com.trafficaudit.reportexport.calc.SummaryWorkbookFiller;
+import com.trafficaudit.reportexport.layout.SummaryLayoutExpander;
 import com.trafficaudit.reportexport.calc.WycSplitCalc;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.ss.usermodel.Cell;
@@ -101,6 +102,8 @@
     private CityTaxiMonthlyMapper cityTaxiMapper;
     @Resource
     private SummaryWorkbookFiller summaryWorkbookFiller;
+    @Resource
+    private SummaryLayoutExpander summaryLayoutExpander;
     @Resource
     private WycSplitCalc wycSplitCalc;
     @Resource
@@ -3622,6 +3625,30 @@
         return exportSummaryWorkbook(period, mode, null, null);
     }
 
+    /**
+     * 姹囨�诲ぇ琛ㄣ�屾寜鏈堟墿鍒椼�嶏紙2026-10-09 Step 1锛夛細鎶� period 褰撴湀姣嶇増鎵╁垪鎴愪笅涓�鏈堢増寮忋��
+     * 鍙仛鐗堝紡鈥斺�斿綋鏈堟暟鎹垪鐣欑┖锛涗笉钀界洏锛岀敱璋冪敤鏂瑰喅瀹氭槸鍚︾‘璁ゅ悗鍙﹀瓨涓轰笅鏈熸瘝鐗堛��
+     */
+    public byte[] expandSummaryWorkbook(String period) throws Exception {
+        if (period == null || !period.contains("-")) {
+            throw new RuntimeException("鎵╁垪浠呮敮鎸佹寜鏈堬紝璇锋寚瀹� period=YYYY-MM");
+        }
+        int year = Integer.parseInt(period.split("-")[0]);
+        int month = monthOf(period, "month");
+        if (month >= 12) {
+            throw new RuntimeException("鎵╁垪锛�12 鏈堜箣鍚庨渶鏂板紑涓�鏈紝璺ㄥ勾瑙勫垯鍙﹁澶勭悊");
+        }
+        File mother = resolveSummaryMother(period, "month");
+        if (mother == null) {
+            throw new RuntimeException("鏈壘鍒版眹鎬昏〃姣嶇増锛坉ocs/鐢熸垚姹囨�诲ぇ琛級锛�" + year + "骞�" + month + "鏈堥亾璺繍杈撻噺姹囨�昏〃.xlsx");
+        }
+        try (InputStream in = new FileInputStream(mother)) {
+            byte[] out = summaryLayoutExpander.expand(org.apache.poi.util.IOUtils.toByteArray(in), year, month + 1);
+            log.info("姹囨�诲ぇ琛ㄦ墿鍒楀畬鎴愶細{}骞磠}鏈堟瘝鐗� -> {}骞磠}鏈堢増寮忥紙鍙仛鐗堝紡銆佹暟鎹暀绌猴級", year, month, year, month + 1);
+            return out;
+        }
+    }
+
     /** 鐢熸垚_閬撹矾杩愯緭閲忔眹鎬昏〃.xlsx锛圥0-P1 楠ㄦ灦锛屾敮鎸� toMonth 瑁佸壀锛夛細
      *  浠ャ�奩YYY骞碝鏈堥亾璺繍杈撻噺姹囨�昏〃.xlsx銆嬶紙M 鐢� period 鍐冲畾锛変负姣嶇増锛屾寜鍚屾湡澶囦唤姣嶇増杩樺師鏈堝害鍧楋紱
      *  toMonth 闈炵┖涓斿皬浜� M 鏃讹紝鎶� 8 涓彴璐�/鍚堟垚椤佃鍒� toMonth 鏈堬紙toMonth+1..M 鐨勫綋鏈堝��/鍚屾瘮鍒楁竻绌恒�佷繚鐣欒〃澶达紝

--
Gitblit v1.9.1