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 | 109 ++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 92 insertions(+), 17 deletions(-)
diff --git a/force-app/main/default/classes/NFM624Rest.cls b/force-app/main/default/classes/NFM624Rest.cls
index 6af9655..591f2bc 100644
--- a/force-app/main/default/classes/NFM624Rest.cls
+++ b/force-app/main/default/classes/NFM624Rest.cls
@@ -50,6 +50,10 @@
public Boolean AgentFlag; //缁忛攢鍟嗘爣璇�
public String ApproverID; //瀹℃牳浜哄憳鍛樺伐缂栫爜
public String DataId;//aws瀛樺偍鍑嵁
+ //閭欢624鎺ュ彛鏂板瀛楁闇�姹� 20220706 LY Start
+ public String ApproveDate; //鏅烘収鍖荤枟棣栨璁よ瘉閫氳繃鏃堕棿
+ //閭欢624鎺ュ彛鏂板瀛楁闇�姹� 20220706 LY End
+
}
@HttpPost
@@ -234,10 +238,11 @@
// 閫氳繃濮撳悕+鎵嬫満鍙峰垽鏂汉鍛樻槸鍚﹂噸澶� thh 20220518 start
MobilePhone_Encrypted__c
// 閫氳繃濮撳悕+鎵嬫満鍙峰垽鏂汉鍛樻槸鍚﹂噸澶� thh 20220518 end
+ ,Account.Department_Class__r.Name
from Contact
where CManageCode__c IN: PersonManagementCodeList
- OR (Account.Parent_PlatformCode__c IN: ManagementList AND LastName_Encrypted__c IN:NameList)
- OR (Account.Parent_Management_Code__c IN: SFDCCodeList AND LastName_Encrypted__c IN:NameList )
+ 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]; //鏍规嵁浜哄憳绠$悊缂栫爜妫�绱㈣仈绯讳汉
Map < String, Contact > peopleMap = new Map < String, Contact > (); //鑱旂郴浜�
system.debug('peopleList '+peopleList);
@@ -246,12 +251,18 @@
Map < String, Contact > snameMap = new Map < String, Contact > ();
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)) {
@@ -259,6 +270,8 @@
}
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);
@@ -311,6 +324,7 @@
List < Account > upsertAccountList = new List < Account > ();
//鑱旂郴浜篖ist锛堟洿鏂扮敤锛�
List < Contact > upsertContactList = new List < Contact > ();
+ List < Contact > upsertContactList1 = new List < Contact > ();
for (Gedata gedata: newGeDataList) {
logstr += gedata.Name;
@@ -345,12 +359,20 @@
ct.Contact_address__c = gedata.ContactAddress;//鑱旂郴鍦板潃
ct.Contact_address_Encrypted__c=gedata.ContactAddressEncrypted;//鑱旂郴鍦板潃瀵嗘枃 add 20220215
ct.Platform_disabled_representation__c = gedata.ForbiddenStatus;//骞冲彴绂佺敤鏍囪瘑
+ //LLIU-CFF7DD 銆愬鎵樸�戝鎴蜂汉鍛樹俊鎭湁鏁�/鏃犳晥涓衡�滅┖鈥濈殑澶勭悊 LY 20220616 strat
+ if (gedata.ForbiddenStatus == false) {
+ ct.Isactive__c = '鏈夋晥';
+ }
+ //LLIU-CFF7DD 銆愬鎵樸�戝鎴蜂汉鍛樹俊鎭湁鏁�/鏃犳晥涓衡�滅┖鈥濈殑澶勭悊 LY 20220616 end
//ct.IsFromPlatform__c = true; //鏉ヨ嚜鏅烘収鍖荤枟鍒涘缓
ct.Ignore_Same_Name__c = true; //涓嶆槸閲嶅鐨勫鎴峰悕
//ct.SendToComPlat__c = true;
ct.AWS_Data_Id__c =gedata.DataId;//add 20220215 aws瀛樺偍鍑瘉
ct.MobilePhone_Encrypted__c =gedata.MobileEncrypted;//add 20220215 鎵嬫満瀵嗘枃
ct.LastName_Encrypted__c =gedata.NameEncrypted;//add 20220215 濮撳悕瀵嗘枃
+ //閭欢624鎺ュ彛鏂板瀛楁闇�姹� 20220706 LY Start
+ ct.ApproveDate__c =NFMUtil.parseDateTimeStr2Date(gedata.ApproveDate); //鏅烘収鍖荤枟棣栨璁よ瘉閫氳繃鏃堕棿
+ //閭欢624鎺ュ彛鏂板瀛楁闇�姹� 20220706 LY End
}
@@ -362,7 +384,7 @@
//鏇存柊缁忛攢鍟嗚仈绯讳汉
if (!peopleMap.containsKey(personCode)) {
rowData.Is_Error__c = 1;
- logstr += 'error:浜哄憳绠$悊缂栫爜 [PersonManagementCode] 瀵瑰簲鐨勮仈绯讳汉涓嶅瓨鍦紝姝ゆ潯鏁版嵁璺宠繃';
+ logstr += 'error:浜哄憳绠$悊缂栫爜'+personCode+'瀵瑰簲鐨勮仈绯讳汉涓嶅瓨鍦紝璇风‘璁ゃ��';
continue;
}
ct.id = peopleMap.get(personCode).id;
@@ -383,6 +405,9 @@
string DepartmentCode = string.isNotBlank(gedata.RelatedDepartment) ? gedata.RelatedDepartment : gedata.DepartmentManagementCode2;
string DepartmentClasskey = gedata.AccountName + ' ' + gedata.DepartmentClass;
system.debug('DepartmentClasskey------->'+DepartmentClasskey);
+ system.debug('DepartmentCode------->'+DepartmentCode);
+ system.debug('AccountMap------->'+AccountMap);
+ system.debug('AccountMap.containsKey(DepartmentCode)------->'+AccountMap.containsKey(DepartmentCode));
//绉戝瀛樺湪
if (AccountMap.containsKey(DepartmentCode)) {
//浜哄憳绠$悊缂栫爜瀛樺湪
@@ -399,7 +424,7 @@
} else { //鑱旂郴浜轰笉瀛樺湪 2 瀹屾垚
system.debug('2閫昏緫 鏈夊尰闄� 鏈夌瀹� 鏈変汉鍛樼鐞嗙紪鐮佷絾鏌ユ壘鏃犳浜� 鍔ㄤ綔锛氭姤閿�');
rowData.Is_Error__c = 1;
- logstr += 'error:浜哄憳绠$悊缂栫爜 [PersonManagementCode] 瀵瑰簲鐨勮仈绯讳汉涓嶅瓨鍦紝姝ゆ潯鏁版嵁璺宠繃';
+ logstr += 'error:浜哄憳绠$悊缂栫爜'+personCode+'瀵瑰簲鐨勮仈绯讳汉涓嶅瓨鍦紝璇风‘璁ゃ��';
continue;
}
} else { //浜哄憳绠$悊缂栫爜涓嶅瓨鍦�
@@ -407,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 瀹屾垚 鏇存柊鎿嶄綔
@@ -414,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);
@@ -451,27 +494,36 @@
} else { //浜哄憳绠$悊缂栫爜鏌ユ壘鏃犲�� 4 瀹屾垚
system.debug('4閫昏緫');
rowData.Is_Error__c = 1;
- logstr += 'error:浜哄憳绠$悊缂栫爜 [PersonManagementCode] 瀵瑰簲鐨勮仈绯讳汉涓嶅瓨鍦紝姝ゆ潯鏁版嵁璺宠繃';
+ logstr += 'error:浜哄憳绠$悊缂栫爜'+personCode+'瀵瑰簲鐨勮仈绯讳汉涓嶅瓨鍦紝璇风‘璁ゃ��';
continue;
}
} else { //浜哄憳绠$悊缂栫爜涓嶅瓨鍦�
system.debug('浜哄憳绠$悊缂栫爜涓嶅瓨鍦�');
- string namekey = gedata.DepartmentName + ' ' + gedata.NameEncrypted + ' ' + gedata.MobileEncrypted;
+ //string namekey = gedata.DepartmentName + ' ' + gedata.NameEncrypted + ' ' + gedata.MobileEncrypted;
+ string namekey = DepartmentClasskey + ' ' + gedata.NameEncrypted;
+ //string namekey = gedata.DepartmentName + ' ' + gedata.NameEncrypted;
+ //string namekey = '8103587' + ' ' + gedata.NameEncrypted;
//string namekey = gedata.AccountName + ' ' + gedata.DepartmentName + ' ' + gedata.DepartmentClass + ' ' + gedata.Name;
system.debug('DepartmentClasskey'+DepartmentClasskey);
system.debug('351nameMap '+nameMap);
+ 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.containsKey(namekey)'+sMap.containsKey(namekey));
+ system.debug('sMap.keySet'+sMap.keySet());
+ system.debug('sMap.containsKey(namekey)'+sMap.get(namekey));
+ //system.debug('sMap.containsKey(namekey)8103587 '+sMap.get('8103587 '+gedata.NameEncrypted));
+ //system.debug('sMap.containsKey(namekey)鍖椾含澶у绗笁鍖婚櫌 鏅绉� 鎵嬪姩鍒涘缓绉戝4'+sMap.get('鍖椾含澶у绗笁鍖婚櫌 鏅绉� 鎵嬪姩鍒涘缓绉戝4 '+gedata.NameEncrypted));
+ //if (sMap.containsKey(namekey)) { //鏌ユ壘瀛樺湪 8 瀹屾垚
if (sMap.containsKey(namekey)) { //鏌ユ壘瀛樺湪 8 瀹屾垚
system.debug('8閫昏緫');
system.debug('璇ヨ仈绯讳汉瀛樺湪');
ct.id = sMap.get(namekey).id;
//upsertAccountList.add(dpt);//鍙互娉ㄩ噴
upsertContactList.add(ct);
+ system.debug('list閲岀殑鑱旂郴浜轰俊鎭�'+upsertContactList);
// if(sMap.containsKey(gedata.Name)){
// ct.Id = sMap.get(gedata.Name).Id;
// }
@@ -489,11 +541,26 @@
contactMap.put(Gedata.DepartmentManagementCode2, ct);
system.debug('contactMap ' + contactMap);
//upsertContactList.add(ct);
+ }else{
+ system.debug('鍒涘缓鑱旂郴浜哄拰绉戝');
+ //system.debug('peopleList[0]'+peopleList[0]);
+ 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);
+
}
- system.debug('鍒涘缓鑱旂郴浜哄拰绉戝');
dpt.Department_Name__c = gedata.DepartmentName;
upsertAccountList.add(dpt);
- contactMap.put(Gedata.DepartmentManagementCode2, ct);
+
}
}
}else if('鏃犳晥'.equals(hospital.Is_Active_Formula__c)){
@@ -515,6 +582,9 @@
hp.OCM_Category__c = 'L';
hp.PlatformCode__c = gedata.HospitalManagementCode2;
hp.State_Master__c = StateMap.get(gedata.State); // 鐪�
+ //Ly 鐪佹枃鏈祴鍊� start
+ hp.State_Text__c = gedata.State; // 鐪�(鏂囨湰)
+ //Ly 鐪佹枃鏈祴鍊� end
hp.City_Master__c = CityMap.get(gedata.City); // 甯�
hp.Hospital_Source__c = '鏅烘収鍖荤枟';
upsertAccountList.add(hp);
@@ -525,7 +595,9 @@
system.debug('upsertContactList ' + upsertContactList);
system.debug('upsertAccountList ' + upsertAccountList);
if (upsertAccountList.size() > 0) {
- ControllerUtil.EscapeNFM001Trigger = true;
+ //鏀惧紑瑙﹀彂201鎺ュ彛鏉′欢 20221102 LY start
+ //ControllerUtil.EscapeNFM001Trigger = true;
+ //鏀惧紑瑙﹀彂201鎺ュ彛鏉′欢 20221102 LY end
StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
system.debug('upsertAccountList ' + upsertAccountList);
upsert upsertAccountList;
@@ -540,12 +612,15 @@
system.debug('ContactMap'+ContactMap);
system.debug('ContactMap.containsKey(ac.PlatformCode__c)'+ContactMap.containsKey(ac.PlatformCode__c));
if(ContactMap.containsKey(ac.PlatformCode__c)){
+
c = contactMap.get(ac.PlatformCode__c);
if(string.isblank(c.Id)|| c.AccountId != ac.Id){
c.Accountid = ac.id;
}
c.OwnerId = ac.OwnerId;
- upsertContactList.add(c);
+ system.debug('鑱旂郴浜轰俊鎭�'+c);
+ system.debug('upsertContactList'+upsertContactList);
+ //upsertContactList.add(c);
system.debug('OwnerId'+ac.OwnerId);
system.debug('upsertContactList'+upsertContactList);
}
--
Gitblit v1.9.1