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/DealerPersonnelController.cls | 377 +++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 306 insertions(+), 71 deletions(-)
diff --git a/force-app/main/default/classes/DealerPersonnelController.cls b/force-app/main/default/classes/DealerPersonnelController.cls
index 41ed30f..33f3d9e 100644
--- a/force-app/main/default/classes/DealerPersonnelController.cls
+++ b/force-app/main/default/classes/DealerPersonnelController.cls
@@ -1,4 +1,4 @@
-public with sharing class DealerPersonnelController {
+public without sharing class DealerPersonnelController {
public DealerPersonnelController() {
}
@@ -6,6 +6,7 @@
public static String processData(String fileData,String sobjectName,List<String> fields) {
system.debug('fileData===============>'+fileData);
String errorMage = '';
+ Savepoint sp = Database.setSavepoint();
try {
if(fileData != null){
String[] fileLines = new String[]{};
@@ -13,77 +14,147 @@
system.debug('fileLines===================>'+fileLines);
// 缁忛攢鍟嗙鐞嗙紪鐮�
List<String> managementCodeList = new List<String>();
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy start
+ // 瀹㈡埛鍚�
+ List<String> CustomerNameList = new List<String>();
+ //浜哄憳绠$悊缂栫爜
+ List<String> CManageCodeList = new List<String>();
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy end
// 瀵煎叆鐨勬暟鎹�
List<List<String>> inputList = new List<List<String>>();
for (Integer i = 1,j = fileLines.size(); i < j; i++) {
List<String> inputValues = new List<String>();
- inputValues = fileLines[i].split(',');
- System.debug('inputValues=============>'+inputValues);
- if(inputValues != null){
- if(inputValues[0] == '' || inputValues[0]== null){
- errorMage += 'errorMage: 绗�' + i + '琛�,濮撳悕涓嶈兘涓虹┖!';
- errorMage += '=';
- }
- if(inputValues[1] == '' || inputValues[1] ==null){
- errorMage += 'errorMage: 绗�' + i + '琛�,鎵嬫満涓嶈兘涓虹┖!';
- errorMage += '=';
+ if(fileLines[i].replace(',','').trim()!=''){
+ inputValues = fileLines[i].split(',',-1);
+ System.debug('inputValues=============>'+inputValues);
+ System.debug('fileLines[i]=============>'+fileLines[i]);
+ if(inputValues != null){
+ if(inputValues[0] == '' || inputValues[0]== null){
+ errorMage += 'errorMage: 绗�' + i + '琛�,濮撳悕涓嶈兘涓虹┖!';
+ errorMage += '=';
+ }
+ // if(inputValues[1] == '' || inputValues[1] ==null){
+ // errorMage += 'errorMage: 绗�' + i + '琛�,鎵嬫満涓嶈兘涓虹┖!';
+ // errorMage += '=';
+ // }
+ // boolean mobileNumberFlag = mobileNumberVerification(inputValues[1]);
+ // if(mobileNumberFlag == false){
+ // errorMage += 'errorMage: 浣犵殑鎵嬫満鍙风爜涓嶅お姝g‘,璇锋鏌ユ偍鐨勬墜鏈烘槸鍚︽纭�!';
+ // errorMage += '=';
+ // }
+ // if(inputValues[2] == '' || inputValues[2] == null){
+ // errorMage += 'errorMage: 绗�' + i + '琛�,閭涓嶈兘涓虹┖!';
+ // errorMage += '=';
+ // }
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy start
+ if(inputValues[2] != '' && inputValues[2] != null){
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy end
+ boolean mailboxFlag = mailboxVerification(inputValues[2]);
+ if(mailboxFlag == false){
+ errorMage += 'errorMage: 浣犵殑閭涓嶅お姝g‘,璇锋鏌ユ偍鐨勯偖绠辨牸寮�!';
+ errorMage += '=';
+ }
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy start
+ }
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy end
+ if(inputValues[3] == '' || inputValues[3] == null){
+ errorMage += 'errorMage: 绗�' + i + '琛�,缁忛攢鍟嗙鐞嗙紪鐮佷笉鑳戒负绌�!';
+ errorMage += '=';
+ }
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy start
+ if(inputValues[4] == '' || inputValues[4] == null){
+ errorMage += 'errorMage: 绗�' + i + '琛�,瀹㈡埛鍚嶄笉鑳戒负绌�!';
+ errorMage += '=';
+ }
+ if(inputValues[5] == '' || inputValues[5] == null){
+ errorMage += 'errorMage: 绗�' + i + '琛�,缁忛攢鍟嗙敤鎴蜂笉鑳戒负绌�!';
+ errorMage += '=';
+ }
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy end
+ inputValues[3]=inputValues[3].leftpad(10,'0');
+ System.debug('娴嬭瘯鍘婚浂1 '+inputValues[3].replace(' ','').length());
+
+ managementCodeList.add(inputValues[3]);
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy start
+ CustomerNameList.add(inputValues[4]);
+ CManageCodeList.add(inputValues[6]);
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy end
+ inputList.add(inputValues);
+ //瀵煎叆鐨勬暟鎹�
+ System.debug('inputValues[0]===============>'+ inputValues[0]);
+ System.debug('inputValues[1]===============>'+ inputValues[1]);
+ System.debug('inputValues[2]===============>'+ inputValues[2]);
+ System.debug('inputValues[3]===============>'+ inputValues[3]);
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy start
+ System.debug('inputValues[4]===============>'+ inputValues[4]);
+ System.debug('inputValues[4]===============>'+ inputValues[5]);
+ System.debug('inputValues[6]===============>'+ inputValues[6]);
+ System.debug('inputValues[7]===============>'+ inputValues[7]);
+ System.debug('inputValues[8]===============>'+ inputValues[8]);
+ System.debug('inputValues[9]===============>'+ inputValues[9]);
+ System.debug('inputValues[10]===============>'+ inputValues[10]);
+ System.debug('inputValues[11]===============>'+ inputValues[11]);
+ System.debug('inputValues[12]===============>'+ inputValues[12]);
+ System.debug('inputValues[13]===============>'+ inputValues[13]);
+ System.debug('inputValues[14]===============>'+ inputValues[14]);
+ System.debug('inputValues[15]===============>'+ inputValues[15]);
+ System.debug('inputValues[16]===============>'+ inputValues[16]);
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy end
+
}
- boolean mobileNumberFlag = mobileNumberVerification(inputValues[1]);
- if(mobileNumberFlag == false){
- errorMage += 'errorMage: 浣犵殑鎵嬫満鍙风爜涓嶅お姝g‘,璇锋鏌ユ偍鐨勬墜鏈烘槸鍚︽纭�!';
- errorMage += '=';
- }
- if(inputValues[2] == '' || inputValues[2] == null){
- errorMage += 'errorMage: 绗�' + i + '琛�,閭涓嶈兘涓虹┖!';
- errorMage += '=';
- }
- boolean mailboxFlag = mailboxVerification(inputValues[2]);
- if(mailboxFlag == false){
- errorMage += 'errorMage: 浣犵殑閭涓嶅お姝g‘,璇锋鏌ユ偍鐨勯偖绠辨牸寮�!';
- errorMage += '=';
- }
- if(inputValues[3] == '' || inputValues[3] == null){
- errorMage += 'errorMage: 绗�' + i + '琛�,缁忛攢鍟嗙鐞嗙紪鐮佷笉鑳戒负绌�!';
- errorMage += '=';
- }
-
- managementCodeList.add(inputValues[3]);
- inputList.add(inputValues);
- //瀵煎叆鐨勬暟鎹�
- System.debug('inputValues[0]===============>'+ inputValues[0]);
- System.debug('inputValues[1]===============>'+ inputValues[1]);
- System.debug('inputValues[2]===============>'+ inputValues[2]);
- System.debug('inputValues[3]===============>'+ inputValues[3]);
}
}
Map<String,Account> accountIdMap = new Map<String,Account>();
- List<Account> accountList = [select id, Name,Management_Code__c from Account where Management_Code__c in: managementCodeList];
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy start
+ Map<String,Contact> contactIdMap = new Map<String,Contact>();
+ Map<Id,String> ManagementCodeMap = new Map<Id,String>();
+ List<Id> AccountIdList =new List<Id>();
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy end
+ List<Account> accountList = [select id, Name,Management_Code__c from Account where Management_Code__c in: managementCodeList and Name in:CustomerNameList ];
for(Account ac : accountList){
accountIdMap.put(ac.Management_Code__c,ac);
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy start
+ AccountIdList.add(ac.Id);
+ ManagementCodeMap.put(ac.Id,ac.Management_Code__c);
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy end
}
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy start
+ //鏌ヨ瀹㈡埛浜哄憳鏄惁鏈夋暟鎹�
+ List<Contact> contactList = [select id, CManageCode__c,AccountId from Contact where AccountId in: AccountIdList and CManageCode__c in:CManageCodeList ];
+ for(Contact cc : contactList){
+ String contactKey=ManagementCodeMap.get(cc.AccountId)+'_'+cc.CManageCode__c;
+ contactIdMap.put(contactKey,cc);
+ }
+ List<Contact> cnupdateList = new List<Contact>();
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy end
List<Contact> cnList = new List<Contact>();
Integer lineNumber = 1;
for(List<String> lineList :inputList){
Contact con = new Contact();
//鏆傛椂瀵煎叆鐨勬槸缁忛攢鍟嗙敤鎴凤紝鎵�浠ヨ褰曠被鍨嬪彧鏈夌粡閿�鍟嗭紝鏆傛椂鍐欐锛涘悗鏈熷鏋滄湁鍙樺姩鍐嶆洿鏀�
con.RecordTypeId = '01210000000QfWiAAK';
- if(lineList[0] != null && lineList[0] != ''){
- con.LastName = lineList[0];
- }else{
- errorMage += 'error: 绗�'+ lineNumber +'琛屾暟鎹�,濮撴皬'+lineList[0]+'涓嶅瓨鍦�';
- errorMage += '=';
- }
- if(lineList[1] != null && lineList[1] != ''){
- if(mobileNumberVerification(lineList[1])){
- con.MobilePhone = lineList[1];
+ if(!contactIdMap.containsKey(lineList[3]+'_'+lineList[6])){
+ if(lineList[0] != null && lineList[0] != ''){
+ con.LastName = lineList[0];
}else{
- errorMage += 'error: 绗�'+ lineNumber +'琛屾暟鎹�,鎵嬫満'+lineList[1]+'涓嶆纭�!';
+ errorMage += 'error: 绗�'+ lineNumber +'琛屾暟鎹�,濮撴皬'+lineList[0]+'涓嶅瓨鍦�';
errorMage += '=';
- }
- }else{
- errorMage += 'error: 绗�'+ lineNumber +'琛屾暟鎹�,鎵嬫満'+lineList[1]+'涓嶅瓨鍦�';
- errorMage += '=';
+ }
}
+ if(lineList[1] != null && lineList[1] != ''){
+ // if(mobileNumberVerification(lineList[1])){
+ con.MobilePhone = lineList[1];
+ // }else{
+ // errorMage += 'error: 绗�'+ lineNumber +'琛屾暟鎹�,鎵嬫満'+lineList[1]+'涓嶆纭�!';
+ // errorMage += '=';
+ // }
+ }
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy start
+ // else{
+ // errorMage += 'error: 绗�'+ lineNumber +'琛屾暟鎹�,鎵嬫満'+lineList[1]+'涓嶅瓨鍦�';
+ // errorMage += '=';
+ // }
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy end
if(lineList[2] != null && lineList[2] != ''){
if(mailboxVerification(lineList[2])){
con.Email = lineList[2];
@@ -91,39 +162,163 @@
errorMage += 'error: 绗�'+ lineNumber +'琛屾暟鎹�,鐢靛瓙閭欢'+lineList[2]+'涓嶆纭�!';
errorMage += '=';
}
- }else{
- errorMage += 'error: 绗�'+ lineNumber +'琛屾暟鎹�,鐢靛瓙閭欢'+lineList[2]+'涓嶅瓨鍦�';
- errorMage += '=';
}
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy start
+ // else{
+ // errorMage += 'error: 绗�'+ lineNumber +'琛屾暟鎹�,鐢靛瓙閭欢'+lineList[2]+'涓嶅瓨鍦�';
+ // errorMage += '=';
+ // }
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy end
if(accountIdMap.containsKey(lineList[3])){
con.AccountId = accountIdMap.get(lineList[3]).id;
}else{
- errorMage += 'error: 绗�'+ lineNumber +'琛屾暟鎹�,缁忛攢鍟嗙紪鐮�'+lineList[3]+'涓嶅瓨鍦�';
+ errorMage += 'error: 绗�'+ lineNumber +'琛屾暟鎹�,缁忛攢鍟嗙紪鐮�'+lineList[3]+'鎴栬�呭鎴峰悕涓嶅瓨鍦�';
errorMage += '=';
}
//鏆傚畾鍒涘缓鐩存帴涓� true
- con.Agency_User__c = true;
+ // con.Agency_User__c = true;
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy start
+ if(lineList[5] != null && lineList[5] != ''){
+ if(lineList[5]=='true'||lineList[5]=='TRUE'){
+ con.Agency_User__c=true;
+ }else{
+ con.Agency_User__c=false;
+ }
+ }else{
+ errorMage += 'error: 绗�'+ lineNumber +'琛屾暟鎹�,缁忛攢鍟嗙敤鎴�'+lineList[0]+'涓嶅瓨鍦�';
+ errorMage += '=';
+ }
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy end
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy start
+ //缁忛攢鍟嗕笓鍛樼被鍨�
+ if(VerificationOLYAssistantType(lineList[7])){
+ con.OLY_Assistant_Type__c = lineList[7];
+ }else{
+ errorMage += 'error: 绗�'+ lineNumber +'琛屾暟鎹�,缁忛攢鍟嗕笓鍛樼被鍨�'+lineList[7]+'涓嶆纭�!';
+ errorMage += '=';
+ }
+ //鍏ヨ亴骞翠唤
+ if(VerificationDateType(lineList[8])){
+ con.InductionYear__c = ConversionDateType(lineList[8]);
+ }else{
+ errorMage += 'error: 绗�'+ lineNumber +'琛屾暟鎹�,鍏ヨ亴骞翠唤'+lineList[8]+'鏍煎紡涓嶆纭�!';
+ errorMage += '=';
+ }
+ //GIR璁よ瘉绾у埆
+ if(VerifyCertificationLevel(lineList[9])){
+ con.GIR_CertificationLevel__c = lineList[9];
+ }else{
+ errorMage += 'error: 绗�'+ lineNumber +'琛屾暟鎹�,GIR璁よ瘉绾у埆'+lineList[9]+'涓嶆纭�!';
+ errorMage += '=';
+ }
+ //GIR璁よ瘉鏃堕棿
+ if(VerificationDateType(lineList[10])){
+ con.GIR_CertificationTime__c = ConversionDateType(lineList[10]);
+ }else{
+ errorMage += 'error: 绗�'+ lineNumber +'琛屾暟鎹�,GIR璁よ瘉鏃堕棿'+lineList[10]+'鏍煎紡涓嶆纭�!';
+ errorMage += '=';
+ }
+ //SP璁よ瘉绾у埆
+ if(VerifyCertificationLevel(lineList[11])){
+ con.SP_CertificationLevel__c = lineList[11];
+ }else{
+ errorMage += 'error: 绗�'+ lineNumber +'琛屾暟鎹�,SP璁よ瘉绾у埆'+lineList[11]+'涓嶆纭�!';
+ errorMage += '=';
+ }
+ //SP璁よ瘉鏃堕棿
+ if(VerificationDateType(lineList[12])){
+ con.SP_CertificationTime__c = ConversionDateType(lineList[12]);
+ }else{
+ errorMage += 'error: 绗�'+ lineNumber +'琛屾暟鎹�,SP璁よ瘉鏃堕棿'+lineList[12]+'鏍煎紡涓嶆纭�!';
+ errorMage += '=';
+ }
+ //ET璁よ瘉绾у埆
+ if(VerifyCertificationLevel(lineList[13])){
+ con.ET_CertificationLevel__c = lineList[13];
+ }else{
+ errorMage += 'error: 绗�'+ lineNumber +'琛屾暟鎹�,ET璁よ瘉绾у埆'+lineList[13]+'涓嶆纭�!';
+ errorMage += '=';
+ }
+ //ET璁よ瘉鏃堕棿
+ if(VerificationDateType(lineList[14])){
+ con.ET_CertificationTime__c = ConversionDateType(lineList[14]);
+ }else{
+ errorMage += 'error: 绗�'+ lineNumber +'琛屾暟鎹�,ET璁よ瘉鏃堕棿'+lineList[14]+'鏍煎紡涓嶆纭�!';
+ errorMage += '=';
+ }
+ //ENG璁よ瘉绾у埆
+ if(VerifyCertificationLevel(lineList[15])){
+ con.ENG_CertificationLevel__c = lineList[15];
+ }else{
+ errorMage += 'error: 绗�'+ lineNumber +'琛屾暟鎹�,ENG璁よ瘉绾у埆'+lineList[15]+'涓嶆纭�!';
+ errorMage += '=';
+ }
+ //ENG璁よ瘉鏃堕棿
+ if(VerificationDateType(lineList[16])){
+ con.ENG_CertificationTime__c = ConversionDateType(lineList[16]);
+ }else{
+ errorMage += 'error: 绗�'+ lineNumber +'琛屾暟鎹�,ENG璁よ瘉鏃堕棿'+lineList[16]+'鏍煎紡涓嶆纭�!';
+ errorMage += '=';
+ }
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy end
lineNumber++;
- cnList.add(con);
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy start
+ System.debug('001+'+lineList[3]+'_'+lineList[6]);
+ System.debug('002+'+contactIdMap.get(lineList[3]+'_'+lineList[6]));
+ if(contactIdMap.containsKey(lineList[3]+'_'+lineList[6])){
+ con.Id=contactIdMap.get(lineList[3]+'_'+lineList[6]).Id;
+ cnupdateList.add(con);
+ }else {
+ cnList.add(con);
+ }
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy end
+ // cnList.add(con);
}
if(errorMage != ''){
system.debug('errorMage==========>'+errorMage);
return errorMage;
}
+
+
// 鏂板鍛ㄦ姤鏄庣粏
if(cnList.size() > 0 ){
+ System.debug('003+'+cnList);
insertContact(cnList);
}
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy start
+ // 鏇存柊鍛ㄦ姤鏄庣粏
+ if(cnupdateList.size() > 0 ){
+ System.debug('004+'+cnupdateList);
+ updateContact(cnupdateList);
+ }
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy start
}
return 'success';
} catch (Exception e) {
- System.debug('exception'+e);
- return 'exception'+e;
+ Database.rollback(sp);
+ System.debug('exception++++++++++++++++++'+e.getLineNumber()+e);
+ String errer=String.valueOf(e);
+ String errerContactiD='';
+ String errerContactName='';
+ if(errer.contains('UniqueNumber__c 涓庤褰曞�奸噸澶�')){
+ List<String> errerList = errer.split('UniqueNumber__c 涓庤褰曞�奸噸澶�');
+ if(errerList.size()>1){
+ errerContactiD=errerList[1].substring(errerList[1].indexOf('ID 涓�:')+5,errerList[1].indexOf(': []')).replace(' ','');
+ List<Contact> repeatContact=[select Name from Contact where Id = :errerContactiD];
+ if(repeatContact.size()>0){
+ errerContactName=repeatContact[0].Name;
+ return 'error: 鏁版嵁涓瓨鍦ㄤ笌绯荤粺鐜版湁鐢ㄦ埛 '+errerContactName+'锛圛d涓猴細'+errerContactiD+'锛夐噸澶嶇殑鐢佃瘽鍙风爜';
+ }else{
+ return 'error: 鏁版嵁涓瓨鍦ㄩ噸澶嶇殑鐢佃瘽鍙风爜';
+ }
+ }
+ }
+ return e.getLineNumber()+'exception'+e;
}
}
// 鐢靛瓙閭欢鐨勯獙璇�
public static boolean mailboxVerification(String mailbox){
- String check = '^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$';
+ String check = '^([a-z0-9A-Z]+[_-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$';
Pattern regex = Pattern.compile(check);
Matcher matcher = regex.matcher(mailbox);
if (matcher.matches()){
@@ -132,18 +327,58 @@
return false;
}
// 鎵嬫満鍙风殑楠岃瘉
- public static boolean mobileNumberVerification(String phoneNumber){
- String check = '^((17[0-9])|(14[0-9])|(13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$';
- Pattern regex = Pattern.compile(check);
- Matcher matcher = regex.matcher(phoneNumber);
- if(matcher.matches()){
- return true;
- }
- return false;
- }
+ // public static boolean mobileNumberVerification(String phoneNumber){
+ // String check = '^((17[0-9])|(14[0-9])|(13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$';
+ // Pattern regex = Pattern.compile(check);
+ // Matcher matcher = regex.matcher(phoneNumber);
+ // if(matcher.matches()){
+ // return true;
+ // }
+ // return false;
+ // }
//鏂板瀹㈡埛浜哄憳锛�
public static void insertContact(List<Contact> data) {
insert data;
}
-
+ // SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy start
+ //鏍¢獙璁よ瘉绾у埆锛�
+ public static boolean VerifyCertificationLevel(String data) {
+ if(data=='A'||data=='B'||data==''){
+ return true;
+ }
+ return false;
+ }
+ //鏍¢獙鏃ユ湡绫诲瀷
+ public static Boolean VerificationDateType(String data) {
+ List<String> date1str;
+ List<String> date2str;
+ if(data==''){
+ return true;
+ }
+ date1str=data.split('/');
+ date2str=data.split('-');
+ if(date1str.size()>1||date2str.size()>1){
+ return true;
+ }
+ return false;
+ }
+ //杞崲鏃ユ湡绫诲瀷锛�
+ public static Date ConversionDateType(String data) {
+ if(data==''){
+ return null;
+ }
+ return Date.valueOf(data.replace('/','-'));
+ }
+ //鏍¢獙缁忛攢鍟嗕笓鍛樼被鍨嬶紱
+ public static Boolean VerificationOLYAssistantType(String data) {
+ if(data=='GR涓撳憳'||data=='SP涓撳憳'||data=='GRSP涓撳憳'||data=='ET涓撳憳'||data=='TB涓撳憳'||data=='濂ヨ緣鍩哄眰涓撳憳'||data=='鍟嗗姟鍔╃悊'||data=='*****'||data==''){
+ return true;
+ }
+ return false;
+ }
+ //鏇存柊瀹㈡埛浜哄憳锛�
+ public static void updateContact(List<Contact> data){
+ update data;
+ }
+ //SWAG-CEW85A 銆愬鎵樸�戞秷鑰楀搧&DAMS绯荤粺缁忛攢鍟嗕汉鍛樼鐞嗏�斺�斾俊鎭畬鍠勶紱fy end
}
\ No newline at end of file
--
Gitblit v1.9.1