DESKTOP-0K9VGFE\hp
2022-03-11 0913862c088ba845fee09a2fb713b2affc2c0b5a
Merge branch 'OBPM_705_706'
1个文件已添加
3个文件已修改
158 ■■■■ 已修改文件
force-app/main/default/classes/NFM705Rest.cls 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM705RestTest.cls 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM706RestTest.cls 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/StateCityUtilTest.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM705Rest.cls
@@ -131,18 +131,12 @@
                //     continue;
                // }
                meetingApprovedNoList.add(ged.MeetingApprovedNo);
                if (String.isNotBlank(ged.Num)) {
                    NumList.add(ged.Num);
                }
                // if (String.isNotBlank(ged.Num)) {
                //     NumList.add(ged.Num);
                // }
            }
            
            //Map<String,String> campaignMap = new Map<String,String>();
            List<Campaign> campaignList = NumList.size() > 0 ? [select Id,
                                            Num__c,
                                            MeetingApprovedNo__c
                                        from Campaign
                                        where Num__c IN: NumList
                                        ] : new List<Campaign>();
            // for(Campaign temp : campaignList){
            //     campaignMap.put(temp.Num__c,temp.Id);
            // }
@@ -176,8 +170,8 @@
                aca.StateMaster__c                  = ged.StateMaster;
                aca.CityMaster__c                   = ged.CityMaster;
                aca.WorkshopPlace__c                = ged.WorkshopPlace;
                aca.HostName__c                     = ged.HostName;
                aca.CooperatorCompany__c            = ged.CooperatorCompany;
                aca.HostName__c                     = String.isBlank(ged.HostName) ? '无' : ged.HostName;
                aca.CooperatorCompany__c            = String.isBlank(ged.CooperatorCompany) ? '无' : ged.CooperatorCompany;
                aca.ConveningParticipantsNum__c     = ged.ConveningParticipantsNum;
                aca.IsPaidToSponsor__c              = NFMUtil.getMapValue(transferMap, 'IsPaidToSponsor__c', string.valueof(ged.IsPaidToSponsor), iflog);
                aca.SponsorshipCategory__c          = ged.SponsorshipCategory;
@@ -194,7 +188,8 @@
                    aca.Id = oldacfcMap.get(ged.MeetingApprovedNo).Id;
                    aca.Num__c = String.isBlank(aca.Num__c) ? oldacfcMap.get(ged.MeetingApprovedNo).Num__c : aca.Num__c; 
                } 
                NumList.add(aca.Num__c);
                system.debug('NumList------------->'+NumList);
                // 确认申请人
                System.debug('aca.Id: ' + aca.Id);
                if (String.isBlank(aca.Id)) {
@@ -211,7 +206,12 @@
                acaList.add(aca);
            }
            List<Campaign> campaignList = NumList.size() > 0 ? [select Id,
                                            Num__c,
                                            MeetingApprovedNo__c
                                        from Campaign
                                        where Num__c IN: NumList
                                        ] : new List<Campaign>();
            // 查找所有人
            if (user_nos != null && user_nos.size() > 0) {
                users = [select Id, Employee_No__c from User where Employee_No__c in :user_nos];
@@ -234,7 +234,6 @@
            if (acaList.size() > 0) {
                // 写入决裁信息
                upsert acaList;
                // 共享权限
                SetSharing(users, acaList);
                // 自动创建学会
force-app/main/default/classes/NFM705RestTest.cls
@@ -1,6 +1,19 @@
@isTest
public class NFM705RestTest {
    static testMethod void testMothodOne(){
        BatchIF_Transfer__c temp1 = new BatchIF_Transfer__c();
        BatchIF_Transfer__c temp2 = new BatchIF_Transfer__c();
        temp1.Table__c = 'Application_for_Conference_Adjudication__c';
        temp1.Column__c = 'ProcessState__c';
        temp1.External_Value__c = '110';
        temp1.Internal_Value__c = '草稿';
        insert temp1;
        temp2.Table__c = 'Application_for_Conference_Adjudication__c';
        temp2.Column__c = 'ProcessState__c';
        temp2.External_Value__c = '120';
        temp2.Internal_Value__c = '审批中';
        insert temp2;
        BatchIF_Log__c testLog = new BatchIF_Log__c();
        testLog.CurrencyIsoCode = 'CNY';
        testLog.Type__c = 'NFM705';
@@ -9,20 +22,77 @@
        testLog.ErrorLog__c = '';
        testLog.MessageGroupNumber__c = '20211207';
        testLog.RowDataFlg__c = true;
        testLog.Log__c = '[{"WorkshopPlace":"朝阳","StateMaster":"北京市","StartDate":"2022-03-25T00:00:00","SponsorshipCategory":"","SharedEditing":"om002080,om003696,om001646","ProcessState":110,"OfficeCategory":"GI(MEBG),ET(MEBG),","Num":"","Name":"自主主办活动-SFDC测试0310","MeetingType":"线上+线下","MeetingApprovedNo":"ME154P03-0004","IsPaidToSponsor":"N","IsCoOrganizingActivities":"Y","HostName":"","ExpectedOlympusAttendance":10,"ExpectedHcpAttendance":2,"EndDate":"2022-03-30T00:00:00","CooperatorCompany":"","ConveningParticipantsNum":12,"CityMaster":"北京市","BudgetType":"其他","Applicant":"om002021","ActivityTypeName":"自主主办活动"}]';
        testLog.Log__c = '[{"WorkshopPlace":"河北","StateMaster":"河北省","StartDate":"2022-03-25T00:00:00","SponsorshipCategory":"","SharedEditing":"","ProcessState":110,"OfficeCategory":"","Num":"MT-GI-202203-5850","Name":"TEST说明会 (2022/01/13 - 2022/03/24) v1","MeetingType":"线上+线下","MeetingApprovedNo":"ME154P03-0007","IsPaidToSponsor":"否","IsCoOrganizingActivities":"Y","HostName":"1","ExpectedOlympusAttendance":10,"ExpectedHcpAttendance":111,"EndDate":"2022-03-30T00:00:00","CooperatorCompany":"2","ConveningParticipantsNum":121,"CityMaster":"石家庄市","BudgetType":"其他","Applicant":"om001646","ActivityTypeName":"自主主办活动"}]';
        //[Select Id, Name, Log__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c, Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c, retry_cnt__c,NFM624_Secondary_processing__c  from BatchIF_Log__c where RowDataFlg__c = true and Id =: rowData_Id]
        insert testLog;
        NFM705Rest.main(testLog.Id);
        testLog.Log__c = '[{"WorkshopPlace":"河北","StateMaster":"河北省","StartDate":"2022-03-25T00:00:00","SponsorshipCategory":"","SharedEditing":"","ProcessState":120,"OfficeCategory":"","Num":"MT-GI-202203-5850","Name":"TEST说明会 (2022/01/13 - 2022/03/24) v1","MeetingType":"线上+线下","MeetingApprovedNo":"ME154P03-0007","IsPaidToSponsor":"否","IsCoOrganizingActivities":"Y","HostName":"1","ExpectedOlympusAttendance":10,"ExpectedHcpAttendance":111,"EndDate":"2022-03-30T00:00:00","CooperatorCompany":"2","ConveningParticipantsNum":121,"CityMaster":"石家庄市","BudgetType":"其他","Applicant":"om001646","ActivityTypeName":"自主主办活动"}]';
        update testLog;
        NFM705Rest.main(testLog.Id);
        //controller.ReservedProductVerification();
        // string[] azzz = new String[]{'1','2'};
        // system.debug(azzz[3]);
    }
    static testMethod void testMethodTwo() {
        BatchIF_Transfer__c temp1 = new BatchIF_Transfer__c();
        BatchIF_Transfer__c temp2 = new BatchIF_Transfer__c();
        temp1.Table__c = 'Application_for_Conference_Adjudication__c';
        temp1.Column__c = 'ProcessState__c';
        temp1.External_Value__c = '110';
        temp1.Internal_Value__c = '草稿';
        insert temp1;
        temp2.Table__c = 'Application_for_Conference_Adjudication__c';
        temp2.Column__c = 'ProcessState__c';
        temp2.External_Value__c = '120';
        temp2.Internal_Value__c = '审批中';
        insert temp2;
        List<RecordType> rectCo = [select Id, Name, DeveloperName from RecordType where IsActive = true and SobjectType = 'Campaign' and DeveloperName = 'Society'];
        System.runAs(new User(Id = Userinfo.getUserId())) {
            User user = new User(Test_staff__c = true);
            user.LastName = '_サンブリッジ';
            user.FirstName = 'う';
            user.Alias = 'う';
            user.Email = 'olympusTest03@sunbridge.com';
            user.Username = 'olympusTest03@sunbridge.com';
            user.IsActive = true;
            user.EmailEncodingKey = 'ISO-2022-JP';
            user.TimeZoneSidKey = 'Asia/Tokyo';
            user.LocaleSidKey = 'ja_JP';
            user.LanguageLocaleKey = 'ja';
            user.ProfileId = System.Label.ProfileId_SystemAdmin;
            user.Province__c = '北京';
            user.Dept__c = '医疗华北营业本部';
            user.Use_Start_Date__c = Date.today().addMonths(-6);
            insert user;
            Campaign cam = new Campaign();
            cam.Name = 'test campaign';
            cam.StartDate = Date.today().addDays(15);
            cam.EndDate = Date.today().addDays(18);
            cam.Name2__c = '1234';
            cam.Status = '申请中';
            cam.Mailflg_after45__c = true;
            cam.Mailflg_cancel__c = true;
            cam.Mailflg_before15__c = true;
            cam.Mailflg_before7__c = true;
            cam.Mailflg_after3__c = true;
            cam.HostName__c = '1';
            cam.cooperatorCompany__c = '1';
            cam.RecordTypeId = rectCo[0].Id;
            cam.OwnerId = user.Id;
            cam.Num__c = 'MT-XN-202203-5854';
            insert cam;
            system.debug('cam.Num__c'+cam.Num__c);
        }
        Test.startTest();
        
        RestRequest req = new RestRequest();
        RestResponse res = new RestResponse();
        String JsonMsg = '{"Monitoring":{"TransmissionDateTime":"202107131529","Text":null,"Tag":null,"Sender":"OBPM","Receiver":"SFDC","NumberOfRecord":"2","MessageType":"NFM705","MessageGroupNumber":null},"GeData":[{"WorkshopPlace":"未来城","StateMaster":"贵州","StartDate":"20211215","SponsorshipCategory":"Y","ProcessState":110,"OfficeCategory":"1.消化科","Num":"MT-HB-202112-5773","Name":"Test会议","MeetingType":"主办会","MeetingApprovedNo":"TEST99793","IsPaidToSponsor":"白给","HostName":"黔西南州中医院","EndDate":"20211216","CooperatorCompany":"未来城","ConveningParticipantsNum":50,"CityMaster":"安顺","BudgetType":"新产品上市","ActivityTypeName":"嗯?乖乖站好?","ExpectedOlympusAttendance":50,"ExpectedHcpAttendance":100}]}';
        String JsonMsg = '{"Monitoring":{"TransmissionDateTime":"202107131529","Text":null,"Tag":null,"Sender":"OBPM","Receiver":"SFDC","NumberOfRecord":"2","MessageType":"NFM705","MessageGroupNumber":null},"GeData":[{"WorkshopPlace":"云南","StateMaster":"云南省","StartDate":"2022-03-28T00:00:00","SponsorshipCategory":"","SharedEditing":"on000695,on000630,om002080","ProcessState":120,"OfficeCategory":"GI(MEBG),ET(MEBG),","Num":"MT-XN-202203-5854","Name":"测试会议-001 (2022/03/28 - 2022/03/31)关联OBPM ","MeetingType":"线下","MeetingApprovedNo":"ME154P03-0009","IsPaidToSponsor":"否","IsCoOrganizingActivities":"N","HostName":"奥林巴斯","ExpectedOlympusAttendance":2,"ExpectedHcpAttendance":100,"EndDate":"2022-04-09T00:00:00","CooperatorCompany":"无","ConveningParticipantsNum":102,"CityMaster":"昆明市","BudgetType":"产品推广","Applicant":"om001646","ActivityTypeName":"自主主办活动"}]}';
        req.requestURI = 'services/apexrest/NFM705/execute';
        req.httpMethod = 'POST';
        req.requestBody = Blob.valueof(JsonMsg);
@@ -32,6 +102,5 @@
        NFM705Rest.doPost();
        Test.stopTest();
    }
}
force-app/main/default/classes/NFM706RestTest.cls
@@ -23,6 +23,55 @@
    }
    @isTest static void test_method_two(){
        List<RecordType> rectCo = [select Id, Name, DeveloperName from RecordType where IsActive = true and SobjectType = 'Campaign' and DeveloperName = 'Society'];
        System.runAs(new User(Id = Userinfo.getUserId())) {
            User user = new User(Test_staff__c = true);
            user.LastName = '_サンブリッジ';
            user.FirstName = 'う';
            user.Alias = 'う';
            user.Email = 'olympusTest03@sunbridge.com';
            user.Username = 'olympusTest03@sunbridge.com';
            user.IsActive = true;
            user.EmailEncodingKey = 'ISO-2022-JP';
            user.TimeZoneSidKey = 'Asia/Tokyo';
            user.LocaleSidKey = 'ja_JP';
            user.LanguageLocaleKey = 'ja';
            user.ProfileId = System.Label.ProfileId_SystemAdmin;
            user.Province__c = '北京';
            user.Dept__c = '医疗华北营业本部';
            user.Use_Start_Date__c = Date.today().addMonths(-6);
            insert user;
            Application_for_Conference_Adjudication__c afca = new Application_for_Conference_Adjudication__c();
            afca.Name = 'hahaha';
            afca.MeetingApprovedNo__c = 'TEST99793';
            afca.Num__c = 'MT-HB-202112-5773';
            afca.ProcessState__c =  '审批中';
            insert afca;
            Campaign cam = new Campaign();
            cam.Name = 'test campaign';
            cam.StartDate = Date.today().addDays(15);
            cam.EndDate = Date.today().addDays(18);
            cam.Name2__c = '1234';
            cam.Status = '申请中';
            cam.Mailflg_after45__c = true;
            cam.Mailflg_cancel__c = true;
            cam.Mailflg_before15__c = true;
            cam.Mailflg_before7__c = true;
            cam.Mailflg_after3__c = true;
            cam.HostName__c = '1';
            cam.cooperatorCompany__c = '1';
            cam.RecordTypeId = rectCo[0].Id;
            cam.OwnerId = user.Id;
            cam.Meeting_Approved_No__c = afca.id;
            insert cam;
            system.debug('cam.Num__c'+cam.Num__c);
        }
        RestRequest req = new RestRequest();
        RestResponse res = new RestResponse();
@@ -36,5 +85,7 @@
        RestContext.response = res;
        
        NFM706Rest.doPost();
    }
}
force-app/main/default/classes/StateCityUtilTest.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>52.0</apiVersion>
    <status>Active</status>
</ApexClass>