public without sharing class LeadDemoPIPLController {
    

    public class CommonInfo{
        @AuraEnabled public List <LayoutDescriberHelper.LayoutSection > layoutSections;      //对应页面和字段的属性
        @AuraEnabled public String layoutSectionsStr; 
        @AuraEnabled public Boolean isNewMode;                                               //是否是新建
        @AuraEnabled public Boolean isCloneMode;                                             //是否是克隆   
        @AuraEnabled public String rtTypeId;                                                 //记录类型Id
        @AuraEnabled public String AWSDataId;                                             
        @AuraEnabled public String currentUserId;                                            //当前用户Id
        @AuraEnabled public String currentUserName;                                          //当前用户名
        @AuraEnabled public List<String> encryptedAPIList;                                   //当前对象所有的加密字段集合
        @AuraEnabled public List<String> layoutEncryptedAPIList;                             //当前页面中的加密字段集合
        @AuraEnabled public String requiredFieldAPIListStr;                                  //必填字段集合
        @AuraEnabled public String fieldApiListStr;                                          //当前页面中字段      
        @AuraEnabled public String fieldAPIToLabelMapStr;                                    //当前页面中字段对应的Label
        @AuraEnabled public String staticResource;                                           //与AWS操作的各种信息（链接）
        @AuraEnabled public String SobjectName;                                              //对象名
        @AuraEnabled public String SobjectLabel;                                             //对象Label        
        @AuraEnabled public Map<String,String> AWSToSobjectNonEncryptedMap;                  //加密字段AWS的名称对应SF的名称的Map
        @AuraEnabled public List<String> AWSToSobjectNonEncryptedMapKeySet;                  //加密字段AWS的名称集合
        @AuraEnabled public List<String> VLookUpFields;                                      //当前页面中lookup字段     
        //public List<String> LookUpOverrideFields;
        @AuraEnabled public String objectId;                                                 //对象Id
        public CommonInfo(){}
   }

    @AuraEnabled 
    public static ResponseBodyLWC initData(String rid,String recordTypeId,String sobjectType){
        system.debug('rid='+rid+',length='+(rid==null?'null':rid.length()+''));
        system.debug('recordTypeId='+recordTypeId+',length='+(recordTypeId==null?'null':recordTypeId.length()+''));
        try{
            ResponseBodyLWC res = new ResponseBodyLWC();
            Map<String,object> data = new Map<String,object>();
            res.entity = data;
            List<Metadata.LayoutSection> layout = null;
            //新建
            if(String.isBlank(rid)){
                layout = MetaDataUtility.GetRecordTypePageLayout(recordTypeId, sobjectType);
                data.put('layout', Json.serialize(layout));
            }else{
                //编辑
            }
            data.put('fields', SObjectHelper.GetFieldInfos(sobjectType));
            data.put('staticResource', Json.serialize(PIHelper.getPIIntegrationInfo(sobjectType)));
            res.status = 'Success';
            res.code = 200;
            res.msg = '';
            return res;
        }catch(Exception e){
            return new ResponseBodyLWC('Error',500, e.getMessage(), '');
        }
    }
}