From bfca7a84bec815da594f1d12558535ed06d2490b Mon Sep 17 00:00:00 2001
From: 沙世明 <shashiming@prec-tech.com>
Date: 星期二, 13 九月 2022 09:57:32 +0800
Subject: [PATCH] 本地提交备份
---
force-app/main/default/classes/ContactTriggerHandler.cls | 26 ++++++++++++++++++++++++--
1 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/force-app/main/default/classes/ContactTriggerHandler.cls b/force-app/main/default/classes/ContactTriggerHandler.cls
index 3e9f002..76a61f9 100644
--- a/force-app/main/default/classes/ContactTriggerHandler.cls
+++ b/force-app/main/default/classes/ContactTriggerHandler.cls
@@ -6,6 +6,8 @@
private Map < Id, Contact > oldMap;
private List < Contact > newList;
private List < Contact > oldList;
+ private Id AgencyId = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId(); // 20220830 ljh LLIU-CHR8FF add
+
public ContactTriggerHandler() {
this.newMap = (Map < Id, Contact > ) Trigger.newMap;
this.oldMap = (Map < Id, Contact > ) Trigger.oldMap;
@@ -22,6 +24,7 @@
syncToAgencyContact();
updateDealerNum();
sendToComPlat();
+ updateChargeState();// 20220830 ljh LLIU-CHR8FF
}
protected override void afterUpdate() {
@@ -430,7 +433,7 @@
|| old.ServicePlatformCode__c != local.ServicePlatformCode__c//鏈嶅姟骞冲彴缂栫爜
|| old.UnifiedI_Contact_ID__c != local.UnifiedI_Contact_ID__c//鏅烘収鍖荤枟缂栫爜
|| old.ContactType__c != local.ContactType__c//浜哄憳绫诲瀷
-
+ || (old.ChargeState__c != local.ChargeState__c && local.RecordTypeId == AgencyId)//璐熻矗鐪� // 20220830 ljh LLIU-CHR8FF add
) {
//鑾峰彇瀹㈡埛浜哄憳鐨勮褰曠被鍨婭D thh 20220330 start
ID InternalStaffRecordTypeId = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Internal_staff').getRecordTypeId();
@@ -439,7 +442,10 @@
//鑾峰彇瀹㈡埛浜哄憳鐨勮褰曠被鍨婭D thh 20220330 end
System.debug('local.UnifiedI_Contact_ID__c1:' + local.UnifiedI_Contact_ID__c);
System.debug('local.MobilePhone1:' + local.MobilePhone);
- if (!local.IsFromSPO__c && !InternalStaffRecordTypeId.equals(local.RecordTypeId)) {
+ // gzw 20220824 bugfix start
+ // if (!local.IsFromSPO__c && !InternalStaffRecordTypeId.equals(local.RecordTypeId)) {
+ if (!InternalStaffRecordTypeId.equals(local.RecordTypeId)) {
+ // gzw 20220824 bugfix end
// 鍖婚櫌 瀹㈡埛浜哄憳 缁熶竴骞冲彴缂栫爜鏈夊�� 鍙戦�� PO
if (DoctorRecordTypeId.equals(local.RecordTypeId) && String.isNotBlank(local.UnifiedI_Contact_ID__c)) {
if (!NFM606_IdMap.containsKey(local.Id)) {
@@ -490,5 +496,21 @@
}
}
// 606鎺ュ彛璋冪敤闂淇 thh 20220330 end
+ // 20220830 ljh LLIU-CHR8FF add start
+ private void updateChargeState(){
+ List<Contact> contactL = new List<Contact>();
+ for (Contact nObj : newList) {
+ if(nObj.RecordTypeId == AgencyId && String.isBlank(nObj.ChargeState__c)){
+ Contact cnew = new Contact();
+ cnew.Id = nObj.Id;
+ cnew.ChargeState__c = nObj.ChargeState_F__c;
+ contactL.add(cnew);
+ }
+ }
+ if (!contactL.isEmpty()) {
+ update contactL;
+ }
+ }
+ // 20220830 ljh LLIU-CHR8FF add end
}
\ No newline at end of file
--
Gitblit v1.9.1