Commit 9f719d68 authored by bsatyanarayana-nisum-com's avatar bsatyanarayana-nisum-com Committed by tdutta-nisum-com

MT-97_7 : SNS :: Update_RoleTable_While_Account_CRUD_operations (#83)

parent c9f183d8
...@@ -82,12 +82,30 @@ public class AccountServiceImpl implements AccountService { ...@@ -82,12 +82,30 @@ public class AccountServiceImpl implements AccountService {
}else if(action != null && action.equals("U")){//U means updating existing Account }else if(action != null && action.equals("U")){//U means updating existing Account
boolean flag = false; boolean flag = false;
boolean nameFlag = false;
boolean accountExistFlag = false;
List<Account> accounts = accountRepo.findAll(); List<Account> accounts = accountRepo.findAll();
Account accountBeforeUpdate = accountRepo.findByAccountId(account.getAccountId()); Account accountBeforeUpdate = accountRepo.findByAccountId(account.getAccountId());
if(accountBeforeUpdate.getAccountName().equalsIgnoreCase(account.getAccountName())) { nameFlag = accountBeforeUpdate.getAccountName().equalsIgnoreCase(account.getAccountName());
if(accounts!= null && !accounts.isEmpty() && accounts.size()>0 ){
for(Account accObj : accounts){
accountExistFlag = accObj.getAccountName().trim().equalsIgnoreCase(account.getAccountName().trim());
if(accountExistFlag){
break;
}
}
}
if( nameFlag && accountExistFlag) {
response ="Account already exist";
return response;
}
//if(accountBeforeUpdate.getAccountName().equalsIgnoreCase(account.getAccountName())) {
List<String> employeeIds = null; List<String> employeeIds = null;
List<Account> accountList = null; List<Account> accountList = null;
List<String> dmsAddedByUser = null; List<String> dmsAddedByUser = null;
...@@ -136,22 +154,11 @@ public class AccountServiceImpl implements AccountService { ...@@ -136,22 +154,11 @@ public class AccountServiceImpl implements AccountService {
return response; return response;
} }
if(accounts!= null && !accounts.isEmpty() && accounts.size()>0 ){
for(Account accObj : accounts){
flag = accObj.getAccountName().trim().equalsIgnoreCase(account.getAccountName().trim());
if(flag){
break;
}
}
}
if(flag) {
response ="Account already exist";
return response;
}
} //}
return response; return response;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment