From 8b7610369a3faf90143ae31b60d5a0058bd8e8d2 Mon Sep 17 00:00:00 2001
From: zhizhijie <zhizhijie@users.noreply.gitee.com>
Date: 星期二, 08 九月 2026 14:51:01 +0800
Subject: [PATCH] feat: 汇总大表版式统一——数值0.00/排名整数/列宽自适应/去底色(7月8月母版+还原源+applyDonorNumberFormat)

---
 traffic-audit-server/src/main/java/com/trafficaudit/reportexport/service/ReportExportService.java |   19 +++++++++++++++++++
 1 files changed, 19 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 c3301d0..dce943c 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
@@ -3551,6 +3551,7 @@
                     Cell tc = (bc != null) ? bc : tr.getCell(dc.getColumnIndex());
                     if (tc == null) tc = tr.createCell(dc.getColumnIndex());
                     tc.setBlank();
+                    applyDonorNumberFormat(wb, tc, dc);
                     if (t == CellType.FORMULA) {
                         String f = dc.getCellFormula();
                         if (f != null) tc.setCellFormula(f);
@@ -3568,6 +3569,24 @@
         return restored;
     }
 
+    /** 杩樺師鍥炲~鏃跺悓姝� donor锛堝凡鍋氱増寮忕粺涓�锛夌殑鏁板瓧鏍煎紡锛屼繚璇佸悓姣�/鏁板��/鎺掑悕鏍兼樉绀烘牸寮忎笌姣嶇増涓�鑷� */
+    private void applyDonorNumberFormat(XSSFWorkbook wb, Cell dst, Cell src) {
+        if (wb == null || dst == null || src == null) return;
+        try {
+            String fmt = src.getCellStyle().getDataFormatString();
+            if (fmt == null || fmt.isEmpty() || "General".equalsIgnoreCase(fmt)) return;
+            org.apache.poi.ss.usermodel.DataFormat df = wb.createDataFormat();
+            short idx = df.getFormat(fmt);
+            CellStyle cur = dst.getCellStyle();
+            if (cur != null && idx == cur.getDataFormat()) return;
+            CellStyle ns = wb.createCellStyle();
+            if (cur != null) ns.cloneStyleFrom(cur);
+            ns.setDataFormat(idx);
+            dst.setCellStyle(ns);
+        } catch (Exception ignore) {
+            // 涓埆鏍煎紡寮傚父涓嶉樆濉炶繕鍘�
+        }
+    }
     /** 鍗曞厓鏍煎唴瀹规枃鏈寲锛堝叕寮忓甫 = 鍓嶇紑锛夛紝鐢ㄤ簬璺ㄧ翱姣斿 */
     private String summaryCellText(Cell c) {
         if (c == null) return null;

--
Gitblit v1.9.1