沙世明
2022-03-12 0593d044698afa73e7e58022dab190ead1925f3a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
 * Author: Yanan Chen
 * Created Date: 02/14/2022
 * Purpose: Utility class for describe layouts
 * Test Class: NewAndEditASEActivityController
 * History: 
 *      02/14/2022 - Yanan Chen - Initial Code.
 * 
 * */
global class NewAndEditASEActivityController extends NewAndEditBaseController 
{
    // public String contactsInfo {set;get;}//key sfid;value awsid
    public String PIPL_Input_Account_Error_Msg{set;get;}
    public String contactId{set;get;}//For Lookup field
    public String contactAWS{set;get;}
    public String staticResourceContact {get; set;}
    public NewAndEditASEActivityController(ApexPages.StandardController controller) {
        List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('ASEActivity__c').getDescribe().fields.getMap().keyset());  
        // Add fields to controller. This is to avoid the SOQL error in visualforce page
        controller.addFields(fieldList);
        LookUpOverrideFields.add('ReporterASE__c');
        Init(controller.getRecord());
 
        //添加项
        PIPL_Input_Account_Error_Msg = label.PIPL_Input_Account_Error_Msg;
        SObject obj = controller.getRecord();
        if(obj.Id == null){
            //初始化加载值
            obj.put('OwnerId',UserInfo.getUserId());
        }
        //获取contact 加密ID
        // contactsInfo = LookUpOverrideFieldsMapJson;
        //contact信息(搜索查询query url用)
        if(obj.Id != null){
            ASEActivity__c aseActivity = [Select Id, ReporterASE__c From ASEActivity__c Where Id = : obj.Id];
            if(aseActivity.ReporterASE__c != null){
                Contact contact = [Select Id, AWS_Data_Id__c From Contact Where Id = : aseActivity.ReporterASE__c];
                System.debug('contact : ' + contact );
                contactAWS = contact.AWS_Data_Id__c;
                System.debug('contactAWS : ' + contactAWS );
            } 
        }
        staticResourceContact = JSON.serialize(PIHelper.getPIIntegrationInfo('Contact'));
    }
 
    
    @RemoteAction
    global static Response saveASEActivity(String leadJson,String transId,Boolean isNew) {
        return save(new ASEActivity__c(),leadJson,transId,isNew);
    }
}