From e3c02c03dd2de442bbced87236f60a13a1cd154e Mon Sep 17 00:00:00 2001
From: 高章伟 <gaozhangwei@prec-tech.com>
Date: 星期四, 02 三月 2023 17:51:57 +0800
Subject: [PATCH] gzw 正式环境最新代码更新

---
 force-app/main/default/classes/NFM624RestTest.cls |  120 +++++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 90 insertions(+), 30 deletions(-)

diff --git a/force-app/main/default/classes/NFM624RestTest.cls b/force-app/main/default/classes/NFM624RestTest.cls
index 3643d61..3ade80c 100644
--- a/force-app/main/default/classes/NFM624RestTest.cls
+++ b/force-app/main/default/classes/NFM624RestTest.cls
@@ -29,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];
         //鎴樼暐绉戝
@@ -163,7 +164,8 @@
         hp.PlatformCode__c = '1375';
         hp.Is_Active__c = '鏈夊姽';
         insert hp;
-        
+        System.debug('鍖婚櫌淇℃伅11'+hp);
+
         Inquiry_form__c inquiryform = new Inquiry_form__c();
         inquiryform.Name = '2019102101';
         inquiryform.Request1__c = '闇�瑕佹姤浠�';
@@ -173,10 +175,11 @@
         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();
 
@@ -354,34 +357,91 @@
     }
     static testMethod void testMethod5(){
         oly_TriggerHandler.bypass('ContactTriggerHandler');
-        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;
+        //鐢ㄦ埛
+        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;
 
-        BatchIF_Log__c testLog = new BatchIF_Log__c();
-        testLog.CurrencyIsoCode = 'CNY';
-        testLog.Type__c = 'NFM624';
-        testLog.MessageGroupNumber__c = '123456789987';
-        testLog.ErrorLog__c = '';
-        testLog.MessageGroupNumber__c = '20211207';
-        testLog.RowDataFlg__c = true;
-        testLog.Log__c = '[{"TypeEncrypted":"53173e61ac22874aab5b8d1f802515db","Type":"*****","State":"鍖椾含甯�","ServiceUserId":"","RelatedHospital":"","RelatedDepartment":"","RegSource":"1","PersonManagementCode":"","NameEncrypted":"24616254c7c7b65d985567f475b667d7","Name":"***","MobileEncrypted":"c34725fe79b3965ea9abfd7c1435cf9a","Mobile":"***********","HospitalManagementCode2":"","ForbiddenStatus":false,"DepartmentName":"鍖椾含寰疯儨闂ㄤ腑鍖婚櫌 娑堝寲绉� 鑳冮暅瀹�","DepartmentManagementCode2":"","DepartmentClass":"娑堝寲绉�","DataId":"958432058273693696","ContactId":"958432058911227904","ContactAddressEncrypted":"121a09fd9e0e9b090c4aa9c95da52810","ContactAddress":"**********","City":"瑗垮煄鍖�","ApproverID":"om003669","AgentFlag":false,"AccountName":"鍖椾含寰疯儨闂ㄤ腑鍖婚櫌"}]';
-        insert testLog;
-        NFM624Rest.main(testLog.Id);
+        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);
+        
 
-        BatchIF_Log__c testLog5 = new BatchIF_Log__c();
-        testLog5.CurrencyIsoCode = 'CNY';
-        testLog5.Type__c = 'NFM624';
-        testLog5.MessageGroupNumber__c = '123456789987';
-        testLog5.ErrorLog__c = '';
-        testLog5.MessageGroupNumber__c = '20211207';
-        testLog5.RowDataFlg__c = true;
-        testLog5.Log__c = '[{"TypeEncrypted":"53173e61ac22874aab5b8d1f802515db","Type":"*****","State":"鍖椾含甯�","ServiceUserId":"958432058911227904","RelatedHospital":"3728239","RelatedDepartment":"5311053","RegSource":"1","PersonManagementCode":"","NameEncrypted":"24616254c7c7b65d985567f475b667d7","Name":"***","MobileEncrypted":"c34725fe79b3965ea9abfd7c1435cf9a","Mobile":"***********","HospitalManagementCode2":"1375","ForbiddenStatus":false,"DepartmentName":"鍖椾含寰疯儨闂ㄤ腑鍖婚櫌 娑堝寲绉� 鑳冮暅瀹�","DepartmentManagementCode2":"1376","DepartmentClass":"娑堝寲绉�","DataId":"958432058273693696","ContactId":"958432058911227904","ContactAddressEncrypted":"121a09fd9e0e9b090c4aa9c95da52810","ContactAddress":"**********","City":"瑗垮煄鍖�","ApproverID":"om003669","AgentFlag":false,"AccountName":"鍖椾含寰疯儨闂ㄤ腑鍖婚櫌"}]';
-        upsert testLog5;
-        NFM624Rest.main(testLog5.Id);
+        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