19626
2023-06-26 cb676d5d9631864b9fd634f9b3052a17c41ed345
force-app/main/default/classes/ReportController.cls
@@ -2,6 +2,44 @@
用于给lwc的js初始化数据和对记录进行dml操作,此controller属于报告书
*/
public with sharing class ReportController {
    @AuraEnabled
    public static InitData initForOPDReportConsumButton(String recordId){
        InitData res = new initData();
        try {
            Consum_Apply__c con = [select RA_Status__c,Product_category__c,Id,Hospital__c,Strategic_dept__c,Account__c from Consum_Apply__c where Id =: recordId];
            res.raStatus = con.RA_Status__c;
            res.productCategory = con.Product_category__c;
            res.consumApplyId = con.Id;
            res.hospital = con.Hospital__c;
            res.strategicDept = con.Strategic_dept__c;
            res.account = con.Account__c;
            res.recordTypeId1 = Schema.SObjectType.Report__c.getRecordTypeInfosByName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_SIS_ENG).getRecordTypeId();
            res.recordTypeId = Schema.SObjectType.Report__c.getRecordTypeInfosByName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_SIS_ET).getRecordTypeId();
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
        return res;
    }
    @AuraEnabled
    public static InitData initForOPDReportButton(String recordId){
        InitData res = new initData();
        try {
            Rental_Apply__c rent = [select RA_Status__c,Asset_return_day2__c,Hospital__c,Strategic_dept__c,Account__c,OPDPlan__c,Follow_UP_Opp__c,demo_purpose2__c from Rental_Apply__c where Id =: recordId];
            res.raStatus = rent.RA_Status__c;
            res.assetReturnDay2 = rent.Asset_return_day2__c;
            res.hospitalId = rent.Hospital__c;
            res.strategicDeptId = rent.Strategic_dept__c;
            res.accountId = rent.Account__c;
            res.demoPurpose2 = rent.demo_purpose2__c;
            res.followUPOpp = rent.Follow_UP_Opp__c;
            res.opdPlan = rent.OPDPlan__c;
            res.recordTypeId = Schema.SObjectType.Report__c.getRecordTypeInfosByName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_OPD).getRecordTypeId();
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
        return res;
    }
    //给VOC完毕相应的js提供初始化数据
    @AuraEnabled
    public static InitData initForVOCFinishButton (String recordId) {
@@ -248,7 +286,7 @@
        try {
            Report__c rac = new Report__c();
            rac.Id = recordId;
            rac.RecordTypeId = Schema.SObjectType.Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_BY_OPD).getRecordTypeId();
            rac.recordTypeId = Schema.SObjectType.Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_BY_OPD).getRecordTypeId();
            update rac;
            return null;
        } catch (Exception e) {
@@ -284,7 +322,7 @@
        try {
            rac.Id = recordId;
            rac.Status__c = LightingButtonConstant.STATUS_COMPLETE;
            rac.RecordTypeId = Schema.SObjectType.Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.VOC_NAME).getRecordTypeId();
            rac.recordTypeId = Schema.SObjectType.Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.VOC_NAME).getRecordTypeId();
            update rac;
            return null;
        } catch (Exception e) {
@@ -317,7 +355,7 @@
        Report__c rac = new Report__c();
        try {
            rac.Id = recordId;
            rac.RecordTypeId = Schema.SObjectType.Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_BY_FOLLOW_THE_STAGE).getRecordTypeId();
            rac.recordTypeId = Schema.SObjectType.Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_BY_FOLLOW_THE_STAGE).getRecordTypeId();
            update rac;
            return null;
        } catch (Exception e) {
@@ -413,6 +451,8 @@
            return eMessage.substring(left,right);
        }
    }
    //VOC回答更新相应数据
    @AuraEnabled
    public static String updateForVOCAnswerButton(String recordId){
@@ -610,10 +650,37 @@
        public String huDiAnId;
        @AuraEnabled
        public String systemProfileId;
        @AuraEnabled
        public String raStatus;
        @AuraEnabled
        public String productCategory;
        @AuraEnabled
        public String hospitalId;
        @AuraEnabled
        public String hospital;
        @AuraEnabled
        public String strategicDeptId;
        @AuraEnabled
        public String strategicDept;
        @AuraEnabled
        public String accountId;
        @AuraEnabled
        public String account;
        @AuraEnabled
        public String rentalApplyId;
        @AuraEnabled
        public String consumApplyId;
        @AuraEnabled
        public String recordTypeId;
        @AuraEnabled
        public String recordTypeId1;
        @AuraEnabled
        public Date assetReturnDay2;
        @AuraEnabled
        public String followUPOpp;
        @AuraEnabled
        public String demoPurpose2;
        @AuraEnabled
        public String opdPlan;
    }
}