高章伟
2022-02-24 2aa8da8af66aa8ae00f25831aed6bb0364176e7b
force-app/main/default/classes/ContactTriggerHandler.cls
@@ -20,12 +20,16 @@
        syncToAgencyContact();
        updateDealerNum();
        sendToComPlat();
        //NFM702
        // NFM702_Handler(this.newList , this.newMap , this.oldList , this.oldMap);
    }
    protected override void afterUpdate() {
        syncToAgencyContact();
        updateDealerNum();
        sendToComPlat();
        //NFM702
        // NFM702_Handler(this.newList , this.newMap , this.oldList , this.oldMap);
    }
    protected override void beforeUpdate() {
@@ -376,4 +380,40 @@
        
    }
    public void NFM702_Handler(List<Contact> newList, Map<Id, Contact> newMap, List<Contact> oldList, Map<Id, Contact> oldMap){
        List<Contact> conIdList = new List<Contact>();
        List<String> idList = new List<String>();
        String LOG_TYPE = 'NFM702';
        // iflog.Log__c = '---------';
        String ConTypeId = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Doctor').getRecordTypeId();
        if (Trigger.isUpdate && Trigger.isAfter) {
            if (newList.size() > 0) {
                for (Contact con : newList) {
                    Contact oldCon = oldMap.get(con.Id);
                    if ((con.RecordTypeId.equals(ConTypeId)) && (con.FullName__c != oldCon.FullName__c || con.Phone != oldCon.Phone || con.Department__c != oldCon.Department__c || con.Isactive__c != oldCon.Isactive__c)) {
                        idList.add(con.Id);
                    }
                }
            }
        }
        if(Trigger.isInsert && Trigger.isAfter){
            if (newList.size() > 0) {
                for (Contact con : newList) {
                    if(con.RecordTypeId.equals(ConTypeId)){
                        idList.add(con.Id);
                    }
                }
            }
        }
        if (idList.size() > 0) {
            BatchIF_Log__c iflog = new BatchIF_Log__c();
            iflog.Log__c = '触发成功';
            iflog.Type__c = LOG_TYPE;
            insert iflog;
            NFM702Controller.callout(iflog.Id, idList);
        }
    }
}