| 3137 |
mandeep.dh |
1 |
/**
|
|
|
2 |
*
|
|
|
3 |
*/
|
|
|
4 |
package in.shop2020.serving.controllers;
|
|
|
5 |
|
| 3339 |
mandeep.dh |
6 |
import in.shop2020.crm.Activity;
|
|
|
7 |
import in.shop2020.crm.ActivityType;
|
| 3137 |
mandeep.dh |
8 |
import in.shop2020.crm.Agent;
|
| 3390 |
mandeep.dh |
9 |
import in.shop2020.crm.SearchFilter;
|
| 3137 |
mandeep.dh |
10 |
import in.shop2020.crm.Ticket;
|
| 3339 |
mandeep.dh |
11 |
import in.shop2020.crm.TicketCategory;
|
|
|
12 |
import in.shop2020.crm.TicketPriority;
|
| 3137 |
mandeep.dh |
13 |
import in.shop2020.crm.TicketStatus;
|
| 5791 |
anupam.sin |
14 |
import in.shop2020.model.v1.order.Attribute;
|
| 3546 |
mandeep.dh |
15 |
import in.shop2020.model.v1.order.LineItem;
|
|
|
16 |
import in.shop2020.model.v1.order.Order;
|
|
|
17 |
import in.shop2020.model.v1.order.OrderStatus;
|
| 4267 |
anupam.sin |
18 |
import in.shop2020.model.v1.order.Transaction;
|
| 3546 |
mandeep.dh |
19 |
import in.shop2020.model.v1.order.TransactionServiceException;
|
| 4267 |
anupam.sin |
20 |
import in.shop2020.model.v1.order.TransactionStatus;
|
| 3137 |
mandeep.dh |
21 |
import in.shop2020.model.v1.user.User;
|
|
|
22 |
import in.shop2020.model.v1.user.UserContextException;
|
| 3578 |
mandeep.dh |
23 |
import in.shop2020.payments.Payment;
|
|
|
24 |
import in.shop2020.payments.PaymentException;
|
|
|
25 |
import in.shop2020.payments.PaymentStatus;
|
| 3390 |
mandeep.dh |
26 |
import in.shop2020.serving.auth.CRMAuthorizingRealm;
|
|
|
27 |
import in.shop2020.thrift.clients.CRMClient;
|
| 3405 |
mandeep.dh |
28 |
import in.shop2020.thrift.clients.HelperClient;
|
| 3578 |
mandeep.dh |
29 |
import in.shop2020.thrift.clients.PaymentClient;
|
| 3546 |
mandeep.dh |
30 |
import in.shop2020.thrift.clients.TransactionClient;
|
| 3390 |
mandeep.dh |
31 |
import in.shop2020.thrift.clients.UserClient;
|
| 3405 |
mandeep.dh |
32 |
import in.shop2020.util.CRMConstants;
|
| 4020 |
mandeep.dh |
33 |
import in.shop2020.util.CRMConstants.EscalationMatrix;
|
| 3405 |
mandeep.dh |
34 |
import in.shop2020.utils.HelperService.Client;
|
|
|
35 |
import in.shop2020.utils.HelperServiceException;
|
| 3546 |
mandeep.dh |
36 |
import in.shop2020.utils.ModelUtils;
|
| 3137 |
mandeep.dh |
37 |
|
| 5791 |
anupam.sin |
38 |
import java.text.DateFormat;
|
| 3397 |
mandeep.dh |
39 |
import java.text.ParseException;
|
| 5791 |
anupam.sin |
40 |
import java.text.SimpleDateFormat;
|
| 3137 |
mandeep.dh |
41 |
import java.util.ArrayList;
|
| 5791 |
anupam.sin |
42 |
import java.util.Arrays;
|
| 3578 |
mandeep.dh |
43 |
import java.util.Calendar;
|
| 3390 |
mandeep.dh |
44 |
import java.util.Collections;
|
| 3405 |
mandeep.dh |
45 |
import java.util.Date;
|
| 4490 |
anupam.sin |
46 |
import java.util.HashMap;
|
| 3137 |
mandeep.dh |
47 |
import java.util.List;
|
| 5909 |
amar.kumar |
48 |
import java.util.Map;
|
| 5791 |
anupam.sin |
49 |
import java.util.TimeZone;
|
| 3137 |
mandeep.dh |
50 |
|
| 4256 |
mandeep.dh |
51 |
import net.htmlparser.jericho.Source;
|
|
|
52 |
|
| 3405 |
mandeep.dh |
53 |
import org.apache.shiro.SecurityUtils;
|
| 3137 |
mandeep.dh |
54 |
import org.apache.thrift.TException;
|
| 3546 |
mandeep.dh |
55 |
import org.apache.thrift.transport.TTransportException;
|
| 3137 |
mandeep.dh |
56 |
|
|
|
57 |
/**
|
|
|
58 |
* @author mandeep
|
|
|
59 |
*
|
|
|
60 |
*/
|
|
|
61 |
public class TicketsController extends BaseController {
|
|
|
62 |
|
|
|
63 |
/**
|
|
|
64 |
*
|
|
|
65 |
*/
|
|
|
66 |
private static final long serialVersionUID = 1L;
|
|
|
67 |
|
|
|
68 |
List<Ticket> tickets = new ArrayList<Ticket>();
|
| 3405 |
mandeep.dh |
69 |
private String customerEmailId;
|
| 3339 |
mandeep.dh |
70 |
private String description;
|
|
|
71 |
private String assigneeEmailId;
|
|
|
72 |
private String priority;
|
|
|
73 |
private String category;
|
|
|
74 |
private String orderId;
|
| 3397 |
mandeep.dh |
75 |
private String[] agentIds;
|
|
|
76 |
private String startTimestamp;
|
|
|
77 |
private String endTimestamp;
|
| 3137 |
mandeep.dh |
78 |
|
| 3405 |
mandeep.dh |
79 |
private String userId;
|
|
|
80 |
private String id;
|
|
|
81 |
private String activityDescription;
|
|
|
82 |
private String status;
|
|
|
83 |
private String activityType;
|
|
|
84 |
private Ticket ticket;
|
|
|
85 |
private List<Activity> activities;
|
|
|
86 |
private String subject;
|
|
|
87 |
private String body;
|
|
|
88 |
private String customerName;
|
|
|
89 |
private String customerMobileNumber;
|
| 3546 |
mandeep.dh |
90 |
private User user;
|
|
|
91 |
private String orderStatus;
|
|
|
92 |
private List<Order> orders;
|
| 4267 |
anupam.sin |
93 |
private List<Payment> payments;
|
| 4020 |
mandeep.dh |
94 |
private String escalate;
|
| 4241 |
anupam.sin |
95 |
private String cancelReason;
|
| 4267 |
anupam.sin |
96 |
private String transactionId;
|
| 5791 |
anupam.sin |
97 |
private String pickupExtension;
|
| 5909 |
amar.kumar |
98 |
private Map<String, Long> ticketCategorycountMap;
|
| 4438 |
anupam.sin |
99 |
private String paymentId;
|
|
|
100 |
|
| 4490 |
anupam.sin |
101 |
private HashMap<String, String> allAttachmentsForTicket;
|
|
|
102 |
|
| 3405 |
mandeep.dh |
103 |
public String index() {
|
|
|
104 |
try {
|
|
|
105 |
if (id != null && !id.isEmpty()) {
|
|
|
106 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
107 |
crmServiceClient = new CRMClient().getClient();
|
|
|
108 |
searchFilter.setTicketId(Long.parseLong(id));
|
|
|
109 |
tickets = crmServiceClient.getTickets(searchFilter);
|
|
|
110 |
}
|
|
|
111 |
} catch (TException e) {
|
|
|
112 |
log.error("Error while getting tickets", e);
|
|
|
113 |
return EXCEPTION;
|
|
|
114 |
}
|
|
|
115 |
|
|
|
116 |
return INDEX;
|
|
|
117 |
}
|
|
|
118 |
|
|
|
119 |
public String edit() {
|
|
|
120 |
try {
|
|
|
121 |
long ticketId = Long.parseLong(id);
|
|
|
122 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
123 |
searchFilter.setTicketId(ticketId);
|
|
|
124 |
crmServiceClient = new CRMClient().getClient();
|
|
|
125 |
ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
|
|
126 |
activities = crmServiceClient.getActivities(searchFilter);
|
| 4490 |
anupam.sin |
127 |
populateAttachments();
|
| 3405 |
mandeep.dh |
128 |
subject = createSubjectString(ticket);
|
|
|
129 |
|
|
|
130 |
if (ticket.isSetCustomerId()) {
|
|
|
131 |
userId = String.valueOf(ticket.getCustomerId());
|
| 3546 |
mandeep.dh |
132 |
userContextServiceClient = new UserClient().getClient();
|
|
|
133 |
|
|
|
134 |
try {
|
|
|
135 |
user = userContextServiceClient.getUserById(ticket
|
|
|
136 |
.getCustomerId());
|
|
|
137 |
} catch (UserContextException e) {
|
|
|
138 |
log.error("Could not fetch user details", e);
|
|
|
139 |
}
|
| 3405 |
mandeep.dh |
140 |
}
|
|
|
141 |
|
|
|
142 |
customerEmailId = ticket.getCustomerEmailId();
|
| 4689 |
anupam.sin |
143 |
|
| 4277 |
anupam.sin |
144 |
if (TicketCategory.ORDER_CANCELLATION.equals(ticket.getCategory())) {
|
|
|
145 |
log.info("Fetching orders for " + ticket.getCustomerId());
|
|
|
146 |
orders = new ArrayList<Order>();
|
|
|
147 |
transactionServiceClient = new TransactionClient().getClient();
|
| 4689 |
anupam.sin |
148 |
for (Order order : transactionServiceClient
|
|
|
149 |
.getOrdersForCustomer(ticket.getCustomerId(), 0, 0,
|
|
|
150 |
Collections.singletonList(OrderStatus.CANCEL_REQUEST_RECEIVED))) {
|
|
|
151 |
log.info("Processing Order: " + order.getId());
|
| 4287 |
anupam.sin |
152 |
orders.add(order);
|
|
|
153 |
}
|
| 4277 |
anupam.sin |
154 |
}
|
| 3546 |
mandeep.dh |
155 |
|
|
|
156 |
if (TicketCategory.COD_VERIFICATION.equals(ticket.getCategory())) {
|
|
|
157 |
log.info("Fetching orders for " + ticket.getCustomerId());
|
|
|
158 |
orders = new ArrayList<Order>();
|
|
|
159 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
160 |
for (Order order : transactionServiceClient
|
|
|
161 |
.getOrdersForCustomer(ticket.getCustomerId(), 0, 0,
|
| 4663 |
rajveer |
162 |
Collections.singletonList(OrderStatus.COD_VERIFICATION_PENDING))) {
|
| 3546 |
mandeep.dh |
163 |
log.info("Processing Order: " + order);
|
|
|
164 |
if (order.isCod()) {
|
|
|
165 |
orders.add(order);
|
|
|
166 |
}
|
|
|
167 |
}
|
|
|
168 |
}
|
| 4689 |
anupam.sin |
169 |
|
| 4490 |
anupam.sin |
170 |
if (TicketCategory.DOA_RECEIVED.equals(ticket.getCategory())) {
|
|
|
171 |
log.info("Fetching orders for " + ticket.getCustomerId());
|
|
|
172 |
orders = new ArrayList<Order>();
|
|
|
173 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
174 |
for (Order order : transactionServiceClient
|
|
|
175 |
.getOrdersForCustomer(ticket.getCustomerId(), 0, 0,
|
|
|
176 |
Collections.singletonList(OrderStatus.DOA_REQUEST_RECEIVED))) {
|
|
|
177 |
log.info("Processing Order: " + order);
|
|
|
178 |
if (order != null) {
|
|
|
179 |
orders.add(order);
|
|
|
180 |
}
|
|
|
181 |
}
|
|
|
182 |
}
|
| 4689 |
anupam.sin |
183 |
|
| 4490 |
anupam.sin |
184 |
if (TicketCategory.RETURN_FORM.equals(ticket.getCategory())) {
|
|
|
185 |
log.info("Fetching orders for " + ticket.getCustomerId());
|
|
|
186 |
orders = new ArrayList<Order>();
|
|
|
187 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
188 |
for (Order order : transactionServiceClient
|
|
|
189 |
.getOrdersForCustomer(ticket.getCustomerId(), 0, 0,
|
|
|
190 |
Collections.singletonList(OrderStatus.RET_REQUEST_RECEIVED))) {
|
|
|
191 |
log.info("Processing Order: " + order);
|
|
|
192 |
if (order != null) {
|
|
|
193 |
orders.add(order);
|
|
|
194 |
}
|
|
|
195 |
}
|
|
|
196 |
}
|
| 3578 |
mandeep.dh |
197 |
|
| 4267 |
anupam.sin |
198 |
if (TicketCategory.PAYMENT_FLAGGED.equals(ticket.getCategory())) {
|
|
|
199 |
log.info("Fetching orders for " + ticket.getCustomerId());
|
|
|
200 |
payments = new ArrayList<Payment>();
|
|
|
201 |
in.shop2020.payments.PaymentService.Client paymentClient = new PaymentClient().getClient();
|
|
|
202 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
203 |
for (Transaction transaction : transactionServiceClient
|
|
|
204 |
.getTransactionsForCustomer(ticket.getCustomerId(), 0, 0, TransactionStatus.FLAGGED)) {
|
|
|
205 |
log.info("Processing Transaction: " + transaction);
|
|
|
206 |
for ( Payment payment : paymentClient.getPaymentForTxnId(transaction.getId())) {
|
|
|
207 |
if( payment.getStatus().equals(PaymentStatus.AUTHORIZED)) {
|
|
|
208 |
payments.add(payment);
|
|
|
209 |
}
|
|
|
210 |
}
|
|
|
211 |
}
|
|
|
212 |
}
|
|
|
213 |
|
| 3578 |
mandeep.dh |
214 |
if (TicketCategory.FAILED_PAYMENTS.equals(ticket.getCategory())) {
|
|
|
215 |
log.info("Fetching orders for " + ticket.getCustomerId());
|
|
|
216 |
orders = new ArrayList<Order>();
|
|
|
217 |
in.shop2020.payments.PaymentService.Client paymentClient = new PaymentClient().getClient();
|
|
|
218 |
|
|
|
219 |
long failedTransactionId = -1;
|
|
|
220 |
long lastfailedTransactionTimestamp = -1;
|
|
|
221 |
for (Payment payment : paymentClient.getPaymentsForUser(ticket.getCustomerId(), 0, getTomorrow().getTime(), PaymentStatus.FAILED, 0)) {
|
|
|
222 |
if (payment.getErrorTimestamp() > lastfailedTransactionTimestamp) {
|
|
|
223 |
failedTransactionId = payment.getMerchantTxnId();
|
|
|
224 |
}
|
|
|
225 |
}
|
|
|
226 |
|
|
|
227 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
228 |
orders.addAll(transactionServiceClient.getOrdersForTransaction(failedTransactionId, ticket.getCustomerId()));
|
|
|
229 |
}
|
| 4008 |
mandeep.dh |
230 |
|
|
|
231 |
if (TicketCategory.DELAYED_DELIVERY.equals(ticket.getCategory())) {
|
|
|
232 |
log.info("Fetching orders for " + ticket.getCustomerId());
|
|
|
233 |
orders = new ArrayList<Order>();
|
|
|
234 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
235 |
|
|
|
236 |
for (Order order : transactionServiceClient.getOrdersForCustomer(ticket.getCustomerId(), 0, 0, null)) {
|
|
|
237 |
if (order.getExpected_delivery_time() > order.getPromised_delivery_time() && order.getExpected_delivery_time() > new Date().getTime()) {
|
|
|
238 |
orders.add(order);
|
|
|
239 |
}
|
|
|
240 |
}
|
|
|
241 |
}
|
| 5791 |
anupam.sin |
242 |
|
|
|
243 |
if (TicketCategory.STORE_PICKUP.equals(ticket.getCategory())) {
|
|
|
244 |
log.info("Fetching orders for " + ticket.getCustomerId());
|
|
|
245 |
orders = new ArrayList<Order>();
|
|
|
246 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
247 |
for (Order order : transactionServiceClient
|
|
|
248 |
.getOrdersForCustomer(ticket.getCustomerId(), 0, 0,
|
|
|
249 |
Collections.singletonList(OrderStatus.RECEIVED_AT_STORE))) {
|
|
|
250 |
log.info("Processing Order: " + order.getId());
|
|
|
251 |
orders.add(order);
|
|
|
252 |
}
|
|
|
253 |
}
|
|
|
254 |
|
| 3405 |
mandeep.dh |
255 |
} catch (TException e) {
|
| 3546 |
mandeep.dh |
256 |
log.error("Error loading edit page", e);
|
|
|
257 |
} catch (NumberFormatException e) {
|
|
|
258 |
log.error("Error parsing orderId", e);
|
|
|
259 |
} catch (TransactionServiceException e) {
|
|
|
260 |
log.error("Error fetching orders for " + ticket.getCustomerId(), e);
|
| 3578 |
mandeep.dh |
261 |
} catch (PaymentException e) {
|
|
|
262 |
log.error("Error fetching payments for " + ticket.getCustomerId(), e);
|
| 3405 |
mandeep.dh |
263 |
}
|
|
|
264 |
|
|
|
265 |
return EDIT;
|
|
|
266 |
}
|
|
|
267 |
|
| 4490 |
anupam.sin |
268 |
private void populateAttachments() {
|
|
|
269 |
allAttachmentsForTicket = new HashMap<String, String>();
|
|
|
270 |
for (Activity activity : activities) {
|
|
|
271 |
log.info("" + activity.getId());
|
|
|
272 |
String attachment = activity.getAttachments();
|
|
|
273 |
if (attachment != null && !attachment.isEmpty()) {
|
|
|
274 |
log.info("" + attachment);
|
|
|
275 |
String [] attachmentList = attachment.split(";");
|
|
|
276 |
for (String attachmentName : attachmentList) {
|
|
|
277 |
if (attachmentName != null && !attachmentName.isEmpty()) {
|
|
|
278 |
log.info("" + attachmentName);
|
|
|
279 |
allAttachmentsForTicket.put(activity.getId() + "-" + attachmentName, attachmentName);
|
|
|
280 |
}
|
|
|
281 |
}
|
|
|
282 |
}
|
|
|
283 |
}
|
|
|
284 |
}
|
|
|
285 |
|
| 5791 |
anupam.sin |
286 |
public static void main(String[] args) throws TException {
|
|
|
287 |
SearchFilter s = new SearchFilter();
|
|
|
288 |
// s.setTicketId(200l);
|
|
|
289 |
// s.setTicketAssigneeIds(null);
|
|
|
290 |
// s.setTicketAssigneeIds(new ArrayList<Long>());
|
|
|
291 |
// s.setActivityCreatorIds(Collections.singletonList(2l));
|
|
|
292 |
// s.setEndTimestamp(new Date());
|
|
|
293 |
//s.setTicketCategory(TicketCategory.STORE_PICKUP);
|
|
|
294 |
s.setTicketId((long) 51345);
|
|
|
295 |
in.shop2020.crm.CRMService.Client crmServiceClient = new CRMClient().getClient();
|
|
|
296 |
Ticket ticket = crmServiceClient.getTickets(s).get(0);
|
|
|
297 |
System.out.println(ticket.getCategory().name());
|
| 4490 |
anupam.sin |
298 |
}
|
|
|
299 |
|
| 3405 |
mandeep.dh |
300 |
private String createSubjectString(Ticket ticket) {
|
|
|
301 |
return CRMConstants.CRM_SUBJECT_PREFIX_FOR_TICKET_ID + ticket.getId()
|
|
|
302 |
+ " " + ticket.getCategory().name();
|
|
|
303 |
}
|
|
|
304 |
|
| 3578 |
mandeep.dh |
305 |
private Date getTomorrow() {
|
|
|
306 |
Calendar calendar = Calendar.getInstance();
|
|
|
307 |
calendar.setTime(new Date());
|
|
|
308 |
calendar.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
309 |
return calendar.getTime();
|
|
|
310 |
}
|
|
|
311 |
|
| 3339 |
mandeep.dh |
312 |
public String create() {
|
|
|
313 |
try {
|
| 3546 |
mandeep.dh |
314 |
long creatorId = CRMAuthorizingRealm.getAgent(currentAgentEmailId)
|
|
|
315 |
.getId();
|
| 3339 |
mandeep.dh |
316 |
Ticket ticket = new Ticket();
|
|
|
317 |
ticket.setDescription(description);
|
|
|
318 |
ticket.setCreatorId(creatorId);
|
|
|
319 |
ticket.setStatus(TicketStatus.OPEN);
|
|
|
320 |
ticket.setPriority(TicketPriority.valueOf(priority));
|
|
|
321 |
ticket.setCategory(TicketCategory.valueOf(category));
|
|
|
322 |
|
|
|
323 |
Activity activity = new Activity();
|
|
|
324 |
activity.setDescription("Creating Ticket");
|
|
|
325 |
activity.setType(ActivityType.OTHER);
|
|
|
326 |
activity.setTicketPriority(TicketPriority.valueOf(priority));
|
|
|
327 |
activity.setTicketStatus(TicketStatus.OPEN);
|
|
|
328 |
activity.setCreatorId(creatorId);
|
|
|
329 |
activity.setTicketCategory(TicketCategory.valueOf(category));
|
|
|
330 |
activity.setTicketDescription(description);
|
|
|
331 |
|
|
|
332 |
if (orderId != null && !orderId.isEmpty()) {
|
|
|
333 |
ticket.setOrderId(Long.parseLong(orderId));
|
|
|
334 |
}
|
| 4490 |
anupam.sin |
335 |
|
|
|
336 |
if (TicketCategory.valueOf(category) == TicketCategory.DOA_RECEIVED) {
|
|
|
337 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
338 |
if (!transactionServiceClient.markOrderDoaRequestReceived(Long.parseLong(orderId))) {
|
|
|
339 |
throw new Exception("Order cannot be marked as DOA Received");
|
|
|
340 |
}
|
|
|
341 |
log.info("" + userId);
|
|
|
342 |
|
|
|
343 |
Order order = transactionServiceClient.getOrder(Long.parseLong(orderId));
|
|
|
344 |
log.info("In order table id is : " + order.getCustomer_id());
|
|
|
345 |
if (userId == null || userId.isEmpty() || order.getCustomer_id() != Long.parseLong(userId)) {
|
|
|
346 |
throw new Exception("This order is not associated with this user Id");
|
|
|
347 |
}
|
|
|
348 |
}
|
|
|
349 |
|
|
|
350 |
if (TicketCategory.valueOf(category) == TicketCategory.RETURN_FORM) {
|
|
|
351 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
352 |
if (!transactionServiceClient.markOrderReturnRequestReceived(Long.parseLong(orderId))) {
|
|
|
353 |
throw new Exception("Order cannot be marked as Return Requested");
|
|
|
354 |
}
|
|
|
355 |
log.info("" + userId);
|
|
|
356 |
|
|
|
357 |
Order order = transactionServiceClient.getOrder(Long.parseLong(orderId));
|
|
|
358 |
log.info("In order table id is : " + order.getCustomer_id());
|
|
|
359 |
if (userId == null || userId.isEmpty() || order.getCustomer_id() != Long.parseLong(userId)) {
|
|
|
360 |
throw new Exception("This order is not associated with this user Id");
|
|
|
361 |
}
|
|
|
362 |
}
|
| 4681 |
amar.kumar |
363 |
if(body!=null && !body.isEmpty()){
|
|
|
364 |
String plainTextbody = new Source(body).getTextExtractor().toString();
|
|
|
365 |
ticket.setDescription(description + " : " + plainTextbody);
|
|
|
366 |
}
|
| 4490 |
anupam.sin |
367 |
|
| 3405 |
mandeep.dh |
368 |
if (userId != null && !userId.isEmpty()) {
|
|
|
369 |
ticket.setCustomerId(Long.parseLong(userId));
|
|
|
370 |
activity.setCustomerId(Long.parseLong(userId));
|
| 3546 |
mandeep.dh |
371 |
} else {
|
| 3390 |
mandeep.dh |
372 |
User user = null;
|
|
|
373 |
userContextServiceClient = new UserClient().getClient();
|
|
|
374 |
try {
|
| 3405 |
mandeep.dh |
375 |
if (customerName != null && !customerName.isEmpty()) {
|
|
|
376 |
ticket.setCustomerName(customerName);
|
|
|
377 |
activity.setCustomerName(customerName);
|
|
|
378 |
}
|
|
|
379 |
|
|
|
380 |
if (customerEmailId != null && !customerEmailId.isEmpty()) {
|
|
|
381 |
ticket.setCustomerEmailId(customerEmailId);
|
|
|
382 |
activity.setCustomerEmailId(customerEmailId);
|
| 3546 |
mandeep.dh |
383 |
user = userContextServiceClient
|
|
|
384 |
.getUserByEmail(customerEmailId);
|
| 3405 |
mandeep.dh |
385 |
}
|
|
|
386 |
|
| 3546 |
mandeep.dh |
387 |
if ((user == null || user.getUserId() == -1)
|
|
|
388 |
&& customerMobileNumber != null
|
|
|
389 |
&& !customerMobileNumber.isEmpty()) {
|
| 3405 |
mandeep.dh |
390 |
ticket.setCustomerMobileNumber(customerMobileNumber);
|
|
|
391 |
activity.setCustomerMobileNumber(customerMobileNumber);
|
| 3546 |
mandeep.dh |
392 |
user = userContextServiceClient
|
|
|
393 |
.getUserByMobileNumber(Long
|
|
|
394 |
.parseLong(customerMobileNumber));
|
| 3405 |
mandeep.dh |
395 |
}
|
| 3390 |
mandeep.dh |
396 |
} catch (UserContextException e) {
|
| 3546 |
mandeep.dh |
397 |
log.error("Could not fetch user for: " + customerEmailId
|
|
|
398 |
+ " " + customerMobileNumber + " " + customerName,
|
|
|
399 |
e);
|
| 3390 |
mandeep.dh |
400 |
}
|
| 3546 |
mandeep.dh |
401 |
|
| 3390 |
mandeep.dh |
402 |
if (user != null && user.getUserId() != -1) {
|
|
|
403 |
ticket.setCustomerId(user.getUserId());
|
|
|
404 |
activity.setCustomerId(user.getUserId());
|
|
|
405 |
}
|
| 3339 |
mandeep.dh |
406 |
}
|
|
|
407 |
|
|
|
408 |
// handling null values appropriately
|
|
|
409 |
if (assigneeEmailId != null && !assigneeEmailId.isEmpty()) {
|
| 3546 |
mandeep.dh |
410 |
long assigneeId = CRMAuthorizingRealm.getAgent(assigneeEmailId)
|
|
|
411 |
.getId();
|
| 3339 |
mandeep.dh |
412 |
ticket.setAssigneeId(assigneeId);
|
|
|
413 |
activity.setTicketAssigneeId(assigneeId);
|
|
|
414 |
}
|
|
|
415 |
|
| 3546 |
mandeep.dh |
416 |
crmServiceClient = new CRMClient().getClient();
|
|
|
417 |
id = String
|
|
|
418 |
.valueOf(crmServiceClient.insertTicket(ticket, activity));
|
| 3339 |
mandeep.dh |
419 |
} catch (TException e) {
|
|
|
420 |
log.error("Error while creating ticket", e);
|
|
|
421 |
return EXCEPTION;
|
| 4490 |
anupam.sin |
422 |
} catch (NumberFormatException e) {
|
|
|
423 |
log.error("Error while parsing Order Id", e);
|
|
|
424 |
return EXCEPTION;
|
|
|
425 |
} catch (TransactionServiceException e) {
|
|
|
426 |
log.error("Error while updating order status", e);
|
|
|
427 |
return EXCEPTION;
|
|
|
428 |
} catch (Exception e) {
|
|
|
429 |
log.error(e.getMessage());
|
|
|
430 |
return EXCEPTION;
|
| 3339 |
mandeep.dh |
431 |
}
|
|
|
432 |
|
| 3405 |
mandeep.dh |
433 |
return index();
|
| 3339 |
mandeep.dh |
434 |
}
|
|
|
435 |
|
| 3405 |
mandeep.dh |
436 |
public boolean isAssigneeEditable() {
|
|
|
437 |
return SecurityUtils.getSubject().hasRole("TeamLead");
|
|
|
438 |
}
|
|
|
439 |
|
| 3397 |
mandeep.dh |
440 |
public String searchTickets() throws ParseException {
|
| 3137 |
mandeep.dh |
441 |
try {
|
| 3397 |
mandeep.dh |
442 |
SearchFilter searchFilter = new SearchFilter();
|
| 3405 |
mandeep.dh |
443 |
if (userId != null && !userId.isEmpty()) {
|
|
|
444 |
searchFilter.setCustomerId(Long.parseLong(userId));
|
|
|
445 |
}
|
|
|
446 |
|
| 3397 |
mandeep.dh |
447 |
if (agentIds != null && agentIds.length != 0) {
|
|
|
448 |
searchFilter.setTicketAssigneeIds(new ArrayList<Long>());
|
|
|
449 |
for (String agentId : agentIds) {
|
| 3546 |
mandeep.dh |
450 |
searchFilter.getTicketAssigneeIds().add(
|
|
|
451 |
CRMAuthorizingRealm.getAgent(agentId).getId());
|
| 3397 |
mandeep.dh |
452 |
}
|
|
|
453 |
}
|
| 7595 |
kshitij.so |
454 |
|
|
|
455 |
//Start:- Added By Manish Sharma for Searching Tickets/Activities using Mobile No. on 21-Jun-2013
|
|
|
456 |
if(customerMobileNumber!=null && !customerMobileNumber.isEmpty()){
|
|
|
457 |
searchFilter.setCustomerMobileNumber(customerMobileNumber);
|
|
|
458 |
}
|
|
|
459 |
//End:- Added By Manish Sharma for Searching Tickets/Activities using Mobile No. on 21-Jun-2013
|
|
|
460 |
|
| 3397 |
mandeep.dh |
461 |
if (startTimestamp != null && !startTimestamp.isEmpty()) {
|
| 3546 |
mandeep.dh |
462 |
searchFilter.setStartTimestamp(SDF.parse(startTimestamp)
|
|
|
463 |
.getTime());
|
| 3397 |
mandeep.dh |
464 |
}
|
|
|
465 |
|
|
|
466 |
if (endTimestamp != null && !endTimestamp.isEmpty()) {
|
|
|
467 |
searchFilter.setEndTimestamp(SDF.parse(endTimestamp).getTime());
|
|
|
468 |
}
|
|
|
469 |
|
| 3422 |
mandeep.dh |
470 |
if (id != null && !id.isEmpty()) {
|
|
|
471 |
searchFilter.setTicketId(Long.parseLong(id));
|
|
|
472 |
}
|
|
|
473 |
|
| 3499 |
mandeep.dh |
474 |
if (status != null && !status.isEmpty()) {
|
| 3972 |
mandeep.dh |
475 |
searchFilter.setTicketStatuses(new ArrayList<TicketStatus>());
|
|
|
476 |
searchFilter.getTicketStatuses().add(TicketStatus.valueOf(status));
|
|
|
477 |
if (TicketStatus.OPEN.name().equals(status)) {
|
|
|
478 |
searchFilter.getTicketStatuses().add(TicketStatus.REOPEN);
|
|
|
479 |
}
|
| 3499 |
mandeep.dh |
480 |
}
|
|
|
481 |
|
|
|
482 |
if (category != null && !category.isEmpty()) {
|
| 3546 |
mandeep.dh |
483 |
searchFilter
|
|
|
484 |
.setTicketCategory(TicketCategory.valueOf(category));
|
| 3499 |
mandeep.dh |
485 |
}
|
|
|
486 |
|
| 3546 |
mandeep.dh |
487 |
crmServiceClient = new CRMClient().getClient();
|
| 3405 |
mandeep.dh |
488 |
tickets = crmServiceClient.getTickets(searchFilter);
|
| 3137 |
mandeep.dh |
489 |
} catch (TException e) {
|
|
|
490 |
String errorString = "Error getting tickets for "
|
|
|
491 |
+ currentAgentEmailId;
|
|
|
492 |
log.error(errorString, e);
|
|
|
493 |
addActionError(errorString);
|
|
|
494 |
}
|
|
|
495 |
|
| 3405 |
mandeep.dh |
496 |
return index();
|
| 3137 |
mandeep.dh |
497 |
}
|
|
|
498 |
|
|
|
499 |
public String getUnassignedTickets() {
|
|
|
500 |
try {
|
| 3546 |
mandeep.dh |
501 |
crmServiceClient = new CRMClient().getClient();
|
| 3137 |
mandeep.dh |
502 |
tickets = crmServiceClient.getUnassignedTickets();
|
|
|
503 |
} catch (TException e) {
|
| 3339 |
mandeep.dh |
504 |
String errorString = "Error getting tickets for "
|
|
|
505 |
+ currentAgentEmailId;
|
| 3137 |
mandeep.dh |
506 |
log.error(errorString, e);
|
|
|
507 |
addActionError(errorString);
|
|
|
508 |
}
|
|
|
509 |
|
| 3405 |
mandeep.dh |
510 |
return index();
|
| 3137 |
mandeep.dh |
511 |
}
|
|
|
512 |
|
| 3405 |
mandeep.dh |
513 |
public String update() {
|
|
|
514 |
try {
|
|
|
515 |
long creatorId = CRMAuthorizingRealm.getAgent(currentAgentEmailId)
|
|
|
516 |
.getId();
|
|
|
517 |
|
| 3546 |
mandeep.dh |
518 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
519 |
searchFilter.setTicketId(Long.parseLong(id));
|
|
|
520 |
crmServiceClient = new CRMClient().getClient();
|
|
|
521 |
Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
| 3405 |
mandeep.dh |
522 |
ticket.setDescription(description);
|
|
|
523 |
ticket.setPriority(TicketPriority.valueOf(priority));
|
|
|
524 |
|
|
|
525 |
// Update when a ticket is closed!
|
| 3578 |
mandeep.dh |
526 |
if (TicketStatus.CLOSED.name().equals(status) || TicketCategory.COD_VERIFICATION.equals(ticket.getCategory())) {
|
| 3546 |
mandeep.dh |
527 |
if (TicketCategory.COD_VERIFICATION.equals(ticket.getCategory())
|
|
|
528 |
&& pendingCODOrders(ticket.getCustomerId())) {
|
|
|
529 |
addActionMessage("Cod orders pending for verification. Ticket can not be closed and its category cannot be changed.");
|
|
|
530 |
} else {
|
|
|
531 |
ticket.setCategory(TicketCategory.valueOf(category));
|
|
|
532 |
ticket.setStatus(TicketStatus.valueOf(status));
|
|
|
533 |
ticket.setCloseDate(new Date().getTime());
|
|
|
534 |
}
|
| 3405 |
mandeep.dh |
535 |
}
|
| 3546 |
mandeep.dh |
536 |
else {
|
|
|
537 |
ticket.setCategory(TicketCategory.valueOf(category));
|
| 3578 |
mandeep.dh |
538 |
ticket.setStatus(TicketStatus.valueOf(status));
|
| 3546 |
mandeep.dh |
539 |
}
|
| 3405 |
mandeep.dh |
540 |
|
|
|
541 |
if (activityDescription == null || activityDescription.isEmpty()) {
|
| 4241 |
anupam.sin |
542 |
activityDescription = "Ticket fields updated";
|
| 3405 |
mandeep.dh |
543 |
}
|
|
|
544 |
|
|
|
545 |
Activity activity = new Activity();
|
|
|
546 |
activity.setDescription(activityDescription);
|
|
|
547 |
activity.setType(ActivityType.valueOf(activityType));
|
| 3546 |
mandeep.dh |
548 |
activity.setTicketPriority(ticket.getPriority());
|
|
|
549 |
activity.setTicketStatus(ticket.getStatus());
|
| 3405 |
mandeep.dh |
550 |
activity.setCreatorId(creatorId);
|
| 3546 |
mandeep.dh |
551 |
activity.setTicketCategory(ticket.getCategory());
|
|
|
552 |
activity.setTicketDescription(ticket.getDescription());
|
| 3405 |
mandeep.dh |
553 |
|
|
|
554 |
if (userId != null && !userId.isEmpty()) {
|
|
|
555 |
activity.setCustomerId(Long.parseLong(userId));
|
|
|
556 |
}
|
|
|
557 |
|
| 4035 |
mandeep.dh |
558 |
// Handling null values appropriately
|
|
|
559 |
if (assigneeEmailId != null && !assigneeEmailId.isEmpty()) {
|
|
|
560 |
long assigneeId = CRMAuthorizingRealm.getAgent(assigneeEmailId)
|
|
|
561 |
.getId();
|
|
|
562 |
ticket.setAssigneeId(assigneeId);
|
|
|
563 |
activity.setTicketAssigneeId(assigneeId);
|
|
|
564 |
}
|
|
|
565 |
|
| 3405 |
mandeep.dh |
566 |
if (ActivityType.SEND_EMAIL_TO_CUSTOMER.equals(activity.getType())) {
|
|
|
567 |
log.info("Sending mail");
|
|
|
568 |
Client helperClient = new HelperClient().getClient();
|
|
|
569 |
activity.setUserEmailId(helperClient.saveUserEmailForSending(
|
| 5865 |
amar.kumar |
570 |
Arrays.asList(customerEmailId), CRMConstants.CRM_EMAIL_SENDOR,
|
|
|
571 |
subject, body, null, CRMConstants.CRM_EMAIL_TYPE, null, null));
|
| 3405 |
mandeep.dh |
572 |
|
| 4256 |
mandeep.dh |
573 |
String plainTextbody = new Source(body).getTextExtractor().toString();
|
|
|
574 |
|
| 3405 |
mandeep.dh |
575 |
// We change activityType to OTHER when pop up box for email
|
|
|
576 |
// closes
|
|
|
577 |
activity.setDescription("Subject: " + subject + "\n\n"
|
| 4256 |
mandeep.dh |
578 |
+ "Body: " + plainTextbody);
|
| 4206 |
mandeep.dh |
579 |
|
|
|
580 |
String activityDesc = activity.getDescription();
|
|
|
581 |
if (activityDesc.length() > CRMConstants.DESCRIPTION_MAX_WIDTH) {
|
|
|
582 |
activityDesc = activityDesc.substring(0, CRMConstants.DESCRIPTION_MAX_WIDTH);
|
|
|
583 |
activityDesc += "\n\nTHIS TEXT IS TRUNCATED. PLEASE VISIT INBOX TO SEE COMPLETE DETAILS.";
|
|
|
584 |
}
|
|
|
585 |
|
|
|
586 |
activity.setDescription(activityDesc);
|
| 3405 |
mandeep.dh |
587 |
}
|
|
|
588 |
|
| 4020 |
mandeep.dh |
589 |
if (ActivityType.ESCALATE_TICKET.equals(activity.getType())) {
|
|
|
590 |
log.info("Sending escalation mail");
|
|
|
591 |
EscalationMatrix escalation = CRMConstants.EscalationMatrix.valueOf(escalate);
|
|
|
592 |
List<Integer> escalationReceipients = escalation.getAgentIds();
|
|
|
593 |
|
| 5865 |
amar.kumar |
594 |
List<String> toMailIds = new ArrayList<String>();
|
| 4020 |
mandeep.dh |
595 |
for (Integer agentId : escalationReceipients) {
|
| 5865 |
amar.kumar |
596 |
toMailIds.add(CRMAuthorizingRealm.getAgent(agentId).getEmailId());
|
| 4034 |
mandeep.dh |
597 |
|
|
|
598 |
// Setting last agent as assignee
|
|
|
599 |
ticket.setAssigneeId(agentId);
|
|
|
600 |
activity.setTicketAssigneeId(agentId);
|
| 4020 |
mandeep.dh |
601 |
}
|
|
|
602 |
|
|
|
603 |
Client helperClient = new HelperClient().getClient();
|
|
|
604 |
String escalationMailSubject = createEscalationMailSubject(ticket, escalation);
|
|
|
605 |
String escalationMailBody = createEscalationMailBody(ticket, escalation);
|
|
|
606 |
|
|
|
607 |
activity.setUserEmailId(helperClient.saveUserEmailForSending(
|
|
|
608 |
toMailIds, CRMConstants.CRM_EMAIL_SENDOR,
|
|
|
609 |
escalationMailSubject, escalationMailBody,
|
| 5865 |
amar.kumar |
610 |
null, CRMConstants.CRM_EMAIL_TYPE, null, null));
|
| 4020 |
mandeep.dh |
611 |
|
|
|
612 |
// We change activityType to OTHER when pop up box for email
|
|
|
613 |
// closes
|
|
|
614 |
activity.setDescription("To: " + toMailIds + "\n\nSubject: " + escalationMailSubject + "\n\n"
|
|
|
615 |
+ "Body: " + escalationMailBody);
|
|
|
616 |
}
|
|
|
617 |
|
| 3405 |
mandeep.dh |
618 |
User user = null;
|
|
|
619 |
userContextServiceClient = new UserClient().getClient();
|
|
|
620 |
try {
|
|
|
621 |
if (customerName != null && !customerName.isEmpty()) {
|
|
|
622 |
ticket.setCustomerName(customerName);
|
|
|
623 |
activity.setCustomerName(customerName);
|
|
|
624 |
}
|
|
|
625 |
|
|
|
626 |
if (customerEmailId != null && !customerEmailId.isEmpty()) {
|
|
|
627 |
ticket.setCustomerEmailId(customerEmailId);
|
|
|
628 |
activity.setCustomerEmailId(customerEmailId);
|
| 3546 |
mandeep.dh |
629 |
user = userContextServiceClient
|
|
|
630 |
.getUserByEmail(customerEmailId);
|
| 3405 |
mandeep.dh |
631 |
}
|
|
|
632 |
|
| 3546 |
mandeep.dh |
633 |
if ((user == null || user.getUserId() == -1)
|
|
|
634 |
&& customerMobileNumber != null
|
|
|
635 |
&& !customerMobileNumber.isEmpty()) {
|
| 3405 |
mandeep.dh |
636 |
ticket.setCustomerMobileNumber(customerMobileNumber);
|
|
|
637 |
activity.setCustomerMobileNumber(customerMobileNumber);
|
| 3546 |
mandeep.dh |
638 |
user = userContextServiceClient.getUserByMobileNumber(Long
|
|
|
639 |
.parseLong(customerMobileNumber));
|
| 3405 |
mandeep.dh |
640 |
}
|
|
|
641 |
} catch (UserContextException e) {
|
|
|
642 |
log.error("Could not fetch user for: " + customerEmailId + " "
|
|
|
643 |
+ customerMobileNumber + " " + customerName, e);
|
|
|
644 |
}
|
| 3546 |
mandeep.dh |
645 |
|
| 3405 |
mandeep.dh |
646 |
if (user != null && user.getUserId() != -1) {
|
|
|
647 |
ticket.setCustomerId(user.getUserId());
|
|
|
648 |
activity.setCustomerId(user.getUserId());
|
|
|
649 |
}
|
|
|
650 |
|
|
|
651 |
crmServiceClient = new CRMClient().getClient();
|
|
|
652 |
crmServiceClient.updateTicket(ticket, activity);
|
|
|
653 |
} catch (TException e) {
|
|
|
654 |
log.error("Error while updating ticket", e);
|
|
|
655 |
return EXCEPTION;
|
|
|
656 |
} catch (HelperServiceException hse) {
|
|
|
657 |
log.error("Error while sending mail", hse);
|
|
|
658 |
return EXCEPTION;
|
|
|
659 |
}
|
|
|
660 |
|
|
|
661 |
return index();
|
|
|
662 |
}
|
|
|
663 |
|
| 4020 |
mandeep.dh |
664 |
private String createEscalationMailBody(Ticket ticket,
|
|
|
665 |
EscalationMatrix escalation)
|
|
|
666 |
{
|
|
|
667 |
return body + "<br />Please visit following URL to check ticket details.<br />" +
|
|
|
668 |
"http://cs.shop2020.in:8080/crm?ticketId=" + ticket.getId();
|
|
|
669 |
}
|
|
|
670 |
|
|
|
671 |
private String createEscalationMailSubject(Ticket ticket,
|
|
|
672 |
EscalationMatrix escalation)
|
|
|
673 |
{
|
|
|
674 |
return CRMConstants.CRM_SUBJECT_PREFIX_FOR_TICKET_ID + ticket.getId() + " - ESCALATION FROM CRM - Type: " + escalation.name();
|
|
|
675 |
}
|
|
|
676 |
|
| 3546 |
mandeep.dh |
677 |
private boolean pendingCODOrders(long customerId) {
|
|
|
678 |
try {
|
|
|
679 |
log.info("Trying to fetch orders for " + customerId);
|
|
|
680 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
681 |
for (Order order : transactionServiceClient.getOrdersForCustomer(
|
|
|
682 |
customerId, 0, 0,
|
| 4663 |
rajveer |
683 |
Collections.singletonList(OrderStatus.COD_VERIFICATION_PENDING))) {
|
| 3546 |
mandeep.dh |
684 |
log.info("Processing order: " + order.getId() + " with COD: " + order.isCod());
|
|
|
685 |
if (order.isCod()) {
|
|
|
686 |
log.info("Returning true from pendingCODOrders() for " + customerId);
|
|
|
687 |
return true;
|
|
|
688 |
}
|
|
|
689 |
}
|
|
|
690 |
} catch (TTransportException e) {
|
|
|
691 |
log.error("Error while creating thrift client", e);
|
|
|
692 |
} catch (TransactionServiceException e) {
|
|
|
693 |
log.error("Error fetching orders", e);
|
|
|
694 |
} catch (TException e) {
|
|
|
695 |
log.error("Error fetching orders", e);
|
|
|
696 |
}
|
|
|
697 |
|
|
|
698 |
log.info("Returning false from pendingCODOrders() for " + customerId);
|
|
|
699 |
return false;
|
|
|
700 |
}
|
| 5791 |
anupam.sin |
701 |
|
|
|
702 |
public String extendExpiry() {
|
|
|
703 |
try {
|
|
|
704 |
log.info("order Id = " + orderId);
|
|
|
705 |
log.info("pickup : " + pickupExtension);
|
|
|
706 |
Attribute newAttribute = new Attribute();
|
|
|
707 |
List<Attribute> attributes = new ArrayList<Attribute>();
|
|
|
708 |
String extendedBy = "0";
|
|
|
709 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
710 |
attributes = transactionServiceClient.getAllAttributesForOrderId(Long.parseLong(orderId));
|
|
|
711 |
for (Attribute attribute : attributes) {
|
|
|
712 |
if (attribute.getName().equals("pickupExtension")) {
|
|
|
713 |
extendedBy = attribute.getValue();
|
|
|
714 |
break;
|
|
|
715 |
}
|
|
|
716 |
}
|
|
|
717 |
log.info("ATTR = " + attributes);
|
|
|
718 |
log.info("1");
|
|
|
719 |
if (extendedBy.equals("0")) {
|
|
|
720 |
newAttribute.setName("pickupExtension");
|
|
|
721 |
newAttribute.setValue(pickupExtension);
|
|
|
722 |
attributes.add(newAttribute);
|
|
|
723 |
log.info("2");
|
|
|
724 |
} else {
|
|
|
725 |
Long totalExtension = Long.parseLong(extendedBy) + Long.parseLong(pickupExtension);
|
|
|
726 |
for (Attribute attribute : attributes) {
|
|
|
727 |
if (attribute.getName().equals("pickupExtension")) {
|
|
|
728 |
attribute.setValue(totalExtension.toString());
|
|
|
729 |
log.info("3");
|
|
|
730 |
}
|
|
|
731 |
}
|
|
|
732 |
}
|
|
|
733 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
734 |
transactionServiceClient.setOrderAttributes(Long.parseLong(orderId), attributes);
|
| 5919 |
anupam.sin |
735 |
|
|
|
736 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
737 |
searchFilter.setTicketId(Long.parseLong(id));
|
|
|
738 |
crmServiceClient = new CRMClient().getClient();
|
|
|
739 |
Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
|
|
740 |
|
|
|
741 |
// Inserting activity
|
|
|
742 |
Activity activity = new Activity();
|
|
|
743 |
activity.setDescription("Pickup extended by " + pickupExtension
|
|
|
744 |
+ " Days.");
|
|
|
745 |
activity.setType(ActivityType.OTHER);
|
|
|
746 |
activity.setTicketPriority(ticket.getPriority());
|
|
|
747 |
activity.setTicketStatus(ticket.getStatus());
|
|
|
748 |
activity.setCreatorId(CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId());
|
|
|
749 |
activity.setTicketCategory(ticket.getCategory());
|
|
|
750 |
activity.setTicketDescription(ticket.getDescription());
|
|
|
751 |
activity.setCustomerId(ticket.getCustomerId());
|
|
|
752 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
|
|
753 |
|
|
|
754 |
crmServiceClient = new CRMClient().getClient();
|
|
|
755 |
crmServiceClient.updateTicket(ticket, activity);
|
|
|
756 |
|
| 5917 |
anupam.sin |
757 |
//transactionServiceClient = new TransactionClient().getClient();
|
|
|
758 |
//transactionServiceClient.enqueueExpiryExtensionEmail(orderId);
|
| 5791 |
anupam.sin |
759 |
} catch (NumberFormatException e) {
|
|
|
760 |
e.printStackTrace();
|
|
|
761 |
} catch (TException e) {
|
|
|
762 |
e.printStackTrace();
|
|
|
763 |
}
|
| 5917 |
anupam.sin |
764 |
return edit();
|
| 5791 |
anupam.sin |
765 |
}
|
|
|
766 |
|
|
|
767 |
public String getPickupExpiryDate(long id, long deliveryTimestamp) {
|
|
|
768 |
try {
|
|
|
769 |
log.info("orderID" + id);
|
|
|
770 |
log.info("Delivery Time : " + deliveryTimestamp);
|
|
|
771 |
Date deliveryDate = new Date(deliveryTimestamp);
|
|
|
772 |
Calendar cal = Calendar.getInstance();
|
|
|
773 |
cal.setTime(deliveryDate);
|
|
|
774 |
|
|
|
775 |
log.info("Orig Del Date :" + cal.get(Calendar.DAY_OF_MONTH) + "-" + cal.get(Calendar.MONTH) + "-" + cal.get(Calendar.YEAR));
|
|
|
776 |
|
|
|
777 |
cal.add(Calendar.DATE, 5);
|
|
|
778 |
|
|
|
779 |
log.info("After adding 5 days" + cal.get(Calendar.DAY_OF_MONTH) + "-" + cal.get(Calendar.MONTH) + "-" + cal.get(Calendar.YEAR));
|
|
|
780 |
|
|
|
781 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
782 |
List<Attribute> attributes = new ArrayList<Attribute>();
|
|
|
783 |
String extendedBy = "0";
|
|
|
784 |
attributes = transactionServiceClient.getAllAttributesForOrderId(id);
|
|
|
785 |
for (Attribute attribute : attributes) {
|
|
|
786 |
if (attribute.getName().equals("pickupExtension")) {
|
|
|
787 |
extendedBy = attribute.getValue();
|
|
|
788 |
}
|
|
|
789 |
}
|
|
|
790 |
cal.add(Calendar.DATE, Integer.parseInt(extendedBy));
|
|
|
791 |
|
|
|
792 |
log.info("Extended by" + extendedBy);
|
|
|
793 |
|
|
|
794 |
log.info("Final : " + cal.get(Calendar.DAY_OF_MONTH) + "-" + cal.get(Calendar.MONTH) + "-" + cal.get(Calendar.YEAR));
|
|
|
795 |
|
|
|
796 |
SimpleDateFormat SDF = new SimpleDateFormat("dd MMM, yyyy");
|
|
|
797 |
return SDF.format(cal.getTime());
|
|
|
798 |
|
|
|
799 |
} catch (NumberFormatException e) {
|
|
|
800 |
e.printStackTrace();
|
|
|
801 |
} catch (TException e) {
|
|
|
802 |
e.printStackTrace();
|
|
|
803 |
}
|
|
|
804 |
return "N/A";
|
|
|
805 |
}
|
| 3546 |
mandeep.dh |
806 |
|
| 4277 |
anupam.sin |
807 |
public String updateOrderStatus() {
|
|
|
808 |
long creatorId;
|
|
|
809 |
OrderStatus orderStatusEnum = null;
|
|
|
810 |
try {
|
|
|
811 |
creatorId = CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId();
|
|
|
812 |
|
|
|
813 |
if(orderStatus.equals("DENY_CANCEL_REQUEST")) {
|
|
|
814 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
815 |
transactionServiceClient.markOrderCancellationRequestDenied(Long.parseLong(orderId));
|
|
|
816 |
}
|
| 3546 |
mandeep.dh |
817 |
|
| 4277 |
anupam.sin |
818 |
else {
|
| 3546 |
mandeep.dh |
819 |
|
| 4277 |
anupam.sin |
820 |
orderStatusEnum = OrderStatus.valueOf(orderStatus);
|
|
|
821 |
transactionServiceClient = new TransactionClient().getClient();
|
| 3578 |
mandeep.dh |
822 |
|
| 4277 |
anupam.sin |
823 |
if (OrderStatus.SUBMITTED_FOR_PROCESSING.equals(orderStatusEnum)) {
|
|
|
824 |
transactionServiceClient.verifyOrder(Long.parseLong(orderId));
|
| 5348 |
anupam.sin |
825 |
transactionServiceClient.updateCODAgent(currentAgentEmailId, Long.parseLong(orderId));
|
| 4277 |
anupam.sin |
826 |
}
|
| 4682 |
rajveer |
827 |
else if (OrderStatus.COD_VERIFICATION_FAILED.equals(orderStatusEnum)) {
|
| 4277 |
anupam.sin |
828 |
transactionServiceClient.refundOrder(Long.parseLong(orderId), currentAgentEmailId, cancelReason);
|
| 5348 |
anupam.sin |
829 |
transactionServiceClient.updateCODAgent(currentAgentEmailId, Long.parseLong(orderId));
|
| 4277 |
anupam.sin |
830 |
}
|
|
|
831 |
else if (OrderStatus.CANCEL_REQUEST_CONFIRMED.equals(orderStatusEnum)) {
|
|
|
832 |
transactionServiceClient.markOrderCancellationRequestConfirmed(Long.parseLong(orderId));
|
|
|
833 |
}
|
|
|
834 |
else {
|
|
|
835 |
throw new UnsupportedOperationException("Cannot update status of orderId: " + orderId + " to: " + orderStatus);
|
|
|
836 |
}
|
|
|
837 |
}
|
|
|
838 |
|
|
|
839 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
840 |
searchFilter.setTicketId(Long.parseLong(id));
|
|
|
841 |
crmServiceClient = new CRMClient().getClient();
|
|
|
842 |
Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
| 3546 |
mandeep.dh |
843 |
|
| 4277 |
anupam.sin |
844 |
// Inserting activity
|
|
|
845 |
Activity activity = new Activity();
|
|
|
846 |
activity.setDescription("Status updated for Order Id: " + orderId
|
|
|
847 |
+ " to " + orderStatus + ", Reason: " + cancelReason + body);
|
|
|
848 |
activity.setType(ActivityType.OTHER);
|
|
|
849 |
activity.setTicketPriority(ticket.getPriority());
|
|
|
850 |
activity.setTicketStatus(ticket.getStatus());
|
|
|
851 |
activity.setCreatorId(creatorId);
|
|
|
852 |
activity.setTicketCategory(ticket.getCategory());
|
|
|
853 |
activity.setTicketDescription(ticket.getDescription());
|
|
|
854 |
activity.setCustomerId(ticket.getCustomerId());
|
|
|
855 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
| 3546 |
mandeep.dh |
856 |
|
| 4277 |
anupam.sin |
857 |
crmServiceClient = new CRMClient().getClient();
|
|
|
858 |
crmServiceClient.updateTicket(ticket, activity);
|
| 3546 |
mandeep.dh |
859 |
|
| 4277 |
anupam.sin |
860 |
} catch (TException e) {
|
|
|
861 |
log.info("Thrift exception", e);
|
|
|
862 |
} catch (NumberFormatException e) {
|
|
|
863 |
log.info("Could not convert to long", e);
|
|
|
864 |
} catch (TransactionServiceException e) {
|
|
|
865 |
log.info("Transaction client exception", e);
|
|
|
866 |
}
|
|
|
867 |
|
| 3546 |
mandeep.dh |
868 |
return edit();
|
|
|
869 |
}
|
| 4277 |
anupam.sin |
870 |
|
| 3137 |
mandeep.dh |
871 |
public User getUser(Long userId) {
|
|
|
872 |
User user = null;
|
|
|
873 |
|
|
|
874 |
try {
|
| 3390 |
mandeep.dh |
875 |
userContextServiceClient = new UserClient().getClient();
|
| 3137 |
mandeep.dh |
876 |
user = userContextServiceClient.getUserById(userId);
|
|
|
877 |
} catch (UserContextException e) {
|
|
|
878 |
String errorString = "Could not fetch user for " + userId;
|
|
|
879 |
log.error(errorString, e);
|
|
|
880 |
addActionError(errorString);
|
|
|
881 |
} catch (TException e) {
|
|
|
882 |
String errorString = "Could not create client";
|
|
|
883 |
log.error(errorString, e);
|
|
|
884 |
addActionError(errorString);
|
|
|
885 |
}
|
|
|
886 |
|
|
|
887 |
return user;
|
|
|
888 |
}
|
| 4267 |
anupam.sin |
889 |
|
| 4438 |
anupam.sin |
890 |
public String allowPayment() {
|
|
|
891 |
try {
|
|
|
892 |
log.info("Allowing payment for paymentId = " + paymentId);
|
|
|
893 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
894 |
transactionServiceClient.markTransactionAsPaymentFlagRemoved(Long.parseLong(transactionId));
|
|
|
895 |
if (id != null && !id.isEmpty()) {
|
|
|
896 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
897 |
crmServiceClient = new CRMClient().getClient();
|
|
|
898 |
searchFilter.setTicketId(Long.parseLong(id));
|
|
|
899 |
Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
|
|
900 |
// Inserting activity
|
|
|
901 |
if(ticket != null) {
|
|
|
902 |
Activity activity = new Activity();
|
|
|
903 |
activity.setDescription("Flagged Payment allowed");
|
|
|
904 |
activity.setType(ActivityType.OTHER);
|
|
|
905 |
activity.setTicketPriority(ticket.getPriority());
|
|
|
906 |
activity.setTicketStatus(ticket.getStatus());
|
|
|
907 |
activity.setCreatorId(CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId());
|
|
|
908 |
activity.setTicketCategory(ticket.getCategory());
|
|
|
909 |
activity.setTicketDescription(ticket.getDescription());
|
|
|
910 |
activity.setCustomerId(ticket.getCustomerId());
|
|
|
911 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
|
|
912 |
|
|
|
913 |
crmServiceClient = new CRMClient().getClient();
|
|
|
914 |
crmServiceClient.updateTicket(ticket, activity);
|
|
|
915 |
}
|
|
|
916 |
}
|
|
|
917 |
|
|
|
918 |
} catch (TException e) {
|
|
|
919 |
log.error("Error while getting tickets", e);
|
|
|
920 |
return EXCEPTION;
|
|
|
921 |
} catch (NumberFormatException e) {
|
|
|
922 |
log.error("Invalid ticket Id", e);
|
|
|
923 |
return EXCEPTION;
|
|
|
924 |
} catch (TransactionServiceException e) {
|
|
|
925 |
log.error("Error while marking transactions as Flag removed", e);
|
|
|
926 |
return EXCEPTION;
|
|
|
927 |
}
|
| 4267 |
anupam.sin |
928 |
return edit();
|
|
|
929 |
}
|
|
|
930 |
|
| 4490 |
anupam.sin |
931 |
public String blockPayment() {
|
| 4438 |
anupam.sin |
932 |
try {
|
|
|
933 |
log.info("Blocking payment for paymentId = " + paymentId);
|
|
|
934 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
935 |
transactionServiceClient.refundTransaction(Long.parseLong(transactionId), currentAgentEmailId, "FLAGGED_PAYMENT_CANCELLED");
|
|
|
936 |
if (id != null && !id.isEmpty()) {
|
|
|
937 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
938 |
crmServiceClient = new CRMClient().getClient();
|
|
|
939 |
searchFilter.setTicketId(Long.parseLong(id));
|
|
|
940 |
Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
|
|
941 |
// Inserting activity
|
|
|
942 |
if(ticket != null) {
|
|
|
943 |
Activity activity = new Activity();
|
|
|
944 |
activity.setDescription("Flagged Payment allowed");
|
|
|
945 |
activity.setType(ActivityType.OTHER);
|
|
|
946 |
activity.setTicketPriority(ticket.getPriority());
|
|
|
947 |
activity.setTicketStatus(ticket.getStatus());
|
|
|
948 |
activity.setCreatorId(CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId());
|
|
|
949 |
activity.setTicketCategory(ticket.getCategory());
|
|
|
950 |
activity.setTicketDescription(ticket.getDescription());
|
|
|
951 |
activity.setCustomerId(ticket.getCustomerId());
|
|
|
952 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
|
|
953 |
|
|
|
954 |
crmServiceClient = new CRMClient().getClient();
|
|
|
955 |
crmServiceClient.updateTicket(ticket, activity);
|
|
|
956 |
}
|
|
|
957 |
}
|
|
|
958 |
|
|
|
959 |
} catch (TException e) {
|
|
|
960 |
log.error("Error while getting tickets", e);
|
|
|
961 |
return EXCEPTION;
|
|
|
962 |
} catch (NumberFormatException e) {
|
|
|
963 |
log.error("Invalid ticket Id", e);
|
|
|
964 |
return EXCEPTION;
|
|
|
965 |
} catch (TransactionServiceException e) {
|
|
|
966 |
log.error("Error while allowing flagged payment", e);
|
|
|
967 |
return EXCEPTION;
|
|
|
968 |
}
|
| 4267 |
anupam.sin |
969 |
return edit();
|
|
|
970 |
}
|
| 4490 |
anupam.sin |
971 |
|
|
|
972 |
public String authorizeReturn() {
|
|
|
973 |
try {
|
|
|
974 |
log.info("Authorizing OrderId =" + orderId);
|
|
|
975 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
976 |
transactionServiceClient.markOrderReturnRequestAuthorized(Long.parseLong(orderId), true);
|
|
|
977 |
if (id != null && !id.isEmpty()) {
|
|
|
978 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
979 |
crmServiceClient = new CRMClient().getClient();
|
|
|
980 |
searchFilter.setTicketId(Long.parseLong(id));
|
|
|
981 |
Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
|
|
982 |
// Inserting activity
|
|
|
983 |
if(ticket != null) {
|
|
|
984 |
Activity activity = new Activity();
|
|
|
985 |
activity.setDescription("Return Authorized");
|
|
|
986 |
activity.setType(ActivityType.OTHER);
|
|
|
987 |
activity.setTicketPriority(ticket.getPriority());
|
|
|
988 |
activity.setTicketStatus(ticket.getStatus());
|
|
|
989 |
activity.setCreatorId(CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId());
|
|
|
990 |
activity.setTicketCategory(ticket.getCategory());
|
|
|
991 |
activity.setTicketDescription(ticket.getDescription());
|
|
|
992 |
activity.setCustomerId(ticket.getCustomerId());
|
|
|
993 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
| 3137 |
mandeep.dh |
994 |
|
| 4490 |
anupam.sin |
995 |
crmServiceClient = new CRMClient().getClient();
|
|
|
996 |
crmServiceClient.updateTicket(ticket, activity);
|
|
|
997 |
}
|
|
|
998 |
}
|
|
|
999 |
|
|
|
1000 |
} catch (TException e) {
|
|
|
1001 |
log.error("Error while getting tickets", e);
|
|
|
1002 |
return EXCEPTION;
|
|
|
1003 |
} catch (NumberFormatException e) {
|
|
|
1004 |
log.error("Invalid ticket Id", e);
|
|
|
1005 |
return EXCEPTION;
|
|
|
1006 |
} catch (TransactionServiceException e) {
|
|
|
1007 |
log.error("Error while authorizing Return", e);
|
|
|
1008 |
return EXCEPTION;
|
|
|
1009 |
}
|
|
|
1010 |
return edit();
|
|
|
1011 |
}
|
|
|
1012 |
|
|
|
1013 |
public String denyReturn() {
|
|
|
1014 |
try {
|
|
|
1015 |
log.info("Denying OrderId =" + orderId);
|
|
|
1016 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
1017 |
transactionServiceClient.markOrderReturnRequestAuthorized(Long.parseLong(orderId), false);
|
|
|
1018 |
if (id != null && !id.isEmpty()) {
|
|
|
1019 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
1020 |
crmServiceClient = new CRMClient().getClient();
|
|
|
1021 |
searchFilter.setTicketId(Long.parseLong(id));
|
|
|
1022 |
Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
|
|
1023 |
// Inserting activity
|
|
|
1024 |
if(ticket != null) {
|
|
|
1025 |
Activity activity = new Activity();
|
|
|
1026 |
activity.setDescription("Return Denied");
|
|
|
1027 |
activity.setType(ActivityType.OTHER);
|
|
|
1028 |
activity.setTicketPriority(ticket.getPriority());
|
|
|
1029 |
activity.setTicketStatus(ticket.getStatus());
|
|
|
1030 |
activity.setCreatorId(CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId());
|
|
|
1031 |
activity.setTicketCategory(ticket.getCategory());
|
|
|
1032 |
activity.setTicketDescription(ticket.getDescription());
|
|
|
1033 |
activity.setCustomerId(ticket.getCustomerId());
|
|
|
1034 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
|
|
1035 |
|
|
|
1036 |
crmServiceClient = new CRMClient().getClient();
|
|
|
1037 |
crmServiceClient.updateTicket(ticket, activity);
|
|
|
1038 |
}
|
|
|
1039 |
}
|
|
|
1040 |
|
|
|
1041 |
} catch (TException e) {
|
|
|
1042 |
log.error("Error while getting tickets", e);
|
|
|
1043 |
return EXCEPTION;
|
|
|
1044 |
} catch (NumberFormatException e) {
|
|
|
1045 |
log.error("Invalid ticket Id", e);
|
|
|
1046 |
return EXCEPTION;
|
|
|
1047 |
} catch (TransactionServiceException e) {
|
|
|
1048 |
log.error("Error while denying Return", e);
|
|
|
1049 |
return EXCEPTION;
|
|
|
1050 |
}
|
|
|
1051 |
return edit();
|
|
|
1052 |
}
|
|
|
1053 |
|
|
|
1054 |
public String authorizeDOA() {
|
|
|
1055 |
try {
|
|
|
1056 |
log.info("Authorizing OrderId =" + orderId);
|
|
|
1057 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
1058 |
transactionServiceClient.markOrderDoaRequestAuthorized(Long.parseLong(orderId), true);
|
|
|
1059 |
if (id != null && !id.isEmpty()) {
|
|
|
1060 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
1061 |
crmServiceClient = new CRMClient().getClient();
|
|
|
1062 |
searchFilter.setTicketId(Long.parseLong(id));
|
|
|
1063 |
Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
|
|
1064 |
// Inserting activity
|
|
|
1065 |
if(ticket != null) {
|
|
|
1066 |
Activity activity = new Activity();
|
|
|
1067 |
activity.setDescription("DOA Authorized");
|
|
|
1068 |
activity.setType(ActivityType.OTHER);
|
|
|
1069 |
activity.setTicketPriority(ticket.getPriority());
|
|
|
1070 |
activity.setTicketStatus(ticket.getStatus());
|
|
|
1071 |
activity.setCreatorId(CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId());
|
|
|
1072 |
activity.setTicketCategory(ticket.getCategory());
|
|
|
1073 |
activity.setTicketDescription(ticket.getDescription());
|
|
|
1074 |
activity.setCustomerId(ticket.getCustomerId());
|
|
|
1075 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
|
|
1076 |
|
|
|
1077 |
crmServiceClient = new CRMClient().getClient();
|
|
|
1078 |
crmServiceClient.updateTicket(ticket, activity);
|
|
|
1079 |
}
|
|
|
1080 |
}
|
|
|
1081 |
|
|
|
1082 |
} catch (TException e) {
|
|
|
1083 |
log.error("Error while getting tickets", e);
|
|
|
1084 |
return EXCEPTION;
|
|
|
1085 |
} catch (NumberFormatException e) {
|
|
|
1086 |
log.error("Invalid ticket Id", e);
|
|
|
1087 |
return EXCEPTION;
|
|
|
1088 |
} catch (TransactionServiceException e) {
|
|
|
1089 |
log.error("Error while authorizing DOA", e);
|
|
|
1090 |
return EXCEPTION;
|
|
|
1091 |
}
|
|
|
1092 |
return edit();
|
|
|
1093 |
}
|
|
|
1094 |
|
|
|
1095 |
public String denyDOA() {
|
|
|
1096 |
try {
|
|
|
1097 |
log.info("Denying OrderId =" + orderId);
|
|
|
1098 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
1099 |
transactionServiceClient.markOrderDoaRequestAuthorized(Long.parseLong(orderId), false);
|
|
|
1100 |
if (id != null && !id.isEmpty()) {
|
|
|
1101 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
1102 |
crmServiceClient = new CRMClient().getClient();
|
|
|
1103 |
searchFilter.setTicketId(Long.parseLong(id));
|
|
|
1104 |
Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
|
|
1105 |
// Inserting activity
|
|
|
1106 |
if(ticket != null) {
|
|
|
1107 |
Activity activity = new Activity();
|
|
|
1108 |
activity.setDescription("DOA Denied");
|
|
|
1109 |
activity.setType(ActivityType.OTHER);
|
|
|
1110 |
activity.setTicketPriority(ticket.getPriority());
|
|
|
1111 |
activity.setTicketStatus(ticket.getStatus());
|
|
|
1112 |
activity.setCreatorId(CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId());
|
|
|
1113 |
activity.setTicketCategory(ticket.getCategory());
|
|
|
1114 |
activity.setTicketDescription(ticket.getDescription());
|
|
|
1115 |
activity.setCustomerId(ticket.getCustomerId());
|
|
|
1116 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
|
|
1117 |
|
|
|
1118 |
crmServiceClient = new CRMClient().getClient();
|
|
|
1119 |
crmServiceClient.updateTicket(ticket, activity);
|
|
|
1120 |
}
|
|
|
1121 |
}
|
|
|
1122 |
|
|
|
1123 |
} catch (TException e) {
|
|
|
1124 |
log.error("Error while getting tickets", e);
|
|
|
1125 |
return EXCEPTION;
|
|
|
1126 |
} catch (NumberFormatException e) {
|
|
|
1127 |
log.error("Invalid ticket Id", e);
|
|
|
1128 |
return EXCEPTION;
|
|
|
1129 |
} catch (TransactionServiceException e) {
|
|
|
1130 |
log.error("Error while denying DOA", e);
|
|
|
1131 |
return EXCEPTION;
|
|
|
1132 |
}
|
|
|
1133 |
return edit();
|
|
|
1134 |
}
|
| 5407 |
amar.kumar |
1135 |
|
| 5909 |
amar.kumar |
1136 |
public String getAllOpenTickets() {
|
|
|
1137 |
try {
|
|
|
1138 |
ticketCategorycountMap= new HashMap<String, Long>();
|
|
|
1139 |
crmServiceClient = new CRMClient().getClient();
|
|
|
1140 |
ticketCategorycountMap = crmServiceClient.getOpenTicketsMap();
|
|
|
1141 |
} catch (TException e) {
|
|
|
1142 |
String errorString = "Error getting tickets for "
|
|
|
1143 |
+ currentAgentEmailId;
|
|
|
1144 |
log.error(errorString, e);
|
|
|
1145 |
addActionError(errorString);
|
|
|
1146 |
}
|
|
|
1147 |
return OPEN;
|
|
|
1148 |
}
|
|
|
1149 |
|
| 5407 |
amar.kumar |
1150 |
public double getCustomerTrustLevel(long userId) {
|
|
|
1151 |
try {
|
|
|
1152 |
userContextServiceClient = new UserClient().getClient();
|
|
|
1153 |
return userContextServiceClient.getTrustLevel(userId);
|
|
|
1154 |
} catch (TException e) {
|
|
|
1155 |
log.info("Exception while getting trustLevel for " +
|
|
|
1156 |
"userId " + userId);
|
|
|
1157 |
}
|
|
|
1158 |
return 0;
|
|
|
1159 |
}
|
| 4490 |
anupam.sin |
1160 |
|
| 4020 |
mandeep.dh |
1161 |
public EscalationMatrix[] getEscalationMatrix () {
|
|
|
1162 |
return CRMConstants.EscalationMatrix.values();
|
|
|
1163 |
}
|
|
|
1164 |
|
| 3546 |
mandeep.dh |
1165 |
public String getAddress(Order order) {
|
|
|
1166 |
return ModelUtils.extractAddressFromOrder(order);
|
|
|
1167 |
}
|
|
|
1168 |
|
|
|
1169 |
public String getProductName(LineItem lineItem) {
|
| 4008 |
mandeep.dh |
1170 |
return ModelUtils.extractProductNameFromLineItem(lineItem) + " " + lineItem.getColor();
|
| 3546 |
mandeep.dh |
1171 |
}
|
|
|
1172 |
|
| 3405 |
mandeep.dh |
1173 |
public ActivityType[] getActivityTypes() {
|
|
|
1174 |
return ActivityType.values();
|
|
|
1175 |
}
|
|
|
1176 |
|
|
|
1177 |
public TicketStatus[] getTicketStatuses() {
|
|
|
1178 |
return TicketStatus.values();
|
|
|
1179 |
}
|
|
|
1180 |
|
| 3390 |
mandeep.dh |
1181 |
public Agent getAgent(long agentId) throws TException {
|
|
|
1182 |
return CRMAuthorizingRealm.getAgent(agentId);
|
| 3137 |
mandeep.dh |
1183 |
}
|
|
|
1184 |
|
| 3339 |
mandeep.dh |
1185 |
public List<Agent> getAllAgents() {
|
| 3390 |
mandeep.dh |
1186 |
return CRMAuthorizingRealm.getAgents();
|
| 3339 |
mandeep.dh |
1187 |
}
|
|
|
1188 |
|
|
|
1189 |
public TicketCategory[] getTicketCategories() {
|
|
|
1190 |
return TicketCategory.values();
|
|
|
1191 |
}
|
|
|
1192 |
|
|
|
1193 |
public TicketPriority[] getTicketPriorities() {
|
|
|
1194 |
return TicketPriority.values();
|
|
|
1195 |
}
|
|
|
1196 |
|
| 3137 |
mandeep.dh |
1197 |
public List<Ticket> getTickets() {
|
|
|
1198 |
return tickets;
|
|
|
1199 |
}
|
|
|
1200 |
|
|
|
1201 |
public void setTickets(List<Ticket> tickets) {
|
|
|
1202 |
this.tickets = tickets;
|
|
|
1203 |
}
|
| 3339 |
mandeep.dh |
1204 |
|
| 3405 |
mandeep.dh |
1205 |
public String getCustomerEmailId() {
|
|
|
1206 |
return customerEmailId;
|
| 3339 |
mandeep.dh |
1207 |
}
|
|
|
1208 |
|
| 3405 |
mandeep.dh |
1209 |
public void setCustomerEmailId(String customerEmailId) {
|
|
|
1210 |
this.customerEmailId = customerEmailId;
|
| 3339 |
mandeep.dh |
1211 |
}
|
|
|
1212 |
|
|
|
1213 |
public String getDescription() {
|
|
|
1214 |
return description;
|
|
|
1215 |
}
|
|
|
1216 |
|
|
|
1217 |
public void setDescription(String description) {
|
|
|
1218 |
this.description = description;
|
|
|
1219 |
}
|
|
|
1220 |
|
|
|
1221 |
public String getAssigneeEmailId() {
|
|
|
1222 |
return assigneeEmailId;
|
|
|
1223 |
}
|
|
|
1224 |
|
|
|
1225 |
public void setAssigneeEmailId(String assigneeEmailId) {
|
|
|
1226 |
this.assigneeEmailId = assigneeEmailId;
|
|
|
1227 |
}
|
|
|
1228 |
|
|
|
1229 |
public String getPriority() {
|
|
|
1230 |
return priority;
|
|
|
1231 |
}
|
|
|
1232 |
|
|
|
1233 |
public void setPriority(String priority) {
|
|
|
1234 |
this.priority = priority;
|
|
|
1235 |
}
|
|
|
1236 |
|
|
|
1237 |
public String getCategory() {
|
|
|
1238 |
return category;
|
|
|
1239 |
}
|
|
|
1240 |
|
|
|
1241 |
public void setCategory(String category) {
|
|
|
1242 |
this.category = category;
|
|
|
1243 |
}
|
|
|
1244 |
|
|
|
1245 |
public String getOrderId() {
|
|
|
1246 |
return orderId;
|
|
|
1247 |
}
|
|
|
1248 |
|
|
|
1249 |
public void setOrderId(String orderId) {
|
|
|
1250 |
this.orderId = orderId;
|
|
|
1251 |
}
|
| 3397 |
mandeep.dh |
1252 |
|
|
|
1253 |
public String[] getAgentIds() {
|
|
|
1254 |
return agentIds;
|
|
|
1255 |
}
|
|
|
1256 |
|
|
|
1257 |
public void setAgentIds(String[] agentIds) {
|
|
|
1258 |
this.agentIds = agentIds;
|
|
|
1259 |
}
|
|
|
1260 |
|
|
|
1261 |
public String getStartTimestamp() {
|
|
|
1262 |
return startTimestamp;
|
|
|
1263 |
}
|
|
|
1264 |
|
|
|
1265 |
public void setStartTimestamp(String startTimestamp) {
|
|
|
1266 |
this.startTimestamp = startTimestamp;
|
|
|
1267 |
}
|
|
|
1268 |
|
|
|
1269 |
public String getEndTimestamp() {
|
|
|
1270 |
return endTimestamp;
|
|
|
1271 |
}
|
|
|
1272 |
|
|
|
1273 |
public void setEndTimestamp(String endTimestamp) {
|
|
|
1274 |
this.endTimestamp = endTimestamp;
|
|
|
1275 |
}
|
| 3405 |
mandeep.dh |
1276 |
|
|
|
1277 |
public String getUserId() {
|
|
|
1278 |
return userId;
|
|
|
1279 |
}
|
|
|
1280 |
|
|
|
1281 |
public void setUserId(String userId) {
|
|
|
1282 |
this.userId = userId;
|
|
|
1283 |
}
|
|
|
1284 |
|
|
|
1285 |
public String getId() {
|
|
|
1286 |
return id;
|
|
|
1287 |
}
|
|
|
1288 |
|
|
|
1289 |
public void setId(String id) {
|
|
|
1290 |
this.id = id;
|
|
|
1291 |
}
|
|
|
1292 |
|
|
|
1293 |
public String getActivityDescription() {
|
|
|
1294 |
return activityDescription;
|
|
|
1295 |
}
|
|
|
1296 |
|
|
|
1297 |
public void setActivityDescription(String activityDescription) {
|
|
|
1298 |
this.activityDescription = activityDescription;
|
|
|
1299 |
}
|
|
|
1300 |
|
|
|
1301 |
public String getStatus() {
|
|
|
1302 |
return status;
|
|
|
1303 |
}
|
|
|
1304 |
|
|
|
1305 |
public void setStatus(String status) {
|
|
|
1306 |
this.status = status;
|
|
|
1307 |
}
|
|
|
1308 |
|
|
|
1309 |
public String getActivityType() {
|
|
|
1310 |
return activityType;
|
|
|
1311 |
}
|
|
|
1312 |
|
|
|
1313 |
public void setActivityType(String activityType) {
|
|
|
1314 |
this.activityType = activityType;
|
|
|
1315 |
}
|
|
|
1316 |
|
|
|
1317 |
public Ticket getTicket() {
|
|
|
1318 |
return ticket;
|
|
|
1319 |
}
|
|
|
1320 |
|
|
|
1321 |
public void setTicket(Ticket ticket) {
|
|
|
1322 |
this.ticket = ticket;
|
|
|
1323 |
}
|
|
|
1324 |
|
|
|
1325 |
public List<Activity> getActivities() {
|
|
|
1326 |
return activities;
|
|
|
1327 |
}
|
|
|
1328 |
|
|
|
1329 |
public void setActivities(List<Activity> activities) {
|
|
|
1330 |
this.activities = activities;
|
|
|
1331 |
}
|
|
|
1332 |
|
|
|
1333 |
public String getSubject() {
|
|
|
1334 |
return subject;
|
|
|
1335 |
}
|
|
|
1336 |
|
|
|
1337 |
public void setSubject(String subject) {
|
|
|
1338 |
this.subject = subject;
|
|
|
1339 |
}
|
|
|
1340 |
|
|
|
1341 |
public String getBody() {
|
|
|
1342 |
return body;
|
|
|
1343 |
}
|
|
|
1344 |
|
|
|
1345 |
public void setBody(String body) {
|
|
|
1346 |
this.body = body;
|
|
|
1347 |
}
|
|
|
1348 |
|
|
|
1349 |
public String getCustomerName() {
|
|
|
1350 |
return customerName;
|
|
|
1351 |
}
|
|
|
1352 |
|
|
|
1353 |
public void setCustomerName(String customerName) {
|
|
|
1354 |
this.customerName = customerName;
|
|
|
1355 |
}
|
|
|
1356 |
|
|
|
1357 |
public String getCustomerMobileNumber() {
|
|
|
1358 |
return customerMobileNumber;
|
|
|
1359 |
}
|
|
|
1360 |
|
|
|
1361 |
public void setCustomerMobileNumber(String customerMobileNumber) {
|
|
|
1362 |
this.customerMobileNumber = customerMobileNumber;
|
|
|
1363 |
}
|
| 3546 |
mandeep.dh |
1364 |
|
|
|
1365 |
public User getUser() {
|
|
|
1366 |
return user;
|
|
|
1367 |
}
|
|
|
1368 |
|
|
|
1369 |
public void setUser(User user) {
|
|
|
1370 |
this.user = user;
|
|
|
1371 |
}
|
|
|
1372 |
|
|
|
1373 |
public String getOrderStatus() {
|
|
|
1374 |
return orderStatus;
|
|
|
1375 |
}
|
|
|
1376 |
|
|
|
1377 |
public void setOrderStatus(String orderStatus) {
|
|
|
1378 |
this.orderStatus = orderStatus;
|
|
|
1379 |
}
|
|
|
1380 |
|
|
|
1381 |
public List<Order> getOrders() {
|
|
|
1382 |
return orders;
|
|
|
1383 |
}
|
|
|
1384 |
|
|
|
1385 |
public void setOrders(List<Order> orders) {
|
|
|
1386 |
this.orders = orders;
|
|
|
1387 |
}
|
| 4020 |
mandeep.dh |
1388 |
|
|
|
1389 |
public String getEscalate() {
|
|
|
1390 |
return escalate;
|
|
|
1391 |
}
|
|
|
1392 |
|
|
|
1393 |
public void setEscalate(String escalate) {
|
|
|
1394 |
this.escalate = escalate;
|
|
|
1395 |
}
|
| 4241 |
anupam.sin |
1396 |
|
|
|
1397 |
public String getCancelReason() {
|
|
|
1398 |
return cancelReason;
|
|
|
1399 |
}
|
|
|
1400 |
|
|
|
1401 |
public void setCancelReason(String cancelReason) {
|
|
|
1402 |
this.cancelReason = cancelReason;
|
|
|
1403 |
}
|
| 4267 |
anupam.sin |
1404 |
|
|
|
1405 |
public List<Payment> getPayments() {
|
|
|
1406 |
return payments;
|
|
|
1407 |
}
|
|
|
1408 |
|
|
|
1409 |
public void setPayments(List<Payment> payments) {
|
|
|
1410 |
this.payments = payments;
|
|
|
1411 |
}
|
|
|
1412 |
|
|
|
1413 |
public String getTransactionId() {
|
|
|
1414 |
return transactionId;
|
|
|
1415 |
}
|
|
|
1416 |
|
|
|
1417 |
public void setTransactionId(String transactionId) {
|
|
|
1418 |
this.transactionId = transactionId;
|
|
|
1419 |
}
|
| 4438 |
anupam.sin |
1420 |
|
|
|
1421 |
public String getPaymentId() {
|
|
|
1422 |
return paymentId;
|
|
|
1423 |
}
|
|
|
1424 |
|
|
|
1425 |
public void setPaymentId(String paymentId) {
|
|
|
1426 |
this.paymentId = paymentId;
|
|
|
1427 |
}
|
| 4490 |
anupam.sin |
1428 |
|
|
|
1429 |
public HashMap<String, String> getAllAttachmentsForTicket() {
|
|
|
1430 |
return allAttachmentsForTicket;
|
|
|
1431 |
}
|
|
|
1432 |
|
|
|
1433 |
public void setAllAttachmentsForTicket(HashMap<String, String> allAttachmentsForTicket) {
|
|
|
1434 |
this.allAttachmentsForTicket = allAttachmentsForTicket;
|
|
|
1435 |
}
|
| 5791 |
anupam.sin |
1436 |
|
|
|
1437 |
public String getPickupExtension() {
|
|
|
1438 |
return pickupExtension;
|
|
|
1439 |
}
|
|
|
1440 |
|
|
|
1441 |
public void setPickupExtension(String pickupExtension) {
|
|
|
1442 |
this.pickupExtension = pickupExtension;
|
|
|
1443 |
}
|
| 5909 |
amar.kumar |
1444 |
|
|
|
1445 |
public Map<String, Long> getTicketCategorycountMap() {
|
|
|
1446 |
return ticketCategorycountMap;
|
|
|
1447 |
}
|
|
|
1448 |
|
|
|
1449 |
public void setTicketCategorycountMap(
|
|
|
1450 |
Map<String, Long> ticketCategorycountMap) {
|
|
|
1451 |
this.ticketCategorycountMap = ticketCategorycountMap;
|
|
|
1452 |
}
|
| 3137 |
mandeep.dh |
1453 |
}
|