From c11e6f07b031eea6c7de4c5508b8dbf0ee01d2c7 Mon Sep 17 00:00:00 2001
From: wujianwei <wjw@11.com>
Date: 星期三, 01 四月 2026 10:08:08 +0800
Subject: [PATCH] 去除不同报价方案,不能添加相同【客户-路线-车型】数据

---
 tms/src/main/java/com/ruoyi/tms/service/impl/TmsArBillServiceImpl.java |   41 +++++++++++++++++++++++++----------------
 1 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/tms/src/main/java/com/ruoyi/tms/service/impl/TmsArBillServiceImpl.java b/tms/src/main/java/com/ruoyi/tms/service/impl/TmsArBillServiceImpl.java
index 9b14195..637ef81 100644
--- a/tms/src/main/java/com/ruoyi/tms/service/impl/TmsArBillServiceImpl.java
+++ b/tms/src/main/java/com/ruoyi/tms/service/impl/TmsArBillServiceImpl.java
@@ -6,7 +6,7 @@
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.config.RuoYiConfig;
 import com.ruoyi.system.service.ISysConfigService;
 import com.ruoyi.tms.domain.*;
 import com.ruoyi.tms.mapper.*;
@@ -332,7 +332,7 @@
             sheet.setColumnWidth(remarkColumn, 10000); // 澶囨敞
             
             // 鏍囬鍖哄煙
-            createTitleArea(sheet, styles,tmsArBill);
+            createTitleArea(sheet, styles,bill);
             
             // 琛ㄥご
             createDynamicTableHeader(sheet, styles, feeNameList, baseColumns, remarkColumn);
@@ -376,15 +376,15 @@
                         
                         // 瑁呰揣鐐�
                         Cell cell2 = row.createCell(2);
-                        if (dispatchOrder != null && dispatchOrder.getShipperAddress() != null) {
-                            cell2.setCellValue(dispatchOrder.getShipperAddress());
+                        if (dispatchOrder != null && dispatchOrder.getShipperRegionLabel() != null) {
+                            cell2.setCellValue(dispatchOrder.getShipperRegionLabel());
                             cell2.setCellStyle(styles.get("data"));
                         }
 
                         // 鍗歌揣鐐�
                         Cell cell3 = row.createCell(3);
-                        if (dispatchOrder != null && dispatchOrder.getReceiverAddress() != null) {
-                            cell3.setCellValue(dispatchOrder.getReceiverAddress());
+                        if (dispatchOrder != null && dispatchOrder.getReceiverRegionLabel() != null) {
+                            cell3.setCellValue(dispatchOrder.getReceiverRegionLabel());
                             cell3.setCellStyle(styles.get("data"));
                         }
 
@@ -455,7 +455,7 @@
                 cell.setCellValue(feeTotals.get(feeName).doubleValue());
                 cell.setCellStyle(styles.get("total"));
             }
-            
+
             // 鍚堣琛�
             int totalRow = subTotalRow + 1;
             Row total = sheet.createRow(totalRow);
@@ -463,7 +463,7 @@
             totalCell.setCellValue("鍚堣(CNB)");
             totalCell.setCellStyle(styles.get("total"));
             sheet.addMergedRegion(new CellRangeAddress(totalRow, totalRow, 2, 5));
-            
+
             // 濉厖璐圭敤鍚堣
             for (int j = 0; j < feeNameList.size(); j++) {
                 String feeName = feeNameList.get(j);
@@ -479,18 +479,26 @@
             createAccountInfo(sheet, styles, totalRow + 4);
             
             // 绛惧瓧鐩栫珷鍖哄煙
-            createSignatureArea(sheet, styles, totalRow + 8);
-            
-            // 鐢熸垚鏂囦欢
-            File file = new File(fileName);
+            createSignatureArea(sheet, styles, totalRow + 8,bill);
+
+            // 淇濆瓨鏂囦欢
+            String path = RuoYiConfig.getDownloadPath() + fileName;
+            File file = new File(path);
+            File parentFile = file.getParentFile();
+            if (!parentFile.exists()) {
+                parentFile.mkdirs();
+            }
+
             try (FileOutputStream fos = new FileOutputStream(file)) {
                 workbook.write(fos);
             }
+
             return fileName;
         } catch (Exception e) {
             logger.error("瀵煎嚭瀵硅处鍗曚竴寮忓鑱旀牸寮忓け璐�", e);
             throw new RuntimeException("瀵煎嚭澶辫触锛岃妫�鏌ユ暟鎹�", e);
         }
+
     }
 
     /**
@@ -701,14 +709,15 @@
     /**
      * 鍒涘缓绛惧瓧鐩栫珷鍖哄煙
      *
-     * @param sheet 宸ヤ綔琛�
-     * @param styles 鏍峰紡鏄犲皠
+     * @param sheet    宸ヤ綔琛�
+     * @param styles   鏍峰紡鏄犲皠
      * @param startRow 璧峰琛�
+     * @param bill
      */
-    private void createSignatureArea(SXSSFSheet sheet, Map<String, CellStyle> styles, int startRow) {
+    private void createSignatureArea(SXSSFSheet sheet, Map<String, CellStyle> styles, int startRow, TmsArBill bill) {
         Row payerRow = sheet.createRow(startRow);
         Cell payerCell = payerRow.createCell(0);
-        payerCell.setCellValue("浠樻鍗曚綅锛堢敳鏂癸級锛歑XXXXXXXXXXXXX");
+        payerCell.setCellValue("浠樻鍗曚綅锛堢敳鏂癸級锛�"+bill.getCustomerName());
         payerCell.setCellStyle(styles.get("text"));
 
         Cell payeeCell = payerRow.createCell(6);

--
Gitblit v1.8.0