FINERACT-609 TopUp

This commit is contained in:
percyashu
2020-05-28 19:16:47 +01:00
parent 896571d479
commit c1ca960ace
3 changed files with 16 additions and 5 deletions
@@ -37,5 +37,7 @@ public interface AccountDetailsReadPlatformService {
public List<LoanAccountSummaryData> retrieveLoanAccountDetailsByGroupIdAndGlimAccountNumber(Long groupId,final String glimAccount);
public Collection<LoanAccountSummaryData> retrieveGroupActiveLoanAccountSummary(final Long groupId);
AccountSummaryCollectionData retrieveGroupAccountDetails(Long groupId, Long gsimId);
}
@@ -157,7 +157,8 @@ public class AccountDetailsReadPlatformServiceJpaRepositoryImpl implements Accou
return retrieveLoanAccountDetails(loanWhereClause, new Object[] { groupId, loanOfficerId });
}
@Override public Collection<LoanAccountSummaryData> retrieveClientActiveLoanAccountSummary(final Long clientId) {
@Override
public Collection<LoanAccountSummaryData> retrieveClientActiveLoanAccountSummary(final Long clientId) {
final String loanWhereClause = " where l.client_id = ? and l.loan_status_id = 300 ";
return retrieveLoanAccountDetails(loanWhereClause, new Object[] { clientId });
}
@@ -171,6 +172,12 @@ public class AccountDetailsReadPlatformServiceJpaRepositoryImpl implements Accou
return this.jdbcTemplate.query(sql, rm, new Object[]{groupId , glimAccount});
}
@Override
public Collection<LoanAccountSummaryData> retrieveGroupActiveLoanAccountSummary(final Long groupId) {
final String loanWhereClause = " where l.group_id = ? and l.loan_status_id = 300 and l.client_id is null";
return retrieveLoanAccountDetails(loanWhereClause, new Object[] { groupId });
}
private List<LoanAccountSummaryData> retrieveLoanAccountDetails(final String loanwhereClause, final Object[] inputs) {
final LoanAccountSummaryDataMapper rm = new LoanAccountSummaryDataMapper();
@@ -1428,15 +1428,17 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
}
}
Collection<LoanAccountSummaryData> clientActiveLoanOptions = null;
if(loanProduct.canUseForTopup() && clientId != null){
clientActiveLoanOptions = this.accountDetailsReadPlatformService.retrieveClientActiveLoanAccountSummary(clientId);
Collection<LoanAccountSummaryData> activeLoanOptions = null;
if(loanProduct.canUseForTopup() && clientId != null) {
activeLoanOptions = this.accountDetailsReadPlatformService.retrieveClientActiveLoanAccountSummary(clientId);
} else if (loanProduct.canUseForTopup() && groupId != null) {
activeLoanOptions = this.accountDetailsReadPlatformService.retrieveGroupActiveLoanAccountSummary(groupId);
}
return LoanAccountData.loanProductWithTemplateDefaults(loanProduct, loanTermFrequencyTypeOptions, repaymentFrequencyTypeOptions,
repaymentFrequencyNthDayTypeOptions, repaymentFrequencyDaysOfWeekTypeOptions, repaymentStrategyOptions,
interestRateFrequencyTypeOptions, amortizationTypeOptions, interestTypeOptions, interestCalculationPeriodTypeOptions,
fundOptions, chargeOptions, loanPurposeOptions, loanCollateralOptions, loanCycleCounter, clientActiveLoanOptions);
fundOptions, chargeOptions, loanPurposeOptions, loanCollateralOptions, loanCycleCounter, activeLoanOptions);
}
@Override