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);
}
Aggregations