public with sharing class lexMaintenanceContractUrlController { @AuraEnabled public static ReturnData initOne(String recordId){ ReturnData returnData = new ReturnData(); String reportId = ''; List reportList= [select Id from Report where DeveloperName ='Repair_maitenance_list_bottun' limit 1]; if(reportList.size()>0) { reportId = reportList[0].Id; } returnData.reportId = reportId; String mCEName = [select id from Maintenance_Contract__c where Id = :recordId].id; returnData.mCEName = mCEName; return returnData; } @AuraEnabled public static ReturnData initTwo(String recordId){ ReturnData returnData = new ReturnData(); String reportId = ''; // List reportList= [select Id from Report where DeveloperName ='Service_contract_bottun_New' limit 1]; List reportList= [select Id from Report where DeveloperName ='NewConRate0607' limit 1]; if(reportList.size()>0) { reportId = reportList[0].Id; } returnData.reportId = reportId; String mCEName = [select id from Maintenance_Contract__c where Id = :recordId].id; returnData.mCEName = mCEName; return returnData; } @AuraEnabled public static ReturnData initThree(String recordId){ ReturnData returnData = new ReturnData(); String reportId = ''; List reportList= [select Id from Report where DeveloperName ='fault' limit 1]; if(reportList.size()>0) { reportId = reportList[0].Id; } returnData.reportId = reportId; String mCEName = [select id from Repair__c where Id = :recordId].id; returnData.mCEName = mCEName; return returnData; } @AuraEnabled public static ReturnData initFour(String recordId){ ReturnData returnData = new ReturnData(); String reportId = ''; List reportList= [select Id from Report where DeveloperName ='Loaner_request_history' limit 1]; if(reportList.size()>0) { reportId = reportList[0].Id; } returnData.reportId = reportId; String mCEName = [select id,Hospital_ID__c from Rental_Apply__c where Id = :recordId].Hospital_ID__c; returnData.mCEName = mCEName; return returnData; } @AuraEnabled public static ReturnData lexCustomNewContract(String recordId){ ReturnData returnData = new ReturnData(); RecordType re = [select id from RecordType where name = '服务合同']; Maintenance_Contract__c mc = [select id ,name ,Hospital__c,Department_Class__c,Department__c,Service_Contract_Staff__c ,Estimate_Target__c,Dealer__c,AccDealerBlacklist__c, //贸易合规二期 add sx start Hospital__r.TradeComplianceStatus__c, Dealer__r.TradeComplianceStatus__c //贸易合规二期 add sx end from Maintenance_Contract__c where id = :recordId]; returnData.recordtypeId = re.id; returnData.name = mc.name; returnData.hospital = mc.Hospital__c; returnData.department_Class = mc.Department_Class__c; returnData.department = mc.Department__c; returnData.service_Contract_Staff = mc.Service_Contract_Staff__c; returnData.estimate_Target = mc.Estimate_Target__c; returnData.dealer = mc.Dealer__c; returnData.accDealerBlacklist = mc.AccDealerBlacklist__c; //2023/11/20 sx 贸易合规 add start List mcaListtemp = [SELECT Id, Asset__r.product2.CountryOfOrigin__c, Asset__r.product2.USRatio_US__c, Asset__r.product2.ProTradeComplianceStatus__c,Asset__r.product2.Asset_Model_No__c FROM Maintenance_Contract_Asset__c WHERE Maintenance_Contract__c = :recordId]; String violationName = ''; if(mcaListtemp.size()>0){ for(Maintenance_Contract_Asset__c mac : mcaListtemp){ if(mac.Asset__r.product2.ProTradeComplianceStatus__c == '0'){ returnData.proTradeComplianceStatus = '0'; violationName += mac.Asset__r.product2.Asset_Model_No__c+','; } } }else{ returnData.proTradeComplianceStatus = '1'; } returnData.violationName = violationName; //2023/11/20 sx 贸易合规 add end return returnData; } public class ReturnData{ @AuraEnabled public String reportId; @AuraEnabled public String mCEName; @AuraEnabled public String name; @AuraEnabled public Id hospital; @AuraEnabled public Id department_Class; @AuraEnabled public Id department; @AuraEnabled public Id service_Contract_Staff; @AuraEnabled public String estimate_Target; @AuraEnabled public Id dealer; @AuraEnabled public Id recordtypeId; @AuraEnabled public String accDealerBlacklist; //贸易合规二期 add sx @AuraEnabled public String proTradeComplianceStatus; @AuraEnabled public String violationName; //贸易合规二期 add sx } }