buli
2022-03-10 a90c9ecfc5118547d0a92b2fee2779eca95e09a5
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
/*
 * Author: Yanan Chen
 * Created Date: 02/15/2022
 * Purpose: Utility class for describe layouts
 * Test Class: NewAndEditEventController
 * History: 
 *      02/15/2022 - Yanan Chen - Initial Code.
 * 
 * */
global class NewAndEditEventController extends NewAndEditBaseController {
    public String contactAWSIds{set;get;}
    public String staticResources {get; set;}
    public NewAndEditEventController (ApexPages.StandardController controller) {
        
        List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('Event').getDescribe().fields.getMap().keyset());  
        // Add fields to controller. This is to avoid the SOQL error in visualforce page
        controller.addFields(fieldList);
        Init(controller.getRecord());
        //1. get 访问对象ID
        //query event by controller.getRecord().Id;
        Event event = [SELECT  Id, Visitor1_ID__c, Visitor2_ID__c,  Visitor3_ID__c, Visitor4_ID__c, Visitor5_ID__c FROM Event WHERE Id =:controller.getRecord().Id];
        System.debug('event: ' + event);
        Set<String> contactIds = new Set<String>();
        List<String> conAWSIds = new List<String>();
        contactIds.add(event.Visitor1_ID__c);
        contactIds.add(event.Visitor2_ID__c);
        contactIds.add(event.Visitor3_ID__c);
        contactIds.add(event.Visitor4_ID__c);
        contactIds.add(event.Visitor5_ID__c);
        List<Contact> conListForReport = new List<Contact>([select id,AWS_Data_Id__c from Contact where id in:contactIds and AWS_Data_Id__c!='']);
        for(Contact con:conListForReport){
            conAWSIds.add(con.AWS_Data_Id__c);
        }
        contactAWSIds = JSON.serialize(conAWSIds);
        system.debug('Contact AWSIDs:'+contactAWSIds);
        staticResources = JSON.serialize(PIHelper.getPIIntegrationInfo('Contact'));
    }
 
    
    // @RemoteAction
    // global static Response saveEvent(String leadJson,String transId,Boolean isNew) {
    //     return save(new Event(),leadJson,transId,isNew);
    // }
}