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
@isTest
private class ConsumApplyApprovalProcessControllerTest {
    @testSetup static void setupTestData(){
        ConsumTestDataFactory factory = new ConsumTestDataFactory();
        factory.setupTestData();
        factory.selectDetails(2);
        TestDataUtility.CreatePIPolicyConfiguration();
    }
    @isTest
    static void tesMethod1(){
        List<Consum_Apply__c> apply = [SELECT Id FROM Consum_Apply__c  LIMIT 1];
        ConsumApplyApprovalProcessController.initSubmitApprovalProcessController(apply[0].Id);
 
 
        // List<Campaign> campaign = [SELECT Id FROM Campaign  LIMIT 1];
        // ConsumApplyApprovalProcessController.selectCampaignById(campaign[0].Id);
 
        // List<QIS_report__c> qisreport = [SELECT Id FROM QIS_report__c  LIMIT 1];
        // ConsumApplyApprovalProcessController.selectReportById(qisreport[0].Id);
 
        List<Consum_Apply_Equipment_Set__c> selectEquipmentById = [SELECT Id FROM Consum_Apply_Equipment_Set__c  LIMIT 1];
        ConsumApplyApprovalProcessController.selectEquipmentById(selectEquipmentById[0].Id);
 
        List<Consum_Apply__c> apply1 = [SELECT Id FROM Consum_Apply__c  LIMIT 1];
        ConsumApplyApprovalProcessController.approvalCheck(apply1[0].Id);
 
        List<Consum_Apply__c> apply2 = [SELECT Id,applyUser__c,JingliApprovalManager__c,SalesManager__c,BuchangApprovalManager__c,BuchangApprovalManagerSales__c,ZongjianApprovalManager__c,OwnerId FROM Consum_Apply__c  LIMIT 1];
        List<String> userAccess = new List<String>();
        userAccess.add(apply2[0].applyUser__c+'_Edit');
        userAccess.add(apply2[0].JingliApprovalManager__c+'_Edit');
        userAccess.add(apply2[0].SalesManager__c+'_Edit');
        userAccess.add(apply2[0].BuchangApprovalManager__c+'_Edit');
        userAccess.add(apply2[0].BuchangApprovalManagerSales__c+'_Edit');
        userAccess.add(apply2[0].ZongjianApprovalManager__c+'_Edit');
        String ownerId = apply2[0].OwnerId;
        ConsumApplyApprovalProcessController.setSObjectShare('Consum_Apply__Share',apply2[0].id,userAccess,ownerId);
 
        List<Consum_Apply__c> apply3 = [SELECT Id FROM Consum_Apply__c  LIMIT 1];
        ConsumApplyApprovalProcessController.updateConsumApply(apply3[0].Id);
 
 
 
    }
    @isTest
    static void tesMethod2(){
        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;
        ConsumApplyApprovalProcessController.selectCampaignById(cam.Id);
 
        // List<QIS_report__c> qisreport = [SELECT Id FROM QIS_report__c  LIMIT 1];
        // ConsumApplyApprovalProcessController.selectReportById(qisreport[0].Id);
    }
 
    @isTest
    static void tesMethod3(){
        QIS_Report__c qr = new QIS_Report__c(
            RC__c = UserInfo.getUserId(),
            // Photo_1__c = '<img alt="用户添加的图片" src="https://ocsm--stagefull--c.documentforce.com/servlet/rtaImage?eid=a0J10000008VbEm&amp;feoid=00N10000008rsVu&amp;refid=0EM1s0000005LCs" style="height: 666px; width: 500px;"></img>',
            Damage_For_Doc_Or_Pat__c = '有',
            Relation_With_The_Problem__c = '有可能',
            Report_For_Goz__c = '不知道',
            Name = 'QIS012345',
            GeneratedPDFField__c = null,
            QIS_Submit_day__c = Date.Today()
        );
        insert qr;
        // List<Campaign> campaign = [SELECT Id FROM Campaign  LIMIT 1];
        // ConsumApplyApprovalProcessController.selectCampaignById(campaign[0].Id);
 
        ConsumApplyApprovalProcessController.selectReportById(qr.Id);
    }
 
    
}