Subversion Repositories SmartDukaan

Rev

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

Rev 35442 Rev 35446
Line 2692... Line 2692...
2692
                .flatMap(List::stream)
2692
                .flatMap(List::stream)
2693
                .map(FocusedModel::getCatalogId)
2693
                .map(FocusedModel::getCatalogId)
2694
                .collect(Collectors.toSet());
2694
                .collect(Collectors.toSet());
2695
 
2695
 
2696
        // Batch fetch all items by catalog IDs upfront
2696
        // Batch fetch all items by catalog IDs upfront
2697
        Map<Integer, List<Item>> itemsByCatalogIdMap = itemRepository.selectAllByCatalogIds(allFocusedCatalogIds).stream()
2697
        List<Item> allItemsByCatalogId = itemRepository.selectAllByCatalogIds(allFocusedCatalogIds);
-
 
2698
        Map<Integer, List<Item>> itemsByCatalogIdMap = allItemsByCatalogId.stream()
2698
                .collect(Collectors.groupingBy(Item::getCatalogItemId));
2699
                .collect(Collectors.groupingBy(Item::getCatalogItemId));
2699
        LOGGER.info("Fetched items for {} catalog IDs", itemsByCatalogIdMap.size());
2700
        LOGGER.info("Fetched items for {} catalog IDs", itemsByCatalogIdMap.size());
2700
 
2701
 
2701
        // Batch fetch all tagListings by catalog IDs upfront
2702
        // Batch fetch all tagListings using pre-fetched items to avoid duplicate item fetch
2702
        Map<Integer, TagListing> tagListingByCatalogIdMap = tagListingRepository
2703
        Map<Integer, TagListing> tagListingByCatalogIdMap = tagListingRepository
2703
                .selectAllByCatalogIds(new ArrayList<>(allFocusedCatalogIds));
2704
                .selectAllByItems(allItemsByCatalogId);
2704
        LOGGER.info("Fetched {} tagListings", tagListingByCatalogIdMap.size());
2705
        LOGGER.info("Fetched {} tagListings", tagListingByCatalogIdMap.size());
2705
 
2706
 
2706
        // Collect all item IDs from inventory, GRN orders, and processing orders for batch item lookup
2707
        // Collect all item IDs from inventory, GRN orders, and processing orders for batch item lookup
2707
        Set<Integer> allItemIds = new HashSet<>();
2708
        Set<Integer> allItemIds = new HashSet<>();
2708
        allInventorySnapshotsMap.values().forEach(list ->
2709
        allInventorySnapshotsMap.values().forEach(list ->