| Line 711... |
Line 711... |
| 711 |
fofoTotalStockPriceMap.put(fofoId,totalStockPrice);
|
711 |
fofoTotalStockPriceMap.put(fofoId,totalStockPrice);
|
| 712 |
|
712 |
|
| 713 |
Map<String, Double> brandMtdTertiaryAmount = fofoOrderItemRepository.selectSumAmountGroupByBrand(
|
713 |
Map<String, Double> brandMtdTertiaryAmount = fofoOrderItemRepository.selectSumAmountGroupByBrand(
|
| 714 |
currentMonthStartDate, currentMonthEndDate, fofoId);
|
714 |
currentMonthStartDate, currentMonthEndDate, fofoId);
|
| 715 |
|
715 |
|
| - |
|
716 |
|
| 716 |
fofoBrandMtdTertiaryMap.put(fofoId,brandMtdTertiaryAmount);
|
717 |
fofoBrandMtdTertiaryMap.put(fofoId,brandMtdTertiaryAmount);
|
| 717 |
|
718 |
|
| 718 |
double totalMtdTertiaryAmount = brandMtdTertiaryAmount.values().stream().mapToDouble(Double::doubleValue).sum();
|
719 |
double totalMtdTertiaryAmount = brandMtdTertiaryAmount.values().stream().mapToDouble(Double::doubleValue).sum();
|
| 719 |
|
720 |
|
| 720 |
fofoTotalMtdTertiaryMap.put(fofoId,totalMtdTertiaryAmount);
|
721 |
fofoTotalMtdTertiaryMap.put(fofoId,totalMtdTertiaryAmount);
|
| 721 |
|
722 |
|
| - |
|
723 |
LOGGER.info("fofoTotalMtdTertiaryMap- {}",fofoTotalMtdTertiaryMap);
|
| - |
|
724 |
LOGGER.info("fofoBrandMtdTertiaryMap- {}",fofoBrandMtdTertiaryMap);
|
| - |
|
725 |
|
| - |
|
726 |
|
| 722 |
List<BrandWiseModel> brandWiseMtdSecondary = orderRepository.selectAllBilledOrderGroupByBrandFofoId(fofoId, currentMonthStartDate);
|
727 |
List<BrandWiseModel> brandWiseMtdSecondary = orderRepository.selectAllBilledOrderGroupByBrandFofoId(fofoId, currentMonthStartDate);
|
| 723 |
Map<String,Long> brandWiseMtdSecondaryMap = brandWiseMtdSecondary.stream().collect(Collectors.toMap(BrandWiseModel::getBrand,BrandWiseModel::getAmount));
|
728 |
Map<String,Long> brandWiseMtdSecondaryMap = brandWiseMtdSecondary.stream().collect(Collectors.toMap(BrandWiseModel::getBrand,BrandWiseModel::getAmount));
|
| 724 |
fofoBrandWiseMtdSecondaryMap.put(fofoId,brandWiseMtdSecondaryMap);
|
729 |
fofoBrandWiseMtdSecondaryMap.put(fofoId,brandWiseMtdSecondaryMap);
|
| 725 |
|
730 |
|
| 726 |
long mtdTotalSecondary = brandWiseMtdSecondary.stream().mapToLong(x -> x.getAmount() != 0 ? x.getAmount() : 0L).sum();
|
731 |
long mtdTotalSecondary = brandWiseMtdSecondary.stream().mapToLong(x -> x.getAmount() != 0 ? x.getAmount() : 0L).sum();
|
| Line 747... |
Line 752... |
| 747 |
if (!fofoDefaultLoans.isEmpty()) {
|
752 |
if (!fofoDefaultLoans.isEmpty()) {
|
| 748 |
defaultLoanAmount = fofoDefaultLoans.stream().map(Loan::getPendingAmount).reduce(BigDecimal.ZERO, BigDecimal::add).floatValue(); // or .floatValue() directly
|
753 |
defaultLoanAmount = fofoDefaultLoans.stream().map(Loan::getPendingAmount).reduce(BigDecimal.ZERO, BigDecimal::add).floatValue(); // or .floatValue() directly
|
| 749 |
}
|
754 |
}
|
| 750 |
}
|
755 |
}
|
| 751 |
|
756 |
|
| - |
|
757 |
List<Loan> activeLoans = loanRepository.selectAllActiveLoan(fofoId);
|
| - |
|
758 |
|
| - |
|
759 |
LOGGER.info("activeLoans- {}",activeLoans);
|
| - |
|
760 |
|
| 752 |
float activeLoan = loanRepository.selectActiveLoan(fofoId).stream().map(Loan::getPendingAmount).reduce(BigDecimal.ZERO,BigDecimal::add).floatValue();
|
761 |
float activeLoan = activeLoans.stream().map(Loan::getPendingAmount).reduce(BigDecimal.ZERO,BigDecimal::add).floatValue();
|
| 753 |
|
762 |
|
| 754 |
|
763 |
|
| 755 |
float poValue = partnerDailyInvestmentMap.get(fofoId) != null ? partnerDailyInvestmentMap.get(fofoId).getUnbilledAmount() : 0f;
|
764 |
float poValue = partnerDailyInvestmentMap.get(fofoId) != null ? partnerDailyInvestmentMap.get(fofoId).getUnbilledAmount() : 0f;
|
| 756 |
|
765 |
|
| 757 |
List<Order> billedAndPoOrder = orderRepository.selectOrders(Arrays.asList(fofoId),Arrays.asList(OrderStatus.SUBMITTED_FOR_PROCESSING, OrderStatus.ACCEPTED, OrderStatus.BILLED, OrderStatus.SHIPPED_FROM_WH, OrderStatus.DELIVERY_SUCCESS),currentMonthStartDate,startOfToday.plusDays(1));
|
766 |
float poAndBilledValue = (float) (currentMonthNetSecondary + poValue);
|
| 758 |
float poAndBilledValue = (float) billedAndPoOrder.stream().map(Order::getTotalAmount).reduce(0f,Float::sum);
|
- |
|
| 759 |
|
767 |
|
| 760 |
double purchaseMtd = secondaryMtd.getOrDefault(fofoId, 0.0);
|
768 |
double purchaseMtd = secondaryMtd.getOrDefault(fofoId, 0.0);
|
| 761 |
|
769 |
|
| 762 |
double todayRequiredDrr = rbmTargetService.calculateFofoIdTodayTarget(fofoId, purchaseMtd,LocalDate.now());
|
770 |
double todayRequiredDrr = rbmTargetService.calculateFofoIdTodayTarget(fofoId, purchaseMtd,LocalDate.now());
|
| 763 |
|
771 |
|
| Line 1196... |
Line 1204... |
| 1196 |
for (List<?> dataRow : rows) {
|
1204 |
for (List<?> dataRow : rows) {
|
| 1197 |
Row row = sheet.createRow(rowIndex++);
|
1205 |
Row row = sheet.createRow(rowIndex++);
|
| 1198 |
for (int i = 0; i < dataRow.size(); i++) {
|
1206 |
for (int i = 0; i < dataRow.size(); i++) {
|
| 1199 |
Cell cell = row.createCell(i);
|
1207 |
Cell cell = row.createCell(i);
|
| 1200 |
Object value = dataRow.get(i);
|
1208 |
Object value = dataRow.get(i);
|
| 1201 |
if (value instanceof Number) {
|
- |
|
| 1202 |
cell.setCellValue(((Number) value).doubleValue());
|
- |
|
| 1203 |
} else {
|
- |
|
| 1204 |
cell.setCellValue(value != null ? value.toString() : "");
|
- |
|
| 1205 |
}
|
- |
|
| 1206 |
|
1209 |
|
| 1207 |
if (i == 6 && value != null) { // Assuming column 6 is "Link"
|
1210 |
if (i == 6 && value != null) { // Assuming column 6 is "Link"
|
| 1208 |
Hyperlink hyperlink = creationHelper.createHyperlink(HyperlinkType.URL);
|
1211 |
Hyperlink hyperlink = creationHelper.createHyperlink(HyperlinkType.URL);
|
| 1209 |
hyperlink.setAddress(value.toString());
|
1212 |
hyperlink.setAddress(value.toString());
|
| 1210 |
cell.setCellValue("View Link"); // Text to display in Excel
|
1213 |
cell.setCellValue("View Link"); // Display text
|
| 1211 |
cell.setHyperlink(hyperlink);
|
1214 |
cell.setHyperlink(hyperlink);
|
| 1212 |
cell.setCellStyle(hyperlinkStyle);
|
1215 |
cell.setCellStyle(hyperlinkStyle);
|
| - |
|
1216 |
} else if (value instanceof Number) {
|
| - |
|
1217 |
cell.setCellValue(((Number) value).doubleValue());
|
| 1213 |
} else {
|
1218 |
} else {
|
| 1214 |
cell.setCellValue(value != null ? value.toString() : "");
|
1219 |
cell.setCellValue(value != null ? value.toString() : "");
|
| 1215 |
}
|
1220 |
}
|
| 1216 |
}
|
1221 |
}
|
| - |
|
1222 |
|
| 1217 |
}
|
1223 |
}
|
| 1218 |
|
1224 |
|
| 1219 |
// Auto-size columns
|
1225 |
// Auto-size columns
|
| 1220 |
if (!rows.isEmpty()) {
|
1226 |
if (!rows.isEmpty()) {
|
| 1221 |
for (int i = 0; i < rows.get(0).size(); i++) {
|
1227 |
for (int i = 0; i < rows.get(0).size(); i++) {
|