| Line 548... |
Line 548... |
| 548 |
throws ProfitMandiBusinessException {
|
548 |
throws ProfitMandiBusinessException {
|
| 549 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
549 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 550 |
boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
|
550 |
boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
|
| 551 |
if (date != null) {
|
551 |
if (date != null) {
|
| 552 |
date = date.isAfter(LocalDate.now()) ? LocalDate.now() : date;
|
552 |
date = date.isAfter(LocalDate.now()) ? LocalDate.now() : date;
|
| - |
|
553 |
} else if (!isAdmin) {
|
| - |
|
554 |
date = LocalDate.now();
|
| 553 |
}
|
555 |
}
|
| 554 |
|
556 |
|
| 555 |
List<Scheme> schemes = null;
|
557 |
List<Scheme> schemes = null;
|
| 556 |
List<SchemeInOut> schemeInOut = null;
|
558 |
List<SchemeInOut> schemeInOut = null;
|
| 557 |
|
559 |
|
| Line 605... |
Line 607... |
| 605 |
//this.setSchemeAmountModel(schemes);
|
607 |
//this.setSchemeAmountModel(schemes);
|
| 606 |
int nlc = this.getNlc(item, loginDetails.getFofoId(), schemes, tagListing);
|
608 |
int nlc = this.getNlc(item, loginDetails.getFofoId(), schemes, tagListing);
|
| 607 |
// For 7720(HR) remove investment
|
609 |
// For 7720(HR) remove investment
|
| 608 |
model.addAttribute("schemes", schemes);
|
610 |
model.addAttribute("schemes", schemes);
|
| 609 |
model.addAttribute("nlc", Math.round(nlc));
|
611 |
model.addAttribute("nlc", Math.round(nlc));
|
| - |
|
612 |
|
| - |
|
613 |
Map<Integer, Map<Integer, Long>> offerSlabPayoutMap = new HashMap<>();
|
| - |
|
614 |
List<CreateOfferRequest> offers = offerService.getPublishedOffers(date, loginDetails.getFofoId(), searchModel);
|
| - |
|
615 |
if (offers.size() > 0) {
|
| - |
|
616 |
for (CreateOfferRequest createOfferRequest : offers) {
|
| - |
|
617 |
Map<Integer, Map<Integer, Long>> catalogSlabPayoutMap = offerService
|
| - |
|
618 |
.getSlabPayoutMap(createOfferRequest);
|
| - |
|
619 |
Map<Integer, Long> slabPayoutMap = catalogSlabPayoutMap.get(searchModel);
|
| - |
|
620 |
offerSlabPayoutMap.put(createOfferRequest.getId(), slabPayoutMap);
|
| - |
|
621 |
}
|
| - |
|
622 |
model.addAttribute("offers", offers);
|
| - |
|
623 |
model.addAttribute("offerSlabPayoutMap", offerSlabPayoutMap);
|
| - |
|
624 |
|
| - |
|
625 |
LOGGER.info("offer");
|
| - |
|
626 |
}
|
| - |
|
627 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
|
| - |
|
628 |
model.addAttribute("partnerCode", fs.getCode());
|
| 610 |
model.addAttribute("fofoId", loginDetails.getFofoId());
|
629 |
model.addAttribute("fofoId", fs.getId());
|
| - |
|
630 |
|
| 611 |
return "schemes-partner";
|
631 |
return "schemes-partner";
|
| 612 |
|
632 |
|
| 613 |
}
|
633 |
}
|
| 614 |
|
634 |
|
| 615 |
} else if (org.apache.commons.lang3.StringUtils.isNotEmpty(searchImei)) {
|
635 |
} else if (org.apache.commons.lang3.StringUtils.isNotEmpty(searchImei)) {
|
| Line 656... |
Line 676... |
| 656 |
schemes = schemeRepository.selectAll(0, 30);
|
676 |
schemes = schemeRepository.selectAll(0, 30);
|
| 657 |
this.setSchemeAmountModel(schemes);
|
677 |
this.setSchemeAmountModel(schemes);
|
| 658 |
model.addAttribute("schemes", schemes);
|
678 |
model.addAttribute("schemes", schemes);
|
| 659 |
return "schemes";
|
679 |
return "schemes";
|
| 660 |
} else {
|
680 |
} else {
|
| 661 |
List<CreateOfferRequest> offers = null;
|
- |
|
| 662 |
Map<Integer, Map<Integer, Long>> offerSlabPayoutMap = new HashMap<>();
|
- |
|
| 663 |
List<PriceDropIMEI> priceDropImeis = new ArrayList<>();
|
- |
|
| 664 |
if (searchModel > 0) {
|
- |
|
| 665 |
offers = offerService.getPublishedOffers(date, loginDetails.getFofoId(), searchModel);
|
- |
|
| 666 |
for (CreateOfferRequest createOfferRequest : offers) {
|
- |
|
| 667 |
Map<Integer, Map<Integer, Long>> catalogSlabPayoutMap = offerService
|
- |
|
| 668 |
.getSlabPayoutMap(createOfferRequest);
|
- |
|
| 669 |
Map<Integer, Long> slabPayoutMap = catalogSlabPayoutMap.get(searchModel);
|
- |
|
| 670 |
offerSlabPayoutMap.put(createOfferRequest.getId(), slabPayoutMap);
|
- |
|
| 671 |
}
|
- |
|
| 672 |
} else {
|
- |
|
| 673 |
offers = new ArrayList<>();
|
- |
|
| 674 |
}
|
- |
|
| 675 |
if (org.apache.commons.lang3.StringUtils.isNotEmpty(searchImei)) {
|
681 |
if (org.apache.commons.lang3.StringUtils.isNotEmpty(searchImei)) {
|
| 676 |
InventoryItem inventoryItem = inventoryItemRepository.selectBySerialNumberFofoId(searchImei,
|
682 |
InventoryItem inventoryItem = inventoryItemRepository.selectBySerialNumberFofoId(searchImei,
|
| 677 |
loginDetails.getFofoId());
|
683 |
loginDetails.getFofoId());
|
| - |
|
684 |
List<PriceDropIMEI> priceDropImeis = priceDropIMEIRepository.selectByFofoIdImei(loginDetails.getFofoId(), searchImei);
|
| - |
|
685 |
if (priceDropImeis.size() > 0) {
|
| 678 |
|
686 |
|
| 679 |
priceDropImeis = priceDropIMEIRepository.selectByFofoIdImei(loginDetails.getFofoId(), searchImei);
|
- |
|
| 680 |
for (PriceDropIMEI priceDropIMEI : priceDropImeis) {
|
687 |
for (PriceDropIMEI priceDropIMEI : priceDropImeis) {
|
| 681 |
int priceDropId = priceDropIMEI.getPriceDropId();
|
688 |
int priceDropId = priceDropIMEI.getPriceDropId();
|
| 682 |
PriceDrop pd = priceDropRepository.selectById(priceDropId);
|
689 |
PriceDrop pd = priceDropRepository.selectById(priceDropId);
|
| 683 |
|
- |
|
| 684 |
priceDropIMEI.setPriceDrop(pd);
|
690 |
priceDropIMEI.setPriceDrop(pd);
|
| - |
|
691 |
}
|
| - |
|
692 |
model.addAttribute("priceDropImeis", priceDropImeis);
|
| 685 |
}
|
693 |
}
|
| 686 |
}
|
694 |
}
|
| 687 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
|
695 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
|
| 688 |
|
- |
|
| 689 |
model.addAttribute("offers", offers);
|
- |
|
| 690 |
model.addAttribute("offerSlabPayoutMap", offerSlabPayoutMap);
|
- |
|
| 691 |
model.addAttribute("searchModel", searchModel);
|
- |
|
| 692 |
model.addAttribute("searchScheme", searchScheme);
|
- |
|
| 693 |
model.addAttribute("searchImei", searchImei);
|
- |
|
| 694 |
model.addAttribute("partnerCode", fs.getCode());
|
696 |
model.addAttribute("partnerCode", fs.getCode());
|
| 695 |
model.addAttribute("fofoId", fs.getId());
|
697 |
model.addAttribute("fofoId", fs.getId());
|
| 696 |
model.addAttribute("priceDropImeis", priceDropImeis);
|
- |
|
| 697 |
return "schemes-partner";
|
698 |
return "schemes-partner";
|
| 698 |
}
|
699 |
}
|
| 699 |
|
700 |
|
| 700 |
}
|
701 |
}
|
| 701 |
|
702 |
|