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/NFM624RestAbout.cls |   71 +++++++++++++++++++++++++++--------
 1 files changed, 55 insertions(+), 16 deletions(-)

diff --git a/force-app/main/default/classes/NFM624RestAbout.cls b/force-app/main/default/classes/NFM624RestAbout.cls
index c8807d2..9a65831 100644
--- a/force-app/main/default/classes/NFM624RestAbout.cls
+++ b/force-app/main/default/classes/NFM624RestAbout.cls
@@ -51,6 +51,8 @@
  
         // 鍙栧緱鎺ュ彛浼犺緭鍐呭
         String strData = RestContext.request.requestBody.toString();
+        system.debug('strData---'+strData );
+        system.debug('strData2---'+RestContext.request.requestBody );
         GeDatas ges = (GeDatas) JSON.deserializeStrict(strData, GeDatas.class);
         system.debug('ges---'+JSON.serialize(ges) );
  
@@ -204,8 +206,30 @@
                                                       OR (Account.Parent_PlatformCode__c IN: ManagementList AND LastName_Encrypted__c IN:NameList AND UnifiedI_Contact_ID__c = null)
                                                       OR (Account.Parent_Management_Code__c IN: SFDCCodeList AND LastName_Encrypted__c IN:NameList AND UnifiedI_Contact_ID__c = null)
                                                       ORDER BY  MobilePhone ASC,CManageCode__c ASC]; //鏍规嵁浜哄憳绠$悊缂栫爜妫�绱㈣仈绯讳汉
+                // List < Contact > peopleList = [select Id, 
+                //                                        Account.Name, 
+                //                                        //Department__c, 
+                //                                        Account.parent.Name, 
+                //                                        UnifiedI_Contact_ID__c,
+                //                                        //Account.PlatformCode__c, 
+                //                                        Account.Management_Code__c, 
+                //                                        //Account.parent.Department_Class_Label__c, 
+                //                                        Name,LastName_Encrypted__c,
+                //                                        //Account.Parent_Management_Code__c, 
+                //                                        //Account.Parent_PlatformCode__c, 
+                //                                        CManageCode__c,AWS_Data_Id__c,
+                //                                        // 閫氳繃濮撳悕+鎵嬫満鍙峰垽鏂汉鍛樻槸鍚﹂噸澶� thh 20220518 start
+                //                                        MobilePhone_Encrypted__c
+                //                                        // 閫氳繃濮撳悕+鎵嬫満鍙峰垽鏂汉鍛樻槸鍚﹂噸澶� thh 20220518 end
+                //                                        //AccountId 
+                //                                        from Contact 
+                //                                        where CManageCode__c IN: PersonManagementCodeList 
+                //                                       OR (Account.Parent_PlatformCode__c IN: ManagementList AND UnifiedI_Contact_ID__c = null)
+                //                                       OR (Account.Parent_Management_Code__c IN: SFDCCodeList AND UnifiedI_Contact_ID__c = null)
+                //                                       ORDER BY  MobilePhone ASC,CManageCode__c ASC]; //鏍规嵁浜哄憳绠$悊缂栫爜妫�绱㈣仈绯讳汉
                  Map < String, Contact > peopleMap = new Map < String, Contact > (); //鑱旂郴浜�
                  system.debug('peopleList  '+peopleList);
+                 system.debug('peopleList.size  '+peopleList.size());
                  for (Contact ct: peopleList) {
                      if (string.isnotblank(ct.Account.parent.Name)) {
                          Map < String, Contact > snameMap = new Map < String, Contact > ();
@@ -278,20 +302,21 @@
                              System.debug('sMap'+sMap);
                              System.debug('sMap.containsKey(namekey)'+sMap.containsKey(namekey));
                              System.debug('Namekey'+namekey);
-                             if (sMap.containsKey(namekey)) {
+                             if (sMap.containsKey(namekey) && sMap.get(namekey).UnifiedI_Contact_ID__c == null) {
                                 system.debug('鏍规嵁鍚嶅瓧鍖归厤瀛樺湪');
                                 red.awsDataId = sMap.get(namekey).AWS_Data_Id__c;
                                 red.sfid = sMap.get(namekey).id;
                             } else if(sMap.containsKey(namekey1) && sMap.get(namekey1).UnifiedI_Contact_ID__c == null) {
+                                system.debug('sMap.containsKey(namekey1) && sMap.get(namekey1).UnifiedI_Contact_ID__c == null');
                                 red.awsDataId = sMap.get(namekey1).AWS_Data_Id__c;
                                 red.sfid = sMap.get(namekey1).id;
                                 
                             // // 閫氳繃濮撳悕+鎵嬫満鍙峰垽鏂汉鍛樻槸鍚﹂噸澶� thh 20220518 start
-                            } else if(sMap.containsKey(namekey2) ){
+                            } else if(sMap.containsKey(namekey2) && sMap.get(namekey2).UnifiedI_Contact_ID__c == null){
                                 system.debug('鎴樼暐绉戝瀛樺湪绉戝涓虹┖鐢佃瘽鏈夊��');
                                 red.awsDataId = sMap.get(namekey2).AWS_Data_Id__c;
                                 red.sfid = sMap.get(namekey2).id;
-                            }else if(sMap.containsKey(namekey3)){
+                            }else if(sMap.containsKey(namekey3) && sMap.get(namekey3).UnifiedI_Contact_ID__c == null){
                                 system.debug('鎴樼暐绉戝瀛樺湪绉戝涓虹┖鐢佃瘽鏃犲��');
                                 red.awsDataId = sMap.get(namekey3).AWS_Data_Id__c;
                                 red.sfid = sMap.get(namekey3).id;
@@ -301,18 +326,32 @@
                                 //red.dataID = gedata.dataID;
                                 //red.awsDataId = null;
                                 //red.sfid = null;
+                                for ( Integer i = 0; i < peopleList.size(); i++) {
+                                    if (peopleList[i].Account.parent.Name !=DepartmentClasskey && peopleList[i].MobilePhone_Encrypted__c ==null) {
+                                        System.debug('peopleList[i].Account.parent.Name = ' + peopleList[i].Account.parent.Name);
+                                        System.debug('DepartmentClasskey = ' + DepartmentClasskey);
+                                        System.debug('peopleList[i].MobilePhone_Encrypted__c = ' + peopleList[i].MobilePhone_Encrypted__c);
+                                        System.debug('peopleList[i].Account.parent.Name !=DepartmentClasskey && peopleList[i].MobilePhone_Encrypted__c ==null');
+                                        red.awsDataId =peopleList[i].AWS_Data_Id__c;
+                                        red.sfid =peopleList[i].id;
+                                    }
+                                }
                             }
                             system.debug('red----------->'+red);
-                            responseList.ResponseDetails.add(red);
+                            //responseList.ResponseDetails.add(red);
                             system.debug('responseList.ResponseDetails'+responseList.ResponseDetails);
                         }else{
                             system.debug('鎴樼暐绉戝涓嶅瓨鍦�');
-                            if (peopleList.size()>0 && peopleList[0].MobilePhone_Encrypted__c ==null) {
-                                red.awsDataId =peopleList[0].AWS_Data_Id__c;
-                                red.sfid =peopleList[0].id;
+                            for ( Integer i = 0; i < peopleList.size(); i++) {
+                                if (peopleList[i].MobilePhone_Encrypted__c ==null) {
+                                    System.debug('peopleList[i].MobilePhone_Encrypted__c ==null');
+                                    red.awsDataId =peopleList[i].AWS_Data_Id__c;
+                                    red.sfid =peopleList[i].id;
+                                }
                             }
-                            responseList.ResponseDetails.add(red);
+                            //responseList.ResponseDetails.add(red);
                         }
+                        responseList.ResponseDetails.add(red);
                     }    
                 }
             }
@@ -327,13 +366,13 @@
             iflog.ErrorLog__c += ex.getMessage() + '\n';
             iflog.ErrorLog__c += ex.getStackTraceString() + '\n';
         }
-        update rowData;
-        system.debug('Rowdata'+rowData);   
-        logstr += responseList +'\n';
-        logstr += 'end';
-        iflog.Log__c = logstr;
-        update iflog;
-        system.debug('responseList.ResponseDetails'+responseList.ResponseDetails);
-        return responseList;  
+    update rowData;
+    system.debug('Rowdata'+rowData);   
+    logstr += responseList +'\n';
+    logstr += 'end';
+    iflog.Log__c = logstr;
+    update iflog;
+    system.debug('responseList.ResponseDetails'+responseList.ResponseDetails);
+    return responseList;  
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1