make full loan retrieve run
This commit is contained in:
@@ -90,8 +90,9 @@ public class LoansApiResource {
|
|||||||
|
|
||||||
LoanBasicDetailsData loanBasicDetails = this.loanReadPlatformService
|
LoanBasicDetailsData loanBasicDetails = this.loanReadPlatformService
|
||||||
.retrieveLoanAccountDetails(loanId);
|
.retrieveLoanAccountDetails(loanId);
|
||||||
|
LoanAccountData loanAccount = this.loanReadPlatformService.convertToData(loanBasicDetails);
|
||||||
|
|
||||||
LoanAccountData loanAccount = new LoanAccountData(loanBasicDetails, null, null, null, null );
|
//LoanAccountData loanAccount = new LoanAccountData(loanBasicDetails, null, null, null, null );
|
||||||
|
|
||||||
String selectedFields = "";
|
String selectedFields = "";
|
||||||
String associatedFields = "summary,repaymentSchedule,loanRepayments,permissions,convenienceData";
|
String associatedFields = "summary,repaymentSchedule,loanRepayments,permissions,convenienceData";
|
||||||
|
|||||||
@@ -27,6 +27,13 @@ import org.joda.time.DateTime;
|
|||||||
import org.joda.time.LocalDate;
|
import org.joda.time.LocalDate;
|
||||||
import org.mifosng.platform.api.data.CurrencyData;
|
import org.mifosng.platform.api.data.CurrencyData;
|
||||||
import org.mifosng.platform.api.data.DerivedLoanData;
|
import org.mifosng.platform.api.data.DerivedLoanData;
|
||||||
|
import org.mifosng.platform.api.data.FundData;
|
||||||
|
import org.mifosng.platform.api.data.LoanAccountData;
|
||||||
|
import org.mifosng.platform.api.data.LoanAccountSummaryData;
|
||||||
|
import org.mifosng.platform.api.data.LoanBasicDetailsData;
|
||||||
|
import org.mifosng.platform.api.data.LoanPermissionData;
|
||||||
|
import org.mifosng.platform.api.data.LoanRepaymentScheduleData;
|
||||||
|
import org.mifosng.platform.api.data.LoanTransactionData;
|
||||||
import org.mifosng.platform.client.domain.Client;
|
import org.mifosng.platform.client.domain.Client;
|
||||||
import org.mifosng.platform.currency.domain.MonetaryCurrency;
|
import org.mifosng.platform.currency.domain.MonetaryCurrency;
|
||||||
import org.mifosng.platform.currency.domain.Money;
|
import org.mifosng.platform.currency.domain.Money;
|
||||||
@@ -954,39 +961,16 @@ public class Loan extends AbstractAuditableCustom<AppUser, Long> {
|
|||||||
|
|
||||||
return statusSinceDate;
|
return statusSinceDate;
|
||||||
}
|
}
|
||||||
/* jpw will be deleting this shortly
|
|
||||||
public LoanBasicDetailsData toBasicDetailsData(final CurrencyData currencyData, final FundData fundData) {
|
|
||||||
|
|
||||||
Money loanPrincipal = this.loanRepaymentScheduleDetail.getPrincipal();
|
|
||||||
MoneyData principal = MoneyData.of(currencyData, loanPrincipal.getAmount());
|
|
||||||
|
|
||||||
Money loanArrearsTolerance = this.loanRepaymentScheduleDetail.getInArrearsTolerance();
|
|
||||||
MoneyData tolerance = MoneyData.of(currencyData, loanArrearsTolerance.getAmount());
|
|
||||||
|
|
||||||
EnumOptionData repaymentFrequencyType = LoanEnumerations.repaymentFrequencyType(this.loanRepaymentScheduleDetail.getRepaymentPeriodFrequencyType());
|
|
||||||
EnumOptionData interestRateFrequencyType = LoanEnumerations.interestRateFrequencyType(this.loanRepaymentScheduleDetail.getInterestPeriodFrequencyType());
|
|
||||||
EnumOptionData amortizationType = LoanEnumerations.amortizationType(this.loanRepaymentScheduleDetail.getAmortizationMethod());
|
|
||||||
EnumOptionData interestType = LoanEnumerations.interestType(this.loanRepaymentScheduleDetail.getInterestMethod());
|
|
||||||
EnumOptionData interestCalculationPeriodType = LoanEnumerations.interestCalculationPeriodType(this.loanRepaymentScheduleDetail.getInterestCalculationPeriodMethod());
|
|
||||||
|
|
||||||
return new LoanBasicDetailsData(getId(), this.externalId, this.loanProduct.getName(), fundData,
|
|
||||||
getClosedOnDate(), getSubmittedOnDate(), getApprovedOnDate(), getExpectedDisbursedOnLocalDate(), getDisbursedOnDate(),
|
|
||||||
getExpectedMaturityDate(), getExpectedFirstRepaymentOnDate(), getInterestChargedFromDate(), principal, tolerance,
|
|
||||||
this.loanRepaymentScheduleDetail.getNumberOfRepayments(), this.loanRepaymentScheduleDetail.getRepayEvery(),
|
|
||||||
this.loanRepaymentScheduleDetail.getNominalInterestRatePerPeriod(), this.loanRepaymentScheduleDetail.getAnnualNominalInterestRate(),
|
|
||||||
repaymentFrequencyType, interestRateFrequencyType, amortizationType, interestType, interestCalculationPeriodType, getLoanStatusDisplayName(), getLoanStatusSinceDate());
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
public String getCurrencyCode() {
|
public String getCurrencyCode() {
|
||||||
return this.loanRepaymentScheduleDetail.getPrincipal().getCurrencyCode();
|
return this.loanRepaymentScheduleDetail.getPrincipal().getCurrencyCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* jpw will be deleting this shortly
|
// jpw will be deleting this shortly
|
||||||
public LoanAccountData toLoanAccountData(LoanAccountSummaryData summary, LoanRepaymentScheduleData repaymentSchedule,
|
public LoanAccountData toLoanAccountData(LoanBasicDetailsData basicDetails, LoanAccountSummaryData summary, LoanRepaymentScheduleData repaymentSchedule,
|
||||||
List<LoanTransactionData> loanRepayments,
|
List<LoanTransactionData> loanRepayments) {
|
||||||
CurrencyData currencyData, FundData fundData) {
|
|
||||||
|
|
||||||
LoanBasicDetailsData basicDetails = toBasicDetailsData(currencyData, fundData);
|
//LoanBasicDetailsData basicDetails = toBasicDetailsData(currencyData, fundData);
|
||||||
|
|
||||||
// permissions
|
// permissions
|
||||||
boolean waiveAllowed = summary.isWaiveAllowed(basicDetails.getInArrearsTolerance())
|
boolean waiveAllowed = summary.isWaiveAllowed(basicDetails.getInArrearsTolerance())
|
||||||
@@ -1011,5 +995,5 @@ public class Loan extends AbstractAuditableCustom<AppUser, Long> {
|
|||||||
|
|
||||||
return new LoanAccountData(basicDetails, summary, repaymentSchedule, loanRepayments, permissions);
|
return new LoanAccountData(basicDetails, summary, repaymentSchedule, loanRepayments, permissions);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
+3
@@ -1,5 +1,6 @@
|
|||||||
package org.mifosng.platform.loan.service;
|
package org.mifosng.platform.loan.service;
|
||||||
|
|
||||||
|
import org.mifosng.platform.api.data.LoanAccountData;
|
||||||
import org.mifosng.platform.api.data.LoanBasicDetailsData;
|
import org.mifosng.platform.api.data.LoanBasicDetailsData;
|
||||||
import org.mifosng.platform.api.data.LoanTransactionData;
|
import org.mifosng.platform.api.data.LoanTransactionData;
|
||||||
import org.mifosng.platform.api.data.NewLoanData;
|
import org.mifosng.platform.api.data.NewLoanData;
|
||||||
@@ -16,4 +17,6 @@ public interface LoanReadPlatformService {
|
|||||||
|
|
||||||
LoanTransactionData retrieveLoanTransactionDetails(Long loanId,
|
LoanTransactionData retrieveLoanTransactionDetails(Long loanId,
|
||||||
Long transactionId);
|
Long transactionId);
|
||||||
|
|
||||||
|
LoanAccountData convertToData(LoanBasicDetailsData loanBasic);//del jpw after
|
||||||
}
|
}
|
||||||
+21
-12
@@ -9,7 +9,10 @@ import java.util.Collection;
|
|||||||
import org.joda.time.LocalDate;
|
import org.joda.time.LocalDate;
|
||||||
import org.mifosng.platform.api.data.ClientData;
|
import org.mifosng.platform.api.data.ClientData;
|
||||||
import org.mifosng.platform.api.data.CurrencyData;
|
import org.mifosng.platform.api.data.CurrencyData;
|
||||||
|
import org.mifosng.platform.api.data.DerivedLoanData;
|
||||||
import org.mifosng.platform.api.data.EnumOptionData;
|
import org.mifosng.platform.api.data.EnumOptionData;
|
||||||
|
import org.mifosng.platform.api.data.FundData;
|
||||||
|
import org.mifosng.platform.api.data.LoanAccountData;
|
||||||
import org.mifosng.platform.api.data.LoanBasicDetailsData;
|
import org.mifosng.platform.api.data.LoanBasicDetailsData;
|
||||||
import org.mifosng.platform.api.data.LoanProductData;
|
import org.mifosng.platform.api.data.LoanProductData;
|
||||||
import org.mifosng.platform.api.data.LoanProductLookup;
|
import org.mifosng.platform.api.data.LoanProductLookup;
|
||||||
@@ -86,20 +89,26 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return selectedLoan;
|
return selectedLoan;
|
||||||
// return convertToData(loan, currencyData, fundData);
|
}
|
||||||
|
//jpw delete after
|
||||||
|
public LoanAccountData convertToData(LoanBasicDetailsData loanBasic) {
|
||||||
|
|
||||||
|
MoneyData princ = loanBasic.getPrincipal();
|
||||||
|
|
||||||
|
CurrencyData currencyData = new CurrencyData(princ.getCurrencyCode(),
|
||||||
|
princ.getDefaultName(), princ.getDigitsAfterDecimal(), princ.getDisplaySymbol(),
|
||||||
|
princ.getNameCode());
|
||||||
|
|
||||||
|
final Loan realLoan = this.loanRepository.findOne(loanBasic.getId());
|
||||||
|
if (realLoan == null) {
|
||||||
|
throw new LoanNotFoundException(loanBasic.getId());
|
||||||
|
}
|
||||||
|
DerivedLoanData loanData = realLoan.deriveLoanData(currencyData);
|
||||||
|
|
||||||
|
return realLoan.toLoanAccountData(loanBasic, loanData.getSummary(),
|
||||||
|
loanData.getRepaymentSchedule(), loanData.getLoanRepayments());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* check if this is used after jpw private LoanAccountData
|
|
||||||
* convertToData(final Loan realLoan, CurrencyData currencyData, FundData
|
|
||||||
* fundData) {
|
|
||||||
*
|
|
||||||
* DerivedLoanData loanData = realLoan.deriveLoanData(currencyData);
|
|
||||||
*
|
|
||||||
* return realLoan.toLoanAccountData(loanData.getSummary(),
|
|
||||||
* loanData.getRepaymentSchedule(), loanData.getLoanRepayments(),
|
|
||||||
* currencyData, fundData); }
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public NewLoanData retrieveClientAndProductDetails(final Long clientId,
|
public NewLoanData retrieveClientAndProductDetails(final Long clientId,
|
||||||
final Long productId) {
|
final Long productId) {
|
||||||
|
|||||||
Reference in New Issue
Block a user