From 87861ae5f1ed5456685f97f8a8e7625e47b9576d Mon Sep 17 00:00:00 2001
From: KKbes <1620284052@qq.com>
Date: 星期四, 13 四月 2023 11:12:26 +0800
Subject: [PATCH] Merge branch 'LEX_dev' of http://47.92.229.245:8089/r/lightningupdate into LEX_dev

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

diff --git a/force-app/main/default/classes/MonthlyReportController.cls b/force-app/main/default/classes/MonthlyReportController.cls
new file mode 100644
index 0000000..3822866
--- /dev/null
+++ b/force-app/main/default/classes/MonthlyReportController.cls
@@ -0,0 +1,95 @@
+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.Id = report.Id;
+            res.nextWeekPlan = report.Next_week_plan__c;
+            System.debug(LoggingLevel.INFO, '*** res: ' + res);
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+        }
+        return res;
+    }
+
+    //涓哄垱寤簄otes閭鎿嶄綔鎻愪緵鍒濆鍖栨暟鎹�
+    @AuraEnabled
+    public static InitData initForCreateNoteEmailButton (String recordId) {
+        InitData res = new initData();
+        try{
+            Monthly_Report__c report = [SELECT
+            Owner_email__c,
+            Owner_alias__c,
+            Key_issue__c,
+            Feedback__c,
+            Task_follow__c,
+            Other_issue__c,
+            Next_week_plan__c,
+            Dr_Sum_URL__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];
+            String userEmail = activeUser.Email;
+            res.ownerEmail = report.Owner_email__c;
+            res.ownerAlias = report.Owner_alias__c;
+            res.keyIssue = report.Key_issue__c;
+            res.feedBack = report.Feedback__c;
+            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) {
+       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 = 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;
+       } catch (Exception e) {
+        System.debug(LoggingLevel.INFO, '*** e: ' + e);
+       } finally {
+
+       }
+
+    }
+
+
+    public class InitData{
+        @AuraEnabled
+        public String Id;
+        @AuraEnabled
+        public String OwnerId;
+        @AuraEnabled
+        public String ownerEmail;
+        @AuraEnabled
+        public String ownerAlias;
+        @AuraEnabled
+        public String keyIssue;
+        @AuraEnabled
+        public String feedBack;
+        @AuraEnabled
+        public String taskFollow;
+        @AuraEnabled
+        public String otherIssue;
+        @AuraEnabled
+        public String nextWeekPlan;
+        @AuraEnabled
+        public String drSumUrl;
+        @AuraEnabled
+        public String userEmail;
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.1