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
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
public with sharing class HosipitalToDeptController {
    @AuraEnabled
    public static InitData init(String recordId){
        InitData res  = new initData();
        try {
            Account report = [SELECT Id,
                                GI_Main__c,
                                BF_owner__c,
                                ET_owner__c,
                                SP_Main__c,
                                URO_owner_ID__c,
                                GYN_owner__c,
                                ENT_owner_ID__c,
                                Tender_information__c,
                                Is_upload_file__c,
                                name,
                                Attribute_Type__c FROM Account WHERE Id = :recordId];
            res.giMain = report.GI_Main__c;
            res.bfowner = report.BF_owner__c;
            res.etowner = report.ET_owner__c;
            res.spmain = report.SP_Main__c;
            res.uroownerID = report.URO_owner_ID__c;
            res.gynowner = report.GYN_owner__c;
            res.entownerID = report.ENT_owner_ID__c;
            res.soakupHPDeptTeam = System.Label.Confirm_SoakupHPDeptTeam;
            res.tenderinformation = report.Tender_information__c;
            res.isuploadfile = report.Is_upload_file__c;
            res.name = report.name;
            res.attributeType = report.Attribute_Type__c;
        } catch (Exception e) {
        }
        return res;
    }
    @AuraEnabled
    public static string updataAccount(String recordId,Boolean HosipitalToDept){
        Account a = new Account();
        try {
            a.Id = recordId;
            a.HosipitalToDept__c = HosipitalToDept;
            update a;
        } catch (Exception e) {
            return e.getMessage();
        }
        return 'ok';
    }
    //提交审批
    @AuraEnabled
    public static String submitApproval(String recordId){
        Savepoint sp = Database.setSavepoint();
        try {
            // Account_Delay_Apply__c report = [SELECT Id,name FROM Account_Delay_Apply__c WHERE Id = :recordId];
            Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest();
            psr.setObjectId(recordId);
            Approval.ProcessResult submitResult = Approval.process(psr);
            //chenjingwu 20231225 start
            return JSON.serialize(submitResult);
            //chenjingwu 20231225 end
        }
        catch (Exception e) {
            Database.rollback(sp);
            return e.getMessage();
        }
    }
    @AuraEnabled
    public static string ReportId(String TypeName){
        String reportId = [select Id from Report where DeveloperName = :TypeName].Id;
        return reportId;
    }
    public class InitData{
        @AuraEnabled
        public string giMain;
        @AuraEnabled
        public string bfowner;
        @AuraEnabled
        public string etowner;
        @AuraEnabled
        public string spmain;
        @AuraEnabled
        public string uroownerID;
        @AuraEnabled
        public string gynowner;
        @AuraEnabled
        public string entownerID;
        @AuraEnabled
        public string soakupHPDeptTeam;
        @AuraEnabled
        public string tenderinformation;
        @AuraEnabled
        public Boolean isuploadfile;
        @AuraEnabled
        public string name;
        @AuraEnabled
        public string attributeType;
    }
}