From d17024670efca145ff97bc26913bfd9b0fef2cd0 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期五, 16 十月 2026 10:26:31 +0800
Subject: [PATCH] feat(crm): 开放客户跨模块访问权限以支持业务集成

---
 yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/qc/imports/MesQcImportHelper.java |   29 ++++-------------------------
 1 files changed, 4 insertions(+), 25 deletions(-)

diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/qc/imports/MesQcImportHelper.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/qc/imports/MesQcImportHelper.java
index bfb5b63..a4f21a8 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/qc/imports/MesQcImportHelper.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/qc/imports/MesQcImportHelper.java
@@ -26,11 +26,9 @@
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
-import java.util.Set;
 
 import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
 import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.QC_NO_TEMPLATE;
@@ -68,9 +66,6 @@
     private Map<String, Long> supplierNameMap;
     /** 瀹㈡埛鍚嶇О -> 缂栧彿 */
     private Map<String, Long> customerNameMap;
-    /** 褰撳墠鐧诲綍鐢ㄦ埛鍙鐨勫鎴风紪鍙凤紱null 琛ㄧず涓嶉檺鍒� */
-    private Set<Long> permittedClientIds;
-    private boolean clientPermissionLoaded;
 
     /**
      * 寮�濮嬩竴娆″鍏ワ細娓呯┖涓婁竴娆″鍏ョ殑缂撳瓨锛屼繚璇佹柊寤虹殑渚涘簲鍟�/瀹㈡埛/鏂规鏈鍗冲彲鍛戒腑
@@ -79,8 +74,6 @@
         templateNameMap = null;
         supplierNameMap = null;
         customerNameMap = null;
-        permittedClientIds = null;
-        clientPermissionLoaded = false;
     }
 
     /**
@@ -174,11 +167,11 @@
     }
 
     /**
-     * 瑙f瀽瀹㈡埛缂栧彿锛屽熀浜庡鎴峰悕绉�
+     * 瑙f瀽瀹㈡埛缂栧彿锛屽熀浜庡鎴峰悕绉帮紱鐣欑┖琛ㄧず涓嶅叧鑱斿鎴�
      */
     public Long resolveClientId(String clientName) {
         if (StrUtil.isBlank(clientName)) {
-            throw new IllegalArgumentException("瀹㈡埛鍚嶇О涓嶈兘涓虹┖锛氳濉啓妯℃澘涓琛岀殑銆屽鎴峰悕绉般�嶅垪");
+            return null;
         }
         if (customerNameMap == null) {
             customerNameMap = new HashMap<>();
@@ -199,23 +192,9 @@
         return clientId;
     }
 
-    /**
-     * 鏍¢獙瀹㈡埛鍦ㄥ綋鍓嶇櫥褰曠敤鎴风殑鍙鑼冨洿鍐�
-     *
-     * 鍑鸿揣妫�楠屽崟鍒楄〃鎸夊鎴锋暟鎹潈闄愯繃婊わ紝鏉冮檺澶栫殑瀹㈡埛瀵煎叆鍚庢湰浜哄湪鍒楄〃涓湅涓嶅埌璇ュ崟鎹紝鍥犳鎻愬墠鎷︽埅銆�
-     */
+    /** MES 涓氬姟妯″潡瀵规墍鏈� CRM 瀹㈡埛寮�鏀捐闂紝涓嶅簲鐢ㄨ惀閿�绠$悊鐨勫鎴峰洟闃熸潈闄愩�� */
     public void validateClientPermission(Long clientId, String clientName) {
-        if (!clientPermissionLoaded) {
-            List<Long> permittedIds = crmCustomerApi.getPermittedCustomerIds();
-            permittedClientIds = permittedIds == null ? null : new HashSet<>(permittedIds);
-            clientPermissionLoaded = true;
-        }
-        if (permittedClientIds == null || permittedClientIds.contains(clientId)) {
-            return;
-        }
-        throw new IllegalArgumentException("瀹㈡埛[" + clientName + "]涓嶅湪鎮ㄧ殑鏁版嵁鏉冮檺鑼冨洿鍐咃細"
-                + "瀵煎叆鍚庢偍灏嗘棤娉曞湪銆屽嚭璐ф楠屻�嶅垪琛ㄤ腑鐪嬪埌璇ユ楠屽崟銆傝鏀圭敤鎮ㄨ礋璐g殑瀹㈡埛锛堝彲鍦ㄣ�孋RM 瀹㈡埛绠$悊-鎴戣礋璐g殑銆嶄腑鏌ョ湅锛夛紝"
-                + "鎴栬仈绯荤鐞嗗憳涓烘偍寮�閫氳瀹㈡埛鐨勬潈闄愬悗閲嶆柊瀵煎叆");
+        // 瀹㈡埛鏄惁瀛樺湪浠嶇敱 resolveClientId 鏍¢獙锛涜礋璐d汉鍜屽洟闃熸潈闄愬彧绾︽潫 CRM 钀ラ攢绠$悊銆�
     }
 
     /**

--
Gitblit v1.9.3