Subversion Repositories SmartDukaan

Rev

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

Rev 36979 Rev 36980
Line 827... Line 827...
827
 
827
 
828
        // Partner type for today
828
        // Partner type for today
829
        Map<Integer, PartnerType> partnerTypeMap = partnerTypeChangeService.getTypesForFofoIds(retailerIds, LocalDate.now());
829
        Map<Integer, PartnerType> partnerTypeMap = partnerTypeChangeService.getTypesForFofoIds(retailerIds, LocalDate.now());
830
 
830
 
831
        // Monthly targets
831
        // Monthly targets
832
        Map<Integer, Double> currentTargetMap = monthlyTargetRepository.selectByDateAndFofoIds(currentMonth, retailerIds).stream()
832
        Map<Integer, Double> currentTargetMap = monthlyTargetRepository.selectByExactDateAndFofoIds(currentMonth, retailerIds).stream()
833
                .collect(Collectors.toMap(MonthlyTarget::getFofoId, MonthlyTarget::getPurchaseTarget, (a, b) -> a));
833
                .collect(Collectors.toMap(MonthlyTarget::getFofoId, MonthlyTarget::getPurchaseTarget, (a, b) -> a));
834
        Map<Integer, Double> lastTargetMap = monthlyTargetRepository.selectByDateAndFofoIds(lastMonth, retailerIds).stream()
834
        Map<Integer, Double> lastTargetMap = monthlyTargetRepository.selectByExactDateAndFofoIds(lastMonth, retailerIds).stream()
835
                .collect(Collectors.toMap(MonthlyTarget::getFofoId, MonthlyTarget::getPurchaseTarget, (a, b) -> a));
835
                .collect(Collectors.toMap(MonthlyTarget::getFofoId, MonthlyTarget::getPurchaseTarget, (a, b) -> a));
836
        Map<Integer, Double> twoMonthAgoTargetMap = monthlyTargetRepository.selectByDateAndFofoIds(twoMonthsAgo, retailerIds).stream()
836
        Map<Integer, Double> twoMonthAgoTargetMap = monthlyTargetRepository.selectByExactDateAndFofoIds(twoMonthsAgo, retailerIds).stream()
837
                .collect(Collectors.toMap(MonthlyTarget::getFofoId, MonthlyTarget::getPurchaseTarget, (a, b) -> a));
837
                .collect(Collectors.toMap(MonthlyTarget::getFofoId, MonthlyTarget::getPurchaseTarget, (a, b) -> a));
838
 
838
 
839
        // DRR target: RbmTargetService.calculateFofoIdTodayTarget always uses YearMonth.now() internally, regardless of
839
        // DRR target: RbmTargetService.calculateFofoIdTodayTarget always uses YearMonth.now() internally, regardless of
840
        // the date arg. On the 1st this differs from currentMonth (previous month) — preserve original semantics.
840
        // the date arg. On the 1st this differs from currentMonth (previous month) — preserve original semantics.
841
        Map<Integer, Double> drrTargetMap = YearMonth.now().equals(currentMonth) ? currentTargetMap
841
        Map<Integer, Double> drrTargetMap = YearMonth.now().equals(currentMonth) ? currentTargetMap
842
                : monthlyTargetRepository.selectByDateAndFofoIds(YearMonth.now(), retailerIds).stream()
842
                : monthlyTargetRepository.selectByExactDateAndFofoIds(YearMonth.now(), retailerIds).stream()
843
                    .collect(Collectors.toMap(MonthlyTarget::getFofoId, MonthlyTarget::getPurchaseTarget, (a, b) -> a));
843
                    .collect(Collectors.toMap(MonthlyTarget::getFofoId, MonthlyTarget::getPurchaseTarget, (a, b) -> a));
844
 
844
 
845
        // Monthly secondary (order value) — batched
845
        // Monthly secondary (order value) — batched
846
        Map<Integer, Double> mtdSecondaryMap = orderRepository.selectOrderValueBetweenBillingDatesGroupByFofoId(retailerIds,
846
        Map<Integer, Double> mtdSecondaryMap = orderRepository.selectOrderValueBetweenBillingDatesGroupByFofoId(retailerIds,
847
                startOfToday.withDayOfMonth(1), previousDay).stream()
847
                startOfToday.withDayOfMonth(1), previousDay).stream()