Subversion Repositories SmartDukaan

Rev

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

Rev 10153 Rev 10154
Line 79... Line 79...
79
				"khushal.bhatia@shop2020.in","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
79
				"khushal.bhatia@shop2020.in","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
80
				"yukti.jain@shop2020.in","manoj.pal@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in","amar.kumar@shop2020.in"};
80
				"yukti.jain@shop2020.in","manoj.pal@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in","amar.kumar@shop2020.in"};
81
		List<String> flipkartorderids = null;
81
		List<String> flipkartorderids = null;
82
		Client catalogServiceClient = null;
82
		Client catalogServiceClient = null;
83
		try {
83
		try {
84
			catalogServiceClient = new CatalogClient().getClient();
84
			catalogServiceClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
85
		} catch (TTransportException e) {
85
		} catch (TTransportException e) {
86
			e.printStackTrace();
86
			e.printStackTrace();
87
		}
87
		}
88
		try {
88
		try {
89
			flipkartItems = catalogServiceClient.getAllFlipkartItems();
89
			flipkartItems = catalogServiceClient.getAllFlipkartItems();
Line 110... Line 110...
110
			e1.printStackTrace();
110
			e1.printStackTrace();
111
		} catch (IOException e1) {
111
		} catch (IOException e1) {
112
			e1.printStackTrace();
112
			e1.printStackTrace();
113
		}
113
		}
114
		try {
114
		try {
115
			transactionClient = new TransactionClient("support_transaction_service_server_host","transaction_service_server_port").getClient();
115
			transactionClient = new TransactionClient().getClient();
116
			if(flipkartorderids!=null && flipkartorderids.size()>0){
116
			if(flipkartorderids!=null && flipkartorderids.size()>0){
117
				itemIdOrdersMap = transactionClient.getCreatedOrdersForFlipkart(flipkartorderids);
117
				itemIdOrdersMap = transactionClient.getCreatedOrdersForFlipkart(flipkartorderids);
118
			}
118
			}
119
		} catch (TTransportException e) {
119
		} catch (TTransportException e) {
120
			try {
120
			try {
121
				itemIdOrdersMap = transactionClient.getCreatedOrdersForFlipkart(flipkartorderids);
121
				itemIdOrdersMap = transactionClient.getCreatedOrdersForFlipkart(flipkartorderids);
122
			} catch (TException e1) {
122
			} catch (TException e1) {
123
				e1.printStackTrace();
123
				e1.printStackTrace();
124
			}
124
			}
125
			//e.printStackTrace();
-
 
126
		}catch (TException e) {
125
		}catch (TException e) {
127
			e.printStackTrace();
126
			e.printStackTrace();
128
		}
127
		}
129
		in.shop2020.model.v1.inventory.InventoryService.Client inventoryServiceClient = null;
128
		in.shop2020.model.v1.inventory.InventoryService.Client inventoryServiceClient = null;
130
		try {
129
		try {
131
			inventoryServiceClient = new InventoryClient("inventory_service_server_host","inventory_service_server_port").getClient();
130
			inventoryServiceClient = new InventoryClient().getClient();
132
		} catch (TTransportException e) {
131
		} catch (TTransportException e) {
133
			e.printStackTrace();
132
			e.printStackTrace();
134
		}
133
		}
135
		try {
134
		try {
136
			List<FlipkartInventorySnapshot> updatedFlipkartInventoryList = inventoryServiceClient.getFlipkartInventorySnapshot();
135
			List<FlipkartInventorySnapshot> updatedFlipkartInventoryList = inventoryServiceClient.getFlipkartInventorySnapshot();
Line 164... Line 163...
164
		//System.out.println("JSON request  " + jsonRequest);
163
		//System.out.println("JSON request  " + jsonRequest);
165
		LogisticsClient logisticsServiceClient;
164
		LogisticsClient logisticsServiceClient;
166
		in.shop2020.logistics.LogisticsService.Client logisticsClient=null;
165
		in.shop2020.logistics.LogisticsService.Client logisticsClient=null;
167
		LogisticsInfo logisticinfo = null;
166
		LogisticsInfo logisticinfo = null;
168
		try {
167
		try {
169
			logisticsServiceClient = new LogisticsClient("logistics_service_prod_server_host","logistics_service_prod_server_port");
168
			logisticsServiceClient = new LogisticsClient();
170
			logisticsClient = logisticsServiceClient.getClient();
169
			logisticsClient = logisticsServiceClient.getClient();
171
 
170
 
172
		} catch (TTransportException e) {
171
		} catch (TTransportException e) {
173
			e.printStackTrace();
172
			e.printStackTrace();
174
		}
173
		}
Line 259... Line 258...
259
			} catch (LogisticsServiceException e) {
258
			} catch (LogisticsServiceException e) {
260
				e.printStackTrace();
259
				e.printStackTrace();
261
				continue;
260
				continue;
262
			}
261
			}
263
			catch (TTransportException e) {
262
			catch (TTransportException e) {
264
				logisticsServiceClient = new LogisticsClient("logistics_service_prod_server_host","logistics_service_prod_server_port");
263
				logisticsServiceClient = new LogisticsClient();
265
				logisticsClient = logisticsServiceClient.getClient();
264
				logisticsClient = logisticsServiceClient.getClient();
266
			} 
265
			} 
267
			System.out.println("sku at flipkart " + entry.getValue().getSkuAtflipkart());
266
			System.out.println("sku at flipkart " + entry.getValue().getSkuAtflipkart());
268
			System.out.println("shipping time " + logisticinfo.getShippingTime());
267
			System.out.println("shipping time " + logisticinfo.getShippingTime());
269
			System.out.println("stock " + stock);
268
			System.out.println("stock " + stock);
Line 355... Line 354...
355
				in.shop2020.model.v1.inventory.InventoryService.Client inventoryServiceClient;
354
				in.shop2020.model.v1.inventory.InventoryService.Client inventoryServiceClient;
356
				try {
355
				try {
357
					while ((line = rd.readLine()) != null) {
356
					while ((line = rd.readLine()) != null) {
358
						System.out.println("Response " + line);
357
						System.out.println("Response " + line);
359
						if(line.equalsIgnoreCase("{\"status\":\"success\"}")){
358
						if(line.equalsIgnoreCase("{\"status\":\"success\"}")){
360
							inventoryServiceClient = new InventoryClient("inventory_service_server_host","inventory_service_server_port").getClient();
359
							inventoryServiceClient = new InventoryClient().getClient();
361
							inventoryServiceClient.addOrUpdateFlipkartInventorySnapshot(inventorysnapshotlist);
360
							inventoryServiceClient.addOrUpdateFlipkartInventorySnapshot(inventorysnapshotlist);
362
							inventorysnapshotlist = new ArrayList<FlipkartInventorySnapshot>();
361
							inventorysnapshotlist = new ArrayList<FlipkartInventorySnapshot>();
363
						}
362
						}
364
						else{
363
						else{
365
							feedResponse.append(line);
364
							feedResponse.append(line);
Line 414... Line 413...
414
 
413
 
415
	private static void calculateinventory(){
414
	private static void calculateinventory(){
416
		CatalogClient catalogServiceClient = null;
415
		CatalogClient catalogServiceClient = null;
417
		Map<Long,ItemInventory> availability= new HashMap<Long,ItemInventory>();
416
		Map<Long,ItemInventory> availability= new HashMap<Long,ItemInventory>();
418
		try {
417
		try {
419
			catalogServiceClient = new CatalogClient();
418
			catalogServiceClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port");
420
		} catch (TTransportException e) {
419
		} catch (TTransportException e) {
421
			e.printStackTrace();
420
			e.printStackTrace();
422
		}
421
		}
423
		in.shop2020.model.v1.catalog.CatalogService.Client catalogClient = catalogServiceClient.getClient();
422
		in.shop2020.model.v1.catalog.CatalogService.Client catalogClient = catalogServiceClient.getClient();
424
		try {
423
		try {