| Line 507... |
Line 507... |
| 507 |
LocalDateTime twoMonthsAgoStartDate = twoMonthsAgo.atDay(1).atStartOfDay();
|
507 |
LocalDateTime twoMonthsAgoStartDate = twoMonthsAgo.atDay(1).atStartOfDay();
|
| 508 |
LocalDateTime twoMonthsAgoEndDate = twoMonthsAgo.atEndOfMonth().atTime(23, 59, 59);
|
508 |
LocalDateTime twoMonthsAgoEndDate = twoMonthsAgo.atEndOfMonth().atTime(23, 59, 59);
|
| 509 |
|
509 |
|
| 510 |
List<ReturnOrderInfoModel> twoMonthAgoReturnOrderInfoModels = returnOrderInfoRepository.selectAllByBetweenDate(twoMonthsAgoStartDate, twoMonthsAgoEndDate);
|
510 |
List<ReturnOrderInfoModel> twoMonthAgoReturnOrderInfoModels = returnOrderInfoRepository.selectAllByBetweenDate(twoMonthsAgoStartDate, twoMonthsAgoEndDate);
|
| 511 |
Map<Integer, Long> twoMonthAgoPartnerReturnOrderInfoModelMap = twoMonthAgoReturnOrderInfoModels.stream().collect(Collectors.groupingBy(x -> x.getRetailerId(), Collectors.summingLong(x -> Math.round(x.getRefundAmount()))));
|
511 |
Map<Integer, Long> twoMonthAgoPartnerReturnOrderInfoModelMap = twoMonthAgoReturnOrderInfoModels.stream().collect(Collectors.groupingBy(x -> x.getRetailerId(), Collectors.summingLong(x -> Math.round(x.getRefundAmount()))));
|
| 512 |
|
- |
|
| - |
|
512 |
LOGGER.info("twoMonthAgoReturnOrderInfoModels {}",twoMonthAgoReturnOrderInfoModels);
|
| 513 |
List<Order> twoMonthRtoRefundOrders = orderRepository.selectAllOrderDatesBetweenByStatus(twoMonthsAgoStartDate, twoMonthsAgoEndDate, OrderStatus.RTO_REFUNDED);
|
513 |
List<Order> twoMonthRtoRefundOrders = orderRepository.selectAllOrderDatesBetweenByStatus(twoMonthsAgoStartDate, twoMonthsAgoEndDate, OrderStatus.RTO_REFUNDED);
|
| 514 |
Map<Integer, Long> twoMonthAgoRtoRefundOrderMap = twoMonthRtoRefundOrders.stream().collect(Collectors.groupingBy(x -> x.getRetailerId(), Collectors.summingLong(x -> Math.round(x.getTotalAmount()))));
|
514 |
Map<Integer, Long> twoMonthAgoRtoRefundOrderMap = twoMonthRtoRefundOrders.stream().collect(Collectors.groupingBy(x -> x.getRetailerId(), Collectors.summingLong(x -> Math.round(x.getTotalAmount()))));
|
| - |
|
515 |
LOGGER.info("twoMonthRtoRefundOrders {}",twoMonthRtoRefundOrders);
|
| 515 |
|
516 |
|
| 516 |
Map<Integer , String> assessmentMap = new HashMap<>();
|
517 |
Map<Integer , String> assessmentMap = new HashMap<>();
|
| 517 |
Map<Integer , String> zeroBillingMap = new HashMap<>();
|
518 |
Map<Integer , String> zeroBillingMap = new HashMap<>();
|
| 518 |
Map<Integer , Float> billingNeededMap = new HashMap<>();
|
519 |
Map<Integer , Float> billingNeededMap = new HashMap<>();
|
| 519 |
Map<Integer , Integer> countAMap = new HashMap<>();
|
520 |
Map<Integer , Integer> countAMap = new HashMap<>();
|
| Line 613... |
Line 614... |
| 613 |
// this month tertiary----------
|
614 |
// this month tertiary----------
|
| 614 |
|
615 |
|
| 615 |
LocalDateTime now = LocalDateTime.now();
|
616 |
LocalDateTime now = LocalDateTime.now();
|
| 616 |
double todaySale = fofoOrderItemRepository.selectSumMopGroupByRetailer(startOfToday, now, fofoId, false).get(fofoId);
|
617 |
double todaySale = fofoOrderItemRepository.selectSumMopGroupByRetailer(startOfToday, now, fofoId, false).get(fofoId);
|
| 617 |
double mtdSaleTillYesterDay = fofoOrderItemRepository.selectSumMopGroupByRetailer(startOfToday.withDayOfMonth(1), startOfToday, fofoId, false).get(fofoId);
|
618 |
double mtdSaleTillYesterDay = fofoOrderItemRepository.selectSumMopGroupByRetailer(startOfToday.withDayOfMonth(1), startOfToday, fofoId, false).get(fofoId);
|
| 618 |
double mtdSale = mtdSaleTillYesterDay + todaySale;
|
619 |
double mtdSale = mtdSaleTillYesterDay;
|
| 619 |
|
620 |
|
| 620 |
|
621 |
|
| 621 |
// last month secondary target
|
622 |
// last month secondary target
|
| 622 |
|
623 |
|
| 623 |
double lastMonthSecondaryTarget = monthlyTargetRepository.selectByDateAndFofoId(lastMonth, fofoId) != null ? monthlyTargetRepository.selectByDateAndFofoId(lastMonth, fofoId).getPurchaseTarget() : 0;
|
624 |
double lastMonthSecondaryTarget = monthlyTargetRepository.selectByDateAndFofoId(lastMonth, fofoId) != null ? monthlyTargetRepository.selectByDateAndFofoId(lastMonth, fofoId).getPurchaseTarget() : 0;
|
| Line 758... |
Line 759... |
| 758 |
|
759 |
|
| 759 |
LOGGER.info("activeLoans- {}",activeLoans);
|
760 |
LOGGER.info("activeLoans- {}",activeLoans);
|
| 760 |
|
761 |
|
| 761 |
float activeLoan = activeLoans.stream().map(Loan::getPendingAmount).reduce(BigDecimal.ZERO,BigDecimal::add).floatValue();
|
762 |
float activeLoan = activeLoans.stream().map(Loan::getPendingAmount).reduce(BigDecimal.ZERO,BigDecimal::add).floatValue();
|
| 762 |
|
763 |
|
| 763 |
|
- |
|
| 764 |
float poValue = partnerDailyInvestmentMap.get(fofoId) != null ? partnerDailyInvestmentMap.get(fofoId).getUnbilledAmount() : 0f;
|
764 |
float poValue = partnerDailyInvestmentMap.get(fofoId) != null ? partnerDailyInvestmentMap.get(fofoId).getUnbilledAmount() : 0f;
|
| 765 |
|
765 |
|
| 766 |
float poAndBilledValue = (float) (currentMonthNetSecondary + poValue);
|
766 |
float poAndBilledValue = (float) (currentMonthNetSecondary + poValue);
|
| 767 |
|
767 |
|
| 768 |
double purchaseMtd = secondaryMtd.getOrDefault(fofoId, 0.0);
|
- |
|
| 769 |
|
- |
|
| 770 |
double todayRequiredDrr = rbmTargetService.calculateFofoIdTodayTarget(fofoId, purchaseMtd,LocalDate.now());
|
768 |
double todayRequiredDrr = rbmTargetService.calculateFofoIdTodayTarget(fofoId, currentMonthNetSecondary,LocalDate.now());
|
| 771 |
|
769 |
|
| 772 |
double monthDay1Drr = rbmTargetService.calculateFofoIdTodayTarget(fofoId,0d,YearMonth.now().atDay(1));
|
770 |
double monthDay1Drr = rbmTargetService.calculateFofoIdTodayTarget(fofoId,0d,YearMonth.now().atDay(1));
|
| 773 |
|
771 |
|
| 774 |
|
772 |
|
| 775 |
double gotDrrPercent = (todayRequiredDrr / monthDay1Drr) * 100;
|
773 |
double gotDrrPercent = (todayRequiredDrr / monthDay1Drr) * 100;
|