@isTest private class NFM203RestTest { public static Address_Level__c al; public static Address_Level2__c al2; static void inittransfersData() { Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin]; // ユーザー作成 User hpOwner = new User(Test_staff__c = true,Employee_No__c ='ocm99999', LastName = 'hp owner' + (DateTime.now().getTime() * Math.random() / 1000), Alias = 'hp', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id); insert hpOwner; StaticParameter.EscapeNFM001AgencyContractTrigger = true; List transfers = new List(); BatchIF_Transfer__c transfer = new BatchIF_Transfer__c(); transfer.Table__c = 'Account'; transfer.Column__c = 'Sales_Shop_Class__c'; transfer.External_Value__c = '03'; transfer.Internal_Value__c = '一级经销商'; transfers.add(transfer); transfer = new BatchIF_Transfer__c(); transfer.Table__c = 'Account'; transfer.Column__c = 'CompanyNo__c'; transfer.External_Value__c = '5112'; transfer.Internal_Value__c = '奥林巴斯(北京)销售服务有限公司上海分公司'; transfers.add(transfer); transfer = new BatchIF_Transfer__c(); transfer.Table__c = 'Account'; transfer.Column__c = 'BPType__c'; transfer.External_Value__c = '02'; transfer.Internal_Value__c = 'OCSM-经销商'; transfers.add(transfer); transfer = new BatchIF_Transfer__c(); transfer.Table__c = 'Account'; transfer.Column__c = 'Contract_Department_Class__c'; transfer.External_Value__c = 'BF'; transfer.Internal_Value__c = '呼吸科'; transfers.add(transfer); transfer = new BatchIF_Transfer__c(); transfer.Table__c = 'Account'; transfer.Column__c = 'Contract_Department_Class__c'; transfer.External_Value__c = 'ENF'; transfer.Internal_Value__c = '耳鼻喉科'; transfers.add(transfer); insert transfers; // 省 al = new Address_Level__c(); al.Name = '東京'; al.Level1_Code__c = 'CN-99'; al.Level1_Sys_No__c = '999999'; insert al; // 市 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; } @isTest static void test_method_one() { inittransfersData(); NFM203Rest.GeDatas GeDatas = new NFM203Rest.GeDatas(); NFM203Rest.GeData GeData = new NFM203Rest.GeData(); NFM203Rest.License_Info License_Info = new NFM203Rest.License_Info(); NFM203Rest.License_Info License_Info05 = new NFM203Rest.License_Info(); NFM203Rest.Consignee_Info Consignee_Info = new NFM203Rest.Consignee_Info(); NFM203Rest.Authorized_Info Authorized_Info = new NFM203Rest.Authorized_Info(); NFM203Rest.Contract_Info Contract_Info = new NFM203Rest.Contract_Info(); GeDatas.Partners = new NFM203Rest.GeData[]{GeData}; GeData.License_Info = new NFM203Rest.License_Info[]{License_Info,License_Info05}; GeData.Consignee_Info = new NFM203Rest.Consignee_Info[]{Consignee_Info}; GeData.Contract_Info = new NFM203Rest.Contract_Info[]{Contract_Info}; GeData.Authorized_Info = new NFM203Rest.Authorized_Info[]{Authorized_Info}; Datetime nowDT = Datetime.now(); String nowStr = nowDT.format('yyyyMMddHHmm'); GeDatas.Monitoring = new NFMUtil.Monitoring(); GeDatas.Monitoring.MessageGroupNumber = nowStr + '01'; GeData.Z3PLTransAgrNo = ''; GeData.Z3PLQualityAgrNo = ''; GeData.Z3PLAuthorizedNo = ''; GeData.TransAgrVT = null; GeData.TransAgrVF= null; GeData.TaxNo = '12412412'; GeData.ServiceType = null; GeData.Remark = ''; GeData.RegisterAddress = '宁国路313弄9号龙泽大厦1601-1603室'; GeData.RegionName = '上海市'; GeData.Region = '20'; GeData.QualityAgrNoVT = null; GeData.QualityAgrNoVF = null; GeData.Postal = ''; GeData.Phone = ''; GeData.other3 = null; GeData.other2 = null; GeData.other1 = null; GeData.OperationProject = null; GeData.CompanyName = '上海培源医疗器械有限公司-测试已有新建2903'; GeData.CompanyCode = '5112'; GeData.CNTag = '4'; GeData.City = '黄浦区'; GeData.BPType = '02'; GeData.BPCode = '30022'; GeData.BankName = '中国银行'; GeData.BankCode = '12312412412412'; GeData.AuthorizedVT = null; GeData.AuthorizedVF = null; GeData.AuthorizedScope = ''; GeData.ApplyType = '2'; GeData.Agreement4 = null; GeData.Agreement3 = null; GeData.Agreement2 = null; GeData.Agreement1 = null; GeData.AgentValidTo = '20260331'; GeData.AgentValidFrom = '20161101'; GeData.AgentType = '01'; License_Info.WarehouseAddress = null; License_Info.ValidTo = '20260331'; License_Info.ValidFrom = '20161101'; License_Info.Principal = '丁世扬'; License_Info.other6 = null; License_Info.other5 = null; License_Info.other4 = null; License_Info.LicenseType = '04'; License_Info.IssueAuthority = null; License_Info.Exclusive1 = null; License_Info.Exclusive = null; License_Info.DiagnosisScope = null; License_Info.BusLicenseNo = '9131011876399850XF'; License_Info.BusinessType = null; License_Info.BusinessScope1 = '医疗器械及耗材 , 电子产品 , 日用百货 , 劳保用品 , 五金电料 , 家用电器 , 磁疗器具 , 医用卫生口罩 , 通讯器材 , 办公设备 , 机电设备 , 计算机销售 , 医疗设备租赁 , 维修 , 技术保养 , 医疗设备迁移 , 安装 , 技术咨询服务'; License_Info.BusinessScope = null; License_Info.BusinessAddress = '上海市黄浦区宁国路313弄9号龙泽大厦1601-1603室'; License_Info05.WarehouseAddress = null; License_Info05.ValidTo = ''; License_Info05.ValidFrom = '20161101'; License_Info05.Principal = '丁世扬'; License_Info05.other6 = null; License_Info05.other5 = null; License_Info05.other4 = null; License_Info05.LicenseType = '05'; License_Info05.IssueAuthority = null; License_Info05.Exclusive1 = null; License_Info05.Exclusive = null; License_Info05.DiagnosisScope = null; License_Info05.BusLicenseNo = '9131011876399850XF'; License_Info05.BusinessType = null; License_Info05.BusinessScope1 = '医疗器械及耗材 , 电子产品 , 日用百货 , 劳保用品 , 五金电料 , 家用电器 , 磁疗器具 , 医用卫生口罩 , 通讯器材 , 办公设备 , 机电设备 , 计算机销售 , 医疗设备租赁 , 维修 , 技术保养 , 医疗设备迁移 , 安装 , 技术咨询服务'; License_Info05.BusinessScope = null; License_Info05.BusinessAddress = '上海市黄浦区宁国路313弄9号龙泽大厦1601-1603室'; Contract_Info.DealerdiscountZF = null ; Contract_Info.DealerdiscountURO = null ; Contract_Info.DealerdiscountSP = null ; Contract_Info.DealerdiscountOTH = null ; Contract_Info.DealerdiscountGS = null ; Contract_Info.DealerdiscountGI = null ; Contract_Info.DealerdiscountET = 10.0 ; Contract_Info.DealerdiscountENG = null ; Contract_Info.DealerdiscountENF = null ; Contract_Info.DealerdiscountBF = null ; Contract_Info.DealerdiscountAH = null ; Contract_Info.ContractDecideStartDate = null ; Contract_Info.ContractDecideEndDate = null ; Contract_Info.BusinessAssistant = null ; Contract_Info.AimPriceAreaSP = null ; Contract_Info.AimPriceAreaET = null ; Contract_Info.TermContractNo = '151P-HD519' ; Contract_Info.SelableProduct = '' ; Contract_Info.SalesState = '上海市' ; Contract_Info.SalesShopClass = '区域' ; Contract_Info.SalesSection = '测试本部' ; Contract_Info.DealerdiscountGYN = 90.0; Contract_Info.ContractStartDate = '20181201' ; Contract_Info.ContractOwner = 'ocm99999' ; Contract_Info.ContractEndDate = '20201231' ; Contract_Info.ContractDepartmentClass = 'GYN;' ; Contract_Info.AimPriceSP = 200000.0 ; Contract_Info.AimPriceGIR = 160000.0 ; Contract_Info.AimPriceAreaENG = 200000.0 ; Contract_Info.AimPriceAH = 0.0 ; Contract_Info.AimPrice = '360000.0' ; Contract_Info.AimDivision = '金额' ; Contract_Info.AgencyApplicationNo = 'MSHTYXQHD201812005' ; Contract_Info.AgencyApplicationDay = '20181207' ; System.Test.startTest(); NFMUtil.Monitoring Monitoring = GeDatas.Monitoring; BatchIF_Log__c rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); Oly_TriggerHandler.bypass('NFM702ControllerHandler'); Oly_TriggerHandler.bypass('ContactTriggerHandler'); StaticParameter.EscapeContactToUser = true; ControllerUtil.EscapeNFM001Trigger = true; ControllerUtil.EscapeMaintenanceContractAfterUpdateTrigger = true; StaticParameter.EscapeNFM001Trigger = true; StaticParameter.EscapeNFM001AgencyContractTrigger = true; StaticParameter.EscapeNFM001AgencyContractTrigger2 = true; StaticParameter.EscapeMaintenanceContractAfterUpdateTrigger = true; NFM203Rest.main(rowData.Id); GeData.BPType = '03'; rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); NFM203Rest.main(rowData.Id); GeData.BPType = ''; rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); NFM203Rest.main(rowData.Id); GeData.BPType = '02'; GeData.BPCode = ''; rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); NFM203Rest.main(rowData.Id); GeData.BPType = '02'; GeData.BPCode = '30022'; GeData.CompanyName = ''; rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); NFM203Rest.main(rowData.Id); GeData.BPType = '02'; GeData.BPCode = '30022'; GeData.CompanyName = '20180522'; GeData.AgentType = ''; rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); NFM203Rest.main(rowData.Id); GeData.BPType = '02'; GeData.BPCode = '30022'; GeData.CompanyName = '20180522'; GeData.AgentType = '01'; Contract_Info.TermContractNo = '' ; rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); NFM203Rest.main(rowData.Id); System.Test.stopTest(); } //@isTest //static void test_method_five() { // inittransfersData(); // NFM203Rest.GeDatas GeDatas = new NFM203Rest.GeDatas(); // NFM203Rest.GeData GeData = new NFM203Rest.GeData(); // NFM203Rest.License_Info License_Info = new NFM203Rest.License_Info(); // NFM203Rest.License_Info License_Info05 = new NFM203Rest.License_Info(); // NFM203Rest.Consignee_Info Consignee_Info = new NFM203Rest.Consignee_Info(); // NFM203Rest.Authorized_Info Authorized_Info = new NFM203Rest.Authorized_Info(); // NFM203Rest.Contract_Info Contract_Info = new NFM203Rest.Contract_Info(); // GeDatas.Partners = new NFM203Rest.GeData[]{GeData}; // GeData.License_Info = new NFM203Rest.License_Info[]{License_Info,License_Info05}; // GeData.Consignee_Info = new NFM203Rest.Consignee_Info[]{Consignee_Info}; // GeData.Contract_Info = new NFM203Rest.Contract_Info[]{Contract_Info}; // GeData.Authorized_Info = new NFM203Rest.Authorized_Info[]{Authorized_Info}; // Datetime nowDT = Datetime.now(); // String nowStr = nowDT.format('yyyyMMddHHmm'); // GeDatas.Monitoring = new NFMUtil.Monitoring(); // GeDatas.Monitoring.MessageGroupNumber = nowStr + '01'; // GeData.Z3PLTransAgrNo = ''; // GeData.Z3PLQualityAgrNo = ''; // GeData.Z3PLAuthorizedNo = ''; // GeData.TransAgrVT = null; // GeData.TransAgrVF= null; // GeData.TaxNo = '12412412'; // GeData.ServiceType = null; // GeData.Remark = ''; // GeData.RegisterAddress = '宁国路313弄9号龙泽大厦1601-1603室'; // GeData.RegionName = '上海市'; // GeData.Region = '20'; // GeData.QualityAgrNoVT = null; // GeData.QualityAgrNoVF = null; // GeData.Postal = ''; // GeData.Phone = ''; // GeData.other3 = null; // GeData.other2 = null; // GeData.other1 = null; // GeData.OperationProject = null; // GeData.CompanyName = '上海培源医疗器械有限公司-测试已有新建2903'; // GeData.CompanyCode = '5112'; // GeData.CNTag = '4'; // GeData.City = '黄浦区'; // GeData.BPType = '02'; // GeData.BPCode = '30022'; // GeData.BankName = '中国银行'; // GeData.BankCode = '12312412412412'; // GeData.AuthorizedVT = null; // GeData.AuthorizedVF = null; // GeData.AuthorizedScope = ''; // GeData.ApplyType = ''; // GeData.Agreement4 = null; // GeData.Agreement3 = null; // GeData.Agreement2 = null; // GeData.Agreement1 = null; // GeData.AgentValidTo = '20260331'; // GeData.AgentValidFrom = '20161101'; // GeData.AgentType = '01'; // License_Info.WarehouseAddress = null; // License_Info.ValidTo = '20260331'; // License_Info.ValidFrom = '20161101'; // License_Info.Principal = '丁世扬'; // License_Info.other6 = null; // License_Info.other5 = null; // License_Info.other4 = null; // License_Info.LicenseType = '04'; // License_Info.IssueAuthority = null; // License_Info.Exclusive1 = null; // License_Info.Exclusive = null; // License_Info.DiagnosisScope = null; // License_Info.BusLicenseNo = '9131011876399850XF'; // License_Info.BusinessType = null; // License_Info.BusinessScope1 = '医疗器械及耗材 , 电子产品 , 日用百货 , 劳保用品 , 五金电料 , 家用电器 , 磁疗器具 , 医用卫生口罩 , 通讯器材 , 办公设备 , 机电设备 , 计算机销售 , 医疗设备租赁 , 维修 , 技术保养 , 医疗设备迁移 , 安装 , 技术咨询服务'; // License_Info.BusinessScope = null; // License_Info.BusinessAddress = '上海市黄浦区宁国路313弄9号龙泽大厦1601-1603室'; // License_Info05.WarehouseAddress = null; // License_Info05.ValidTo = ''; // License_Info05.ValidFrom = '20161101'; // License_Info05.Principal = '丁世扬'; // License_Info05.other6 = null; // License_Info05.other5 = null; // License_Info05.other4 = null; // License_Info05.LicenseType = '05'; // License_Info05.IssueAuthority = null; // License_Info05.Exclusive1 = null; // License_Info05.Exclusive = null; // License_Info05.DiagnosisScope = null; // License_Info05.BusLicenseNo = '9131011876399850XF'; // License_Info05.BusinessType = null; // License_Info05.BusinessScope1 = '医疗器械及耗材 , 电子产品 , 日用百货 , 劳保用品 , 五金电料 , 家用电器 , 磁疗器具 , 医用卫生口罩 , 通讯器材 , 办公设备 , 机电设备 , 计算机销售 , 医疗设备租赁 , 维修 , 技术保养 , 医疗设备迁移 , 安装 , 技术咨询服务'; // License_Info05.BusinessScope = null; // License_Info05.BusinessAddress = '上海市黄浦区宁国路313弄9号龙泽大厦1601-1603室'; // Contract_Info.DealerdiscountZF = null ; // Contract_Info.DealerdiscountURO = null ; // Contract_Info.DealerdiscountSP = null ; // Contract_Info.DealerdiscountOTH = null ; // Contract_Info.DealerdiscountGS = null ; // Contract_Info.DealerdiscountGI = null ; // Contract_Info.DealerdiscountET = 10.0 ; // Contract_Info.DealerdiscountENG = null ; // Contract_Info.DealerdiscountENF = null ; // Contract_Info.DealerdiscountBF = null ; // Contract_Info.DealerdiscountAH = null ; // Contract_Info.ContractDecideStartDate = null ; // Contract_Info.ContractDecideEndDate = null ; // Contract_Info.BusinessAssistant = null ; // Contract_Info.AimPriceAreaSP = null ; // Contract_Info.AimPriceAreaET = null ; // Contract_Info.TermContractNo = '151P-HD519' ; // Contract_Info.SelableProduct = '' ; // Contract_Info.SalesState = '上海市' ; // Contract_Info.SalesShopClass = '区域' ; // Contract_Info.SalesSection = '测试本部' ; // Contract_Info.DealerdiscountGYN = 90.0; // Contract_Info.ContractStartDate = '20181201' ; // Contract_Info.ContractOwner = 'ocm99999' ; // Contract_Info.ContractEndDate = '20201231' ; // Contract_Info.ContractDepartmentClass = 'GYN;' ; // Contract_Info.AimPriceSP = 200000.0 ; // Contract_Info.AimPriceGIR = 160000.0 ; // Contract_Info.AimPriceAreaENG = 200000.0 ; // Contract_Info.AimPriceAH = 0.0 ; // Contract_Info.AimPrice = 360000.0 ; // Contract_Info.AimDivision = '金额' ; // Contract_Info.AgencyApplicationNo = 'MSHTYXQHD201812005' ; // Contract_Info.AgencyApplicationDay = '20181207' ; // System.Test.startTest(); // NFMUtil.Monitoring Monitoring = GeDatas.Monitoring; // BatchIF_Log__c rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); // NFM203Rest.main(rowData.Id); // GeData.BPType = '02'; // License_Info.LicenseType = '01'; // rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); // NFM203Rest.main(rowData.Id); // GeData.BPType = '02'; // License_Info.LicenseType = '07'; // rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); // NFM203Rest.main(rowData.Id); // GeData.BPType = '03'; // rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); // NFM203Rest.main(rowData.Id); // //GeData.BPType = '02'; // //GeData.BPCode = ''; // //rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); // //NFM203Rest.main(rowData.Id); // //GeData.BPType = '02'; // //GeData.BPCode = '30022'; // //GeData.CompanyName = ''; // //rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); // //NFM203Rest.main(rowData.Id); // //GeData.BPType = '02'; // //GeData.BPCode = '30022'; // //GeData.CompanyName = '20180522'; // //GeData.AgentType = ''; // //rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); // //NFM203Rest.main(rowData.Id); // //GeData.BPType = '02'; // //GeData.BPCode = '30022'; // //GeData.CompanyName = '20180522'; // //GeData.AgentType = '01'; // //Contract_Info.TermContractNo = '' ; // //rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); // //NFM203Rest.main(rowData.Id); // System.Test.stopTest(); //} @isTest static void test_method_two() { StaticParameter.EscapeNFM007Trigger = true; ControllerUtil.EscapeNFM001Trigger = true; inittransfersData() ; Account hospital = new Account(); hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id; 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.AgentCode_Ext__c = '8063366'; insert hospital; NFM203Rest.GeDatas GeDatas = new NFM203Rest.GeDatas(); NFM203Rest.GeData GeData = new NFM203Rest.GeData(); GeDatas.Partners = new NFM203Rest.GeData[]{GeData}; NFM203Rest.License_Info License_Info = new NFM203Rest.License_Info(); GeData.License_Info = new NFM203Rest.License_Info[]{License_Info}; Datetime nowDT = Datetime.now(); String nowStr = nowDT.format('yyyyMMddHHmm'); GeDatas.Monitoring = new NFMUtil.Monitoring(); GeDatas.Monitoring.MessageGroupNumber = nowStr + '01'; GeData.Z3PLTransAgrNo = null; GeData.Z3PLQualityAgrNo = null; GeData.Z3PLAuthorizedNo = null; GeData.TransAgrVT = null; GeData.TransAgrVF= null; GeData.TaxNo = null; GeData.ServiceType = null; GeData.Remark = null; GeData.RegisterAddress = null; GeData.RegionName = null; GeData.Region = null; GeData.QualityAgrNoVT = null; GeData.QualityAgrNoVF = null; GeData.Postal = null; GeData.Phone = null; GeData.other3 = null; GeData.other2 = null; GeData.other1 = null; GeData.OperationProject = null; GeData.CompanyName = null; GeData.CompanyCode = null; GeData.CNTag = null; GeData.City = null; GeData.BPType = '03'; GeData.BPCode = '8063366'; GeData.BankName = null; GeData.BankCode = null; GeData.AuthorizedVT = null; GeData.AuthorizedVF = null; GeData.AuthorizedScope =null; GeData.ApplyType = ''; GeData.Agreement4 = null; GeData.Agreement3 = null; GeData.Agreement2 = null; GeData.Agreement1 = null; GeData.AgentValidTo = null; GeData.AgentValidFrom = null; GeData.AgentType = null; License_Info.WarehouseAddress = null; License_Info.ValidTo = '20260331'; License_Info.ValidFrom = '20161101'; License_Info.Principal = '丁世扬'; License_Info.other6 = null; License_Info.other5 = null; License_Info.other4 = null; License_Info.LicenseType = '01'; License_Info.IssueAuthority = null; License_Info.Exclusive1 = null; License_Info.Exclusive = null; License_Info.DiagnosisScope = null; License_Info.BusLicenseNo = '9131011876399850XF'; License_Info.BusinessType = null; License_Info.BusinessScope1 = '医疗器械及耗材 , 电子产品 , 日用百货 , 劳保用品 , 五金电料 , 家用电器 , 磁疗器具 , 医用卫生口罩 , 通讯器材 , 办公设备 , 机电设备 , 计算机销售 , 医疗设备租赁 , 维修 , 技术保养 , 医疗设备迁移 , 安装 , 技术咨询服务'; License_Info.BusinessScope = null; License_Info.BusinessAddress = '上海市黄浦区宁国路313弄9号龙泽大厦1601-1603室'; System.Test.startTest(); NFMUtil.Monitoring Monitoring = GeDatas.Monitoring; BatchIF_Log__c rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); NFM203Rest.main(rowData.Id); GeData.ApplyType = '8'; rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); NFM203Rest.main(rowData.Id); GeData.ApplyType = '6'; License_Info.BusLicenseNo = ''; rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); NFM203Rest.main(rowData.Id); GeData.ApplyType = '6'; License_Info.BusLicenseNo = '180522'; License_Info.LicenseType = '23'; rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); NFM203Rest.main(rowData.Id); GeData.ApplyType = '6'; License_Info.LicenseType = '01'; rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); NFM203Rest.main(rowData.Id); GeData.ApplyType = ''; License_Info.LicenseType = ''; rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); NFM203Rest.main(rowData.Id); GeData.ApplyType = '5'; rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); NFM203Rest.main(rowData.Id); System.Test.stopTest(); } @isTest static void test_method_Three() { ControllerUtil.EscapeNFM001Trigger = true; inittransfersData(); NFM203Rest.GeDatas GeDatas = new NFM203Rest.GeDatas(); NFM203Rest.GeData GeData = new NFM203Rest.GeData(); NFM203Rest.License_Info License_Info = new NFM203Rest.License_Info(); NFM203Rest.Consignee_Info Consignee_Info = new NFM203Rest.Consignee_Info(); NFM203Rest.Authorized_Info Authorized_Info = new NFM203Rest.Authorized_Info(); NFM203Rest.Contract_Info Contract_Info = new NFM203Rest.Contract_Info(); GeDatas.Partners = new NFM203Rest.GeData[]{GeData}; GeData.License_Info = new NFM203Rest.License_Info[]{License_Info}; GeData.Consignee_Info = new NFM203Rest.Consignee_Info[]{Consignee_Info}; GeData.Contract_Info = new NFM203Rest.Contract_Info[]{Contract_Info}; GeData.Authorized_Info = new NFM203Rest.Authorized_Info[]{Authorized_Info}; Datetime nowDT = Datetime.now(); String nowStr = nowDT.format('yyyyMMddHHmm'); GeDatas.Monitoring = new NFMUtil.Monitoring(); GeDatas.Monitoring.MessageGroupNumber = nowStr + '01'; GeData.Z3PLTransAgrNo = ''; GeData.Z3PLQualityAgrNo = ''; GeData.Z3PLAuthorizedNo = ''; GeData.TransAgrVT = null; GeData.TransAgrVF= null; GeData.TaxNo = '12412412'; GeData.ServiceType = null; GeData.Remark = ''; GeData.RegisterAddress = '宁国路313弄9号龙泽大厦1601-1603室'; GeData.RegionName = al.Name; GeData.Region = '20'; GeData.QualityAgrNoVT = null; GeData.QualityAgrNoVF = null; GeData.Postal = ''; GeData.Phone = ''; GeData.other3 = null; GeData.other2 = null; GeData.other1 = null; GeData.OperationProject = null; GeData.CompanyName = '上海培源医疗器械有限公司-测试已有新建2903'; GeData.CompanyCode = '5112'; GeData.CNTag = ''; GeData.City = al2.Name; GeData.BPType = '02'; GeData.BPCode = '30022'; GeData.BankName = '中国银行'; GeData.BankCode = '12312412412412'; GeData.AuthorizedVT = null; GeData.AuthorizedVF = null; GeData.AuthorizedScope = ''; GeData.ApplyType = '4'; GeData.Agreement4 = null; GeData.Agreement3 = null; GeData.Agreement2 = null; GeData.Agreement1 = null; GeData.AgentValidTo = '20260331'; GeData.AgentValidFrom = '20161101'; GeData.AgentType = '01'; License_Info.WarehouseAddress = null; License_Info.ValidTo = '20260331'; License_Info.ValidFrom = '20161101'; License_Info.Principal = '丁世扬'; License_Info.other6 = null; License_Info.other5 = null; License_Info.other4 = null; License_Info.LicenseType = '01'; License_Info.IssueAuthority = null; License_Info.Exclusive1 = null; License_Info.Exclusive = null; License_Info.DiagnosisScope = null; License_Info.BusLicenseNo = '9131011876399850XF'; License_Info.BusinessType = null; License_Info.BusinessScope1 = '医疗器械及耗材 , 电子产品 , 日用百货 , 劳保用品 , 五金电料 , 家用电器 , 磁疗器具 , 医用卫生口罩 , 通讯器材 , 办公设备 , 机电设备 , 计算机销售 , 医疗设备租赁 , 维修 , 技术保养 , 医疗设备迁移 , 安装 , 技术咨询服务'; License_Info.BusinessScope = null; License_Info.BusinessAddress = '上海市黄浦区宁国路313弄9号龙泽大厦1601-1603室'; Contract_Info.DealerdiscountZF = null ; Contract_Info.DealerdiscountURO = null ; Contract_Info.DealerdiscountSP = null ; Contract_Info.DealerdiscountOTH = null ; Contract_Info.DealerdiscountGS = null ; Contract_Info.DealerdiscountGI = null ; Contract_Info.DealerdiscountET = 10.0 ; Contract_Info.DealerdiscountENG = null ; Contract_Info.DealerdiscountENF = null ; Contract_Info.DealerdiscountBF = null ; Contract_Info.DealerdiscountAH = null ; Contract_Info.ContractDecideStartDate = null ; Contract_Info.ContractDecideEndDate = null ; Contract_Info.BusinessAssistant = null ; Contract_Info.AimPriceAreaSP = null ; Contract_Info.AimPriceAreaET = null ; Contract_Info.TermContractNo = '151P-HD519' ; Contract_Info.SelableProduct = '' ; Contract_Info.SalesState = '上海市' ; Contract_Info.SalesShopClass = '区域' ; Contract_Info.SalesSection = '测试本部' ; Contract_Info.DealerdiscountGYN = 90.0; Contract_Info.ContractStartDate = '20181201' ; Contract_Info.ContractOwner = 'ocm99999' ; Contract_Info.ContractEndDate = '20201231' ; Contract_Info.ContractDepartmentClass = 'GYN;' ; Contract_Info.AimPriceSP = 200000.0 ; Contract_Info.AimPriceGIR = 160000.0 ; Contract_Info.AimPriceAreaENG = 200000.0 ; Contract_Info.AimPriceAH = 0.0 ; Contract_Info.AimPrice = '360000.0' ; Contract_Info.AimDivision = '金额' ; Contract_Info.AgencyApplicationNo = 'MSHTYXQHD201812005' ; Contract_Info.AgencyApplicationDay = '20181207' ; System.Test.startTest(); NFMUtil.Monitoring Monitoring = GeDatas.Monitoring; BatchIF_Log__c rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); Oly_TriggerHandler.bypass('NFM702ControllerHandler'); Oly_TriggerHandler.bypass('ContactTriggerHandler'); StaticParameter.EscapeContactToUser = true; ControllerUtil.EscapeNFM001Trigger = true; ControllerUtil.EscapeMaintenanceContractAfterUpdateTrigger = true; StaticParameter.EscapeNFM001Trigger = true; StaticParameter.EscapeNFM001AgencyContractTrigger = true; StaticParameter.EscapeNFM001AgencyContractTrigger2 = true; StaticParameter.EscapeMaintenanceContractAfterUpdateTrigger = true; NFM203Rest.main(rowData.Id); //Contract_Info.DealerdiscountET = null ; //Contract_Info.DealerdiscountENG = 10.0 ; //rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); //NFM203Rest.main(rowData.Id); //Contract_Info.DealerdiscountET = null ; //Contract_Info.DealerdiscountENG = null ; //Contract_Info.DealerdiscountAH = 10.0 ; //rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); //NFM203Rest.main(rowData.Id); //Contract_Info.DealerdiscountET = null ; //Contract_Info.DealerdiscountENG = null ; //Contract_Info.DealerdiscountAH = null ; //Contract_Info.DealerdiscountSP = 10.0 ; //rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); //NFM203Rest.main(rowData.Id); //License_Info.LicenseType = ''; //rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); //NFM203Rest.main(rowData.Id); //License_Info.LicenseType = '23'; //rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); //NFM203Rest.executefuture(rowData.Id); //License_Info.LicenseType = '07'; //rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); //NFM203Rest.executefuture(rowData.Id); //License_Info.BusLicenseNo = ''; //rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); //NFM203Rest.executefuture(rowData.Id); System.Test.stopTest(); } //@isTest //static void test_method_four() { // ControllerUtil.EscapeNFM001Trigger = true; // StaticParameter.EscapeNFM001AgencyContractTrigger2 = true; // inittransfersData(); // List rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; // if (rectCo.size() == 0) { // return; // } // List rectContract = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '契約']; // if (rectCo.size() == 0) { // return; // } ////经销商 // Account myAccount1 = new Account(name='Testaccount001', // Dealer_discount__c =20, // RecordTypeId = rectCo[0].Id); // insert myAccount1; // //经销商有效合同 // Account myAccount2 = new Account(name='Testaccount002', // RecordTypeId = rectContract[0].Id, // Contract_Decide_Start_Date__c = Date.today().addDays(-1), // Contract_Decide_End_Date__c =Date.today().addDays(1), // Agent_Ref__c =myAccount1.Id, // ParentId =myAccount1.Id, // Term_Contract_No__c = '151P-HD519', // City_Master__c = al2.Id); // insert myAccount2; // List actList = [select Id,Name,Term_Contract_No__c from Account where Contract_Decide_Start_Date__c != null]; // system.assertEquals('151P-HD519',actList.get(0).Term_Contract_No__c); // NFM203Rest.GeDatas GeDatas = new NFM203Rest.GeDatas(); // NFM203Rest.GeData GeData = new NFM203Rest.GeData(); // NFM203Rest.License_Info License_Info = new NFM203Rest.License_Info(); // NFM203Rest.Consignee_Info Consignee_Info = new NFM203Rest.Consignee_Info(); // NFM203Rest.Authorized_Info Authorized_Info = new NFM203Rest.Authorized_Info(); // NFM203Rest.Contract_Info Contract_Info = new NFM203Rest.Contract_Info(); // GeDatas.Partners = new NFM203Rest.GeData[]{GeData}; // GeData.License_Info = new NFM203Rest.License_Info[]{License_Info}; // GeData.Consignee_Info = new NFM203Rest.Consignee_Info[]{Consignee_Info}; // GeData.Contract_Info = new NFM203Rest.Contract_Info[]{Contract_Info}; // GeData.Authorized_Info = new NFM203Rest.Authorized_Info[]{Authorized_Info}; // Datetime nowDT = Datetime.now(); // String nowStr = nowDT.format('yyyyMMddHHmm'); // GeDatas.Monitoring = new NFMUtil.Monitoring(); // GeDatas.Monitoring.MessageGroupNumber = nowStr + '01'; // GeData.Z3PLTransAgrNo = ''; // GeData.Z3PLQualityAgrNo = ''; // GeData.Z3PLAuthorizedNo = ''; // GeData.TransAgrVT = null; // GeData.TransAgrVF= null; // GeData.TaxNo = '12412412'; // GeData.ServiceType = null; // GeData.Remark = ''; // GeData.RegisterAddress = '宁国路313弄9号龙泽大厦1601-1603室'; // GeData.RegionName = '上海市'; // GeData.Region = '20'; // GeData.QualityAgrNoVT = null; // GeData.QualityAgrNoVF = null; // GeData.Postal = ''; // GeData.Phone = ''; // GeData.other3 = null; // GeData.other2 = null; // GeData.other1 = null; // GeData.OperationProject = null; // GeData.CompanyName = '上海培源医疗器械有限公司-测试已有新建2903'; // GeData.CompanyCode = '5112'; // GeData.CNTag = ''; // GeData.City = '黄浦区'; // GeData.BPType = '02'; // GeData.BPCode = '30022'; // GeData.BankName = '中国银行'; // GeData.BankCode = '12312412412412'; // GeData.AuthorizedVT = null; // GeData.AuthorizedVF = null; // GeData.AuthorizedScope = ''; // GeData.ApplyType = '4'; // GeData.Agreement4 = null; // GeData.Agreement3 = null; // GeData.Agreement2 = null; // GeData.Agreement1 = null; // GeData.AgentValidTo = '20260331'; // GeData.AgentValidFrom = '20161101'; // GeData.AgentType = '01'; // License_Info.WarehouseAddress = null; // License_Info.ValidTo = '20260331'; // License_Info.ValidFrom = '20161101'; // License_Info.Principal = '丁世扬'; // License_Info.other6 = null; // License_Info.other5 = null; // License_Info.other4 = null; // License_Info.LicenseType = '01'; // License_Info.IssueAuthority = null; // License_Info.Exclusive1 = null; // License_Info.Exclusive = null; // License_Info.DiagnosisScope = null; // License_Info.BusLicenseNo = '9131011876399850XF'; // License_Info.BusinessType = null; // License_Info.BusinessScope1 = '医疗器械及耗材 , 电子产品 , 日用百货 , 劳保用品 , 五金电料 , 家用电器 , 磁疗器具 , 医用卫生口罩 , 通讯器材 , 办公设备 , 机电设备 , 计算机销售 , 医疗设备租赁 , 维修 , 技术保养 , 医疗设备迁移 , 安装 , 技术咨询服务'; // License_Info.BusinessScope = null; // License_Info.BusinessAddress = '上海市黄浦区宁国路313弄9号龙泽大厦1601-1603室'; // Contract_Info.DealerdiscountZF = null ; // Contract_Info.DealerdiscountURO = null ; // Contract_Info.DealerdiscountSP = null ; // Contract_Info.DealerdiscountOTH = null ; // Contract_Info.DealerdiscountGS = null ; // Contract_Info.DealerdiscountGI = null ; // Contract_Info.DealerdiscountET = 10.0 ; // Contract_Info.DealerdiscountENG = null ; // Contract_Info.DealerdiscountENF = null ; // Contract_Info.DealerdiscountBF = null ; // Contract_Info.DealerdiscountAH = null ; // Contract_Info.ContractDecideStartDate = null ; // Contract_Info.ContractDecideEndDate = null ; // Contract_Info.BusinessAssistant = null ; // Contract_Info.AimPriceAreaSP = null ; // Contract_Info.AimPriceAreaET = null ; // Contract_Info.TermContractNo = '151P-HD519' ; // Contract_Info.SelableProduct = '' ; // Contract_Info.SalesState = '上海市' ; // Contract_Info.SalesShopClass = '区域' ; // Contract_Info.SalesSection = '测试本部' ; // Contract_Info.DealerdiscountGYN = 90.0; // Contract_Info.ContractStartDate = '20181201' ; // Contract_Info.ContractOwner = 'ocm99999' ; // Contract_Info.ContractEndDate = '20201231' ; // Contract_Info.ContractDepartmentClass = 'GYN;' ; // Contract_Info.AimPriceSP = 200000.0 ; // Contract_Info.AimPriceGIR = 160000.0 ; // Contract_Info.AimPriceAreaENG = 200000.0 ; // Contract_Info.AimPriceAH = 0.0 ; // Contract_Info.AimPrice = '360000.0' ; // Contract_Info.AimDivision = '金额' ; // Contract_Info.AgencyApplicationNo = 'MSHTYXQHD201812005' ; // Contract_Info.AgencyApplicationDay = '20181207' ; // System.Test.startTest(); // NFMUtil.Monitoring Monitoring = GeDatas.Monitoring; // BatchIF_Log__c rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); // NFM203Rest.main(rowData.Id); // Contract_Info.DealerdiscountET = null ; // Contract_Info.DealerdiscountENG = 10.0 ; // rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); // NFM203Rest.executefuture(rowData.Id); // Contract_Info.DealerdiscountET = null ; // Contract_Info.DealerdiscountENG = null ; // Contract_Info.DealerdiscountAH = 10.0 ; // rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); // NFM203Rest.executefuture(rowData.Id); // Contract_Info.DealerdiscountET = null ; // Contract_Info.DealerdiscountENG = null ; // Contract_Info.DealerdiscountAH = null ; // Contract_Info.DealerdiscountSP = 10.0 ; // rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); // NFM203Rest.executefuture(rowData.Id); // System.Test.stopTest(); //} @isTest static void test_method_Seven() { Test.startTest(); RestRequest req = new RestRequest(); RestResponse res = new RestResponse(); String JsonMsg = '{"Monitoring":{"TransmissionDateTime":"201812201320","Text":"","Tag":"MSGH","Sender":"SFDC","Receiver":"SPO","NumberOfRecord":"1","MessageType":"NFM203","MessageGroupNumber":"20180001722190"},"Partners":[{"Z3PLTransAgrNo":null,"Z3PLQualityAgrNo":null,"Z3PLAuthorizedNo":null,"TransAgrVT":null,"TransAgrVF":null,"TaxNo":null,"ServiceType":null,"Remark":null,"RegisterAddress":null,"RegionName":null,"Region":null,"QualityAgrNoVT":null,"QualityAgrNoVF":null,"Postal":null,"Phone":null,"other3":null,"other2":null,"other1":null,"OperationProject":null,"License_Info":null,"Incorporator":null,"Fax":null,"CustomerService":null,"Contract_Info":null,"Consignee_Info":null,"CompanyName":null,"CompanyCode":null,"CNTag":null,"City":null,"BPType":"04","BPCode":"8063538","BankName":null,"BankCode":null,"AuthorizedVT":null,"AuthorizedVF":null,"AuthorizedScope":null,"Authorized_Info":null,"ApplyType":"1","Agreement4":null,"Agreement3":null,"Agreement2":null,"Agreement1":null,"AgentValidTo":null,"AgentValidFrom":null,"AgentType":null}]}'; req.requestURI = 'services/apexrest/NFM203/execute'; req.httpMethod = 'POST'; req.requestBody = Blob.valueof(JsonMsg); RestContext.request = req; RestContext.response= res; NFM203Rest.execute(); Test.stopTest(); //Test.setMock(HttpCalloutMock.class, new NFM205RestCalloutMock()); //NFM205Rest.execute1('{"Monitoring":{"TransmissionDateTime":"201812201320","Text":"","Tag":"MSGH","Sender":"SFDC","Receiver":"SPO","NumberOfRecord":"1","MessageType":"NFM205","MessageGroupNumber":"20180001722190"},"GeData":[{"Opportunity_Code":"HKBJ-GI-BJ0588881","Bidding_No":"as123121","Bidding_Content":"招标内容","Bid_Project_Name":"招标项目名","Bid_Date":"20181203","Authorized_Status":"1","Authorized_Finish_Sales":"30033","Authorized_DB_No":"MGZWESQHN201812001","Authorized_Date":"20190316","Autholization_Activated_Date":"20190415"}]}'); } @isTest static void test_method_Log() { Test.startTest(); RestRequest req = new RestRequest(); RestResponse res = new RestResponse(); String JsonMsg = '{"Monitoring":{"TransmissionDateTime":"201812201320","Text":"","Tag":"MSGH","Sender":"SFDC","Receiver":"SPO","NumberOfRecord":"1","MessageType":"NFM203","MessageGroupNumber":"20180001722190"},"Partners":[{"Z3PLTransAgrNo":"","Z3PLQualityAgrNo":"","Z3PLAuthorizedNo":"","TransAgrVT":null,"TransAgrVF":null,"TaxNo":"12345678909855","ServiceType":null,"Remark":"","RegisterAddress":"1号","RegionName":"北京市","Region":"10","QualityAgrNoVT":null,"QualityAgrNoVF":null,"Postal":"111100","Phone":"15611778799","other3":null,"other2":null,"other1":null,"OperationProject":null,"License_Info":[{"WarehouseAddress":null,"ValidTo":"20210731","ValidFrom":"20210601","Principal":"张三","other6":null,"other5":null,"other4":null,"LicenseType":"01","IssueAuthority":null,"Exclusive1":null,"Exclusive":null,"DiagnosisScope":null,"BusLicenseNo":"code123456","BusinessType":null,"BusinessScope1":"医疗器械","BusinessScope":null,"BusinessAddress":"北京市昌平区1号"},{"WarehouseAddress":"","ValidTo":"20210701","ValidFrom":"20210531","Principal":"张三","other6":null,"other5":null,"other4":null,"LicenseType":"09","IssueAuthority":"测试","Exclusive1":"","Exclusive":"","DiagnosisScope":"","BusLicenseNo":"code123456","BusinessType":"不带有存储设施的经营","BusinessScope1":"","BusinessScope":"过乙酸[含量≤16%,含水≥39%,含乙酸≥15%,含过氧化氢≤24%,含稳定剂]","BusinessAddress":"北京市昌平区1号"}],"Incorporator":"张三","Fax":"","CustomerService":null,"Contract_Info":[{"TermContractNo":"154P-HD062","SelableProduct":"阿西赛多","SalesState":"上海市","SalesShopClass":"产品","SalesSection":"统括本部","SalesCity":"上海市","DealerdiscountZF":null,"DealerdiscountURO":null,"DealerdiscountSP":null,"DealerdiscountOTH":null,"DealerdiscountGYN":null,"DealerdiscountGS":null,"DealerdiscountGI":null,"DealerdiscountET":null,"DealerdiscountENG":null,"DealerdiscountENF":null,"DealerdiscountBF":null,"DealerdiscountAH":null,"ContractStartDate":"20210401","ContractOwner":"comlan_ctec_zhangbo","ContractEndDate":"20220331","ContractDepartmentClass":null,"ContractDecideStartDate":"20210401","ContractDecideEndDate":"20220331","BusinessAssistant":null,"AimPriceSP":null,"AimPriceGIR":null,"AimPriceAreaSP":null,"AimPriceAreaET":null,"AimPriceAreaENG":null,"AimPriceAH":null,"AimPrice":null,"AimDivision":"金额","AgencyApplicationNo":"MSHTYXGHD202106005","AgencyApplicationDay":"20210616"}],"Consignee_Info":[{"PostalCode":"111101","ContactPhone":"15611778700","ContactName":"码图测试收货人信息变更","ContactCity":"北京","ContactAddress":"北京市朝阳区亮马桥"}],"CompanyName":"阿西赛多复测0616","CompanyCode":"5112","Comment":"同意","CNTag":"","City":"昌平区","BPType":"02","BPCode":"31416","BillingType":"2B","BillingTelephone":"15611778796","BillingAddress":"北京市昌平区2号","BankName":"工商银行","BankCode":"12345678909876","AuthorizedVT":null,"AuthorizedVF":null,"AuthorizedScope":"","Authorized_Info":[],"Approver":"李岳洋","ApproveDate":"20210616","ApplyType":"1","Agreement4":null,"Agreement3":null,"Agreement2":null,"Agreement1":null,"AgentValidTo":"20210701","AgentValidFrom":"20210601","AgentType":"02"}]}'; //String JsonMsg = '{"Monitoring":{"TransmissionDateTime":"201812201320","Text":"","Tag":"MSGH","Sender":"SFDC","Receiver":"SPO","NumberOfRecord":"1","MessageType":"NFM203","MessageGroupNumber":"20180001722190"},"Partners":[{"Z3PLTransAgrNo":"","Z3PLQualityAgrNo":"","Z3PLAuthorizedNo":"","TransAgrVT":null,"TransAgrVF":null,"TaxNo":"12345678909855","ServiceType":null,"Remark":"","RegisterAddress":"1号","RegionName":"北京市","Region":"10","QualityAgrNoVT":null,"QualityAgrNoVF":null,"Postal":"111100","Phone":"15611778799","other3":null,"other2":null,"other1":null,"OperationProject":null,"License_Info":[{"WarehouseAddress":null,"ValidTo":"20210731","ValidFrom":"20210601","Principal":"张三","other6":null,"other5":null,"other4":null,"LicenseType":"01","IssueAuthority":null,"Exclusive1":null,"Exclusive":null,"DiagnosisScope":null,"BusLicenseNo":"code123456","BusinessType":null,"BusinessScope1":"医疗器械","BusinessScope":null,"BusinessAddress":"北京市昌平区1号"},{"WarehouseAddress":"","ValidTo":"20210701","ValidFrom":"20210531","Principal":"张三","other6":null,"other5":null,"other4":null,"LicenseType":"09","IssueAuthority":"测试","Exclusive1":"","Exclusive":"","DiagnosisScope":"","BusLicenseNo":"code123456","BusinessType":"不带有存储设施的经营","BusinessScope1":"","BusinessScope":"过乙酸[含量≤16%,含水≥39%,含乙酸≥15%,含过氧化氢≤24%,含稳定剂]","BusinessAddress":"北京市昌平区1号"}],"Incorporator":"张三","Fax":"","CustomerService":null,"Contract_Info":[{"TermContractNo":"154P-HD062","SelableProduct":"阿西赛多","SalesState":"上海市","SalesShopClass":"产品","SalesSection":"统括本部","SalesCity":"上海市","DealerdiscountZF":null,"DealerdiscountURO":null,"DealerdiscountSP":null,"DealerdiscountOTH":null,"DealerdiscountGYN":null,"DealerdiscountGS":null,"DealerdiscountGI":null,"DealerdiscountET":null,"DealerdiscountENG":null,"DealerdiscountENF":null,"DealerdiscountBF":null,"DealerdiscountAH":null,"ContractStartDate":"20210401","ContractOwner":"comlan_ctec_zhangbo","ContractEndDate":"20220331","ContractDepartmentClass":null,"ContractDecideStartDate":"20210401","ContractDecideEndDate":"20220331","BusinessAssistant":null,"AimPriceSP":null,"AimPriceGIR":null,"AimPriceAreaSP":null,"AimPriceAreaET":null,"AimPriceAreaENG":null,"AimPriceAH":null,"AimPrice":null,"AimDivision":"金额","AgencyApplicationNo":"MSHTYXGHD202106005","AgencyApplicationDay":"20210616"}],"CompanyName":"阿西赛多复测0616","CompanyCode":"5112","Comment":"同意","CNTag":"","City":"昌平区","BPType":"02","BPCode":"31416","BillingType":"2B","BillingTelephone":"15611778796","BillingAddress":"北京市昌平区2号","BankName":"工商银行","BankCode":"12345678909876","AuthorizedVT":null,"AuthorizedVF":null,"AuthorizedScope":"","Authorized_Info":[],"Approver":"李岳洋","ApproveDate":"20210616","ApplyType":"1","Agreement4":null,"Agreement3":null,"Agreement2":null,"Agreement1":null,"AgentValidTo":"20210701","AgentValidFrom":"20210601","AgentType":"02"}]}'; req.requestURI = 'services/apexrest/NFM203/execute'; req.httpMethod = 'POST'; req.requestBody = Blob.valueof(JsonMsg); RestContext.request = req; RestContext.response= res; NFM203Rest.execute(); Test.stopTest(); } // 契约延长 @isTest static void test_method_ProtocolExtension() { ControllerUtil.EscapeNFM001Trigger = true; inittransfersData(); List rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; if (rectCo.size() == 0) { return; } List rectContract = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '契約']; if (rectCo.size() == 0) { return; } //经销商 Account myAccount1 = new Account(name='Testaccount001', Dealer_discount__c =20, RecordTypeId = rectCo[0].Id); insert myAccount1; //经销商有效合同 Account myAccount2 = new Account(name='Testaccount002', RecordTypeId = rectContract[0].Id, Contract_Decide_Start_Date__c = Date.today().addDays(-1), Contract_Decide_End_Date__c =Date.today().addDays(1), Agent_Ref__c =myAccount1.Id, ParentId =myAccount1.Id, Term_Contract_No__c = '151P-HD519', City_Master__c = al2.Id); insert myAccount2; NFM203Rest.GeDatas GeDatas = new NFM203Rest.GeDatas(); NFM203Rest.GeData GeData = new NFM203Rest.GeData(); NFM203Rest.License_Info License_Info = new NFM203Rest.License_Info(); NFM203Rest.Consignee_Info Consignee_Info = new NFM203Rest.Consignee_Info(); NFM203Rest.Authorized_Info Authorized_Info = new NFM203Rest.Authorized_Info(); NFM203Rest.Contract_Info Contract_Info = new NFM203Rest.Contract_Info(); GeDatas.Partners = new NFM203Rest.GeData[]{GeData}; GeData.License_Info = new NFM203Rest.License_Info[]{License_Info}; GeData.Consignee_Info = new NFM203Rest.Consignee_Info[]{Consignee_Info}; GeData.Contract_Info = new NFM203Rest.Contract_Info[]{Contract_Info}; GeData.Authorized_Info = new NFM203Rest.Authorized_Info[]{Authorized_Info}; Datetime nowDT = Datetime.now(); String nowStr = nowDT.format('yyyyMMddHHmm'); GeDatas.Monitoring = new NFMUtil.Monitoring(); GeDatas.Monitoring.MessageGroupNumber = nowStr + '01'; GeData.Z3PLTransAgrNo = ''; GeData.Z3PLQualityAgrNo = ''; GeData.Z3PLAuthorizedNo = ''; GeData.TransAgrVT = null; GeData.TransAgrVF= null; GeData.TaxNo = '12412412'; GeData.ServiceType = null; GeData.Remark = ''; GeData.RegisterAddress = '宁国路313弄9号龙泽大厦1601-1603室'; GeData.RegionName = al.Name; GeData.Region = '20'; GeData.QualityAgrNoVT = null; GeData.QualityAgrNoVF = null; GeData.Postal = ''; GeData.Phone = ''; GeData.other3 = null; GeData.other2 = null; GeData.other1 = null; GeData.OperationProject = null; GeData.CompanyName = '上海培源医疗器械有限公司-测试已有新建2903'; GeData.CompanyCode = '5112'; GeData.CNTag = ''; GeData.City = al2.Name; GeData.BPType = '02'; GeData.BPCode = '30022'; GeData.BankName = '中国银行'; GeData.BankCode = '12312412412412'; GeData.AuthorizedVT = null; GeData.AuthorizedVF = null; GeData.AuthorizedScope = ''; GeData.ApplyType = '9'; GeData.Agreement4 = null; GeData.Agreement3 = null; GeData.Agreement2 = null; GeData.Agreement1 = null; GeData.AgentValidTo = '20260331'; GeData.AgentValidFrom = '20161101'; GeData.AgentType = '01'; Contract_Info.DealerdiscountZF = null ; Contract_Info.DealerdiscountURO = null ; Contract_Info.DealerdiscountSP = null ; Contract_Info.DealerdiscountOTH = null ; Contract_Info.DealerdiscountGS = null ; Contract_Info.DealerdiscountGI = null ; Contract_Info.DealerdiscountET = 10.0 ; Contract_Info.DealerdiscountENG = null ; Contract_Info.DealerdiscountENF = null ; Contract_Info.DealerdiscountBF = null ; Contract_Info.DealerdiscountAH = null ; Contract_Info.ContractDecideStartDate = '20180522' ; Contract_Info.ContractDecideEndDate = '20220522' ; Contract_Info.BusinessAssistant = null ; Contract_Info.AimPriceAreaSP = null ; Contract_Info.AimPriceAreaET = null ; Contract_Info.TermContractNo = '151P-HD519' ; Contract_Info.SelableProduct = '' ; Contract_Info.SalesState = '上海市' ; Contract_Info.SalesShopClass = '区域' ; Contract_Info.SalesSection = '测试本部' ; Contract_Info.DealerdiscountGYN = 90.0; Contract_Info.ContractStartDate = '20181201' ; Contract_Info.ContractOwner = 'ocm99999' ; Contract_Info.ContractEndDate = '20201231' ; Contract_Info.ContractDepartmentClass = 'GYN;' ; Contract_Info.AimPriceSP = 200000.0 ; Contract_Info.AimPriceGIR = 160000.0 ; Contract_Info.AimPriceAreaENG = 200000.0 ; Contract_Info.AimPriceAH = 0.0 ; Contract_Info.AimPrice = '360000.0' ; Contract_Info.AimDivision = '金额' ; Contract_Info.AgencyApplicationNo = 'MSHTYXQHD201812005' ; Contract_Info.AgencyApplicationDay = '20181207' ; System.Test.startTest(); NFMUtil.Monitoring Monitoring = GeDatas.Monitoring; BatchIF_Log__c rowData = NFMUtil.saveRowData(Monitoring, 'NFM203', GeDatas.Partners); NFM203Rest.main(rowData.Id); System.Test.stopTest(); } }