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/customer/CrmCustomerController.java |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java b/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java
index 7902835..c7c6a7f 100644
--- a/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java
+++ b/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java
@@ -15,8 +15,10 @@
 import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.customer.*;
 import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
 import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO;
+import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerProgressDO;
 import cn.iocoder.yudao.module.crm.service.contract.CrmContractService;
 import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerPoolConfigService;
+import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerProgressService;
 import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService;
 import cn.iocoder.yudao.module.system.api.dept.DeptApi;
 import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
@@ -61,6 +63,8 @@
     private CrmCustomerPoolConfigService customerPoolConfigService;
     @Resource
     private CrmContractService contractService;
+    @Resource
+    private CrmCustomerProgressService customerProgressService;
 
     @Resource
     private DeptApi deptApi;
@@ -106,7 +110,6 @@
     @GetMapping("/get")
     @Operation(summary = "鑾峰緱瀹㈡埛")
     @Parameter(name = "id", description = "缂栧彿", required = true, example = "1024")
-    @PreAuthorize("@ss.hasPermission('crm:customer:query')")
     public CommonResult<CrmCustomerRespVO> getCustomer(@RequestParam("id") Long id) {
         // 1. 鑾峰彇瀹㈡埛
         CrmCustomerDO customer = customerService.getCustomer(id);
@@ -132,7 +135,6 @@
 
     @GetMapping("/page")
     @Operation(summary = "鑾峰緱瀹㈡埛鍒嗛〉")
-    @PreAuthorize("@ss.hasPermission('crm:customer:query')")
     public CommonResult<PageResult<CrmCustomerRespVO>> getCustomerPage(@Valid CrmCustomerPageReqVO pageVO) {
         // 1. 鏌ヨ瀹㈡埛鍒嗛〉
         PageResult<CrmCustomerDO> pageResult = customerService.getCustomerPage(pageVO, getLoginUserId());
@@ -169,6 +171,8 @@
         Set<Long> customerIds = convertSet(list, CrmCustomerDO::getId);
         Map<Long, Long> contractCountMap = contractService.getContractCountMapByCustomerIds(customerIds);
         Map<Long, BigDecimal> contractPriceMap = contractService.getContractPriceMapByCustomerIds(customerIds);
+        // 1.4 鑾峰彇姣忎釜瀹㈡埛鏈�鏂扮殑涓�鏉℃唇璋堣繘搴︼紙瀹㈡埛瀵煎嚭鏃跺甫鍑猴級
+        Map<Long, CrmCustomerProgressDO> latestProgressMap = customerProgressService.getLatestProgressMap(customerIds);
         // 2. 杞崲鎴� VO
         return BeanUtils.toBean(list, CrmCustomerRespVO.class, customerVO -> {
             customerVO.setAreaName(AreaUtils.format(customerVO.getAreaId()));
@@ -187,12 +191,14 @@
             customerVO.setContractCount(
                     contractCountMap.getOrDefault(customerVO.getId(), 0L).intValue());
             customerVO.setContractTotalPrice(contractPriceMap.get(customerVO.getId()));
+            // 2.4 璁剧疆鏈�鏂版唇璋堣繘搴�
+            MapUtils.findAndThen(latestProgressMap, customerVO.getId(),
+                    progress -> customerVO.setNegotiationProgress(progress.getContent()));
         });
     }
 
     @GetMapping("/put-pool-remind-page")
     @Operation(summary = "鑾峰緱寰呰繘鍏ュ叕娴峰鎴峰垎椤�")
-    @PreAuthorize("@ss.hasPermission('crm:customer:query')")
     public CommonResult<PageResult<CrmCustomerRespVO>> getPutPoolRemindCustomerPage(@Valid CrmCustomerPageReqVO pageVO) {
         // 1. 鏌ヨ瀹㈡埛鍒嗛〉
         PageResult<CrmCustomerDO> pageResult = customerService.getPutPoolRemindCustomerPage(pageVO, getLoginUserId());
@@ -202,21 +208,18 @@
 
     @GetMapping("/put-pool-remind-count")
     @Operation(summary = "鑾峰緱寰呰繘鍏ュ叕娴峰鎴锋暟閲�")
-    @PreAuthorize("@ss.hasPermission('crm:customer:query')")
     public CommonResult<Long> getPutPoolRemindCustomerCount() {
         return success(customerService.getPutPoolRemindCustomerCount(getLoginUserId()));
     }
 
     @GetMapping("/today-contact-count")
     @Operation(summary = "鑾峰緱浠婃棩闇�鑱旂郴瀹㈡埛鏁伴噺")
-    @PreAuthorize("@ss.hasPermission('crm:customer:query')")
     public CommonResult<Long> getTodayContactCustomerCount() {
         return success(customerService.getTodayContactCustomerCount(getLoginUserId()));
     }
 
     @GetMapping("/follow-count")
     @Operation(summary = "鑾峰緱鍒嗛厤缁欐垜銆佸緟璺熻繘鐨勭嚎绱㈡暟閲忕殑瀹㈡埛鏁伴噺")
-    @PreAuthorize("@ss.hasPermission('crm:customer:query')")
     public CommonResult<Long> getFollowCustomerCount() {
         return success(customerService.getFollowCustomerCount(getLoginUserId()));
     }

--
Gitblit v1.9.3