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

MT-97_6 : SNS :: Update_RoleTable_While_Account_CRUD_operations (#82)

parent cf30e48e
...@@ -85,20 +85,9 @@ public class AccountServiceImpl implements AccountService { ...@@ -85,20 +85,9 @@ public class AccountServiceImpl implements AccountService {
List<Account> accounts = accountRepo.findAll(); List<Account> accounts = accountRepo.findAll();
if(accounts!= null && !accounts.isEmpty() && accounts.size()>0 ){ Account accountBeforeUpdate = accountRepo.findByAccountId(account.getAccountId());
for(Account accObj : accounts){
flag = accObj.getAccountName().trim().equalsIgnoreCase(account.getAccountName().trim());
if(flag){
break;
}
}
}
if(flag) {
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;
...@@ -106,7 +95,7 @@ public class AccountServiceImpl implements AccountService { ...@@ -106,7 +95,7 @@ public class AccountServiceImpl implements AccountService {
Map<String, Integer> dmsCount = new HashMap<String,Integer>(); Map<String, Integer> dmsCount = new HashMap<String,Integer>();
Account accountBeforeUpdate = accountRepo.findByAccountId(account.getAccountId());
List<String> updatedAccDms = account.getDeliveryManagers(); List<String> updatedAccDms = account.getDeliveryManagers();
List<String> beforeAccUpdateDms = accountBeforeUpdate.getDeliveryManagers(); List<String> beforeAccUpdateDms = accountBeforeUpdate.getDeliveryManagers();
...@@ -144,6 +133,24 @@ public class AccountServiceImpl implements AccountService { ...@@ -144,6 +133,24 @@ public class AccountServiceImpl implements AccountService {
accountResult = accountRepo.save(account); accountResult = accountRepo.save(account);
roleMappingService.saveUniqueEmployeeAndRole(dmsAddedByUser, roleId); roleMappingService.saveUniqueEmployeeAndRole(dmsAddedByUser, roleId);
response="Updated succesfully"; response="Updated succesfully";
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