| Line 176... |
Line 176... |
| 176 |
if (ticketSubCategory != null) {
|
176 |
if (ticketSubCategory != null) {
|
| 177 |
throw new ProfitMandiBusinessException("name & categoryId", name + " " + categoryId, "already exists!");
|
177 |
throw new ProfitMandiBusinessException("name & categoryId", name + " " + categoryId, "already exists!");
|
| 178 |
}
|
178 |
}
|
| 179 |
|
179 |
|
| 180 |
ticketSubCategory = new TicketSubCategory();
|
180 |
ticketSubCategory = new TicketSubCategory();
|
| 181 |
ticketSubCategory.setcategoryId(categoryId);
|
181 |
ticketSubCategory.setCategoryId(categoryId);
|
| 182 |
ticketSubCategory.setName(name);
|
182 |
ticketSubCategory.setName(name);
|
| 183 |
ticketSubCategory.setDescription(description);
|
183 |
ticketSubCategory.setDescription(description);
|
| 184 |
ticketSubCategoryRepository.persist(ticketSubCategory);
|
184 |
ticketSubCategoryRepository.persist(ticketSubCategory);
|
| 185 |
return "create-ticket-sub-category";
|
185 |
return "create-ticket-sub-category";
|
| 186 |
}
|
186 |
}
|
| Line 436... |
Line 436... |
| 436 |
searchTerm, offset, limit);
|
436 |
searchTerm, offset, limit);
|
| 437 |
size = ticketRepository.selectAllCountByAssignee(authUser.getId(), Optional.empty(), null,
|
437 |
size = ticketRepository.selectAllCountByAssignee(authUser.getId(), Optional.empty(), null,
|
| 438 |
searchTerm);
|
438 |
searchTerm);
|
| 439 |
} else {
|
439 |
} else {
|
| 440 |
tickets = ticketRepository.selectAllByAssignee(authUser.getId(),
|
440 |
tickets = ticketRepository.selectAllByAssignee(authUser.getId(),
|
| 441 |
Optional.of(TicketStatus.OPENED.equals(ticketStatus)), sortOrder, null, searchTerm, offset,
|
441 |
Optional.of(TicketStatus.CLOSED.equals(ticketStatus)), sortOrder, null, searchTerm, offset,
|
| 442 |
limit);
|
442 |
limit);
|
| 443 |
size = ticketRepository.selectAllCountByAssignee(authUser.getId(),
|
443 |
size = ticketRepository.selectAllCountByAssignee(authUser.getId(),
|
| 444 |
Optional.of(TicketStatus.OPENED.equals(ticketStatus)), null, searchTerm);
|
444 |
Optional.of(TicketStatus.CLOSED.equals(ticketStatus)), null, searchTerm);
|
| 445 |
}
|
445 |
}
|
| 446 |
|
446 |
|
| 447 |
} else {
|
447 |
} else {
|
| 448 |
|
448 |
|
| 449 |
if (ticketStatus.equals(TicketStatus.RESOLVED)) {
|
449 |
if (ticketStatus.equals(TicketStatus.RESOLVED)) {
|
| Line 451... |
Line 451... |
| 451 |
ticketSearchType, searchTerm, offset, limit);
|
451 |
ticketSearchType, searchTerm, offset, limit);
|
| 452 |
size = ticketRepository.selectAllCountByAssignee(authUser.getId(), Optional.empty(),
|
452 |
size = ticketRepository.selectAllCountByAssignee(authUser.getId(), Optional.empty(),
|
| 453 |
ticketSearchType, searchTerm);
|
453 |
ticketSearchType, searchTerm);
|
| 454 |
} else {
|
454 |
} else {
|
| 455 |
tickets = ticketRepository.selectAllByAssignee(authUser.getId(),
|
455 |
tickets = ticketRepository.selectAllByAssignee(authUser.getId(),
|
| 456 |
Optional.of(TicketStatus.OPENED.equals(ticketStatus)), sortOrder, ticketSearchType,
|
456 |
Optional.of(TicketStatus.CLOSED.equals(ticketStatus)), sortOrder, ticketSearchType,
|
| 457 |
searchTerm, offset, limit);
|
457 |
searchTerm, offset, limit);
|
| 458 |
size = ticketRepository.selectAllCountByAssignee(authUser.getId(),
|
458 |
size = ticketRepository.selectAllCountByAssignee(authUser.getId(),
|
| 459 |
Optional.of(TicketStatus.OPENED.equals(ticketStatus)), ticketSearchType, searchTerm);
|
459 |
Optional.of(TicketStatus.CLOSED.equals(ticketStatus)), ticketSearchType, searchTerm);
|
| 460 |
}
|
460 |
}
|
| 461 |
}
|
461 |
}
|
| 462 |
// LOGGER.info(size + "size");
|
462 |
// LOGGER.info(size + "size");
|
| 463 |
if (tickets.size() > 0) {
|
463 |
if (tickets.size() > 0) {
|
| 464 |
ticketAssigneds = ticketAssignedRepository
|
464 |
ticketAssigneds = ticketAssignedRepository
|
| Line 594... |
Line 594... |
| 594 |
@RequestParam(name = "internal", defaultValue = "true") boolean internal,
|
594 |
@RequestParam(name = "internal", defaultValue = "true") boolean internal,
|
| 595 |
@RequestParam(name = "message", defaultValue = "") String message, Model model) throws Exception {
|
595 |
@RequestParam(name = "message", defaultValue = "") String message, Model model) throws Exception {
|
| 596 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
596 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 597 |
Ticket ticket = ticketRepository.selectById(ticketId);
|
597 |
Ticket ticket = ticketRepository.selectById(ticketId);
|
| 598 |
if (ticket.getCloseTimestamp() == null) {
|
598 |
if (ticket.getCloseTimestamp() == null) {
|
| - |
|
599 |
Activity activity = new Activity();
|
| - |
|
600 |
activity.setCreatedBy(0);
|
| - |
|
601 |
activity.setCreateTimestamp(LocalDateTime.now());
|
| - |
|
602 |
activity.setMessage(message);
|
| 599 |
if (!roleManager.isAdmin(new HashSet<>(loginDetails.getRoleIds()))) {
|
603 |
if (!roleManager.isAdmin(new HashSet<>(loginDetails.getRoleIds()))) {
|
| 600 |
Activity activity = new Activity();
|
- |
|
| 601 |
activity.setMessage(message);
|
- |
|
| 602 |
activity.setCreatedBy(0);
|
- |
|
| 603 |
activity.setCreateTimestamp(LocalDateTime.now());
|
- |
|
| 604 |
activity.setType(ActivityType.COMMUNICATION_IN);
|
604 |
activity.setType(ActivityType.COMMUNICATION_IN);
|
| 605 |
csService.addActivity(ticketId, activity);
|
- |
|
| 606 |
AuthUser authUser = authRepository.selectById(ticket.getL1AuthUser());
|
605 |
AuthUser authUser = authRepository.selectById(ticket.getL1AuthUser());
|
| 607 |
String subject = String.format(ACTIVITY_SUBJECT, ticket.getId());
|
606 |
String subject = String.format(ACTIVITY_SUBJECT, ticket.getId());
|
| 608 |
String[] cc = { authRepository.selectById(ticket.getL2AuthUser()).getEmailId(),
|
607 |
String[] cc = { authRepository.selectById(ticket.getL2AuthUser()).getEmailId(),
|
| 609 |
authRepository.selectById(ticket.getL3AuthUser()).getEmailId() };
|
608 |
authRepository.selectById(ticket.getL3AuthUser()).getEmailId() };
|
| 610 |
// LOGGER.info(authUser.getEmailId()+" "+cc+" "+subject+" "+message);
|
609 |
// LOGGER.info(authUser.getEmailId()+" "+cc+" "+subject+" "+message);
|
| 611 |
// this.activityRelatedMail(authUser.getEmailId(), cc, subject, message);
|
610 |
// this.activityRelatedMail(authUser.getEmailId(), cc, subject, message);
|
| 612 |
model.addAttribute("response", mvcResponseSender.createResponseString(authUser));
|
611 |
model.addAttribute("response", mvcResponseSender.createResponseString(authUser));
|
| 613 |
} else {
|
612 |
} else {
|
| 614 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
613 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| 615 |
Activity activity = new Activity();
|
- |
|
| 616 |
activity.setMessage(message);
|
- |
|
| 617 |
activity.setCreatedBy(authUser.getId());
|
614 |
activity.setCreatedBy(authUser.getId());
|
| 618 |
activity.setCreateTimestamp(LocalDateTime.now());
|
- |
|
| 619 |
if (internal) {
|
615 |
if (internal) {
|
| 620 |
activity.setType(ActivityType.COMMUNICATION_INTERNAL);
|
616 |
activity.setType(ActivityType.COMMUNICATION_INTERNAL);
|
| 621 |
String subject = String.format(ACTIVITY_SUBJECT, ticket.getId());
|
617 |
// String subject = String.format(ACTIVITY_SUBJECT, ticket.getId());
|
| 622 |
if (authUser.getId() == ticket.getL1AuthUser()) {
|
- |
|
| 623 |
String cc[] = { authRepository.selectById(ticket.getL3AuthUser()).getEmailId() };
|
- |
|
| 624 |
this.activityRelatedMail(authRepository.selectById(ticket.getL2AuthUser()).getEmailId(), cc,
|
- |
|
| 625 |
subject, message);
|
- |
|
| 626 |
} else if (authUser.getId() == ticket.getL2AuthUser()) {
|
- |
|
| 627 |
String cc[] = { authRepository.selectById(ticket.getL3AuthUser()).getEmailId() };
|
- |
|
| 628 |
this.activityRelatedMail(authRepository.selectById(ticket.getL1AuthUser()).getEmailId(), cc,
|
- |
|
| 629 |
subject, message);
|
- |
|
| 630 |
} else {
|
- |
|
| 631 |
String cc[] = { authRepository.selectById(ticket.getL2AuthUser()).getEmailId() };
|
- |
|
| 632 |
this.activityRelatedMail(authRepository.selectById(ticket.getL1AuthUser()).getEmailId(), cc,
|
- |
|
| 633 |
subject, message);
|
- |
|
| 634 |
}
|
- |
|
| 635 |
|
- |
|
| 636 |
} else {
|
618 |
} else {
|
| 637 |
|
- |
|
| 638 |
activity.setType(ActivityType.COMMUNICATION_OUT);
|
619 |
activity.setType(ActivityType.COMMUNICATION_OUT);
|
| 639 |
String subject = String.format(ACTIVITY_SUBJECT, ticket.getId());
|
- |
|
| 640 |
this.activityRelatedMail(retailerService.getFofoRetailer(ticket.getFofoId()).getEmail(), null,
|
- |
|
| 641 |
subject, message);
|
- |
|
| 642 |
}
|
620 |
}
|
| 643 |
csService.addActivity(ticketId, activity);
|
- |
|
| 644 |
|
- |
|
| 645 |
// LOGGER.info(authUser.getEmailId() + " " + subject + " " + message);
|
- |
|
| 646 |
|
- |
|
| 647 |
model.addAttribute("response", mvcResponseSender.createResponseString(authUser));
|
621 |
model.addAttribute("response", mvcResponseSender.createResponseString(authUser));
|
| 648 |
}
|
622 |
}
|
| - |
|
623 |
activityRepository.persist(activity);
|
| - |
|
624 |
csService.addActivity(ticket, activity);
|
| 649 |
} else {
|
625 |
} else {
|
| 650 |
throw new ProfitMandiBusinessException("Ticket", ticket.getId(), "Already closed ticket");
|
626 |
throw new ProfitMandiBusinessException("Ticket", ticket.getId(), "Already closed ticket");
|
| 651 |
}
|
627 |
}
|
| 652 |
return "response";
|
628 |
return "response";
|
| 653 |
}
|
629 |
}
|
| Line 675... |
Line 651... |
| 675 |
}
|
651 |
}
|
| 676 |
return "response";
|
652 |
return "response";
|
| 677 |
}
|
653 |
}
|
| 678 |
|
654 |
|
| 679 |
@GetMapping(value = "/cs/managerTicket")
|
655 |
@GetMapping(value = "/cs/managerTicket")
|
| 680 |
public String getL2L3AndL4Tickets(HttpServletRequest request,
|
656 |
public String getManagerTickets(HttpServletRequest request,
|
| 681 |
@RequestParam(name = "orderby", defaultValue = "DESCENDING") SortOrder sortOrder,
|
657 |
@RequestParam(name = "orderby", defaultValue = "DESCENDING") SortOrder sortOrder,
|
| 682 |
@RequestParam(name = "ticketStatus", defaultValue = "OPENED") TicketStatus ticketStatus,
|
658 |
@RequestParam(name = "ticketStatus", defaultValue = "OPENED") TicketStatus ticketStatus,
|
| 683 |
@RequestParam(name = "ticketSearchType", defaultValue = "") TicketSearchType ticketSearchType,
|
659 |
@RequestParam(name = "ticketSearchType", defaultValue = "") TicketSearchType ticketSearchType,
|
| 684 |
@RequestParam(name = "searchTerm", defaultValue = "0") int searchTerm,
|
660 |
@RequestParam(name = "searchTerm", defaultValue = "0") int searchTerm,
|
| 685 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
661 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| Line 811... |
Line 787... |
| 811 |
@RequestParam(name = "ticketId", defaultValue = "0") int ticketId, Model model) {
|
787 |
@RequestParam(name = "ticketId", defaultValue = "0") int ticketId, Model model) {
|
| 812 |
Ticket ticket = ticketRepository.selectById(ticketId);
|
788 |
Ticket ticket = ticketRepository.selectById(ticketId);
|
| 813 |
List<TicketCategory> ticketCategories = csService.getAllTicketCategotyFromSubCategory();
|
789 |
List<TicketCategory> ticketCategories = csService.getAllTicketCategotyFromSubCategory();
|
| 814 |
TicketSubCategory ticketSubCategory = ticketSubCategoryRepository.selectById(ticket.getSubCategoryId());
|
790 |
TicketSubCategory ticketSubCategory = ticketSubCategoryRepository.selectById(ticket.getSubCategoryId());
|
| 815 |
List<TicketSubCategory> ticketSubCategories = ticketSubCategoryRepository
|
791 |
List<TicketSubCategory> ticketSubCategories = ticketSubCategoryRepository
|
| 816 |
.selectAll(ticketSubCategory.getcategoryId());
|
792 |
.selectAll(ticketSubCategory.getCategoryId());
|
| 817 |
List<AuthUser> authUsers = authRepository.selectAllActiveUser();
|
793 |
List<AuthUser> authUsers = new ArrayList<>();
|
| 818 |
model.addAttribute("ticket", ticket);
|
794 |
model.addAttribute("ticket", ticket);
|
| 819 |
model.addAttribute("ticketCategories", ticketCategories);
|
795 |
model.addAttribute("ticketCategories", ticketCategories);
|
| 820 |
model.addAttribute("ticketSubCategories", ticketSubCategories);
|
796 |
model.addAttribute("ticketSubCategories", ticketSubCategories);
|
| 821 |
model.addAttribute("ticketSubCategory", ticketSubCategory);
|
797 |
model.addAttribute("ticketSubCategory", ticketSubCategory);
|
| 822 |
model.addAttribute("authUsers", authUsers);
|
798 |
model.addAttribute("authUsers", authUsers);
|
| Line 829... |
Line 805... |
| 829 |
@RequestParam(name = "subCategoryId", defaultValue = "0") int subCategoryId,
|
805 |
@RequestParam(name = "subCategoryId", defaultValue = "0") int subCategoryId,
|
| 830 |
@RequestParam(name = "categoryId", defaultValue = "0") int categoryId,
|
806 |
@RequestParam(name = "categoryId", defaultValue = "0") int categoryId,
|
| 831 |
@RequestParam(name = "authUserId", defaultValue = "0") int authUserId, Model model) throws Exception {
|
807 |
@RequestParam(name = "authUserId", defaultValue = "0") int authUserId, Model model) throws Exception {
|
| 832 |
LOGGER.info(ticketId);
|
808 |
LOGGER.info(ticketId);
|
| 833 |
Ticket ticket = ticketRepository.selectById(ticketId);
|
809 |
Ticket ticket = ticketRepository.selectById(ticketId);
|
| 834 |
ticketAssignedRepository.deleteByTicketId(ticketId);
|
- |
|
| 835 |
if (ticket.getSubCategoryId() == subCategoryId) {
|
- |
|
| 836 |
LOGGER.info(ticket);
|
- |
|
| 837 |
TicketAssigned ticketAssigned = new TicketAssigned();
|
- |
|
| 838 |
ticketAssigned.setTicketId(ticketId);
|
- |
|
| 839 |
ticketAssigned.setAssineeId(authUserId);
|
- |
|
| 840 |
ticketAssignedRepository.persist(ticketAssigned);
|
- |
|
| 841 |
ticket.setL1AuthUser(authUserId);
|
- |
|
| 842 |
ticket.setSubCategoryId(subCategoryId);
|
- |
|
| 843 |
ticket.setUpdateTimestamp(LocalDateTime.now());
|
- |
|
| 844 |
ticket.setL2EscalationTimestamp(ticket.getUpdateTimestamp().plusDays(2));
|
- |
|
| 845 |
ticket.setL3EscalationTimestamp(ticket.getL2EscalationTimestamp().plusDays(2));
|
- |
|
| 846 |
ticket.setLastEscalationTimestamp(ticket.getL3EscalationTimestamp().plusDays(2));
|
- |
|
| 847 |
ticketRepository.persist(ticket);
|
- |
|
| 848 |
csService.sendAssignedTicketMail(authRepository.selectById(authUserId), ticket);
|
- |
|
| 849 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
- |
|
| 850 |
} else {
|
- |
|
| 851 |
csService.updateTicket(categoryId, subCategoryId, ticket);
|
810 |
csService.updateTicket(categoryId, subCategoryId, ticket);
|
| 852 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
811 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 853 |
}
|
- |
|
| 854 |
return "response";
|
812 |
return "response";
|
| - |
|
813 |
|
| 855 |
}
|
814 |
}
|
| 856 |
|
815 |
|
| 857 |
@DeleteMapping(value = "/cs/removePosition")
|
816 |
@DeleteMapping(value = "/cs/removePosition")
|
| 858 |
public String removePosition(HttpServletRequest request,
|
817 |
public String removePosition(HttpServletRequest request,
|
| 859 |
@RequestParam(name = "positionId", defaultValue = "0") int positionId, Model model) throws Exception {
|
818 |
@RequestParam(name = "positionId", defaultValue = "0") int positionId, Model model) throws Exception {
|
| Line 894... |
Line 853... |
| 894 |
String to = authRepository.selectById(ticket.getL1AuthUser()).getEmailId();
|
853 |
String to = authRepository.selectById(ticket.getL1AuthUser()).getEmailId();
|
| 895 |
String cc[] = { authRepository.selectById(ticket.getL2AuthUser()).getEmailId(),
|
854 |
String cc[] = { authRepository.selectById(ticket.getL2AuthUser()).getEmailId(),
|
| 896 |
authRepository.selectById(ticket.getL3AuthUser()).getEmailId() };
|
855 |
authRepository.selectById(ticket.getL3AuthUser()).getEmailId() };
|
| 897 |
ticket.setLastActivity(lastActivity);
|
856 |
ticket.setLastActivity(lastActivity);
|
| 898 |
ticket.setUpdateTimestamp(LocalDateTime.now());
|
857 |
ticket.setUpdateTimestamp(LocalDateTime.now());
|
| 899 |
ticket.setL2EscalationTimestamp(ticket.getUpdateTimestamp().plusDays(2));
|
- |
|
| 900 |
ticket.setL3EscalationTimestamp(ticket.getL2EscalationTimestamp().plusDays(2));
|
- |
|
| 901 |
ticket.setLastEscalationTimestamp(ticket.getL3EscalationTimestamp().plusDays(2));
|
- |
|
| 902 |
ticketAssignedRepository.deleteByTicketId(ticketId);
|
858 |
ticketAssignedRepository.deleteByTicketId(ticketId);
|
| 903 |
TicketAssigned ticketAssigned = new TicketAssigned();
|
859 |
TicketAssigned ticketAssigned = new TicketAssigned();
|
| 904 |
ticketAssigned.setAssineeId(ticket.getL1AuthUser());
|
860 |
ticketAssigned.setAssineeId(ticket.getL1AuthUser());
|
| 905 |
ticketAssigned.setTicketId(ticketId);
|
861 |
ticketAssigned.setTicketId(ticketId);
|
| 906 |
ticketAssignedRepository.persist(ticketAssigned);
|
862 |
ticketAssignedRepository.persist(ticketAssigned);
|
| Line 913... |
Line 869... |
| 913 |
this.activityRelatedMail(retailerService.getFofoRetailer(loginDetails.getFofoId()).getEmail(), null,
|
869 |
this.activityRelatedMail(retailerService.getFofoRetailer(loginDetails.getFofoId()).getEmail(), null,
|
| 914 |
subject, String.format(PARTNER_REOPEN, ticketId));
|
870 |
subject, String.format(PARTNER_REOPEN, ticketId));
|
| 915 |
}
|
871 |
}
|
| 916 |
|
872 |
|
| 917 |
}
|
873 |
}
|
| 918 |
ticketRepository.persist(ticket);
|
- |
|
| 919 |
activityRepository.persist(activity);
|
874 |
activityRepository.persist(activity);
|
| 920 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
875 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 921 |
return "response";
|
876 |
return "response";
|
| 922 |
}
|
877 |
}
|
| 923 |
|
878 |
|