Subversion Repositories SmartDukaan

Rev

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

Rev 7700 Rev 7972
Line 101... Line 101...
101
            Client catalogClient = catalogServiceClient.getClient();
101
            Client catalogClient = catalogServiceClient.getClient();
102
 
102
 
103
            List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.getAllIgnoredInventoryUpdateItemsList(offset, limit);
103
            List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.getAllIgnoredInventoryUpdateItemsList(offset, limit);
104
 
104
 
105
            for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
105
            for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
106
                itemList.add(getItemFromThriftItem(thriftItem, null, null, null, null, null, null, null, null));
106
                itemList.add(getItemFromThriftItem(thriftItem, null, null, null, null, null, null, null, "", null));
107
            }
107
            }
108
        } catch (Exception e) {
108
        } catch (Exception e) {
109
            logger.error("Error while getting all items from the catalog service", e);
109
            logger.error("Error while getting all items from the catalog service", e);
110
        }
110
        }
111
        return itemList;
111
        return itemList;
Line 135... Line 135...
135
            Client catalogClient = catalogServiceClient.getClient();
135
            Client catalogClient = catalogServiceClient.getClient();
136
 
136
 
137
            List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.getAllItemsInRange(start, limit);
137
            List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.getAllItemsInRange(start, limit);
138
 
138
 
139
            for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
139
            for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
140
                itemList.add(getItemFromThriftItem(thriftItem, null, null, null, null, null, null, null, null));
140
                itemList.add(getItemFromThriftItem(thriftItem, null, null, null, null, null, null, null, "", null));
141
            }
141
            }
142
        } catch (Exception e) {
142
        } catch (Exception e) {
143
            logger.error("Error while getting all items from the catalog service", e);
143
            logger.error("Error while getting all items from the catalog service", e);
144
        }
144
        }
145
        return itemList;
145
        return itemList;
Line 175... Line 175...
175
            CatalogClient catalogServiceClient = new CatalogClient();
175
            CatalogClient catalogServiceClient = new CatalogClient();
176
            Client catalogClient = catalogServiceClient.getClient();
176
            Client catalogClient = catalogServiceClient.getClient();
177
 
177
 
178
            List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.getBestDeals();
178
            List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.getBestDeals();
179
            for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
179
            for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
180
                itemList.add(getItemFromThriftItem(thriftItem, null, null, null, null, null, null, null, null));
180
                itemList.add(getItemFromThriftItem(thriftItem, null, null, null, null, null, null, null, "", null));
181
            }
181
            }
182
        } catch(Exception e){
182
        } catch(Exception e){
183
            logger.error("Error while getting the best deals from the catalog service", e);
183
            logger.error("Error while getting the best deals from the catalog service", e);
184
        }
184
        }
185
        //Collections.sort(itemList, new ItemsComparator());
185
        //Collections.sort(itemList, new ItemsComparator());
Line 193... Line 193...
193
            CatalogClient catalogServiceClient = new CatalogClient();
193
            CatalogClient catalogServiceClient = new CatalogClient();
194
            Client catalogClient = catalogServiceClient.getClient();
194
            Client catalogClient = catalogServiceClient.getClient();
195
 
195
 
196
            List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.getItemsByRiskyFlag();
196
            List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.getItemsByRiskyFlag();
197
            for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
197
            for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
198
                itemList.add(getItemFromThriftItem(thriftItem, null, null, null, null, null, null, null, null));
198
                itemList.add(getItemFromThriftItem(thriftItem, null, null, null, null, null, null, null, "", null));
199
            }
199
            }
200
        } catch(Exception e){
200
        } catch(Exception e){
201
            logger.error("Error while getting the risky items from the catalog service", e);
201
            logger.error("Error while getting the risky items from the catalog service", e);
202
        }
202
        }
203
        Collections.sort(itemList, new ItemsComparator());
203
        Collections.sort(itemList, new ItemsComparator());
Line 211... Line 211...
211
            CatalogClient catalogServiceClient = new CatalogClient();
211
            CatalogClient catalogServiceClient = new CatalogClient();
212
            Client catalogClient = catalogServiceClient.getClient();
212
            Client catalogClient = catalogServiceClient.getClient();
213
 
213
 
214
            List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.getBestSellers();
214
            List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.getBestSellers();
215
            for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
215
            for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
216
                itemList.add(getItemFromThriftItem(thriftItem, null, null, null, null, null, null, null, null));
216
                itemList.add(getItemFromThriftItem(thriftItem, null, null, null, null, null, null, null, "", null));
217
            }
217
            }
218
        } catch(Exception e){
218
        } catch(Exception e){
219
            logger.error("Error while getting the best sellers from the catalog service", e);
219
            logger.error("Error while getting the best sellers from the catalog service", e);
220
        }
220
        }
221
        return itemList;        
221
        return itemList;        
Line 257... Line 257...
257
            Client catalogClient = catalogServiceClient.getClient();
257
            Client catalogClient = catalogServiceClient.getClient();
258
 
258
 
259
            List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.getLatestArrivals();
259
            List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.getLatestArrivals();
260
            for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
260
            for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
261
                //List<in.shop2020.model.v1.inventory.VendorItemPricing> vip = catalogClient.getAllItemPricing(thriftItem.getId());
261
                //List<in.shop2020.model.v1.inventory.VendorItemPricing> vip = catalogClient.getAllItemPricing(thriftItem.getId());
262
                itemList.add(getItemFromThriftItem(thriftItem, null, null, null, null, null, null, null, null));
262
                itemList.add(getItemFromThriftItem(thriftItem, null, null, null, null, null, null, null, "", null));
263
            }
263
            }
264
        } catch(Exception e){
264
        } catch(Exception e){
265
            logger.error("Error while getting the latest arrivals from the catalog service", e);
265
            logger.error("Error while getting the latest arrivals from the catalog service", e);
266
        }
266
        }
267
        return itemList;
267
        return itemList;
Line 275... Line 275...
275
            CatalogClient catalogServiceClient = new CatalogClient();
275
            CatalogClient catalogServiceClient = new CatalogClient();
276
            Client catalogClient = catalogServiceClient.getClient();
276
            Client catalogClient = catalogServiceClient.getClient();
277
 
277
 
278
            List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.searchItemsInRange(searchTerms, start, limit);
278
            List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.searchItemsInRange(searchTerms, start, limit);
279
            for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
279
            for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
280
                itemList.add(getItemFromThriftItem(thriftItem, null, null, null, null, null, null, null, null));
280
                itemList.add(getItemFromThriftItem(thriftItem, null, null, null, null, null, null, null, "",null));
281
            }
281
            }
282
        } catch(Exception e){
282
        } catch(Exception e){
283
            logger.error("Error while getting the search results from the catalog service", e);
283
            logger.error("Error while getting the search results from the catalog service", e);
284
        }
284
        }
285
        return itemList;
285
        return itemList;
Line 322... Line 322...
322
            List<in.shop2020.model.v1.inventory.VendorItemMapping> vim = inventoryClient.getVendorItemMappings(thriftItem.getId());
322
            List<in.shop2020.model.v1.inventory.VendorItemMapping> vim = inventoryClient.getVendorItemMappings(thriftItem.getId());
323
            List<in.shop2020.model.v1.catalog.SourceItemPricing> sip = catalogClient.getAllSourcePricing(thriftItem.getId());
323
            List<in.shop2020.model.v1.catalog.SourceItemPricing> sip = catalogClient.getAllSourcePricing(thriftItem.getId());
324
            List<in.shop2020.model.v1.catalog.Item> sit = catalogClient.getAllSimilarItems(thriftItem.getId());
324
            List<in.shop2020.model.v1.catalog.Item> sit = catalogClient.getAllSimilarItems(thriftItem.getId());
325
            in.shop2020.model.v1.inventory.ItemInventory itemInventory = inventoryClient.getItemInventoryByItemId(thriftItem.getId());
325
            in.shop2020.model.v1.inventory.ItemInventory itemInventory = inventoryClient.getItemInventoryByItemId(thriftItem.getId());
326
            ItemStockPurchaseParams stockPurchaseParams = inventoryClient.getItemStockPurchaseParams(thriftItem.getId());
326
            ItemStockPurchaseParams stockPurchaseParams = inventoryClient.getItemStockPurchaseParams(thriftItem.getId());
-
 
327
            String lastNdaySale = inventoryClient.getLastNdaySaleForItem(thriftItem.getId(), 5);
327
            Long freebieItemId = catalogClient.getFreebieForItem(thriftItem.getId());
328
            Long freebieItemId = catalogClient.getFreebieForItem(thriftItem.getId());
328
            List<in.shop2020.model.v1.catalog.VoucherItemMapping> tvouchers = catalogClient.getAllItemVouchers(thriftItem.getId());
329
            List<in.shop2020.model.v1.catalog.VoucherItemMapping> tvouchers = catalogClient.getAllItemVouchers(thriftItem.getId());
329
            Item it = getItemFromThriftItem(thriftItem, vip, vim, sip, sit, itemInventory, tvouchers, stockPurchaseParams, freebieItemId);
330
            Item it = getItemFromThriftItem(thriftItem, vip, vim, sip, sit, itemInventory, tvouchers, stockPurchaseParams, lastNdaySale, freebieItemId);
330
            it.setSameItemsWithDifferentColors(sameItemsWithDifferentColors);
331
            it.setSameItemsWithDifferentColors(sameItemsWithDifferentColors);
331
            return it;
332
            return it;
332
        }catch(Exception e){
333
        }catch(Exception e){
333
            logger.error("Error while getting the item from the catalog service", e);
334
            logger.error("Error while getting the item from the catalog service", e);
334
        }
335
        }
Line 802... Line 803...
802
            
803
            
803
            for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
804
            for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
804
                List<in.shop2020.model.v1.inventory.VendorItemPricing> vip = inventoryClient.getAllItemPricing(thriftItem.getId());
805
                List<in.shop2020.model.v1.inventory.VendorItemPricing> vip = inventoryClient.getAllItemPricing(thriftItem.getId());
805
                List<in.shop2020.model.v1.inventory.VendorItemMapping> vim = inventoryClient.getVendorItemMappings(thriftItem.getId());
806
                List<in.shop2020.model.v1.inventory.VendorItemMapping> vim = inventoryClient.getVendorItemMappings(thriftItem.getId());
806
                List<in.shop2020.model.v1.catalog.SourceItemPricing> sip = catalogClient.getAllSourcePricing(thriftItem.getId());
807
                List<in.shop2020.model.v1.catalog.SourceItemPricing> sip = catalogClient.getAllSourcePricing(thriftItem.getId());
807
                itemList.add(getItemFromThriftItem(thriftItem, vip, vim, sip, null, null, null, null, null));
808
                itemList.add(getItemFromThriftItem(thriftItem, vip, vim, sip, null, null, null, null, "", null));
808
            }
809
            }
809
        } catch (Exception e) {
810
        } catch (Exception e) {
810
            logger.error("Error while getting items by category: " + category, e);
811
            logger.error("Error while getting items by category: " + category, e);
811
        }
812
        }
812
        Collections.sort(itemList, new ItemsComparator());
813
        Collections.sort(itemList, new ItemsComparator());
Line 832... Line 833...
832
                
833
                
833
    			in.shop2020.model.v1.catalog.Item thriftItem = catalogClient.getItem(itemId);
834
    			in.shop2020.model.v1.catalog.Item thriftItem = catalogClient.getItem(itemId);
834
				List<in.shop2020.model.v1.inventory.VendorItemPricing> vip = inventoryClient.getAllItemPricing(thriftItem.getId());
835
				List<in.shop2020.model.v1.inventory.VendorItemPricing> vip = inventoryClient.getAllItemPricing(thriftItem.getId());
835
				List<in.shop2020.model.v1.inventory.VendorItemMapping> vim = inventoryClient.getVendorItemMappings(thriftItem.getId());
836
				List<in.shop2020.model.v1.inventory.VendorItemMapping> vim = inventoryClient.getVendorItemMappings(thriftItem.getId());
836
				List<in.shop2020.model.v1.catalog.SourceItemPricing> sip = catalogClient.getAllSourcePricing(thriftItem.getId());
837
				List<in.shop2020.model.v1.catalog.SourceItemPricing> sip = catalogClient.getAllSourcePricing(thriftItem.getId());
837
				items.add(getItemFromThriftItem(thriftItem, vip, vim, sip, null, null, null, null, null));
838
				items.add(getItemFromThriftItem(thriftItem, vip, vim, sip, null, null, null, null, "", null));
838
    		} catch (Exception e) {
839
    		} catch (Exception e) {
839
    			logger.error("Could not fetch item for : " + itemId, e);
840
    			logger.error("Could not fetch item for : " + itemId, e);
840
    			return "Could not push to production. No item got pushed.";
841
    			return "Could not push to production. No item got pushed.";
841
    		}
842
    		}
842
    	}
843
    	}
Line 968... Line 969...
968
            Client catalogClient = catalogServiceClient.getClient();
969
            Client catalogClient = catalogServiceClient.getClient();
969
 
970
 
970
            List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.getAllItemsByStatusInRange(st, start, limit);
971
            List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.getAllItemsByStatusInRange(st, start, limit);
971
 
972
 
972
            for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
973
            for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
973
                itemList.add(getItemFromThriftItem(thriftItem, null, null, null, null, null, null, null, null));
974
                itemList.add(getItemFromThriftItem(thriftItem, null, null, null, null, null, null, null, "", null));
974
            }
975
            }
975
        } catch (Exception e) {
976
        } catch (Exception e) {
976
            logger.error("Error while getting items by status: " + st, e);
977
            logger.error("Error while getting items by status: " + st, e);
977
        }
978
        }
978
        return itemList;
979
        return itemList;
Line 996... Line 997...
996
            List<in.shop2020.model.v1.inventory.VendorItemMapping> tVendorMappings,
997
            List<in.shop2020.model.v1.inventory.VendorItemMapping> tVendorMappings,
997
            List<in.shop2020.model.v1.catalog.SourceItemPricing> tSourceMappings,
998
            List<in.shop2020.model.v1.catalog.SourceItemPricing> tSourceMappings,
998
            List<in.shop2020.model.v1.catalog.Item> tSimilarItems, 
999
            List<in.shop2020.model.v1.catalog.Item> tSimilarItems, 
999
            in.shop2020.model.v1.inventory.ItemInventory tItemInventory, 
1000
            in.shop2020.model.v1.inventory.ItemInventory tItemInventory, 
1000
            List<in.shop2020.model.v1.catalog.VoucherItemMapping> tVoucherMappings, 
1001
            List<in.shop2020.model.v1.catalog.VoucherItemMapping> tVoucherMappings, 
1001
            ItemStockPurchaseParams tStockPurchaseParams, Long freebieItemId){
1002
            ItemStockPurchaseParams tStockPurchaseParams, String lastNdaySale, Long freebieItemId){
1002
 
1003
 
1003
        Map<String, VendorItemMapping> vItemMap = new HashMap<String, VendorItemMapping>();
1004
        Map<String, VendorItemMapping> vItemMap = new HashMap<String, VendorItemMapping>();
1004
        VendorItemMapping vItemMapping;
1005
        VendorItemMapping vItemMapping;
1005
        if(tVendorMappings != null) {
1006
        if(tVendorMappings != null) {
1006
            for(in.shop2020.model.v1.inventory.VendorItemMapping vim : tVendorMappings) {
1007
            for(in.shop2020.model.v1.inventory.VendorItemMapping vim : tVendorMappings) {
Line 1127... Line 1128...
1127
                itemInventoryMap,
1128
                itemInventoryMap,
1128
                vendorPricingMap,
1129
                vendorPricingMap,
1129
                vItemMap,
1130
                vItemMap,
1130
                sourcePricingMap,
1131
                sourcePricingMap,
1131
                SimilarItemslist,
1132
                SimilarItemslist,
-
 
1133
                voucherMap, 
1132
                voucherMap, stockPurchaseParams.getNumOfDaysStock(), 
1134
                stockPurchaseParams.getNumOfDaysStock(), 
1133
                stockPurchaseParams.getMinStockLevel(), freebieItemId,
1135
                stockPurchaseParams.getMinStockLevel(), 
-
 
1136
                lastNdaySale, 
-
 
1137
                freebieItemId,
1134
                thriftItem.getAsin(),
1138
                thriftItem.getAsin(),
1135
                thriftItem.getHoldInventory(),
1139
                thriftItem.getHoldInventory(),
1136
                thriftItem.getDefaultInventory());
1140
                thriftItem.getDefaultInventory());
1137
        return item;
1141
        return item;
1138
    }
1142
    }
Line 1191... Line 1195...
1191
		try{
1195
		try{
1192
            CatalogClient catalogServiceClient = new CatalogClient();
1196
            CatalogClient catalogServiceClient = new CatalogClient();
1193
            Client catalogClient = catalogServiceClient.getClient();
1197
            Client catalogClient = catalogServiceClient.getClient();
1194
            in.shop2020.model.v1.catalog.Item thriftItem = catalogClient.addSimilarItem(itemId, catalogItemId);;
1198
            in.shop2020.model.v1.catalog.Item thriftItem = catalogClient.addSimilarItem(itemId, catalogItemId);;
1195
 
1199
 
1196
            return getItemFromThriftItem(thriftItem, null, null, null, null, null, null, null, null);
1200
            return getItemFromThriftItem(thriftItem, null, null, null, null, null, null, null, "", null);
1197
        }catch(Exception e){
1201
        }catch(Exception e){
1198
            logger.error("Error while adding the SimilarItems for: " + itemId, e);
1202
            logger.error("Error while adding the SimilarItems for: " + itemId, e);
1199
        }
1203
        }
1200
        return null;
1204
        return null;
1201
	}
1205
	}