Subversion Repositories SmartDukaan

Rev

Rev 4241 | Rev 4490 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4241 Rev 4416
Line 20... Line 20...
20
import in.shop2020.thrift.clients.TransactionClient;
20
import in.shop2020.thrift.clients.TransactionClient;
21
import in.shop2020.thrift.clients.UserClient;
21
import in.shop2020.thrift.clients.UserClient;
22
import in.shop2020.utils.ModelUtils;
22
import in.shop2020.utils.ModelUtils;
23
 
23
 
24
import java.util.ArrayList;
24
import java.util.ArrayList;
-
 
25
import java.util.Collections;
25
import java.util.List;
26
import java.util.List;
-
 
27
import java.util.concurrent.Callable;
-
 
28
import java.util.concurrent.Executors;
-
 
29
import java.util.concurrent.TimeUnit;
26
 
30
 
27
import org.apache.log4j.Logger;
31
import org.apache.log4j.Logger;
28
import org.apache.thrift.TException;
32
import org.apache.thrift.TException;
29
import org.apache.thrift.transport.TTransportException;
33
import org.apache.thrift.transport.TTransportException;
30
 
34
 
Line 38... Line 42...
38
    private static BlueDartTrackingService blueDartTrackingService = new BlueDartTrackingService();
42
    private static BlueDartTrackingService blueDartTrackingService = new BlueDartTrackingService();
39
 
43
 
40
    private long                 orderId;
44
    private long                 orderId;
41
    private Order                order;
45
    private Order                order;
42
    private List<Payment>        payments;
46
    private List<Payment>        payments;
43
    private List<ShipmentUpdate> shipmentUpdates;
47
    private List<ShipmentUpdate> shipmentUpdates = new ArrayList<ShipmentUpdate>();
44
    private Long                 codTicketId;
48
    private Long                 codTicketId;
45
    private List<Address>        addresses;
49
    private List<Address>        addresses;
46
 
50
 
47
    public UserOrderInfoController() {
51
    public UserOrderInfoController() {
48
        super();
52
        super();
Line 60... Line 64...
60
        }
64
        }
61
 
65
 
62
        payments = paymentServiceClient.getClient()
66
        payments = paymentServiceClient.getClient()
63
                .getPaymentForTxnId(order.getTransactionId());
67
                .getPaymentForTxnId(order.getTransactionId());
64
 
68
 
-
 
69
 
-
 
70
        // Spawning a thread to capture shipment updates from Bluedart
-
 
71
        // This is done to ensure that response from Crm web app is sent
-
 
72
        // within given time limits. Also, we wont be affected in the cases 
-
 
73
        // where bluedart site is down or slow
-
 
74
        Executors.newSingleThreadExecutor().invokeAll(Collections.singletonList(new Callable<Boolean>() {
-
 
75
            @Override
-
 
76
            public Boolean call() throws Exception {
65
        shipmentUpdates = blueDartTrackingService.getUpdates(order
77
                shipmentUpdates = blueDartTrackingService.getUpdates(order.getAirwaybill_no());
66
                .getAirwaybill_no());
78
                return true;
-
 
79
            }
-
 
80
        }), 5, TimeUnit.SECONDS);
67
 
81
 
68
        if (order.isCod() && OrderStatus.INIT.equals(order.getStatus())) {
82
        if (order.isCod() && OrderStatus.INIT.equals(order.getStatus())) {
69
            populateCODTicketId(order.getCustomer_id());
83
            populateCODTicketId(order.getCustomer_id());
70
        }
84
        }
71
 
85