Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mytime
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Narendar Vakiti
mytime
Commits
cf30e48e
Commit
cf30e48e
authored
Jul 27, 2018
by
bsatyanarayana-nisum-com
Committed by
rbonthala-nisum-com
Jul 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MT-97_5 : SNS :: Update_RoleTable_While_Account_CRUD_operations (#81)
parent
5718d05f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
83 deletions
+1
-83
AccountServiceImpl.java
...ain/java/com/nisum/mytime/service/AccountServiceImpl.java
+1
-83
No files found.
src/main/java/com/nisum/mytime/service/AccountServiceImpl.java
View file @
cf30e48e
...
@@ -43,89 +43,7 @@ public class AccountServiceImpl implements AccountService {
...
@@ -43,89 +43,7 @@ public class AccountServiceImpl implements AccountService {
Account
accountResult
=
null
;
Account
accountResult
=
null
;
String
roleId
=
roleInfoService
.
getRole
(
MyTimeUtils
.
ACCOUNT
);
String
roleId
=
roleInfoService
.
getRole
(
MyTimeUtils
.
ACCOUNT
);
//List<Account> accounts = accountRepo.findAll();
/* if( action != null && action.equals(MyTimeUtils.STRING_N)) {//N means adding New Account
if( !accounts.isEmpty() && accounts.size() > 0){
response ="Account already exist";
}else {
List<String> accDms = account.getDeliveryManagers();
account.setAccountId(generateAccountId());
account.setStatus(MyTimeUtils.STRING_Y);
accountResult = accountRepo.save(account);
if(accDms != null && !accDms.isEmpty() && accDms.size() > 0) {
roleMappingService.saveUniqueEmployeeAndRole(accDms, roleId);
}
if(accountResult.getId() != null) {
response="Saved succesfully";
}else {
response = "Error occured while account creating";
}
}
}else if(action != null && action.equals("U")){//U means updating existing Account
if( !accounts.isEmpty() && accounts.size() > 0){
for(Account accObj : accounts) {
if(!accObj.getAccountId().equals(account.getAccountId()) && accObj.getAccountName().equalsIgnoreCase(account.getAccountName())){
response ="Account already exist with updated account name";
return response;
}
}
//response ="Account already exist";
}
List<String> employeeIds = null;
List<Account> accountList = null;
List<String> dmsAddedByUser = null;
List<String> dmsDeletedByUser = null;
Map<String, Integer> dmsCount = new HashMap<String,Integer>();
Account accountBeforeUpdate = accountRepo.findByAccountId(account.getAccountId());
List<String> updatedAccDms = account.getDeliveryManagers();
List<String> beforeAccUpdateDms = accountBeforeUpdate.getDeliveryManagers();
dmsAddedByUser = CommomUtil.getAddedManagersList(beforeAccUpdateDms, updatedAccDms);
dmsDeletedByUser = CommomUtil.getDeletedManagersList(beforeAccUpdateDms, updatedAccDms);
accountList = accountRepo.findAll();
if(accountList != null && !accountList.isEmpty() && accountList.size() >0) {
for (Account acc : accountList) {
employeeIds = acc.getDeliveryManagers();
if(employeeIds != null && !employeeIds.isEmpty() && employeeIds.size() >0) {
for(String eId:employeeIds) {
if(dmsCount.get(eId) != null)
dmsCount.put(eId, dmsCount.get(eId)+1);
else
dmsCount.put(eId, 1);
employeeIds = null;
}
}
}
}
for (String empId : dmsDeletedByUser) {
if(dmsCount.get(empId)==1) {
//Service call for RoleMapping
roleMappingService.deleteRole(empId,roleId);
}
}
//account.setStatus(MyTimeUtils.STRING_Y);
account.setStatus(accountBeforeUpdate.getStatus());
accountResult = accountRepo.save(account);
roleMappingService.saveUniqueEmployeeAndRole(dmsAddedByUser, roleId);
response="Updated succesfully";
}*/
if
(
action
!=
null
&&
action
.
equals
(
MyTimeUtils
.
STRING_N
))
{
//N means adding New Account
if
(
action
!=
null
&&
action
.
equals
(
MyTimeUtils
.
STRING_N
))
{
//N means adding New Account
boolean
flag
=
false
;
boolean
flag
=
false
;
...
@@ -177,7 +95,7 @@ public class AccountServiceImpl implements AccountService {
...
@@ -177,7 +95,7 @@ public class AccountServiceImpl implements AccountService {
}
}
if
(
flag
)
{
if
(
flag
)
{
response
=
"Account
Already exist with update account name
"
;
response
=
"Account
already exist
"
;
return
response
;
return
response
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment