Subversion Repositories SmartDukaan

Rev

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

Rev 34938 Rev 34972
Line 125... Line 125...
125
    public Set<Integer> getAllItemIdsForSmartCartOfPartner(int fofoId) throws ProfitMandiBusinessException {
125
    public Set<Integer> getAllItemIdsForSmartCartOfPartner(int fofoId) throws ProfitMandiBusinessException {
126
        LocalDateTime todayDate = LocalDate.now().atStartOfDay();
126
        LocalDateTime todayDate = LocalDate.now().atStartOfDay();
127
        LocalDateTime fortyFiveAgoDate = todayDate.minusDays(45).with(LocalTime.MAX);
127
        LocalDateTime fortyFiveAgoDate = todayDate.minusDays(45).with(LocalTime.MAX);
128
        List<SoldAllCatalogitemQtyByPartnerModel> soldAllCatalogitemQtyByPartnerModels = this.getAllSoldCatalogItemByPartner(fofoId,fortyFiveAgoDate,todayDate);
128
        List<SoldAllCatalogitemQtyByPartnerModel> soldAllCatalogitemQtyByPartnerModels = this.getAllSoldCatalogItemByPartner(fofoId,fortyFiveAgoDate,todayDate);
129
        Set<Integer> soldCatalogsIn45Days = soldAllCatalogitemQtyByPartnerModels.stream().map(x->x.getCatalogId()).collect(Collectors.toSet());
129
        Set<Integer> soldCatalogsIn45Days = soldAllCatalogitemQtyByPartnerModels.stream().map(x->x.getCatalogId()).collect(Collectors.toSet());
-
 
130
        if(soldCatalogsIn45Days.size() == 0) {
-
 
131
            return new HashSet<>();
-
 
132
        }
130
        logger.info("soldCatalogsIn45Days {}",soldCatalogsIn45Days);
133
        logger.info("soldCatalogsIn45Days {}",soldCatalogsIn45Days);
131
        List<Item> soldItems = itemRepository.selectAllByCatalogIds(soldCatalogsIn45Days);
134
        List<Item> soldItems = itemRepository.selectAllByCatalogIds(soldCatalogsIn45Days);
132
        Set<Integer> soldItemIds = soldItems.stream().map(x->x.getId()).collect(Collectors.toSet());
135
        Set<Integer> soldItemIds = soldItems.stream().map(x->x.getId()).collect(Collectors.toSet());
133
        List<CurrentInventorySnapshot> currentInventorySnapshots =  currentInventorySnapshotRepository.selectByFofoItemIds(fofoId,soldItemIds);
136
        List<CurrentInventorySnapshot> currentInventorySnapshots =  currentInventorySnapshotRepository.selectByFofoItemIds(fofoId,soldItemIds);
134
        Set<Integer> instockItemIds = currentInventorySnapshots.stream().filter(x -> x.getAvailability() > 0).map(x->x.getItemId()).collect(Collectors.toSet());
137
        Set<Integer> instockItemIds = currentInventorySnapshots.stream().filter(x -> x.getAvailability() > 0).map(x->x.getItemId()).collect(Collectors.toSet());