Subversion Repositories SmartDukaan

Rev

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

Rev 37160 Rev 37188
Line 109... Line 109...
109
 
109
 
110
    @Autowired
110
    @Autowired
111
    private PriceDropRepository priceDropRepository;
111
    private PriceDropRepository priceDropRepository;
112
 
112
 
113
    @Autowired
113
    @Autowired
-
 
114
    private BrandsRepository brandsRepository;
-
 
115
 
-
 
116
    @Autowired
114
    private CookiesProcessor cookiesProcessor;
117
    private CookiesProcessor cookiesProcessor;
115
 
118
 
116
    @Autowired
119
    @Autowired
117
    private PendingOrderRepository pendingOrderRepository;
120
    private PendingOrderRepository pendingOrderRepository;
118
 
121
 
Line 1686... Line 1689...
1686
                                                    category) throws Exception {
1689
                                                    category) throws Exception {
1687
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1690
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1688
        if (warehouseIds.contains(0)) {
1691
        if (warehouseIds.contains(0)) {
1689
            warehouseIds.addAll(warehouseMap.keySet());
1692
            warehouseIds.addAll(warehouseMap.keySet());
1690
        }
1693
        }
-
 
1694
        // Band-aid for URL '+' decode issue on brand names (e.g. "Ai+"):
-
 
1695
        // if a brand doesn't exist in catalog.brand as-is but "<brand>+" does,
-
 
1696
        // switch to the plus variant. Zero regression for the other brands.
-
 
1697
        brands = brands.stream().map(b -> {
-
 
1698
            if (b == null || b.trim().isEmpty()) return b;
-
 
1699
            String probe = b.replaceAll("\\s+$", "");
-
 
1700
            try {
-
 
1701
                if (brandsRepository.selectByBrand(b) == null
-
 
1702
                        && (probe.equals(b) || brandsRepository.selectByBrand(probe) == null)) {
-
 
1703
                    String withPlus = probe + "+";
-
 
1704
                    if (brandsRepository.selectByBrand(withPlus) != null) {
-
 
1705
                        LOGGER.info("getWarehouseWiseItemStock brand fallback: '{}' -> '{}'", b, withPlus);
-
 
1706
                        return withPlus;
-
 
1707
                    }
-
 
1708
                }
-
 
1709
            } catch (Exception e) {
-
 
1710
                LOGGER.warn("getWarehouseWiseItemStock brand fallback failed for '{}': {}", b, e.getMessage());
-
 
1711
            }
-
 
1712
            return b;
-
 
1713
        }).collect(Collectors.toList());
1691
        List<WarehouseWiseitemStockModel> warehouseWiseItemStock = saholicInventoryCISRepository.selectWarehouseItemStock(warehouseIds, brands, category);
1714
        List<WarehouseWiseitemStockModel> warehouseWiseItemStock = saholicInventoryCISRepository.selectWarehouseItemStock(warehouseIds, brands, category);
1692
 
1715
 
1693
        model.addAttribute("warehouseWiseItemStock", warehouseWiseItemStock);
1716
        model.addAttribute("warehouseWiseItemStock", warehouseWiseItemStock);
1694
        model.addAttribute("warehouseMap", warehouseMap);
1717
        model.addAttribute("warehouseMap", warehouseMap);
1695
        return "warehouse_item_details";
1718
        return "warehouse_item_details";