From 2c4649009ce262ecbd5f299ba6fb407621a7962c Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期日, 23 四月 2023 17:42:10 +0800
Subject: [PATCH] 修改按钮以及页面所需controller

---
 force-app/main/default/classes/OpportunityLightingButtonController.cls |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/classes/OpportunityLightingButtonController.cls b/force-app/main/default/classes/OpportunityLightingButtonController.cls
index f3274d0..4a95a61 100644
--- a/force-app/main/default/classes/OpportunityLightingButtonController.cls
+++ b/force-app/main/default/classes/OpportunityLightingButtonController.cls
@@ -362,6 +362,31 @@
         return res;
     }
     @AuraEnabled
+    public static InitData initForOpporSpliteButton(String recordId){
+        InitData res = new InitData();
+        try {
+            Opportunity oppo = [
+                select
+                Authorized_DB_No__c,
+                Estimation_Decision__c,
+                SI_Decide_ID__c,
+                Name,
+                Opportunity_No__c,
+                IsAuthorized__c
+                from Opportunity where Id =: recordId
+            ];
+            res.authorizedDBNo = oppo.Authorized_DB_No__c;
+            res.estimationDecision = oppo.Estimation_Decision__c;
+            res.siDecideID = oppo.SI_Decide_ID__c;
+            res.name = oppo.Name;
+            res.opportunityNo = oppo.Opportunity_No__c;
+            res.isAuthorized = oppo.IsAuthorized__c;
+        } catch (Exception e) {
+            throw new AuraHandledException(e.getMessage());
+        }
+        return res;
+    }
+    @AuraEnabled
     public static string updateForAgencyAuthorizeButton(String recordId){
         try {
             Opportunity opp = new Opportunity();
@@ -547,6 +572,21 @@
         }
         return fields;
     }
+    @AuraEnabled
+    public static Object submitProcess(String opportunityId) {
+        try {
+            Approval.ProcessSubmitRequest request = new Approval.ProcessSubmitRequest();
+            request.setObjectId(opportunityId);
+            Approval.ProcessResult[] processResults = new Approval.ProcessResult[] {};
+            processResults.add(Approval.process(request));
+            return processResults[0].errors;
+        } catch (Exception e) {
+            String eMessage = e.getMessage();
+            Integer left = eMessage.indexOf(',') + 1;
+            Integer right = eMessage.length();
+            return eMessage.substring(left,right);
+        }
+    }
     public class InitData{
         @AuraEnabled
         public Boolean directLossFLG;
@@ -642,5 +682,11 @@
         public String opportunityCategory;
         @AuraEnabled
         public String agency1Name;
+        @AuraEnabled
+        public String authorizedDBNo;
+        @AuraEnabled
+        public String siDecideID;
+        @AuraEnabled
+        public String opportunityNo;
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1