use of org.mifos.dto.domain.CustomerDetailDto in project head by mifos.
the class PersonnelRESTController method getLastRepayments.
@RequestMapping(value = "personnel/id-current/last-repayments", method = RequestMethod.GET)
@ResponseBody
public List<LastRepaymentDto> getLastRepayments() {
List<LastRepaymentDto> lastRepayments = new ArrayList<LastRepaymentDto>();
PersonnelBO loanOfficer = personnelDao.findPersonnelById(getCurrentPersonnel().getPersonnelId());
List<CustomerBO> borrowers = new ArrayList<CustomerBO>();
for (CustomerDetailDto group : this.customerDao.findGroupsUnderUser(loanOfficer)) {
borrowers.add(customerDao.findGroupBySystemId(group.getGlobalCustNum()));
for (ClientBO client : this.customerDao.findAllExceptClosedAndCancelledClientsUnderParent(group.getSearchId(), loanOfficer.getOffice().getOfficeId())) {
borrowers.add(client);
}
}
for (ClientBO client : this.customerDao.findAllExceptClosedAndCancelledClientsWithoutGroupForLoanOfficer(loanOfficer.getPersonnelId(), loanOfficer.getOffice().getOfficeId())) {
borrowers.add(client);
}
for (CustomerBO borrower : borrowers) {
List<LoanBO> loans = borrower.getOpenLoanAccountsAndGroupLoans();
if (loans != null && loans.size() != 0) {
LoanBO lastLoan = null;
Date lastLoanDate = null;
for (LoanBO loan : loans) {
Date lastAction = null;
for (AccountActionDateEntity accountAction : loan.getAccountActionDates()) {
if (lastAction == null || lastAction.before(accountAction.getActionDate())) {
lastAction = accountAction.getActionDate();
}
}
if (lastLoanDate == null || lastLoanDate.before(lastAction)) {
lastLoan = loan;
lastLoanDate = lastAction;
}
}
if (lastLoan == null || lastLoanDate == null) {
continue;
}
ClientDescriptionDto clientDescription = new ClientDescriptionDto(borrower.getCustomerId(), borrower.getDisplayName(), borrower.getGlobalCustNum(), borrower.getSearchId());
LoanDetailDto loanDetails = new LoanDetailDto(lastLoan.getGlobalAccountNum(), lastLoan.getLoanOffering().getPrdOfferingName(), lastLoan.getAccountState().getId(), lastLoan.getAccountState().getName(), lastLoan.getLoanBalance().toString(), lastLoan.getTotalAmountDue().toString(), lastLoan.getAccountType().getAccountTypeId(), lastLoan.getTotalAmountInArrears().toString());
LastRepaymentDto lastRepayment = new LastRepaymentDto(clientDescription, loanDetails, lastLoanDate);
if (borrower instanceof GroupBO) {
lastRepayment.setGroup(true);
}
lastRepayments.add(lastRepayment);
}
}
return lastRepayments;
}
use of org.mifos.dto.domain.CustomerDetailDto in project head by mifos.
the class PentahoParamParser method updatePossibleValuesForParam.
private Map<String, String> updatePossibleValuesForParam(ListParameter paramDefEntry, ParameterContext paramContext, Map<String, AbstractPentahoParameter> selectedValues) throws ReportDataFactoryException {
Map<String, String> result = new HashMap<String, String>();
String id;
if (parameterIsOffice(paramDefEntry.getName())) {
ParameterValues paramValues = paramDefEntry.getValues(paramContext);
for (int i = 0; i < paramValues.getRowCount(); i++) {
String key = String.valueOf(paramValues.getKeyValue(i));
String value = String.valueOf(paramValues.getTextValue(i));
result.put(key, value);
}
} else if (parameterIsCenter(paramDefEntry.getName())) {
String keyValue = searchKey("(.*officer$)|(.*officer_id$)", selectedValues, paramDefEntry.getName());
if (!keyValue.equals("")) {
id = (String) selectedValues.get(keyValue).getParamValue();
if (!id.equals("-1")) {
List<CustomerDetailDto> customerList = ApplicationContextProvider.getBean(CenterServiceFacade.class).retrieveCustomersUnderUser(new Short(id));
for (CustomerDetailDto office : customerList) {
String key = office.getCustomerId().toString();
String value = office.getDisplayName();
result.put(key, value);
}
} else {
ParameterValues paramValues = paramDefEntry.getValues(paramContext);
for (int i = 0; i < paramValues.getRowCount(); i++) {
String key = String.valueOf(paramValues.getKeyValue(i));
String value = String.valueOf(paramValues.getTextValue(i));
result.put(key, value);
}
}
} else {
keyValue = searchKey("(selected_office$)|(.*BRANCH_NAME.*)", selectedValues, paramDefEntry.getName());
if (!keyValue.equals("")) {
id = (String) selectedValues.get(keyValue).getParamValue();
if (!id.equals("-1")) {
List<CustomerDetailDto> customerList = ApplicationContextProvider.getBean(CenterServiceFacade.class).retrieveCustomersUnderBranch(new Short(id));
for (CustomerDetailDto office : customerList) {
String key = office.getCustomerId().toString();
String value = office.getDisplayName();
result.put(key, value);
}
} else {
ParameterValues paramValues = paramDefEntry.getValues(paramContext);
for (int i = 0; i < paramValues.getRowCount(); i++) {
String key = String.valueOf(paramValues.getKeyValue(i));
String value = String.valueOf(paramValues.getTextValue(i));
result.put(key, value);
}
}
} else {
ParameterValues paramValues = paramDefEntry.getValues(paramContext);
for (int i = 0; i < paramValues.getRowCount(); i++) {
String key = String.valueOf(paramValues.getKeyValue(i));
String value = String.valueOf(paramValues.getTextValue(i));
result.put(key, value);
}
}
}
String key = "-1";
String value = "All";
result.put(key, value);
} else if (parameterIsGroup(paramDefEntry.getName())) {
String keyValue = searchKey("(.*officer*)", selectedValues, paramDefEntry.getName());
if (!keyValue.equals("")) {
id = (String) selectedValues.get(keyValue).getParamValue();
if (!id.equals("-1")) {
List<CustomerDetailDto> customerList = ApplicationContextProvider.getBean(CenterServiceFacade.class).retrieveGroupForPentahoReport(new Short(id));
for (CustomerDetailDto office : customerList) {
String key = office.getCustomerId().toString();
String value = office.getDisplayName();
result.put(key, value);
}
} else {
ParameterValues paramValues = paramDefEntry.getValues(paramContext);
for (int i = 0; i < paramValues.getRowCount(); i++) {
String key = String.valueOf(paramValues.getKeyValue(i));
String value = String.valueOf(paramValues.getTextValue(i));
result.put(key, value);
}
}
} else {
ParameterValues paramValues = paramDefEntry.getValues(paramContext);
for (int i = 0; i < paramValues.getRowCount(); i++) {
String key = String.valueOf(paramValues.getKeyValue(i));
String value = String.valueOf(paramValues.getTextValue(i));
result.put(key, value);
}
}
String key = "-1";
String value = "All";
result.put(key, value);
} else if (parameterIsOfficer(paramDefEntry.getName())) {
String keyValue = searchKey("(.*office$)|(.*office_id$)|(.*branch_id$)|(.*office$)|(.*selectedBranch.*)", selectedValues, paramDefEntry.getName());
if (!keyValue.equals("")) {
id = (String) selectedValues.get(keyValue).getParamValue();
if (!id.equals("-1")) {
ChangeAccountStatusDto changeAccountStatusDto = ApplicationContextProvider.getBean(LoanAccountServiceFacade.class).retrieveLoanOfficerDetailsForBranch(new Short(id));
List<PersonnelDto> officers = changeAccountStatusDto.getLoanOfficers();
for (PersonnelDto officer : officers) {
String key = officer.getPersonnelId().toString();
String value = officer.getDisplayName();
result.put(key, value);
}
}
String key = "-1";
String value = "All";
result.put(key, value);
}
} else {
ParameterValues paramValues = paramDefEntry.getValues(paramContext);
for (int i = 0; i < paramValues.getRowCount(); i++) {
String key = String.valueOf(paramValues.getKeyValue(i));
String value = String.valueOf(paramValues.getTextValue(i));
result.put(key, value);
}
}
return result;
}
use of org.mifos.dto.domain.CustomerDetailDto in project head by mifos.
the class CenterServiceFacadeWebTier method retrieveCustomersUnderBranch.
@Override
public List<CustomerDetailDto> retrieveCustomersUnderBranch(Short branchId) {
List<CustomerDetailDto> customers = null;
try {
customers = new ArrayList<CustomerDetailDto>();
List<PersonnelBO> officers = personnelBusinessService.getActiveLoanOfficersUnderOffice(branchId);
for (PersonnelBO officer : officers) {
customers.addAll(retrieveCustomersUnderUser(officer.getPersonnelId()));
}
} catch (ServiceException e) {
}
return customers;
}
use of org.mifos.dto.domain.CustomerDetailDto in project head by mifos.
the class CenterServiceFacadeWebTier method retrieveCustomersUnderUser.
@Override
public List<CustomerDetailDto> retrieveCustomersUnderUser(Short loanOfficerId) {
PersonnelBO loanOfficer = this.personnelDao.findPersonnelById(loanOfficerId);
List<CustomerDetailDto> customerList = new ArrayList<CustomerDetailDto>();
if (ClientRules.getCenterHierarchyExists()) {
customerList = this.customerDao.findActiveCentersUnderUser(loanOfficer);
} else {
customerList = this.customerDao.findGroupsUnderUser(loanOfficer);
}
return customerList;
}
use of org.mifos.dto.domain.CustomerDetailDto in project head by mifos.
the class GroupTransferAction method transferToCenter.
@TransactionDemarcate(validateAndResetToken = true)
@CloseSession
public ActionForward transferToCenter(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
GroupTransferActionForm actionForm = (GroupTransferActionForm) form;
GroupBO groupInSession = (GroupBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
CustomerDetailDto groupDetail = this.groupServiceFacade.transferGroupToCenter(groupInSession.getGlobalCustNum(), actionForm.getCenterSystemId(), groupInSession.getVersionNo());
GroupBO group = this.customerDao.findGroupBySystemId(groupDetail.getGlobalCustNum());
SessionUtils.setAttribute(Constants.BUSINESS_KEY, group, request);
return mapping.findForward(ActionForwards.update_success.toString());
}
Aggregations