19626
2023-09-09 e14d6d0619330cad423f06493e3aa2371faa2a8f
force-app/main/default/classes/OpportunityLightingButtonController.cls
@@ -4,9 +4,24 @@
 * @Author: chen jing wu
 * @Date: 2023-04-12 11:16:07
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-06-29 16:53:17
 * @LastEditTime: 2023-09-08 16:57:51
 */
public with sharing class OpportunityLightingButtonController {
    @AuraEnabled
    public static List<Lost_cancel_report__c> queryForEditLostButton(String recordId){
        List<Lost_cancel_report__c> res = new List<Lost_cancel_report__c>();
        try {
            List<Lost_cancel_report__c> re = [
                select id,
                Report_Status__c,
                RecordTypeId
                from Lost_cancel_report__c where RecordTypeId != '01210000000R4hHAAS' and Opportunity__c =: recordId];
            res = re;
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
        return res;
    }
    @AuraEnabled
    public static InitData initForPredictedDateChangeButton(String recordId){
        InitData res = new InitData();
@@ -45,9 +60,21 @@
                IF_Submit__c ,
                Trade__c,
                Is_Corrosion__c,
                If_Authorizing_Lock__c
                If_Authorizing_Lock__c,
                AccDealerBlacklist__c,
                Agency1__c,
                Agency2__c,
                Hospital__c,
                OwnerId,
                Sales_assistant_name_text__c
                from Opportunity where Id =: recordId 
            ];
            res.AccDealerBlacklist = opportunity.AccDealerBlacklist__c;
            res.angency1 = opportunity.Agency1__c;
            res.angency2 = opportunity.Agency2__c;
            res.accname = opportunity.Hospital__c;
            res.ownerids = opportunity.OwnerId;
            res.ddid = opportunity.Sales_assistant_name_text__c;
            res.agency1Id = opportunity.Agency1_ID_18__c;
            res.stageName = opportunity.StageName;
            res.sapSendOK = opportunity.SAP_Send_OK__c;
@@ -264,6 +291,36 @@
        return res;
    }
    @AuraEnabled
    public static InitData initForLexQuoteEntryNewbotton(String recordId){
        InitData res = new InitData();
        try {
            Opportunity opportunity = [
                select
                Agency_Is_Delete__c,
                Account_Is_Active__c,
                Hospital_Is_Active__c,
                RecordTypeId,
                Estimation_Decision__c
                from Opportunity where Id =: recordId
            ];
            res.agencyIsDeletec = opportunity.Agency_Is_Delete__c;
            res.accountIsActivec = opportunity.Account_Is_Active__c;
            res.hospitalIsActivec = opportunity.Hospital_Is_Active__c;
            res.recordTypeId = opportunity.RecordTypeId;
            res.estimationDecisionc = opportunity.Estimation_Decision__c;
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
        return res;
    }
    @AuraEnabled
    public static Boolean describeSObjectCommon (String objname)
    {
        Schema.DescribeSobjectResult schemaMap = Schema.describeSObjects(new String[]{objname})[0];
        return schemaMap.isCreateable();
    }
    @AuraEnabled
    public static InitData initForQuotationRequestButton(String recordId){
        InitData res = new InitData();
        try {
@@ -431,7 +488,7 @@
            res.accountId = opp.AccountId;
            res.accountName = acc.Name;
            res.name = opp.Name;
            res.recordTypeId = Schema.SObjectType.Task.getRecordTypeInfosByName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_INQUIRY_FOLLOW_UP).getRecordTypeId();
            // res.recordTypeId = Schema.SObjectType.Task.getRecordTypeInfosByName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_INQUIRY_FOLLOW_UP).getRecordTypeId();
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
@@ -901,5 +958,29 @@
        public String oppForecastStatus;
        @AuraEnabled
        public String oppId;
        @AuraEnabled
        public String AccDealerBlacklist;
        @AuraEnabled
        public String angency1;
        @AuraEnabled
        public String angency2;
        @AuraEnabled
        public String accname;
        @AuraEnabled
        public String ownerids;
        @AuraEnabled
        public String ddid;
        @AuraEnabled
        public String agencyIsDeletec;
        @AuraEnabled
        public String accountIsActivec;
        @AuraEnabled
        public String hospitalIsActivec;
        @AuraEnabled
        public Boolean estimationDecisionc;
        @AuraEnabled
        public String reportStatus;
        @AuraEnabled
        public String reportId;
    }
}