| Line 531... |
Line 531... |
| 531 |
}
|
531 |
}
|
| 532 |
List<Activity> activities = null;
|
532 |
List<Activity> activities = null;
|
| 533 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
533 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 534 |
if (roleManager.isAdmin(loginDetails.getRoleIds())) {
|
534 |
if (roleManager.isAdmin(loginDetails.getRoleIds())) {
|
| 535 |
Set<Integer> authUserIds = allactivities.stream().map(x -> x.getCreatedBy()).collect(Collectors.toSet());
|
535 |
Set<Integer> authUserIds = allactivities.stream().map(x -> x.getCreatedBy()).collect(Collectors.toSet());
|
| 536 |
List<AuthUser> users = authRepository.selectAllAuthUserByIds(new ArrayList<>(authUserIds));
|
536 |
List<AuthUser> users = authRepository.selectByIds(new ArrayList<>(authUserIds));
|
| 537 |
Map<Integer, String> authUserNameMap = users.stream().collect(Collectors.toMap(AuthUser::getId, x -> x.getFirstName() + " " + x.getLastName()));
|
537 |
Map<Integer, String> authUserNameMap = users.stream().collect(Collectors.toMap(AuthUser::getId, x -> x.getFirstName() + " " + x.getLastName()));
|
| 538 |
allactivities.stream().forEach(x -> x.setName(authUserNameMap.get(x.getCreatedBy())));
|
538 |
allactivities.stream().forEach(x -> x.setName(authUserNameMap.get(x.getCreatedBy())));
|
| 539 |
activities = allactivities;
|
539 |
activities = allactivities;
|
| 540 |
} else {
|
540 |
} else {
|
| 541 |
activities = allactivities.stream().filter(x -> ActivityType.PARTNER_ACTIVITIES.contains(x.getType())).collect(Collectors.toList());
|
541 |
activities = allactivities.stream().filter(x -> ActivityType.PARTNER_ACTIVITIES.contains(x.getType())).collect(Collectors.toList());
|
| Line 557... |
Line 557... |
| 557 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
557 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 558 |
Ticket ticket = ticketRepository.selectById(ticketId);
|
558 |
Ticket ticket = ticketRepository.selectById(ticketId);
|
| 559 |
List<TicketAssigned> ticketAssignedList = ticketAssignedRepository.selectByTicketIds(Arrays.asList(ticketId));
|
559 |
List<TicketAssigned> ticketAssignedList = ticketAssignedRepository.selectByTicketIds(Arrays.asList(ticketId));
|
| 560 |
List<Integer> authUserIds = ticketAssignedList.stream().map(x -> x.getAssineeId()).collect(Collectors.toList());
|
560 |
List<Integer> authUserIds = ticketAssignedList.stream().map(x -> x.getAssineeId()).collect(Collectors.toList());
|
| 561 |
authUserIds.add(ticketAssignedList.get(ticketAssignedList.size() - 1).getManagerId());
|
561 |
authUserIds.add(ticketAssignedList.get(ticketAssignedList.size() - 1).getManagerId());
|
| 562 |
Map<Integer, AuthUser> authUsersMap = authRepository.selectAllAuthUserByIds(authUserIds).stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
|
562 |
Map<Integer, AuthUser> authUsersMap = authRepository.selectByIds(authUserIds).stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
|
| 563 |
if (ticket.getCloseTimestamp() == null) {
|
563 |
if (ticket.getCloseTimestamp() == null) {
|
| 564 |
Activity activity = new Activity();
|
564 |
Activity activity = new Activity();
|
| 565 |
activity.setCreatedBy(0);
|
565 |
activity.setCreatedBy(0);
|
| 566 |
activity.setCreateTimestamp(LocalDateTime.now());
|
566 |
activity.setCreateTimestamp(LocalDateTime.now());
|
| 567 |
String subject = null;
|
567 |
String subject = null;
|
| Line 879... |
Line 879... |
| 879 |
activity.setType(ActivityType.COMMUNICATION_IN);
|
879 |
activity.setType(ActivityType.COMMUNICATION_IN);
|
| 880 |
activity.setCreateTimestamp(LocalDateTime.now());
|
880 |
activity.setCreateTimestamp(LocalDateTime.now());
|
| 881 |
} else {
|
881 |
} else {
|
| 882 |
String message = String.format(INTERNAL_REOPEN_MAIL, ticketId, retailerService.getFofoRetailer(loginDetails.getFofoId()).getBusinessName());
|
882 |
String message = String.format(INTERNAL_REOPEN_MAIL, ticketId, retailerService.getFofoRetailer(loginDetails.getFofoId()).getBusinessName());
|
| 883 |
String to = authRepository.selectById(ticket.getL1AuthUser()).getEmailId();
|
883 |
String to = authRepository.selectById(ticket.getL1AuthUser()).getEmailId();
|
| 884 |
String[] ccTo = authRepository.selectAllAuthUserByIds(Arrays.asList(ticket.getL2AuthUser(), ticket.getL3AuthUser(), ticket.getL4AuthUser(), ticket.getL5AuthUser())).stream().map(x -> x.getEmailId()).toArray(String[]::new);
|
884 |
String[] ccTo = authRepository.selectByIds(Arrays.asList(ticket.getL2AuthUser(), ticket.getL3AuthUser(), ticket.getL4AuthUser(), ticket.getL5AuthUser())).stream().map(x -> x.getEmailId()).toArray(String[]::new);
|
| 885 |
ticket.setLastActivity(lastActivity);
|
885 |
ticket.setLastActivity(lastActivity);
|
| 886 |
ticket.setUpdateTimestamp(LocalDateTime.now());
|
886 |
ticket.setUpdateTimestamp(LocalDateTime.now());
|
| 887 |
ticketAssignedRepository.deleteByTicketId(ticketId);
|
887 |
ticketAssignedRepository.deleteByTicketId(ticketId);
|
| 888 |
TicketAssigned ticketAssigned = new TicketAssigned();
|
888 |
TicketAssigned ticketAssigned = new TicketAssigned();
|
| 889 |
ticketAssigned.setAssineeId(ticket.getL1AuthUser());
|
889 |
ticketAssigned.setAssineeId(ticket.getL1AuthUser());
|
| Line 920... |
Line 920... |
| 920 |
|
920 |
|
| 921 |
List<Integer> positionIdsToUpdate = new ArrayList<>();
|
921 |
List<Integer> positionIdsToUpdate = new ArrayList<>();
|
| 922 |
positionIdsToUpdate.addAll(positionIdsToAddMap.keySet());
|
922 |
positionIdsToUpdate.addAll(positionIdsToAddMap.keySet());
|
| 923 |
positionIdsToUpdate.addAll(positionIdsToRemoveMap.keySet());
|
923 |
positionIdsToUpdate.addAll(positionIdsToRemoveMap.keySet());
|
| 924 |
|
924 |
|
| 925 |
Map<Integer, Position> positionsToUpdateMap = positionRepository.selectAll(positionIdsToUpdate).stream().collect(Collectors.toMap(x->x.getId(), x->x));
|
925 |
Map<Integer, Position> positionsToUpdateMap = positionRepository.selectByIds(positionIdsToUpdate).stream().collect(Collectors.toMap(x->x.getId(), x->x));
|
| 926 |
List<Integer> invalidPositionIds = positionsToUpdateMap.values().stream().filter(x-> x.getCategoryId()!= ProfitMandiConstants.TICKET_CATEGORY_RBM
|
926 |
List<Integer> invalidPositionIds = positionsToUpdateMap.values().stream().filter(x-> x.getCategoryId()!= ProfitMandiConstants.TICKET_CATEGORY_RBM
|
| 927 |
&& x.getCategoryId() != ProfitMandiConstants.TICKET_CATEGORY_SALES && x.getCategoryId() != ProfitMandiConstants.TICKET_CATEGORY_ABM).map(x -> x.getId()).collect(Collectors.toList());
|
927 |
&& x.getCategoryId() != ProfitMandiConstants.TICKET_CATEGORY_SALES && x.getCategoryId() != ProfitMandiConstants.TICKET_CATEGORY_ABM).map(x -> x.getId()).collect(Collectors.toList());
|
| 928 |
if(invalidPositionIds.size() > 0) {
|
928 |
if(invalidPositionIds.size() > 0) {
|
| 929 |
String message = "Non RBM/Sales/ABM are not allowed - " + invalidPositionIds;
|
929 |
String message = "Non RBM/Sales/ABM are not allowed - " + invalidPositionIds;
|
| 930 |
throw new ProfitMandiBusinessException(message, message, message);
|
930 |
throw new ProfitMandiBusinessException(message, message, message);
|