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);
|
// }
|
// }
|
// }
|
|
}
|