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
public with sharing class DealerVisitDetailsController {
    @AuraEnabled
    public static InitData init(String recordId){
        InitData res  = new initData();
        ID myUserID = UserInfo.getUserId();
        Profile p = [select Id,Name from Profile where id =:System.Label.ProfileId_SystemAdmin];
        try {
            User userinfo = [SELECT id,ProfileId FROM User WHERE Id = :myUserID LIMIT 1];
            Account report = [SELECT Id,RecordTypeId,Department_Class_Label__c,name,Hospital_Department_Class__c FROM Account WHERE Id = :recordId];
            res.profileId = p.Name;
            res.recordTypeId = report.recordTypeId == System.Label.HP ? 'ok' : 'no';
            res.departmentClassLabel = report.Department_Class_Label__c;
            res.name = report.name;
            res.hospitalDepartmentClass = report.Hospital_Department_Class__c;
        } catch (Exception e) {
        }
        return res;
    }
    public class InitData{
        @AuraEnabled
        public string profileId;
        @AuraEnabled
        public string recordTypeId;
        @AuraEnabled
        public string departmentClassLabel;
        @AuraEnabled
        public string name;
        @AuraEnabled
        public string hospitalDepartmentClass;
    }
}