Search in sources :

Example 1 with CustomerDetailDto

use of org.mifos.dto.domain.CustomerDetailDto in project head by mifos.

the class CenterServiceFacadeWebTier method getCenterInformationDto.

@Override
public CenterInformationDto getCenterInformationDto(String globalCustNum) {
    MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    UserContext userContext = toUserContext(user);
    CenterBO center = customerDao.findCenterBySystemId(globalCustNum);
    if (center == null) {
        throw new MifosRuntimeException("Center not found for globalCustNum" + globalCustNum);
    }
    try {
        personnelDao.checkAccessPermission(userContext, center.getOfficeId(), center.getLoanOfficerId());
    } catch (AccountException e) {
        throw new MifosRuntimeException("Access denied!", e);
    }
    CenterDisplayDto centerDisplay = customerDao.getCenterDisplayDto(center.getCustomerId(), userContext);
    Integer centerId = center.getCustomerId();
    String searchId = center.getSearchId();
    Short branchId = centerDisplay.getBranchId();
    CustomerAccountSummaryDto customerAccountSummary = customerDao.getCustomerAccountSummaryDto(centerId);
    CenterPerformanceHistoryDto centerPerformanceHistory = customerDao.getCenterPerformanceHistory(searchId, branchId);
    CustomerAddressDto centerAddress = customerDao.getCustomerAddressDto(center);
    List<CustomerDetailDto> groups = customerDao.getGroupsOtherThanClosedAndCancelledForGroup(searchId, branchId);
    List<CustomerNoteDto> recentCustomerNotes = customerDao.getRecentCustomerNoteDto(centerId);
    List<CustomerPositionOtherDto> customerPositions = customerDao.getCustomerPositionDto(centerId, userContext);
    List<SavingsDetailDto> savingsDetail = customerDao.getSavingsDetailDto(centerId, userContext);
    CustomerMeetingDto customerMeeting = customerDao.getCustomerMeetingDto(center.getCustomerMeeting(), userContext);
    List<AccountBO> allClosedLoanAndSavingsAccounts = customerDao.retrieveAllClosedLoanAndSavingsAccounts(centerId);
    List<SavingsDetailDto> closedSavingsAccounts = new ArrayList<SavingsDetailDto>();
    for (AccountBO closedAccount : allClosedLoanAndSavingsAccounts) {
        if (closedAccount.getAccountType().getAccountTypeId() == AccountTypes.SAVINGS_ACCOUNT.getValue().intValue()) {
            closedSavingsAccounts.add(new SavingsDetailDto(closedAccount.getGlobalAccountNum(), ((SavingsBO) closedAccount).getSavingsOffering().getPrdOfferingName(), closedAccount.getAccountState().getId(), closedAccount.getAccountState().getName(), ((SavingsBO) closedAccount).getSavingsBalance().toString()));
        }
    }
    //new SurveysPersistence().isActiveSurveysForSurveyType(SurveyType.CENTER);
    Boolean activeSurveys = Boolean.FALSE;
    List<SurveyDto> customerSurveys = new ArrayList<SurveyDto>();
    List<CustomFieldDto> customFields = new ArrayList<CustomFieldDto>();
    return new CenterInformationDto(centerDisplay, customerAccountSummary, centerPerformanceHistory, centerAddress, groups, recentCustomerNotes, customerPositions, savingsDetail, customerMeeting, activeSurveys, customerSurveys, customFields, closedSavingsAccounts);
}
Also used : CustomerAccountSummaryDto(org.mifos.dto.domain.CustomerAccountSummaryDto) SurveyDto(org.mifos.dto.domain.SurveyDto) ArrayList(java.util.ArrayList) CenterBO(org.mifos.customers.center.business.CenterBO) CustomerAddressDto(org.mifos.dto.domain.CustomerAddressDto) CenterPerformanceHistoryDto(org.mifos.dto.domain.CenterPerformanceHistoryDto) AccountBO(org.mifos.accounts.business.AccountBO) CustomerAccountBO(org.mifos.customers.business.CustomerAccountBO) CustomerMeetingDto(org.mifos.dto.domain.CustomerMeetingDto) CustomerNoteDto(org.mifos.dto.domain.CustomerNoteDto) CustomerDetailDto(org.mifos.dto.domain.CustomerDetailDto) CustomerPositionOtherDto(org.mifos.dto.domain.CustomerPositionOtherDto) CenterInformationDto(org.mifos.dto.domain.CenterInformationDto) SavingsDetailDto(org.mifos.dto.domain.SavingsDetailDto) UserContext(org.mifos.security.util.UserContext) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) MifosUser(org.mifos.security.MifosUser) AccountException(org.mifos.accounts.exceptions.AccountException) CenterDisplayDto(org.mifos.dto.domain.CenterDisplayDto) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 2 with CustomerDetailDto

use of org.mifos.dto.domain.CustomerDetailDto in project head by mifos.

the class ClientServiceFacadeWebTier method retrieveMfiInfoForEdit.

@Override
public ClientMfiInfoDto retrieveMfiInfoForEdit(String clientSystemId) {
    MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    UserContext userContext = toUserContext(user);
    ClientBO client = this.customerDao.findClientBySystemId(clientSystemId);
    String groupDisplayName = "";
    String centerDisplayName = "";
    if (client.getParentCustomer() != null) {
        groupDisplayName = client.getParentCustomer().getDisplayName();
        if (client.getParentCustomer().getParentCustomer() != null) {
            centerDisplayName = client.getParentCustomer().getParentCustomer().getDisplayName();
        }
    }
    List<PersonnelDto> loanOfficersList = new ArrayList<PersonnelDto>();
    if (!client.isClientUnderGroup()) {
        CenterCreation centerCreation = new CenterCreation(client.getOffice().getOfficeId(), userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
        loanOfficersList = this.personnelDao.findActiveLoanOfficersForOffice(centerCreation);
    }
    CustomerDetailDto customerDetail = client.toCustomerDetailDto();
    ClientDetailDto clientDetail = client.toClientDetailDto(ClientRules.isFamilyDetailsRequired());
    return new ClientMfiInfoDto(groupDisplayName, centerDisplayName, loanOfficersList, customerDetail, clientDetail);
}
Also used : UserContext(org.mifos.security.util.UserContext) CenterCreation(org.mifos.dto.domain.CenterCreation) ClientBO(org.mifos.customers.client.business.ClientBO) ClientDetailDto(org.mifos.dto.screen.ClientDetailDto) ArrayList(java.util.ArrayList) CustomerDetailDto(org.mifos.dto.domain.CustomerDetailDto) PersonnelDto(org.mifos.dto.domain.PersonnelDto) MifosUser(org.mifos.security.MifosUser) ClientMfiInfoDto(org.mifos.dto.screen.ClientMfiInfoDto)

Example 3 with CustomerDetailDto

use of org.mifos.dto.domain.CustomerDetailDto in project head by mifos.

the class ClientServiceFacadeWebTier method retrieveFamilyInfoForEdit.

@Override
public ClientFamilyInfoDto retrieveFamilyInfoForEdit(String clientGlobalCustNum) {
    ClientBO client = this.customerDao.findClientBySystemId(clientGlobalCustNum);
    ClientDropdownsDto clientDropdowns = retrieveClientDropdownData();
    ClientRulesDto clientRules = retrieveClientRules();
    CustomerDetailDto customerDetail = client.toCustomerDetailDto();
    ClientDetailDto clientDetail = client.toClientDetailDto(clientRules.isFamilyDetailsRequired());
    List<ClientNameDetailDto> familyMembers = new ArrayList<ClientNameDetailDto>();
    Map<Integer, List<ClientFamilyDetailDto>> clientFamilyDetails = new HashMap<Integer, List<ClientFamilyDetailDto>>();
    int familyMemberCount = 0;
    for (ClientNameDetailEntity clientNameDetailEntity : client.getNameDetailSet()) {
        if (clientNameDetailEntity.isNotClientNameType()) {
            ClientNameDetailDto nameView1 = clientNameDetailEntity.toDto();
            familyMembers.add(nameView1);
            for (ClientFamilyDetailEntity clientFamilyDetailEntity : client.getFamilyDetailSet()) {
                if (clientNameDetailEntity.matchesCustomerId(clientFamilyDetailEntity.getClientName().getCustomerNameId())) {
                    ClientFamilyDetailDto clientFamilyDetail = clientFamilyDetailEntity.toDto();
                    addFamilyDetailsDtoToMap(clientFamilyDetails, familyMemberCount, clientFamilyDetail);
                }
            }
            familyMemberCount++;
        }
    }
    return new ClientFamilyInfoDto(clientDropdowns, customerDetail, clientDetail, familyMembers, clientFamilyDetails);
}
Also used : HashMap(java.util.HashMap) ClientBO(org.mifos.customers.client.business.ClientBO) ArrayList(java.util.ArrayList) ClientFamilyDetailDto(org.mifos.dto.screen.ClientFamilyDetailDto) ClientNameDetailDto(org.mifos.dto.screen.ClientNameDetailDto) ClientNameDetailEntity(org.mifos.customers.client.business.ClientNameDetailEntity) ClientRulesDto(org.mifos.dto.domain.ClientRulesDto) ClientDetailDto(org.mifos.dto.screen.ClientDetailDto) CustomerDetailDto(org.mifos.dto.domain.CustomerDetailDto) ArrayList(java.util.ArrayList) List(java.util.List) ClientDropdownsDto(org.mifos.dto.screen.ClientDropdownsDto) ClientFamilyDetailEntity(org.mifos.customers.client.business.ClientFamilyDetailEntity) ClientFamilyInfoDto(org.mifos.dto.screen.ClientFamilyInfoDto)

Example 4 with CustomerDetailDto

use of org.mifos.dto.domain.CustomerDetailDto in project head by mifos.

the class CustomerUIHelperFn method getClientPosition.

public static String getClientPosition(Object customerPositions, Object customer) {
    logger.debug("Inside UI helper function getClientPositions");
    StringBuilder stringBuilder = new StringBuilder();
    if (customerPositions != null && customer != null) {
        logger.debug("Iterating over customerPositions list");
        List<CustomerPositionOtherDto> customerPositionList = (List<CustomerPositionOtherDto>) customerPositions;
        String[] positionNames = new String[customerPositionList.size()];
        int i = 0;
        for (CustomerPositionOtherDto customerPosition : customerPositionList) {
            CustomerDetailDto customerDetails = (CustomerDetailDto) customer;
            if (null != customerPosition && customerPosition.getCustomerId() != null && customerDetails != null) {
                if (customerPosition.getCustomerId().equals((customerDetails).getCustomerId())) {
                    String posName = customerPosition.getPositionName();
                    logger.debug("The position name is " + posName);
                    positionNames[i] = posName;
                    i++;
                }
            }
        }
        for (; i < positionNames.length; i++) {
            positionNames[i] = null;
        }
        stringBuilder.append("(");
        for (int j = 0; j < positionNames.length; j++) {
            if (positionNames[j] != null && positionNames[j] != "") {
                stringBuilder.append(positionNames[j]);
            }
            if (j + 1 < positionNames.length && positionNames[j + 1] != null && positionNames[j + 1] != "") {
                stringBuilder.append(",");
            }
        }
        stringBuilder.append(")");
    }
    if (stringBuilder.toString().equals("()")) {
        return "";
    }
    return stringBuilder.toString();
}
Also used : CustomerDetailDto(org.mifos.dto.domain.CustomerDetailDto) CustomerPositionOtherDto(org.mifos.dto.domain.CustomerPositionOtherDto) List(java.util.List)

Example 5 with CustomerDetailDto

use of org.mifos.dto.domain.CustomerDetailDto in project head by mifos.

the class LoanAccountActionForm method getCustomer.

/**
     * FIXME - keithw - loan refactoring - try to remove this usage from validation stages
     */
@Deprecated
private CustomerBO getCustomer(HttpServletRequest request) throws PageExpiredException, PersistenceException {
    CustomerDetailDto oldCustomer = (CustomerDetailDto) SessionUtils.getAttribute(LoanConstants.LOANACCOUNTOWNER, request);
    Integer oldCustomerId;
    if (oldCustomer == null) {
        oldCustomerId = Integer.parseInt(getCustomerId());
    } else {
        oldCustomerId = oldCustomer.getCustomerId();
    }
    return getCustomer(oldCustomerId);
}
Also used : CustomerDetailDto(org.mifos.dto.domain.CustomerDetailDto)

Aggregations

CustomerDetailDto (org.mifos.dto.domain.CustomerDetailDto)24 ArrayList (java.util.ArrayList)14 ClientBO (org.mifos.customers.client.business.ClientBO)9 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)7 CustomerBO (org.mifos.customers.business.CustomerBO)6 CustomerPositionOtherDto (org.mifos.dto.domain.CustomerPositionOtherDto)5 HashMap (java.util.HashMap)3 List (java.util.List)3 Test (org.junit.Test)3 AccountException (org.mifos.accounts.exceptions.AccountException)3 LoanBO (org.mifos.accounts.loan.business.LoanBO)3 MifosRuntimeException (org.mifos.core.MifosRuntimeException)3 GroupBO (org.mifos.customers.group.business.GroupBO)3 ValueListElement (org.mifos.dto.domain.ValueListElement)3 ClientDetailDto (org.mifos.dto.screen.ClientDetailDto)3 UserContext (org.mifos.security.util.UserContext)3 Date (java.util.Date)2 LocalDate (org.joda.time.LocalDate)2 AccountBO (org.mifos.accounts.business.AccountBO)2 AccountStateEntity (org.mifos.accounts.business.AccountStateEntity)2