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 ++++++++++++++++++++++++++++++++++++++--- 1 files changed, 38 insertions(+), 3 deletions(-) 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 -- Gitblit v1.9.1