| Line 475... |
Line 475... |
| 475 |
@RequestMapping(value = "/priceCircular")
|
475 |
@RequestMapping(value = "/priceCircular")
|
| 476 |
public String priceCircular(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
476 |
public String priceCircular(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
| 477 |
int fofoId = Utils.SYSTEM_PARTNER_ID;
|
477 |
int fofoId = Utils.SYSTEM_PARTNER_ID;
|
| 478 |
Set<String> brands = mongoClient.getMongoBrands(fofoId, null, 3).stream().map(x -> (String) x.get("name"))
|
478 |
Set<String> brands = mongoClient.getMongoBrands(fofoId, null, 3).stream().map(x -> (String) x.get("name"))
|
| 479 |
.collect(Collectors.toSet());
|
479 |
.collect(Collectors.toSet());
|
| 480 |
Map<Integer, CustomRetailer> customRetailers = retailerService.getFofoRetailers(true);
|
- |
|
| 481 |
Map<Integer, PartnerType> fofoIdPartnerTypeMap = new HashMap<>();
|
- |
|
| 482 |
|
- |
|
| 483 |
for (Entry<Integer, CustomRetailer> customRetailer : customRetailers.entrySet()) {
|
- |
|
| 484 |
PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(customRetailer.getKey(), LocalDate.now());
|
480 |
brands.addAll(mongoClient.getMongoBrands(fofoId, null, 6).stream().map(x -> (String) x.get("name"))
|
| 485 |
fofoIdPartnerTypeMap.put(customRetailer.getKey(), partnerType);
|
481 |
.collect(Collectors.toSet()));
|
| 486 |
}
|
- |
|
| 487 |
|
482 |
|
| - |
|
483 |
/*
|
| - |
|
484 |
* Map<Integer, CustomRetailer> customRetailers =
|
| - |
|
485 |
* retailerService.getFofoRetailers(true); Map<Integer, PartnerType>
|
| - |
|
486 |
* fofoIdPartnerTypeMap = new HashMap<>();
|
| - |
|
487 |
*
|
| - |
|
488 |
* for (Entry<Integer, CustomRetailer> customRetailer :
|
| - |
|
489 |
* customRetailers.entrySet()) { PartnerType partnerType =
|
| - |
|
490 |
* partnerTypeChangeService.getTypeOnDate(customRetailer.getKey(),
|
| - |
|
491 |
* LocalDate.now()); fofoIdPartnerTypeMap.put(customRetailer.getKey(),
|
| - |
|
492 |
* partnerType); }
|
| - |
|
493 |
*
|
| 488 |
Map<PartnerType, List<Integer>> partnerTypePartnersMap = fofoIdPartnerTypeMap.entrySet().stream().collect(
|
494 |
* Map<PartnerType, List<Integer>> partnerTypePartnersMap =
|
| - |
|
495 |
* fofoIdPartnerTypeMap.entrySet().stream().collect( Collectors.groupingBy(x ->
|
| 489 |
Collectors.groupingBy(x -> x.getValue(), Collectors.mapping(x -> x.getKey(), Collectors.toList())));
|
496 |
* x.getValue(), Collectors.mapping(x -> x.getKey(), Collectors.toList())));
|
| - |
|
497 |
*/
|
| 490 |
model.addAttribute("brands", brands);
|
498 |
model.addAttribute("brands", brands);
|
| 491 |
|
499 |
|
| 492 |
return "price-circular";
|
500 |
return "price-circular";
|
| 493 |
}
|
501 |
}
|
| 494 |
|
502 |
|
| - |
|
503 |
@RequestMapping(value = "/priceCircularByBrandAndPartnerType")
|
| - |
|
504 |
public String priceCircularByBrandAndPartnerType(HttpServletRequest request, @RequestParam List<String> brands,
|
| - |
|
505 |
@RequestParam PartnerType partnerType, Model model) throws ProfitMandiBusinessException {
|
| - |
|
506 |
List<PartnerType> partnerTypes = new ArrayList<>();
|
| - |
|
507 |
partnerTypes.add(partnerType);
|
| - |
|
508 |
partnerTypes.add(PartnerType.ALL);
|
| - |
|
509 |
List<PriceCircularModel> priceCircular = tagListingRepository.getPriceCircularByBrandAndType(partnerTypes,
|
| - |
|
510 |
brands, LocalDateTime.now(), LocalDateTime.now().plusDays(1).toLocalDate().atStartOfDay());
|
| - |
|
511 |
|
| - |
|
512 |
for (PriceCircularModel pc : priceCircular) {
|
| - |
|
513 |
|
| - |
|
514 |
Long totalScheme = pc.getBasePayout() + pc.getCashDiscount() + pc.getTertiaryPayout()
|
| - |
|
515 |
+ pc.getHygienePayout() + pc.getCategoryPayout() + pc.getInvestmentPayout() + pc.getModelSpecfic();
|
| - |
|
516 |
pc.setTotalScheme(totalScheme);
|
| - |
|
517 |
long netprice = pc.getSellingPrice() - pc.getTotalScheme();
|
| - |
|
518 |
pc.setNetPrice(netprice);
|
| - |
|
519 |
int mopdpdiff = pc.getMop() - pc.getSellingPrice();
|
| - |
|
520 |
pc.setMopdp(mopdpdiff);
|
| - |
|
521 |
pc.setNetPrice2((int) pc.getNetPrice() - pc.getMopdp());
|
| - |
|
522 |
long totalProfit = totalScheme + mopdpdiff;
|
| - |
|
523 |
pc.setTotalProfit((int) totalProfit);
|
| - |
|
524 |
double rouoff = totalProfit / (pc.getSellingPrice() / 1.18) * 100;
|
| - |
|
525 |
double roundOff = Math.round(rouoff * 100.0) / 100.0;
|
| - |
|
526 |
pc.setNetMargin(roundOff);
|
| - |
|
527 |
|
| - |
|
528 |
}
|
| - |
|
529 |
model.addAttribute("priceCircular", priceCircular);
|
| - |
|
530 |
return "categorywise-circular";
|
| - |
|
531 |
}
|
| - |
|
532 |
|
| 495 |
@RequestMapping(value = "/partnerPriceCircular")
|
533 |
@RequestMapping(value = "/partnerPriceCircular")
|
| 496 |
public String partnerPriceCircular(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
534 |
public String partnerPriceCircular(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
| 497 |
int fofoId = Utils.SYSTEM_PARTNER_ID;
|
535 |
int fofoId = Utils.SYSTEM_PARTNER_ID;
|
| 498 |
Set<String> brands = mongoClient.getMongoBrands(fofoId, null, 3).stream().map(x -> (String) x.get("name"))
|
536 |
Set<String> brands = mongoClient.getMongoBrands(fofoId, null, 3).stream().map(x -> (String) x.get("name"))
|
| 499 |
.collect(Collectors.toSet());
|
537 |
.collect(Collectors.toSet());
|
| Line 513... |
Line 551... |
| 513 |
PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(loginDetails.getFofoId(), LocalDate.now());
|
551 |
PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(loginDetails.getFofoId(), LocalDate.now());
|
| 514 |
List<PartnerType> partnerTypes = new ArrayList<>();
|
552 |
List<PartnerType> partnerTypes = new ArrayList<>();
|
| 515 |
partnerTypes.add(partnerType);
|
553 |
partnerTypes.add(partnerType);
|
| 516 |
partnerTypes.add(PartnerType.ALL);
|
554 |
partnerTypes.add(PartnerType.ALL);
|
| 517 |
List<PriceCircularModel> priceCircular = tagListingRepository.getPriceCircularByBrandAndType(partnerTypes,
|
555 |
List<PriceCircularModel> priceCircular = tagListingRepository.getPriceCircularByBrandAndType(partnerTypes,
|
| - |
|
556 |
Arrays.asList(brand), LocalDateTime.now(),
|
| 518 |
brand, LocalDateTime.now(), LocalDateTime.now().plusDays(1).toLocalDate().atStartOfDay());
|
557 |
LocalDateTime.now().plusDays(1).toLocalDate().atStartOfDay());
|
| 519 |
|
558 |
|
| 520 |
for (PriceCircularModel pc : priceCircular) {
|
559 |
for (PriceCircularModel pc : priceCircular) {
|
| 521 |
|
560 |
|
| 522 |
Long totalScheme = pc.getBasePayout() + pc.getCashDiscount() + pc.getTertiaryPayout()
|
561 |
Long totalScheme = pc.getBasePayout() + pc.getCashDiscount() + pc.getTertiaryPayout()
|
| 523 |
+ pc.getHygienePayout() + pc.getCategoryPayout() + pc.getInvestmentPayout() + pc.getModelSpecfic();
|
562 |
+ pc.getHygienePayout() + pc.getCategoryPayout() + pc.getInvestmentPayout() + pc.getModelSpecfic();
|