use of org.springframework.web.bind.annotation.RequestMapping in project head by mifos.
the class PersonnelRESTController method getOverdueBorrowersUnderPersonnel.
@RequestMapping(value = "personnel/id-current/overdue_borrowers", method = RequestMethod.GET)
@ResponseBody
public OverdueCustomer[] getOverdueBorrowersUnderPersonnel() {
List<OverdueCustomer> overdueCustomers = new ArrayList<OverdueCustomer>();
PersonnelBO loanOfficer = this.personnelDao.findPersonnelById(getCurrentPersonnel().getPersonnelId());
for (CustomerDetailDto group : this.customerDao.findGroupsUnderUser(loanOfficer)) {
addClientIfHasOverdueLoan(customerDao.findGroupBySystemId(group.getGlobalCustNum()), overdueCustomers);
for (ClientBO client : this.customerDao.findAllExceptClosedAndCancelledClientsUnderParent(group.getSearchId(), loanOfficer.getOffice().getOfficeId())) {
addClientIfHasOverdueLoan(client, overdueCustomers);
}
}
for (ClientBO client : this.customerDao.findAllExceptClosedAndCancelledClientsWithoutGroupForLoanOfficer(loanOfficer.getPersonnelId(), loanOfficer.getOffice().getOfficeId())) {
addClientIfHasOverdueLoan(client, overdueCustomers);
}
return overdueCustomers.toArray(new OverdueCustomer[] {});
}
use of org.springframework.web.bind.annotation.RequestMapping 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.springframework.web.bind.annotation.RequestMapping in project head by mifos.
the class ApprovalController method list.
@RequestMapping("restApprovalList.ftl")
public ModelAndView list() {
ModelAndView mav = new ModelAndView("approval/list");
List<BreadCrumbsLinks> breadcrumbs = new AdminBreadcrumbBuilder().withLink("View REST Approval List", "").build();
mav.addObject("isApprovalRequired", RESTConfigKey.isApprovalRequired(configurationServiceFacade));
mav.addObject("breadcrumbs", breadcrumbs);
mav.addObject("waitingForApprovalList", approvalService.getAllWaiting());
mav.addObject("approvedList", approvalService.getAllNotWaiting());
return mav;
}
use of org.springframework.web.bind.annotation.RequestMapping in project head by mifos.
the class ApprovalController method details.
@RequestMapping("restApproval/id-{id}/details.ftl")
public ModelAndView details(@PathVariable Long id) {
ModelAndView mav = new ModelAndView("approval/details");
mav.addObject("waitingForApprovalList", approvalService.getAllWaiting());
RESTApprovalEntity approval = approvalService.getDetails(id);
mav.addObject("approval", approval);
PersonnelInformationDto p = personnelServiceFacade.getPersonnelInformationDto(approval.getCreatedBy().longValue(), null);
mav.addObject("createdBy", p.getDisplayName());
if (!approval.getState().equals(ApprovalState.WAITING)) {
p = personnelServiceFacade.getPersonnelInformationDto(approval.getApprovedBy().longValue(), null);
mav.addObject("approvedBy", p.getDisplayName());
}
return mav;
}
use of org.springframework.web.bind.annotation.RequestMapping in project head by mifos.
the class JSONAjaxController method deleteCacheDir.
@RequestMapping("jsonAjax.ftl")
public ModelAndView deleteCacheDir(HttpServletResponse response) {
ModelAndView mav;
if (TestMode.MAIN == testingService.getTestMode()) {
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
mav = new ModelAndView("pageNotFound");
} else {
mav = new ModelAndView("jsonAjax");
}
return mav;
}
Aggregations