use of org.mifos.application.util.helpers.AccountPaymentDtoComperator in project head by mifos.
the class LoanAccountServiceFacadeWebTier method getLoanAccountPayments.
@Override
public List<AccountPaymentDto> getLoanAccountPayments(String globalAccountNum) {
List<AccountPaymentDto> loanAccountPayments = new ArrayList<AccountPaymentDto>();
LoanBO loanAccount = loanDao.findByGlobalAccountNum(globalAccountNum);
List<AccountPaymentEntity> loanAccountPaymentsEntities = loanAccount.getAccountPayments();
for (AccountPaymentEntity accountPaymentEntity : loanAccountPaymentsEntities) {
loanAccountPayments.add(accountPaymentEntity.toScreenDto());
}
//for new group loan accounts
if (loanAccount.isGroupLoanAccount() && null == loanAccount.getParentAccount()) {
for (LoanBO member : loanAccount.getMemberAccounts()) {
for (AccountPaymentEntity accPayment : member.getAccountPayments()) {
if (!accPayment.isLoanDisbursment()) {
loanAccountPayments.add(accPayment.toScreenDto());
}
}
}
Collections.sort(loanAccountPayments, new AccountPaymentDtoComperator());
Collections.reverse(loanAccountPayments);
}
return loanAccountPayments;
}
Aggregations