| Line 142... |
Line 142... |
| 142 |
boolean isTarun = loginDetails.getEmailId().equals("tarun.verma@smartdukaan.com") || loginDetails.getEmailId().equals("kamini.sharma@smartdukaan.com");
|
142 |
boolean isTarun = loginDetails.getEmailId().equals("tarun.verma@smartdukaan.com") || loginDetails.getEmailId().equals("kamini.sharma@smartdukaan.com");
|
| 143 |
|
143 |
|
| 144 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailers(true);
|
144 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailers(true);
|
| 145 |
|
145 |
|
| 146 |
Map<Integer, SDCreditRequirement> sdCreditRequirementMap = sdCreditRequirementRepository.selectAll().stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
146 |
Map<Integer, SDCreditRequirement> sdCreditRequirementMap = sdCreditRequirementRepository.selectAll().stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
| - |
|
147 |
Map<Integer, com.spice.profitmandi.dao.model.BulkCreditSummary> summaryMap = sdCreditService.getCreditSummaryBulk();
|
| 147 |
for (Entry<Integer, CustomRetailer> customRetailerEntry : customRetailerMap.entrySet()) {
|
148 |
for (Entry<Integer, CustomRetailer> customRetailerEntry : customRetailerMap.entrySet()) {
|
| 148 |
int fofoId = customRetailerEntry.getKey();
|
149 |
int fofoId = customRetailerEntry.getKey();
|
| 149 |
|
150 |
|
| 150 |
SDCreditRequirement sdCreditRequirement = sdCreditRequirementMap.get(customRetailerEntry.getKey());
|
151 |
SDCreditRequirement sdCreditRequirement = sdCreditRequirementMap.get(fofoId);
|
| 151 |
|
152 |
|
| 152 |
if (sdCreditRequirement != null) {
|
153 |
if (sdCreditRequirement != null) {
|
| 153 |
|
- |
|
| 154 |
BigDecimal utilizedLimit = sdCreditService.getUtilizationAmount(fofoId);
|
154 |
com.spice.profitmandi.dao.model.BulkCreditSummary bulk = summaryMap.get(fofoId);
|
| 155 |
|
- |
|
| 156 |
BigDecimal availableLimit = sdCreditRequirement.getLimit().subtract(utilizedLimit);
|
155 |
BigDecimal utilizedLimit = bulk != null ? bulk.getUtilization() : BigDecimal.ZERO;
|
| 157 |
|
- |
|
| 158 |
LOGGER.info("utilizedLimit {} ", utilizedLimit);
|
- |
|
| 159 |
|
- |
|
| 160 |
LOGGER.info("availableLimit {} ", availableLimit);
|
- |
|
| 161 |
|
- |
|
| 162 |
sdCreditRequirement.setUtilizedAmount(utilizedLimit);
|
156 |
sdCreditRequirement.setUtilizedAmount(utilizedLimit);
|
| 163 |
|
- |
|
| 164 |
sdCreditRequirement.setUpdateTimestamp(LocalDateTime.now());
|
- |
|
| 165 |
}
|
157 |
}
|
| 166 |
|
158 |
|
| 167 |
}
|
159 |
}
|
| 168 |
|
160 |
|
| 169 |
model.addAttribute("customRetailerMap", customRetailerMap);
|
161 |
model.addAttribute("customRetailerMap", customRetailerMap);
|
| Line 657... |
Line 649... |
| 657 |
|
649 |
|
| 658 |
List<Integer> loanFofoIds = loanCountByFofoIdModels.stream().map(x -> x.getFofoId()).collect(Collectors.toList());
|
650 |
List<Integer> loanFofoIds = loanCountByFofoIdModels.stream().map(x -> x.getFofoId()).collect(Collectors.toList());
|
| 659 |
|
651 |
|
| 660 |
List<SDCreditRequirement> sdCreditRequirements = sdCreditRequirementRepository.selectByFofoIds(new ArrayList<>(loanFofoIds));
|
652 |
List<SDCreditRequirement> sdCreditRequirements = sdCreditRequirementRepository.selectByFofoIds(new ArrayList<>(loanFofoIds));
|
| 661 |
|
653 |
|
| 662 |
// Map<Integer, Long> loanCountMap = loans.stream().collect(Collectors.groupingBy(x -> x.getFofoId(), Collectors.counting()));
|
654 |
Map<Integer, com.spice.profitmandi.dao.model.BulkCreditSummary> summaryMap = sdCreditService.getCreditSummaryBulk();
|
| - |
|
655 |
for (SDCreditRequirement req : sdCreditRequirements) {
|
| - |
|
656 |
com.spice.profitmandi.dao.model.BulkCreditSummary bulk = summaryMap.get(req.getFofoId());
|
| - |
|
657 |
if (bulk != null) {
|
| 663 |
// LOGGER.info("loanCountMap" + loanCountMap);
|
658 |
req.setUtilizedAmount(bulk.getUtilization());
|
| - |
|
659 |
}
|
| - |
|
660 |
}
|
| 664 |
|
661 |
|
| 665 |
Map<Integer, UserWallet> userWalletMap = userWalletRepository.selectByRetailerIds(fofoIds).stream().collect(Collectors.toMap(x -> x.getUserId(), x -> x));
|
662 |
Map<Integer, UserWallet> userWalletMap = userWalletRepository.selectByRetailerIds(fofoIds).stream().collect(Collectors.toMap(x -> x.getUserId(), x -> x));
|
| 666 |
Map<Integer, CurrentPartnerDailyInvestment> currentPartnerDailyInvestmentMap = currentPartnerDailyInvestmentRepository.selectAll().stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
663 |
Map<Integer, CurrentPartnerDailyInvestment> currentPartnerDailyInvestmentMap = currentPartnerDailyInvestmentRepository.selectAll().stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
| 667 |
|
664 |
|
| 668 |
model.addAttribute("userWalletMap", userWalletMap);
|
665 |
model.addAttribute("userWalletMap", userWalletMap);
|