Subversion Repositories SmartDukaan

Rev

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

Rev 5554 Rev 5945
Line 1... Line 1...
1
package in.shop2020.support.services;
1
package in.shop2020.support.services;
2
 
2
 
3
import in.shop2020.logistics.DeliveryType;
3
import in.shop2020.logistics.DeliveryType;
4
import in.shop2020.logistics.LogisticsServiceException;
4
import in.shop2020.logistics.LogisticsServiceException;
5
import in.shop2020.logistics.Provider;
5
import in.shop2020.logistics.Provider;
6
import in.shop2020.model.v1.catalog.InventoryServiceException;
6
import in.shop2020.model.v1.inventory.InventoryServiceException;
7
import in.shop2020.model.v1.catalog.Warehouse;
7
import in.shop2020.model.v1.inventory.Warehouse;
8
import in.shop2020.model.v1.order.LineItem;
8
import in.shop2020.model.v1.order.LineItem;
9
import in.shop2020.model.v1.order.Order;
9
import in.shop2020.model.v1.order.Order;
10
import in.shop2020.model.v1.order.OrderStatus;
10
import in.shop2020.model.v1.order.OrderStatus;
11
import in.shop2020.model.v1.order.TransactionServiceException;
11
import in.shop2020.model.v1.order.TransactionServiceException;
12
import in.shop2020.thrift.clients.CatalogClient;
12
import in.shop2020.thrift.clients.InventoryClient;
13
import in.shop2020.thrift.clients.LogisticsClient;
13
import in.shop2020.thrift.clients.LogisticsClient;
14
import in.shop2020.thrift.clients.TransactionClient;
14
import in.shop2020.thrift.clients.TransactionClient;
15
 
15
 
16
import java.io.ByteArrayOutputStream;
16
import java.io.ByteArrayOutputStream;
17
import java.io.FileNotFoundException;
17
import java.io.FileNotFoundException;
Line 34... Line 34...
34
 
34
 
35
public class CourierDetailsGenerator {
35
public class CourierDetailsGenerator {
36
    private static Logger logger = LoggerFactory.getLogger(CourierDetailsGenerator.class);
36
    private static Logger logger = LoggerFactory.getLogger(CourierDetailsGenerator.class);
37
    
37
    
38
	private TransactionClient tsc = null;
38
	private TransactionClient tsc = null;
39
	private CatalogClient csc = null;
39
	private InventoryClient isc = null;
40
	private LogisticsClient lsc = null;
40
	private LogisticsClient lsc = null;
41
	
41
	
42
	public CourierDetailsGenerator(){
42
	public CourierDetailsGenerator(){
43
		try {
43
		try {
44
			tsc = new TransactionClient();
44
			tsc = new TransactionClient();
45
			csc = new CatalogClient();
45
			isc = new InventoryClient();
46
			lsc = new LogisticsClient();
46
			lsc = new LogisticsClient();
47
		} catch (Exception e) {
47
		} catch (Exception e) {
48
			logger.error("Error while initializing one of the thrift clients", e);
48
			logger.error("Error while initializing one of the thrift clients", e);
49
		}
49
		}
50
	}
50
	}
51
	
51
	
52
	public ByteArrayOutputStream generateCourierDetails(long warehouseId, long providerId, boolean isCod){
52
	public ByteArrayOutputStream generateCourierDetails(long warehouseId, long providerId, boolean isCod){
53
		ByteArrayOutputStream baosXLS = new ByteArrayOutputStream();
53
		ByteArrayOutputStream baosXLS = new ByteArrayOutputStream();
54
		in.shop2020.model.v1.order.TransactionService.Client txnClient = tsc.getClient();
54
		in.shop2020.model.v1.order.TransactionService.Client txnClient = tsc.getClient();
55
		in.shop2020.model.v1.catalog.InventoryService.Client inventoryClient = csc.getClient();
55
		in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = isc.getClient();
56
		in.shop2020.logistics.LogisticsService.Client logisticsClient = lsc.getClient();
56
		in.shop2020.logistics.LogisticsService.Client logisticsClient = lsc.getClient();
57
		
57
		
58
		List<Order> orders = null;
58
		List<Order> orders = null;
59
		Warehouse warehouse = null;
59
		Warehouse warehouse = null;
60
		Provider provider = null;
60
		Provider provider = null;