From 36d15f189de2e83ce2576715dac30c3c260388dd Mon Sep 17 00:00:00 2001 From: buli <137736985@qq.com> Date: 星期五, 14 七月 2023 14:47:50 +0800 Subject: [PATCH] fixconflict --- force-app/main/default/triggers/ContactHpDeptUpd.trigger | 95 +++++++++++++++++++++++++++-------------------- 1 files changed, 55 insertions(+), 40 deletions(-) diff --git a/force-app/main/default/triggers/ContactHpDeptUpd.trigger b/force-app/main/default/triggers/ContactHpDeptUpd.trigger index b420794..9ed9601 100644 --- a/force-app/main/default/triggers/ContactHpDeptUpd.trigger +++ b/force-app/main/default/triggers/ContactHpDeptUpd.trigger @@ -1,14 +1,19 @@ //鍖荤檪寰撲簨鑰呫伄瑷虹檪绉�(鍏煎嫏鍏�)銈掑鏇淬伄鍫村悎銆佹垿鐣ョ瀹ゃ兓鐥呴櫌銈備慨姝� trigger ContactHpDeptUpd on Contact (before insert, before update) { + if((!Test.isRunningTest())&&UserInfo.getUserId()==System.Label.ByPassTrigger){ + return; + } List<String> accIds = new List<String>(); List<String> FirstNameList = new List<String>(); List<String> LastnameList = new List<String>(); + List<String> LastnameEncryptedList = new List<String>(); List<id> Hospital_id_list = new List<id>(); List<id> ACCOUNT_id_list = new List<id>(); Map<String,Contact> mapCon = new Map<String,Contact>(); //***************************************INSERT 2016-12-14 By ZDF START************************************* // 澧炲姞鈥滄柊澧炲鎴蜂汉鍛樺叆渚嬭鍒欌�� //***************************************INSERT 2016-12-14 By ZDF START************************************* +//2022-02-10 PI鏀归�狅紝鐢↙astName_Encrypted__c鏇夸唬鍘熸湁鐨凬ame浣滀负mapCon鏄犲皠鐨勯敭 for(Contact a : Trigger.new) { if (Trigger.isInsert || (Trigger.isUpdate @@ -21,9 +26,12 @@ if(Trigger.isInsert&&a.Ignore_Same_Name__c==false){ FirstNameList.add(a.firstname); LastnameList.add(a.Lastname); + //zhj MEBG鏂版柟妗堟敼閫� 2022-11-28 start + //LastnameEncryptedList.add(a.LastName_Encrypted__c); ACCOUNT_id_list.add(a.Accountid); - mapCon.put((a.firstname+a.Lastname),a); + //mapCon.put(a.LastName_Encrypted__c,a); system.debug('========1111111'); + //zhj MEBG鏂版柟妗堟敼閫� 2022-11-28 end } } @@ -49,49 +57,56 @@ Hospital_id_list.add( acc.Id ); } } - List<Contact> CntingList = [ select - id, - Name, - Department__c, - Account.Parent.Name, - Account.name, - Account.Parent.Parent.Name - from - Contact - where - firstname in:FirstNameList - and - Lastname in:LastnameList - and - ( - Account.Parent.Parentid in:Hospital_id_list - or - Account.Parentid in:Hospital_id_list - or - Account.id in:Hospital_id_list - ) - ]; + //zhj MEBG鏂版柟妗堟敼閫� 2022-11-28 start + // List<Contact> CntingList = [ select + // id, + // Name, + // Department__c, + // Account.Parent.Name, + // Account.name, + // Account.Parent.Parent.Name + // from + // Contact + // where + // // firstname in:FirstNameList + // // and + // // Lastname in:LastnameList + // LastName_Encrypted__c in : LastnameEncryptedList + // and + // ( + // Account.Parent.Parentid in:Hospital_id_list + // or + // Account.Parentid in:Hospital_id_list + // or + // Account.id in:Hospital_id_list + // ) + // ]; system.debug('========1212121212'+FirstNameList); system.debug('========1212121212'+LastnameList); + //system.debug('========1212121212'+LastnameEncryptedList); system.debug('========1212121212'+Hospital_id_list); - if(CntingList.size()>0){ - system.debug('========2222222'+CntingList.size()); - Contact Cnting = CntingList[0]; - for(Contact a : Trigger.new) { - system.debug('========3333333'); - if(mapCon.containsKey(a.firstname+a.Lastname)){ - system.debug('========333333'); - if( Cnting.Account.Parent.Parent.Name != null ){ - a.addError('璇ュ鎴蜂汉鍛樺悕瀛楀凡瀛樺湪锛屽湪'+Cnting.Account.Parent.Parent.Name+'鍖婚櫌涓嬪睘 '+Cnting.Account.Parent.Name+'鎴樼暐绉戝鐨� '+Cnting.Account.Name+'绉戝锛岃淇敼,鎴栬�呭嬀閫夆�滀笉鏄噸澶嶇殑瀹㈡埛鍚嶁�濆悗锛屽啀娆$偣鍑讳繚瀛�'+Cnting); - } else if ( Cnting.Account.Parent.Name !=null ){ - a.addError('璇ュ鎴蜂汉鍛樺悕瀛楀凡瀛樺湪锛屽湪'+Cnting.Account.Parent.Name+'鍖婚櫌鐨� '+Cnting.Account.Name+' 鎴樼暐绉戝涓嬶紝璇蜂慨鏀�,鎴栬�呭嬀閫夆�滀笉鏄噸澶嶇殑瀹㈡埛鍚嶁�濆悗锛屽啀娆$偣鍑讳繚瀛�'+Cnting); - } else if ( Cnting.Account.Name != null ){ - a.addError('璇ュ鎴蜂汉鍛樺悕瀛楀凡瀛樺湪锛屽湪'+Cnting.Account.Name+'鍖婚櫌锛岃淇敼,鎴栬�呭嬀閫夆�滀笉鏄噸澶嶇殑瀹㈡埛鍚嶁�濆悗锛屽啀娆$偣鍑讳繚瀛�'+Cnting); - } - } - } - } + + // if(CntingList.size()>0){ + // system.debug('========2222222'+CntingList.size()); + // Contact Cnting = CntingList[0]; + // for(Contact a : Trigger.new) { + // system.debug('========3333333'); + // if(mapCon.containsKey(a.LastName_Encrypted__c)){ + // //For PIPL testing by Li Jun 20220308 Start + // // system.debug('========333333'); + // // if( Cnting.Account.Parent.Parent.Name != null ){ + // // a.addError('璇ュ鎴蜂汉鍛樺悕瀛楀凡瀛樺湪锛屽湪'+Cnting.Account.Parent.Parent.Name+'鍖婚櫌涓嬪睘 '+Cnting.Account.Parent.Name+'鎴樼暐绉戝鐨� '+Cnting.Account.Name+'绉戝锛岃淇敼,鎴栬�呭嬀閫夆�滀笉鏄噸澶嶇殑瀹㈡埛鍚嶁�濆悗锛屽啀娆$偣鍑讳繚瀛�'); + // // } else if ( Cnting.Account.Parent.Name !=null ){ + // // a.addError('璇ュ鎴蜂汉鍛樺悕瀛楀凡瀛樺湪锛屽湪'+Cnting.Account.Parent.Name+'鍖婚櫌鐨� '+Cnting.Account.Name+' 鎴樼暐绉戝涓嬶紝璇蜂慨鏀�,鎴栬�呭嬀閫夆�滀笉鏄噸澶嶇殑瀹㈡埛鍚嶁�濆悗锛屽啀娆$偣鍑讳繚瀛�'); + // // } else if ( Cnting.Account.Name != null ){ + // // a.addError('璇ュ鎴蜂汉鍛樺悕瀛楀凡瀛樺湪锛屽湪'+Cnting.Account.Name+'鍖婚櫌锛岃淇敼,鎴栬�呭嬀閫夆�滀笉鏄噸澶嶇殑瀹㈡埛鍚嶁�濆悗锛屽啀娆$偣鍑讳繚瀛�'); + // // } + // //For PIPL testing by Li Jun 20220308 End + // } + // } + // } } + //zhj MEBG鏂版柟妗堟敼閫� 2022-11-28 end //***************************************INSERT 2016-12-14 By ZDF EDN************************************* // 澧炲姞鈥滄柊澧炲鎴蜂汉鍛樺叆渚嬭鍒欌�� //***************************************INSERT 2016-12-14 By ZDF EDN************************************* -- Gitblit v1.9.1