liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
public with sharing class LexLostSubmitApprovalController {
 
    // 遗失报告 提交待审核
    @AuraEnabled
    public static InitData LexLostSubmitApprovalController(String recordId) {
        InitData res = new initData();
        try{
            List<LostReport_Detail__c> reportDetail = new List<LostReport_Detail__c>();
            List<LostReport__c> reportList = [SELECT Id,Status__c FROM LostReport__c WHERE Id = :recordId LIMIT 1];
            if(reportList.size() > 0){
                LostReport__c report = reportList[0];
                res.Id = report.Id;
                res.statusTf = report.Status__c;
                reportDetail = [SELECT Rental_Apply_Equipment_Set_Detail__r.Lost_item_check_day__c FROM LostReport_Detail__c WHERE LostReport__c = :recordId AND Rental_Apply_Equipment_Set_Detail__r.Lost_item_check_day__c != null];
                res.reportDetailList = reportDetail;
                System.debug(LoggingLevel.INFO, '*** zq: ' + res);
            }
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** zq: ' + e);
        }
        return res;
    }
 
    public class InitData{
        @AuraEnabled
        public String Id;
        @AuraEnabled
        public String statusTf;
        @AuraEnabled
        public List<LostReport_Detail__c> reportDetailList;
    }
 
    //提交按钮
    @AuraEnabled
    public static String submit(String recordId) {
        System.debug(recordId);
       try {
        LostReport__c rac = [SELECT Id,Status__c FROM LostReport__c WHERE Id = :recordId LIMIT 1];
        rac.Id = rac.Id;
        rac.Status__c = '填写完毕';
        update rac;
        return '1';
       } catch (Exception e) {
        // return e.getMessage();
        System.debug('exception----'+e);
        if (e.getMessage().contains(':')) {
            String eMessage = e.getMessage();
            Integer left  = e.getMessage().indexOf(',')+1;
            Integer right = e.getMessage().lastIndexOf(':');
            return eMessage.substring(left,right);
        }else{
            return e.getMessage();
        }
       }
    }
}