From d8dc84a3d56df839895f1c417a4d9cbee763d262 Mon Sep 17 00:00:00 2001
From: 高章伟 <gaozhangwei@prec-tech.com>
Date: 星期五, 03 三月 2023 14:50:59 +0800
Subject: [PATCH] gzw 测试环境代码更新

---
 force-app/main/default/classes/HospitalApprovalResponseController.cls |   77 ++++++++++++++++++++++++++++----------
 1 files changed, 56 insertions(+), 21 deletions(-)

diff --git a/force-app/main/default/classes/HospitalApprovalResponseController.cls b/force-app/main/default/classes/HospitalApprovalResponseController.cls
index 31a7cf5..86366b0 100644
--- a/force-app/main/default/classes/HospitalApprovalResponseController.cls
+++ b/force-app/main/default/classes/HospitalApprovalResponseController.cls
@@ -29,7 +29,13 @@
     // 鐢婚潰鍒濆鍖�
     public void init() {
         hasError = true;
-        List<Account> raList = [select Id, Name, Is_Active__c, Response__c, ResponseNew__c, OwnerId, Owner.Name, Owner.Email, Response_Cc_User1__c, Response_Cc_User2__c, Response_Cc_User3__c, Response_Cc_User4__c, Response_Cc_User5__c from Account where id = : accid ];
+        List<Account> raList = [select Id, Name, Is_Active__c, Response__c, ResponseNew__c, OwnerId, 
+                                       Owner.Name, Owner.Email, Response_Cc_User1__c, 
+                                       Response_Cc_User2__c, Response_Cc_User3__c, Response_Cc_User4__c,
+                                       Response_Cc_User5__c
+                                       , Response_Cc_User6__c   //20221212 lt 鍖婚櫌瀹℃壒浼樺寲
+                                from Account 
+                                where id = : accid ];
         
         if (raList.size() > 0) {
             ra = raList[0];
@@ -41,10 +47,14 @@
         cc.Response_Cc_User4__c = null;
         cc.Response_Cc_User5__c = null;
 
-        List<User> toSysUser = [select Id, Name, Email from User where Id = : System.Label.LeaderID_Zhu];
-        if (toSysUser.size() > 0) {
-            systemUser = toSysUser[0];
-        }
+        //20221212 lt 鍖婚櫌瀹℃壒浼樺寲 start
+        cc.Response_Cc_User6__c = null;
+
+        // List<User> toSysUser = [select Id, Name, Email from User where Id = : System.Label.LeaderID_Zhu];
+        // if (toSysUser.size() > 0) {
+        //     systemUser = toSysUser[0];
+        // }
+        //20221212 lt 鍖婚櫌瀹℃壒浼樺寲 end
 
         // 閭欢榛樿cc
         if (type == 'response2system') {
@@ -89,14 +99,39 @@
         Map<Id, User> userMap = new Map<Id, User>([
             select Id, Name, Email from User where Id in :ccList
         ]);
+
+        //20221212 lt 鍖婚櫌瀹℃壒浼樺寲 start
+        List<Id> toList = new List<Id>();
+        if (String.isBlank(cc.Response_Cc_User6__c) == false) {
+            toList.add(cc.Response_Cc_User6__c);
+        }
+        Map<Id, User> touserMap = new Map<Id, User>([
+            select Id, Name, Email from User where Id in :toList
+        ]);
+        //20221212 lt 鍖婚櫌瀹℃壒浼樺寲 end
+
         // 鏀朵俊鑰�
         String toName = '';
         List<String> toMailList = new List<String>();
         if (type == 'response2system') {
-            toName = systemUser.Name;
-            toMailList.add(systemUser.Email);
+            //20221212 lt 鍖婚櫌瀹℃壒浼樺寲 start
+            // toName = systemUser.Name;
+            // toMailList.add(systemUser.Email);
+            if (touserMap.size() > 0) {
+                for (Id id : touserMap.keySet()) {
+                    toName += touserMap.get(id).Name + ', ';
+                    toMailList.add(touserMap.get(id).Email);
+                }
+            }
+            if (toName != '') {
+                toName = toName.left(toName.length() - 2);
+            }else if(String.isBlank(toName) == true){
+                cc.Response_Cc_User6__c.addError('to瀹℃壒浜哄繀濉��');
+                return null;
+            }
+            //20221212 lt 鍖婚櫌瀹℃壒浼樺寲 end
         } else if (type == 'response2user') {
-            toName = ra.Owner.Name + '锛堝鎵规彁浜や汉锛�';
+            toName = ra.Owner.Name ;  //+ '锛堝鎵规彁浜や汉锛�'  lt del
             toMailList.add(ra.Owner.Email);
         }
         // 鎶勯�佽��
@@ -106,21 +141,21 @@
 
         //WLIG-BS2CJW  ---20200807---update By rentongxiao ---Start
         //鑾峰彇 閮� 鍜� 娌� 鐨勪俊鎭�
-        String ydIdsStr = System.Label.LeaderId_YD;
-        List<String> ydIds = ydIdsStr.split(',');
+        // String ydIdsStr = System.Label.LeaderId_YD;
+        // List<String> ydIds = ydIdsStr.split(',');
 
-        List<User> yds = [select Id, Name, Email from User where Id in : ydIds];
+        // List<User> yds = [select Id, Name, Email from User where Id in : ydIds];
 
-        if(type == 'response2user'){
-            ccName += systemUser.Name + ', ';
-            ccMailList.add(systemUser.Email);
-            if (yds.size() > 0) {
-                for(User u : yds){
-                    ccName += u.Name +', ';
-                    ccMailList.add(u.Email);
-                }
-            }
-        }
+        // if(type == 'response2user'){
+        //     ccName += systemUser.Name + ', ';
+        //     ccMailList.add(systemUser.Email);
+        //     if (yds.size() > 0) {
+        //         for(User u : yds){
+        //             ccName += u.Name +', ';
+        //             ccMailList.add(u.Email);
+        //         }
+        //     }
+        // }
 
         //WLIG-BS2CJW ---20200807---update By rentongxiao---End
 

--
Gitblit v1.9.1