From 1b73d255ea81d4c82e568cc7d7dcec5badae7f85 Mon Sep 17 00:00:00 2001
From: 张宇恒 <bxyun0@163.com>
Date: 星期五, 01 四月 2022 08:53:31 +0800
Subject: [PATCH] 彭坤部分
---
force-app/main/default/classes/InquiryFormManageController.cls-meta.xml | 5 +
force-app/main/default/classes/InquiryFormManageControllerTest.cls | 75 +++++++++++++++++++++++++
force-app/main/default/classes/InquiryFormManageController.cls | 55 ++++++++++++++++++
force-app/main/default/classes/InquiryFormManageControllerTest.cls-meta.xml | 5 +
4 files changed, 140 insertions(+), 0 deletions(-)
diff --git a/force-app/main/default/classes/InquiryFormManageController.cls b/force-app/main/default/classes/InquiryFormManageController.cls
new file mode 100644
index 0000000..19d9c10
--- /dev/null
+++ b/force-app/main/default/classes/InquiryFormManageController.cls
@@ -0,0 +1,55 @@
+/**
+ * 2022-02-23 mzy
+ * 鍏遍�氬钩鍙� - 棣栭〉鎻愰啋
+ * 鏅烘収鍖荤枟 - 棣栭〉鎻愰啋
+ * 姹囨�讳竴涓嬫垜鐨勫緟璺熻繘鐨勫挩璇㈠崟鏁伴噺
+ */
+public with sharing class InquiryFormManageController {
+ public InquiryFormManageController() {
+
+ }
+
+ //鏌ヨ褰撳墠鐧诲綍浜烘墍鑳芥煡鐪嬪埌鐨勭鍚堣姹傜殑鍜ㄨ鍗�
+ public static InquiryFormView getCurrentInquiryInform(){
+
+ List<Inquiry_form__c> AllInquiryForm = goSelectByCurrentUser();
+
+ InquiryFormView MyInquiryForm = new InquiryFormView();
+ if(AllInquiryForm.size()>0){
+ MyInquiryForm.InquiryFormList = AllInquiryForm;
+ MyInquiryForm.isShow = true;
+ }
+ return MyInquiryForm;
+ }
+
+ //鏍规嵁褰撳墠鐢ㄦ埛鏌ユ壘鍜ㄨ鍗�
+ public static List<Inquiry_form__c> goSelectByCurrentUser(){
+ //瀹氫箟List灏佽鏌ヨ缁撴灉
+ List<Inquiry_form__c> AllInquiryForm = new List<Inquiry_form__c>();
+ //鏌ヨ
+ String query = 'SELECT id ';
+ query += 'FROM Inquiry_form__c ';
+ //鐘舵�� 涓� 鏈窡杩�
+ query += 'WHERE Status__c = \'01.鏈窡杩沑' ';
+ //鎵�鏈変汉 涓� 褰撳墠鐧诲綍浜�
+ query += 'AND OwnerId = \''+UserInfo.getUserId()+'\'';
+
+ AllInquiryForm = Database.query(query);
+
+ return AllInquiryForm;
+ }
+
+ public class InquiryFormView {
+ //鏄惁鏄剧ず
+ @AuraEnabled
+ public Boolean isShow;
+ //鏌ヨ缁撴灉
+ @AuraEnabled
+ public List<Inquiry_form__c> InquiryFormList;
+
+ public InquiryFormView(){
+ this.isShow = false;
+ this.InquiryFormList = new List<Inquiry_form__c>();
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/InquiryFormManageController.cls-meta.xml b/force-app/main/default/classes/InquiryFormManageController.cls-meta.xml
new file mode 100644
index 0000000..dd61d1f
--- /dev/null
+++ b/force-app/main/default/classes/InquiryFormManageController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>52.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/InquiryFormManageControllerTest.cls b/force-app/main/default/classes/InquiryFormManageControllerTest.cls
new file mode 100644
index 0000000..4987324
--- /dev/null
+++ b/force-app/main/default/classes/InquiryFormManageControllerTest.cls
@@ -0,0 +1,75 @@
+@isTest
+public class InquiryFormManageControllerTest {
+
+ static testMethod void testMethod1() {
+ ControllerUtil.EscapeNFM001Trigger = true;
+ ControllerUtil.EscapeMaintenanceContractAfterUpdateTrigger = true;
+ StaticParameter.EscapeNFM001Trigger = true;
+ StaticParameter.EscapeNFM001AgencyContractTrigger = true;
+ StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
+ StaticParameter.EscapeMaintenanceContractAfterUpdateTrigger = true;
+ //鍖婚櫌
+ 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;
+
+
+ Inquiry_form__c inquiryform = new Inquiry_form__c();
+ // inquiryform.Name = '2019102101';
+ inquiryform.Hospital_Name__c = dpt1.Id;
+ List<Account> dpecList = [select Id,Department_Class__c from Account where Id =: dpt1.Id];
+ inquiryform.Department_Class__c = dpecList[0].Department_Class__c;
+ inquiryform.Status__c ='01.鏈窡杩�';
+ inquiryform.Company__c ='鍖椾含鏌愭煇鏌愭祴璇曞叕鍙�';
+ inquiryform.Family_Name__c ='闈�';
+ inquiryform.Opportunity_Division__c = '璇环';
+ inquiryform.Phone__c = '13844756322';
+ inquiryform.Product1__c = '瓒呭0';
+ inquiryform.Request1__c = '闇�瑕佹姤浠�';
+ Test.startTest();
+ insert inquiryform;
+
+ InquiryFormManageController.getCurrentInquiryInform();
+ Test.stopTest();
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/InquiryFormManageControllerTest.cls-meta.xml b/force-app/main/default/classes/InquiryFormManageControllerTest.cls-meta.xml
new file mode 100644
index 0000000..dd61d1f
--- /dev/null
+++ b/force-app/main/default/classes/InquiryFormManageControllerTest.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>52.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
--
Gitblit v1.9.1