|  |  | 
 |  |  |                                          LastName_Encrypted__c// 20220314 PI改造 by Bright | 
 |  |  |                                          , MobilePhone_Encrypted__c // 通过姓名+手机号判断人员是否重复 thh 20220518 | 
 |  |  |                                         FROM Contact  | 
 |  |  |                                         WHERE IsFromSPO__c = false AND AccountId IN:accountIdSet]; | 
 |  |  |                                         WHERE IsFromSPO__c = false AND AccountId IN:accountIdSet AND Id Not IN: oldMap.keyset()]; | 
 |  |  |             if ( contactList.size() > 0) { | 
 |  |  |                 for(Contact contact :contactList){ | 
 |  |  |                     // 通过姓名+手机号判断人员是否重复 thh 20220518 start | 
 |  |  |                     // String lastNameStr = String.isNotBlank(contact.LastName) ? contact.LastName:''; | 
 |  |  |                     // String firstNameStr = String.isNotBlank(contact.FirstName) ? contact.FirstName:''; | 
 |  |  |                     // String contactFullName = lastNameStr + firstNameStr + MobilePhoneStr; | 
 |  |  |                     // String contactFullName = lastNameStr + firstNameStr + MobilePhoneStr;  | 
 |  |  |                     String contactFullName = contact.LastName_Encrypted__c + contact.MobilePhone_Encrypted__c;// 20220314 PI改造 by Bright | 
 |  |  |                     // 通过姓名+手机号判断人员是否重复 thh 20220518 end | 
 |  |  |                     if(string.isBlank(contactFullName)){ | 
 |  |  | 
 |  |  |  | 
 |  |  |         for (Contact contactnew: newList) {  | 
 |  |  |             String accountId = String.valueOf(contactnew.AccountId).substring(0, 15); | 
 |  |  |  | 
 |  |  |             if (accountContactMap.containsKey(accountId)) { | 
 |  |  |                 Map<String,Contact> contactFullNameMap =  accountContactMap.get(accountId); | 
 |  |  |                 // 通过姓名+手机号判断人员是否重复 thh 20220518 start | 
 |  |  | 
 |  |  |                     String cManageCode = contactFullNameMap.get(contactFullName).CManageCode__c; | 
 |  |  |                     // 跳过测试程序 和 SPO通过203接口创建的联系人 | 
 |  |  |                     if (!(Test.isRunningTest() || contactnew.IsFromSPO__c)) { | 
 |  |  |                         if(Trigger.isInsert) { | 
 |  |  |                         // if(Trigger.isInsert) { | 
 |  |  |                             contactnew.LastName.addError('客户 [ '+accountName+ ' ],已存在相同名字的联系人 人员管理编码 ['+cManageCode+' ] ,不能重复创建,请了解');      | 
 |  |  |                         }  | 
 |  |  |                         // }  | 
 |  |  |                         // 客户人员删除手机号时,进行判断是否存在同名且手机号为空的客户人员 thh 20220523 start | 
 |  |  |                         if(Trigger.isUpdate && !UserInfo.getUserId().equals(System.Label.interfaceUserID)) { | 
 |  |  |                             if (String.isBlank(contactnew.MobilePhone_Encrypted__c)){ | 
 |  |  |                                 contactnew.LastName.addError('相同名字的联系人 人员管理编码 ['+cManageCode+' ] 手机号为空已经存在,不能重复创建,请了解'); | 
 |  |  |                             } else{ | 
 |  |  |                                 contactnew.LastName.addError('客户 [ '+accountName+ ' ],已存在相同名字的联系人 人员管理编码 ['+cManageCode+' ] ,不能重复创建,请了解');  | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                         // if(Trigger.isUpdate && !UserInfo.getUserId().equals(System.Label.interfaceUserID)) { | 
 |  |  |                         //     if (String.isNotBlank(oldMap.get(contactnew.Id).MobilePhone_Encrypted__c) && String.isBlank(contactnew.MobilePhone_Encrypted__c)){ | 
 |  |  |                         //         contactnew.LastName.addError('相同名字的联系人 人员管理编码 ['+cManageCode+' ] 手机号为空已经存在,不能重复创建,请了解'); | 
 |  |  |                         //     }  | 
 |  |  |                         //     if (oldMap.get(contactnew.Id).CManageCode__c != contactnew.CManageCode__c){ | 
 |  |  |                         //         contactnew.LastName.addError('客户 [ '+accountName+ ' ],已存在相同名字的联系人 人员管理编码 ['+cManageCode+' ] ,不能重复创建,请了解');  | 
 |  |  |                         //     } | 
 |  |  |                         // } | 
 |  |  |                         // 客户人员删除手机号时,进行判断是否存在同名且手机号为空的客户人员 thh 20220523 end | 
 |  |  |                     }  | 
 |  |  |                 } |