Subversion Repositories SmartDukaan

Rev

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

Rev 9238 Rev 9338
Line 12... Line 12...
12
import in.shop2020.logistics.PickupStore;
12
import in.shop2020.logistics.PickupStore;
13
import in.shop2020.logistics.Provider;
13
import in.shop2020.logistics.Provider;
14
import in.shop2020.model.v1.catalog.CatalogService;
14
import in.shop2020.model.v1.catalog.CatalogService;
15
import in.shop2020.model.v1.catalog.CatalogServiceException;
15
import in.shop2020.model.v1.catalog.CatalogServiceException;
16
import in.shop2020.model.v1.catalog.Item;
16
import in.shop2020.model.v1.catalog.Item;
-
 
17
import in.shop2020.model.v1.inventory.Warehouse;
17
import in.shop2020.model.v1.order.AmazonOrder;
18
import in.shop2020.model.v1.order.AmazonOrder;
18
import in.shop2020.model.v1.order.HotspotStore;
19
import in.shop2020.model.v1.order.HotspotStore;
19
import in.shop2020.model.v1.order.LineItem;
20
import in.shop2020.model.v1.order.LineItem;
20
import in.shop2020.model.v1.order.Order;
21
import in.shop2020.model.v1.order.Order;
21
import in.shop2020.model.v1.order.OrderSource;
22
import in.shop2020.model.v1.order.OrderSource;
Line 38... Line 39...
38
import in.shop2020.serving.services.FedExTrackingService;
39
import in.shop2020.serving.services.FedExTrackingService;
39
import in.shop2020.serving.services.RedExpressTrackingService;
40
import in.shop2020.serving.services.RedExpressTrackingService;
40
import in.shop2020.thrift.clients.CRMClient;
41
import in.shop2020.thrift.clients.CRMClient;
41
import in.shop2020.thrift.clients.CatalogClient;
42
import in.shop2020.thrift.clients.CatalogClient;
42
import in.shop2020.thrift.clients.HelperClient;
43
import in.shop2020.thrift.clients.HelperClient;
-
 
44
import in.shop2020.thrift.clients.InventoryClient;
43
import in.shop2020.thrift.clients.LogisticsClient;
45
import in.shop2020.thrift.clients.LogisticsClient;
44
import in.shop2020.thrift.clients.PaymentClient;
46
import in.shop2020.thrift.clients.PaymentClient;
45
import in.shop2020.thrift.clients.TransactionClient;
47
import in.shop2020.thrift.clients.TransactionClient;
46
import in.shop2020.thrift.clients.UserClient;
48
import in.shop2020.thrift.clients.UserClient;
47
import in.shop2020.thrift.clients.config.ConfigClient;
49
import in.shop2020.thrift.clients.config.ConfigClient;
Line 101... Line 103...
101
	private static Logger                  log                     = Logger.getLogger(Class.class);
103
	private static Logger                  log                     = Logger.getLogger(Class.class);
102
	private static BlueDartTrackingService blueDartTrackingService = new BlueDartTrackingService();
104
	private static BlueDartTrackingService blueDartTrackingService = new BlueDartTrackingService();
103
	private static AramexTrackingService aramexTrackingService     = new AramexTrackingService();
105
	private static AramexTrackingService aramexTrackingService     = new AramexTrackingService();
104
	private static DelhiveryTrackingService delhiveryTrackingService     = new DelhiveryTrackingService();
106
	private static DelhiveryTrackingService delhiveryTrackingService     = new DelhiveryTrackingService();
105
	private static RedExpressTrackingService redexpressTrackingService = new RedExpressTrackingService();
107
	private static RedExpressTrackingService redexpressTrackingService = new RedExpressTrackingService();
106
	//Start:- Added by Manish Sharma for fedex Integration- Shipment Tracking on 31-Jul-2013
-
 
107
	private static FedExTrackingService fedexTrackingService = new FedExTrackingService();
108
	private FedExTrackingService fedexTrackingService;
108
	//End:- Added by Manish Sharma for fedex Integration- Shipment Tracking on 31-Jul-2013
-
 
109
	
109
	
110
	private long                 orderId;
110
	private long                 orderId;
111
	private Order                order;
111
	private Order                order;
112
	private List<Payment>        payments;
112
	private List<Payment>        payments;
113
	private List<ShipmentUpdate> shipmentUpdates = new ArrayList<ShipmentUpdate>();
113
	private List<ShipmentUpdate> shipmentUpdates = new ArrayList<ShipmentUpdate>();
Line 209... Line 209...
209
			Map<Long, String> providerNameMap = new HashMap<Long, String>();
209
			Map<Long, String> providerNameMap = new HashMap<Long, String>();
210
			for(Provider provider : providerList){
210
			for(Provider provider : providerList){
211
				providerNameMap.put(provider.getId(), provider.getName());
211
				providerNameMap.put(provider.getId(), provider.getName());
212
			}*/
212
			}*/
213
			order = transactionServiceClient.getClient().getOrder(orderId);
213
			order = transactionServiceClient.getClient().getOrder(orderId);
-
 
214
			Warehouse warehouse = getWareHouseForOrder(order.getWarehouse_id());
-
 
215
			fedexTrackingService = new FedExTrackingService(warehouse.getLogisticsLocation());
214
			//Start:- Added by Manish Sharma for Displaying Logistics Provider Id and Amazon Order Id on 25-Jul-2013
216
			//Start:- Added by Manish Sharma for Displaying Logistics Provider Id and Amazon Order Id on 25-Jul-2013
215
			if(OrderSource.AMAZON == OrderSource.findByValue((int)order.getSource())){
217
			if(OrderSource.AMAZON == OrderSource.findByValue((int)order.getSource())){
216
				try {
218
				try {
217
				    amazonOrder = transactionServiceClient.getClient().getAmazonOrder(orderId);
219
				    amazonOrder = transactionServiceClient.getClient().getAmazonOrder(orderId);
218
				} catch (Exception e) {
220
				} catch (Exception e) {
Line 498... Line 500...
498
			sos.flush();
500
			sos.flush();
499
		} catch (IOException e) {
501
		} catch (IOException e) {
500
			System.out.println("Unable to stream the manifest file");
502
			System.out.println("Unable to stream the manifest file");
501
		}   
503
		}   
502
	}
504
	}
-
 
505
	
-
 
506
	public Warehouse getWareHouseForOrder(long warehouseId){
-
 
507
		Warehouse warehouse = null;
-
 
508
		try{
-
 
509
    		InventoryClient isc = new InventoryClient();
-
 
510
    		warehouse = isc.getClient().getWarehouse(warehouseId);
-
 
511
		} catch(Exception e) {
-
 
512
			log.error("Unable to get warehouse for id : " + warehouseId,e);
-
 
513
		    //TODO throw e;
-
 
514
		}
-
 
515
		return warehouse;
-
 
516
	}
503
 
517
 
504
	public void getOrderDeliveryMail() throws IOException, TException, ConfigException, TransactionServiceException {
518
	public void getOrderDeliveryMail() throws IOException, TException, ConfigException, TransactionServiceException {
505
		HelperClient helperClient = new HelperClient("helper_service_server","helper_service_server_port");
519
		HelperClient helperClient = new HelperClient("helper_service_server","helper_service_server_port");
506
		String mail = helperClient.getClient().getOrderDeliveryMail(orderId);
520
		String mail = helperClient.getClient().getOrderDeliveryMail(orderId);
507
		File file = new File("/tmp/temp");
521
		File file = new File("/tmp/temp");
Line 606... Line 620...
606
			TransactionClient transactionServiceClient = new TransactionClient();
620
			TransactionClient transactionServiceClient = new TransactionClient();
607
			in.shop2020.model.v1.order.TransactionService.Client transactionClient
621
			in.shop2020.model.v1.order.TransactionService.Client transactionClient
608
		    = transactionServiceClient.getClient();
622
		    = transactionServiceClient.getClient();
609
			transactionClient.changeShippingAddress(orderId, line1, line2, city, state, pin);
623
			transactionClient.changeShippingAddress(orderId, line1, line2, city, state, pin);
610
			in.shop2020.model.v1.order.Order t_order = transactionClient.getOrder(orderId);
624
			in.shop2020.model.v1.order.Order t_order = transactionClient.getOrder(orderId);
-
 
625
			Warehouse warehouse = getWareHouseForOrder(t_order.getWarehouse_id());			
611
			if(t_order.getLogistics_provider_id()==7L){
626
			if(t_order.getLogistics_provider_id()==7L){
612
				FedExShipAccountInfo fedexAccountInfo = FedExShipAccountInfo.getFedExInfo();
627
				FedExShipAccountInfo fedexAccountInfo = FedExShipAccountInfo.getFedExInfo(warehouse.getLogisticsLocation());
613
				ProcessShipmentReply  processShipmentReply = ShipWebServiceClient.getShipmentCreationReply(t_order,fedexAccountInfo.getClientDetail(),fedexAccountInfo.getWad(),fedexAccountInfo.getEndPointAddress());
628
				ProcessShipmentReply  processShipmentReply = ShipWebServiceClient.getShipmentCreationReply(t_order,fedexAccountInfo.getClientDetail(),fedexAccountInfo.getWad(),fedexAccountInfo.getEndPointAddress());
614
				CompletedShipmentDetail completedShipmentDetails = processShipmentReply.getCompletedShipmentDetail();
629
				CompletedShipmentDetail completedShipmentDetails = processShipmentReply.getCompletedShipmentDetail();
615
				CompletedPackageDetail completedPackageDetails =  completedShipmentDetails.getCompletedPackageDetails(0);
630
				CompletedPackageDetail completedPackageDetails =  completedShipmentDetails.getCompletedPackageDetails(0);
616
				TrackingId  trackId= completedPackageDetails.getTrackingIds(0);
631
				TrackingId  trackId= completedPackageDetails.getTrackingIds(0);
617
				t_order = transactionClient.updateOrderAWB(t_order.getId(), trackId.getTrackingNumber());
632
				t_order = transactionClient.updateOrderAWB(t_order.getId(), trackId.getTrackingNumber());