| Line 10... |
Line 10... |
| 10 |
import in.shop2020.crm.SearchFilter;
|
10 |
import in.shop2020.crm.SearchFilter;
|
| 11 |
import in.shop2020.crm.Ticket;
|
11 |
import in.shop2020.crm.Ticket;
|
| 12 |
import in.shop2020.crm.handler.ActivityHandler;
|
12 |
import in.shop2020.crm.handler.ActivityHandler;
|
| 13 |
import in.shop2020.crm.handler.AgentHandler;
|
13 |
import in.shop2020.crm.handler.AgentHandler;
|
| 14 |
import in.shop2020.crm.handler.TicketHandler;
|
14 |
import in.shop2020.crm.handler.TicketHandler;
|
| 15 |
import in.shop2020.crm.util.DelayedOrderProcessorTask;
|
- |
|
| 16 |
import in.shop2020.crm.util.PaymentProcessorTask;
|
- |
|
| 17 |
import in.shop2020.crm.util.CODTransactionProcessorTask;
|
- |
|
| 18 |
|
15 |
|
| 19 |
import java.text.ParseException;
|
16 |
import java.text.ParseException;
|
| 20 |
import java.util.ArrayList;
|
17 |
import java.util.ArrayList;
|
| 21 |
import java.util.Date;
|
18 |
import java.util.Date;
|
| 22 |
import java.util.List;
|
19 |
import java.util.List;
|
| 23 |
import java.util.concurrent.Executors;
|
- |
|
| 24 |
import java.util.concurrent.ScheduledExecutorService;
|
- |
|
| 25 |
import java.util.concurrent.TimeUnit;
|
- |
|
| 26 |
|
20 |
|
| 27 |
import org.apache.commons.logging.Log;
|
21 |
import org.apache.commons.logging.Log;
|
| 28 |
import org.apache.commons.logging.LogFactory;
|
22 |
import org.apache.commons.logging.LogFactory;
|
| 29 |
import org.apache.thrift.TException;
|
23 |
import org.apache.thrift.TException;
|
| 30 |
import org.springframework.context.ApplicationContext;
|
24 |
import org.springframework.context.ApplicationContext;
|
| Line 39... |
Line 33... |
| 39 |
*/
|
33 |
*/
|
| 40 |
@Service
|
34 |
@Service
|
| 41 |
public class CRMServiceHandler implements Iface {
|
35 |
public class CRMServiceHandler implements Iface {
|
| 42 |
private static final Log log = LogFactory.getLog(CRMServiceHandler.class);
|
36 |
private static final Log log = LogFactory.getLog(CRMServiceHandler.class);
|
| 43 |
|
37 |
|
| 44 |
private ScheduledExecutorService scheduler;
|
- |
|
| 45 |
private TicketHandler ticketHandler;
|
38 |
private TicketHandler ticketHandler;
|
| 46 |
private ActivityHandler activityHandler;
|
39 |
private ActivityHandler activityHandler;
|
| 47 |
private AgentHandler agentHandler;
|
40 |
private AgentHandler agentHandler;
|
| 48 |
|
41 |
|
| 49 |
public CRMServiceHandler() {
|
42 |
public CRMServiceHandler() {
|
| 50 |
log.info("Creating context");
|
43 |
log.info("Creating context");
|
| 51 |
ApplicationContext context = new ClassPathXmlApplicationContext("context.xml");
|
44 |
ApplicationContext context = new ClassPathXmlApplicationContext("context.xml");
|
| 52 |
ticketHandler = context.getBean(TicketHandler.class);
|
45 |
ticketHandler = context.getBean(TicketHandler.class);
|
| 53 |
activityHandler = context.getBean(ActivityHandler.class);
|
46 |
activityHandler = context.getBean(ActivityHandler.class);
|
| 54 |
agentHandler = context.getBean(AgentHandler.class);
|
47 |
agentHandler = context.getBean(AgentHandler.class);
|
| 55 |
scheduler = Executors.newSingleThreadScheduledExecutor();
|
- |
|
| 56 |
|
- |
|
| 57 |
log.info("Scheduling tasks");
|
- |
|
| 58 |
scheduler.scheduleAtFixedRate(new CODTransactionProcessorTask(ticketHandler, activityHandler), 2, 5, TimeUnit.MINUTES);
|
- |
|
| 59 |
scheduler.scheduleAtFixedRate(new PaymentProcessorTask(ticketHandler, activityHandler), 4, 5, TimeUnit.MINUTES);
|
- |
|
| 60 |
scheduler.scheduleAtFixedRate(new DelayedOrderProcessorTask(ticketHandler, activityHandler), 6, 5, TimeUnit.MINUTES);
|
- |
|
| 61 |
}
|
48 |
}
|
| 62 |
|
49 |
|
| 63 |
public List<Ticket> getTickets(SearchFilter searchFilter) throws TException {
|
50 |
public List<Ticket> getTickets(SearchFilter searchFilter) throws TException {
|
| 64 |
List<Ticket> ttickets = new ArrayList<Ticket>();
|
51 |
List<Ticket> ttickets = new ArrayList<Ticket>();
|
| 65 |
for (in.shop2020.crm.domain.Ticket ticket : ticketHandler
|
52 |
for (in.shop2020.crm.domain.Ticket ticket : ticketHandler
|