From f02d0df2f1dfc7a8b775cf50d45375e57628a5ef Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期二, 10 十一月 2026 11:26:22 +0800
Subject: [PATCH] feat(ncr): 完善NCR处置联动逻辑与关闭校验

---
 yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/quotation/CrmSaleQuotationController.java |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/quotation/CrmSaleQuotationController.java b/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/quotation/CrmSaleQuotationController.java
index 0d039ed..870fe71 100644
--- a/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/quotation/CrmSaleQuotationController.java
+++ b/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/quotation/CrmSaleQuotationController.java
@@ -18,7 +18,8 @@
 import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService;
 import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService;
 import cn.iocoder.yudao.module.crm.enums.quotation.CrmSaleQuotationStatusEnum;
-import cn.iocoder.yudao.module.crm.service.quotation.CrmSaleQuotationDocumentRenderer;
+import cn.iocoder.yudao.module.crm.service.quotation.CrmSaleQuotationExcelRenderer;
+import cn.iocoder.yudao.module.crm.service.contact.CrmContactService;
 import cn.iocoder.yudao.module.crm.service.quotation.CrmSaleQuotationService;
 import cn.iocoder.yudao.module.system.service.companyconfig.SystemCompanyConfigService;
 import cn.iocoder.yudao.module.mdm.api.item.MdmItemApi;
@@ -76,6 +77,8 @@
     private MdmUnitMeasureApi mdmUnitMeasureApi;
     @Resource
     private CrmCustomerService customerService;
+    @Resource
+    private CrmContactService contactService;
     @Resource
     private CrmBusinessService businessService;
     @Resource
@@ -166,8 +169,8 @@
         ExcelUtils.write(response, "閿�鍞姤浠峰崟.xls", "鏁版嵁", CrmSaleQuotationRespVO.class, list);
     }
 
-    @GetMapping("/export-word")
-    @Operation(summary = "瀵煎嚭閿�鍞姤浠峰崟 Word锛堝甫鐢靛瓙绔狅級")
+    @GetMapping({"/export-word", "/export-quotation-excel"})
+    @Operation(summary = "瀵煎嚭閿�鍞姤浠峰崟 Excel锛堝甫鐢靛瓙绔狅級")
     @Parameter(name = "id", description = "鎶ヤ环鍗曠紪鍙�", required = true)
     @PreAuthorize("@ss.hasPermission('crm:sale-quotation:export')")
     @ApiAccessLog(operateType = EXPORT)
@@ -187,12 +190,17 @@
                 saleQuotationService.getSaleQuotationProductListByQuotationId(id));
         var companyConfig = companyConfigService.getCompanyConfig();
         String companyName = companyConfig != null ? companyConfig.getCompanyName() : null;
-        byte[] content = CrmSaleQuotationDocumentRenderer.render(respVO, companyName);
+        var customer = saleQuotation.getCustomerId() == null ? null : customerService.getCustomer(saleQuotation.getCustomerId());
+        var contact = saleQuotation.getContactId() == null ? null : contactService.getContact(saleQuotation.getContactId());
+        String phone = contact == null ? null : (contact.getMobile() != null && !contact.getMobile().isBlank()
+                ? contact.getMobile() : contact.getTelephone());
+        byte[] content = CrmSaleQuotationExcelRenderer.render(respVO, companyName,
+                customer == null ? null : customer.getDetailAddress(), contact == null ? null : contact.getName(), phone);
 
         String filename = "鎶ヤ环鍗�-" + saleQuotation.getNo()
-                + (respVO.getCustomerName() != null ? "-" + respVO.getCustomerName() : "") + ".docx";
+                + (respVO.getCustomerName() != null ? "-" + respVO.getCustomerName() : "") + ".xlsx";
         String encoded = URLEncoder.encode(filename, StandardCharsets.UTF_8).replace("+", "%20");
-        response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
+        response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
         response.setHeader("Content-Disposition", "attachment;filename*=UTF-8''" + encoded);
         response.getOutputStream().write(content);
     }

--
Gitblit v1.9.3