Search in sources :

Example 1 with LoanCreationPreviewDto

use of org.mifos.dto.screen.LoanCreationPreviewDto in project head by mifos.

the class LoanAccountServiceFacadeWebTier method previewLoanCreationDetails.

@Override
public LoanCreationPreviewDto previewLoanCreationDetails(Integer customerId, List<LoanAccountDetailsDto> accountDetails, List<String> selectedClientIds) {
    CustomerBO customer = this.customerDao.findCustomerById(customerId);
    final boolean isGroup = customer.isGroup();
    final boolean isGlimEnabled = configurationPersistence.isGlimEnabled();
    List<LoanAccountDetailsDto> loanAccountDetailsView = new ArrayList<LoanAccountDetailsDto>();
    for (String clientIdAsString : selectedClientIds) {
        if (StringUtils.isNotEmpty(clientIdAsString)) {
            LoanAccountDetailsDto tempLoanAccount = new LoanAccountDetailsDto();
            ClientBO client = (ClientBO) this.customerDao.findCustomerById(Integer.valueOf(clientIdAsString));
            LoanAccountDetailsDto account = null;
            for (LoanAccountDetailsDto tempAccount : accountDetails) {
                if (tempAccount.getClientId().equals(clientIdAsString)) {
                    account = tempAccount;
                }
            }
            tempLoanAccount.setClientId(client.getGlobalCustNum().toString());
            tempLoanAccount.setClientName(client.getDisplayName());
            tempLoanAccount.setLoanAmount((null != account.getLoanAmount() && !EMPTY.equals(account.getLoanAmount().toString()) ? account.getLoanAmount() : "0.0"));
            tempLoanAccount.setBusinessActivity(account.getBusinessActivity());
            tempLoanAccount.setGovermentId((StringUtils.isNotBlank(client.getGovernmentId()) ? client.getGovernmentId() : "-").toString());
            loanAccountDetailsView.add(tempLoanAccount);
        }
    }
    return new LoanCreationPreviewDto(isGlimEnabled, isGroup, loanAccountDetailsView);
}
Also used : ClientBO(org.mifos.customers.client.business.ClientBO) ArrayList(java.util.ArrayList) CustomerBO(org.mifos.customers.business.CustomerBO) LoanCreationPreviewDto(org.mifos.dto.screen.LoanCreationPreviewDto) LoanAccountDetailsDto(org.mifos.dto.domain.LoanAccountDetailsDto) MultipleLoanAccountDetailsDto(org.mifos.dto.screen.MultipleLoanAccountDetailsDto)

Aggregations

ArrayList (java.util.ArrayList)1 CustomerBO (org.mifos.customers.business.CustomerBO)1 ClientBO (org.mifos.customers.client.business.ClientBO)1 LoanAccountDetailsDto (org.mifos.dto.domain.LoanAccountDetailsDto)1 LoanCreationPreviewDto (org.mifos.dto.screen.LoanCreationPreviewDto)1 MultipleLoanAccountDetailsDto (org.mifos.dto.screen.MultipleLoanAccountDetailsDto)1