19626
2023-05-09 3d312e60e65de7bd0194c50ae26d11c7a4d4fc73
force-app/main/default/classes/ReportController.cls
@@ -10,6 +10,10 @@
            Report__c report = [select Status__c from Report__c where Id = :recordId];
            res.status = report.Status__c;
            res.profileId = UserInfo.getProfileId();
            res.userId = UserInfo.getUserId();
            res.luShengId = getUserIdByName(LightingButtonConstant.LU_SHENG_NAME);
            res.huDiAnId = getUserIdByName(LightingButtonConstant.HU_DI_AN_NAME);
            res.systemProfileId = getProfileIdByName(LightingButtonConstant.SYSTEM_PROFILE_NAME);
            System.debug(LoggingLevel.INFO, '*** res: ' + res);
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
@@ -26,6 +30,10 @@
            res.isVOC = report.IsVOC__c;
            res.personId = report.Responsible_Person__r.Id;
            res.profileId = UserInfo.getProfileId();
            res.userId = UserInfo.getUserId();
            res.luShengId = getUserIdByName(LightingButtonConstant.LU_SHENG_NAME);
            res.huDiAnId = getUserIdByName(LightingButtonConstant.HU_DI_AN_NAME);
            res.systemProfileId = getProfileIdByName(LightingButtonConstant.SYSTEM_PROFILE_NAME);
            System.debug(LoggingLevel.INFO, '*** res: ' + res);
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
@@ -218,10 +226,10 @@
    //给提交相应的js提供初始化数据
    @AuraEnabled
    public static String updateForSubmitButton(String reocrdId){
    public static String updateForSubmitButton(String recordId){
        try {
            Report__c rac = new Report__c();
            rac.Id = reocrdId;
            rac.Id = recordId;
            rac.Status__c = LightingButtonConstant.RECORD_TYPE_NAME_BY_SUBMIT;
            rac.Submit_time__c = Datetime.now();
            rac.Submit_report_day__c = Date.today();
@@ -539,6 +547,26 @@
            return eMessage.substring(left,right);
        }
    }
    @AuraEnabled
    public static string getUserIdByName(String name){
        User user = null;
        try {
            user = [select Id from User where Name =:name];
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
        return user.Id;
    }
    @AuraEnabled
    public static string getProfileIdByName(String name){
        Profile profile = null;
        try {
            profile = [select Id from Profile where Name =:name];
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
        return profile.Id;
    }
    public class InitData{
        @AuraEnabled
        public String status;
@@ -576,7 +604,12 @@
        public String DeveloperName;
        @AuraEnabled
        public String userId;
        @AuraEnabled
        public String luShengId;
        @AuraEnabled
        public String huDiAnId;
        @AuraEnabled
        public String systemProfileId;