| Line 588... |
Line 588... |
| 588 |
List<PartnerType> partnerTypes = new ArrayList<>();
|
588 |
List<PartnerType> partnerTypes = new ArrayList<>();
|
| 589 |
partnerTypes.add(partnerType);
|
589 |
partnerTypes.add(partnerType);
|
| 590 |
partnerTypes.add(PartnerType.ALL);
|
590 |
partnerTypes.add(PartnerType.ALL);
|
| 591 |
List<PriceCircularItemModel> priceCircular = tagListingRepository.getPriceCircularByBrandAndType(partnerTypes,
|
591 |
List<PriceCircularItemModel> priceCircular = tagListingRepository.getPriceCircularByBrandAndType(partnerTypes,
|
| 592 |
brands, LocalDateTime.now(), LocalDateTime.now().plusDays(1).toLocalDate().atStartOfDay());
|
592 |
brands, LocalDateTime.now(), LocalDateTime.now().plusDays(1).toLocalDate().atStartOfDay());
|
| - |
|
593 |
priceCircular = priceCircular.stream().filter(Utils.distinctByKey(PriceCircularItemModel::getCatalogId)).collect(Collectors.toList());
|
| - |
|
594 |
|
| 593 |
|
595 |
|
| 594 |
for (PriceCircularItemModel pc : priceCircular) {
|
596 |
for (PriceCircularItemModel pc : priceCircular) {
|
| 595 |
|
597 |
|
| 596 |
Long totalScheme = pc.getBasePayout() + pc.getCashDiscount() + pc.getUpfrontMargin()
|
598 |
Long totalScheme = pc.getBasePayout() + pc.getCashDiscount() + pc.getUpfrontMargin()
|
| 597 |
+ pc.getTertiaryPayout() + pc.getHygienePayout() + pc.getCategoryPayout() + pc.getInvestmentPayout()
|
599 |
+ pc.getTertiaryPayout() + pc.getHygienePayout() + pc.getCategoryPayout() + pc.getInvestmentPayout()
|
| Line 641... |
Line 643... |
| 641 |
PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoId, LocalDate.now());
|
643 |
PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoId, LocalDate.now());
|
| 642 |
List<PartnerType> partnerTypes = new ArrayList<>();
|
644 |
List<PartnerType> partnerTypes = new ArrayList<>();
|
| 643 |
partnerTypes.add(partnerType);
|
645 |
partnerTypes.add(partnerType);
|
| 644 |
partnerTypes.add(PartnerType.ALL);
|
646 |
partnerTypes.add(PartnerType.ALL);
|
| 645 |
PriceCircularModel priceCircular = priceCircularService.getPriceCircularByOffer(fofoId, brand);
|
647 |
PriceCircularModel priceCircular = priceCircularService.getPriceCircularByOffer(fofoId, brand);
|
| 646 |
for (PriceCircularItemModel pc : priceCircular.getPriceCircularItemModels()) {
|
- |
|
| 647 |
LOGGER.info("Slabs {}", pc.getSlabPayouts());
|
- |
|
| 648 |
Long totalScheme = pc.getBasePayout() + pc.getCashDiscount()
|
- |
|
| 649 |
+ pc.getUpfrontMargin()
|
- |
|
| 650 |
+ pc.getTertiaryPayout()
|
- |
|
| 651 |
+ pc.getUpgradeOffer()
|
- |
|
| 652 |
+ pc.getHygienePayout() + pc.getCategoryPayout() + pc.getInvestmentPayout() + pc.getModelSpecfic()
|
- |
|
| 653 |
+ (pc.getSlabPayouts() == null ? 0l : pc.getSlabPayouts().stream().filter(x -> x != null).collect(Collectors.summingLong(x -> x.entrySet().stream().findFirst().get().getValue())));
|
- |
|
| 654 |
pc.setTotalScheme(totalScheme);
|
- |
|
| 655 |
long netprice = pc.getSellingPrice() - pc.getTotalScheme();
|
- |
|
| 656 |
pc.setNetPrice(netprice);
|
- |
|
| 657 |
int mopdpdiff = pc.getMop() - pc.getSellingPrice();
|
- |
|
| 658 |
pc.setMopdp(mopdpdiff);
|
- |
|
| 659 |
pc.setNetPrice2((int) pc.getNetPrice() - pc.getMopdp());
|
- |
|
| 660 |
long totalProfit = totalScheme + mopdpdiff;
|
- |
|
| 661 |
pc.setTotalProfit((int) totalProfit);
|
- |
|
| 662 |
double rouoff = totalProfit / (pc.getSellingPrice() / 1.18) * 100;
|
- |
|
| 663 |
double roundOff = Math.round(rouoff * 100.0) / 100.0;
|
- |
|
| 664 |
pc.setNetMargin(roundOff);
|
- |
|
| 665 |
}
|
- |
|
| 666 |
|
648 |
|
| 667 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(fofoId);
|
649 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(fofoId);
|
| 668 |
model.addAttribute("priceCircular", priceCircular.getPriceCircularItemModels());
|
650 |
model.addAttribute("priceCircular", priceCircular.getPriceCircularItemModels());
|
| 669 |
model.addAttribute("offers", priceCircular.getOffers());
|
651 |
model.addAttribute("offers", priceCircular.getOffers());
|
| 670 |
model.addAttribute("upgradeOffer", priceCircular.isUpgradeOffer());
|
652 |
model.addAttribute("upgradeOffer", priceCircular.isUpgradeOffer());
|