KKbes
2023-07-19 955453de1d14e678b5b8c76fd73905effdb7cc0b
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
public with sharing class LexSubmitCampaignController {
    //提交审批按钮 学会
    @AuraEnabled
    public static Campaign initSubmit(String recordId){
        try{
            Campaign res = [SELECT Id,Status,Is_LendProduct__c,EndDate
                FROM Campaign 
                    WHERE Id = : recordId];
            return res;
        }
        catch(Exception e){
            System.debug('lexSubmitCampaign,method:initSubmit   error: '+e.getMessage());
        }
        return null;
    }
 
    @AuraEnabled
    public static void newAndUpddateCampaign(String Id,String Status){
        try{    
            Campaign res = new Campaign();
            res.Id = Id;
            res.Status=Status;
            update res;
        }
        catch(Exception e){
            System.debug('lexSubmitCampaign,method:newAndUpddateCampaign   error: '+e.getMessage());
           
        }
 
    }
 
    
    @AuraEnabled
    public static String submitApprovalRequest(String recordId) {
        try{
           Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest();
           req.setObjectId(recordId);
           Approval.ProcessResult result = Approval.process(req);
           if(result!=null&&result.getErrors()!=null&&result.getErrors().size()>0) return result.getErrors().get(0).getMessage();
        }catch(Exception e){
            System.debug('lexSubmitCampaign,method:submitApprovalRequest submitApprovalRequest  error: '+e.getMessage());
            return e.getMessage();
        }
        return null;
    }
 
    //取消按钮 
    @AuraEnabled
    public static Campaign initCancle(String recordId){
        Campaign res = new Campaign();
        try {
            res = [SELECT Status,Id,CancleReason__c,IF_Submit__c
                                    From Campaign Where Id = :recordId];
            return res;
        }
        catch (Exception e) {
             System.debug('lexSubmitCampaign,method:initCancle   error: '+e.getMessage());
        }
        return res;
    }
 
    @AuraEnabled
    public static String newAndUpdateCampaignCancle(String campaignId ,String Status){
 
        try {
            Campaign res = new Campaign();
            res.Id = campaignId;
            res.Status =Status;
            update res;
            
        }
        catch (Exception e) {
            return e.getMessage();
        }
        return 'success';
    }    
 
    @AuraEnabled
    public static Campaign initMember(String recordId){
        Campaign res = new Campaign();
        try {
            res = [SELECT Status,Id,    ServiceDesignDep__c
                                    From Campaign Where Id = :recordId];
            return res;
        }
        catch (Exception e) {
             System.debug('lexSubmitCampaign,method:initCancle   error: '+e.getMessage());
        }
        return res;    
    }
 
    //取消按钮 CancleService
    @AuraEnabled
    public static Campaign initCancleService(String recordId){
        Campaign res = new Campaign();
        try {
            res = [SELECT Status,Id,CancleReason__c
                                    From Campaign Where Id = :recordId];
            return res;
        }
        catch (Exception e) {
             System.debug('lexSubmitCampaign,method:initCancle   error: '+e.getMessage());
        }
        return res;        
    }
 
    @AuraEnabled
    public static String cancleServiceNewAndUpdate(String Id,String Status,Boolean IsCancelFromOpen){
        Campaign res = new Campaign();
        try{
            res.Id = Id;
            res.Status = Status;
            res.IsCancelFromOpen__c = IsCancelFromOpen;
            UPDATE res;
            return 'success';
        }
        catch (Exception e) {
             System.debug('lexSubmitCampaign,method:initCancle   error: '+e.getMessage());
             return e.getMessage();
        }
        return 'success';
    }
 
    
 
 
 
}