liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
@isTest
public with sharing class LexSubmitCampaignControllerTest {
    @isTest
    static void testMethod1(){
        //数据准备
        Application_for_Conference_Adjudication__c aca = new Application_for_Conference_Adjudication__c();
        aca.MeetingApprovedNo__c            = 'ME154P03-0012';
        aca.Name                            = 'ME154P03-0012'; // 用决裁编号替代名称
        aca.CampaignTheme__c                = 'obpm发起赞助决裁';
        aca.Num__c                          = 'test1';
        aca.StartDate__c                    = NFMUtil.parseDateTimeStr2Date('2022-04-19');
        aca.EndDate__c                      = NFMUtil.parseDateTimeStr2Date('2022-04-22');
        aca.Implementation_Purpose1__c                   = '其他';
        aca.OfficeCategory__c               = '1.消化科';
        aca.MeetingType__c                  = '主办会';
        aca.StateMaster__c                  = '北京市';
        aca.CityMaster__c                   = '北京市';
        aca.WorkshopPlace__c                = 'CTEC';
        aca.HostName__c                     = '医学会';
        aca.CooperatorCompany__c            = '中华医学会';
        aca.ConveningParticipantsNum__c     = 0;
        aca.IsPaidToSponsor__c              = '否';
        aca.SponsorshipCategory__c          = '资金';
        aca.ExpectedOlympusAttendance__c    = 0;
        aca.ActivityTypeName__c             = '自主主办会';
        aca.ExpectedHcpAttendance__c        = 0;
        aca.ProcessState__c                 = '草稿';
        aca.Type_of_adjudication_meeting__c = '线下';
        aca.Activities_of_a_share__c        = '否';
        aca.IsSupplemental__c = true;
 
        insert aca;
 
        Campaign cam = new Campaign();
        Id RtId = Schema.SObjectType.Campaign.getRecordTypeInfosByDeveloperName().get('Society').getRecordTypeId();
        // Id RtId2 = Schema.SObjectType.CampaignMember.getRecordTypeInfosByDeveloperName().get('WorkShop').getRecordTypeId();
        cam.RecordTypeId                     = RtId;
        // cam.CampaignMemberRecordTypeId       = RtId2;
 
        cam.Name                             = aca.MeetingApprovedNo__c;
        cam.Name2__c                         = aca.MeetingApprovedNo__c;
        cam.MeetingApprovedNo__c             = aca.MeetingApprovedNo__c;
        cam.Meeting_Approved_No__c           = aca.Id;
        cam.StartDate                        = aca.StartDate__c;
        cam.EndDate                          = aca.EndDate__c;
        cam.Implementation_Purpose__c                   = aca.Implementation_Purpose1__c;
        cam.OfficeCategory__c                = aca.OfficeCategory__c;
        cam.Meeting_Type__c                  = aca.MeetingType__c;
        cam.Activity_Type_Name__c            = aca.ActivityTypeName__c;
        
        cam.WorkshopPlace__c                 = aca.WorkshopPlace__c;
        cam.HostName__c                      = aca.HostName__c;
        cam.cooperatorCompany__c             = aca.CooperatorCompany__c;
        cam.Convening_Participants_Num__c    = aca.ConveningParticipantsNum__c;
        cam.IF_Approved__c                   = true;
 
        // OBPM对接 新增字段
        cam.Expected_Olympus_Attendance__c   = aca.ExpectedOlympusAttendance__c;
        cam.Expected_Hcp_Attendance__c       = aca.ExpectedHcpAttendance__c;
        cam.SponsorshipCategory__c           = aca.SponsorshipCategory__c;
        cam.IsPaidToSponsor__c               = aca.IsPaidToSponsor__c;
        cam.Activity_Type_Name__c            = aca.ActivityTypeName__c;
        cam.Is_LendProduct__c                = '是';
        cam.PlanBackData__c                  = NFMUtil.parseDateTimeStr2Date('2022-04-30');
        cam.LoadNum__c                       = 'CV-290*1; GI-290镜子*1;';
        insert cam;
 
        User u = new User(alias = 'manager', email='manager@acme.com',
                emailencodingkey='UTF-8', lastname='manager',
                languagelocalekey='en_US',
                localesidkey='ja_JP', profileid = System.Label.ProfileId_SystemAdmin,
                timezonesidkey='Asia/Shanghai',
                username='manager@acme.com' + Datetime.now().getTime(),
                ZongjianApprovalManager__c =  UserInfo.getUserId()
            );
        insert u;   
 
        OlympusCalendar__c oc = new OlympusCalendar__c();
        oc.Date__c = System.Today();
        oc.Before_1_WorkDay__c = oc.Date__c.addDays(-1);
        insert oc;
 
        Date t = Date.today();
        Date t1 = t.addMonths(6);
        Date t2 = t.addMonths(-6);
        Date t3 = t.addYears(1);
        
        Daily_Report__c dr1 = new Daily_Report__c(
            Reported_Date__c = t1,
            Status__c = '作成中',
            Reporter__c = Userinfo.getUserId()
        );
        Daily_Report__c dr2 = new Daily_Report__c(
            Reported_Date__c = t2,
            Status__c = '作成中',
            Reporter__c = Userinfo.getUserId()
        );
        
        insert new Daily_Report__c[] {dr1, dr2};
        
        Event__c ec1 = new Event__c(
            Daily_Report__c = dr1.Id,
            StartDateTime__c = Datetime.newInstance(t1.year(), t1.month(), t1.day(), 10, 0, 0),
            EndDateTime__c = Datetime.newInstance(t1.year(), t1.month(), t1.day(), 11, 0, 0),
            ActivityDate__c = dr1.Reported_Date__c,
            Subject__c = 'eventc1'
        );
        insert ec1;
 
        LexSubmitCampaignController.initSubmit('123');
        LexSubmitCampaignController.initSubmit(cam.Id);    
        LexSubmitCampaignController.newAndUpddateCampaign(cam.Id,'取消');    
        //LexSubmitCampaignController.submitApprovalRequest('123');    
        LexSubmitCampaignController.submitApprovalRequest(cam.Id);    
        LexSubmitCampaignController.initCancle(cam.Id);    
        LexSubmitCampaignController.initCancle('123');    
        LexSubmitCampaignController.newAndUpdateCampaignCancle(cam.Id,'取消');    
         LexSubmitCampaignController.newAndUpdateCampaignCancle('xxx123','取消');   
        LexSubmitCampaignController.initMember(cam.Id);    
        LexSubmitCampaignController.initMember('123');    
        LexSubmitCampaignController.UpdateCampagin('123','123',NFMUtil.parseDateTimeStr2Date('2022-04-22'));    
        LexSubmitCampaignController.UpdateCampagin(cam.Id,'取消',NFMUtil.parseDateTimeStr2Date('2022-04-22'));    
        LexSubmitCampaignController.initCancleService(cam.Id);    
        LexSubmitCampaignController.initCancleService('123');    
        LexSubmitCampaignController.cancleServiceNewAndUpdate(cam.Id,'取消',true);    
        LexSubmitCampaignController.cancleServiceNewAndUpdate('123','123',true);    
        LexSubmitCampaignController.queryUserIdByName(u.Name);    
        LexSubmitCampaignController.queryUserIdByName('123xxx');
        // LexSubmitCampaignController.initUpdateTimeReply('123xxx');
        LexSubmitCampaignController.initUpdateTimeReply(cam.Id);    
        // LexSubmitCampaignController.getUserNameById('12323xx');
        LexSubmitCampaignController.getUserNameById(u.Id);
        // LexSubmitCampaignController.initSendToComPlat('222');
        LexSubmitCampaignController.initSendToComPlat(cam.Id);
        LexSubmitCampaignController.SendToComPlatUpdate(cam.Id,true);
        LexSubmitCampaignController.SendToComPlatUpdate('123',true);
        LexSubmitCampaignController.initAddToCalender('123');
        LexSubmitCampaignController.initAddToCalender(cam.Id);
        LexSubmitCampaignController.initMeetingDelayApply('12323');
        LexSubmitCampaignController.initMeetingDelayApply(cam.Id);
        LexSubmitCampaignController.getCampaignEvent('123','123');
        LexSubmitCampaignController.getCampaignEvent(ec1.Id,'123');
        LexSubmitCampaignController.addCampaignEvent(NFMUtil.parseDateTimeStr2Date('2022-04-22'),NFMUtil.parseDateTimeStr2Date('2022-05-22'),ec1.Id,'会议对应');
        LexSubmitCampaignController.addCampaignEvent(NFMUtil.parseDateTimeStr2Date('2022-04-22'),NFMUtil.parseDateTimeStr2Date('2022-05-22'),'12323','会议对应');
        LexSubmitCampaignController.findQualified3(cam.Id);
        LexSubmitCampaignController.findQualified3('xxx123xx');
 
 
    }
 
    @isTest
    static void testMethod2(){
                RecordType rectCam =
                    [select Id from RecordType
                     where IsActive = true and SobjectType = 'Campaign'
                                      and DeveloperName = 'ServiceEngineerTraining'];
 
                Campaign cam = new Campaign();
                cam.Name = 'camTest';
                cam.Name2__c = '1234Test';
                cam.RecordTypeId = rectCam.Id;
                cam.StartDate = Date.today().addDays(-15);
                cam.EndDate = Date.today().addDays(18);
                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.Status = '申请中';
                insert cam;
 
                //需要一个meetings 的对象集合
                meeting_delay_apply__c m = new meeting_delay_apply__c();
                m.Meeting_Type__c = '共同主办会';
                m.HostName__c = '主办方Test';
                m.cooperatorCompany__c = '承办方Test';
                m.status__c = '草案中';
                m.campaign__c = cam.Id;
                insert m;                
        LexSubmitCampaignController.getRecordTypeId();
        LexSubmitCampaignController.getRecordIdByName('询价');
        LexSubmitCampaignController.getRecordIdByName('xx123xx');
                LexSubmitCampaignController.findQualified1(m.Id);
                LexSubmitCampaignController.findQualified1('123xx123');
 
 
    }
}