19626
2023-05-09 3d312e60e65de7bd0194c50ae26d11c7a4d4fc73
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;
    }
    //为创建notes邮箱操作提供初始化数据
    @AuraEnabled
    public static InitData initForCreateNoteEmailButton (String recordId) {
        InitData res = new initData();
@@ -48,22 +50,23 @@
        }
        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 {
        String eMessage = e.getMessage();
        Integer left = eMessage.indexOf(',') + 1;
        Integer right = eMessage.length();
        return eMessage.substring(left,right);
       }
    }
@@ -71,7 +74,7 @@
        @AuraEnabled
        public String Id;
        @AuraEnabled
        public String OwnerId;
        public String ownerId;
        @AuraEnabled
        public String ownerEmail;
        @AuraEnabled
@@ -90,5 +93,7 @@
        public String drSumUrl;
        @AuraEnabled
        public String userEmail;
        @AuraEnabled
        public String userId;
    }
}