| Line 147... |
Line 147... |
| 147 |
@Autowired
|
147 |
@Autowired
|
| 148 |
RbmTargetService rbmTargetService;
|
148 |
RbmTargetService rbmTargetService;
|
| 149 |
|
149 |
|
| 150 |
public void test() throws Exception {
|
150 |
public void test() throws Exception {
|
| 151 |
System.out.println("test start");
|
151 |
System.out.println("test start");
|
| 152 |
this.generateBiReportExcel();
|
- |
|
| 153 |
System.out.println("test end");
|
152 |
System.out.println("test end");
|
| 154 |
|
153 |
|
| 155 |
}
|
154 |
}
|
| 156 |
|
155 |
|
| - |
|
156 |
public void generateBiReport() throws Exception {
|
| - |
|
157 |
LOGGER.info("bi report started {-----}");
|
| - |
|
158 |
this.generateBiReportExcel();
|
| - |
|
159 |
LOGGER.info("bi report ended {-----}");
|
| - |
|
160 |
}
|
| - |
|
161 |
|
| 157 |
public void createLoanForBillingByTransactionIdAndInvoiceNumber(int transactionId, double invoiceAmount, String invoiceNumber) throws Exception {
|
162 |
public void createLoanForBillingByTransactionIdAndInvoiceNumber(int transactionId, double invoiceAmount, String invoiceNumber) throws Exception {
|
| 158 |
sdCreditService.createLoanForBilling(transactionId, invoiceAmount, invoiceNumber);
|
163 |
sdCreditService.createLoanForBilling(transactionId, invoiceAmount, invoiceNumber);
|
| 159 |
|
164 |
|
| 160 |
}
|
165 |
}
|
| 161 |
|
166 |
|
| Line 443... |
Line 448... |
| 443 |
|
448 |
|
| 444 |
Map<Integer, CustomRetailer> customRetailers = retailerService.getAllFofoRetailersInternalFalse();
|
449 |
Map<Integer, CustomRetailer> customRetailers = retailerService.getAllFofoRetailersInternalFalse();
|
| 445 |
|
450 |
|
| 446 |
List<Integer> retailerIds = customRetailers.values().stream().map(CustomRetailer::getPartnerId).collect(Collectors.toList());
|
451 |
List<Integer> retailerIds = customRetailers.values().stream().map(CustomRetailer::getPartnerId).collect(Collectors.toList());
|
| 447 |
|
452 |
|
| - |
|
453 |
/* List<Integer> retailerIds = Arrays.asList(175139401,175139400,175139381,175139667,175139662,175139661,175130896,175139323,175139452);
|
| - |
|
454 |
Map<Integer,CustomRetailer> customRetailers = retailerService.getFofoRetailers(retailerIds);*/
|
| - |
|
455 |
|
| 448 |
//partner daily investment
|
456 |
//partner daily investment
|
| 449 |
List<Loan> defaultLoans = sdCreditService.getDefaultLoan();
|
457 |
List<Loan> defaultLoans = sdCreditService.getDefaultLoan();
|
| 450 |
Map<Integer,List<Loan>> defaultLoanMap = defaultLoans.stream().collect(Collectors.groupingBy(Loan::getFofoId));
|
458 |
Map<Integer,List<Loan>> defaultLoanMap = defaultLoans.stream().collect(Collectors.groupingBy(Loan::getFofoId));
|
| 451 |
|
459 |
|
| 452 |
Map<Integer, PartnerDailyInvestment> partnerDailyInvestmentMap = new HashMap<>();
|
460 |
Map<Integer, PartnerDailyInvestment> partnerDailyInvestmentMap = new HashMap<>();
|
| Line 455... |
Line 463... |
| 455 |
if (!partnerDailyInvestments.isEmpty()) {
|
463 |
if (!partnerDailyInvestments.isEmpty()) {
|
| 456 |
partnerDailyInvestmentMap = partnerDailyInvestments.stream()
|
464 |
partnerDailyInvestmentMap = partnerDailyInvestments.stream()
|
| 457 |
.collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
465 |
.collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
| 458 |
}
|
466 |
}
|
| 459 |
|
467 |
|
| 460 |
// this month return data
|
468 |
// this month return data
|
| 461 |
YearMonth currentMonth = YearMonth.now();
|
469 |
YearMonth currentMonth = YearMonth.now();
|
| 462 |
String currentMonthStringValue = String.valueOf(currentMonth);
|
470 |
String currentMonthStringValue = String.valueOf(currentMonth);
|
| 463 |
LocalDateTime currentMonthStartDate = YearMonth.now().atDay(1).atStartOfDay();
|
471 |
LocalDateTime currentMonthStartDate = YearMonth.now().atDay(1).atStartOfDay();
|
| 464 |
LocalDateTime currentMonthEndDate = LocalDateTime.now();
|
472 |
LocalDateTime currentMonthEndDate = LocalDateTime.now();
|
| 465 |
|
473 |
|
| Line 493... |
Line 501... |
| 493 |
Map<Integer, Long> twoMonthAgoPartnerReturnOrderInfoModelMap = twoMonthAgoReturnOrderInfoModels.stream().collect(Collectors.groupingBy(x -> x.getRetailerId(), Collectors.summingLong(x -> Math.round(x.getRefundAmount()))));
|
501 |
Map<Integer, Long> twoMonthAgoPartnerReturnOrderInfoModelMap = twoMonthAgoReturnOrderInfoModels.stream().collect(Collectors.groupingBy(x -> x.getRetailerId(), Collectors.summingLong(x -> Math.round(x.getRefundAmount()))));
|
| 494 |
|
502 |
|
| 495 |
List<Order> twoMonthRtoRefundOrders = orderRepository.selectAllOrderDatesBetweenByStatus(twoMonthsAgoStartDate, twoMonthsAgoEndDate, OrderStatus.RTO_REFUNDED);
|
503 |
List<Order> twoMonthRtoRefundOrders = orderRepository.selectAllOrderDatesBetweenByStatus(twoMonthsAgoStartDate, twoMonthsAgoEndDate, OrderStatus.RTO_REFUNDED);
|
| 496 |
Map<Integer, Long> twoMonthAgoRtoRefundOrderMap = twoMonthRtoRefundOrders.stream().collect(Collectors.groupingBy(x -> x.getRetailerId(), Collectors.summingLong(x -> Math.round(x.getTotalAmount()))));
|
504 |
Map<Integer, Long> twoMonthAgoRtoRefundOrderMap = twoMonthRtoRefundOrders.stream().collect(Collectors.groupingBy(x -> x.getRetailerId(), Collectors.summingLong(x -> Math.round(x.getTotalAmount()))));
|
| 497 |
|
505 |
|
| - |
|
506 |
Map<Integer , String> assessmentMap = new HashMap<>();
|
| - |
|
507 |
Map<Integer , String> zeroBillingMap = new HashMap<>();
|
| - |
|
508 |
Map<Integer , Float> billingNeededMap = new HashMap<>();
|
| - |
|
509 |
Map<Integer , Integer> countAMap = new HashMap<>();
|
| 498 |
|
510 |
|
| 499 |
Map<Integer , BIRetailerModel> biRetailerModelMap = new HashMap<>();
|
511 |
Map<Integer , BIRetailerModel> biRetailerModelMap = new HashMap<>();
|
| 500 |
|
512 |
|
| 501 |
Map<Integer , FofoInvestmentModel> biInvestmentModelMap = new HashMap<>();
|
513 |
Map<Integer , FofoInvestmentModel> biInvestmentModelMap = new HashMap<>();
|
| 502 |
|
514 |
|
| Line 506... |
Line 518... |
| 506 |
|
518 |
|
| 507 |
Map<Integer,Map<String, BrandStockPrice>> fofoBrandStockPriceMap = new HashMap<>();
|
519 |
Map<Integer,Map<String, BrandStockPrice>> fofoBrandStockPriceMap = new HashMap<>();
|
| 508 |
|
520 |
|
| 509 |
Map<Integer,Long> fofoTotalMtdSecondaryMap = new HashMap<>();
|
521 |
Map<Integer,Long> fofoTotalMtdSecondaryMap = new HashMap<>();
|
| 510 |
|
522 |
|
| 511 |
Map<Integer , String> assessmentMap = new HashMap<>();
|
- |
|
| 512 |
Map<Integer , String> zeroBillingMap = new HashMap<>();
|
- |
|
| 513 |
Map<Integer , Float> billingNeededMap = new HashMap<>();
|
- |
|
| 514 |
Map<Integer , Integer> countAMap = new HashMap<>();
|
- |
|
| 515 |
|
523 |
|
| 516 |
Map<Integer,Map<String, Long>> fofoBrandWiseMtdSecondaryMap = new HashMap<>();
|
524 |
Map<Integer,Map<String, Long>> fofoBrandWiseMtdSecondaryMap = new HashMap<>();
|
| 517 |
|
525 |
|
| 518 |
|
- |
|
| 519 |
|
- |
|
| 520 |
Map<Integer,Double> fofoTotalMtdTertiaryMap = new HashMap<>();
|
526 |
Map<Integer,Double> fofoTotalMtdTertiaryMap = new HashMap<>();
|
| 521 |
|
527 |
|
| 522 |
Map<Integer,Map<String, Double>> fofoBrandMtdTertiaryMap = new HashMap<>();
|
528 |
Map<Integer,Map<String, Double>> fofoBrandMtdTertiaryMap = new HashMap<>();
|
| 523 |
|
529 |
|
| 524 |
for(Integer fofoId: retailerIds){
|
530 |
for(Integer fofoId: retailerIds){
|
| Line 956... |
Line 962... |
| 956 |
brandStockMap.get("Almost New") != null ? brandStockMap.get("Almost New").getTotalValue() : 0.0
|
962 |
brandStockMap.get("Almost New") != null ? brandStockMap.get("Almost New").getTotalValue() : 0.0
|
| 957 |
));
|
963 |
));
|
| 958 |
|
964 |
|
| 959 |
Map<String, Long> brandSecondaryMap = fofoBrandWiseMtdSecondaryMap.get(fofoId);
|
965 |
Map<String, Long> brandSecondaryMap = fofoBrandWiseMtdSecondaryMap.get(fofoId);
|
| 960 |
row.addAll(Arrays.asList(
|
966 |
row.addAll(Arrays.asList(
|
| 961 |
current.getSecondaryAchieved(),
|
967 |
fofoTotalMtdSecondaryMap.get(fofoId),
|
| 962 |
brandSecondaryMap.getOrDefault("Apple", 0L),
|
968 |
brandSecondaryMap.getOrDefault("Apple", 0L),
|
| 963 |
brandSecondaryMap.getOrDefault("Xiaomi", 0L),
|
969 |
brandSecondaryMap.getOrDefault("Xiaomi", 0L),
|
| 964 |
brandSecondaryMap.getOrDefault("Vivo", 0L),
|
970 |
brandSecondaryMap.getOrDefault("Vivo", 0L),
|
| 965 |
brandSecondaryMap.getOrDefault("Tecno", 0L),
|
971 |
brandSecondaryMap.getOrDefault("Tecno", 0L),
|
| 966 |
brandSecondaryMap.getOrDefault("Samsung", 0L),
|
972 |
brandSecondaryMap.getOrDefault("Samsung", 0L),
|
| Line 974... |
Line 980... |
| 974 |
));
|
980 |
));
|
| 975 |
rows.add(row);
|
981 |
rows.add(row);
|
| 976 |
|
982 |
|
| 977 |
Map<String, Double> brandTertiaryMap = fofoBrandMtdTertiaryMap.get(fofoId);
|
983 |
Map<String, Double> brandTertiaryMap = fofoBrandMtdTertiaryMap.get(fofoId);
|
| 978 |
row.addAll(Arrays.asList(
|
984 |
row.addAll(Arrays.asList(
|
| 979 |
current.getTertiary(),
|
985 |
fofoTotalMtdTertiaryMap.get(fofoId),
|
| 980 |
brandTertiaryMap.getOrDefault("Apple", 0d),
|
986 |
brandTertiaryMap.getOrDefault("Apple", 0d),
|
| 981 |
brandTertiaryMap.getOrDefault("Xiaomi", 0d),
|
987 |
brandTertiaryMap.getOrDefault("Xiaomi", 0d),
|
| 982 |
brandTertiaryMap.getOrDefault("Vivo", 0d),
|
988 |
brandTertiaryMap.getOrDefault("Vivo", 0d),
|
| 983 |
brandTertiaryMap.getOrDefault("Tecno", 0d),
|
989 |
brandTertiaryMap.getOrDefault("Tecno", 0d),
|
| 984 |
brandTertiaryMap.getOrDefault("Samsung", 0d),
|
990 |
brandTertiaryMap.getOrDefault("Samsung", 0d),
|