Subversion Repositories SmartDukaan

Rev

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

Rev 5946 Rev 6096
Line 10... Line 10...
10
import in.shop2020.catalog.dashboard.shared.VendorPricings;
10
import in.shop2020.catalog.dashboard.shared.VendorPricings;
11
import in.shop2020.catalog.dashboard.shared.VoucherItemMapping;
11
import in.shop2020.catalog.dashboard.shared.VoucherItemMapping;
12
import in.shop2020.config.ConfigException;
12
import in.shop2020.config.ConfigException;
13
import in.shop2020.content.ContentService;
13
import in.shop2020.content.ContentService;
14
import in.shop2020.content.ContentServiceException;
14
import in.shop2020.content.ContentServiceException;
15
import in.shop2020.model.v1.inventory.InventoryService;
-
 
16
import in.shop2020.model.v1.catalog.CatalogService.Client;
15
import in.shop2020.model.v1.catalog.CatalogService.Client;
17
import in.shop2020.model.v1.catalog.ItemType;
16
import in.shop2020.model.v1.catalog.ItemType;
18
import in.shop2020.model.v1.catalog.status;
17
import in.shop2020.model.v1.catalog.status;
-
 
18
import in.shop2020.model.v1.inventory.InventoryService;
19
import in.shop2020.model.v1.user.VoucherType;
19
import in.shop2020.model.v1.user.VoucherType;
20
import in.shop2020.thrift.clients.CatalogClient;
20
import in.shop2020.thrift.clients.CatalogClient;
21
import in.shop2020.thrift.clients.ContentClient;
21
import in.shop2020.thrift.clients.ContentClient;
22
import in.shop2020.thrift.clients.InventoryClient;
22
import in.shop2020.thrift.clients.InventoryClient;
23
import in.shop2020.thrift.clients.config.ConfigClient;
23
import in.shop2020.thrift.clients.config.ConfigClient;
Line 1192... Line 1192...
1192
            logger.error("Error while checking for a Catalog Item Id: ", e);
1192
            logger.error("Error while checking for a Catalog Item Id: ", e);
1193
        }
1193
        }
1194
		return false;
1194
		return false;
1195
	}
1195
	}
1196
 
1196
 
-
 
1197
	@Override
-
 
1198
	public String updateExpectedDelayOnProd(Item item) {
-
 
1199
		try{
-
 
1200
            CatalogClient catalogServiceClient_Prod = new CatalogClient( 
-
 
1201
                    ConfigClientKeys.catalog_service_server_host_prod.toString(),
-
 
1202
                    ConfigClientKeys.catalog_service_server_port.toString());
-
 
1203
            
-
 
1204
            Client catalogClient_Prod = catalogServiceClient_Prod.getClient();
-
 
1205
 
-
 
1206
            InventoryClient inventoryServiceClient= new InventoryClient();
-
 
1207
            
-
 
1208
            InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
-
 
1209
 
-
 
1210
            in.shop2020.model.v1.catalog.Item tItem = catalogClient_Prod.getItem(item.getId());
-
 
1211
            if(item.getExpectedDelay() != null) {
-
 
1212
            	tItem.setExpectedDelay(item.getExpectedDelay());
-
 
1213
            
-
 
1214
	            long rItemId;
-
 
1215
	            if((rItemId = catalogClient_Prod.updateItem(tItem)) != item.getId()) {
-
 
1216
	                logger.error("Error updating item on production, returned Item Id: " + rItemId);
-
 
1217
	                return "Error updating expected delay on production";
-
 
1218
	            }
-
 
1219
	            inventoryClient.clearItemAvailabilityCacheForItem(rItemId);
-
 
1220
	            logger.info("Successfully updated item: " + item.getId());
-
 
1221
	            return "Expected delay successfully updated on prod"; 
-
 
1222
            } else {
-
 
1223
            	return "Error:expected delay should not be null";
-
 
1224
            }
-
 
1225
        } catch (Exception e) {
-
 
1226
            logger.error("Error while updating prices on production", e);
-
 
1227
            return "Error while updating all prices on production. Some of the prices may not have been  updated";
-
 
1228
        }
-
 
1229
	}
-
 
1230
 
-
 
1231
 
-
 
1232
	
-
 
1233
		
-
 
1234
 
1197
}
1235
}
1198
1236