From d8dc84a3d56df839895f1c417a4d9cbee763d262 Mon Sep 17 00:00:00 2001
From: 高章伟 <gaozhangwei@prec-tech.com>
Date: 星期五, 03 三月 2023 14:50:59 +0800
Subject: [PATCH] gzw 测试环境代码更新
---
force-app/main/default/classes/UpdateTenderInformationBatchTest.cls | 425 +++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 332 insertions(+), 93 deletions(-)
diff --git a/force-app/main/default/classes/UpdateTenderInformationBatchTest.cls b/force-app/main/default/classes/UpdateTenderInformationBatchTest.cls
index 6057aa0..ac65da7 100644
--- a/force-app/main/default/classes/UpdateTenderInformationBatchTest.cls
+++ b/force-app/main/default/classes/UpdateTenderInformationBatchTest.cls
@@ -105,49 +105,49 @@
te3.IsReactionOpp__c = true;
insert te3;
- //璇环
- Opportunity opp1 = new Opportunity(
- Name = 'test opp1',
- StageName = '寮曞悎',
- CurrencyIsoCode = 'USD',
- CloseDate = Date.today(),
- AccountId = depart1.Id,
- RecordTypeId = oppVND.Id,
- Closing_Bid_Date__c = Date.today().addDays(-5),
- Hospital__c = acc1.Id,
- Competitor__c = 'A',
- Bidding_Project_Name_Bid__c = te1.Id
- );
- Opportunity opp2 = new Opportunity(
- Name = 'test opp2',
- StageName = '寮曞悎',
- CurrencyIsoCode = 'USD',
- CloseDate = Date.today(),
- AccountId = depart3.Id,
- RecordTypeId = oppVND.Id,
- Closing_Bid_Date__c = Date.today().addDays(-5),
- Hospital__c = acc2.Id,
- Competitor__c = 'B',
- Bidding_Project_Name_Bid__c = te1.Id
- );
- Opportunity opp3 = new Opportunity(
- Name = 'test opp3',
- StageName = '寮曞悎',
- CurrencyIsoCode = 'USD',
- CloseDate = Date.today(),
- AccountId = depart5.Id,
- RecordTypeId = oppVND.Id,
- Closing_Bid_Date__c = Date.today().addDays(-5),
- Hospital__c = acc3.Id,
- Competitor__c = 'C',
- Bidding_Project_Name_Bid__c = te2.Id
- );
- insert new Opportunity[] {opp1, opp2,opp3};
+ ////璇环
+ //Opportunity opp1 = new Opportunity(
+ // Name = 'test opp1',
+ // StageName = '寮曞悎',
+ // CurrencyIsoCode = 'USD',
+ // CloseDate = Date.today(),
+ // AccountId = depart1.Id,
+ // RecordTypeId = oppVND.Id,
+ // Closing_Bid_Date__c = Date.today().addDays(-5),
+ // Hospital__c = acc1.Id,
+ // Competitor__c = 'A',
+ // Bidding_Project_Name_Bid__c = te1.Id
+ //);
+ //Opportunity opp2 = new Opportunity(
+ // Name = 'test opp2',
+ // StageName = '寮曞悎',
+ // CurrencyIsoCode = 'USD',
+ // CloseDate = Date.today(),
+ // AccountId = depart3.Id,
+ // RecordTypeId = oppVND.Id,
+ // Closing_Bid_Date__c = Date.today().addDays(-5),
+ // Hospital__c = acc2.Id,
+ // Competitor__c = 'B',
+ // Bidding_Project_Name_Bid__c = te1.Id
+ //);
+ //Opportunity opp3 = new Opportunity(
+ // Name = 'test opp3',
+ // StageName = '寮曞悎',
+ // CurrencyIsoCode = 'USD',
+ // CloseDate = Date.today(),
+ // AccountId = depart5.Id,
+ // RecordTypeId = oppVND.Id,
+ // Closing_Bid_Date__c = Date.today().addDays(-5),
+ // Hospital__c = acc3.Id,
+ // Competitor__c = 'C',
+ // Bidding_Project_Name_Bid__c = te2.Id
+ //);
+ //insert new Opportunity[] {opp1, opp2,opp3};
System.Test.StartTest();
- opp3.Bidding_Project_Name_Bid__c = te2.Id;
- update opp3;
+ //opp3.Bidding_Project_Name_Bid__c = te2.Id;
+ //update opp3;
Id execBTId = Database.executeBatch(new UpdateTenderInformationBatch());
System.Test.StopTest();
@@ -316,7 +316,8 @@
Closing_Bid_Date__c = Date.today().addDays(-5),
Hospital__c = acc.Id,
Competitor__c = 'A',
- SAP_Send_OK__c = true,
+ // SAP_Send_OK__c = true,
+ SAP_Send_OK__c = false, // 20220426 ljh update
Authorized_DB_No__c = '123',
Contract_DB_SalesDept_complite_day__c = Date.today(),
NotesApprovedNo__c = '123'
@@ -331,7 +332,8 @@
Closing_Bid_Date__c = Date.today().addDays(-5),
Hospital__c = acc.Id,
Competitor__c = 'B',
- SAP_Send_OK__c = true,
+ // SAP_Send_OK__c = true,
+ SAP_Send_OK__c = false, // 20220426 ljh update
Authorized_DB_No__c = '123',
Contract_DB_SalesDept_complite_day__c = Date.today(),
NotesApprovedNo__c = '123',
@@ -347,7 +349,8 @@
Closing_Bid_Date__c = Date.today().addDays(-5),
Hospital__c = acc.Id,
Competitor__c = 'C',
- SAP_Send_OK__c = true,
+ // SAP_Send_OK__c = true,
+ SAP_Send_OK__c = false, // 20220426 ljh update
Authorized_DB_No__c = '123',
Contract_DB_SalesDept_complite_day__c = Date.today(),
NotesApprovedNo__c = '123',
@@ -433,7 +436,8 @@
Closing_Bid_Date__c = Date.today().addDays(-5),
Hospital__c = acc.Id,
Competitor__c = 'A',
- SAP_Send_OK__c = true,
+ // SAP_Send_OK__c = true,
+ SAP_Send_OK__c = false, // 20220426 ljh update
Authorized_DB_No__c = '123',
Contract_DB_SalesDept_complite_day__c = Date.today(),
NotesApprovedNo__c = '123'
@@ -448,7 +452,8 @@
Closing_Bid_Date__c = Date.today().addDays(-5),
Hospital__c = acc.Id,
Competitor__c = 'B',
- SAP_Send_OK__c = true,
+ // SAP_Send_OK__c = true,
+ SAP_Send_OK__c = false,// 20220426 ljh update
Authorized_DB_No__c = '123',
Contract_DB_SalesDept_complite_day__c = Date.today(),
NotesApprovedNo__c = '123',
@@ -593,58 +598,60 @@
te3.IsReactionOpp__c = true;
insert te3;
- //璇环
- Opportunity opp1 = new Opportunity(
- Name = 'test opp1',
- StageName = '瀹屼簡',
- CurrencyIsoCode = 'USD',
- CloseDate = Date.today(),
- AccountId = depart1.Id,
- RecordTypeId = oppVND.Id,
- Closing_Bid_Date__c = Date.today().addDays(-5),
- Hospital__c = acc1.Id,
- Competitor__c = 'A',
- SAP_Send_OK__c = true,
- Authorized_DB_No__c = '123',
- Contract_DB_SalesDept_complite_day__c = Date.today(),
- NotesApprovedNo__c = '123',
- Bidding_Project_Name_Bid__c = te1.Id
- );
- Opportunity opp2 = new Opportunity(
- Name = 'test opp2',
- StageName = '瀹屼簡',
- CurrencyIsoCode = 'USD',
- CloseDate = Date.today(),
- AccountId = depart3.Id,
- RecordTypeId = oppVND.Id,
- Closing_Bid_Date__c = Date.today().addDays(-5),
- Hospital__c = acc2.Id,
- Competitor__c = 'B',
- SAP_Send_OK__c = true,
- Authorized_DB_No__c = '123',
- Contract_DB_SalesDept_complite_day__c = Date.today(),
- NotesApprovedNo__c = '123',
- Bidding_Project_Name_Bid__c = te1.Id
- );
- Opportunity opp3 = new Opportunity(
- Name = 'test opp3',
- StageName = '鏁楁垿',
- CurrencyIsoCode = 'USD',
- CloseDate = Date.today(),
- AccountId = depart5.Id,
- RecordTypeId = oppVND.Id,
- Closing_Bid_Date__c = Date.today().addDays(-5),
- Hospital__c = acc3.Id,
- Competitor__c = 'C',
- Bidding_Project_Name_Bid__c = te2.Id
- );
+ ////璇环
+ //Opportunity opp1 = new Opportunity(
+ // Name = 'test opp1',
+ // StageName = '瀹屼簡',
+ // CurrencyIsoCode = 'USD',
+ // CloseDate = Date.today(),
+ // AccountId = depart1.Id,
+ // RecordTypeId = oppVND.Id,
+ // Closing_Bid_Date__c = Date.today().addDays(-5),
+ // Hospital__c = acc1.Id,
+ // Competitor__c = 'A',
+ // // SAP_Send_OK__c = true,
+ // SAP_Send_OK__c = false,// 20220426 ljh update
+ // Authorized_DB_No__c = '123',
+ // Contract_DB_SalesDept_complite_day__c = Date.today(),
+ // NotesApprovedNo__c = '123',
+ // Bidding_Project_Name_Bid__c = te1.Id
+ //);
+ //Opportunity opp2 = new Opportunity(
+ // Name = 'test opp2',
+ // StageName = '瀹屼簡',
+ // CurrencyIsoCode = 'USD',
+ // CloseDate = Date.today(),
+ // AccountId = depart3.Id,
+ // RecordTypeId = oppVND.Id,
+ // Closing_Bid_Date__c = Date.today().addDays(-5),
+ // Hospital__c = acc2.Id,
+ // Competitor__c = 'B',
+ // // SAP_Send_OK__c = true,
+ // SAP_Send_OK__c = false,// 20220426 ljh update
+ // Authorized_DB_No__c = '123',
+ // Contract_DB_SalesDept_complite_day__c = Date.today(),
+ // NotesApprovedNo__c = '123',
+ // Bidding_Project_Name_Bid__c = te1.Id
+ //);
+ //Opportunity opp3 = new Opportunity(
+ // Name = 'test opp3',
+ // StageName = '鏁楁垿',
+ // CurrencyIsoCode = 'USD',
+ // CloseDate = Date.today(),
+ // AccountId = depart5.Id,
+ // RecordTypeId = oppVND.Id,
+ // Closing_Bid_Date__c = Date.today().addDays(-5),
+ // Hospital__c = acc3.Id,
+ // Competitor__c = 'C',
+ // Bidding_Project_Name_Bid__c = te2.Id
+ //);
- insert new Opportunity[] {opp1, opp2,opp3};
+ //insert new Opportunity[] {opp1, opp2,opp3};
System.Test.StartTest();
- opp2.Bidding_Project_Name_Bid__c = te2.Id;
- update opp2;
+ //opp2.Bidding_Project_Name_Bid__c = te2.Id;
+ //update opp2;
List<String> ids = new List<String> ();
ids.add(String.valueOf(te1.Id).substring(0,15));
@@ -658,4 +665,236 @@
static testMethod void testForTest() {
UpdateTenderInformationBatch.justForTest();
}
+ // 20220426 ljh add
+ static testMethod void testMethod06() {
+ ControllerUtil.EscapeNFM001Trigger = true;
+ StaticParameter.EscapeOtherUpdateTenOwner = false;
+ Profile p = [select id from Profile where id = :System.Label.ProfileId_SystemAdmin];
+ String loginId = UserInfo.getUserId();
+ User sys = [select id from User where Id = :loginId];
+ StaticParameter.EscapeNFM001AgencyContractTrigger = true;
+ User u1 = new User(Test_staff__c = true);
+ u1.LastName = '123';
+ u1.FirstName = '2';
+ u1.Batch_User__c = true;
+ u1.Alias = '2';
+ u1.Email = 'olympusTest01@sunbridge.com';
+ u1.Username = 'olympusTest10@sunbridge.com';
+ u1.CommunityNickname = '銇�1';
+ u1.IsActive = true;
+ u1.EmailEncodingKey = 'ISO-2022-JP';
+ u1.TimeZoneSidKey = 'Asia/Tokyo';
+ u1.LocaleSidKey = 'ja_JP';
+ u1.LanguageLocaleKey = 'ja';
+ u1.ProfileId = p.id;
+ u1.Job_Category__c = '閿�鍞湇鍔�';
+ u1.Province__c = '鏉变含';
+ u1.Employee_No__c = '0001';
+ insert u1;
+ StaticParameter.EscapeNFM001AgencyContractTrigger = true;
+ User u2 = new User(Test_staff__c = true);
+ u2.LastName = '_銈点兂銉栥儶銉冦偢';
+ u2.FirstName = '銇�';
+ u2.Batch_User__c = true;
+ u2.Alias = '銇�';
+ u2.Email = 'olympusTest02@sunbridge.com';
+ u2.Username = 'olympusTest02@sunbridge.com';
+ u2.CommunityNickname = '銇�';
+ u2.IsActive = true;
+ u2.EmailEncodingKey = 'ISO-2022-JP';
+ u2.TimeZoneSidKey = 'Asia/Tokyo';
+ u2.LocaleSidKey = 'ja_JP';
+ u2.LanguageLocaleKey = 'ja';
+ u2.ProfileId = p.id;
+ u2.Job_Category__c = '閿�鍞帹骞�';
+ u2.Province__c = '鏉变含';
+ u2.IsActive = true;
+ u2.Employee_No__c = '0002';
+ insert u2;
+ StaticParameter.EscapeNFM001AgencyContractTrigger = true;
+ User u3 = new User(Test_staff__c = true);
+ u3.LastName = '1222';
+ u3.FirstName = '銇�';
+ u3.Batch_User__c = true;
+ u3.Alias = '銇�';
+ u3.Email = 'olympus12st03@sunbridge.com';
+ u3.Username = 'olympus34st03@sunbridge.com';
+ u3.CommunityNickname = '33';
+ u3.IsActive = true;
+ u3.EmailEncodingKey = 'ISO-2022-JP';
+ u3.TimeZoneSidKey = 'Asia/Tokyo';
+ u3.LocaleSidKey = 'ja_JP';
+ u3.LanguageLocaleKey = 'ja';
+ u3.ProfileId = p.id;
+ u3.Job_Category__c = '閿�鍞帹骞�';
+ u3.Province__c = '鏉变含';
+ u3.IsActive = true;
+ u3.Employee_No__c = '0003';
+ insert u3;
+ StaticParameter.EscapeNFM001AgencyContractTrigger = true;
+ User u4 = new User(Test_staff__c = true);
+ u4.LastName = '244';
+ u4.FirstName = '銇�';
+ u4.Batch_User__c = true;
+ u4.Alias = '銇�';
+ u4.Email = 'olympusT23t04@sunbridge.com';
+ u4.Username = 'olymp11est04@sunbridge.com';
+ u4.CommunityNickname = '444';
+ u4.IsActive = true;
+ u4.EmailEncodingKey = 'ISO-2022-JP';
+ u4.TimeZoneSidKey = 'Asia/Tokyo';
+ u4.LocaleSidKey = 'ja_JP';
+ u4.LanguageLocaleKey = 'ja';
+ u4.ProfileId = p.id;
+ u4.Job_Category__c = '閿�鍞帹骞�';
+ u4.Province__c = '鏉变含';
+ u4.IsActive = true;
+ u4.Employee_No__c = '0004';
+ 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;
+ u5.Employee_No__c = '0005';
+ 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;
+ // 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 = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'];
+ // Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Department_Class_BF').getRecordTypeId();
+ // RecordType rt3 = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '瑷虹檪绉� 鍛煎惛绉�'];
+ // Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Department_BF').getRecordTypeId();
+
+ //鍒涘缓涓�涓尰闄�
+ // 鐪�
+ //Address_Level__c al = new Address_Level__c();
+ //al.Name = '鍖椾含';
+ //al.Level1_Code__c = 'CN-99';
+ //al.Level1_Sys_No__c = '999999';
+ //insert al;
+ //// 甯�
+ //Address_Level2__c al2 = new Address_Level2__c();
+ //al2.Level1_Code__c = 'CN-99';
+ //al2.Level1_Sys_No__c = '999999';
+ //al2.Level1_Name__c = '鍖椾含';
+ //al2.Name = '娴锋穩鍖�';
+ //al2.Level2_Code__c = 'CN-9999';
+ //al2.Level2_Sys_No__c = '9999999';
+ //al2.Address_Level__c = al.id;
+ //insert al2;
+
+ //Account company = new Account();
+ //company.Name = 'aiueo鐥呴櫌';
+ //company.RecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('HP').getRecordTypeId();
+ ////company.State_Master__c = al.Id;
+ ////company.City_Master__c = al2.Id;
+ //insert company;
+
+ //Account sct = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company.Id and RecordTypeId = :Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Department_Class_BF').getRecordTypeId() Limit 1];
+
+ //Account depart = new Account();
+ //depart.RecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Department_BF').getRecordTypeId();
+ //depart.Name = '*';
+ //depart.Department_Name__c = 'aiueo瑷虹檪绉�';
+ //depart.ParentId = sct.Id;
+ //depart.Department_Class__c = sct.Id;
+ //depart.Hospital__c = company.Id;
+ //insert depart;
+ //StaticParameter.EscapeOpportunityBefUpdTrigger = true;
+ //Opportunity opp = new Opportunity(OwnerId = u1.Id , Name = 'aiueo鍟嗚珖', StageName = 'contact', CloseDate=Date.today());
+ //insert opp;
+
+ //// 鐥呴櫌銈掍綔銈�
+ //Account hospital = new Account();
+ //hospital.recordtypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('HP').getRecordTypeId();
+ //hospital.Name = 'test hospital';
+ //hospital.Is_Active__c = '鏈夊姽';
+ //hospital.Attribute_Type__c = '鍗敓閮�';
+ //hospital.Speciality_Type__c = '缁煎悎鍖婚櫌';
+ //hospital.Grade__c = '涓�绾�';
+ //hospital.OCM_Category__c = 'SLTV';
+ //hospital.Is_Medical__c = '鍖荤枟鏈烘瀯';
+ ////hospital.State_Master__c = al.id;
+ ////hospital.City_Master__c = al2.id;
+ //hospital.Town__c = '涓滀含';
+ //hospital.GI_Main__c = u1.Id;
+ //hospital.BF_owner__c = u2.Id;
+ //hospital.ET_owner__c = u2.Id;
+ //hospital.SP_Main__c = u3.Id;
+ //hospital.URO_owner_ID__c = u4.Id;
+ //hospital.GYN_owner__c = u1.Id;
+ //hospital.ENT_owner_ID__c = u1.Id;
+ //hospital.Energy_LeaderStr__c = '2 123';
+ //insert hospital;
+
+ Test.startTest();
+
+ Tender_information__c info = new Tender_information__c();
+ User thisUser= [select Id from User where Id=:UserInfo.getUserId()];
+ System.runAs(thisUser) {
+ info.OwnerId = thisUser.Id;
+ info.Name = 'TEST001';
+ info.InfoTitle__c = 'TEST001';
+ info.AreaProvince__c = '鍖椾含';
+ //info.Hospital__c = hospital.Id;
+ info.IsBid__c = '鍚�';
+ info.InfoType__c = '3锛氱粨鏋�';
+ info.OpportunityNum__c = 2;
+ info.TenderAssistant2__c = u2.Id;
+ info.Window2__c = u2.Id;
+ info.TenderAssistant1__c = u2.Id;
+ 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 ='3-5锛氫腑鏍囬�氱煡';
+ info.department_selection__c = '01210000000QemLAAS';
+ if(!NFMUtil.isSandbox()){
+ info.RecordTypeId = '01210000000VLZ8';
+ } else {
+ info.RecordTypeId = '01210000000VLZ8';
+ }
+
+ insert info;
+
+ //Tender_Opportunity_Link__c BlinksList = new Tender_Opportunity_Link__c();
+ //BlinksList.Opportunity__c = opp.Id;
+ //BlinksList.CurrencyIsoCode = 'CNY';
+ //BlinksList.Tender_information__c = info.Id;
+ //BlinksList.IsRelated__c = false;
+ //insert BlinksList;
+
+ List<Tender_information__c> clist = [select id, department_category__c from Tender_information__c ];
+ info.InfoType__c = '2锛氬叕鍛�';
+ update info;
+
+ //Delete BlinksList;
+ Id execBTId = Database.executeBatch(new UpdateTenderInformationBatch());
+ }
+
+ Test.stopTest();
+
+ }
}
\ No newline at end of file
--
Gitblit v1.9.1