Subversion Repositories SmartDukaan

Rev

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

Rev 35318 Rev 35320
Line 675... Line 675...
675
        model.addAttribute("fofoIdLoansMap", fofoIdLoansMap);
675
        model.addAttribute("fofoIdLoansMap", fofoIdLoansMap);
676
        model.addAttribute("loanCountMap", loanCountMap);
676
        model.addAttribute("loanCountMap", loanCountMap);
677
        return "partner-wise-loan-summary";
677
        return "partner-wise-loan-summary";
678
    }
678
    }
679
 
679
 
-
 
680
    @RequestMapping(value = "/getPartnerStateWiseLoanSummary", method = RequestMethod.GET)
-
 
681
    public String getPartnerStateWiseLoanSummary(HttpServletRequest request, @RequestParam LoanSummaryType loanSummaryType, @RequestParam String stateName, @RequestParam(required = false) Integer days, Model model) throws ProfitMandiBusinessException {
-
 
682
        Map<Integer, FofoReportingModel> fofoReportingModelMap = csService.getPartnerIdSalesHeaders();
-
 
683
        List<Loan> loans = loanRepository.selectAllStateWiseActiveLoan(stateName);
-
 
684
        if (loanSummaryType.equals(LoanSummaryType.DEFAULT_LOAN)) {
-
 
685
            loans = loans.stream().filter(x -> x.isDefault()).collect(Collectors.toList());
-
 
686
        } else if (loanSummaryType.equals(LoanSummaryType.DUE_LOAN)) {
-
 
687
            loans = loans.stream().filter(x -> x.isOverdue()).collect(Collectors.toList());
-
 
688
        }
-
 
689
 
-
 
690
        if (days != null) {
-
 
691
            loans = loans.stream()
-
 
692
                    .filter(x -> x.getLoanAgeInDays() >= days)   // your logic
-
 
693
                    .collect(Collectors.toList());
-
 
694
        }
-
 
695
 
-
 
696
        List<Integer> fofoIds = loans.stream().map(x -> x.getFofoId()).collect(Collectors.toList());
-
 
697
        Map<Integer, Double> fofoIdLoansMap = loans.stream().collect(Collectors.groupingBy(x -> x.getFofoId(), Collectors.summingDouble(x -> x.getPendingAmount().doubleValue())));
-
 
698
        Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailers(fofoIds);
-
 
699
        Map<Integer, Long> loanCountMap = loans.stream().collect(Collectors.groupingBy(x -> x.getFofoId(), Collectors.counting()));
-
 
700
        model.addAttribute("customRetailerMap", customRetailerMap);
-
 
701
        model.addAttribute("loans", loans);
-
 
702
        model.addAttribute("fofoReportingModelMap", fofoReportingModelMap);
-
 
703
        model.addAttribute("fofoIdLoansMap", fofoIdLoansMap);
-
 
704
        model.addAttribute("loanCountMap", loanCountMap);
-
 
705
        return "partner-wise-loan-summary";
-
 
706
    }
-
 
707
 
680
    @RequestMapping(value = "/getLoanSummary", method = RequestMethod.GET)
708
    @RequestMapping(value = "/getLoanSummary", method = RequestMethod.GET)
681
    public String getLoanSummary(HttpServletRequest request, @RequestParam int fofoId, Model model) throws ProfitMandiBusinessException {
709
    public String getLoanSummary(HttpServletRequest request, @RequestParam int fofoId, Model model) throws ProfitMandiBusinessException {
682
 
710
 
683
        SDCreditResponseOut sdCreditResponseOut = sdCreditService.sdDirectService(fofoId);
711
        SDCreditResponseOut sdCreditResponseOut = sdCreditService.sdDirectService(fofoId);
684
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
712
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);