Subversion Repositories SmartDukaan

Rev

Rev 34741 | Rev 34749 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 34741 Rev 34743
Line 460... Line 460...
460
            // Otherwise, use today
460
            // Otherwise, use today
461
            startOfToday = LocalDate.now().atStartOfDay();
461
            startOfToday = LocalDate.now().atStartOfDay();
462
            previousDay = startOfToday.with(LocalTime.MAX).minusDays(1);
462
            previousDay = startOfToday.with(LocalTime.MAX).minusDays(1);
463
        }
463
        }
464
 
464
 
465
        /*Map<Integer, CustomRetailer> customRetailers = retailerService.getAllFofoRetailersInternalFalse();
465
        Map<Integer, CustomRetailer> customRetailers = retailerService.getAllFofoRetailersInternalFalse();
466
 
466
 
467
        List<Integer> retailerIds = customRetailers.values().stream().map(CustomRetailer::getPartnerId).collect(Collectors.toList());*/
467
        List<Integer> retailerIds = customRetailers.values().stream().map(CustomRetailer::getPartnerId).collect(Collectors.toList());
468
 
468
 
469
        List<Integer> retailerIds = Arrays.asList(175139400, 175139727, 175138674, 175139476, 175139409, 175139260, 175139650, 175139742, 175139715, 175139154, 175139135, 175139550, 175139733, 175139722, 175138842, 175139309, 175138859, 175139438, 175139718, 175139320, 175139047, 175138408, 175139590, 175139494, 175139670, 175139730, 175139295, 175139188, 175139487, 175139422, 175139488, 175139279, 175139724, 175139687, 175139161, 175138934, 175139013, 175139633, 175139383, 175139432, 175139089, 175139561, 175135227, 175139412, 175139018, 175139088, 175139616, 175139294, 175139649, 175139129, 175139366, 175139699, 175139557, 175138174, 175139620, 175139514, 175139079, 175139521, 175139015, 175138982, 175139683, 175139676, 175139562, 175139675, 175138989, 175139114, 175139526, 175139729, 175139394, 175138864, 175135923, 175139415, 175139459, 175139395, 175139731, 175139401, 175139481, 175139623, 175139563, 175139692, 175139345);
469
/*        List<Integer> retailerIds = Arrays.asList(175139494);
470
        Map<Integer,CustomRetailer> customRetailers = retailerService.getFofoRetailers(retailerIds);
470
        Map<Integer,CustomRetailer> customRetailers = retailerService.getFofoRetailers(retailerIds);*/
471
 
471
 
472
        //partner daily investment
472
        //partner daily investment
473
        List<Loan> defaultLoans = sdCreditService.getDefaultLoans();
473
        List<Loan> defaultLoans = sdCreditService.getDefaultLoans();
474
        Map<Integer,List<Loan>> defaultLoanMap = defaultLoans.stream().collect(Collectors.groupingBy(Loan::getFofoId));
474
        Map<Integer,List<Loan>> defaultLoanMap = defaultLoans.stream().collect(Collectors.groupingBy(Loan::getFofoId));
475
 
475
 
Line 809... Line 809...
809
            }
809
            }
810
 
810
 
811
            float defaultLoanAmount = 0f;
811
            float defaultLoanAmount = 0f;
812
            if(fofoDefaultLoans != null ){
812
            if(fofoDefaultLoans != null ){
813
                if (!fofoDefaultLoans.isEmpty()) {
813
                if (!fofoDefaultLoans.isEmpty()) {
-
 
814
                    for (Loan entry : fofoDefaultLoans) {
-
 
815
 
-
 
816
                        List<LoanStatement> loanStatements = loanStatementRepository.selectByLoanId(entry.getId());
-
 
817
 
814
                    defaultLoanAmount =  fofoDefaultLoans.stream().map(Loan::getPendingAmount).reduce(BigDecimal.ZERO, BigDecimal::add).floatValue(); // or .floatValue() directly
818
                        double amount = loanStatements.stream().map(x -> x.getAmount()).collect(Collectors.summingDouble(x -> x.doubleValue()));
-
 
819
 
-
 
820
                        defaultLoanAmount += amount;
-
 
821
                    }
815
                }
822
                }
816
            }
823
            }
817
 
824
 
818
            List<Loan> activeLoans = loanRepository.selectAllActiveLoan(fofoId);
825
            List<Loan> activeLoans = loanRepository.selectAllActiveLoan(fofoId);
819
 
826
 
820
            LOGGER.info("activeLoans- {}",activeLoans);
827
            LOGGER.info("activeLoans- {}",activeLoans);
821
 
828
 
-
 
829
            float activeLoan = 0f;
-
 
830
 
-
 
831
            for (Loan entry : activeLoans) {
-
 
832
 
-
 
833
                List<LoanStatement> loanStatements = loanStatementRepository.selectByLoanId(entry.getId());
-
 
834
 
822
            float activeLoan = activeLoans.stream().map(Loan::getPendingAmount).reduce(BigDecimal.ZERO,BigDecimal::add).floatValue();
835
                double pendingAmount = loanStatements.stream().map(x -> x.getAmount()).collect(Collectors.summingDouble(x -> x.doubleValue()));
-
 
836
 
-
 
837
                activeLoan += pendingAmount;
-
 
838
            }
823
 
839
 
824
            float poValue = partnerDailyInvestmentMap.get(fofoId) != null ?  partnerDailyInvestmentMap.get(fofoId).getUnbilledAmount() : 0f;
840
            float poValue = partnerDailyInvestmentMap.get(fofoId) != null ?  partnerDailyInvestmentMap.get(fofoId).getUnbilledAmount() : 0f;
825
 
841
 
826
            float poAndBilledValue = (float) (currentMonthNetSecondary + poValue);
842
            float poAndBilledValue = (float) (currentMonthNetSecondary + poValue);
827
 
843
 
Line 1019... Line 1035...
1019
                row.addAll(Arrays.asList(
1035
                row.addAll(Arrays.asList(
1020
                        fofoInvestmentModelValue.getCounterPotential(),
1036
                        fofoInvestmentModelValue.getCounterPotential(),
1021
                        fofoInvestmentModelValue.getShortInvestment(),
1037
                        fofoInvestmentModelValue.getShortInvestment(),
1022
                        fofoInvestmentModelValue.getDefaultLoan(),
1038
                        fofoInvestmentModelValue.getDefaultLoan(),
1023
                        fofoInvestmentModelValue.getInvestmentLevel() +"%",
1039
                        fofoInvestmentModelValue.getInvestmentLevel() +"%",
1024
                       "-"+fofoInvestmentModelValue.getActiveLoan(),
1040
                        fofoInvestmentModelValue.getActiveLoan(),
1025
                        fofoInvestmentModelValue.getPoValue(),
1041
                        fofoInvestmentModelValue.getPoValue(),
1026
                        fofoInvestmentModelValue.getAgreedInvestment(),
1042
                        fofoInvestmentModelValue.getAgreedInvestment(),
1027
                        fofoInvestmentModelValue.getWallet(),
1043
                        fofoInvestmentModelValue.getWallet(),
1028
                        fofoInvestmentModelValue.getPoAndBilled(),
1044
                        fofoInvestmentModelValue.getPoAndBilled(),
1029
                        fofoInvestmentModelValue.getMonthBeginingDrr(),
1045
                        fofoInvestmentModelValue.getMonthBeginingDrr(),
Line 1307... Line 1323...
1307
        style.setFont(font);
1323
        style.setFont(font);
1308
        return style;
1324
        return style;
1309
    }
1325
    }
1310
 
1326
 
1311
 
1327
 
1312
 
-
 
1313
 
-
 
1314
}
1328
}