From 1727a4f4d02e429475608e60f142a63bc24127bc Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期一, 23 十月 2023 10:07:34 +0800
Subject: [PATCH] 近期修改

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

diff --git a/force-app/main/default/classes/OpportunityLightingButtonController.cls b/force-app/main/default/classes/OpportunityLightingButtonController.cls
index 03f0d91..d20d964 100644
--- a/force-app/main/default/classes/OpportunityLightingButtonController.cls
+++ b/force-app/main/default/classes/OpportunityLightingButtonController.cls
@@ -4,7 +4,7 @@
  * @Author: chen jing wu
  * @Date: 2023-04-12 11:16:07
  * @LastEditors: chen jing wu
- * @LastEditTime: 2023-10-10 17:08:13
+ * @LastEditTime: 2023-10-19 16:29:00
  */
 public with sharing class OpportunityLightingButtonController {
     @AuraEnabled
@@ -462,7 +462,8 @@
                 SI_Decide_ID__c,
                 Name,
                 Opportunity_No__c,
-                IsAuthorized__c
+                IsAuthorized__c,
+                recordTypeId
                 from Opportunity where Id =: recordId
             ];
             res.authorizedDBNo = oppo.Authorized_DB_No__c;
@@ -471,6 +472,7 @@
             res.name = oppo.Name;
             res.opportunityNo = oppo.Opportunity_No__c;
             res.isAuthorized = oppo.IsAuthorized__c;
+            res.recordTypeId = oppo.recordTypeId;
         } catch (Exception e) {
             
         }
@@ -598,7 +600,7 @@
             update opp;
             return null;
         } catch (Exception e) {
-            return errorMessage(e);
+            return e.getDmlMessage(0);
         }
     }
     @AuraEnabled
@@ -610,7 +612,7 @@
             update opp;
             return null;
         } catch (Exception e) {
-            return errorMessage(e);
+            return e.getDmlMessage(0);
         }
     }
     @AuraEnabled
@@ -624,7 +626,7 @@
             update opp;
             return null;
         } catch (Exception e) {
-            return errorMessage(e);
+            return e.getDmlMessage(0);
         }
     }
     @AuraEnabled
@@ -640,7 +642,7 @@
             update opp;
             return null;
         } catch (Exception e) {
-            return errorMessage(e);
+            return e.getDmlMessage(0);
         }
     }
     @AuraEnabled
@@ -770,7 +772,7 @@
             processResults.add(Approval.process(request));
             return processResults[0].errors;
         } catch (Exception e) {
-            return errorMessage(e);
+            return e.getDmlMessage(0);
         }
     }
     @AuraEnabled
@@ -784,7 +786,7 @@
             ];
             return user.Id;
         } catch (Exception e) {
-            return errorMessage(e);
+            return e.getDmlMessage(0);
         }
     }
     @AuraEnabled
@@ -798,7 +800,7 @@
             ];
             return pro.Id;
         } catch (Exception e) {
-            return errorMessage(e);
+            return e.getDmlMessage(0);
         }
     }
     @AuraEnabled
@@ -943,25 +945,29 @@
             return '1';     
         } catch (Exception ex) {
             Database.rollback(sp);
-            return errorMessage(ex);
+            return ex.getDmlMessage(0);
         }
     }
-
-    public static string errorMessage(Exception e){
-        if (e.getMessage().contains(',')) {
-            System.debug(LoggingLevel.INFO, '*** e: ' + e);
-            String exc = '' + e.getMessage();
-            Integer left = exc.indexOf(':') + 1;
-            Integer right = exc.lastIndexOf(':');
-            String str = exc.substring(left,right);
-            left = str.indexOf(',') +  1;
-            String newStr = str.substring(left);
-            return newStr;
-        }else {
-            return e.getMessage();   
+    @AuraEnabled
+    public static Boolean queryLostReport (String recordId){
+        RecordType recordType1 = [select Id from RecordType where Name = '璇环鍙栨秷鎶ュ憡'];
+        List<Lost_cancel_report__c> repList = [select Id from Lost_cancel_report__c where Opportunity__c =: recordId and RecordTypeId !=: recordType1.Id];
+        if(repList.size() > 0){
+            return true;
         }
-
+        return false;
     }
+
+    @AuraEnabled
+    public static Boolean queryCancelReport (String recordId){
+        RecordType recordType1 = [select Id from RecordType where Name = '璇环鍙栨秷鎶ュ憡'];
+        List<Lost_cancel_report__c> repList = [select Id from Lost_cancel_report__c where Opportunity__c =: recordId and RecordTypeId =: recordType1.Id];
+        if(repList.size() > 0){
+            return true;
+        }
+        return false;
+    }
+
     public class InitData{
         @AuraEnabled
         public Boolean directLossFLG;

--
Gitblit v1.9.1