liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
public with sharing class OCSMHandler extends Oly_TriggerHandler {
    //LY          2021/11/12                  start
    //平台窗口1、2、3任何一个有变更都会触发客户人员接口,向共通平台发送
    public static void OCSMToUser(List<OCM_Management_Province__c> newList, Map<Id, OCM_Management_Province__c> newMap, List<OCM_Management_Province__c> oldList, Map<Id, OCM_Management_Province__c> oldMap){
    
        OCM_Management_Province__c old = null;
        List<String> noList = new List<String>();
        //Add By Li Jun 20230420 Start OCSM省的【营业窗口】人员发生变动时,需要更新现有的未完成的签收单的【营业助理】值 
        Set<String> changedWindowProvince = new set<String>();
        //Add By Li Jun 20230420 End 
        for (OCM_Management_Province__c local : newList) {
 
            if (Trigger.isInsert) {
                if (String.isNotBlank(local.OnlinePlatformWindow1__c)) {
                    noList.add(local.OnlinePlatformWindow1__c);
                }
                if (String.isNotBlank(local.OnlinePlatformWindow2__c)) {
                    noList.add(local.OnlinePlatformWindow2__c);
                }
                if (String.isNotBlank(local.OnlinePlatformWindow3__c)) {
                    noList.add(local.OnlinePlatformWindow3__c);
                }
            }
 
            if (Trigger.isUpdate) {
                old = oldMap.get(local.Id);
                if (old.OnlinePlatformWindow1__c != local.OnlinePlatformWindow1__c) {
                    if (String.isNotBlank(local.OnlinePlatformWindow1__c)) {
                        noList.add(local.OnlinePlatformWindow1__c);
                    }
                    if (String.isNotBlank(old.OnlinePlatformWindow1__c)) {
                        noList.add(old.OnlinePlatformWindow1__c);
                    }
                }
                if (old.OnlinePlatformWindow2__c != local.OnlinePlatformWindow2__c) {
                    if (String.isNotBlank(local.OnlinePlatformWindow2__c)) {
                        noList.add(local.OnlinePlatformWindow2__c);
                    }
                    if (String.isNotBlank(old.OnlinePlatformWindow2__c)) {
                        noList.add(old.OnlinePlatformWindow2__c);
                    }
                }
                if (old.OnlinePlatformWindow3__c != local.OnlinePlatformWindow3__c) {
                    if (String.isNotBlank(local.OnlinePlatformWindow3__c)) {
                        noList.add(local.OnlinePlatformWindow3__c);
                    }
                    if (String.isNotBlank(old.OnlinePlatformWindow3__c)) {
                        noList.add(old.OnlinePlatformWindow3__c);
                    }
                }
                //Add By Li Jun 20230420 Start 
                if ((local.GI_assistant__c != null &&  local.GI_assistant__c != old.GI_assistant__c) || (local.SP_assistant__c != null &&  local.SP_assistant__c != old.SP_assistant__c)) {
                    changedWindowProvince.add(local.Name);   
                }                
                //Add By Li Jun 20230420 End
            
            }
 
        }
        if (noList.size() > 0) {
            NFM621Controller.callout('',  noList);
        }
        //Add By Li Jun 20230420 Start 
        if(changedWindowProvince.size() > 0){
            SyncProvinceWIndowToSignForm.syncProvinceWIndow(changedWindowProvince);
        }
        //Add By Li Jun 20230420 End
    }
    // //办事处ET/ENG担当共享 you 20230222  为了记录更改之前的ET/ENG专员是谁
    // public static void OCSMToOpp(List<OCM_Management_Province__c> newList, Map<Id, OCM_Management_Province__c> newMap, List<OCM_Management_Province__c> oldList, Map<Id, OCM_Management_Province__c> oldMap){
    //     for (OCM_Management_Province__c newocm : newList) {
    //         OCM_Management_Province__c oldocm = oldMap.get(newocm.Id);
    //         if(Trigger.isUpdate && (newocm.ET_DataWindow__c != oldocm.ET_DataWindow__c || newocm.ET_BusinessWindow__c != oldocm.ET_BusinessWindow__c || newocm.ET_Assistant1__c != oldocm.ET_Assistant1__c || newocm.ET_Assistant2__c != oldocm.ET_Assistant2__c)){
    //             newocm.ETShareOpp__c=(oldocm.ET_DataWindow__c == null? '' : oldocm.ET_DataWindow__c)+','+(oldocm.ET_BusinessWindow__c == null? '' : oldocm.ET_BusinessWindow__c)+','+(oldocm.ET_Assistant1__c == null? '' : oldocm.ET_Assistant1__c)+','+(oldocm.ET_Assistant2__c == null? '' : oldocm.ET_Assistant2__c);
    //         }
    //         if(Trigger.isUpdate && (newocm.ENG_DataWindow__c != oldocm.ENG_DataWindow__c || newocm.ENG_BusinessWindow__c != oldocm.ENG_BusinessWindow__c || newocm.ENG_Assistant1__c != oldocm.ENG_Assistant1__c || newocm.ENG_Assistant2__c != oldocm.ENG_Assistant2__c)){
    //             newocm.ENGShareOpp__c=(oldocm.ENG_DataWindow__c == null? '' : oldocm.ENG_DataWindow__c)+','+(oldocm.ENG_BusinessWindow__c == null? '' : oldocm.ENG_BusinessWindow__c)+','+(oldocm.ENG_Assistant1__c == null? '' : oldocm.ENG_Assistant1__c)+','+(oldocm.ENG_Assistant2__c == null? '' : oldocm.ENG_Assistant2__c);
    //         }
    //         }
    // }
 
}