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/NFM624RestAboutTest.cls | 41 +++++++ force-app/main/default/classes/NFM624RestTest.cls | 177 ++++++++++++++++++++++++++++++++++ force-app/main/default/classes/NFM624RestAbout.cls | 25 +++- force-app/main/default/classes/NFM624Rest.cls | 52 +++++++-- 4 files changed, 266 insertions(+), 29 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; - } } } diff --git a/force-app/main/default/classes/NFM624RestAbout.cls b/force-app/main/default/classes/NFM624RestAbout.cls index c8807d2..8011d0b 100644 --- a/force-app/main/default/classes/NFM624RestAbout.cls +++ b/force-app/main/default/classes/NFM624RestAbout.cls @@ -278,7 +278,7 @@ 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; @@ -287,11 +287,11 @@ 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 +301,27 @@ //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) { + 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) { + 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); } } } diff --git a/force-app/main/default/classes/NFM624RestAboutTest.cls b/force-app/main/default/classes/NFM624RestAboutTest.cls index f4b563c..9faeffe 100644 --- a/force-app/main/default/classes/NFM624RestAboutTest.cls +++ b/force-app/main/default/classes/NFM624RestAboutTest.cls @@ -21,9 +21,26 @@ Account hptemp = [select Id,PlatformCode__c,AgentCode_Ext__c,Is_Active_Formula__c from Account where Id = :hp.Id]; - //鎴樼暐绉戝 - Account dc = [select Id, Name,Parent_PlatformCode__c,Parent_Management_Code__c, RecordType_DeveloperName__c, Account2__c from Account where ParentId = :hp.Id and RecordType_DeveloperName__c = 'Department_Class_BF']; - + // 鎴︾暐绉戝銈掑緱銈� + Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hp.Id AND recordType.DeveloperName = 'Department_Class_OTH']; + // 瑷虹檪绉戙倰浣溿倠 + Account dep = new Account(); + dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_OTH'].id; + dep.Name = 'test dep'; + dep.AgentCode_Ext__c = '9999998'; + dep.ParentId = strategicDep[0].Id; + dep.Department_Class__c = strategicDep[0].Id; + dep.Hospital__c = hp.Id; + insert dep; + + //鑱旂郴浜� + Contact contact2 = new Contact(); + contact2.AccountId = dep.Id; + contact2.FirstName = '璨换鑰�'; + contact2.LastName = 'test1缁忛攢鍟�'; + contact2.LastName_Encrypted__c ='24616254c7c7b65d985567f475b667d7'; + insert contact2; + NFM624Rest.GeData GeData1 = new NFM624Rest.GeData(); NFM624Rest.GeDatas GaDatas = new NFM624Rest.GeDatas(); @@ -99,4 +116,22 @@ NFM624RestAbout.executefuture(rowData3.Id); } } + + static testMethod void test_method_execute(){ + Test.startTest(); + + RestRequest req = new RestRequest(); + RestResponse res = new RestResponse(); + + String JsonMsg = '{"Monitoring":{"Tag":"MSGH","Sender":"SPO","Receiver":"SFDC","MessageType":"NFM624About","MessageGroupNumber":"20210000004695","NumberOfRecord":"4","TransmissionDateTime":"2022-05-19","Text":""},"GeData":[{"PersonManagementCode":"thhTest","HospitalManagementCode2":"thhTest","DepartmentManagementCode2":"thhTest","NameEncrypted":"thhTest","RelatedHospital":"thhTest","DepartmentClass":"thhTest","DepartmentName":"thhTest","RelatedDepartment":"thhTest","dataId":"thh121231345","AccountName":"thhTest","MobileEncrypted":"11223344"}]}'; + req.requestURI = 'services/apexrest/NFM624RestAbout/execute'; + req.httpMethod = 'POST'; + req.requestBody = Blob.valueof(JsonMsg); + RestContext.request = req; + RestContext.response= res; + + NFM624RestAbout.execute(); + + Test.stopTest(); + } } \ No newline at end of file diff --git a/force-app/main/default/classes/NFM624RestTest.cls b/force-app/main/default/classes/NFM624RestTest.cls index 45b8135..3ade80c 100644 --- a/force-app/main/default/classes/NFM624RestTest.cls +++ b/force-app/main/default/classes/NFM624RestTest.cls @@ -1,6 +1,7 @@ @isTest private class NFM624RestTest { static testMethod void testMethod1(){ + oly_TriggerHandler.bypass('ContactTriggerHandler'); BatchIF_Log__c testLog = new BatchIF_Log__c(); testLog.CurrencyIsoCode = 'CNY'; testLog.Type__c = 'NFM624'; @@ -15,7 +16,7 @@ NFM624Rest.main(testLog.Id); } static testMethod void testMethod2(){ - + oly_TriggerHandler.bypass('ContactTriggerHandler'); //Test.startTest(); //鐢ㄦ埛 User hpowner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '鍖椾含', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = '00e10000000xnp2'); @@ -28,6 +29,7 @@ Account hp = new Account(RecordTypeId = '01210000000QemG', Name = 'hp', OwnerId = hpOwner.Id); hp.FSE_GI_Main_Leader__c = hpOwner.Id; hp.Advance_Payment_Identification_Approval__c = Date.today().addyears(-1); + hp.Is_Active__c = '鏈夊姽'; insert hp; Account hptemp = [select Id,PlatformCode__c,AgentCode_Ext__c from Account where Id = :hp.Id]; //鎴樼暐绉戝 @@ -79,6 +81,7 @@ //Test.stopTest(); } static testMethod void testMethod3(){ + oly_TriggerHandler.bypass('ContactTriggerHandler'); BatchIF_Log__c testLog = new BatchIF_Log__c(); testLog.CurrencyIsoCode = 'CNY'; testLog.Type__c = 'NFM624'; @@ -145,6 +148,7 @@ NFM624Rest.main(testLog5.Id); } static testMethod void testMethod4(){ + oly_TriggerHandler.bypass('ContactTriggerHandler'); //鐢ㄦ埛 User hpowner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '鍖椾含', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = '00e10000000xnp2'); insert hpowner; @@ -160,13 +164,22 @@ hp.PlatformCode__c = '1375'; hp.Is_Active__c = '鏈夊姽'; insert hp; - + System.debug('鍖婚櫌淇℃伅11'+hp); - Account hptemp = [select Id,PlatformCode__c,AgentCode_Ext__c,Is_Active_Formula__c from Account where Id = :hp.Id]; + Inquiry_form__c inquiryform = new Inquiry_form__c(); + inquiryform.Name = '2019102101'; + inquiryform.Request1__c = '闇�瑕佹姤浠�'; + inquiryform.Product1__c = '瓒呭0'; + inquiryform.Opportunity_Division__c = '璇环'; + inquiryform.ContactId__c = '958432058911227904'; + insert inquiryform; + Account hptemp = [select Id,PlatformCode__c,AgentCode_Ext__c,Is_Active_Formula__c from Account where Id = :hp.Id]; + System.debug('鍖婚櫌淇℃伅hptemp'+hptemp); //鎴樼暐绉戝 Account dc = [select Id, Name,Parent_PlatformCode__c,Parent_Management_Code__c, RecordType_DeveloperName__c, Account2__c from Account where ParentId = :hp.Id and RecordType_DeveloperName__c = 'Department_Class_BF']; - + System.debug('鎴樼暐绉戝淇℃伅'+dc); + NFM624Rest.GeData GeData1 = new NFM624Rest.GeData(); NFM624Rest.GeDatas GaDatas = new NFM624Rest.GeDatas(); @@ -241,6 +254,40 @@ NFM624Rest.executefuture(rowData2.Id); } + NFM624Rest.GeData GeData6 = new NFM624Rest.GeData(); + GaDatas.GeData = new NFM624Rest.Gedata[] { GeData6 }; + GeData6.ContactId = ''; + GeData6.ServiceUserId = ''; + GeData6.PersonManagementCode = ''; + GeData6.HospitalManagementCode2 = ''; + GeData6.DepartmentManagementCode2 = ''; + GeData6.Name = ''; + GeData6.NameEncrypted = ''; + GeData6.Mobile = ''; + GeData6.MobileEncrypted = ''; + GeData6.State = ''; + GeData6.City = ''; + GeData6.AccountName = ''; + GeData6.RelatedHospital = ''; + GeData6.DepartmentClass = ''; + GeData6.DepartmentName = ''; + GeData6.RelatedDepartment = ''; + GeData6.Type = ''; + GeData6.TypeEncrypted = ''; + GeData6.ContactAddress = ''; + GeData6.ContactAddressEncrypted = ''; + GeData6.ForbiddenStatus = false; + GeData6.RegSource = ''; + GeData6.AgentFlag = true; + GeData6.ApproverID = ''; + GeData6.DataId = ''; + + + BatchIF_Log__c rowData6 = NFMUtil.saveRowData(GaDatas.Monitoring, 'NFM624', GaDatas.GeData); + if (String.isBlank(rowData6.Log__c) == false){ + NFM624Rest.executefuture(rowData6.Id); + } + //鏈夊尰闄㈡湁鏈夌瀹ゆ病鏈変汉鍛樼鐞嗙紪鐮佲�斺��>鏇存柊鑱旂郴浜� NFM624Rest.GeData GeData3 = new NFM624Rest.GeData(); GaDatas.GeData = new NFM624Rest.Gedata[] { GeData3 }; @@ -274,5 +321,127 @@ if (String.isBlank(rowData3.Log__c) == false){ NFM624Rest.executefuture(rowData3.Id); } + NFM624RestAbout.GeDatas GaDatas2 = new NFM624RestAbout.GeDatas(); + NFM624RestAbout.GeData GeData5 = new NFM624RestAbout.GeData(); + GaDatas2.GeData = new NFM624RestAbout.Gedata[] { GeData5 }; + // GeData3.ContactId = '958432058911227904'; + //GeData3.ServiceUserId = '958432058911227904'; + GeData5.PersonManagementCode = ''; + GeData5.HospitalManagementCode2 = '1375'; + GeData5.DepartmentManagementCode2 = '1376'; + //GeData3.Name = '***'; + GeData5.NameEncrypted = '24616254c7c7b65d985567f475b667d7'; + //GeData3.Mobile = '***********'; + //GeData3.MobileEncrypted = 'c34725fe79b3965ea9abfd7c1435cf9a'; + //GeData3.State = '鍖椾含甯�'; + //GeData3.City = '瑗垮煄鍖�'; + GeData5.AccountName = '鍖椾含寰疯儨闂ㄤ腑鍖婚櫌'; + GeData5.RelatedHospital = '112358'; + GeData5.DepartmentClass = '娑堝寲绉�'; + GeData5.DepartmentName = '鍖椾含寰疯儨闂ㄤ腑鍖婚櫌 娑堝寲绉� 鑳冮暅瀹�'; + GeData5.RelatedDepartment = '5311053'; + //GeData3.Type = '*****'; + //GeData3.TypeEncrypted = '53173e61ac22874aab5b8d1f802515db'; + //GeData3.ContactAddress = '**********'; + //GeData3.ContactAddressEncrypted = '121a09fd9e0e9b090c4aa9c95da52810'; + //GeData3.ForbiddenStatus = false; + //GeData3.RegSource = '1'; + //GeData3.AgentFlag = false; + //GeData3.ApproverID = hpowner.Id; + GeData5.DataId = '958432058273693696'; + + BatchIF_Log__c rowData5 = NFMUtil.saveRowData(GaDatas.Monitoring, 'NFM624About', GaDatas.GeData); + if (String.isBlank(rowData5.Log__c) == false){ + NFM624RestAbout.executefuture(rowData5.Id); + } + } + static testMethod void testMethod5(){ + oly_TriggerHandler.bypass('ContactTriggerHandler'); + //鐢ㄦ埛 + User hpowner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '鍖椾含', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = '00e10000000xnp2'); + insert hpowner; + + User hpowner2 = new User(Test_staff__c = true, LastName = 'hp1', FirstName = 'owner1', Alias = 'hp1', Work_Location__c = '鍖椾含', CommunityNickname = 'hpOwner1', Email = 'olympus_hpowner1@sunbridge.com', Username = 'olympus_hpowner1@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = '00e10000000xnp2'); + insert hpowner2; + + //鍖婚櫌 + Account hp = new Account(RecordTypeId = '01210000000QemG', Name = '鍖椾含寰疯儨闂ㄤ腑鍖婚櫌', OwnerId = hpOwner.Id); + hp.FSE_GI_Main_Leader__c = hpOwner.Id; + hp.Advance_Payment_Identification_Approval__c = Date.today().addyears(-1); + hp.AgentCode_Ext__c = '112358'; + hp.PlatformCode__c = '1375'; + hp.Is_Active__c = '鏈夊姽'; + insert hp; + System.debug('鍖婚櫌淇℃伅111'+hp); + + + Account hptemp = [select Id,PlatformCode__c,AgentCode_Ext__c,Is_Active_Formula__c from Account where Id = :hp.Id]; + + // 鎴︾暐绉戝銈掑緱銈� + Account strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hp.Id AND recordType.DeveloperName = 'Department_Class_OTH']; + System.debug('鎴樼暐绉戝111'+strategicDep); + // 瑷虹檪绉戙倰浣溿倠 + Account dep = new Account(); + dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_OTH'].id; + dep.Name = '鑳冮暅瀹�'; + dep.AgentCode_Ext__c = '5311053'; + dep.ParentId = strategicDep.Id; + dep.Department_Class__c = strategicDep.Id; + dep.Hospital__c = hp.Id; + insert dep; + System.debug('绉戝淇℃伅111'+dep); + + //鑱旂郴浜� + Contact contact2 = new Contact(); + contact2.AccountId = dep.Id; + contact2.FirstName = '璨换鑰�'; + contact2.LastName = 'test1缁忛攢鍟�'; + contact2.LastName_Encrypted__c ='24616254c7c7b65d985567f475b667d7'; + insert contact2; + System.debug('鑱旂郴浜轰俊鎭�222'+contact2); + Contact contact =[select Id,Account.Name,Account.parent.Name from Contact where id=:contact2.Id]; + System.debug('鑱旂郴浜轰俊鎭�111'+contact); + System.debug('鑱旂郴浜轰俊鎭�111'+contact.Account.parent.Name); + + NFM624Rest.GeData GeData1 = new NFM624Rest.GeData(); + NFM624Rest.GeDatas GaDatas = new NFM624Rest.GeDatas(); + + Datetime nowDT = Datetime.now(); + String nowStr = nowDT.format('yyyyMMddHHmm'); + GaDatas.Monitoring = new NFMUtil.Monitoring(); + GaDatas.Monitoring.MessageGroupNumber = nowStr + '01'; + //鏈夊尰闄㈡湁鏈夌瀹ゆ病鏈変汉鍛樼鐞嗙紪鐮佲�斺��>鏇存柊鑱旂郴浜� + NFM624Rest.GeData GeData3 = new NFM624Rest.GeData(); + GaDatas.GeData = new NFM624Rest.Gedata[] { GeData3 }; + GeData3.ContactId = '958432058911227904'; + GeData3.ServiceUserId = '958432058911227904'; + GeData3.PersonManagementCode = ''; + GeData3.HospitalManagementCode2 = '1375'; + GeData3.DepartmentManagementCode2 = '1376'; + GeData3.Name = '***'; + GeData3.NameEncrypted = '24616254c7c7b65d985567f475b667d7'; + GeData3.Mobile = '***********'; + GeData3.MobileEncrypted = 'c34725fe79b3965ea9abfd7c1435cf9a'; + GeData3.State = '鍖椾含甯�'; + GeData3.City = '瑗垮煄鍖�'; + GeData3.AccountName = '鍖椾含寰疯儨闂ㄤ腑鍖婚櫌'; + GeData3.RelatedHospital = '112358'; + GeData3.DepartmentClass = '鍏朵粬'; + GeData3.DepartmentName = '鍖椾含寰疯儨闂ㄤ腑鍖婚櫌 鍏朵粬 鑳冮暅瀹�'; + GeData3.RelatedDepartment = '5311053'; + GeData3.Type = '*****'; + GeData3.TypeEncrypted = '53173e61ac22874aab5b8d1f802515db'; + GeData3.ContactAddress = '**********'; + GeData3.ContactAddressEncrypted = '121a09fd9e0e9b090c4aa9c95da52810'; + GeData3.ForbiddenStatus = false; + GeData3.RegSource = '1'; + GeData3.AgentFlag = false; + GeData3.ApproverID = hpowner.Id; + GeData3.DataId = '958432058273693696'; + + BatchIF_Log__c rowData3 = NFMUtil.saveRowData(GaDatas.Monitoring, 'NFM624', GaDatas.GeData); + if (String.isBlank(rowData3.Log__c) == false){ + NFM624Rest.executefuture(rowData3.Id); + } } } \ No newline at end of file -- Gitblit v1.9.1