From ae181f917b1b6ee90b2d6c273e0e9f61f29b4e33 Mon Sep 17 00:00:00 2001 From: 涂煌豪 <tuhuanghao@prec-tech.com> Date: 星期一, 28 三月 2022 18:25:15 +0800 Subject: [PATCH] 606接口报错修改,客户人员手机号校验 --- force-app/main/default/classes/ContactTriggerHandler.cls | 102 ++++++++++++++++++++++++++------------------------ 1 files changed, 53 insertions(+), 49 deletions(-) diff --git a/force-app/main/default/classes/ContactTriggerHandler.cls b/force-app/main/default/classes/ContactTriggerHandler.cls index 55901b1..e8fc656 100644 --- a/force-app/main/default/classes/ContactTriggerHandler.cls +++ b/force-app/main/default/classes/ContactTriggerHandler.cls @@ -14,25 +14,25 @@ } protected override void beforeInsert() { mobileNumberVerification(); + sendToComPlat(); } protected override void afterInsert() { syncToAgencyContact(); updateDealerNum(); - sendToComPlat(); } protected override void afterUpdate() { syncToAgencyContact(); updateDealerNum(); - sendToComPlat(); - } + protected override void beforeUpdate() { // 鏈嶅姟鎶�甯� 2018/12/24 Start UpdateProcessingWork(); // 鏈嶅姟鎶�甯� 2018/12/24 end mobileNumberVerification(); + sendToComPlat(); } @@ -235,7 +235,7 @@ // for(User us1: userList){ // userMap.put(us1.ContactId, us1); // } - // } + // } //鏌ユ壘鑱旂郴浜哄璞′笂瀵瑰簲鐨勬湁鏁堝鎴凤紱鍖婚櫌鐩存帴浣跨敤鏈夋晥/鏃犳晥瀛楁銆佺粡閿�鍟嗕娇鐢ㄦ湁鏁�/鏃犳晥鍏紡瀛楁 List<String> accIdList = new List<String>(); Map<String,String> accMap= new Map<String,String>(); @@ -256,30 +256,37 @@ } } } - for (Contact contactnew: newList) { - // 鎵嬫満鍙� 鏈夊�� 骞朵笖 鑱旂郴浜烘湁鏁� 鑱旂郴浜虹殑瀹㈡埛鏈夋晥 杩涜鎵嬫満鍙风爜楠岃瘉 - if (String.isNotBlank(contactnew.MobilePhone) && ('鏈夋晥'.equals(contactnew.Isactive__c) ||'鏈夊姽'.equals(contactnew.Isactive__c)) - && '鏈夊姽'.equals(accMap.get(contactnew.AccountId))) { - Matcher isMobilePhone = pattern.matcher(contactnew.MobilePhone); - if (isMobilePhone.matches()) { - // 灏嗘墜鏈哄彿 璧嬪�肩粰 鎵嬫満鍙峰敮涓�瀛楁 - contactnew.UniqueNumber__c = contactnew.MobilePhone; - } else { - // 鎵嬫満鍙峰敮涓�瀛楁娓呯┖ - contactnew.UniqueNumber__c = null; - } - } else { - // 鎵嬫満鍙� 鏃犲�� 鎴栬�� 鑱旂郴浜轰笉鏄湁鏁� 鎵嬫満鍙峰敮涓�瀛楁娓呯┖ - contactnew.UniqueNumber__c = null; + //鎵嬫満鍙峰敮涓�鏍¢獙-鍖婚櫌涓嬫柊寤哄鎴蜂汉鍛樻牎楠屼娇鐢ㄥ姞瀵嗘墜鏈哄彿,缁忛攢鍟嗕娇鐢ㄦ櫘閫氭墜鏈哄彿 thh 20220328 start + ID recordTypeId = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId(); + for (Contact contactnew : newList) { + // 鎵嬫満鍙锋湁鍊煎苟涓旇仈绯讳汉鏈夋晥锛岃仈绯讳汉鐨勫鎴锋湁鏁堬紝杩涜鎵嬫満鍙风爜楠岃瘉 + if (('鏈夋晥'.equals(contactnew.Isactive__c) || '鏈夊姽'.equals(contactnew.Isactive__c)) + && ('鏈夊姽'.equals(accMap.get(contactnew.AccountId)) || '鏈夋晥'.equals(accMap.get(contactnew.AccountId)))) { + if(contactnew.RecordTypeId.equals(recordTypeId)){ + if(String.isNotBlank(contactnew.MobilePhone)){ + Matcher isMobilePhone = pattern.matcher(contactnew.MobilePhone); + if (isMobilePhone.matches()) { + contactnew.UniqueNumber__c = contactnew.MobilePhone; + } else { + // 鎵嬫満鍙峰敮涓�瀛楁娓呯┖ + contactnew.UniqueNumber__c = null; + } + } else { + contactnew.UniqueNumber__c = null; + } + } else{ + if(String.isNotBlank(contactnew.MobilePhone_Encrypted__c)){ + contactnew.UniqueNumber__c = contactnew.MobilePhone_Encrypted__c; + } else { + contactnew.UniqueNumber__c = null; + } + } } - - - if (Trigger.isInsert) { - accountIdSet.add(contactnew.AccountId); - + accountIdSet.add(contactnew.AccountId); } } + //鎵嬫満鍙峰敮涓�鏍¢獙-鍖婚櫌涓嬫柊寤哄鎴蜂汉鍛樻牎楠屼娇鐢ㄥ姞瀵嗘墜鏈哄彿,缁忛攢鍟嗕娇鐢ㄦ櫘閫氭墜鏈哄彿 thh 20220328 end // 鏂板鑱旂郴浜烘椂锛� if (accountIdSet.size() > 0) { List<Contact> contactList = [SELECT Id,AccountId,FullName__c,LastName,FirstName,Account.Name,CManageCode__c,IsFromSPO__c, @@ -340,9 +347,8 @@ public static Map<Id,Id> NFM606_IdMap = new Map<Id,Id>(); private void sendToComPlat() { List<Id> contactIdList = new List<Id>(); - List<String> interfaceUserUpsertContact = new List<String>(); + List<String> interfaceUserUpsertContact = new List<String>(); for (Contact local: newList) { - Contact old = null; if (Trigger.isUpdate) { old = oldMap.get(local.Id); @@ -369,52 +375,50 @@ || old.ContactType__c != local.ContactType__c//浜哄憳绫诲瀷 ) { + //624璋冪敤606闂淇 thh 20220328 start if (!local.IsFromSPO__c && !'01210000000QtkyAAC'.equals(local.RecordTypeId)) { - // 鍖婚櫌 瀹㈡埛浜哄憳 缁熶竴骞冲彴缂栫爜鏈夊�� 鍙戦�� PO if ('01210000000QfWdAAK'.equals(local.RecordTypeId) && String.isNotBlank(local.UnifiedI_Contact_ID__c)) { if (!NFM606_IdMap.containsKey(local.Id)) { - //624璋冪敤606闂淇 thh 20220325 start // if(UserInfo.getProfileId().equals(System.Label.ProfileId_SystemAdmin)){ // interfaceUserUpsertContact.add(local.Id); // } else { - contactIdList.add(local.Id); + // contactIdList.add(local.Id); // } - //624璋冪敤606闂淇 thh 20220325 end + local.trigger606Flag__c = true; NFM606_IdMap.put(local.Id, local.Id); } } // 缁忛攢鍟� 瀹㈡埛浜哄憳 鎵嬫満鍙风爜鏈夊�� 鍙戦�� PO if ('01210000000QfWiAAK'.equals(local.RecordTypeId) && String.isNotBlank(local.MobilePhone)) { if (!NFM606_IdMap.containsKey(local.Id)) { - //624璋冪敤606闂淇 thh 20220325 start // if(UserInfo.getProfileId().equals(System.Label.ProfileId_SystemAdmin)){ // interfaceUserUpsertContact.add(local.Id); // } else { - contactIdList.add(local.Id); + // contactIdList.add(local.Id); // } - //624璋冪敤606闂淇 thh 20220325 end + local.trigger606Flag__c = true; NFM606_IdMap.put(local.Id, local.Id); } } } - + //624璋冪敤606闂淇 thh 20220328 end } } - - if(!System.Test.isRunningTest()){ - // NFM606Controller.executeNotFuture('', contactIdList); - //624璋冪敤606闂淇 thh 20220325 start - if (contactIdList.size() > 0) { - // NFM606Controller.callout('', contactIdList); - //娣诲姞future 鍒ゆ柇 add for pipl sushanhu 20220317 start - if (!(System.isFuture()||System.isBatch())) { - NFM606Controller.callout('', contactIdList); - } else{ - NFM606Controller.executeNotFuture('', contactIdList); - } - //娣诲姞future 鍒ゆ柇 add for pipl sushanhu 20220317 end - } + //606鏍囪 + // if(!System.Test.isRunningTest()){ + // // NFM606Controller.executeNotFuture('', contactIdList); + // //624璋冪敤606闂淇 thh 20220325 start + // if (contactIdList.size() > 0) { + // // NFM606Controller.callout('', contactIdList); + // //娣诲姞future 鍒ゆ柇 add for pipl sushanhu 20220317 start + // if (!(System.isFuture()||System.isBatch())) { + // NFM606Controller.callout('', contactIdList); + // } else{ + // NFM606Controller.executeNotFuture('', contactIdList); + // } + // //娣诲姞future 鍒ゆ柇 add for pipl sushanhu 20220317 end + // } // if (interfaceUserUpsertContact.size() > 0) { // NFM606Controller.executeNotFuture('', interfaceUserUpsertContact); //娣诲姞future 鍒ゆ柇 add for pipl sushanhu 20220316 start @@ -425,7 +429,7 @@ // } //624璋冪敤606闂淇 thh 20220325 end - } + // } } -- Gitblit v1.9.1