| Line 73... |
Line 73... |
| 73 |
log.error("Could not lookup transaction", e);
|
73 |
log.error("Could not lookup transaction", e);
|
| 74 |
}
|
74 |
}
|
| 75 |
}
|
75 |
}
|
| 76 |
|
76 |
|
| 77 |
private void processDelayedOrder(Long customerId) {
|
77 |
private void processDelayedOrder(Long customerId) {
|
| 78 |
try {
|
- |
|
| 79 |
log.info("Processing delayed order for customerId: " + customerId);
|
78 |
log.info("Processing delayed order for customerId: " + customerId);
|
| 80 |
SearchFilter searchFilter = new SearchFilter();
|
79 |
SearchFilter searchFilter = new SearchFilter();
|
| 81 |
searchFilter.setTicketStatuses(new ArrayList<TicketStatus>());
|
80 |
searchFilter.setTicketStatuses(new ArrayList<TicketStatus>());
|
| 82 |
searchFilter.getTicketStatuses().add(TicketStatus.OPEN);
|
81 |
searchFilter.getTicketStatuses().add(TicketStatus.OPEN);
|
| 83 |
searchFilter.getTicketStatuses().add(TicketStatus.REOPEN);
|
82 |
searchFilter.getTicketStatuses().add(TicketStatus.REOPEN);
|
| 84 |
searchFilter.setTicketCategory(TicketCategory.DELAYED_DELIVERY);
|
83 |
searchFilter.setTicketCategory(TicketCategory.DELAYED_DELIVERY);
|
| 85 |
searchFilter.setCustomerId(customerId);
|
84 |
searchFilter.setCustomerId(customerId);
|
| 86 |
|
85 |
|
| 87 |
// No need to create a ticket if there exists one for the customer!
|
86 |
// No need to create a ticket if there exists one for the customer!
|
| 88 |
if (ticketHandler.getTickets(searchFilter).isEmpty()) {
|
87 |
if (ticketHandler.getTickets(searchFilter).isEmpty()) {
|
| 89 |
Ticket ticket = new Ticket();
|
88 |
Ticket ticket = new Ticket();
|
| 90 |
ticket.setCategory(TicketCategory.DELAYED_DELIVERY);
|
89 |
ticket.setCategory(TicketCategory.DELAYED_DELIVERY);
|
| 91 |
ticket.setCreatorId(ADMIN_AGENT_ID);
|
90 |
ticket.setCreatorId(ADMIN_AGENT_ID);
|
| 92 |
ticket.setCustomerId(customerId);
|
91 |
ticket.setCustomerId(customerId);
|
| 93 |
ticket.setDescription("Requires delayed delivery intimation");
|
92 |
ticket.setDescription("Requires delayed delivery intimation");
|
| 94 |
ticket.setPriority(TicketPriority.HIGH);
|
93 |
ticket.setPriority(TicketPriority.HIGH);
|
| 95 |
ticket.setStatus(TicketStatus.OPEN);
|
94 |
ticket.setStatus(TicketStatus.OPEN);
|
| 96 |
ticket.setAssigneeId(OUTBOUND_DEFAULT_ASSIGNEE_ID);
|
95 |
ticket.setAssigneeId(OUTBOUND_DEFAULT_ASSIGNEE_ID);
|
| 97 |
|
96 |
|
| 98 |
Activity activity = new Activity();
|
97 |
Activity activity = new Activity();
|
| 99 |
activity.setCreatorId(ticket.getCreatorId());
|
98 |
activity.setCreatorId(ticket.getCreatorId());
|
| 100 |
activity.setCustomerId(ticket.getCustomerId());
|
99 |
activity.setCustomerId(ticket.getCustomerId());
|
| 101 |
activity.setDescription("Creating ticket");
|
100 |
activity.setDescription("Creating ticket");
|
| 102 |
activity.setTicketCategory(ticket.getCategory());
|
101 |
activity.setTicketCategory(ticket.getCategory());
|
| 103 |
activity.setTicketDescription(ticket.getDescription());
|
102 |
activity.setTicketDescription(ticket.getDescription());
|
| 104 |
activity.setTicketPriority(ticket.getPriority());
|
103 |
activity.setTicketPriority(ticket.getPriority());
|
| 105 |
activity.setTicketStatus(ticket.getStatus());
|
104 |
activity.setTicketStatus(ticket.getStatus());
|
| 106 |
activity.setType(ActivityType.OTHER);
|
105 |
activity.setType(ActivityType.OTHER);
|
| 107 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
106 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
| 108 |
|
107 |
|
| 109 |
createTicket(ticket, activity);
|
108 |
createTicket(ticket, activity);
|
| 110 |
}
|
- |
|
| 111 |
} catch (Exception e) {
|
- |
|
| 112 |
log.error("Exception processing delayed delivery in order for customer Id: "
|
- |
|
| 113 |
+ customerId, e);
|
- |
|
| 114 |
}
|
109 |
}
|
| 115 |
}
|
110 |
}
|
| 116 |
|
111 |
|
| 117 |
@Transactional
|
112 |
@Transactional
|
| 118 |
private void createTicket(Ticket ticket, Activity activity) {
|
113 |
private void createTicket(Ticket ticket, Activity activity) {
|