李金换
2022-11-30 0e43bab9d421948c61ca0f79b763942ba9e724a6
force-app/main/default/classes/TenderInformationHandlerTest.cls
@@ -6,6 +6,8 @@
        StaticParameter.EscapeOtherUpdateTenOwner = false;
        Profile p = [select id from Profile where id = :System.Label.ProfileId_SystemAdmin];
        String loginId = UserInfo.getUserId();
        User thisUser= [select Id from User where Id=:UserInfo.getUserId()];
System.runAs (thisUser){
        User sys = [select id from User where Id = :loginId];
        StaticParameter.EscapeNFM001AgencyContractTrigger = true;
        User u1 = new User(Test_staff__c = true);
@@ -24,6 +26,7 @@
        u1.ProfileId = p.id;
        u1.Job_Category__c = '销售服务';
        u1.Province__c = '東京';
        u1.Employee_No__c = '0001';//20220426 ljh add
        insert u1;
        StaticParameter.EscapeNFM001AgencyContractTrigger = true;
        User u2 = new User(Test_staff__c = true);
@@ -43,6 +46,7 @@
        u2.Job_Category__c = '销售推广';
        u2.Province__c = '東京';
        u2.IsActive = true;
        u2.Employee_No__c = '0002';//20220426 ljh add
        insert u2;
        StaticParameter.EscapeNFM001AgencyContractTrigger = true;
        User u3 = new User(Test_staff__c = true);
@@ -62,6 +66,7 @@
        u3.Job_Category__c = '销售推广';
        u3.Province__c = '東京';
        u3.IsActive = true;
        u3.Employee_No__c = '0003';//20220426 ljh add
        insert u3;
        StaticParameter.EscapeNFM001AgencyContractTrigger = true;
        User u4 = new User(Test_staff__c = true);
@@ -81,35 +86,37 @@
        u4.Job_Category__c = '销售推广';
        u4.Province__c = '東京';
        u4.IsActive = true;
        u4.Employee_No__c = '0004';//20220426 ljh add
        insert u4;
        StaticParameter.EscapeNFM001AgencyContractTrigger = true;
        User u5 = new User(Test_staff__c = true);
        u5.LastName = 'test00001';
        u5.FirstName = 'qbcuy';
        u5.Batch_User__c = true;
        u5.Alias = '12cs';
        u5.Email = 'olympusT221cd04@sunbridge.com';
        u5.Username = 'olymp11est3221@sunbridge.com';
        u5.CommunityNickname = 'fewfa';
        u5.IsActive = true;
        u5.EmailEncodingKey = 'ISO-2022-JP';
        u5.TimeZoneSidKey = 'Asia/Tokyo';
        u5.LocaleSidKey = 'ja_JP';
        u5.LanguageLocaleKey = 'ja';
        u5.ProfileId = p.id;
        u5.Job_Category__c = '销售推广';
        u5.Province__c = '東京';
        u5.IsActive = true;
        insert u5;
        // User u5 = new User(Test_staff__c = true);
        // u5.LastName = 'test00001';
        // u5.FirstName = 'qbcuy';
        // u5.Batch_User__c = true;
        // u5.Alias = '12cs';
        // u5.Email = 'olympusT221cd04@sunbridge.com';
        // u5.Username = 'olymp11est3221@sunbridge.com';
        // u5.CommunityNickname = 'fewfa';
        // u5.IsActive = true;
        // u5.EmailEncodingKey = 'ISO-2022-JP';
        // u5.TimeZoneSidKey = 'Asia/Tokyo';
        // u5.LocaleSidKey = 'ja_JP';
        // u5.LanguageLocaleKey = 'ja';
        // u5.ProfileId = p.id;
        // u5.Job_Category__c = '销售推广';
        // u5.Province__c = '東京';
        // u5.IsActive = true;
        // u5.Employee_No__c = '0005'; //20220426 ljh add
        // insert u5;
        // StaticParameter.EscapeOpportunityBefUpdTrigger = true;
        // OCM_Management_Province__c mp1 = new OCM_Management_Province__c();
        // mp1.Name = '北京';
        // mp1.GI_assistant__c = u1.Id;
        // mp1.SP_assistant__c = u2.Id;
        // mp1.Window2__c = u3.Id;
        // mp1.Admin_assistant3__c = u4.Id;
        // insert mp1;
        OCM_Management_Province__c mp1 = new OCM_Management_Province__c();
        mp1.Name = '北京';
        mp1.GI_assistant__c = u1.Id;
        mp1.SP_assistant__c = u2.Id;
        mp1.Window2__c = u3.Id;
        mp1.Admin_assistant3__c = u4.Id;
        insert mp1;
        // RecordType rt1 = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
        // Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('HP').getRecordTypeId();
        // RecordType rt2 = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科'];
@@ -186,6 +193,7 @@
        System.runAs(u1) {
            info.OwnerId = u1.Id;
            info.Name = 'TEST001';
            info.InfoTitle__c = 'TEST001';
            info.AreaProvince__c = '北京';
            info.Hospital__c = hospital.Id;
            info.IsBid__c = '否';
@@ -197,17 +205,20 @@
            info.YingyeWindow__c = u2.Id;
            info.SP_assistant__c = u2.Id;
            info.GI_assistant__c = u2.Id;
            info.ResultDate__c=Date.today();
            info.subInfoType__c='1-1:意见征集';
            info.department_selection__c = '01210000000QemLAAS';
            if(!NFMUtil.isSandbox()){
                info.RecordTypeId = '01210000000VLZ8';
            } else {
                info.RecordTypeId = '0121m000000bKzA';
                info.RecordTypeId = '01210000000VLZ8';
            }
            
            insert info;
            info2.OwnerId = u1.Id;
            info2.Name = 'TEST002';
            info2.InfoTitle__c = 'TEST002';
            info2.AreaProvince__c = '北京';
            info2.Hospital__c = hospital.Id;
            info2.IsBid__c = '否';
@@ -219,7 +230,9 @@
            info2.YingyeWindow__c = u2.Id;
            info2.SP_assistant__c = u2.Id;
            info2.GI_assistant__c = u2.Id;
            insert info2;
            info2.ResultDate__c=Date.today();
            info2.subInfoType__c='1-1:意见征集';
            // insert info2;
            Tender_Opportunity_Link__c BlinksList = new Tender_Opportunity_Link__c();
            BlinksList.Opportunity__c = opp.Id;
@@ -228,12 +241,12 @@
            BlinksList.IsRelated__c = false;
            insert BlinksList;
            Tender_Opportunity_Link__c BlinksList2 = new Tender_Opportunity_Link__c();
            BlinksList2.Opportunity__c = opp.Id;
            BlinksList2.CurrencyIsoCode = 'CNY';
            BlinksList2.Tender_information__c = info2.Id;
            BlinksList2.IsRelated__c = false;
            insert BlinksList2;
            // Tender_Opportunity_Link__c BlinksList2 = new Tender_Opportunity_Link__c();
            // BlinksList2.Opportunity__c = opp.Id;
            // BlinksList2.CurrencyIsoCode = 'CNY';
            // // BlinksList2.Tender_information__c = info2.Id;
            // BlinksList2.IsRelated__c = false;
            // insert BlinksList2;
            List<Tender_information__c> clist = [select id, department_category__c from Tender_information__c ];
            info.InfoType__c = '2:公告';
@@ -243,4 +256,5 @@
        Test.stopTest();
    }
}
}