【重要!学会会议】自办会关联OBPM决裁信息不更新会议开始日和结束日
| | |
| | | } |
| | | } |
| | | if (app_cam_binds.size() > 0) { |
| | | List<Campaign> cams = [select Id, MeetingApprovedNo__c, Meeting_Approved_No__c from Campaign where Meeting_Approved_No__c in :app_cam_binds.keySet() and Num__c in :app_cam_binds.values()]; |
| | | List<Campaign> cams = [select Id, MeetingApprovedNo__c, Meeting_Approved_No__c, RecordTypeId, Meeting_Type__c from Campaign where Meeting_Approved_No__c in :app_cam_binds.keySet() and Num__c in :app_cam_binds.values()]; |
| | | if (cams != null && cams.size() > 0) { |
| | | for (Campaign cam : cams) { |
| | | cam.MeetingApprovedNo__c = null; |
| | |
| | | } |
| | | } |
| | | if (approved_nos.size() > 0) { |
| | | List<Campaign> campaigns = [select Id, MeetingApprovedNo__c, Meeting_Approved_No__c from Campaign where Meeting_Approved_No__c in :approved_nos]; |
| | | List<Campaign> campaigns = [select Id, MeetingApprovedNo__c, Meeting_Approved_No__c , RecordTypeId, Meeting_Type__c from Campaign where Meeting_Approved_No__c in :approved_nos]; |
| | | if (campaigns != null && campaigns.size() > 0) { |
| | | for (Campaign cam : campaigns) { |
| | | cam.MeetingApprovedNo__c = null; |
| | |
| | | List<String> app_ids = new List<String>(); |
| | | Map<String, Application_for_Conference_Adjudication__c> app_nos = new Map<String, Application_for_Conference_Adjudication__c>(); |
| | | for (Application_for_Conference_Adjudication__c app : this.newList) { |
| | | if (app.ProcessState__c == '审批成功') { |
| | | if (app.ProcessState__c != oldMap.get(app.Id).ProcessState__c && app.ProcessState__c == '审批成功') { //20221206 lt DB202212060256 update |
| | | app.Approved_Date__c = Date.today(); |
| | | app_ids.add(app.Id); |
| | | // 补充决裁 |
| | |
| | | } |
| | | Map<String, Campaign> wait_upd_campaigns = new Map<String, Campaign>(); |
| | | if (app_ids.size() > 0) { |
| | | List<Campaign> campaigns = [select Id, Num__c, MeetingApprovedNo__c, Meeting_Approved_No__c from Campaign where Meeting_Approved_No__c in :app_ids and Meeting_Type__c != '赞助会']; |
| | | List<Campaign> campaigns = [select Id, Num__c, MeetingApprovedNo__c, Meeting_Approved_No__c, WorkshopPlace__c, State_Master__c, City_Master__c, RecordTypeId, Meeting_Type__c from Campaign where Meeting_Approved_No__c in :app_ids and Meeting_Type__c != '赞助会']; |
| | | if (campaigns.size() > 0) { |
| | | for (Campaign cam : campaigns) { |
| | | Application_for_Conference_Adjudication__c app = this.newMap.get(cam.Meeting_Approved_No__c); |
| | |
| | | } |
| | | } |
| | | if (app_nos.size() > 0) { |
| | | List<Campaign> campaigns = [select Id, Num__c, MeetingApprovedNo__c, Meeting_Approved_No__c from Campaign where MeetingApprovedNo__c in :app_nos.keySet()]; |
| | | List<Campaign> campaigns = [select Id, Num__c, MeetingApprovedNo__c, Meeting_Approved_No__c, WorkshopPlace__c, State_Master__c, City_Master__c, RecordTypeId, Meeting_Type__c from Campaign where MeetingApprovedNo__c in :app_nos.keySet()]; |
| | | if (campaigns.size() > 0) { |
| | | for (Campaign cam : campaigns) { |
| | | Application_for_Conference_Adjudication__c app = app_nos.get(cam.MeetingApprovedNo__c); |
| | |
| | | |
| | | // 更新决裁的信息到学会上 |
| | | private Campaign update_info_from_app(Campaign cam, Application_for_Conference_Adjudication__c app) { |
| | | cam.StartDate = app.StartDate__c; |
| | | cam.EndDate = app.EndDate__c; |
| | | cam.Implementation_Purpose__c = app.BudgetType__c; |
| | | //20221206 lt DB202212060256 start |
| | | Id RtId = Schema.SObjectType.Campaign.getRecordTypeInfosByDeveloperName().get('Society').getRecordTypeId(); |
| | | Id RtId2 = Schema.SObjectType.Campaign.getRecordTypeInfosByDeveloperName().get('BusinessTraining').getRecordTypeId(); |
| | | System.debug('lt123-------Cam------记录类型----'+cam.RecordTypeId); |
| | | System.debug('lt123-------Cam------会议类型----'+cam.Meeting_Type__c); |
| | | System.debug('lt123-------Cam------记录类型RtId----'+RtId); |
| | | if(cam.RecordTypeId == RtId || cam.RecordTypeId == RtId2){ |
| | | System.debug('lt123-------App------1----'); |
| | | if (cam.Meeting_Type__c != '主办会'){ |
| | | System.debug('lt123-------App------2----'); |
| | | cam.StartDate = app.StartDate__c; |
| | | cam.EndDate = app.EndDate__c; |
| | | } |
| | | } |
| | | if(cam.RecordTypeId != RtId && cam.RecordTypeId != RtId2){ |
| | | System.debug('lt123-------App------3----'); |
| | | cam.StartDate = app.StartDate__c; |
| | | cam.EndDate = app.EndDate__c; |
| | | } |
| | | // cam.StartDate = app.StartDate__c; |
| | | // cam.EndDate = app.EndDate__c; |
| | | //20221206 lt DB202212060256 end |
| | | cam.Implementation_Purpose__c = app.Implementation_Purpose1__c; |
| | | cam.OfficeCategory__c = app.OfficeCategory__c; |
| | | cam.Meeting_Type__c = app.MeetingType__c; |
| | | |
| | | cam.WorkshopPlace__c = app.WorkshopPlace__c; |
| | | cam.WorkshopPlace__c = String.isNotBlank(app.WorkshopPlace__c) ? app.WorkshopPlace__c : cam.WorkshopPlace__c; |
| | | cam.HostName__c = app.HostName__c; |
| | | cam.cooperatorCompany__c = app.CooperatorCompany__c; |
| | | cam.Convening_Participants_Num__c = app.ConveningParticipantsNum__c; |
| | |
| | | // cam.Activity_Type_Name__c = app.ActivityTypeName__c; |
| | | cam.Activity_Type_Name__c = app.Type_of_adjudication_meeting__c; |
| | | // 这里需要额外加操作 |
| | | cam.State_Master__c = StateCityUtil.get_state(app.StateMaster__c); |
| | | cam.City_Master__c = StateCityUtil.get_city(app.CityMaster__c); |
| | | cam.State_Master__c = String.isNotBlank(app.StateMaster__c) ? StateCityUtil.get_state(app.StateMaster__c) : cam.State_Master__c; |
| | | cam.City_Master__c = String.isNotBlank(app.CityMaster__c) ? StateCityUtil.get_city(app.CityMaster__c) : cam.City_Master__c; |
| | | |
| | | return cam; |
| | | } |
| | |
| | | ProcessState__c, |
| | | StartDate__c, |
| | | EndDate__c, |
| | | BudgetType__c, |
| | | Implementation_Purpose1__c, |
| | | OfficeCategory__c, |
| | | MeetingType__c, |
| | | ActivityTypeName__c, |
| | |
| | | cam.MeetingApprovedNo__c = app.MeetingApprovedNo__c; |
| | | // 非赞助会的情况下更新以下内容 |
| | | if (app.MeetingType__c != '赞助会') { |
| | | cam.StartDate = app.StartDate__c; |
| | | cam.EndDate = app.EndDate__c; |
| | | cam.Implementation_Purpose__c = app.BudgetType__c; |
| | | //20221206 lt DB202212060256 start |
| | | // System.debug('lt123-------Cam------记录类型----'+cam.RecordTypeId); |
| | | // System.debug('lt123-------Cam------会议类型----'+cam.Meeting_Type__c); |
| | | if(cam.RecordTypeId == '01210000000QfeD' || cam.RecordTypeId == '01210000000gQzO'){ |
| | | // System.debug('lt123-------Cam------1----'); |
| | | if (cam.Meeting_Type__c != '主办会'){ |
| | | // System.debug('lt123-------Cam------2----'); |
| | | cam.StartDate = app.StartDate__c; |
| | | cam.EndDate = app.EndDate__c; |
| | | } |
| | | } |
| | | if(cam.RecordTypeId != '01210000000QfeD' && cam.RecordTypeId != '01210000000gQzO'){ |
| | | // System.debug('lt123-------Cam------3----'); |
| | | cam.StartDate = app.StartDate__c; |
| | | cam.EndDate = app.EndDate__c; |
| | | } |
| | | // cam.StartDate = app.StartDate__c; |
| | | // cam.EndDate = app.EndDate__c; |
| | | //20221206 lt DB202212060256 end |
| | | cam.Implementation_Purpose__c = app.Implementation_Purpose1__c; |
| | | cam.OfficeCategory__c = app.OfficeCategory__c; |
| | | cam.Meeting_Type__c = app.MeetingType__c; |
| | | |
| | | cam.WorkshopPlace__c = app.WorkshopPlace__c; |
| | | cam.WorkshopPlace__c = String.isNotBlank(app.WorkshopPlace__c) ? app.WorkshopPlace__c : cam.WorkshopPlace__c; |
| | | cam.HostName__c = app.HostName__c; |
| | | cam.cooperatorCompany__c = app.CooperatorCompany__c; |
| | | cam.Convening_Participants_Num__c = app.ConveningParticipantsNum__c; |
| | |
| | | // cam.Activity_Type_Name__c = app.ActivityTypeName__c; |
| | | cam.Activity_Type_Name__c = app.Type_of_adjudication_meeting__c; |
| | | // 这里需要额外加操作 |
| | | cam.State_Master__c = StateCityUtil.get_state(app.StateMaster__c); |
| | | cam.City_Master__c = StateCityUtil.get_city(app.CityMaster__c); |
| | | cam.State_Master__c = String.isNotBlank(app.StateMaster__c) ? StateCityUtil.get_state(app.StateMaster__c) : cam.State_Master__c; |
| | | cam.City_Master__c = String.isNotBlank(app.CityMaster__c) ? StateCityUtil.get_city(app.CityMaster__c) : cam.City_Master__c; |
| | | |
| | | if (cam.Num__c != app.Num__c) { |
| | | app.Num__c = cam.Num__c; |
| | |
| | | static testMethod void testMethod2(){ |
| | | StaticParameter.EscapeCampain =false; |
| | | StaticParameter.shareToOSCMFlag = false; |
| | | |
| | | Application_for_Conference_Adjudication__c afc = new Application_for_Conference_Adjudication__c(); |
| | | afc.Name = 'test01'; |
| | | afc.StartDate__c = Date.today().addDays(1); |
| | | afc.EndDate__c = Date.today().addDays(21); |
| | | insert afc; |
| | | |
| | | Application_for_Conference_Adjudication__c afca = new Application_for_Conference_Adjudication__c(); |
| | | afca.Name = 'test02'; |
| | | afca.StartDate__c = Date.today(); |
| | | afca.EndDate__c = Date.today().addDays(20); |
| | | // afca.Implementation_Purpose1__c = '新产品上市'; |
| | | // afca.OfficeCategory__c = '1.消化科'; |
| | | // afca.MeetingType__c = '共同主办会'; |
| | | // afca.WorkshopPlace__c = 'Beijing'; |
| | | // afca.HostName__c = 'Olympus'; |
| | | // afca.CooperatorCompany__c = 'Olympus'; |
| | | // afca.ConveningParticipantsNum__c = 200; |
| | | // afca.ExpectedOlympusAttendance__c = 200; |
| | | // afca.ExpectedHcpAttendance__c = 200; |
| | | // afca.SponsorshipCategory__c = '无'; |
| | | // afca.IsPaidToSponsor__c = '是'; |
| | | // afca.ActivityTypeName__c = '线上'; |
| | | insert afca; |
| | | |
| | | // Implement test code |
| | | Campaign cam = new Campaign(); |
| | | cam.Name = 'test campaign'; |
| | |
| | | cam.Mailflg_after3__c = true; |
| | | cam.HostName__c = '1'; |
| | | cam.cooperatorCompany__c = '1'; |
| | | cam.Meeting_Approved_No__c = afc.Id; |
| | | cam.RecordTypeId = System.label.RecordType_CampaignService; |
| | | insert cam; |
| | | StaticParameter.EscapeCampain =false; |
| | | cam.Status = '时间修改申请中'; |
| | | cam.is_true_or_false__c = true; |
| | | cam.is_pass_or_fail__c = 1; |
| | | cam.Meeting_Approved_No__c = afca.Id; |
| | | update cam; |
| | | } |
| | | static testMethod void testMethod3(){ |
| | |
| | | aca.Num__c = ged.Num; |
| | | aca.StartDate__c = NFMUtil.parseDateTimeStr2Date(ged.StartDate); |
| | | aca.EndDate__c = NFMUtil.parseDateTimeStr2Date(ged.EndDate); |
| | | aca.BudgetType__c = ged.BudgetType; |
| | | aca.Implementation_Purpose1__c = ged.BudgetType; |
| | | aca.OfficeCategory__c = GetOfficeCategory(ged.OfficeCategory, transferMap, iflog); |
| | | //aca.MeetingType__c = ged.MeetingType; |
| | | aca.MeetingType__c = DividingTypes(ged.IsCoOrganizingActivities,ged.ActivityTypeName); |
| | |
| | | } |
| | | List<Campaign> campaignList = NumList.size() > 0 ? [select Id, |
| | | Num__c, |
| | | MeetingApprovedNo__c |
| | | MeetingApprovedNo__c, |
| | | State_Master__c, |
| | | City_Master__c, |
| | | WorkshopPlace__c, |
| | | RecordTypeId, |
| | | Meeting_Type__c |
| | | from Campaign |
| | | where Num__c IN: NumList |
| | | ] : new List<Campaign>(); |
| | |
| | | // } |
| | | // 更新已存在的决裁信息 |
| | | System.debug('查找到的会议: ' + campaignList.size()); |
| | | System.debug('lt123查找到的会议:--- ' + campaignList); |
| | | if (campaignList != null && campaignList.size() > 0) { |
| | | List<Campaign> updatelist = new List<Campaign>(); |
| | | for (Campaign cam : campaignList) { |
| | |
| | | cam.MeetingApprovedNo__c = app.MeetingApprovedNo__c; |
| | | cam.Meeting_Approved_No__c = app.Id; |
| | | if (app.MeetingType__c != '赞助会') { |
| | | cam.StartDate = app.StartDate__c; |
| | | cam.EndDate = app.EndDate__c; |
| | | cam.Implementation_Purpose__c = app.BudgetType__c; |
| | | //20221206 lt DB202212060256 start |
| | | Id RtId = Schema.SObjectType.Campaign.getRecordTypeInfosByDeveloperName().get('Society').getRecordTypeId(); |
| | | Id RtId2 = Schema.SObjectType.Campaign.getRecordTypeInfosByDeveloperName().get('BusinessTraining').getRecordTypeId(); |
| | | |
| | | if(cam.RecordTypeId == RtId || cam.RecordTypeId == RtId2){ |
| | | if (cam.Meeting_Type__c != '主办会'){ |
| | | cam.StartDate = app.StartDate__c; |
| | | cam.EndDate = app.EndDate__c; |
| | | } |
| | | } |
| | | if(cam.RecordTypeId != RtId && cam.RecordTypeId != RtId2){ |
| | | cam.StartDate = app.StartDate__c; |
| | | cam.EndDate = app.EndDate__c; |
| | | } |
| | | // cam.StartDate = app.StartDate__c; |
| | | // cam.EndDate = app.EndDate__c; |
| | | //20221206 lt DB202212060256 end |
| | | cam.Implementation_Purpose__c = app.Implementation_Purpose1__c; |
| | | cam.OfficeCategory__c = app.OfficeCategory__c; |
| | | cam.Meeting_Type__c = app.MeetingType__c; |
| | | |
| | | cam.WorkshopPlace__c = app.WorkshopPlace__c; |
| | | cam.WorkshopPlace__c = String.isNotBlank(app.WorkshopPlace__c) ? app.WorkshopPlace__c : cam.WorkshopPlace__c; |
| | | cam.HostName__c = app.HostName__c; |
| | | cam.cooperatorCompany__c = app.CooperatorCompany__c; |
| | | cam.Convening_Participants_Num__c = app.ConveningParticipantsNum__c; |
| | |
| | | // cam.Activity_Type_Name__c = app.ActivityTypeName__c; |
| | | cam.Activity_Type_Name__c = app.Type_of_adjudication_meeting__c; |
| | | // 这里需要额外加操作 |
| | | cam.State_Master__c = StateCityUtil.get_state(app.StateMaster__c); |
| | | cam.City_Master__c = StateCityUtil.get_city(app.CityMaster__c); |
| | | cam.State_Master__c = String.isNotBlank(app.StateMaster__c) ? StateCityUtil.get_state(app.StateMaster__c) : cam.State_Master__c; |
| | | cam.City_Master__c = String.isNotBlank(app.CityMaster__c) ? StateCityUtil.get_city(app.CityMaster__c) : cam.City_Master__c; |
| | | } |
| | | |
| | | |
| | |
| | | // cam.Meeting_Approved_No__c = app.Id; |
| | | // cam.StartDate = app.StartDate__c; |
| | | // cam.EndDate = app.EndDate__c; |
| | | // cam.Implementation_Purpose__c = app.BudgetType__c; |
| | | // cam.Implementation_Purpose__c = app.Implementation_Purpose1__c; |
| | | // cam.OfficeCategory__c = app.OfficeCategory__c; |
| | | // cam.Meeting_Type__c = app.MeetingType__c; |
| | | // cam.Activity_Type_Name__c = app.ActivityTypeName__c; |
| | |
| | | cam.Num__c = 'MT-XN-202203-5854'; |
| | | insert cam; |
| | | system.debug('cam.Num__c'+cam.Num__c); |
| | | |
| | | //20221208 lt DB202212060256 start |
| | | Campaign cam1 = new Campaign(); |
| | | cam1.Name = 'test campaign'; |
| | | cam1.StartDate = Date.today().addDays(18); |
| | | cam1.EndDate = Date.today().addDays(20); |
| | | cam1.Name2__c = '1234'; |
| | | cam1.Status = '申请中'; |
| | | cam1.Meeting_Type__c = '共同主办会'; |
| | | cam1.Mailflg_after45__c = true; |
| | | cam1.Mailflg_cancel__c = true; |
| | | cam1.Mailflg_before15__c = true; |
| | | cam1.Mailflg_before7__c = true; |
| | | cam1.Mailflg_after3__c = true; |
| | | cam1.HostName__c = '1'; |
| | | cam1.cooperatorCompany__c = '1'; |
| | | cam1.RecordTypeId = rectCo[0].Id; |
| | | cam1.OwnerId = user.Id; |
| | | cam1.Num__c = 'MT-GI-202203-5850'; |
| | | insert cam1; |
| | | system.debug('lt123cam.Num__c---'+cam.Num__c); |
| | | |
| | | cam1.StartDate = Date.today().addDays(28); |
| | | cam1.EndDate = Date.today().addDays(30); |
| | | update cam1; |
| | | //20221208 lt DB202212060256 end |
| | | } |
| | | |
| | | 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":"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":"自主主办活动"}]}'; |
| | | String JsonMsg = '{"Monitoring":{"TransmissionDateTime":"202107131529","Text":null,"Tag":null,"Sender":"OBPM","Receiver":"SFDC","NumberOfRecord":"2","MessageType":"NFM705","MessageGroupNumber":null},"GeData":[{"WorkshopPlace":"云南","StateMaster":"云南省","StartDate":"2022-12-28T00:00:00","SponsorshipCategory":"","SharedEditing":"on000695,on000630,om002080","ProcessState":120,"OfficeCategory":"GI(MEBG),ET(MEBG),","Num":"MT-GI-202203-5850","Name":"测试会议-001 (2022/03/28 - 2022/03/31)关联OBPM ","MeetingType":"线下","MeetingApprovedNo":"ME154P03-0009","IsPaidToSponsor":"否","IsCoOrganizingActivities":"N","HostName":"奥林巴斯","ExpectedOlympusAttendance":2,"ExpectedHcpAttendance":100,"EndDate":"2023-01-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); |