| Line 574... |
Line 574... |
| 574 |
return "schemes";
|
574 |
return "schemes";
|
| 575 |
} else {
|
575 |
} else {
|
| 576 |
throw new ProfitMandiBusinessException("SchemeId", searchScheme, "SchemeId Not Found");
|
576 |
throw new ProfitMandiBusinessException("SchemeId", searchScheme, "SchemeId Not Found");
|
| 577 |
}
|
577 |
}
|
| 578 |
} else if (searchModel > 0) {
|
578 |
} else if (searchModel > 0) {
|
| 579 |
TagListing tagListing = null;
|
- |
|
| 580 |
Item item = itemRepository.selectAllByCatalogItemId(searchModel).get(0);
|
579 |
Item item = itemRepository.selectAllByCatalogItemId(searchModel).get(0);
|
| 581 |
tagListing = tagListingRepository.selectByItemId(item.getId());
|
580 |
TagListing tagListing = tagListingRepository.selectByItemId(item.getId());
|
| 582 |
model.addAttribute("modelName", item.getItemDescriptionNoColor());
|
- |
|
| 583 |
if (tagListing != null) {
|
581 |
if (tagListing != null) {
|
| 584 |
model.addAttribute("dp", tagListing.getSellingPrice());
|
582 |
model.addAttribute("dp", tagListing.getSellingPrice());
|
| 585 |
model.addAttribute("mop", tagListing.getMop());
|
583 |
model.addAttribute("mop", tagListing.getMop());
|
| 586 |
}
|
584 |
}
|
| - |
|
585 |
model.addAttribute("modelName", item.getItemDescriptionNoColor());
|
| - |
|
586 |
if (isAdmin) {
|
| 587 |
schemes = schemeService.selectSchemeByPartnerType(partnerType, date, searchModel, isAdmin, offset, limit)
|
587 |
schemes = schemeService.selectSchemeByPartnerType(partnerType, date, searchModel, isAdmin, offset, limit)
|
| 588 |
.stream().filter(x -> {
|
588 |
.stream().filter(x -> {
|
| 589 |
return (x.getId() != 411 && x.getId() != 612) || date1.isBefore(LocalDate.of(2021, 12, 1));
|
589 |
return (x.getId() != 411 && x.getId() != 612) || date1.isBefore(LocalDate.of(2021, 12, 1));
|
| 590 |
}).collect(Collectors.toList());
|
590 |
}).collect(Collectors.toList());
|
| 591 |
// Remove 411 and 612
|
591 |
// Remove 411 and 612
|
| 592 |
this.setSchemeAmountModel(schemes);
|
592 |
this.setSchemeAmountModel(schemes);
|
| 593 |
model.addAttribute("schemes", schemes);
|
593 |
model.addAttribute("schemes", schemes);
|
| 594 |
// For 7720(HR) remove investment
|
594 |
// For 7720(HR) remove investment
|
| 595 |
//int nlc = this.getNlc(item, loginDetails.getFofoId(), schemes, tagListing, searchModel);
|
595 |
//int nlc = this.getNlc(item, loginDetails.getFofoId(), schemes, tagListing, searchModel);
|
| 596 |
//model.addAttribute("nlc", Math.round(nlc));
|
596 |
//model.addAttribute("nlc", Math.round(nlc));
|
| 597 |
return "schemes";
|
597 |
return "schemes";
|
| - |
|
598 |
} else {
|
| - |
|
599 |
partnerType = partnerTypeChangeService.getTypeOnDate(loginDetails.getFofoId(), date);
|
| - |
|
600 |
schemes = schemeService.selectSchemeByPartnerType(partnerType, date, searchModel, isAdmin, offset, limit)
|
| - |
|
601 |
.stream().filter(x -> {
|
| - |
|
602 |
return (x.getId() != 411 && x.getId() != 612) || date1.isBefore(LocalDate.of(2021, 12, 1));
|
| - |
|
603 |
}).collect(Collectors.toList());
|
| - |
|
604 |
// Remove 411 and 612
|
| - |
|
605 |
//this.setSchemeAmountModel(schemes);
|
| - |
|
606 |
int nlc = this.getNlc(item, loginDetails.getFofoId(), schemes, tagListing);
|
| - |
|
607 |
// For 7720(HR) remove investment
|
| - |
|
608 |
model.addAttribute("schemes", schemes);
|
| - |
|
609 |
model.addAttribute("nlc", Math.round(nlc));
|
| - |
|
610 |
model.addAttribute("fofoId", loginDetails.getFofoId());
|
| - |
|
611 |
return "schemes-partner";
|
| - |
|
612 |
|
| - |
|
613 |
}
|
| 598 |
|
614 |
|
| 599 |
} else if (org.apache.commons.lang3.StringUtils.isNotEmpty(searchImei)) {
|
615 |
} else if (org.apache.commons.lang3.StringUtils.isNotEmpty(searchImei)) {
|
| 600 |
|
616 |
|
| 601 |
LOGGER.info("searchImei" + searchImei);
|
617 |
LOGGER.info("searchImei" + searchImei);
|
| 602 |
|
618 |
|
| Line 627... |
Line 643... |
| 627 |
}
|
643 |
}
|
| 628 |
|
644 |
|
| 629 |
schemeMap = schemes.stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
|
645 |
schemeMap = schemes.stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
|
| 630 |
}
|
646 |
}
|
| 631 |
}
|
647 |
}
|
| 632 |
|
- |
|
| - |
|
648 |
model.addAttribute("fofoId", loginDetails.getFofoId());
|
| 633 |
model.addAttribute("schemeMap", schemeMap);
|
649 |
model.addAttribute("schemeMap", schemeMap);
|
| 634 |
model.addAttribute("item", item);
|
650 |
model.addAttribute("item", item);
|
| 635 |
model.addAttribute("schemeInOut", schemeInOut);
|
651 |
model.addAttribute("schemeInOut", schemeInOut);
|
| 636 |
return "schemes-partner";
|
652 |
return "schemes-partner";
|
| 637 |
}
|
653 |
}
|
| Line 681... |
Line 697... |
| 681 |
return "schemes-partner";
|
697 |
return "schemes-partner";
|
| 682 |
}
|
698 |
}
|
| 683 |
|
699 |
|
| 684 |
}
|
700 |
}
|
| 685 |
|
701 |
|
| 686 |
private int getNlc(Item item, int fofoId, List<Scheme> schemes, TagListing tagListing, int itemId)
|
702 |
private int getNlc(Item item, int fofoId, List<Scheme> schemes, TagListing tagListing)
|
| 687 |
throws ProfitMandiBusinessException {
|
703 |
throws ProfitMandiBusinessException {
|
| 688 |
|
- |
|
| - |
|
704 |
int itemId = item.getId();
|
| 689 |
if (item.getBrand().equals("Vivo") && fofoStoreRepository.getWarehousePartnerMap().get(7720).stream()
|
705 |
if (item.getBrand().equals("Vivo") && fofoStoreRepository.getWarehousePartnerMap().get(7720).stream()
|
| 690 |
.filter(x -> x.getId() == fofoId).count() > 0) {
|
706 |
.filter(x -> x.getId() == fofoId).count() > 0) {
|
| 691 |
schemes = schemes.stream().filter(x -> !x.getType().equals(SchemeType.INVESTMENT))
|
707 |
schemes = schemes.stream().filter(x -> !x.getType().equals(SchemeType.INVESTMENT))
|
| 692 |
.collect(Collectors.toList());
|
708 |
.collect(Collectors.toList());
|
| 693 |
}
|
709 |
}
|
| Line 743... |
Line 759... |
| 743 |
List<LastMonthCreditedIncomeModel> lastMonthPurchaseInMargins = schemeInOutRepository
|
759 |
List<LastMonthCreditedIncomeModel> lastMonthPurchaseInMargins = schemeInOutRepository
|
| 744 |
.selectLastMonthPurchaseInMarginByFofoId(loginDetails.getFofoId(), currentStartMonth, currentDate);
|
760 |
.selectLastMonthPurchaseInMarginByFofoId(loginDetails.getFofoId(), currentStartMonth, currentDate);
|
| 745 |
|
761 |
|
| 746 |
List<LastMonthCreditedIncomeModel> lastMonthFrontEndIncomes = schemeInOutRepository
|
762 |
List<LastMonthCreditedIncomeModel> lastMonthFrontEndIncomes = schemeInOutRepository
|
| 747 |
.selectFrontIncomeByBrand(loginDetails.getFofoId(), currentStartMonth, currentDate);
|
763 |
.selectFrontIncomeByBrand(loginDetails.getFofoId(), currentStartMonth, currentDate);
|
| 748 |
|
- |
|
| 749 |
|
- |
|
| 750 |
Map<String,LastMonthCreditedIncomeModel>lastMonthPendingIncomeMap = schemeInOutRepository
|
- |
|
| 751 |
.selectLastMonthPendingIncomeByFofoId(loginDetails.getFofoId(), currentStartMonth, currentDate).stream().collect(Collectors.toMap(x-> x.getBrand(), x-> x));
|
- |
|
| 752 |
|
764 |
|
| - |
|
765 |
|
| - |
|
766 |
Map<String, LastMonthCreditedIncomeModel> lastMonthPendingIncomeMap = schemeInOutRepository
|
| - |
|
767 |
.selectLastMonthPendingIncomeByFofoId(loginDetails.getFofoId(), currentStartMonth, currentDate).stream().collect(Collectors.toMap(x -> x.getBrand(), x -> x));
|
| - |
|
768 |
|
| 753 |
|
769 |
|
| 754 |
LOGGER.info("lastMonthCreditedIncomeModels" + lastMonthCreditedIncomeModels);
|
770 |
LOGGER.info("lastMonthCreditedIncomeModels" + lastMonthCreditedIncomeModels);
|
| 755 |
LOGGER.info("lastMonthFrontEndIncomes" + lastMonthFrontEndIncomes);
|
771 |
LOGGER.info("lastMonthFrontEndIncomes" + lastMonthFrontEndIncomes);
|
| 756 |
LOGGER.info("lastMonthPurchaseInMargins" + lastMonthPurchaseInMargins);
|
772 |
LOGGER.info("lastMonthPurchaseInMargins" + lastMonthPurchaseInMargins);
|
| 757 |
LOGGER.info("lastMonthCategoryUpgradeMarginMap" + lastMonthCategoryUpgradeMarginMap);
|
773 |
LOGGER.info("lastMonthCategoryUpgradeMarginMap" + lastMonthCategoryUpgradeMarginMap);
|
| 758 |
|
774 |
|
| Line 789... |
Line 805... |
| 789 |
totalAmountMap.put(brand, 0f);
|
805 |
totalAmountMap.put(brand, 0f);
|
| 790 |
}
|
806 |
}
|
| 791 |
totalAmountMap.put(brand, totalAmountMap.get(brand) + amount);
|
807 |
totalAmountMap.put(brand, totalAmountMap.get(brand) + amount);
|
| 792 |
|
808 |
|
| 793 |
});
|
809 |
});
|
| 794 |
|
810 |
|
| 795 |
lastMonthPendingIncomeMap.entrySet().stream().forEach(x -> {
|
811 |
lastMonthPendingIncomeMap.entrySet().stream().forEach(x -> {
|
| 796 |
String brand = x.getKey();
|
812 |
String brand = x.getKey();
|
| 797 |
float amount = x.getValue().getAmount();
|
813 |
float amount = x.getValue().getAmount();
|
| 798 |
if (!totalAmountMap.containsKey(brand)) {
|
814 |
if (!totalAmountMap.containsKey(brand)) {
|
| 799 |
totalAmountMap.put(brand, 0f);
|
815 |
totalAmountMap.put(brand, 0f);
|
| Line 870... |
Line 886... |
| 870 |
.selectLastMonthFrontEndImei(loginDetails.getFofoId(), catalogItemId, lastMonthStart, currentMonthEnd);
|
886 |
.selectLastMonthFrontEndImei(loginDetails.getFofoId(), catalogItemId, lastMonthStart, currentMonthEnd);
|
| 871 |
List<LastMonthImeiModel> lmpi = schemeInOutRepository.selectLastMonthPurchaseInImei(loginDetails.getFofoId(),
|
887 |
List<LastMonthImeiModel> lmpi = schemeInOutRepository.selectLastMonthPurchaseInImei(loginDetails.getFofoId(),
|
| 872 |
catalogItemId, lastMonthStart, currentMonthEnd);
|
888 |
catalogItemId, lastMonthStart, currentMonthEnd);
|
| 873 |
List<LastMonthImeiModel> lmci = schemeInOutRepository.selectLastMonthCreditedImei(loginDetails.getFofoId(),
|
889 |
List<LastMonthImeiModel> lmci = schemeInOutRepository.selectLastMonthCreditedImei(loginDetails.getFofoId(),
|
| 874 |
catalogItemId, lastMonthStart, currentMonthEnd);
|
890 |
catalogItemId, lastMonthStart, currentMonthEnd);
|
| 875 |
|
891 |
|
| 876 |
LOGGER.info("lmci {}", lmci);
|
892 |
LOGGER.info("lmci {}", lmci);
|
| 877 |
|
893 |
|
| 878 |
Map<String, Double> lastmonthCategoryUpgradeMargin = schemeInOutRepository
|
894 |
Map<String, Double> lastmonthCategoryUpgradeMargin = schemeInOutRepository
|
| 879 |
.selectLastMonthCategoryUpgradeMarginByImei(loginDetails.getFofoId(), catalogItemId, lastMonthStart,
|
895 |
.selectLastMonthCategoryUpgradeMarginByImei(loginDetails.getFofoId(), catalogItemId, lastMonthStart,
|
| 880 |
currentMonthEnd)
|
896 |
currentMonthEnd)
|
| Line 886... |
Line 902... |
| 886 |
|
902 |
|
| 887 |
List<String> allImeiList = new ArrayList<>(allImeiSet);
|
903 |
List<String> allImeiList = new ArrayList<>(allImeiSet);
|
| 888 |
|
904 |
|
| 889 |
LOGGER.info("allImeiList" + allImeiList);
|
905 |
LOGGER.info("allImeiList" + allImeiList);
|
| 890 |
LOGGER.info("lmcm" + lastmonthCategoryUpgradeMargin);
|
906 |
LOGGER.info("lmcm" + lastmonthCategoryUpgradeMargin);
|
| 891 |
|
907 |
|
| 892 |
List<LastMonthFrontEndImeiModel> lastMonthFrontEndImeis = schemeInOutRepository
|
908 |
List<LastMonthFrontEndImeiModel> lastMonthFrontEndImeis = schemeInOutRepository
|
| 893 |
.selectLastMonthFrontEndByImei(loginDetails.getFofoId(), allImeiList);
|
909 |
.selectLastMonthFrontEndByImei(loginDetails.getFofoId(), allImeiList);
|
| 894 |
List<LastMonthImeiModel> lastMonthPurchaseInImeis = schemeInOutRepository
|
910 |
List<LastMonthImeiModel> lastMonthPurchaseInImeis = schemeInOutRepository
|
| 895 |
.selectLastMonthPurchaseInByImei(loginDetails.getFofoId(), allImeiList);
|
911 |
.selectLastMonthPurchaseInByImei(loginDetails.getFofoId(), allImeiList);
|
| 896 |
List<LastMonthImeiModel> lastMonthCreditedImeis = schemeInOutRepository
|
912 |
List<LastMonthImeiModel> lastMonthCreditedImeis = schemeInOutRepository
|
| 897 |
.selectLastMonthCreditedByImei(loginDetails.getFofoId(), allImeiList);
|
913 |
.selectLastMonthCreditedByImei(loginDetails.getFofoId(), allImeiList);
|
| 898 |
|
914 |
|
| 899 |
|
915 |
|
| 900 |
LOGGER.info("lastMonthFrontEndImei {}", lastMonthFrontEndImeis);
|
916 |
LOGGER.info("lastMonthFrontEndImei {}", lastMonthFrontEndImeis);
|
| 901 |
LOGGER.info("lastMonthPurchaseInImei {}", lastMonthPurchaseInImeis);
|
917 |
LOGGER.info("lastMonthPurchaseInImei {}", lastMonthPurchaseInImeis);
|
| 902 |
LOGGER.info("lastMonthCreditedImei {}", lastMonthCreditedImeis);
|
918 |
LOGGER.info("lastMonthCreditedImei {}", lastMonthCreditedImeis);
|
| 903 |
|
919 |
|
| 904 |
Map<String, Float> imeiWisePendingSaleAmount = lastMonthCreditedImeis.stream().filter(x->x.getStatus().equals(SchemePayoutStatus.PENDING) ).collect(Collectors.toMap(x->x.getImei(), x->x.getPendingSaleAmount()));
|
920 |
Map<String, Float> imeiWisePendingSaleAmount = lastMonthCreditedImeis.stream().filter(x -> x.getStatus().equals(SchemePayoutStatus.PENDING)).collect(Collectors.toMap(x -> x.getImei(), x -> x.getPendingSaleAmount()));
|
| 905 |
|
921 |
|
| 906 |
|
922 |
|
| 907 |
Map<IncomeImeiDate, Map<String, Double>> lastMonthPurchaseInMapPairMap = lastMonthPurchaseInImeis.stream()
|
923 |
Map<IncomeImeiDate, Map<String, Double>> lastMonthPurchaseInMapPairMap = lastMonthPurchaseInImeis.stream()
|
| 908 |
.collect(Collectors.groupingBy(x -> new IncomeImeiDate(x.getImei(), x.getCreateTimeStamp()),
|
924 |
.collect(Collectors.groupingBy(x -> new IncomeImeiDate(x.getImei(), x.getCreateTimeStamp()),
|
| 909 |
Collectors.groupingBy(x -> x.getDescription(), Collectors.summingDouble(x -> x.getAmount()))));
|
925 |
Collectors.groupingBy(x -> x.getDescription(), Collectors.summingDouble(x -> x.getAmount()))));
|
| 910 |
|
926 |
|
| 911 |
Map<IncomeImeiDate, Map<String, Double>> lastMonthCreditedMapPairMap = lastMonthCreditedImeis.stream()
|
927 |
Map<IncomeImeiDate, Map<String, Double>> lastMonthCreditedMapPairMap = lastMonthCreditedImeis.stream()
|
| Line 915... |
Line 931... |
| 915 |
purchaseSet.addAll(lastMonthPurchaseInImeis.stream().map(x -> x.getDescription()).collect(Collectors.toList()));
|
931 |
purchaseSet.addAll(lastMonthPurchaseInImeis.stream().map(x -> x.getDescription()).collect(Collectors.toList()));
|
| 916 |
saleSet.addAll(lastMonthCreditedImeis.stream().map(x -> x.getDescription()).collect(Collectors.toList()));
|
932 |
saleSet.addAll(lastMonthCreditedImeis.stream().map(x -> x.getDescription()).collect(Collectors.toList()));
|
| 917 |
|
933 |
|
| 918 |
List<String> purchaseList = new ArrayList<>(purchaseSet);
|
934 |
List<String> purchaseList = new ArrayList<>(purchaseSet);
|
| 919 |
List<String> saleList = new ArrayList<>(saleSet);
|
935 |
List<String> saleList = new ArrayList<>(saleSet);
|
| 920 |
|
936 |
|
| 921 |
Map<IncomeImeiDate, ImeiWiseIncomePairAndMapModel> imeiWiseIncomeMapOfMap = new HashMap<>();
|
937 |
Map<IncomeImeiDate, ImeiWiseIncomePairAndMapModel> imeiWiseIncomeMapOfMap = new HashMap<>();
|
| 922 |
|
938 |
|
| 923 |
for (Map.Entry<IncomeImeiDate, Map<String, Double>> entry : lastMonthPurchaseInMapPairMap.entrySet()) {
|
939 |
for (Map.Entry<IncomeImeiDate, Map<String, Double>> entry : lastMonthPurchaseInMapPairMap.entrySet()) {
|
| 924 |
|
940 |
|
| 925 |
IncomeImeiDate imeiDate = entry.getKey();
|
941 |
IncomeImeiDate imeiDate = entry.getKey();
|
| 926 |
Map<String, Double> descriptionAmountMap = entry.getValue();
|
942 |
Map<String, Double> descriptionAmountMap = entry.getValue();
|
| 927 |
|
943 |
|
| Line 1000... |
Line 1016... |
| 1000 |
return "last-month-imei-wise-income";
|
1016 |
return "last-month-imei-wise-income";
|
| 1001 |
}
|
1017 |
}
|
| 1002 |
|
1018 |
|
| 1003 |
@RequestMapping(value = "/brandWiseIncome", method = RequestMethod.GET)
|
1019 |
@RequestMapping(value = "/brandWiseIncome", method = RequestMethod.GET)
|
| 1004 |
public String getBrandWiseIncome(HttpServletRequest request,
|
1020 |
public String getBrandWiseIncome(HttpServletRequest request,
|
| 1005 |
@RequestParam(name = "brand", required = false, defaultValue = "") String brand,
|
1021 |
@RequestParam(name = "brand", required = false, defaultValue = "") String brand,
|
| 1006 |
@RequestParam(name = "status", required = false, defaultValue = "") String status,
|
1022 |
@RequestParam(name = "status", required = false, defaultValue = "") String status,
|
| 1007 |
@RequestParam(name = "month", required = false, defaultValue = "") int month, Model model)
|
1023 |
@RequestParam(name = "month", required = false, defaultValue = "") int month, Model model)
|
| 1008 |
throws ProfitMandiBusinessException {
|
1024 |
throws ProfitMandiBusinessException {
|
| 1009 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
1025 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 1010 |
LOGGER.info("loginDetails {}", loginDetails);
|
1026 |
LOGGER.info("loginDetails {}", loginDetails);
|
| 1011 |
LOGGER.info("brand" + brand);
|
1027 |
LOGGER.info("brand" + brand);
|
| 1012 |
LOGGER.info("month {}", month);
|
1028 |
LOGGER.info("month {}", month);
|
| Line 1031... |
Line 1047... |
| 1031 |
currentMonthEnd)
|
1047 |
currentMonthEnd)
|
| 1032 |
.stream().collect(Collectors.toMap(x -> x.getBrand(), x -> x.getAmount()));
|
1048 |
.stream().collect(Collectors.toMap(x -> x.getBrand(), x -> x.getAmount()));
|
| 1033 |
}
|
1049 |
}
|
| 1034 |
LOGGER.info("partnerType {}", partnerType);
|
1050 |
LOGGER.info("partnerType {}", partnerType);
|
| 1035 |
LOGGER.info("categoryUpradeBrandModelMap {}", categoryUpradeBrandModelMap);
|
1051 |
LOGGER.info("categoryUpradeBrandModelMap {}", categoryUpradeBrandModelMap);
|
| 1036 |
|
1052 |
|
| 1037 |
|
1053 |
|
| 1038 |
lastMonthModelWiseIncomes = schemeInOutRepository.selectLastMonthBrandWiseIncome(loginDetails.getFofoId(),
|
1054 |
lastMonthModelWiseIncomes = schemeInOutRepository.selectLastMonthBrandWiseIncome(loginDetails.getFofoId(),
|
| 1039 |
brand, lastMonthStart, currentMonthEnd);
|
1055 |
brand, lastMonthStart, currentMonthEnd);
|
| 1040 |
modelWiseFrontIncomes = schemeInOutRepository.selectFrontIncomeBrandWise(loginDetails.getFofoId(), brand,
|
1056 |
modelWiseFrontIncomes = schemeInOutRepository.selectFrontIncomeBrandWise(loginDetails.getFofoId(), brand,
|
| 1041 |
lastMonthStart, currentMonthEnd);
|
1057 |
lastMonthStart, currentMonthEnd);
|
| 1042 |
purchaseInModelWiseIncomes = schemeInOutRepository.selectLastMonthPurchaseBrandWiseIncome(
|
1058 |
purchaseInModelWiseIncomes = schemeInOutRepository.selectLastMonthPurchaseBrandWiseIncome(
|
| 1043 |
loginDetails.getFofoId(), brand, lastMonthStart, currentMonthEnd);
|
1059 |
loginDetails.getFofoId(), brand, lastMonthStart, currentMonthEnd);
|
| 1044 |
|
1060 |
|
| 1045 |
LOGGER.info("modelWiseFrontIncomes {}", modelWiseFrontIncomes);
|
1061 |
LOGGER.info("modelWiseFrontIncomes {}", modelWiseFrontIncomes);
|
| 1046 |
LOGGER.info("lastMonthModelWiseIncomes {}", lastMonthModelWiseIncomes);
|
1062 |
LOGGER.info("lastMonthModelWiseIncomes {}", lastMonthModelWiseIncomes);
|
| 1047 |
LOGGER.info("purchaseInModelWiseIncomes {}", purchaseInModelWiseIncomes);
|
1063 |
LOGGER.info("purchaseInModelWiseIncomes {}", purchaseInModelWiseIncomes);
|
| 1048 |
Map<String, LastMonthBrandWiseIncomeModel> modelWiseMap = lastMonthModelWiseIncomes.stream()
|
1064 |
Map<String, LastMonthBrandWiseIncomeModel> modelWiseMap = lastMonthModelWiseIncomes.stream()
|
| 1049 |
.collect(Collectors.toMap(x -> x.getModelNumber(), x -> x));
|
1065 |
.collect(Collectors.toMap(x -> x.getModelNumber(), x -> x));
|
| 1050 |
|
1066 |
|
| 1051 |
|
1067 |
|
| 1052 |
LOGGER.info("modelWiseMap1" + modelWiseMap );
|
1068 |
LOGGER.info("modelWiseMap1" + modelWiseMap);
|
| 1053 |
Map<String, LastMonthBrandWiseIncomeModel> purchaseWiseMap = purchaseInModelWiseIncomes.stream()
|
1069 |
Map<String, LastMonthBrandWiseIncomeModel> purchaseWiseMap = purchaseInModelWiseIncomes.stream()
|
| 1054 |
.collect(Collectors.toMap(x -> x.getModelNumber(), x -> x));
|
1070 |
.collect(Collectors.toMap(x -> x.getModelNumber(), x -> x));
|
| 1055 |
|
1071 |
|
| 1056 |
Map<String, Double> modelWiseTotalAmount = new HashMap<>();
|
1072 |
Map<String, Double> modelWiseTotalAmount = new HashMap<>();
|
| 1057 |
|
1073 |
|
| 1058 |
modelWiseFrontIncomes.stream().forEach(x -> {
|
1074 |
modelWiseFrontIncomes.stream().forEach(x -> {
|
| 1059 |
LastMonthBrandWiseIncomeModel lmbwi = modelWiseMap.get(x.getModelNumber());
|
1075 |
LastMonthBrandWiseIncomeModel lmbwi = modelWiseMap.get(x.getModelNumber());
|
| 1060 |
if (modelWiseMap.containsKey(x.getModelNumber())) {
|
1076 |
if (modelWiseMap.containsKey(x.getModelNumber())) {
|
| 1061 |
|
1077 |
|
| 1062 |
|
1078 |
|
| 1063 |
lmbwi.setAmount(x.getAmount() + lmbwi.getAmount());
|
1079 |
lmbwi.setAmount(x.getAmount() + lmbwi.getAmount());
|
| 1064 |
|
1080 |
|
| 1065 |
modelWiseMap.put(x.getModelNumber(), lmbwi);
|
1081 |
modelWiseMap.put(x.getModelNumber(), lmbwi);
|
| 1066 |
}
|
- |
|
| 1067 |
else {
|
1082 |
} else {
|
| 1068 |
LastMonthBrandWiseIncomeModel lmbwIncomeModel = new LastMonthBrandWiseIncomeModel();
|
1083 |
LastMonthBrandWiseIncomeModel lmbwIncomeModel = new LastMonthBrandWiseIncomeModel();
|
| 1069 |
lmbwIncomeModel.setAmount(x.getAmount());
|
1084 |
lmbwIncomeModel.setAmount(x.getAmount());
|
| 1070 |
lmbwIncomeModel.setModelName(x.getModelName());
|
1085 |
lmbwIncomeModel.setModelName(x.getModelName());
|
| 1071 |
lmbwIncomeModel.setModelNumber(x.getModelNumber());
|
1086 |
lmbwIncomeModel.setModelNumber(x.getModelNumber());
|
| 1072 |
lmbwIncomeModel.setBrand(x.getBrand());
|
1087 |
lmbwIncomeModel.setBrand(x.getBrand());
|
| Line 1074... |
Line 1089... |
| 1074 |
lmbwIncomeModel.setPendingSaleAmount(x.getPendingSaleAmount());
|
1089 |
lmbwIncomeModel.setPendingSaleAmount(x.getPendingSaleAmount());
|
| 1075 |
lmbwIncomeModel.setQty(x.getQty());
|
1090 |
lmbwIncomeModel.setQty(x.getQty());
|
| 1076 |
lmbwIncomeModel.setStatus(SchemePayoutStatus.CREDITED);
|
1091 |
lmbwIncomeModel.setStatus(SchemePayoutStatus.CREDITED);
|
| 1077 |
modelWiseMap.put(lmbwIncomeModel.getModelNumber(), lmbwIncomeModel);
|
1092 |
modelWiseMap.put(lmbwIncomeModel.getModelNumber(), lmbwIncomeModel);
|
| 1078 |
}
|
1093 |
}
|
| 1079 |
|
1094 |
|
| 1080 |
if (modelWiseTotalAmount.containsKey(x.getModelNumber())) {
|
1095 |
if (modelWiseTotalAmount.containsKey(x.getModelNumber())) {
|
| 1081 |
|
1096 |
|
| 1082 |
double amount = x.getAmount() + modelWiseTotalAmount.get(x.getModelNumber());
|
1097 |
double amount = x.getAmount() + modelWiseTotalAmount.get(x.getModelNumber());
|
| 1083 |
modelWiseTotalAmount.put(x.getModelNumber(), amount);
|
1098 |
modelWiseTotalAmount.put(x.getModelNumber(), amount);
|
| 1084 |
} else {
|
1099 |
} else {
|
| 1085 |
|
1100 |
|
| 1086 |
double amount = modelWiseMap.get(x.getModelNumber()).getAmount();
|
1101 |
double amount = modelWiseMap.get(x.getModelNumber()).getAmount();
|
| 1087 |
modelWiseTotalAmount.put(x.getModelNumber(), amount);
|
1102 |
modelWiseTotalAmount.put(x.getModelNumber(), amount);
|
| 1088 |
}
|
1103 |
}
|
| 1089 |
});
|
1104 |
});
|
| 1090 |
|
1105 |
|
| 1091 |
for (LastMonthBrandWiseIncomeModel pmi : purchaseInModelWiseIncomes) {
|
1106 |
for (LastMonthBrandWiseIncomeModel pmi : purchaseInModelWiseIncomes) {
|
| 1092 |
|
1107 |
|
| 1093 |
if (!modelWiseMap.containsKey(pmi.getModelNumber())) {
|
1108 |
if (!modelWiseMap.containsKey(pmi.getModelNumber())) {
|
| 1094 |
modelWiseMap.put(pmi.getModelNumber(), null);
|
1109 |
modelWiseMap.put(pmi.getModelNumber(), null);
|
| 1095 |
}
|
1110 |
}
|
| Line 1100... |
Line 1115... |
| 1100 |
} else {
|
1115 |
} else {
|
| 1101 |
modelWiseTotalAmount.put(pmi.getModelNumber(), pmi.getAmount());
|
1116 |
modelWiseTotalAmount.put(pmi.getModelNumber(), pmi.getAmount());
|
| 1102 |
}
|
1117 |
}
|
| 1103 |
|
1118 |
|
| 1104 |
}
|
1119 |
}
|
| 1105 |
LOGGER.info("modelWiseTotalAmount" + modelWiseTotalAmount );
|
1120 |
LOGGER.info("modelWiseTotalAmount" + modelWiseTotalAmount);
|
| 1106 |
|
1121 |
|
| 1107 |
lastMonthModelWiseIncomes.stream().filter(x->x.getStatus().equals(SchemePayoutStatus.PENDING) && x.getPendingSaleAmount() != 0.0).forEach(x-> {
|
1122 |
lastMonthModelWiseIncomes.stream().filter(x -> x.getStatus().equals(SchemePayoutStatus.PENDING) && x.getPendingSaleAmount() != 0.0).forEach(x -> {
|
| 1108 |
|
1123 |
|
| 1109 |
if(modelWiseTotalAmount.containsKey(x.getModelNumber()))
|
1124 |
if (modelWiseTotalAmount.containsKey(x.getModelNumber())) {
|
| 1110 |
{
|
- |
|
| 1111 |
double amount = modelWiseTotalAmount.get(x.getModelNumber()) + x.getPendingSaleAmount();
|
1125 |
double amount = modelWiseTotalAmount.get(x.getModelNumber()) + x.getPendingSaleAmount();
|
| 1112 |
modelWiseTotalAmount.put(x.getModelNumber(), amount);
|
1126 |
modelWiseTotalAmount.put(x.getModelNumber(), amount);
|
| 1113 |
|
1127 |
|
| 1114 |
LOGGER.info("modelWiseTotalAmoun111t" + amount );
|
1128 |
LOGGER.info("modelWiseTotalAmoun111t" + amount);
|
| 1115 |
}
|
- |
|
| 1116 |
else {
|
1129 |
} else {
|
| 1117 |
LOGGER.info("modelWiseTotalAmou2222t" + x.getPendingSaleAmount() );
|
1130 |
LOGGER.info("modelWiseTotalAmou2222t" + x.getPendingSaleAmount());
|
| 1118 |
modelWiseTotalAmount.put(x.getModelNumber(), x.getPendingSaleAmount());
|
1131 |
modelWiseTotalAmount.put(x.getModelNumber(), x.getPendingSaleAmount());
|
| 1119 |
}
|
1132 |
}
|
| 1120 |
|
1133 |
|
| 1121 |
});
|
1134 |
});
|
| 1122 |
LOGGER.info("modelWiseMap" + modelWiseMap );
|
1135 |
LOGGER.info("modelWiseMap" + modelWiseMap);
|
| 1123 |
|
1136 |
|
| 1124 |
model.addAttribute("purchaseWiseMap", purchaseWiseMap);
|
1137 |
model.addAttribute("purchaseWiseMap", purchaseWiseMap);
|
| 1125 |
model.addAttribute("categoryUpradeBrandModelMap", categoryUpradeBrandModelMap);
|
1138 |
model.addAttribute("categoryUpradeBrandModelMap", categoryUpradeBrandModelMap);
|
| 1126 |
model.addAttribute("modelWiseMap", modelWiseMap);
|
1139 |
model.addAttribute("modelWiseMap", modelWiseMap);
|
| 1127 |
model.addAttribute("modelWiseTotalAmount", modelWiseTotalAmount);
|
1140 |
model.addAttribute("modelWiseTotalAmount", modelWiseTotalAmount);
|
| 1128 |
|
1141 |
|
| 1129 |
return "montly-brand-wise-income";
|
1142 |
return "montly-brand-wise-income";
|
| 1130 |
|
1143 |
|
| 1131 |
}
|
1144 |
}
|
| 1132 |
|
1145 |
|