use of org.mifos.dto.domain.RepaymentScheduleInstallmentDto in project head by mifos.
the class LoanAccountServiceFacadeWebTier method retrieveOriginalLoanSchedule.
@Override
public OriginalScheduleInfoDto retrieveOriginalLoanSchedule(String globalAccountNum) {
LoanBO loanBO = this.loanDao.findByGlobalAccountNum(globalAccountNum);
Integer accountId = loanBO.getAccountId();
try {
List<OriginalLoanScheduleEntity> loanScheduleEntities = loanBusinessService.retrieveOriginalLoanSchedule(accountId);
ArrayList<RepaymentScheduleInstallmentDto> repaymentScheduleInstallments = new ArrayList<RepaymentScheduleInstallmentDto>();
for (OriginalLoanScheduleEntity loanScheduleEntity : loanScheduleEntities) {
RepaymentScheduleInstallment repaymentScheduleInstallment = loanScheduleEntity.toDto();
RepaymentScheduleInstallmentDto installmentDto = new RepaymentScheduleInstallmentDto(repaymentScheduleInstallment.getInstallment(), repaymentScheduleInstallment.getPrincipal().toString(), repaymentScheduleInstallment.getInterest().toString(), repaymentScheduleInstallment.getFees().toString(), repaymentScheduleInstallment.getMiscFees().toString(), repaymentScheduleInstallment.getFeesWithMiscFee().toString(), repaymentScheduleInstallment.getMiscPenalty().toString(), repaymentScheduleInstallment.getTotal(), repaymentScheduleInstallment.getDueDate());
repaymentScheduleInstallments.add(installmentDto);
}
return new OriginalScheduleInfoDto(loanBO.getLoanAmount().toString(), loanBO.getDisbursementDate(), repaymentScheduleInstallments);
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
}
Aggregations