/*
|
* Author: Zhang,Heyang
|
* Created Date: 2023/08/07
|
* Purpose: Utility class for describe layouts
|
* Test Class: LexNewAndEditLeadPIPLControllerTest
|
* History:
|
* 2023/08/07 - Zhang,Heyang - Initial Code.
|
*
|
* */
|
public with sharing class LexInspectionReportPIPLController
|
{
|
@AuraEnabled
|
public static ResponseBodyLWC initData(Id rid, String recordTypeId, String sobjectType) {
|
System.debug('进入:' );
|
Map<String, object> data = new Map<String, object>();
|
System.debug('LayoutDescriberHelper.getDefaultRecordType(sobjectType): ' + LayoutDescriberHelper.getDefaultRecordType(sobjectType));
|
ResponseBodyLWC rbl = LexNewAndEditBasePIPLController.initData(rid, recordTypeId, sobjectType);
|
if(rbl.status == 'Success'){
|
data = (Map<String,Object>)rbl.entity;
|
data.put('staticResourceContact', Json.serialize(PIHelper.getPIIntegrationInfo('Contact')));
|
if(String.isNotBlank(rid)){
|
String sql = 'SELECT Responsible_Person_F__r.Name,Responsible_Person_F__r.AWS_Data_Id__c, ';
|
DescribeSObjectResult objectType = rid.getSobjectType().getDescribe();
|
List<String> objectFields = new List<String>(objectType.fields.getMap().keySet());
|
sql += String.join(objectFields, ',') +' from '+sobjectType+' where id =\''+rid+'\' limit 1';
|
System.debug('sql: ' + sql);
|
Sobject leadData = Database.query(sql);
|
data.put('data',leadData);
|
}
|
System.debug('data: ' + data);
|
rbl.entity = data;
|
}
|
return rbl;
|
}
|
|
@AuraEnabled
|
public static Map<String, Object> getContactByAWSId(String awsId){
|
Map<String, Object> resultMap = new Map<String, Object>();
|
Contact ContactInfo = new Contact();
|
ContactInfo = [SELECT Id,Name,Account.Name,Phone,Email,MobilePhone FROM Contact WHERE AWS_Data_Id__c =:awsId LIMIT 1];
|
resultMap.put('ContactInfo', ContactInfo);
|
return resultMap;
|
}
|
|
}
|