Subversion Repositories SmartDukaan

Rev

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

Rev 5945 Rev 5959
Line 1... Line 1...
1
package in.shop2020.support.controllers;
1
package in.shop2020.support.controllers;
2
 
2
 
-
 
3
import in.shop2020.model.v1.catalog.Item;
3
import in.shop2020.model.v1.inventory.InventoryService.Client;
4
import in.shop2020.model.v1.inventory.InventoryService.Client;
4
import in.shop2020.model.v1.inventory.InventoryServiceException;
5
import in.shop2020.model.v1.inventory.InventoryServiceException;
5
import in.shop2020.model.v1.catalog.Item;
-
 
6
import in.shop2020.model.v1.inventory.ItemInventory;
6
import in.shop2020.model.v1.inventory.ItemInventory;
7
import in.shop2020.model.v1.inventory.VendorItemMapping;
7
import in.shop2020.model.v1.inventory.VendorItemMapping;
8
import in.shop2020.model.v1.inventory.Warehouse;
8
import in.shop2020.model.v1.inventory.Warehouse;
9
import in.shop2020.support.models.BillingUpdate;
9
import in.shop2020.support.models.BillingUpdate;
10
import in.shop2020.support.models.InventoryUpdate;
10
import in.shop2020.support.models.InventoryUpdate;
11
import in.shop2020.support.models.PLBDetails;
11
import in.shop2020.support.models.PLBDetails;
12
import in.shop2020.support.models.Update;
12
import in.shop2020.support.models.Update;
13
import in.shop2020.thrift.clients.CatalogClient;
13
import in.shop2020.thrift.clients.CatalogClient;
14
import in.shop2020.thrift.clients.InventoryClient;
14
import in.shop2020.thrift.clients.InventoryClient;
15
import in.shop2020.thrift.clients.TransactionClient;
15
import in.shop2020.thrift.clients.TransactionClient;
16
import in.shop2020.utils.ConfigClientKeys;
-
 
17
import in.shop2020.utils.GmailUtils;
16
import in.shop2020.utils.GmailUtils;
18
 
17
 
19
import java.io.BufferedWriter;
18
import java.io.BufferedWriter;
20
import java.io.File;
19
import java.io.File;
21
import java.io.FileWriter;
20
import java.io.FileWriter;
Line 178... Line 177...
178
		try {
177
		try {
179
		    //The snapshot client is used to update the inventory snapshot for production systems.
178
		    //The snapshot client is used to update the inventory snapshot for production systems.
180
		    InventoryClient snapshotCatalogServiceClient = new InventoryClient();
179
		    InventoryClient snapshotCatalogServiceClient = new InventoryClient();
181
			Client snapshotClient = snapshotCatalogServiceClient.getClient();
180
			Client snapshotClient = snapshotCatalogServiceClient.getClient();
182
 
181
 
183
	         //The history client is used to update the inventory history on the processing system.
-
 
184
            InventoryClient historyInventoryServiceClient = new InventoryClient(
-
 
185
                    ConfigClientKeys.inventory_history_service_server_host.toString(),
-
 
186
                    ConfigClientKeys.inventory_history_service_server_port.toString());
-
 
187
			Client historyClient = historyInventoryServiceClient.getClient();
-
 
188
 
-
 
189
			Client stagingCatalogClient = new InventoryClient(ConfigClientKeys.catalog_service_server_host_prod.toString(),
-
 
190
                    ConfigClientKeys.catalog_service_server_port.toString()).getClient();
-
 
191
 
-
 
192
		    //The snapshot client is used to update the inventory snapshot for production systems.
182
		    //The snapshot client is used to update the inventory snapshot for production systems.
193
		    TransactionClient transactionClient = new TransactionClient();
183
		    TransactionClient transactionClient = new TransactionClient();
194
			in.shop2020.model.v1.order.TransactionService.Client tClient = transactionClient.getClient();
184
			in.shop2020.model.v1.order.TransactionService.Client tClient = transactionClient.getClient();
195
 
185
 
196
			Long warehouseId = Long.parseLong(inventoryUpdate.getwarehouseId());
186
			Long warehouseId = Long.parseLong(inventoryUpdate.getwarehouseId());
Line 208... Line 198...
208
	            }			    
198
	            }			    
209
			}
199
			}
210
 
200
 
211
			//Update the snapshot before the history since that is more important.
201
			//Update the snapshot before the history since that is more important.
212
			snapshotClient.updateInventory(warehouseId, timestamp, availability);
202
			snapshotClient.updateInventory(warehouseId, timestamp, availability);
213
			stagingCatalogClient.updateVendorString(warehouseId, timestamp);
-
 
214
			historyClient.updateInventoryHistory(warehouseId, timestamp, availability);
203
			snapshotClient.updateInventoryHistory(warehouseId, timestamp, availability);
215
			
204
			
216
			List<BillingUpdate> billingUpdates = inventoryUpdate.getBillingUpdates();
205
			List<BillingUpdate> billingUpdates = inventoryUpdate.getBillingUpdates();
217
			if(billingUpdates!=null){
206
			if(billingUpdates!=null){
218
				for(BillingUpdate billingUpdate: billingUpdates){
207
				for(BillingUpdate billingUpdate: billingUpdates){
219
					tClient.addInvoiceNumber(Long.parseLong(billingUpdate.getOrderId()), billingUpdate.getInvoiceNumber(), billingUpdate.getColor());
208
					tClient.addInvoiceNumber(Long.parseLong(billingUpdate.getOrderId()), billingUpdate.getInvoiceNumber(), billingUpdate.getColor());