| Line 589... |
Line 589... |
| 589 |
model.addAttribute("date", FormattingUtils.format(LocalDateTime.now()));
|
589 |
model.addAttribute("date", FormattingUtils.format(LocalDateTime.now()));
|
| 590 |
|
590 |
|
| 591 |
return "partner-price-circular";
|
591 |
return "partner-price-circular";
|
| 592 |
}
|
592 |
}
|
| 593 |
|
593 |
|
| 594 |
@RequestMapping(value = "/priceCircularByBrandAndPartnerType")
|
- |
|
| 595 |
public String priceCircularByBrandAndPartnerType(HttpServletRequest request, @RequestParam List<String> brands,
|
- |
|
| 596 |
@RequestParam PartnerType partnerType, Model model) throws ProfitMandiBusinessException {
|
- |
|
| 597 |
List<PartnerType> partnerTypes = new ArrayList<>();
|
- |
|
| 598 |
partnerTypes.add(partnerType);
|
- |
|
| 599 |
partnerTypes.add(PartnerType.ALL);
|
- |
|
| 600 |
List<PriceCircularItemModel> priceCircular = tagListingRepository.getPriceCircularByBrandAndType(partnerTypes,
|
- |
|
| 601 |
brands, LocalDateTime.now(), LocalDateTime.now().plusDays(1).toLocalDate().atStartOfDay());
|
- |
|
| 602 |
priceCircular = priceCircular.stream().filter(Utils.distinctByKey(PriceCircularItemModel::getCatalogId)).collect(Collectors.toList());
|
- |
|
| 603 |
|
- |
|
| 604 |
|
- |
|
| 605 |
for (PriceCircularItemModel pc : priceCircular) {
|
- |
|
| 606 |
|
- |
|
| 607 |
if (pc.getSpecialSupport() > 0) {
|
- |
|
| 608 |
pc.setSpecialSupport(Math.round(schemeService.getSpecialSupportAmount(pc.getSpecialSupport(), partnerType, LocalDate.now(), pc.getCatalogId())));
|
- |
|
| 609 |
}
|
- |
|
| 610 |
|
- |
|
| 611 |
Long totalScheme = pc.getBasePayout() + pc.getCashDiscount() + pc.getUpfrontMargin()
|
- |
|
| 612 |
+ pc.getTertiaryPayout() + pc.getHygienePayout() + pc.getCategoryPayout() + pc.getInvestmentPayout()
|
- |
|
| 613 |
+ pc.getSpecialSupport() + pc.getModelSpecfic();
|
- |
|
| 614 |
pc.setTotalScheme(totalScheme);
|
- |
|
| 615 |
long netprice = pc.getSellingPrice() - pc.getTotalScheme();
|
- |
|
| 616 |
pc.setNetPrice(netprice);
|
- |
|
| 617 |
int mopdpdiff = pc.getMop() - pc.getSellingPrice();
|
- |
|
| 618 |
pc.setMopdp(mopdpdiff);
|
- |
|
| 619 |
pc.setNetPrice2((int) pc.getNetPrice() - pc.getMopdp());
|
- |
|
| 620 |
long totalProfit = totalScheme + mopdpdiff;
|
- |
|
| 621 |
pc.setTotalProfit((int) totalProfit);
|
- |
|
| 622 |
//Total profit margin inculding tax
|
- |
|
| 623 |
double rouoff = totalProfit / (pc.getSellingPrice()) * 100;
|
- |
|
| 624 |
double roundOff = Math.round(rouoff * 100.0) / 100.0;
|
- |
|
| 625 |
pc.setNetMargin(roundOff);
|
- |
|
| 626 |
|
- |
|
| 627 |
}
|
- |
|
| 628 |
model.addAttribute("date", LocalDate.now());
|
- |
|
| 629 |
model.addAttribute("priceCircular", priceCircular);
|
- |
|
| 630 |
return "categorywise-circular";
|
- |
|
| 631 |
}
|
- |
|
| 632 |
|
- |
|
| 633 |
@RequestMapping(value = "/partnerPriceCircular")
|
594 |
@RequestMapping(value = "/partnerPriceCircular")
|
| 634 |
public String partnerPriceCircular(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
595 |
public String partnerPriceCircular(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
| 635 |
int fofoId = Utils.SYSTEM_PARTNER_ID;
|
596 |
int fofoId = Utils.SYSTEM_PARTNER_ID;
|
| 636 |
Set<String> brands = mongoClient.getMongoBrands(fofoId, null, 3).stream().map(x -> (String) x.get("name"))
|
597 |
Set<String> brands = mongoClient.getMongoBrands(fofoId, null, 3).stream().map(x -> (String) x.get("name"))
|
| 637 |
.collect(Collectors.toSet());
|
598 |
.collect(Collectors.toSet());
|