| Line 1082... |
Line 1082... |
| 1082 |
}
|
1082 |
}
|
| 1083 |
|
1083 |
|
| 1084 |
|
1084 |
|
| 1085 |
@Autowired
|
1085 |
@Autowired
|
| 1086 |
SidbiService sidbiService;
|
1086 |
SidbiService sidbiService;
|
| - |
|
1087 |
|
| 1087 |
@RequestMapping(value = "/activateKred", method = RequestMethod.POST)
|
1088 |
@RequestMapping(value = "/activateKred", method = RequestMethod.POST)
|
| 1088 |
public String activateKred(HttpServletRequest request, @RequestParam int id, Model model, @RequestParam Gateway gateway) throws Exception {
|
1089 |
public String activateKred(HttpServletRequest request, @RequestParam int id, Model model, @RequestParam Gateway gateway) throws Exception {
|
| 1089 |
CreditAccount creditAccount = creditAccountRepository.selectById(id);
|
1090 |
CreditAccount creditAccount = creditAccountRepository.selectById(id);
|
| 1090 |
if (creditAccount.getGateway().equals(gateway)) {
|
1091 |
if (creditAccount.getGateway().equals(gateway)) {
|
| 1091 |
creditAccount.setActive(true);
|
1092 |
creditAccount.setActive(true);
|
| 1092 |
} else {
|
1093 |
} else {
|
| 1093 |
SDCreditRequirement sdCreditRequirement = sdCreditRequirementRepository.selectByFofoId(creditAccount.getFofoId());
|
1094 |
SDCreditRequirement sdCreditRequirement = sdCreditRequirementRepository.selectByFofoId(creditAccount.getFofoId());
|
| 1094 |
|
1095 |
|
| 1095 |
if(sdCreditRequirement.getUtilizedAmount().compareTo(BigDecimal.ZERO) != 0) {
|
1096 |
if (sdCreditRequirement.getUtilizedAmount().compareTo(BigDecimal.ZERO) != 0) {
|
| 1096 |
LOGGER.info("sdCreditRequirement - {}", sdCreditRequirement);
|
1097 |
LOGGER.info("sdCreditRequirement - {}", sdCreditRequirement);
|
| 1097 |
throw new ProfitMandiBusinessException("Could not change to " + gateway + " unless previous loans are settled","","");
|
1098 |
throw new ProfitMandiBusinessException("Could not change to " + gateway + " unless previous loans are settled", "", "");
|
| 1098 |
}
|
1099 |
}
|
| 1099 |
if (gateway.equals(Gateway.SIDBI)) {
|
1100 |
if (gateway.equals(Gateway.SIDBI)) {
|
| 1100 |
//TODO - Issuance pending
|
1101 |
//TODO - Issuance pending
|
| 1101 |
FofoSidbiSanction fofoSidbiSanction = fofoSidbiSanctionRepository.selectByFofoId(creditAccount.getFofoId());
|
1102 |
FofoSidbiSanction fofoSidbiSanction = fofoSidbiSanctionRepository.selectByFofoId(creditAccount.getFofoId());
|
| 1102 |
creditAccount.setSanctionedAmount((float) fofoSidbiSanction.getSanctionAmount());
|
- |
|
| 1103 |
sidbiService.issueLimit(fofoSidbiSanction);
|
1103 |
sidbiService.issueLimit(fofoSidbiSanction);
|
| 1104 |
sdCreditRequirement.setLimit(BigDecimal.valueOf(fofoSidbiSanction.getSanctionAmount()));
|
1104 |
sdCreditRequirement.setLimit(BigDecimal.valueOf(fofoSidbiSanction.getLoanAmount()));
|
| - |
|
1105 |
sdCreditRequirement.setSuggestedLimit(sdCreditRequirement.getLimit());
|
| 1105 |
if (sdCreditRequirement.getUtilizedAmount().compareTo(BigDecimal.ZERO) > 0) {
|
1106 |
if (sdCreditRequirement.getUtilizedAmount().compareTo(BigDecimal.ZERO) > 0) {
|
| 1106 |
throw new ProfitMandiBusinessException("Loans are not closed", "Loans are not closed", "Loans are not closed");
|
1107 |
throw new ProfitMandiBusinessException("Loans are not closed", "Loans are not closed", "Loans are not closed");
|
| 1107 |
}
|
1108 |
}
|
| 1108 |
sdCreditRequirement.setUtilizedAmount(BigDecimal.ZERO);
|
1109 |
creditAccount.setSanctionedAmount((float) fofoSidbiSanction.getLoanAmount());
|
| 1109 |
creditAccount.setAvailableAmount((float) fofoSidbiSanction.getLoanAmount());
|
1110 |
creditAccount.setAvailableAmount((float) fofoSidbiSanction.getLoanAmount());
|
| 1110 |
creditAccount.setActive(true);
|
- |
|
| 1111 |
}
|
1111 |
}
|
| - |
|
1112 |
creditAccount.setAvailableAmount(creditAccount.getSanctionedAmount());
|
| - |
|
1113 |
sdCreditRequirement.setUtilizedAmount(BigDecimal.ZERO);
|
| - |
|
1114 |
creditAccount.setActive(true);
|
| - |
|
1115 |
creditAccount.setGateway(gateway);
|
| 1112 |
}
|
1116 |
}
|
| 1113 |
|
1117 |
|
| 1114 |
Map<Integer, CustomRetailer> customRetailers = retailerService.getAllFofoRetailers();
|
1118 |
Map<Integer, CustomRetailer> customRetailers = retailerService.getAllFofoRetailers();
|
| 1115 |
|
1119 |
|
| 1116 |
String title = "Loan Approved";
|
1120 |
String title = "Loan Approved";
|