Search in sources :

Example 91 with ClientBO

use of org.mifos.customers.client.business.ClientBO in project head by mifos.

the class ClientRESTController method getClientChargesByNumber.

@RequestMapping(value = "client/num-{globalCustNum}/charges", method = RequestMethod.GET)
@ResponseBody
public CustomerChargesDetailsDto getClientChargesByNumber(@PathVariable String globalCustNum) {
    ClientBO clientBO = customerDao.findClientBySystemId(globalCustNum);
    CustomerChargesDetailsDto clientCharges = centerServiceFacade.retrieveChargesDetails(clientBO.getCustomerId());
    clientCharges.addActivities(centerServiceFacade.retrieveRecentActivities(clientBO.getCustomerId(), 3));
    return clientCharges;
}
Also used : CustomerChargesDetailsDto(org.mifos.dto.domain.CustomerChargesDetailsDto) ClientBO(org.mifos.customers.client.business.ClientBO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 92 with ClientBO

use of org.mifos.customers.client.business.ClientBO in project head by mifos.

the class PersonnelServiceFacadeWebTier method getLoanOfficerCustomersHierarchyForDay.

@Override
public CustomerHierarchyDto getLoanOfficerCustomersHierarchyForDay(Short loanOfficerId, DateTime day) {
    PersonnelBO personnel = personnelDao.findPersonnelById(loanOfficerId);
    CustomerHierarchyDto hierarchy = new CustomerHierarchyDto();
    // Yesterday as current date because upcoming meetings should include current day
    DateTime currentDate = new DateTime().minusDays(1);
    if (ClientRules.getCenterHierarchyExists()) {
        for (CustomerDetailDto center : this.customerDao.findActiveCentersUnderUser(personnel)) {
            CustomerBO centerBO = this.customerDao.findCustomerById(center.getCustomerId());
            if (isCustomerHavingMeetingOnDay(centerBO, day, currentDate)) {
                CenterDescriptionDto centerDescription = new CenterDescriptionDto();
                centerDescription.setId(center.getCustomerId());
                centerDescription.setDisplayName(center.getDisplayName());
                centerDescription.setGlobalCustNum(center.getGlobalCustNum());
                centerDescription.setSearchId(center.getSearchId());
                hierarchy.getCenters().add(centerDescription);
            }
        }
    }
    allGroups: for (CustomerDetailDto group : this.customerDao.findGroupsUnderUser(personnel)) {
        CustomerBO groupBO = this.customerDao.findCustomerById(group.getCustomerId());
        if (isCustomerHavingMeetingOnDay(groupBO, day, currentDate)) {
            GroupDescriptionDto groupDescription = new GroupDescriptionDto();
            groupDescription.setId(group.getCustomerId());
            groupDescription.setDisplayName(group.getDisplayName());
            groupDescription.setGlobalCustNum(group.getGlobalCustNum());
            groupDescription.setSearchId(group.getSearchId());
            for (ClientBO client : this.customerDao.findActiveClientsUnderParent(group.getSearchId(), personnel.getOffice().getOfficeId())) {
                ClientDescriptionDto clientDescription = new ClientDescriptionDto();
                clientDescription.setId(client.getCustomerId());
                clientDescription.setDisplayName(client.getDisplayName());
                clientDescription.setGlobalCustNum(client.getGlobalCustNum());
                clientDescription.setSearchId(client.getSearchId());
                groupDescription.getClients().add(clientDescription);
            }
            for (CenterDescriptionDto center : hierarchy.getCenters()) {
                if (group.getSearchId().startsWith(center.getSearchId())) {
                    center.getGroups().add(groupDescription);
                    continue allGroups;
                }
            }
            hierarchy.getGroups().add(groupDescription);
        }
    }
    return hierarchy;
}
Also used : PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) CenterDescriptionDto(org.mifos.dto.domain.CenterDescriptionDto) ClientBO(org.mifos.customers.client.business.ClientBO) CustomerHierarchyDto(org.mifos.dto.domain.CustomerHierarchyDto) CustomerDetailDto(org.mifos.dto.domain.CustomerDetailDto) CustomerBO(org.mifos.customers.business.CustomerBO) GroupDescriptionDto(org.mifos.dto.domain.GroupDescriptionDto) ClientDescriptionDto(org.mifos.dto.domain.ClientDescriptionDto) DateTime(org.joda.time.DateTime)

Example 93 with ClientBO

use of org.mifos.customers.client.business.ClientBO in project head by mifos.

the class LoanAccountServiceFacadeWebTier method getGuarantorsByLoanId.

public List<CustomerDto> getGuarantorsByLoanId(Integer loanId) throws PersistenceException {
    List<CustomerDto> guarantors = new ArrayList<CustomerDto>();
    List<GuarantyEntity> guaranties = legacyAccountDao.getGuarantyByLoanId(loanId);
    for (GuarantyEntity guaranty : guaranties) {
        ClientBO guarantor = customerDao.findClientById(guaranty.getGuarantorId());
        CustomerDto customerDto = new CustomerDto(guarantor.getCustomerId(), guarantor.getClientName().getDisplayName(), guarantor.getGlobalCustNum(), null);
        guarantors.add(customerDto);
    }
    return guarantors;
}
Also used : GuarantyEntity(org.mifos.accounts.loan.business.GuarantyEntity) ClientBO(org.mifos.customers.client.business.ClientBO) ArrayList(java.util.ArrayList) CustomerDto(org.mifos.dto.domain.CustomerDto)

Aggregations

ClientBO (org.mifos.customers.client.business.ClientBO)93 ArrayList (java.util.ArrayList)27 Test (org.junit.Test)27 CustomerException (org.mifos.customers.exceptions.CustomerException)25 CustomerBO (org.mifos.customers.business.CustomerBO)23 GroupBO (org.mifos.customers.group.business.GroupBO)22 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)22 UserContext (org.mifos.security.util.UserContext)21 MifosRuntimeException (org.mifos.core.MifosRuntimeException)19 CenterBO (org.mifos.customers.center.business.CenterBO)19 BusinessRuleException (org.mifos.service.BusinessRuleException)17 ClientBuilder (org.mifos.domain.builders.ClientBuilder)16 PersistenceException (org.mifos.framework.exceptions.PersistenceException)16 OfficeBO (org.mifos.customers.office.business.OfficeBO)14 GroupBuilder (org.mifos.domain.builders.GroupBuilder)14 ClientNameDetailDto (org.mifos.dto.screen.ClientNameDetailDto)14 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)14 Date (java.util.Date)13 DateTime (org.joda.time.DateTime)13 AccountException (org.mifos.accounts.exceptions.AccountException)13