From 8badb57ea2c82557850ad5b39281c3e8714eb119 Mon Sep 17 00:00:00 2001
From: liuyan <liuyan@prec-tech.com>
Date: 星期四, 24 十一月 2022 10:08:31 +0800
Subject: [PATCH] 科室信息漏传SPO问题
---
force-app/main/default/classes/NFM624Rest.cls | 52 ++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 38 insertions(+), 14 deletions(-)
diff --git a/force-app/main/default/classes/NFM624Rest.cls b/force-app/main/default/classes/NFM624Rest.cls
index b279b76..591f2bc 100644
--- a/force-app/main/default/classes/NFM624Rest.cls
+++ b/force-app/main/default/classes/NFM624Rest.cls
@@ -252,14 +252,17 @@
string namekey;
string nameKey2;
string nameKey3;
+ string nameKey4;
if(String.isBlank(ct.MobilePhone_Encrypted__c)){
namekey = ct.Account.Name + ' ' + ct.LastName_Encrypted__c.trim();
nameKey2 = ct.Account.Management_Code__c + ' ' + ct.LastName_Encrypted__c.trim();
nameKey3 = ct.Account.Department_Class__r.Name + ' ' + ct.LastName_Encrypted__c.trim();
+ nameKey4 = ct.LastName_Encrypted__c.trim();
} else{
namekey = ct.Account.Name + ' ' + ct.LastName_Encrypted__c.trim() + ' ' + ct.MobilePhone_Encrypted__c.trim();
nameKey2 = ct.Account.Management_Code__c + ' ' + ct.LastName_Encrypted__c.trim() + ' ' + ct.MobilePhone_Encrypted__c.trim();
nameKey3 = ct.Account.Department_Class__r.Name + ' ' + ct.LastName_Encrypted__c.trim() + ' ' + ct.MobilePhone_Encrypted__c.trim();
+ nameKey4 = ct.LastName_Encrypted__c.trim() + ' ' + ct.MobilePhone_Encrypted__c.trim();
}
// snameMap.put(namekey,ct);
if (nameMap.containsKey(ct.Account.parent.Name)) {
@@ -268,6 +271,7 @@
snameMap.put(namekey, ct);
snameMap.put(nameKey2,ct);
snameMap.put(nameKey3,ct);
+ snameMap.put(nameKey4,ct);
// // 閫氳繃濮撳悕+鎵嬫満鍙峰垽鏂汉鍛樻槸鍚﹂噸澶� thh 20220518 start
// if(String.isBlank(ct.MobilePhone_Encrypted__c)){
// snameMap.put(ct.LastName_Encrypted__c.trim(), ct);
@@ -428,6 +432,8 @@
System.debug('浜哄憳绠$悊缂栫爜涓嶅瓨鍦�');
string namekey = gedata.RelatedDepartment + ' ' + gedata.NameEncrypted + ' ' + gedata.MobileEncrypted;
string namekey1 = gedata.RelatedDepartment + ' ' + gedata.NameEncrypted;
+ string namekey2 = gedata.NameEncrypted + ' ' + gedata.MobileEncrypted;
+ string namekey3 = gedata.NameEncrypted;
system.debug('DepartmentClasskey = '+DepartmentClasskey);
system.debug('nameMap22222222 '+nameMap);
if (nameMap.containskey(DepartmentClasskey)) { // 6 瀹屾垚 鏇存柊鎿嶄綔
@@ -435,18 +441,34 @@
System.debug('sMap'+sMap);
System.debug('sMap.containsKey(namekey)'+sMap.containsKey(namekey));
System.debug('sMap.containsKey(gedata.NameEncrypted)'+sMap.containsKey(gedata.NameEncrypted));
- if (sMap.containsKey(namekey)) {
+ if (sMap.containsKey(namekey) && sMap.get(namekey).UnifiedI_Contact_ID__c == null) {
system.debug('Id璧嬪��'+sMap);
ct.id = sMap.get(namekey).id;
} else if (sMap.containsKey(namekey1) && sMap.get(namekey1).UnifiedI_Contact_ID__c == null) {
ct.id = sMap.get(namekey1).id;
- // // 閫氳繃濮撳悕+鎵嬫満鍙峰垽鏂汉鍛樻槸鍚﹂噸澶� thh 20220518 start
- // } else if(sMap.containsKey(gedata.NameEncrypted + gedata.MobileEncrypted) && sMap.get(gedata.NameEncrypted + gedata.MobileEncrypted).UnifiedI_Contact_ID__c == null){
- // ct.id = sMap.get(gedata.NameEncrypted + gedata.MobileEncrypted).id;
- // // 閫氳繃濮撳悕+鎵嬫満鍙峰垽鏂汉鍛樻槸鍚﹂噸澶� thh 20220518 end
+ // 閫氳繃濮撳悕+鎵嬫満鍙峰垽鏂汉鍛樻槸鍚﹂噸澶� thh 20220518 start
+ } else if(sMap.containsKey(namekey2) && sMap.get(namekey2).UnifiedI_Contact_ID__c == null){
+ system.debug('鎴樼暐绉戝瀛樺湪绉戝涓虹┖鐢佃瘽鏈夊��');
+ ct.id = sMap.get(namekey2).id;
+ }else if(sMap.containsKey(namekey3) && sMap.get(namekey3).MobilePhone_Encrypted__c == null){
+ system.debug('鎴樼暐绉戝瀛樺湪绉戝涓虹┖鐢佃瘽鏃犲��');
+ ct.id = sMap.get(namekey3).id;
+ // 閫氳繃濮撳悕+鎵嬫満鍙峰垽鏂汉鍛樻槸鍚﹂噸澶� thh 20220518 end
}else { // 7 瀹屾垚
system.debug('7閫昏緫 鏃犱汉鍛樼鐞嗙紪鐮� 鏈夊尰闄� 鏈夌瀹� 浜哄悕鏌ユ壘鏃� 鍔ㄤ綔锛氭柊寤鸿仈绯讳汉 ');
+ for ( Integer i = 0; i < peopleList.size(); i++) {
+ if (peopleList[i].Account.parent.Name !=DepartmentClasskey && (peopleList[i].MobilePhone_Encrypted__c ==null || peopleList[i].MobilePhone_Encrypted__c ==gedata.MobileEncrypted)) {
+ ct.id = peopleList[i].id;
+ }
+ }
+ }
+ }else {
+ //鎴樼暐绉戝涓嶅瓨鍦紝鎵炬墜鏈哄彿涓虹┖鎴栫浉绛夌殑瀹㈡埛浜哄憳
+ for ( Integer i = 0; i < peopleList.size(); i++) {
+ if (peopleList[i].MobilePhone_Encrypted__c ==null || peopleList[i].MobilePhone_Encrypted__c ==gedata.MobileEncrypted) {
+ ct.id = peopleList[i].ID;
+ }
}
}
upsertContactList.add(ct);
@@ -487,7 +509,7 @@
system.debug('nameMap.get(DepartmentClasskey)'+nameMap.get(DepartmentClasskey));
if (nameMap.containsKey(DepartmentClasskey)) { //鏌ユ壘鏄惁瀛樺湪璇ユ垬鐣ョ瀹�
System.debug('浜哄憳绠$悊缂栫爜涓嶅瓨鍦ㄧ殑鎯呭喌涓嬫垬鐣ョ瀹ゅ瓨鍦�');
- system.debug('鎴樼暐绉戝瀛樺湪' + nameMap.get(DepartmentClasskey));
+ System.debug('鎴樼暐绉戝瀛樺湪' + nameMap.get(DepartmentClasskey));
Map < String, Contact > sMap = nameMap.get(DepartmentClasskey);
system.debug('namekey'+namekey);
system.debug('sMap.keySet'+sMap.keySet());
@@ -522,14 +544,18 @@
}else{
system.debug('鍒涘缓鑱旂郴浜哄拰绉戝');
//system.debug('peopleList[0]'+peopleList[0]);
- if (peopleList.size()>0) {
- ct.id = peopleList[0].ID;
+ for ( Integer i = 0; i < peopleList.size(); i++) {
+ if (peopleList[i].MobilePhone_Encrypted__c ==null) {
+ ct.id = peopleList[i].ID;
+ }
}
// dpt.Department_Name__c = gedata.DepartmentName;
// upsertAccountList.add(dpt);
contactMap.put(Gedata.DepartmentManagementCode2, ct);
system.debug('122222222222222222222contactMap'+contactMap);
+ upsertContactList.add(ct);
+ system.debug('122222222222222222222upsertContactList'+upsertContactList);
}
dpt.Department_Name__c = gedata.DepartmentName;
@@ -592,9 +618,11 @@
c.Accountid = ac.id;
}
c.OwnerId = ac.OwnerId;
- upsertContactList1.add(c);
+ system.debug('鑱旂郴浜轰俊鎭�'+c);
+ system.debug('upsertContactList'+upsertContactList);
+ //upsertContactList.add(c);
system.debug('OwnerId'+ac.OwnerId);
- system.debug('upsertContactList1'+upsertContactList1);
+ system.debug('upsertContactList'+upsertContactList);
}
if(ac.RecordTypeId == '01210000000QemGAAS' && ac.Is_Active__c == '鑽夋涓�' && string.isNotBlank( OCSMMap.get(ac.OCM_man_province_HP__c))){
@@ -616,10 +644,6 @@
// Database.executeBatch(new NFM620RestBatch(), 1);
// Database.executeBatch(new NFM623RestBatch(), 1);
supplement(gedata.ContactId);
- }
- if(upsertContactList1.size()>0){
- upsert upsertContactList1;
-
}
}
}
--
Gitblit v1.9.1