| Line 1... |
Line 1... |
| 1 |
package in.shop2020.catalog.dashboard.server;
|
1 |
package in.shop2020.catalog.dashboard.server;
|
| 2 |
|
2 |
|
| 3 |
import in.shop2020.catalog.dashboard.client.CatalogService;
|
3 |
import in.shop2020.catalog.dashboard.client.CatalogService;
|
| 4 |
import in.shop2020.catalog.dashboard.shared.Item;
|
4 |
import in.shop2020.catalog.dashboard.shared.Item;
|
| - |
|
5 |
import in.shop2020.catalog.dashboard.shared.ItemInventory;
|
| 5 |
import in.shop2020.catalog.dashboard.shared.ItemStatus;
|
6 |
import in.shop2020.catalog.dashboard.shared.ItemStatus;
|
| 6 |
import in.shop2020.catalog.dashboard.shared.ItemsComparator;
|
7 |
import in.shop2020.catalog.dashboard.shared.ItemsComparator;
|
| 7 |
import in.shop2020.catalog.dashboard.shared.SourcePricings;
|
8 |
import in.shop2020.catalog.dashboard.shared.SourcePricings;
|
| 8 |
import in.shop2020.catalog.dashboard.shared.VendorItemMapping;
|
9 |
import in.shop2020.catalog.dashboard.shared.VendorItemMapping;
|
| 9 |
import in.shop2020.catalog.dashboard.shared.VendorPricings;
|
10 |
import in.shop2020.catalog.dashboard.shared.VendorPricings;
|
| Line 772... |
Line 773... |
| 772 |
sItems.setContentCategory(CategoryManager.getCategoryManager().getCategoryLabel(sit.getCategory()));
|
773 |
sItems.setContentCategory(CategoryManager.getCategoryManager().getCategoryLabel(sit.getCategory()));
|
| 773 |
SimilarItemslist.put(sit.getCatalogItemId(), sItems);
|
774 |
SimilarItemslist.put(sit.getCatalogItemId(), sItems);
|
| 774 |
}
|
775 |
}
|
| 775 |
}
|
776 |
}
|
| 776 |
|
777 |
|
| - |
|
778 |
Map<Long, ItemInventory> itemInventoryMap = new HashMap<Long, ItemInventory>();
|
| - |
|
779 |
ItemInventory warehousedata;
|
| - |
|
780 |
if(thriftItem.getItemInventory() != null) {
|
| - |
|
781 |
Map<Long, Long> availabilityMap = thriftItem.getItemInventory().getAvailability();
|
| - |
|
782 |
Map<Long, Long> reservedMap = thriftItem.getItemInventory().getReserved();
|
| - |
|
783 |
for(Entry<Long, Long> availability : availabilityMap.entrySet()) {
|
| - |
|
784 |
warehousedata = new ItemInventory();
|
| - |
|
785 |
warehousedata.setWarehouseId(availability.getKey());
|
| - |
|
786 |
warehousedata.setAvailability(availability.getValue());
|
| - |
|
787 |
warehousedata.setReserved(reservedMap.get(availability.getKey()));
|
| - |
|
788 |
itemInventoryMap.put(warehousedata.getWarehouseId(), warehousedata);
|
| - |
|
789 |
}
|
| - |
|
790 |
}
|
| - |
|
791 |
else {
|
| - |
|
792 |
itemInventoryMap = null;
|
| - |
|
793 |
}
|
| - |
|
794 |
|
| 777 |
Item item = new Item(thriftItem.getId(),
|
795 |
Item item = new Item(thriftItem.getId(),
|
| 778 |
thriftItem.getHotspotCategory(),
|
796 |
thriftItem.getHotspotCategory(),
|
| 779 |
thriftItem.getProductGroup(),
|
797 |
thriftItem.getProductGroup(),
|
| 780 |
thriftItem.getBrand(),
|
798 |
thriftItem.getBrand(),
|
| 781 |
thriftItem.getModelNumber(),
|
799 |
thriftItem.getModelNumber(),
|
| Line 805... |
Line 823... |
| 805 |
thriftItem.isRisky(),
|
823 |
thriftItem.isRisky(),
|
| 806 |
thriftItem.isSetExpectedDelay() ? thriftItem.getExpectedDelay() : null,
|
824 |
thriftItem.isSetExpectedDelay() ? thriftItem.getExpectedDelay() : null,
|
| 807 |
thriftItem.isSetPreferredWarehouse() ? thriftItem.getPreferredWarehouse() : null,
|
825 |
thriftItem.isSetPreferredWarehouse() ? thriftItem.getPreferredWarehouse() : null,
|
| 808 |
thriftItem.isSetDefaultWarehouse() ? thriftItem.getDefaultWarehouse() : null,
|
826 |
thriftItem.isSetDefaultWarehouse() ? thriftItem.getDefaultWarehouse() : null,
|
| 809 |
thriftItem.isIsWarehousePreferenceSticky(),
|
827 |
thriftItem.isIsWarehousePreferenceSticky(),
|
| 810 |
(thriftItem.getItemInventory() != null ? thriftItem.getItemInventory().getAvailability() : null),
|
828 |
itemInventoryMap,
|
| 811 |
vendorPricingMap,
|
829 |
vendorPricingMap,
|
| 812 |
vItemMap,
|
830 |
vItemMap,
|
| 813 |
sourcePricingMap,
|
831 |
sourcePricingMap,
|
| 814 |
SimilarItemslist);
|
832 |
SimilarItemslist);
|
| 815 |
return item;
|
833 |
return item;
|
| Line 875... |
Line 893... |
| 875 |
}catch(Exception e){
|
893 |
}catch(Exception e){
|
| 876 |
logger.error("Error while adding the SimilarItems for: " + itemId, e);
|
894 |
logger.error("Error while adding the SimilarItems for: " + itemId, e);
|
| 877 |
}
|
895 |
}
|
| 878 |
return null;
|
896 |
return null;
|
| 879 |
}
|
897 |
}
|
| - |
|
898 |
|
| - |
|
899 |
@Override
|
| - |
|
900 |
public Map<Long, ItemInventory> getProdItemInventory(long itemId) {
|
| - |
|
901 |
try {
|
| - |
|
902 |
// Initialize client for production server
|
| - |
|
903 |
CatalogClient catalogServiceClient_Prod = new CatalogClient(ConfigClientKeys.catalog_service_server_host_prod.toString(),
|
| - |
|
904 |
ConfigClientKeys.catalog_service_server_port.toString());
|
| - |
|
905 |
InventoryService.Client catalogClient_Prod = catalogServiceClient_Prod.getClient();
|
| - |
|
906 |
in.shop2020.model.v1.catalog.ItemInventory thriftItemInventory = catalogClient_Prod.getItemInventoryByItemId(itemId);
|
| - |
|
907 |
|
| - |
|
908 |
Map<Long, ItemInventory> itemInventoryMap = new HashMap<Long, ItemInventory>();
|
| - |
|
909 |
ItemInventory warehousedata;
|
| - |
|
910 |
if(thriftItemInventory != null) {
|
| - |
|
911 |
Map<Long, Long> availabilityMap = thriftItemInventory.getAvailability();
|
| - |
|
912 |
Map<Long, Long> reservedMap = thriftItemInventory.getReserved();
|
| - |
|
913 |
for(Entry<Long, Long> availability : availabilityMap.entrySet()) {
|
| - |
|
914 |
warehousedata = new ItemInventory();
|
| - |
|
915 |
warehousedata.setWarehouseId(availability.getKey());
|
| - |
|
916 |
warehousedata.setAvailability(availability.getValue());
|
| - |
|
917 |
warehousedata.setReserved(reservedMap.get(availability.getKey()));
|
| - |
|
918 |
itemInventoryMap.put(warehousedata.getWarehouseId(), warehousedata);
|
| - |
|
919 |
}
|
| - |
|
920 |
}
|
| - |
|
921 |
else {
|
| - |
|
922 |
itemInventoryMap = null;
|
| - |
|
923 |
}
|
| - |
|
924 |
return itemInventoryMap;
|
| - |
|
925 |
} catch (Exception e) {
|
| - |
|
926 |
logger.error("Error while updating item's risky flag on staging", e);
|
| - |
|
927 |
}
|
| - |
|
928 |
return null;
|
| - |
|
929 |
}
|
| 880 |
}
|
930 |
}
|
| 881 |
|
931 |
|