From 34d9607524cad4f765299b28b4f9423cc2fa9e32 Mon Sep 17 00:00:00 2001 From: 沙世明 <shashiming@prec-tech.com> Date: 星期三, 23 三月 2022 18:07:42 +0800 Subject: [PATCH] Merge branch 'master' of http://47.92.229.245:8089/r/OlyMEBG --- force-app/main/default/classes/NFM624Rest.cls | 321 ++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 230 insertions(+), 91 deletions(-) diff --git a/force-app/main/default/classes/NFM624Rest.cls b/force-app/main/default/classes/NFM624Rest.cls index ad8dc2e..c935195 100644 --- a/force-app/main/default/classes/NFM624Rest.cls +++ b/force-app/main/default/classes/NFM624Rest.cls @@ -10,6 +10,10 @@ @RestResource(urlMapping = '/NFM624/*') global with sharing class NFM624Rest { + //add to AWS 鍥炲 start sushanhu 20220225 + static Boolean SFStatus=true; + static String SFMessage=''; + //add to AWS 鍥炲 end sushanhu 20220225 private static final String LOG_TYPE = 'NFM624'; // global class GeDatasRest { // public GeDatas GeDatas; @@ -21,13 +25,15 @@ } global class GeData { - public String ContactId; //缁熶竴骞冲彴ID + public String ContactId; //缁熶竴骞冲彴ID//Update to aws 瀛樺偍鐨凙WSContactId 20220225 SUSHANHU public String ServiceUserId; //鏈嶅姟骞冲彴鐢ㄦ埛ID public String PersonManagementCode; //浜哄憳绠$悊缂栫爜 public String HospitalManagementCode2; //鍖婚櫌骞冲彴缂栫爜 骞冲彴缂栫爜 PlatformCode__c public String DepartmentManagementCode2; //绉戝骞冲彴缂栫爜 骞冲彴缂栫爜 PlatformCode__c public String Name; //濮撳悕 + public String NameEncrypted;//濮撳悕瀵嗘枃 add 20220215 public String Mobile; //鎵嬫満鍙风爜 + public String MobileEncrypted;//鎵嬫満鍙风爜瀵嗘枃 add 20220215 public String State; //鍗曚綅鎵�鍦ㄧ渷浠� public String City; //甯� public String AccountName; //鍖婚櫌鍚� @@ -36,11 +42,14 @@ public String DepartmentName; //鎵�灞炵瀹� public String RelatedDepartment; //鍏宠仈SFDC绉戝 瀹㈡埛绠$悊缂栫爜(鎵嬪啓) AgentCode_Ext__c public String Type; //鑱岀 + public String TypeEncrypted;//鑱岀Hash add for pipl 20220316 sushanhu public String ContactAddress; //鑱旂郴鍦板潃 - public Boolean ForbiddenStatus; //骞冲彴鐢ㄦ埛绂佺敤鏍囪瘑 + public String ContactAddressEncrypted;//鑱旂郴鍦板潃瀵嗘枃 + public Boolean ForbiddenStatus; //骞冲彴鐢ㄦ埛绂佺敤鏍囪瘑 public String RegSource; //娉ㄥ唽骞冲彴鏉ユ簮 public Boolean AgentFlag; //缁忛攢鍟嗘爣璇� public String ApproverID; //瀹℃牳浜哄憳鍛樺伐缂栫爜 + public String DataId;//aws瀛樺偍鍑嵁 } @HttpPost @@ -49,7 +58,7 @@ // 鍙栧緱鎺ュ彛浼犺緭鍐呭 String strData = RestContext.request.requestBody.toString(); GeDatas ges = (GeDatas) JSON.deserializeStrict(strData, GeDatas.class); - + system.debug('ges---'+ges); if (ges == null) { return; @@ -71,8 +80,16 @@ RestResponse res = RestContext.response; res.addHeader('Content-Type', 'application/json'); res.statusCode = 200; - String jsonResponse = '{"status": "Success", "Message":""}'; - res.responseBody = blob.valueOf(jsonResponse); + // String jsonResponse = '{"status": "Success", "Message":""}'; + // res.responseBody = blob.valueOf(jsonResponse); + //updata response toAWS 20220225 sushanhu start + NFMUtil.NFMResponse result = NFMUtil.getNFMResponse(); + result.SFStatus=SFStatus; + result.SFMessage=SFMessage; + String jsonResponse =JSON.serialize(result); + system.debug('result---'+jsonResponse); + res.responseBody = blob.valueOf(jsonResponse); + //updata response toAWS 20220225 sushanhu end return; } @@ -130,7 +147,11 @@ try { //鏍规嵁浼犺繃鏉ョ殑绠$悊缂栫爜鏌ヨ濡傛灉鍙互鏌ヨ寰楀埌缁撴灉鍒欐洿鏂帮紝鏌ヨ涓嶅埌鍒欐柊澧� List < Gedata > newGeDataList = new List < Gedata > (); for (Gedata gedata: GeDataList) { - string dataComplete = verify(gedata); + //for test + gedata.AgentFlag=false; + // string dataComplete = verify(gedata); + string dataComplete =null; + // test end for pi if (!String.isBlank(dataComplete)) { logstr += dataComplete; rowData.Is_Error__c = 1; @@ -140,8 +161,12 @@ StateList.add(gedata.State); CityList.add(gedata.City); ApproverIDList.add(gedata.ApproverID); - ManagementList.add(gedata.HospitalManagementCode2); - ManagementList.add(gedata.DepartmentManagementCode2); + if(string.isnotblank(gedata.HospitalManagementCode2)){ + ManagementList.add(gedata.HospitalManagementCode2); + } + if(string.isnotblank(gedata.DepartmentManagementCode2)){ + ManagementList.add(gedata.DepartmentManagementCode2); + } //system.debug('AccountCodeList'+AccountCodeList); if (string.isnotblank(gedata.RelatedHospital)) { SFDCCodeList.add(gedata.RelatedHospital); @@ -165,13 +190,14 @@ for (Address_Level__c temp: statetempList) { StateMap.put(temp.Name, temp.Id); } + system.debug('StateMap----->'+StateMap); //鏌ヨ甯傚尯Id Map < String, String > CityMap = new Map < String, String > (); //甯侻ap List < Address_Level2__c > citytempList = [select Id, Name from Address_Level2__c where Name IN: CityList]; for (Address_Level2__c temp: citytempList) { CityMap.put(temp.Name, temp.Id); } - + system.debug('CityMap----->'+CityMap); //鏌ヨ鍖婚櫌鎵�鏈変汉 Map<string,String> ownerMap = new Map<string,String>(); List<User> ownerList = [select Id,Employee_No__c from User where Employee_No__c IN:ApproverIDList]; @@ -195,13 +221,15 @@ Account.PlatformCode__c, Account.Management_Code__c, Account.parent.Department_Class_Label__c, - Name, + Name,LastName_Encrypted__c, Account.Parent_Management_Code__c, Account.Parent_PlatformCode__c, - CManageCode__c, + CManageCode__c, AccountId from Contact where CManageCode__c IN: PersonManagementCodeList + OR Account.PlatformCode__c IN: ManagementList + OR Account.Management_Code__c IN: SFDCCodeList OR Account.Parent_PlatformCode__c IN: ManagementList OR Account.Parent_Management_Code__c IN: SFDCCodeList]; //鏍规嵁浜哄憳绠$悊缂栫爜妫�绱㈣仈绯讳汉 Map < String, Contact > peopleMap = new Map < String, Contact > (); //鑱旂郴浜� @@ -210,22 +238,21 @@ if (string.isnotblank(ct.Account.parent.Name)) { Map < String, Contact > snameMap = new Map < String, Contact > (); string Name = ct.Name.replaceAll(' ',''); - string namekey = ct.Account.Name + ' ' + Name; + string namekey = ct.Account.Name + ' ' + ct.LastName_Encrypted__c; // snameMap.put(namekey,ct); if (nameMap.containsKey(ct.Account.parent.Name)) { snameMap = nameMap.get(ct.Account.parent.Name); } snameMap.put(namekey, ct); - snameMap.put(ct.Name, ct); + snameMap.put(ct.LastName_Encrypted__c, ct); nameMap.put(ct.Account.parent.Name, snameMap); } peopleMap.put(ct.CManageCode__c, ct); - System.debug('peopleMap'+peopleMap); // peopleMap.put(ct.Name, ct); //string temp = ct.Name + ct.Account.parent.Department_Class_Label__c; // peopleMap.put(temp, ct); } - + System.debug('peopleMap'+peopleMap); //鏌ヨ鍖婚櫌绉戝 //List<Account> AccountList = [select Id,PlatformCode__c,PlatformCode__c,Department_Class_Label__c,Name,Management_Code__c,Is_Active__c,AgentCode_Ext__c,ParentId,Parent.ParentId from Account where PlatformCode__c IN :HpCodeList OR parent.PlatformCode__c IN :HpCodeList OR PlatformCode__c IN :HpCodeList OR Management_Code__c IN :RelatedHospitalList OR Parent_Management_Code__c IN :RelatedHospitalList]; //List < Account > AccountList = [select Id, PlatformCode__c, Department_Class_Label__c, Name, Management_Code__c, Is_Active__c, AgentCode_Ext__c, ParentId, Parent.ParentId from Account where Management_Code__c IN :AccountCodeList OR Parent_Management_Code__c IN :AccountCodeList OR PlatformCode__c IN :AccountCodeList OR Parent.Parent.PlatformCode__c IN :AccountCodeList]; @@ -236,12 +263,16 @@ OCM_man_province_HP__c, Name, Management_Code__c, Is_Active__c, AgentCode_Ext__c, + RelatedMessageGroupNumber__c, ParentId, Parent.ParentId, OwnerId from Account where Parent_PlatformCode__c IN: ManagementList - OR Parent_Management_Code__c IN: SFDCCodeList]; + OR Parent_Management_Code__c IN: SFDCCodeList + OR PlatformCode__c IN: ManagementList + OR Management_Code__c IN: SFDCCodeList + OR (State_Master__c IN:StateMap.Values() AND City_Master__c IN:CityMap.Values())]; Map <String,Account> DepartmentClassMap = new Map <String,Account>();//鎴樼暐绉戝Map Map < String, Account > AccountMap = new Map < String, Account > (); //鍖婚櫌绉戝 for (Account ac: AccountList) { @@ -251,6 +282,9 @@ } if (string.isNotBlank(ac.PlatformCode__c)) { AccountMap.put(ac.PlatformCode__c, ac); + } + if(string.isNotBlank(ac.Name) && ac.ParentId == null && ac.Parent.ParentId == null){ + AccountMap.put(ac.name,ac); } } system.debug('AccountMap '+AccountMap); @@ -279,15 +313,22 @@ ct.LastName = gedata.Name; ct.FirstName = ''; ct.Type__c = gedata.Type; + ct.Type_Encrypted__c = gedata.TypeEncrypted;//add for pipl sushanhu 20220316 ct.MobilePhone = gedata.Mobile; ct.RegSource__c = comefrom; ct.UnifiedI_Contact_ID__c = gedata.ContactId; //缁熶竴骞冲彴Id + // //UPDATE TO AWS 瀛樺偍鐨勭粺涓�骞冲彴id + // ct.AWS_UnifiedI_Contact_ID__c=gedata.ContactId; //缁熶竴骞冲彴Id ct.ServicePlatformCode__c = gedata.ServiceUserId; //鏈嶅姟骞冲彴鐢ㄦ埛Id ct.Contact_address__c = gedata.ContactAddress;//鑱旂郴鍦板潃 + ct.Contact_address_Encrypted__c=gedata.ContactAddressEncrypted;//鑱旂郴鍦板潃瀵嗘枃 add 20220215 ct.Platform_disabled_representation__c = gedata.ForbiddenStatus;//骞冲彴绂佺敤鏍囪瘑 //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 濮撳悕瀵嗘枃 String personCode = gedata.PersonManagementCode; @@ -313,14 +354,14 @@ dpt.Hospital__c = hospital.Id; //鍒ゆ柇鍖婚櫌鏄惁鏈夋晥 - if ('鏈夋晥'.equals(hospital.Is_Active_Formula__c)) { + if ('鏈夋晥'.equals(hospital.Is_Active_Formula__c) || '鏃犳晥'.equals(hospital.Is_Active_Formula__c)) { string DepartmentCode = string.isNotBlank(gedata.RelatedDepartment) ? gedata.RelatedDepartment : gedata.DepartmentManagementCode2; string DepartmentClasskey = gedata.AccountName + ' ' + gedata.DepartmentClass; //绉戝瀛樺湪 if (AccountMap.containsKey(DepartmentCode)) { //浜哄憳绠$悊缂栫爜瀛樺湪 ct.AccountId = AccountMap.get(DepartmentCode).id;//绉戝纭畾锛屽皢鑱旂郴浜烘寕鍦ㄨ绉戝涓� - ct.OwnerId = AccountMap.get(DepartmentCode).OwnerId;//鍙槸纭畾锛屽皢灏嗚仈绯讳汉鎵�鏈変汉鐨勫�艰祴涓虹瀹ゆ墍鏈変汉 + ct.OwnerId = AccountMap.get(DepartmentCode).OwnerId;//绉戝纭畾锛屽皢灏嗚仈绯讳汉鎵�鏈変汉鐨勫�艰祴涓虹瀹ゆ墍鏈変汉 system.debug('personCode' + personCode); if (string.isnotblank(personCode)) { system.debug('浜哄憳绠$悊缂栫爜瀛樺湪'); @@ -337,7 +378,8 @@ } else { //浜哄憳绠$悊缂栫爜涓嶅瓨鍦� //鎼滅储浜哄悕/涓斿湪褰撳墠鎴樼暐绉戝绉戝涓� System.debug('浜哄憳绠$悊缂栫爜涓嶅瓨鍦�'); - string namekey = gedata.Name; + string namekey = gedata.NameEncrypted; + system.debug('namekey----->'+namekey); system.debug('DepartmentClasskey = '+DepartmentClasskey); system.debug('nameMap22222222 '+nameMap); if (nameMap.containskey(DepartmentClasskey)) { // 6 瀹屾垚 鏇存柊鎿嶄綔 @@ -408,29 +450,141 @@ contactMap.put(Gedata.DepartmentManagementCode2, ct); } } - }else if('鏃犳晥'.equals(hospital.Is_Active_Formula__c)){ - logstr += 'error:璇ュ尰闄㈡棤鏁堬紝姝ゆ潯鏁版嵁璺宠繃'; - continue; }else{ - logstr += '璇ュ尰闄㈠浜庤崏妗堜腑锛岃绛夊緟瀹℃壒瀹屾垚'; + logstr += '璇ュ尰闄㈠浜庤崏妗堜腑/鐢宠涓紝璇风瓑寰呭鎵瑰畬鎴�'; + //鐘舵��------>鑽夋涓�/鐢宠涓�------->绛夊緟锛宲lan1:鎶婂尰闄d鍐欏埌鏃ュ織琛ㄤ笂锛堝悗缁绱㈡牴鎹尰闄d妫�绱㈡湭澶勭悊杩囩殑鏃ュ織锛�,plan2:鎶奙essageGroupNumber瀛樺埌鍖婚櫌涓� rowData.NFM624_Secondary_processing__c = false; continue; } - } else { //鍖婚櫌涓嶅瓨鍦� - system.debug('鏂板缓鍖婚櫌 閫昏緫5閫昏緫10 鏃犺浜哄憳绠$悊缂栫爜鏄惁鏈夊�奸兘闇�瑕佹柊寤哄尰闄�'); - hp.Name = gedata.AccountName; //鍖婚櫌鍚嶈祴鍊� - if(ownerMap.containsKey(gedata.ApproverID)){ - hp.OwnerId = ownerMap.get(gedata.ApproverID);//瀹℃牳浜哄憳鍛樺伐缂栫爜璧嬪�肩粰鐢ㄦ埛鎵�鏈変汉 + } else { //鍖婚櫌涓嶅瓨鍦� 鍒欓渶瑕佸鍔犲垽鏂牴鎹悕鍒ら噸 + if(accountMap.containskey(gedata.AccountName)){//濡傛灉鏍规嵁鍚嶅瓧鍒ゆ柇鏈夐噸澶嶅垯鏁版嵁鏂板缓鎸囧悜杩欎釜鍖婚櫌 + Account dpt = new Account(); + Account hospital = AccountMap.get(gedata.AccountName); + dpt.PlatformCode__c = gedata.DepartmentManagementCode2; + dpt.Hospital__c = hospital.Id; + //鍖婚櫌瀛樺湪鈫撳彇鐘舵��,鏈夋晥鏃犳晥閮芥柊寤� + if ('鏈夋晥'.equals(hospital.Is_Active_Formula__c) || '鏃犳晥'.equals(hospital.Is_Active_Formula__c)) { + string DepartmentCode = string.isNotBlank(gedata.RelatedDepartment) ? gedata.RelatedDepartment : gedata.DepartmentManagementCode2; + string DepartmentClasskey = gedata.AccountName + ' ' + gedata.DepartmentClass; + //绉戝瀛樺湪 + if (AccountMap.containsKey(DepartmentCode)) {//鍥犱负SOQL娌℃湁妫�绱㈠埌绉戝鎵�浠ユ病鏈夊垽瀹氫负娌℃湁绉戝 + //浜哄憳绠$悊缂栫爜瀛樺湪 + ct.AccountId = AccountMap.get(DepartmentCode).id;//绉戝纭畾锛屽皢鑱旂郴浜烘寕鍦ㄨ绉戝涓� + ct.OwnerId = AccountMap.get(DepartmentCode).OwnerId;//鍙槸纭畾锛屽皢灏嗚仈绯讳汉鎵�鏈変汉鐨勫�艰祴涓虹瀹ゆ墍鏈変汉 + system.debug('personCode' + personCode); + if (string.isnotblank(personCode)) { + system.debug('浜哄憳绠$悊缂栫爜瀛樺湪'); + //鑱旂郴浜哄瓨鍦� 11 鍖婚櫌鍚嶅瓧鎺掗噸瀛樺湪锛岀瀹ゅ瓨鍦紝鏇存柊鑱旂郴浜猴紝 瀹屾垚 + if (peopleMap.containsKey(personCode)) { + system.debug('11閫昏緫 鍚嶅瓧鏌ラ噸鍖婚櫌 鏈夌瀹� 鏈変汉鍛樼鐞嗙紪鐮佷笖鏌ユ壘鏈夋浜� 鍔ㄤ綔锛氭洿鏂�'); + ct.Id = peopleMap.get(personCode).Id; + upsertContactList.add(ct); + } else { //鑱旂郴浜轰笉瀛樺湪 12 瀹屾垚 + system.debug('12閫昏緫 鍚嶅瓧鏌ラ噸鍖婚櫌 鏈夌瀹� 鏈変汉鍛樼鐞嗙紪鐮佷絾鏌ユ壘鏃犳浜� 鍔ㄤ綔锛氭姤閿�'); + logstr += 'error:浜哄憳绠$悊缂栫爜 [PersonManagementCode] 瀵瑰簲鐨勮仈绯讳汉涓嶅瓨鍦紝姝ゆ潯鏁版嵁璺宠繃'; + continue; + } + } else { //浜哄憳绠$悊缂栫爜涓嶅瓨鍦� + //鎼滅储浜哄悕/涓斿湪褰撳墠鎴樼暐绉戝绉戝涓� + System.debug('浜哄憳绠$悊缂栫爜涓嶅瓨鍦�'); + string namekey = gedata.NameEncrypted; + system.debug('DepartmentClasskey = '+DepartmentClasskey); + system.debug('nameMap22222222 '+nameMap); + system.debug('nameMap.containskey(DepartmentClasskey)'+nameMap.containskey(DepartmentClasskey)); + if (nameMap.containskey(DepartmentClasskey)) { // 16 瀹屾垚 鏇存柊鎿嶄綔 + Map < String, Contact > sMap = nameMap.get(DepartmentClasskey); + if (sMap.containsKey(namekey)) { + system.debug('Id璧嬪��'+sMap); + ct.id = sMap.get(namekey).id; + system.debug('16閫昏緫 鏃犱汉鍛樼鐞嗙紪鐮� 鍖婚櫌鏌ラ噸瀛樺湪 鏈夌瀹� 浜哄悕鏌ユ壘鏈� 鍔ㄤ綔锛氭洿鏂拌仈绯讳汉 '); + } else { // 17 瀹屾垚 + system.debug('17閫昏緫 鏃犱汉鍛樼鐞嗙紪鐮� 鍖婚櫌鏌ラ噸瀛樺湪 鏈夌瀹� 浜哄悕鏌ユ壘鏃� 鍔ㄤ綔锛氭柊寤鸿仈绯讳汉 '); + } + } + upsertContactList.add(ct); + } + dpt.Id = AccountMap.get(DepartmentCode).Id; + upsertAccountList.add(dpt); + } else { //绉戝涓嶅瓨鍦� + //涓虹瀹よ祴鍊� + dpt.Name = gedata.DepartmentName; + dpt.RecordTypeId = RecordTypeMap.get(gedata.DepartmentClass); + //鍥犱负娌℃湁鍖婚櫌绠$悊缂栫爜锛屾棤娉曟绱㈠埌鎴樼暐绉戝锛屾墍浠ュ湪缁欑瀹ょ殑鎴樼暐绉戝瀛楁璧嬪�兼椂绌烘寚閽� + dpt.Department_Class__c = DepartmentClassMap.get(gedata.DepartmentClass).Id; + dpt.ParentId = DepartmentClassMap.get(gedata.DepartmentClass).Id; + if (string.isnotblank(personCode)) { //浜哄憳绠$悊缂栫爜瀛樺湪 + if (peopleMap.containsKey(personCode)) { //浜哄憳绠$悊缂栫爜鏌ユ壘鏈夊�� 13 瀹屾垚 + System.debug('13閫昏緫'); + //鏂板缓绉戝+鏂板缓鑱旂郴浜�, + ct.id = peopleMap.get(personCode).id; + contactMap.put(Gedata.DepartmentManagementCode2, ct); + system.debug('contactMap ' + contactMap); + dpt.Department_Name__c = gedata.DepartmentName; + upsertAccountList.add(dpt); + //upsertContactList.add(ct); + } else { //浜哄憳绠$悊缂栫爜鏌ユ壘鏃犲�� 14 瀹屾垚 + system.debug('14閫昏緫'); + logstr += 'error:浜哄憳绠$悊缂栫爜 [PersonManagementCode] 瀵瑰簲鐨勮仈绯讳汉涓嶅瓨鍦紝姝ゆ潯鏁版嵁璺宠繃'; + continue; + } + } else { //浜哄憳绠$悊缂栫爜涓嶅瓨鍦� + system.debug('浜哄憳绠$悊缂栫爜涓嶅瓨鍦�'); + string namekey = gedata.DepartmentName+ ' ' + gedata.Name; + //string namekey = gedata.AccountName + ' ' + gedata.DepartmentName + ' ' + gedata.DepartmentClass + ' ' + gedata.Name; + system.debug('DepartmentClasskey'+DepartmentClasskey); + system.debug('351nameMap '+nameMap); + if (nameMap.containsKey(DepartmentClasskey)) { //鏌ユ壘鏄惁瀛樺湪璇ユ垬鐣ョ瀹� + System.debug('浜哄憳绠$悊缂栫爜涓嶅瓨鍦ㄧ殑鎯呭喌涓嬫垬鐣ョ瀹ゅ瓨鍦�'); + system.debug('鎴樼暐绉戝瀛樺湪' + nameMap.get(DepartmentClasskey)); + Map < String, Contact > sMap = nameMap.get(DepartmentClasskey); + if (sMap.containsKey(namekey)) { //鏌ユ壘瀛樺湪 18 瀹屾垚 + system.debug('18閫昏緫'); + system.debug('璇ヨ仈绯讳汉瀛樺湪'); + ct.id = sMap.get(namekey).id; + upsertAccountList.add(dpt); + upsertContactList.add(ct); + // if(sMap.containsKey(gedata.Name)){ + // ct.Id = sMap.get(gedata.Name).Id; + // } + }else if(sMap.containsKey(gedata.Name)){ + system.debug('1234567890'); + ct.Id = sMap.get(gedata.Name).Id; + //upsertAccountList.add(dpt); + } + system.debug('contactMap ' + contactMap); + System.debug('19閫昏緫'); + contactMap.put(Gedata.DepartmentManagementCode2, ct); + } + system.debug('鍒涘缓鑱旂郴浜哄拰绉戝'); + dpt.Department_Name__c = gedata.DepartmentName; + upsertAccountList.add(dpt); + contactMap.put(Gedata.DepartmentManagementCode2, ct); + } + } + }else{ + logstr += '璇ュ尰闄㈠浜庤崏妗堜腑/鐢宠涓紝璇风瓑寰呭鎵瑰畬鎴�'; + //鐘舵��------>鑽夋涓�/鐢宠涓�------->绛夊緟锛宲lan1:鎶婂尰闄d鍐欏埌鏃ュ織琛ㄤ笂锛堝悗缁绱㈡牴鎹尰闄d妫�绱㈡湭澶勭悊杩囩殑鏃ュ織锛�,plan2:鎶奙essageGroupNumber瀛樺埌鍖婚櫌涓� + hospital.RelatedMessageGroupNumber__c += iflog.MessageGroupNumber__c + ';'; + rowData.NFM624_Secondary_processing__c = false; + upsertAccountList.add(hospital); + } + }else{ + //鈫撴柊寤哄尰闄� + system.debug('鏂板缓鍖婚櫌 閫昏緫5閫昏緫10閫昏緫15閫昏緫20 鏃犺浜哄憳绠$悊缂栫爜鏄惁鏈夊�奸兘闇�瑕佹柊寤哄尰闄�'); + hp.Name = gedata.AccountName; //鍖婚櫌鍚嶈祴鍊� + if(ownerMap.containsKey(gedata.ApproverID)){ + hp.OwnerId = ownerMap.get(gedata.ApproverID);//瀹℃牳浜哄憳鍛樺伐缂栫爜璧嬪�肩粰鐢ㄦ埛鎵�鏈変汉 + } + hp.RecordTypeId = '01210000000QemG'; + hp.OCM_Category__c = 'L'; + hp.PlatformCode__c = gedata.HospitalManagementCode2; + hp.State_Master__c = StateMap.get(gedata.State); // 鐪� + hp.City_Master__c = CityMap.get(gedata.City); // 甯� + hp.Hospital_Source__c = '鏅烘収鍖荤枟'; + upsertAccountList.add(hp); + System.debug('upsertAccountList'+upsertAccountList); + rowData.NFM624_Secondary_processing__c = false;//鏁版嵁闇�瑕佷簩娆″鐞嗘爣璁� } - hp.RecordTypeId = '01210000000QemG'; - hp.OCM_Category__c = 'L'; - hp.PlatformCode__c = gedata.HospitalManagementCode2; - hp.State_Master__c = StateMap.get(gedata.State); // 鐪� - hp.City_Master__c = CityMap.get(gedata.City); // 甯� - hp.Hospital_Source__c = '鏅烘収鍖荤枟'; - upsertAccountList.add(hp); - System.debug('upsertAccountList'+upsertAccountList); - rowData.NFM624_Secondary_processing__c = false;//鏁版嵁闇�瑕佷簩娆″鐞嗘爣璁� } } system.debug('upsertContactList ' + upsertContactList); @@ -518,11 +672,19 @@ if (string.isblank(gda.Name)) { result += 'DataError锛氬鍚嶄负绌篭n'; } + if (string.isblank(gda.NameEncrypted)) { + result += 'DataError锛氬鍚嶅瘑鏂囦负绌篭n'; + } if (string.isblank(gda.Mobile)) { result += 'DataError锛氭墜鏈哄彿涓虹┖\n'; } + if (string.isblank(gda.MobileEncrypted)) { + result += 'DataError锛氭墜鏈哄彿瀵嗘枃涓虹┖\n'; + } if (string.isblank(gda.RegSource)) { result += 'DataError锛氭敞鍐屽钩鍙版潵婧愪负绌篭n'; + }if (string.isblank(gda.DataId)) { + result += 'DataError锛欰WS鍔犲瘑鍑嵁涓虹┖\n'; } if (gda.AgentFlag) { if (string.isblank(gda.PersonManagementCode)) { @@ -559,55 +721,7 @@ } return result; } - // global static String contactAllName(String contactName){ - // // 涓浗 澶嶅澶у叏 - // String CompoundSurname = '婵槼銆佸叕鍐躲�佸お鍙斻�佺敵灞犮�佸叕瀛欍�佹厱瀹广�佷徊瀛欍�侀挓绂汇�侀暱瀛欍�佸畤鏂囥�佸徃寰掋�侀矞浜庛�佸徃绌恒�侀椌涓樸�佸瓙杞︺�佷簱瀹樸�佸徃瀵囥�佸帆椹�佸叕瑗裤�侀瀛欍�佸¥椹枫�佸叕鑹�佹紗闆曘�佷箰姝c�佸鐖躲�佽胺姊併�佹嫇璺嬨�佸す璋枫�佽僵杈曘�佷护鐙愩�佹骞层�佺櫨閲屻�佸懠寤躲�佷笢閮�佸崡闂ㄣ�佺緤鑸屻�佸井鐢熴�佸叕鎴枫�佸叕鐜夈�佸叕浠�佹涓樸�佸叕浠层�佸叕涓娿�佸叕闂ㄣ�佸叕灞便�佸叕鍧氥�佸乏涓樸�佸叕浼�佽タ闂ㄣ�佸叕绁栥�佺浜斻�佸叕涔樸�佽疮涓樸�佸叕鐨欍�佸崡鑽c�佷笢閲屻�佷笢瀹�佷徊闀裤�佸瓙涔︺�佸瓙妗戙�佸嵆澧ㄣ�佽揪濂氥�佽甯堛�佸惔閾�'; - // // string allname = '鏈卞惎璐�'; - // // contactName = '绗簲鎯嗘��'; - // String lastName = ''; - // String firstName = ''; - // String result = ''; - // if (contactName.contains('路')) { - // lastName = contactName.split('路')[0]; - // firstName = contactName.split('路')[1]; - // } else { - // if (contactName.length() > 2) { - - // system.debug('CompoundSurname--->01' + contactName.subString(0, 2)); - // if (CompoundSurname.contains(contactName.subString(0, 2))) { - // lastName = contactName.substring(0,2); - // firstName = contactName.substring(2,contactName.length()); - // system.debug('lastName--->'+lastName); - // system.debug('firstName--->'+firstName); - // } else { - // lastName = contactName.substring(0,1); - // firstName = contactName.substring(1,contactName.length()); - // system.debug('lastName--->'+lastName); - // system.debug('firstName--->'+firstName); - // } - // } else { - // if (contactName.length() == 2) { - // lastName = contactName.substring(0,1); - // firstName = contactName.substring(1,contactName.length()); - // system.debug('lastName--->'+lastName); - // system.debug('firstName--->'+firstName); - // } else { - // lastName = contactName; - // firstName = contactName; - // system.debug('lastName--->'+lastName); - // system.debug('firstName--->'+firstName); - // } - // } - // } - // if (!contactName.equals(lastName+firstName)) { - // lastName = contactName; - // firstName = contactName; - // } - // result = lastName + '_' + firstName; - // //system.debug('CompoundSurname--->02' + CompoundSurname); - // return result; - // } - + private static void supplement (String ContactId){ //鎶�620Batch 鍜� 623Batch 鎼繃鏉� //琛ュ厖璇㈤棶鍗曢儴鍒� start @@ -618,12 +732,11 @@ List<Inquiry_form__c> InquiryList = [select Id,Inquiry_No__c,ContactId__c,Hospital_Name__c,Department_Class__c,Contact_Name__c from Inquiry_form__c where ContactId__c = :ContactId]; system.debug('InquiryList'+InquiryList); //鏍规嵁缁熶竴鐢ㄦ埛Id鏌ヨ鑱旂郴浜� - //select Id,Name,UnifiedI_Contact_ID__c,AccountId,Account.Name from Contact List<Contact> contactList = [select Id,Name,UnifiedI_Contact_ID__c,Account.Id,Strategic_dept_Class__c,AccountId,Account.Name,Strategic_dept_Class__r.OwnerId from Contact where UnifiedI_Contact_ID__c = :ContactId]; - system.debug('contactList' + contactList); - + system.debug('contactList' + contactList); + if(InquiryList.size()>0){ - //缁熶竴鐢ㄦ埛ID瀛樺叆List銆佽闂崟ID瀛楳ap + //缁熶竴鐢ㄦ埛ID瀛樺叆List銆佽闂崟ID瀛楳ap Map<String, String> inquiryMap = new Map<String, String>(); //List<String> contactIdList = new List<String>(); for (Inquiry_form__c inquiryInfo : inquiryList) { @@ -649,7 +762,8 @@ //琛ュ厖璇㈤棶鍗曢儴鍒� end //琛ュ厖瀛︿細閮ㄥ垎 start - List<CampaignMember__c> capMemList = [select Id,Contact_ID__c,Campaign__c,Campaign__r.Num__c,ViewContactId__c from CampaignMember__c where ViewContactId__c = :ContactId]; + //List<CampaignMember__c> campaignMemberList = new List<CampaignMember__c>(); + List<CampaignMember__c> capMemList = [select Id,Contact_ID__c,Campaign__c,Campaign__r.Num__c,ViewContactId__c from CampaignMember__c where Contact_ID__c = :ContactId]; if(capMemList.size() > 0){ system.debug('capMemList=================>'+capMemList); Map<String, String> capMemMap = new Map<String, String>(); @@ -680,4 +794,29 @@ } //琛ュ厖瀛︿細閮ㄥ垎 end } + //鍓嶇疆鏉′欢锛屽尰闄㈢鐞嗙紪鐮佷笉瀛樺湪鐨勬椂鍊欐墽琛岃繖涓搷浣� +// private static Account duplicate_removal (Map<String,ACcount> accountNameMap,Gedate ged,BatchIF_Log__c iflog){//鍖婚櫌鍚峂ap,鎺ュ彛鏁版嵁锛屾棩蹇楄〃 +// //鏌ヨ鍖婚櫌鏄柊澧炴潯浠禣R 锛堢渷 = 浼犲叆鐪� AND 甯� = 浼犲叆甯傦級锛屽鍔犱竴涓竴鍚嶅瓧涓簁ey鐨刴ap锛屾牴鎹紶鍏ユ暟鎹殑鍚嶅瓧鍒ゆ柇鏄惁瀛樺湪 +// //涓嶅瓨鍦ㄢ�斺�斺��>鏂板缓 +// //瀛樺湪鈥斺��>鍙栫姸鎬� +// //鐘舵��------>鑽夋涓�/鐢宠涓�------->绛夊緟锛宲lan1:鎶婂尰闄d鍐欏埌鏃ュ織琛ㄤ笂锛堝悗缁绱㈡牴鎹尰闄d妫�绱㈡湭澶勭悊杩囩殑鏃ュ織锛�,plan2:鎶奙essageGroupNumber瀛樺埌鍖婚櫌涓� +// //鐘舵��------>鏈夋晥锛屾暟鎹柊寤哄埌璇ュ尰闄笅,鍙戦�佽仈绯讳汉淇℃伅 +// //鐘舵��------>鏃犳晥锛屾暟鎹柊寤哄埌璇ュ尰闄笅,鍏堝彂閫佽仈绯讳汉淇℃伅锛屽啀鍙戦�佸尰闄俊鎭� +// if(accountNameMap.containskey(ged.AccountName)){//鏍规嵁鍖婚櫌鍚嶅垽鏂尰闄㈡槸鍚﹀瓨鍦� +// //鍖婚櫌瀛樺湪 +// Account tempHp = accountNameMap.get(ged.AccountName); +// if('鑽夋涓�'.equals(tempHp.Is_Active_Formula__c) || '鐢宠涓�'.equals(tempHp.Is_Active_Formula__c)){//鍒ゆ柇鍖婚櫌鐘舵�� +// //鑽夋涓�/鐢宠涓姸鎬� +// tempHp.RelatedMessageGroupNumber__c += iflog.MessageGroupNumber__c + ';'; +// //continue; +// return tempHp; +// }else{ + +// } +// }else{ +// //鍖婚櫌涓嶅瓨鍦� + +// return hp; +// } +// } } \ No newline at end of file -- Gitblit v1.9.1