| Line 338... |
Line 338... |
| 338 |
|
338 |
|
| 339 |
params.put("type", "INVESTMENT");
|
339 |
params.put("type", "INVESTMENT");
|
| 340 |
|
340 |
|
| 341 |
List<EvaluateSchemeInvestmentPayoutModel> evaluateSchemeInvestmentPayouts = reporticoService.getReports(
|
341 |
List<EvaluateSchemeInvestmentPayoutModel> evaluateSchemeInvestmentPayouts = reporticoService.getReports(
|
| 342 |
EvaluateSchemeInvestmentPayoutModel.class, ReporticoProject.FOCO, "schemepayout.xml", params);
|
342 |
EvaluateSchemeInvestmentPayoutModel.class, ReporticoProject.FOCO, "schemepayout.xml", params);
|
| 343 |
LOGGER.info("reportResponse {}", evaluateSchemeInvestmentPayouts);
|
- |
|
| 344 |
|
343 |
|
| 345 |
int referenceId = Integer.parseInt(FormattingUtils.getYearMonth(startOfPreviousMonth.atStartOfDay()));
|
344 |
int referenceId = Integer.parseInt(FormattingUtils.getYearMonth(startOfPreviousMonth.atStartOfDay()));
|
| 346 |
List<PartnerDailyInvestment> partnerDailyInvestments = partnerDailyInvestmentRepository
|
345 |
List<PartnerDailyInvestment> partnerDailyInvestments = partnerDailyInvestmentRepository
|
| 347 |
.selectAll(startOfPreviousMonth, lastOfPreviousMonth);
|
346 |
.selectAll(startOfPreviousMonth, lastOfPreviousMonth);
|
| 348 |
Map<Integer, Long> investmentMaintainedDaysMap = partnerDailyInvestments.stream()
|
347 |
Map<Integer, Long> investmentMaintainedDaysMap = partnerDailyInvestments.stream()
|
| Line 354... |
Line 353... |
| 354 |
long investmentMaintainedDays = investmentMaintainedDaysMap.get(esip.getFofoId()) == null ? 0
|
353 |
long investmentMaintainedDays = investmentMaintainedDaysMap.get(esip.getFofoId()) == null ? 0
|
| 355 |
: investmentMaintainedDaysMap.get(esip.getFofoId());
|
354 |
: investmentMaintainedDaysMap.get(esip.getFofoId());
|
| 356 |
|
355 |
|
| 357 |
esip.setInvestmentDays(investmentMaintainedDays);
|
356 |
esip.setInvestmentDays(investmentMaintainedDays);
|
| 358 |
|
357 |
|
| 359 |
float processAmount = esip.getPaidAmount() / 2;
|
358 |
float processAmount = esip.getProcessAmount();
|
| - |
|
359 |
if (investmentMaintainedDays < 8) {
|
| - |
|
360 |
processAmount = 0;
|
| - |
|
361 |
} else if (investmentMaintainedDays < 12) {
|
| - |
|
362 |
processAmount = processAmount / 2;
|
| - |
|
363 |
}
|
| 360 |
|
364 |
|
| 361 |
esip.setProcessAmount(processAmount);
|
365 |
esip.setProcessAmount(processAmount);
|
| 362 |
|
366 |
|
| 363 |
rows.add(Arrays.asList(esip.getCode(), esip.getStoreName(), esip.getFofoId(), esip.getItemId(),
|
367 |
rows.add(Arrays.asList(esip.getCode(), esip.getStoreName(), esip.getFofoId(), esip.getItemId(),
|
| 364 |
esip.getBrand(), esip.getModelName(), esip.getModelNumber(), esip.getColor(), esip.getSchemeInDp(),
|
368 |
esip.getBrand(), esip.getModelName(), esip.getModelNumber(), esip.getColor(), esip.getSchemeInDp(),
|
| Line 952... |
Line 956... |
| 952 |
LOGGER.info("allImeiList" + allImeiList);
|
956 |
LOGGER.info("allImeiList" + allImeiList);
|
| 953 |
LOGGER.info("lmcm" + lastmonthCategoryUpgradeMargin);
|
957 |
LOGGER.info("lmcm" + lastmonthCategoryUpgradeMargin);
|
| 954 |
|
958 |
|
| 955 |
List<LastMonthFrontEndImeiModel> lastMonthFrontEndImeis = schemeInOutRepository
|
959 |
List<LastMonthFrontEndImeiModel> lastMonthFrontEndImeis = schemeInOutRepository
|
| 956 |
.selectLastMonthFrontEndByImei(loginDetails.getFofoId(), allImeiList);
|
960 |
.selectLastMonthFrontEndByImei(loginDetails.getFofoId(), allImeiList);
|
| - |
|
961 |
Map<String, LastMonthFrontEndImeiModel> soldMap = lastMonthFrontEndImeis.stream().collect(Collectors.toMap(x -> x.getImei(), x -> x));
|
| - |
|
962 |
|
| 957 |
|
963 |
|
| 958 |
List<LastMonthImeiModel> lastMonthPurchaseInImeis = schemeInOutRepository
|
964 |
List<LastMonthImeiModel> lastMonthPurchaseInImeis = schemeInOutRepository
|
| 959 |
.selectLastMonthPurchaseInByImei(loginDetails.getFofoId(), allImeiList);
|
965 |
.selectLastMonthPurchaseInByImei(loginDetails.getFofoId(), allImeiList);
|
| 960 |
|
966 |
|
| 961 |
List<LastMonthImeiModel> lastMonthCreditedImeis = schemeInOutRepository
|
967 |
List<LastMonthImeiModel> lastMonthCreditedImeis = schemeInOutRepository
|
| Line 1024... |
Line 1030... |
| 1024 |
.collect(Collectors.summingDouble(x -> x.getValue()));
|
1030 |
.collect(Collectors.summingDouble(x -> x.getValue()));
|
| 1025 |
imeiWiseIncomeMapOfMap.get(entry.getKey())
|
1031 |
imeiWiseIncomeMapOfMap.get(entry.getKey())
|
| 1026 |
.setTotalIncome(totalAmount + imeiWiseIncomeMapOfMap.get(entry.getKey()).getTotalIncome());
|
1032 |
.setTotalIncome(totalAmount + imeiWiseIncomeMapOfMap.get(entry.getKey()).getTotalIncome());
|
| 1027 |
}
|
1033 |
}
|
| 1028 |
|
1034 |
|
| 1029 |
lastMonthFrontEndImeis.stream().forEach(x -> {
|
1035 |
/*lastMonthFrontEndImeis.stream().forEach(x -> {
|
| 1030 |
if (imeiWiseIncomeMapOfMap.containsKey(x.getImei())) {
|
1036 |
if (imeiWiseIncomeMapOfMap.containsKey(x.getImei())) {
|
| 1031 |
ImeiWiseIncomePairAndMapModel imeiWiseIncomePairAndMapModel = imeiWiseIncomeMapOfMap
|
1037 |
ImeiWiseIncomePairAndMapModel imeiWiseIncomePairAndMapModel = imeiWiseIncomeMapOfMap
|
| 1032 |
.get(x.getImei());
|
1038 |
.get(x.getImei());
|
| 1033 |
imeiWiseIncomePairAndMapModel.setTotalIncome(imeiWiseIncomePairAndMapModel.getTotalIncome() + x.getAmount());
|
1039 |
imeiWiseIncomePairAndMapModel.setTotalIncome(imeiWiseIncomePairAndMapModel.getTotalIncome() + x.getAmount());
|
| 1034 |
imeiWiseIncomePairAndMapModel.setFrontMargin(x.getAmount());
|
1040 |
imeiWiseIncomePairAndMapModel.setFrontMargin(x.getAmount());
|
| 1035 |
}
|
1041 |
}
|
| 1036 |
});
|
1042 |
});*/
|
| 1037 |
|
1043 |
|
| 1038 |
//Imeis for pending activation
|
1044 |
//Imeis for pending activation
|
| 1039 |
lastMonthCreditedImeis.stream().filter(x -> x.getStatus().equals(SchemePayoutStatus.PENDING)).forEach(x -> {
|
1045 |
lastMonthCreditedImeis.stream().filter(x -> x.getStatus().equals(SchemePayoutStatus.PENDING)).forEach(x -> {
|
| 1040 |
if (!imeiWiseIncomeMapOfMap.containsKey(x.getImei())) {
|
1046 |
if (!imeiWiseIncomeMapOfMap.containsKey(x.getImei())) {
|
| 1041 |
ImeiWiseIncomePairAndMapModel imeiWiseIncomePairAndMapModel = new ImeiWiseIncomePairAndMapModel();
|
1047 |
ImeiWiseIncomePairAndMapModel imeiWiseIncomePairAndMapModel = new ImeiWiseIncomePairAndMapModel(x.getImei(), null, null);
|
| 1042 |
imeiWiseIncomePairAndMapModel.setSerialNumber(x.getImei());
|
- |
|
| 1043 |
}
|
1048 |
}
|
| 1044 |
ImeiWiseIncomePairAndMapModel imeiWiseIncomePairAndMapModel = imeiWiseIncomeMapOfMap
|
1049 |
ImeiWiseIncomePairAndMapModel imeiWiseIncomePairAndMapModel = imeiWiseIncomeMapOfMap
|
| 1045 |
.get(x.getImei());
|
1050 |
.get(x.getImei());
|
| 1046 |
imeiWiseIncomePairAndMapModel.setSaleDate(x.getCreateTimeStamp().toLocalDate());
|
1051 |
imeiWiseIncomePairAndMapModel.setSaleDate(x.getCreateTimeStamp().toLocalDate());
|
| 1047 |
imeiWiseIncomePairAndMapModel.setTotalIncome(x.getPendingSaleAmount() + imeiWiseIncomePairAndMapModel.getTotalIncome());
|
1052 |
imeiWiseIncomePairAndMapModel.setTotalIncome(x.getPendingSaleAmount() + imeiWiseIncomePairAndMapModel.getTotalIncome());
|
| 1048 |
});
|
1053 |
});
|
| 1049 |
|
1054 |
|
| - |
|
1055 |
lastMonthFrontEndImeis.stream().forEach(lastMonthFrontEndImeiModel -> {
|
| - |
|
1056 |
if (imeiWiseIncomeMapOfMap.containsKey(lastMonthFrontEndImeiModel.getImei())) {
|
| - |
|
1057 |
lastMonthFrontEndImeiModel.setNlc(lastMonthFrontEndImeiModel.getDp()
|
| - |
|
1058 |
- (float) imeiWiseIncomeMapOfMap.get(lastMonthFrontEndImeiModel.getImei()).getTotalIncome());
|
| - |
|
1059 |
lastMonthFrontEndImeiModel.setNetIncome(lastMonthFrontEndImeiModel.getSellingPrice() - lastMonthFrontEndImeiModel.getNlc());
|
| - |
|
1060 |
}
|
| - |
|
1061 |
});
|
| - |
|
1062 |
|
| 1050 |
model.addAttribute("imeiWisePendingSaleAmount", imeiWisePendingSaleAmount);
|
1063 |
model.addAttribute("imeiWisePendingSaleAmount", imeiWisePendingSaleAmount);
|
| 1051 |
model.addAttribute("month", month);
|
1064 |
model.addAttribute("month", month);
|
| 1052 |
model.addAttribute("purchaseList", purchaseList);
|
1065 |
model.addAttribute("purchaseList", purchaseList);
|
| 1053 |
model.addAttribute("saleList", saleList);
|
1066 |
model.addAttribute("saleList", saleList);
|
| 1054 |
model.addAttribute("lastMonthPurchaseInMapPairMap", lastMonthPurchaseInMapPairMap);
|
1067 |
model.addAttribute("lastMonthPurchaseInMapPairMap", lastMonthPurchaseInMapPairMap);
|
| 1055 |
model.addAttribute("lastMonthCreditedMapPairMap", lastMonthCreditedMapPairMap);
|
1068 |
model.addAttribute("lastMonthCreditedMapPairMap", lastMonthCreditedMapPairMap);
|
| 1056 |
model.addAttribute("imeiWiseIncomeMapOfMap", imeiWiseIncomeMapOfMap);
|
1069 |
model.addAttribute("imeiWiseIncomeMapOfMap", imeiWiseIncomeMapOfMap);
|
| 1057 |
model.addAttribute("lastmonthCategoryUpgradeMargin", lastmonthCategoryUpgradeMargin);
|
1070 |
model.addAttribute("lastmonthCategoryUpgradeMargin", lastmonthCategoryUpgradeMargin);
|
| - |
|
1071 |
model.addAttribute("soldMap", soldMap);
|
| 1058 |
model.addAttribute("allOfferPayoutImeiIncomeModels", allOfferPayoutImeiIncomeModels);
|
1072 |
model.addAttribute("allOfferPayoutImeiIncomeModels", allOfferPayoutImeiIncomeModels);
|
| 1059 |
//model.addAttribute("iimeiSaleDateMap", imeiSaleDateMap);
|
1073 |
//model.addAttribute("iimeiSaleDateMap", imeiSaleDateMap);
|
| 1060 |
//model.addAttribute("imeiPurchaseDateMap", imeiPurchaseDateMap);
|
1074 |
//model.addAttribute("imeiPurchaseDateMap", imeiPurchaseDateMap);
|
| 1061 |
|
1075 |
|
| 1062 |
return "last-month-imei-wise-income";
|
1076 |
return "last-month-imei-wise-income";
|