buli
2023-05-23 07390e2fcb4adf27c928335bf27ae7939c5a80ad
force-app/main/default/classes/AddSubmitApprovalProcessController.cls
@@ -1,7 +1,4 @@
public with sharing class AddSubmitApprovalProcessController {
    public AddSubmitApprovalProcessController() {
    }
    @AuraEnabled
    public static InitData init(String recordId){
@@ -40,9 +37,12 @@
            res.applyUserId = ra.applyUser__r.Id;
            res.ownerId = ra.OwnerId;
            res.rentalApplyStatus = ra.Status__c;
            res.demoRequestPastDataId = Schema.SObjectType.Rental_Apply__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_BY_PastData).getRecordTypeId();
            List<Rental_Apply_Equipment_Set_Detail__c> raeSet = [SELECT Id from Rental_Apply_Equipment_Set_Detail__c WHERE Rental_Apply__c = :recordId AND Draft_Appended__c=1];
            res.detailSize = raeSet.size();
            res.addApprovalStatus = '草案中';
            res.detailSize = 1;
        }
        catch (Exception e) {
            System.debug(LoggingLevel.INFO, '****e:' + e);  
@@ -51,7 +51,24 @@
    }
    public Class InitData{
    //提交审批
    @AuraEnabled
    public static String submitApproval(String recordId){
        Savepoint sp = Database.setSavepoint();
        try {
            Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
            req1.setObjectId(recordId);
            Approval.ProcessResult submitResult = Approval.process(req1);
            return 'OK';
        }
        catch (Exception e) {
            Database.rollback(sp);
            return e.getMessage();
        }
    }
    private class InitData{
        @AuraEnabled
        public String rentalApplyId;        //备品借出申请Id
        @AuraEnabled
@@ -102,5 +119,7 @@
        public String ownerId;                      //备品借出申请.所有人Id
        @AuraEnabled
        public String rentalApplyStatus;            //备品借出申请.状态
        @AuraEnabled
        public String demoRequestPastDataId;        //备品申请 过去历史转移Id
    }
}