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/CM_SearchContactServiceController.cls |   72 ++++++++++++++++++++++++++++++++++-
 1 files changed, 69 insertions(+), 3 deletions(-)

diff --git a/force-app/main/default/classes/CM_SearchContactServiceController.cls b/force-app/main/default/classes/CM_SearchContactServiceController.cls
index 589da3c..801ee9f 100644
--- a/force-app/main/default/classes/CM_SearchContactServiceController.cls
+++ b/force-app/main/default/classes/CM_SearchContactServiceController.cls
@@ -5,6 +5,7 @@
     public String conId { get; set; }
 
     public String openLine { get; set; }
+    public String accountIdV2{ get; set; }      //zhj 2022-02-04 鏂版柟妗堟敼閫�
     private String accountId;
     private String nowValue;
 
@@ -13,9 +14,13 @@
     public String contactsInfo {set;get;}
     public String awsDataIdArray {set;get;}
 
+    public String sfContactId{set;get;} //zhj 2022-12-02 sfId
+    public String staticResourceContactV2 {get; set;}   //zhj 2022-02-04 鏂版柟妗堟敼閫�
+
     public CM_SearchContactServiceController() {
         openLine = Apexpages.currentPage().getParameters().get('line');
         accountId = Apexpages.currentPage().getParameters().get('acc');
+        accountIdV2 = accountId;
         nowValue = Apexpages.currentPage().getParameters().get('now');
 
         //2022/02/15 寮犲崕寤� PI PL start
@@ -37,6 +42,7 @@
         contactsInfo = JSON.serialize(awsIdToContactMap);
         contactAWSIds = JSON.serialize(conAWSIds);
         staticResource = JSON.serialize(PIHelper.getPIIntegrationInfo('Contact')); 
+        staticResourceContactV2 = JSON.serialize(PIHelper.getPIIntegrationInfo('ContactV2'));       //zhj 2022-02-04 鏂版柟妗堟敼閫�
         //2022/02/15 寮犲崕寤� PI PL end
     }
 
@@ -54,6 +60,7 @@
 
         newCon = new Contact();
         newCon.AccountId = accountId;
+        sfContactId = '';
 
         return;
     }
@@ -115,11 +122,15 @@
 
     public PageReference editContact() {
         if (conId != null && conId != '') {
-            newCon = [select Id, Name, Department__c, Type__c, Search_LastName__c, Search_FirstName__c, Phone, Supplement__c,LastName_Encrypted__c,Phone_Encrypted__c,
+            // newCon = [select Id, Name, Department__c, Type__c, Search_LastName__c, Search_FirstName__c, Phone, Supplement__c,LastName_Encrypted__c,Phone_Encrypted__c,
+            //           FirstName, LastName,AWS_Data_Id__c
+            //             from Contact where Id = :conId];
+            newCon = [select Id, Name, Department__c, Type__c, Search_LastName__c, Search_FirstName__c, Phone, Supplement__c,
                       FirstName, LastName,AWS_Data_Id__c
-                        from Contact where Id = :conId];
+                        from Contact where Id = :conId];    //zhj 鏂版柟妗堟敼閫� 鍘婚櫎Encrypted__c 2022-12-05
             newCon.Search_LastName__c = newCon.LastName;
             newCon.Search_FirstName__c = newCon.FirstName;
+            sfContactId = newCon.Id; // zhj 2022-12-02 寰楀埌sfid缁檃ws
         }
 
         return null;
@@ -133,6 +144,8 @@
         newCon.LastName = newCon.Search_LastName__c;
         newCon.FirstName = newCon.Search_FirstName__c;
         upsert newCon;
+        System.debug('newCon.Id = ' + newCon.Id); 
+        sfContactId = newCon.Id; // zhj 2022-12-02 寰楀埌sfid缁檃ws
 
         searchCon.Search_LastName__c = newCon.LastName;
         searchCon.Search_FirstName__c = newCon.FirstName;
@@ -144,7 +157,6 @@
     public PageReference editClear()  {
         newCon = new Contact();
         newCon.AccountId = accountId;
-
         return null;
     }
 
@@ -167,4 +179,58 @@
             con = in_con;
         }
     }
+
+    //zhj MEBG鏂版柟妗堟敼閫� 2022-11-24 start
+    @RemoteAction
+    public static ResponseV2 searchContactByAccountId(String accountId) {
+        System.debug('accountId = ' + accountId);
+        ResponseV2 res = new ResponseV2();
+        try{
+            Account account = [select Id,Name from Account where Id = :accountId];
+            List<Contact> contactList = [select id,AWS_Data_Id__c, CManageCode__c,Name from Contact where AccountId = :account.Id];
+            Map<String,String> dataIdManageCodeMap = new Map<String,String>();
+            for(Contact contact : contactList){
+                dataIdManageCodeMap.put(contact.AWS_Data_Id__c,contact.CManageCode__c);
+            }
+            res.dataIdManageCodeMap = dataIdManageCodeMap;
+            res.accountName = account.Name;
+            res.contactList = contactList;
+
+            Map<String,String> accMap= new Map<String,String>();
+            List<Account> accList=[select ID,Is_Active__c,Is_Active_Formula__c from Account where ID =:accountId];
+            if(accList.size()>0){
+                for(Account acc:accList){
+                    if (String.isNotBlank(acc.Is_Active__c)){
+                        String subId = acc.Id;
+                        accMap.put(subId.substring(0,15), acc.Is_Active__c);
+                        continue;
+                    }
+                    if (String.isNotBlank(acc.Is_Active_Formula__c)){
+                        String subId = acc.Id;
+                        accMap.put(subId.substring(0,15), acc.Is_Active_Formula__c);
+                    }
+                }
+            }
+            System.debug('accMap= ' + accMap);
+            res.isNameMobileVerif = true;
+            res.isMobileVerif = false;
+            res.status = 'success';
+            return res;
+        }catch(Exception e){
+            res.message = e.getMessage() + '';
+            res.status = 'fail';
+            return res;
+        }
+    }
+
+    public class ResponseV2{
+        public List<Contact> contactList{set;get;}
+        public String accountName{set;get;}
+        public Map<String,String> dataIdManageCodeMap{set;get;}
+        public Boolean isMobileVerif;
+        public Boolean isNameMobileVerif;
+        public String message{set;get;}
+        public String status{set;get;}
+    }
+    //zhj MEBG鏂版柟妗堟敼閫� 2022-11-24 end
 }
\ No newline at end of file

--
Gitblit v1.9.1