public with sharing class buttonAccountCtl { @AuraEnabled public static InitData init(String recordId){ InitData res = new initData(); try{ String mcServiceRecordTypeId = [select Id,DeveloperName from RecordType where SobjectType = 'Maintenance_Contract__c' and DeveloperName = 'NewMaintenance_Contract'].Id; Account report = [SELECT Hospital__r.IFTradeComplianceIntercept__c ,Department_Class__r.Id,Hospital__r.Id, Hospital__r.Name,// WYL 贸易合规2期 add Department_Class__c,Hospital__c,Id FROM Account WHERE Id =: recordId LIMIT 1]; System.debug(LoggingLevel.INFO, '*** opp: ' + report); res.Id = report.Id; res.HospitalC = report.Hospital__c; res.HospitalId = report.Hospital__r.Id; res.DepartmentClassC = report.Department_Class__c; res.DepartmentClassId = report.Department_Class__r.Id; res.IFTradeComplianceIntercept = report.Hospital__r.IFTradeComplianceIntercept__c; res.Name = report.Hospital__r.Name;// WYL 贸易合规2期 add res.recordTypeId = mcServiceRecordTypeId; res.userID = UserInfo.getUserId(); System.debug(LoggingLevel.INFO, '*** res: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } // 查找UserName @AuraEnabled public static List initUserName(String userId){ List res = new List(); try{ res = [SELECT Id,name,RepairSalesPoint_Province_China__c,Employee_No__c FROM User WHERE Id=: userId ]; }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } @AuraEnabled public static List selecctAccountByAccountId(String AccountId){ try { List accounts = [SELECT ParentId,Parent.RecordTypeId,Parent.RecordType_DeveloperName__c ,Parent.Parent.FSE_GI_Main_Leader__c, Parent.Parent.FSE_GI_Main_Leader__r.Name,Parent.Parent.FSE_SP_Main_Leader__r.Name,Parent.Parent.FSE_SP_Main_Leader__c,Parent.Parent.FSE_GI_Main_Leader__r.Work_Location__c,Parent.Parent.FSE_SP_Main_Leader__r.Work_Location__c FROM Account WHERE ID=:AccountId]; return accounts; } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } } public class InitData{ @AuraEnabled public String Id; @AuraEnabled public String HospitalC; @AuraEnabled public String HospitalId; @AuraEnabled public String DepartmentClassC; @AuraEnabled public String DepartmentClassId; @AuraEnabled public String Name; @AuraEnabled public String userID; @AuraEnabled public String recordTypeId; @AuraEnabled public String IFTradeComplianceIntercept; } }