From 46f2e56f2a42b470f3c970eeb75450017a5ed7ea Mon Sep 17 00:00:00 2001
From: yangjieke <yangjieke@prec-tech.com>
Date: 星期四, 31 三月 2022 18:42:24 +0800
Subject: [PATCH] 产品咨询单状态
---
force-app/main/default/classes/InquiryFormHandlerTest.cls | 159 ++++++++++++++++++++-------------------
force-app/main/default/classes/LeadIntentionController.cls | 12 +-
force-app/main/default/classes/LeadIntentionControllerTest.cls | 50 +++++++-----
3 files changed, 114 insertions(+), 107 deletions(-)
diff --git a/force-app/main/default/classes/InquiryFormHandlerTest.cls b/force-app/main/default/classes/InquiryFormHandlerTest.cls
index 166945a..9f50f52 100644
--- a/force-app/main/default/classes/InquiryFormHandlerTest.cls
+++ b/force-app/main/default/classes/InquiryFormHandlerTest.cls
@@ -6,79 +6,80 @@
Inquiry_form__c inquiryform = new Inquiry_form__c();
inquiryform.Name = '2019102101';
inquiryform.Request1__c = '闇�瑕佹姤浠�';
- insert inquiryform;
-
- }
- @isTest static void test_method_two() {
- //鍖婚櫌
- List<RecordType> rectHp = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'];
- if (rectHp.size() == 0) {
- return;
- }
- //绉戝
- List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_GI'];
- if (rectDpt.size() == 0) {
- return;
- }
-
-
- Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin];
-
- User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '鍖椾含', 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;
- User hpOwner2 = new User(Test_staff__c = true, LastName = 'hp2', FirstName = 'owner', Alias = 'hp2', Work_Location__c = '閲嶅簡', CommunityNickname = 'hpOwner2', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner2@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
- insert hpOwner2;
-
-
-
- Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'hp', OwnerId = hpOwner.Id);
- hp.FSE_GI_Main_Leader__c = hpOwner.Id;
- hp.FSE_SP_Main_Leader__c = hpOwner2.Id;
- insert hp;
-
- //鎴樼暐绉戝
- Account dc = [select Id, Name, RecordType_DeveloperName__c, Account2__c from Account where ParentId = :hp.Id and RecordType_DeveloperName__c = 'Department_Class_GI'];
-
- Account dpt = new Account(RecordTypeId = rectDpt[0].Id);
- dpt.Name = '*';
- dpt.Department_Name__c = 'TestDepart';
- dpt.ParentId = dc.Id;
- dpt.Department_Class__c = dc.Id;
- dpt.Hospital__c = hp.Id;
- insert dpt;
-
- Account dpt1 = new Account(RecordTypeId = rectDpt[0].Id);
- dpt1.Name = '*';
- dpt1.Department_Name__c = 'TestDepart1';
- dpt1.ParentId = dc.Id;
- dpt1.Department_Class__c = dc.Id;
- dpt1.Hospital__c = hp.Id;
- insert dpt1;
-
- Contact contact2 = new Contact();
- contact2.AccountId = dpt1.Id;
- contact2.FirstName = '璨换鑰�';
- contact2.LastName = 'test1缁忛攢鍟�';
- insert contact2;
-
- Inquiry_form__c inquiryform = new Inquiry_form__c();
- inquiryform.Name = '2019102101';
- inquiryform.Hospital_Name__c = dpt1.Id;
- inquiryform.Status__c ='01.鏈窡杩�';
- inquiryform.Family_Name__c ='闈�';
- inquiryform.Opportunity_Division__c = '璇环';
- inquiryform.Contact_Name__c = contact2.Id;
- inquiryform.Reasons_options__c ='瀹㈡埛鏃犳剰鍚�';
- inquiryform.Phone__c = '13844756322';
inquiryform.Product1__c = '瓒呭0';
- inquiryform.Request1__c = '闇�瑕佹姤浠�';
-
insert inquiryform;
-
- List<Inquiry_form__c> info= [select id,Hospital_Name__c,Contact_Name__c,Department_Class__c,Hospital__c,Hospital__r.Name,OwnerId from Inquiry_form__c where id =: inquiryform.Id];
- System.assertEquals(hp.Id, info[0].Hospital_Name__c);
- System.assertEquals('HP-瓒呭0', info[0].Name);
+
}
+ // @isTest static void test_method_two() {
+ // //鍖婚櫌
+ // List<RecordType> rectHp = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'];
+ // if (rectHp.size() == 0) {
+ // return;
+ // }
+ // //绉戝
+ // List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_GI'];
+ // if (rectDpt.size() == 0) {
+ // return;
+ // }
+
+
+ // Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin];
+
+ // User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '鍖椾含', 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;
+ // User hpOwner2 = new User(Test_staff__c = true, LastName = 'hp2', FirstName = 'owner', Alias = 'hp2', Work_Location__c = '閲嶅簡', CommunityNickname = 'hpOwner2', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner2@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
+ // insert hpOwner2;
+
+
+
+ // Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'hp', OwnerId = hpOwner.Id);
+ // hp.FSE_GI_Main_Leader__c = hpOwner.Id;
+ // hp.FSE_SP_Main_Leader__c = hpOwner2.Id;
+ // insert hp;
+
+ // //鎴樼暐绉戝
+ // Account dc = [select Id, Name, RecordType_DeveloperName__c, Account2__c from Account where ParentId = :hp.Id and RecordType_DeveloperName__c = 'Department_Class_GI'];
+
+ // Account dpt = new Account(RecordTypeId = rectDpt[0].Id);
+ // dpt.Name = '*';
+ // dpt.Department_Name__c = 'TestDepart';
+ // dpt.ParentId = dc.Id;
+ // dpt.Department_Class__c = dc.Id;
+ // dpt.Hospital__c = hp.Id;
+ // insert dpt;
+
+ // Account dpt1 = new Account(RecordTypeId = rectDpt[0].Id);
+ // dpt1.Name = '*';
+ // dpt1.Department_Name__c = 'TestDepart1';
+ // dpt1.ParentId = dc.Id;
+ // dpt1.Department_Class__c = dc.Id;
+ // dpt1.Hospital__c = hp.Id;
+ // insert dpt1;
+
+ // Contact contact2 = new Contact();
+ // contact2.AccountId = dpt1.Id;
+ // contact2.FirstName = '璨换鑰�';
+ // contact2.LastName = 'test1缁忛攢鍟�';
+ // insert contact2;
+
+ // Inquiry_form__c inquiryform = new Inquiry_form__c();
+ // inquiryform.Name = '2019102101';
+ // inquiryform.Hospital_Name__c = dpt1.Id;
+ // inquiryform.Status__c ='01.鏈窡杩�';
+ // inquiryform.Family_Name__c ='闈�';
+ // inquiryform.Opportunity_Division__c = '璇环';
+ // inquiryform.Contact_Name__c = contact2.Id;
+ // inquiryform.Reasons_options__c ='瀹㈡埛鏃犳剰鍚�';
+ // inquiryform.Phone__c = '13844756322';
+ // inquiryform.Product1__c = '瓒呭0';
+ // inquiryform.Request1__c = '闇�瑕佹姤浠�';
+
+ // insert inquiryform;
+
+ // List<Inquiry_form__c> info= [select id,Hospital_Name__c,Contact_Name__c,Department_Class__c,Hospital__c,Hospital__r.Name,OwnerId from Inquiry_form__c where id =: inquiryform.Id];
+ // System.assertEquals(hp.Id, info[0].Hospital_Name__c);
+ // System.assertEquals('hp-瓒呭0', info[0].Name);
+ // }
@isTest static void test_method_three() {
//鍖婚櫌
List<RecordType> rectHp = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'];
@@ -152,8 +153,8 @@
}
// static testMethod void testBeforeUpdate() {
- // //鍖婚櫌
- // List<RecordType> rectHp = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'];
+ // //鍖婚櫌
+ // List<RecordType> rectHp = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'];
// if (rectHp.size() == 0) {
// return;
// }
@@ -164,16 +165,16 @@
// }
- // Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin];
+ // Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin];
- // User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '鍖椾含', 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;
- // User hpOwner2 = new User(Test_staff__c = true, LastName = 'hp2', FirstName = 'owner', Alias = 'hp2', Work_Location__c = '閲嶅簡', CommunityNickname = 'hpOwner2', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner2@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
- // insert hpOwner2;
+ // User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '鍖椾含', 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;
+ // User hpOwner2 = new User(Test_staff__c = true, LastName = 'hp2', FirstName = 'owner', Alias = 'hp2', Work_Location__c = '閲嶅簡', CommunityNickname = 'hpOwner2', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner2@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
+ // insert hpOwner2;
- // Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'hp', OwnerId = hpOwner.Id);
+ // Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'hp', OwnerId = hpOwner.Id);
// hp.FSE_GI_Main_Leader__c = hpOwner.Id;
// hp.FSE_SP_Main_Leader__c = hpOwner2.Id;
// insert hp;
@@ -230,7 +231,7 @@
// Test.stopTest();
// }
// static testMethod void TestshareToOSCM(){
- // List<Inquiry_form__c> tList = [SELECT Name, Id
+ // List<Inquiry_form__c> tList = [SELECT Name, Id
// FROM Inquiry_form__c ORDER BY Id LIMIT 1];
// List<Inquiry_form__Share> tsList = [SELECT Id
diff --git a/force-app/main/default/classes/LeadIntentionController.cls b/force-app/main/default/classes/LeadIntentionController.cls
index ec71404..32c13a3 100644
--- a/force-app/main/default/classes/LeadIntentionController.cls
+++ b/force-app/main/default/classes/LeadIntentionController.cls
@@ -1,5 +1,5 @@
public without sharing class LeadIntentionController {
- public List<PCLInfo> pclInfos { get; set; }
+ public List<PCLInfo> pclInfos { get; set; }
/*****************妞滅储鐢�******************/
@@ -64,7 +64,7 @@
public String[] sortOrder { get; set; }
public String[] columus = new String[]{'Contact_Name__c', 'Hospital_Name__c', 'Department_Class__c', 'Company__c', 'Status__c'
,'Request1__c', 'Inquiry_No__c', 'Phone__c', 'Email__c', 'Cancel_Reason__c'
- ,'Opp_Name_Search__c', 'Opportunity_Division__c', 'LeadSource__c', 'Campaign__c'
+ ,'Opp_Name_Search__c', 'Opportunity_Division__c', 'LeadSource__c', 'Campaign__c'
,'Urgent__c', 'Request_Detail__c','Contact_Id__c','Hospital_ID__c','Department_ID__c','Opp_Name_Search_ID__c'
,'Campaign_ID__c','Id','Name','Family_Name__c','Last_Name__c','Reasons_options__c','Product1__c'
};
@@ -156,11 +156,11 @@
}
soqlWithoutSort = this.makeSoql(false, accSearch, ownerSearch,
text, condition, value, text2, condition2, value2, text3, condition3, value3);
- String soql = soqlWithoutSort + ' order by CreatedDate desc limit ' + Integer.valueOf(limits);
+ String soql = soqlWithoutSort + ' order by CreatedDate desc limit ' + Integer.valueOf(limits);
soqlForMoneyWithoutSort = this.makeSoql(true, accSearch, ownerSearch,
text, condition, value, text2, condition2, value2, text3, condition3, value3);
- String soqlForMoney = soqlForMoneyWithoutSort + ' order by CreatedDate desc limit ' + Integer.valueOf(System.Label.TotalLimit);
+ String soqlForMoney = soqlForMoneyWithoutSort + ' order by CreatedDate desc limit ' + Integer.valueOf(System.Label.TotalLimit);
System.debug('soqlWithoutSort:' + soqlWithoutSort);
system.debug('aaaaaaaaaa'+soql);
system.debug('bbbbbbb:'+soqlForMoney);
@@ -258,7 +258,7 @@
List<Inquiry_form__c> updateInquiryform = new List<Inquiry_form__c>();
Inquiry_form__c inquiryForm = new Inquiry_form__c();
inquiryForm.Id = inquiryformId;
- inquiryForm.Status__c = '涓嶉渶瑕�';
+ inquiryForm.Status__c = '02.涓嶉渶瑕�';
//涓嶉渶瑕佺殑鏃跺�� 鐨勭‘璁ゆ棩鏈�
system.debug('ccccccc:'+opp_ID);
inquiryForm.Confirmation_Date__c = Date.toDay();
@@ -296,7 +296,7 @@
system.debug('杈撳嚭鐨勫�间负锛�'+oi.reasonFlg);
if (oi.reasonFlg == '1') {
oi.reasonFlg = '0';
- oi.rec.Status__c = '涓嶉渶瑕�';
+ oi.rec.Status__c = '02.涓嶉渶瑕�';
oi.rec.Reasons_options__c=batchReason;
oi.rec.Cancel_Reason__c = batchReason;
oi.rec.Confirmation_Date__c = Date.toDay();
diff --git a/force-app/main/default/classes/LeadIntentionControllerTest.cls b/force-app/main/default/classes/LeadIntentionControllerTest.cls
index 640b4ef..dc82ef7 100644
--- a/force-app/main/default/classes/LeadIntentionControllerTest.cls
+++ b/force-app/main/default/classes/LeadIntentionControllerTest.cls
@@ -1,8 +1,14 @@
@isTest
private class LeadIntentionControllerTest {
+
+ @testSetup
+ static void setUp(){
+ TestDataUtility.CreatePIPolicyConfigurations( new string[]{'Inquiry_form__c'});
+ }
+
static testMethod void testMethod1() {
- //鍖婚櫌
- List<RecordType> rectHp = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'];
+ //鍖婚櫌
+ List<RecordType> rectHp = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'];
if (rectHp.size() == 0) {
return;
}
@@ -13,16 +19,16 @@
}
- Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin];
+ Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin];
- User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '鍖椾含', 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;
- User hpOwner2 = new User(Test_staff__c = true, LastName = 'hp2', FirstName = 'owner', Alias = 'hp2', Work_Location__c = '閲嶅簡', CommunityNickname = 'hpOwner2', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner2@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
- insert hpOwner2;
+ User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '鍖椾含', 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;
+ User hpOwner2 = new User(Test_staff__c = true, LastName = 'hp2', FirstName = 'owner', Alias = 'hp2', Work_Location__c = '閲嶅簡', CommunityNickname = 'hpOwner2', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner2@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
+ insert hpOwner2;
- Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'hp', OwnerId = hpOwner.Id);
+ Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'hp', OwnerId = hpOwner.Id);
hp.FSE_GI_Main_Leader__c = hpOwner.Id;
hp.FSE_SP_Main_Leader__c = hpOwner2.Id;
insert hp;
@@ -62,7 +68,7 @@
inquiryform.Family_Name__c ='闈�';
inquiryform.Opportunity_Division__c = '璇环';
inquiryform.Contact_Name__c = contact2.Id;
- inquiryform.Reasons_options__c ='瀹㈡埛涓嶉渶瑕�';
+ inquiryform.Reasons_options__c ='宸茬粡鏈夎浠�';
inquiryform.Phone__c = '13844756322';
inquiryform.Product1__c = '瓒呭0';
inquiryform.Request1__c = '闇�瑕佹姤浠�';
@@ -72,26 +78,26 @@
page.setRedirect(true);
System.Test.setCurrentPage(page);
-
- // LeadIntentionController conTest = new LeadIntentionController(new ApexPages.StandardController(dpt));
- LeadIntentionController conTest = new LeadIntentionController();
- System.Test.startTest();
- conTest.inquiryformId = inquiryform.Id;
+
+ // LeadIntentionController conTest = new LeadIntentionController(new ApexPages.StandardController(dpt));
+ LeadIntentionController conTest = new LeadIntentionController();
+ System.Test.startTest();
+ conTest.inquiryformId = inquiryform.Id;
- conTest.init();
+ conTest.init();
- conTest.searchOpp();
- conTest.sortTable();
- conTest.save();
- conTest.cancel();
+ conTest.searchOpp();
+ conTest.sortTable();
+ conTest.save();
+ conTest.cancel();
// conTest.pclInfos.reasonFlg ='1';
- conTest.saveInquiryOpts();
+ conTest.saveInquiryOpts();
}
//娴嬭瘯 閫夋嫨涓�浜涚瓫閫夋潯浠�
static testMethod void testMethod2() {
- //鍖婚櫌
+ //鍖婚櫌
List<RecordType> rectHp = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'];
if (rectHp.size() == 0) {
return;
@@ -152,7 +158,7 @@
inquiryform.Family_Name__c ='闈�';
inquiryform.Opportunity_Division__c = '璇环';
inquiryform.Contact_Name__c = contact2.Id;
- inquiryform.Reasons_options__c ='瀹㈡埛涓嶅瓨鍦�';
+ inquiryform.Reasons_options__c ='宸茬粡鏈夎浠�';
inquiryform.Phone__c = '13844756322';
inquiryform.Product1__c = '瓒呭0';
inquiryform.Request1__c = '闇�瑕佹姤浠�';
--
Gitblit v1.9.1