From e14d6d0619330cad423f06493e3aa2371faa2a8f Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期六, 09 九月 2023 14:02:23 +0800
Subject: [PATCH] Sit期间修改

---
 force-app/main/default/classes/MonthlyReportController.cls |   40 +++++++++++++++++++++++++---------------
 1 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/force-app/main/default/classes/MonthlyReportController.cls b/force-app/main/default/classes/MonthlyReportController.cls
index a68b5da..3cee8e6 100644
--- a/force-app/main/default/classes/MonthlyReportController.cls
+++ b/force-app/main/default/classes/MonthlyReportController.cls
@@ -1,10 +1,12 @@
 public with sharing class MonthlyReportController {
+    //涓哄彇娑堟彁浜ょ浉搴旂殑js鎻愪緵鍒濆鍖栨暟鎹�
     @AuraEnabled
     public static InitData initForCancelSubmitButton (String recordId){
         InitData res = new initData();
         try{
             Monthly_Report__c report = [SELECT 	OwnerId,Id,Next_week_plan__c FROM Monthly_Report__c WHERE Id = :recordId LIMIT 1];
-            res.OwnerId = report.OwnerId;
+            res.ownerId = report.OwnerId;
+            res.userId = UserInfo.getUserId();
             res.Id = report.Id;
             res.nextWeekPlan = report.Next_week_plan__c;
             System.debug(LoggingLevel.INFO, '*** res: ' + res);
@@ -14,7 +16,7 @@
         return res;
     }
 
-
+    //涓哄垱寤簄otes閭鎿嶄綔鎻愪緵鍒濆鍖栨暟鎹�
     @AuraEnabled
     public static InitData initForCreateNoteEmailButton (String recordId) {
         InitData res = new initData();
@@ -26,8 +28,7 @@
             Feedback__c,
             Task_follow__c,
             Other_issue__c,
-            Next_week_plan__c,
-            Dr_Sum_URL__c
+            Next_week_plan__c
             FROM Monthly_Report__c WHERE Id = :recordId LIMIT 1];
             String userName = UserInfo.getUserName();
             User activeUser = [Select Email From User where Username = : userName limit 1];
@@ -39,31 +40,38 @@
             res.taskFollow = report.Task_follow__c;
             res.otherIssue = report.Other_issue__c;
             res.nextWeekPlan = report.Next_week_plan__c;
-            res.drSumUrl = report.Dr_Sum_URL__c;
             res.userEmail = activeUser.Email;
-            
             System.debug(LoggingLevel.INFO, '*** res: ' + res);
         }catch(Exception e){
             System.debug(LoggingLevel.INFO, '*** e: ' + e);
         }
         return res;
     }
-
+    //鍙栨秷鎻愪氦鎿嶄綔鏇存柊鐩稿簲鏁版嵁
     @AuraEnabled
-    public static void cancel(String recordId) {
+    public static String cancel(String recordId) {
        try {
         Monthly_Report__c report = [SELECT 	Id,Status__c,Submit_check_flag__c,RecordTypeId,Submit_time__c FROM Monthly_Report__c WHERE Id = :recordId LIMIT 1];
-        report.Status__c = '鑽夋涓�';
-        report.RecordTypeId = '01210000000Qggf';
+        report.Status__c = LightingButtonConstant.STATUS_DRAFT;
+        report.RecordTypeId =  Schema.SObjectType.Monthly_Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_BY_MONTHLY_REPORT).getRecordTypeId();
         report.Submit_check_flag__c = false;
         report.Submit_time__c = null;
         update report;
+        return null;
        } catch (Exception e) {
-        System.debug(LoggingLevel.INFO, '*** e: ' + e);
-       } finally {
-
+        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();   
+        }
        }
-
     }
 
 
@@ -71,7 +79,7 @@
         @AuraEnabled
         public String Id;
         @AuraEnabled
-        public String OwnerId;
+        public String ownerId;
         @AuraEnabled
         public String ownerEmail;
         @AuraEnabled
@@ -90,5 +98,7 @@
         public String drSumUrl;
         @AuraEnabled
         public String userEmail;
+        @AuraEnabled
+        public String userId;
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1