| Line 430... |
Line 430... |
| 430 |
}
|
430 |
}
|
| 431 |
|
431 |
|
| 432 |
@GetMapping(value = "/cs/createTicket")
|
432 |
@GetMapping(value = "/cs/createTicket")
|
| 433 |
public String createTicket(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
433 |
public String createTicket(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
| 434 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
434 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
435 |
boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
|
| - |
|
436 |
boolean isCrmUser = false;
|
| - |
|
437 |
|
| 435 |
List<TicketCategory> ticketCategories = csService.getAllTicketCategotyFromSubCategory();
|
438 |
List<TicketCategory> ticketCategories = csService.getAllTicketCategotyFromSubCategory();
|
| - |
|
439 |
|
| - |
|
440 |
if (isAdmin) {
|
| - |
|
441 |
AuthUser currentAuthUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| - |
|
442 |
isCrmUser = positionRepository.hasCategory(currentAuthUser.getId(), ProfitMandiConstants.TICKET_CATEGORY_CRM);
|
| - |
|
443 |
|
| - |
|
444 |
// CRM users should not see Sales and RBM categories
|
| - |
|
445 |
if (isCrmUser) {
|
| - |
|
446 |
ticketCategories = ticketCategories.stream()
|
| - |
|
447 |
.filter(tc -> tc.getId() != ProfitMandiConstants.TICKET_CATEGORY_SALES
|
| - |
|
448 |
&& tc.getId() != ProfitMandiConstants.TICKET_CATEGORY_RBM)
|
| - |
|
449 |
.collect(Collectors.toList());
|
| - |
|
450 |
}
|
| - |
|
451 |
}
|
| - |
|
452 |
|
| 436 |
model.addAttribute("roleType", roleManager.isAdmin(loginDetails.getRoleIds()));
|
453 |
model.addAttribute("roleType", isAdmin);
|
| 437 |
model.addAttribute("ticketCategories", ticketCategories);
|
454 |
model.addAttribute("ticketCategories", ticketCategories);
|
| - |
|
455 |
model.addAttribute("isCrmUser", isCrmUser);
|
| 438 |
return "create-ticket";
|
456 |
return "create-ticket";
|
| 439 |
}
|
457 |
}
|
| 440 |
|
458 |
|
| 441 |
@GetMapping(value = "/cs/getSubCategoriesByCategoryId")
|
459 |
@GetMapping(value = "/cs/getSubCategoriesByCategoryId")
|
| 442 |
public String getSubCategoriesByCategoryId(HttpServletRequest request, @RequestParam(name = "categoryId", defaultValue = "0") int categoryId, Model model) {
|
460 |
public String getSubCategoriesByCategoryId(HttpServletRequest request, @RequestParam(name = "categoryId", defaultValue = "0") int categoryId, Model model) throws ProfitMandiBusinessException {
|
| - |
|
461 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
462 |
boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
|
| - |
|
463 |
boolean isCrmUser = false;
|
| - |
|
464 |
|
| - |
|
465 |
if (isAdmin) {
|
| - |
|
466 |
AuthUser currentAuthUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| - |
|
467 |
isCrmUser = positionRepository.hasCategory(currentAuthUser.getId(), ProfitMandiConstants.TICKET_CATEGORY_CRM);
|
| - |
|
468 |
}
|
| - |
|
469 |
|
| 443 |
List<TicketSubCategory> ticketSubCategories = ticketSubCategoryRepository.selectAllVisible(categoryId);
|
470 |
List<TicketSubCategory> ticketSubCategories = ticketSubCategoryRepository.selectAllVisible(categoryId);
|
| - |
|
471 |
|
| - |
|
472 |
// CRM users should not see Sales Escalation and RBM Escalation subcategories
|
| - |
|
473 |
if (isCrmUser) {
|
| - |
|
474 |
ticketSubCategories = ticketSubCategories.stream()
|
| - |
|
475 |
.filter(tsc -> tsc.getId() != ProfitMandiConstants.TICKET_SUBCATEGORY_SALES_ESCALATION
|
| - |
|
476 |
&& tsc.getId() != ProfitMandiConstants.TICKET_SUBCATEGORY_RBM_ESCALATION)
|
| - |
|
477 |
.collect(Collectors.toList());
|
| - |
|
478 |
}
|
| - |
|
479 |
|
| 444 |
LOGGER.info(ticketSubCategories);
|
480 |
LOGGER.info(ticketSubCategories);
|
| 445 |
model.addAttribute("ticketSubCategories", ticketSubCategories);
|
481 |
model.addAttribute("ticketSubCategories", ticketSubCategories);
|
| 446 |
return "ticket-sub-categories";
|
482 |
return "ticket-sub-categories";
|
| 447 |
}
|
483 |
}
|
| 448 |
|
484 |
|
| Line 926... |
Line 962... |
| 926 |
@GetMapping(value = "/cs/managerTicket")
|
962 |
@GetMapping(value = "/cs/managerTicket")
|
| 927 |
public String getManagerTickets(HttpServletRequest request, @RequestParam(name = "orderby", defaultValue = "DESCENDING") SortOrder sortOrder, @RequestParam(name = "ticketStatus", defaultValue = "OPENED") TicketStatus ticketStatus, @RequestParam(name = "ticketSearchType", defaultValue = "") TicketSearchType ticketSearchType, @RequestParam(name = "searchTerm", defaultValue = "0") int searchTerm, Model model) throws ProfitMandiBusinessException {
|
963 |
public String getManagerTickets(HttpServletRequest request, @RequestParam(name = "orderby", defaultValue = "DESCENDING") SortOrder sortOrder, @RequestParam(name = "ticketStatus", defaultValue = "OPENED") TicketStatus ticketStatus, @RequestParam(name = "ticketSearchType", defaultValue = "") TicketSearchType ticketSearchType, @RequestParam(name = "searchTerm", defaultValue = "0") int searchTerm, Model model) throws ProfitMandiBusinessException {
|
| 928 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
964 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 929 |
long size = 0;
|
965 |
long size = 0;
|
| 930 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
966 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| - |
|
967 |
boolean isCrmUser = positionRepository.hasCategory(authUser.getId(), ProfitMandiConstants.TICKET_CATEGORY_CRM);
|
| - |
|
968 |
|
| 931 |
List<Ticket> tickets = null;
|
969 |
List<Ticket> tickets = null;
|
| 932 |
Map<Integer, List<AuthUser>> authUserListMap = null;
|
970 |
Map<Integer, List<AuthUser>> authUserListMap = null;
|
| - |
|
971 |
|
| - |
|
972 |
// CRM users can see all tickets to assign them (like managers)
|
| - |
|
973 |
if (isCrmUser) {
|
| - |
|
974 |
if (ticketStatus.equals(TicketStatus.RESOLVED)) {
|
| - |
|
975 |
tickets = ticketRepository.selectAllTickets(Optional.empty(), sortOrder, ticketSearchType, searchTerm);
|
| - |
|
976 |
size = ticketRepository.selectAllTicketsCount(Optional.empty(), ticketSearchType, searchTerm);
|
| - |
|
977 |
} else {
|
| - |
|
978 |
tickets = ticketRepository.selectAllTickets(Optional.of(TicketStatus.CLOSED.equals(ticketStatus)), sortOrder, ticketSearchType, searchTerm);
|
| - |
|
979 |
size = ticketRepository.selectAllTicketsCount(Optional.of(TicketStatus.CLOSED.equals(ticketStatus)), ticketSearchType, searchTerm);
|
| - |
|
980 |
}
|
| 933 |
if (ticketSearchType == null) {
|
981 |
} else if (ticketSearchType == null) {
|
| 934 |
if (ticketStatus.equals(TicketStatus.RESOLVED)) {
|
982 |
if (ticketStatus.equals(TicketStatus.RESOLVED)) {
|
| 935 |
tickets = ticketRepository.selectAllManagerTicket(authUser.getId(), sortOrder, Optional.empty(), null, searchTerm);
|
983 |
tickets = ticketRepository.selectAllManagerTicket(authUser.getId(), sortOrder, Optional.empty(), null, searchTerm);
|
| 936 |
size = ticketRepository.selectAllCountByManagerTicket(authUser.getId(), Optional.empty(), null, 0);
|
984 |
size = ticketRepository.selectAllCountByManagerTicket(authUser.getId(), Optional.empty(), null, 0);
|
| 937 |
} else {
|
985 |
} else {
|
| 938 |
tickets = ticketRepository.selectAllManagerTicket(authUser.getId(), sortOrder, Optional.of(TicketStatus.CLOSED.equals(ticketStatus)), null, searchTerm);
|
986 |
tickets = ticketRepository.selectAllManagerTicket(authUser.getId(), sortOrder, Optional.of(TicketStatus.CLOSED.equals(ticketStatus)), null, searchTerm);
|
| Line 1005... |
Line 1053... |
| 1005 |
model.addAttribute("subCategoryIdAndCategoryMap", subCategoryIdAndCategoryMap);
|
1053 |
model.addAttribute("subCategoryIdAndCategoryMap", subCategoryIdAndCategoryMap);
|
| 1006 |
|
1054 |
|
| 1007 |
model.addAttribute("activityMap", activityMap);
|
1055 |
model.addAttribute("activityMap", activityMap);
|
| 1008 |
model.addAttribute("authUserMap", authUserMap);
|
1056 |
model.addAttribute("authUserMap", authUserMap);
|
| 1009 |
model.addAttribute("activityMapWithActivityId", activityMapWithActivityId);
|
1057 |
model.addAttribute("activityMapWithActivityId", activityMapWithActivityId);
|
| - |
|
1058 |
model.addAttribute("isCrmUser", isCrmUser);
|
| 1010 |
|
1059 |
|
| 1011 |
return "managerTicket";
|
1060 |
return "managerTicket";
|
| 1012 |
}
|
1061 |
}
|
| 1013 |
|
1062 |
|
| 1014 |
|
1063 |
|
| 1015 |
@GetMapping(value = "/cs/edit-ticket")
|
1064 |
@GetMapping(value = "/cs/edit-ticket")
|
| 1016 |
public String getEditTicket(HttpServletRequest request, @RequestParam(name = "ticketId", defaultValue = "0") int ticketId, Model model) {
|
1065 |
public String getEditTicket(HttpServletRequest request, @RequestParam(name = "ticketId", defaultValue = "0") int ticketId, Model model) throws ProfitMandiBusinessException {
|
| - |
|
1066 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
1067 |
AuthUser currentAuthUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| - |
|
1068 |
boolean isCrmUser = positionRepository.hasCategory(currentAuthUser.getId(), ProfitMandiConstants.TICKET_CATEGORY_CRM);
|
| - |
|
1069 |
|
| 1017 |
Ticket ticket = ticketRepository.selectById(ticketId);
|
1070 |
Ticket ticket = ticketRepository.selectById(ticketId);
|
| 1018 |
List<TicketCategory> ticketCategories = csService.getAllTicketCategotyFromSubCategory();
|
1071 |
List<TicketCategory> ticketCategories = csService.getAllTicketCategotyFromSubCategory();
|
| 1019 |
TicketSubCategory ticketSubCategory = ticketSubCategoryRepository.selectById(ticket.getSubCategoryId());
|
1072 |
TicketSubCategory ticketSubCategory = ticketSubCategoryRepository.selectById(ticket.getSubCategoryId());
|
| 1020 |
List<TicketSubCategory> ticketSubCategories = ticketSubCategoryRepository.selectAll(ticketSubCategory.getCategoryId());
|
1073 |
List<TicketSubCategory> ticketSubCategories = ticketSubCategoryRepository.selectAll(ticketSubCategory.getCategoryId());
|
| 1021 |
List<AuthUser> authUsers = authRepository.selectAllActiveUser();
|
1074 |
List<AuthUser> authUsers = authRepository.selectAllActiveUser();
|
| - |
|
1075 |
|
| - |
|
1076 |
// CRM users should not see Sales/RBM categories and their Escalation subcategories
|
| - |
|
1077 |
if (isCrmUser) {
|
| - |
|
1078 |
ticketCategories = ticketCategories.stream()
|
| - |
|
1079 |
.filter(tc -> tc.getId() != ProfitMandiConstants.TICKET_CATEGORY_SALES
|
| - |
|
1080 |
&& tc.getId() != ProfitMandiConstants.TICKET_CATEGORY_RBM)
|
| - |
|
1081 |
.collect(Collectors.toList());
|
| - |
|
1082 |
ticketSubCategories = ticketSubCategories.stream()
|
| - |
|
1083 |
.filter(tsc -> tsc.getId() != ProfitMandiConstants.TICKET_SUBCATEGORY_SALES_ESCALATION
|
| - |
|
1084 |
&& tsc.getId() != ProfitMandiConstants.TICKET_SUBCATEGORY_RBM_ESCALATION)
|
| - |
|
1085 |
.collect(Collectors.toList());
|
| - |
|
1086 |
}
|
| - |
|
1087 |
|
| - |
|
1088 |
// Get partner name for modal title
|
| - |
|
1089 |
String partnerName = retailerService.getFofoRetailer(ticket.getFofoId()).getBusinessName();
|
| - |
|
1090 |
|
| 1022 |
model.addAttribute("ticket", ticket);
|
1091 |
model.addAttribute("ticket", ticket);
|
| 1023 |
model.addAttribute("ticketCategories", ticketCategories);
|
1092 |
model.addAttribute("ticketCategories", ticketCategories);
|
| 1024 |
model.addAttribute("ticketSubCategories", ticketSubCategories);
|
1093 |
model.addAttribute("ticketSubCategories", ticketSubCategories);
|
| 1025 |
model.addAttribute("ticketSubCategory", ticketSubCategory);
|
1094 |
model.addAttribute("ticketSubCategory", ticketSubCategory);
|
| 1026 |
model.addAttribute("authUsers", authUsers);
|
1095 |
model.addAttribute("authUsers", authUsers);
|
| - |
|
1096 |
model.addAttribute("isCrmUser", isCrmUser);
|
| - |
|
1097 |
model.addAttribute("partnerName", partnerName);
|
| 1027 |
return "edit-ticket-modal";
|
1098 |
return "edit-ticket-modal";
|
| 1028 |
}
|
1099 |
}
|
| 1029 |
|
1100 |
|
| 1030 |
@GetMapping(value = "/cs/edit-partner-ticket")
|
1101 |
@GetMapping(value = "/cs/edit-partner-ticket")
|
| 1031 |
public String getEditPartnerTicket(HttpServletRequest request, @RequestParam(name = "ticketId", defaultValue = "0") int ticketId, Model model) {
|
1102 |
public String getEditPartnerTicket(HttpServletRequest request, @RequestParam(name = "ticketId", defaultValue = "0") int ticketId, Model model) throws ProfitMandiBusinessException {
|
| - |
|
1103 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
1104 |
AuthUser currentAuthUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| - |
|
1105 |
boolean isCrmUser = positionRepository.hasCategory(currentAuthUser.getId(), ProfitMandiConstants.TICKET_CATEGORY_CRM);
|
| - |
|
1106 |
|
| 1032 |
Ticket ticket = ticketRepository.selectById(ticketId);
|
1107 |
Ticket ticket = ticketRepository.selectById(ticketId);
|
| 1033 |
List<TicketCategory> ticketCategories = csService.getAllTicketCategotyFromSubCategory();
|
1108 |
List<TicketCategory> ticketCategories = csService.getAllTicketCategotyFromSubCategory();
|
| 1034 |
TicketSubCategory ticketSubCategory = ticketSubCategoryRepository.selectById(ticket.getSubCategoryId());
|
1109 |
TicketSubCategory ticketSubCategory = ticketSubCategoryRepository.selectById(ticket.getSubCategoryId());
|
| 1035 |
List<TicketSubCategory> ticketSubCategories = ticketSubCategoryRepository.selectAll(ticketSubCategory.getCategoryId());
|
1110 |
List<TicketSubCategory> ticketSubCategories = ticketSubCategoryRepository.selectAll(ticketSubCategory.getCategoryId());
|
| 1036 |
List<AuthUser> authUsers = authRepository.selectAllActiveUser();
|
1111 |
List<AuthUser> authUsers = authRepository.selectAllActiveUser();
|
| - |
|
1112 |
|
| - |
|
1113 |
// CRM users should not see Sales/RBM categories and their Escalation subcategories
|
| - |
|
1114 |
if (isCrmUser) {
|
| - |
|
1115 |
ticketCategories = ticketCategories.stream()
|
| - |
|
1116 |
.filter(tc -> tc.getId() != ProfitMandiConstants.TICKET_CATEGORY_SALES
|
| - |
|
1117 |
&& tc.getId() != ProfitMandiConstants.TICKET_CATEGORY_RBM)
|
| - |
|
1118 |
.collect(Collectors.toList());
|
| - |
|
1119 |
ticketSubCategories = ticketSubCategories.stream()
|
| - |
|
1120 |
.filter(tsc -> tsc.getId() != ProfitMandiConstants.TICKET_SUBCATEGORY_SALES_ESCALATION
|
| - |
|
1121 |
&& tsc.getId() != ProfitMandiConstants.TICKET_SUBCATEGORY_RBM_ESCALATION)
|
| - |
|
1122 |
.collect(Collectors.toList());
|
| - |
|
1123 |
}
|
| - |
|
1124 |
|
| - |
|
1125 |
// Get partner name for modal title
|
| - |
|
1126 |
String partnerName = retailerService.getFofoRetailer(ticket.getFofoId()).getBusinessName();
|
| - |
|
1127 |
|
| 1037 |
model.addAttribute("ticket", ticket);
|
1128 |
model.addAttribute("ticket", ticket);
|
| 1038 |
model.addAttribute("ticketCategories", ticketCategories);
|
1129 |
model.addAttribute("ticketCategories", ticketCategories);
|
| 1039 |
model.addAttribute("ticketSubCategories", ticketSubCategories);
|
1130 |
model.addAttribute("ticketSubCategories", ticketSubCategories);
|
| 1040 |
model.addAttribute("ticketSubCategory", ticketSubCategory);
|
1131 |
model.addAttribute("ticketSubCategory", ticketSubCategory);
|
| 1041 |
model.addAttribute("authUsers", authUsers);
|
1132 |
model.addAttribute("authUsers", authUsers);
|
| - |
|
1133 |
model.addAttribute("isCrmUser", isCrmUser);
|
| - |
|
1134 |
model.addAttribute("partnerName", partnerName);
|
| 1042 |
return "edit-ticket-partner-modal";
|
1135 |
return "edit-ticket-partner-modal";
|
| 1043 |
}
|
1136 |
}
|
| 1044 |
|
1137 |
|
| 1045 |
@PostMapping(value = "/cs/edit-ticket")
|
1138 |
@PostMapping(value = "/cs/edit-ticket")
|
| 1046 |
public String editTicket(HttpServletRequest request, @RequestParam(name = "ticketId", defaultValue = "0") int ticketId, @RequestParam(name = "subCategoryId", defaultValue = "0") int subCategoryId, @RequestParam(name = "categoryId", defaultValue = "0") int categoryId, @RequestParam(name = "authUserId", defaultValue = "0") int authUserId, @RequestParam(name = "escalationType", defaultValue = "L1") EscalationType escalationType, Model model) throws Exception {
|
1139 |
public String editTicket(HttpServletRequest request, @RequestParam(name = "ticketId", defaultValue = "0") int ticketId, @RequestParam(name = "subCategoryId", defaultValue = "0") int subCategoryId, @RequestParam(name = "categoryId", defaultValue = "0") int categoryId, @RequestParam(name = "authUserId", defaultValue = "0") int authUserId, @RequestParam(name = "escalationType", defaultValue = "L1") EscalationType escalationType, Model model) throws Exception {
|