| Line 4... |
Line 4... |
| 4 |
package in.shop2020.crm.service.handler;
|
4 |
package in.shop2020.crm.service.handler;
|
| 5 |
|
5 |
|
| 6 |
import in.shop2020.alert.AlertService;
|
6 |
import in.shop2020.alert.AlertService;
|
| 7 |
import in.shop2020.alert.EntityType;
|
7 |
import in.shop2020.alert.EntityType;
|
| 8 |
import in.shop2020.alert.MonitoredEntity;
|
8 |
import in.shop2020.alert.MonitoredEntity;
|
| - |
|
9 |
import in.shop2020.config.ConfigException;
|
| 9 |
import in.shop2020.crm.Activity;
|
10 |
import in.shop2020.crm.Activity;
|
| 10 |
import in.shop2020.crm.ActivityType;
|
11 |
import in.shop2020.crm.ActivityType;
|
| 11 |
import in.shop2020.crm.Agent;
|
12 |
import in.shop2020.crm.Agent;
|
| 12 |
import in.shop2020.crm.TicketStatus;
|
13 |
import in.shop2020.crm.TicketStatus;
|
| 13 |
import in.shop2020.crm.CRMService.Iface;
|
14 |
import in.shop2020.crm.CRMService.Iface;
|
| Line 15... |
Line 16... |
| 15 |
import in.shop2020.crm.Ticket;
|
16 |
import in.shop2020.crm.Ticket;
|
| 16 |
import in.shop2020.crm.TicketCategory;
|
17 |
import in.shop2020.crm.TicketCategory;
|
| 17 |
import in.shop2020.crm.handler.ActivityHandler;
|
18 |
import in.shop2020.crm.handler.ActivityHandler;
|
| 18 |
import in.shop2020.crm.handler.AgentHandler;
|
19 |
import in.shop2020.crm.handler.AgentHandler;
|
| 19 |
import in.shop2020.crm.handler.TicketHandler;
|
20 |
import in.shop2020.crm.handler.TicketHandler;
|
| - |
|
21 |
import in.shop2020.serving.model.ShipmentUpdate;
|
| - |
|
22 |
import in.shop2020.serving.services.FedExTrackingService;
|
| 20 |
import in.shop2020.thrift.clients.AlertClient;
|
23 |
import in.shop2020.thrift.clients.AlertClient;
|
| - |
|
24 |
import in.shop2020.thrift.clients.TransactionClient;
|
| - |
|
25 |
import in.shop2020.thrift.clients.config.ConfigClient;
|
| - |
|
26 |
import in.shop2020.model.v1.order.Order;
|
| - |
|
27 |
import in.shop2020.model.v1.order.TransactionServiceException;
|
| 21 |
|
28 |
|
| 22 |
import java.text.ParseException;
|
29 |
import java.text.ParseException;
|
| 23 |
import java.util.ArrayList;
|
30 |
import java.util.ArrayList;
|
| 24 |
import java.util.Calendar;
|
31 |
import java.util.Calendar;
|
| 25 |
import java.util.Date;
|
32 |
import java.util.Date;
|
| Line 27... |
Line 34... |
| 27 |
import java.util.Map;
|
34 |
import java.util.Map;
|
| 28 |
|
35 |
|
| 29 |
import org.apache.commons.logging.Log;
|
36 |
import org.apache.commons.logging.Log;
|
| 30 |
import org.apache.commons.logging.LogFactory;
|
37 |
import org.apache.commons.logging.LogFactory;
|
| 31 |
import org.apache.thrift.TException;
|
38 |
import org.apache.thrift.TException;
|
| - |
|
39 |
import org.apache.thrift.transport.TTransportException;
|
| 32 |
import org.springframework.context.ApplicationContext;
|
40 |
import org.springframework.context.ApplicationContext;
|
| 33 |
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
41 |
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
| 34 |
import org.springframework.stereotype.Service;
|
42 |
import org.springframework.stereotype.Service;
|
| 35 |
import org.springframework.transaction.annotation.Transactional;
|
43 |
import org.springframework.transaction.annotation.Transactional;
|
| 36 |
|
44 |
|
| Line 44... |
Line 52... |
| 44 |
private static final Log log = LogFactory.getLog(CRMServiceHandler.class);
|
52 |
private static final Log log = LogFactory.getLog(CRMServiceHandler.class);
|
| 45 |
|
53 |
|
| 46 |
private TicketHandler ticketHandler;
|
54 |
private TicketHandler ticketHandler;
|
| 47 |
private ActivityHandler activityHandler;
|
55 |
private ActivityHandler activityHandler;
|
| 48 |
private AgentHandler agentHandler;
|
56 |
private AgentHandler agentHandler;
|
| - |
|
57 |
private FedExTrackingService fedexTrackClient = new FedExTrackingService();
|
| 49 |
|
58 |
|
| 50 |
public CRMServiceHandler() {
|
59 |
public CRMServiceHandler() {
|
| 51 |
log.info("Creating context");
|
60 |
log.info("Creating context");
|
| 52 |
ApplicationContext context = new ClassPathXmlApplicationContext("context.xml");
|
61 |
ApplicationContext context = new ClassPathXmlApplicationContext("context.xml");
|
| 53 |
ticketHandler = context.getBean(TicketHandler.class);
|
62 |
ticketHandler = context.getBean(TicketHandler.class);
|
| Line 288... |
Line 297... |
| 288 |
}
|
297 |
}
|
| 289 |
|
298 |
|
| 290 |
public Map<String,Long> getOpenTicketsMap() {
|
299 |
public Map<String,Long> getOpenTicketsMap() {
|
| 291 |
return ticketHandler.getOpenTicketsMap();
|
300 |
return ticketHandler.getOpenTicketsMap();
|
| 292 |
}
|
301 |
}
|
| - |
|
302 |
|
| - |
|
303 |
|
| - |
|
304 |
public Map<String, String> getFedexReconciliationDataMap(
|
| - |
|
305 |
List<Long> order_ids, String method_key) {
|
| - |
|
306 |
Map<String, String> fedexReconciliationDataMap = null;
|
| - |
|
307 |
try{
|
| - |
|
308 |
TransactionClient transactionServiceClient = new TransactionClient();
|
| - |
|
309 |
List<Order> orderList= transactionServiceClient.getClient().getOrderList(order_ids);
|
| - |
|
310 |
if("delivered_orders".equalsIgnoreCase(method_key)){
|
| - |
|
311 |
fedexReconciliationDataMap = fedexTrackClient.readFedExDeliveredOrdersMap(orderList);
|
| - |
|
312 |
}
|
| - |
|
313 |
if("returned_orders".equalsIgnoreCase(method_key)){
|
| - |
|
314 |
fedexReconciliationDataMap = fedexTrackClient.readFedExReturnedOrdersMap(orderList);
|
| - |
|
315 |
}
|
| - |
|
316 |
if("undelivered_orders".equalsIgnoreCase(method_key)){
|
| - |
|
317 |
fedexReconciliationDataMap = fedexTrackClient.readFedExUnDeliveredOrdersMap(orderList);
|
| - |
|
318 |
}
|
| - |
|
319 |
if("first_delivery_attempted_orders".equalsIgnoreCase(method_key)){
|
| - |
|
320 |
fedexReconciliationDataMap = fedexTrackClient.readFedExFirstDeliveryAttemptedOrdersMap(orderList);
|
| - |
|
321 |
}
|
| - |
|
322 |
if("destination_city_reached_orders".equalsIgnoreCase(method_key)){
|
| - |
|
323 |
fedexReconciliationDataMap = fedexTrackClient.readFedExReachedDestinationOrdersMap(orderList);
|
| - |
|
324 |
}
|
| - |
|
325 |
if("delivered_orders".equalsIgnoreCase(method_key)){
|
| - |
|
326 |
fedexReconciliationDataMap = fedexTrackClient.readFedExFirstDeliveryAttemptedOrdersMap(orderList);
|
| - |
|
327 |
}
|
| - |
|
328 |
if("picked_up_orders".equalsIgnoreCase(method_key) || "local_connection_orders".equalsIgnoreCase(method_key)){
|
| - |
|
329 |
fedexReconciliationDataMap = fedexTrackClient.readFedExPickupOrdersMap(orderList);
|
| - |
|
330 |
}
|
| - |
|
331 |
// TODO Auto-generated method stub
|
| - |
|
332 |
}
|
| - |
|
333 |
catch (TTransportException e) {
|
| - |
|
334 |
log.error("Unable to create thrift Client", e);
|
| - |
|
335 |
} catch (TException e) {
|
| - |
|
336 |
log.error("Unable to get thrift Client", e);
|
| - |
|
337 |
}
|
| - |
|
338 |
return fedexReconciliationDataMap;
|
| - |
|
339 |
}
|
| 293 |
}
|
340 |
}
|