List of usage examples for org.joda.time LocalDate toString
@ToString
public String toString()
From source file:org.mifos.application.collectionsheet.persistence.CollectionSheetDaoHibernate.java
License:Open Source License
@Override @SuppressWarnings("unchecked") public List<CollectionSheetCustomerDto> findCustomerHierarchy(final Integer customerId, final LocalDate transactionDate) { Map<String, Object> queryParameters = new HashMap<String, Object>(); queryParameters.put("CUSTOMER_ID", customerId); queryParameters.put("TRANSACTION_DATE", transactionDate.toString()); CollectionSheetCustomerDto topCustomer = execUniqueResultNamedQueryWithResultTransformer( "findCustomerAtTopOfHierarchyAsDto", queryParameters, CollectionSheetCustomerDto.class); if (topCustomer == null) { return new ArrayList<CollectionSheetCustomerDto>(); }/*from w w w.j a v a 2 s.co m*/ final Map<String, Object> withinHierarchyQueryParameters = new HashMap<String, Object>(); withinHierarchyQueryParameters.put("BRANCH_ID", topCustomer.getBranchId()); withinHierarchyQueryParameters.put("SEARCH_ID", topCustomer.getSearchId() + ".%"); withinHierarchyQueryParameters.put("TRANSACTION_DATE", transactionDate.toString()); final List<CollectionSheetCustomerDto> restOfHierarchy = executeNamedQueryWithResultTransformer( "findCustomersWithinHierarchyAsDto", withinHierarchyQueryParameters, CollectionSheetCustomerDto.class); final List<CollectionSheetCustomerDto> collectionSheetCutomerList = new ArrayList<CollectionSheetCustomerDto>(); collectionSheetCutomerList.add(topCustomer); collectionSheetCutomerList.addAll(restOfHierarchy); return collectionSheetCutomerList; }
From source file:org.mifos.application.collectionsheet.persistence.CollectionSheetDaoHibernate.java
License:Open Source License
@Override @SuppressWarnings("unchecked") public Map<Integer, List<CollectionSheetCustomerLoanDto>> findAllLoanRepaymentsForCustomerHierarchy( final Short branchId, final String searchId, final LocalDate transactionDate, final Integer customerAtTopOfHierarchyId) { final Map<Integer, List<CollectionSheetCustomerLoanDto>> allLoanRepaymentsGroupedByCustomerId = new HashMap<Integer, List<CollectionSheetCustomerLoanDto>>(); final Map<String, Object> topOfHierarchyParameters = new HashMap<String, Object>(); topOfHierarchyParameters.put("BRANCH_ID", branchId); topOfHierarchyParameters.put("CUSTOMER_ID", customerAtTopOfHierarchyId); topOfHierarchyParameters.put("TRANSACTION_DATE", transactionDate.toString()); final List<CollectionSheetCustomerLoanDto> loanRepaymentsForCustomerAtTopOfHierarchy = executeNamedQueryWithResultTransformer( "findLoanRepaymentsforCustomerAtTopOfHierarchyAsDto", topOfHierarchyParameters, CollectionSheetCustomerLoanDto.class); if (loanRepaymentsForCustomerAtTopOfHierarchy != null) { allLoanRepaymentsGroupedByCustomerId.put(customerAtTopOfHierarchyId, loanRepaymentsForCustomerAtTopOfHierarchy); }//w w w .j ava 2s . c o m final Map<String, Object> queryParameters = new HashMap<String, Object>(); queryParameters.put("BRANCH_ID", branchId); queryParameters.put("SEARCH_ID", searchId); queryParameters.put("TRANSACTION_DATE", transactionDate.toString()); final List<CollectionSheetCustomerLoanDto> loanRepayments = executeNamedQueryWithResultTransformer( "findLoanRepaymentsforCustomerHierarchyAsDto", queryParameters, CollectionSheetCustomerLoanDto.class); for (CollectionSheetCustomerLoanDto customerLoan : loanRepayments) { final Integer customerId = customerLoan.getCustomerId(); if (allLoanRepaymentsGroupedByCustomerId.containsKey(customerId)) { final List<CollectionSheetCustomerLoanDto> loansForCustomer = allLoanRepaymentsGroupedByCustomerId .get(customerId); Comparator<CollectionSheetCustomerLoanDto> comparator = new Comparator<CollectionSheetCustomerLoanDto>() { @Override public int compare(CollectionSheetCustomerLoanDto cseDto1, CollectionSheetCustomerLoanDto cseDto2) { return cseDto1.getAccountId().compareTo(cseDto2.getAccountId()); } }; Collections.sort(loansForCustomer, comparator); if (Collections.binarySearch(loansForCustomer, customerLoan, comparator) < 0) { loansForCustomer.add(customerLoan); } } else { final List<CollectionSheetCustomerLoanDto> customerLoansForCustomer = new ArrayList<CollectionSheetCustomerLoanDto>(); customerLoansForCustomer.add(customerLoan); allLoanRepaymentsGroupedByCustomerId.put(customerId, customerLoansForCustomer); } } addInformationAboutActiveLoans(allLoanRepaymentsGroupedByCustomerId, queryParameters); return allLoanRepaymentsGroupedByCustomerId; }
From source file:org.mifos.application.collectionsheet.persistence.CollectionSheetDaoHibernate.java
License:Open Source License
@Override @SuppressWarnings("unchecked") public Map<Integer, Map<Integer, List<CollectionSheetLoanFeeDto>>> findOutstandingFeesForLoansOnCustomerHierarchy( final Short branchId, final String searchId, final LocalDate transactionDate, final Integer customerAtTopOfHierarchyId) { final Map<Integer, Map<Integer, List<CollectionSheetLoanFeeDto>>> outstandingLoanFeesGroupedByCustomerId = new HashMap<Integer, Map<Integer, List<CollectionSheetLoanFeeDto>>>(); final Map<String, Object> topOfHierarchyQueryParams = new HashMap<String, Object>(); topOfHierarchyQueryParams.put("BRANCH_ID", branchId); topOfHierarchyQueryParams.put("CUSTOMER_ID", customerAtTopOfHierarchyId); topOfHierarchyQueryParams.put("TRANSACTION_DATE", transactionDate.toString()); final List<CollectionSheetLoanFeeDto> outstandingLoanFeesForTopCustomer = executeNamedQueryWithResultTransformer( "findOutstandingFeesForLoansOnCustomerAtTopOfHierarchyAsDto", topOfHierarchyQueryParams, CollectionSheetLoanFeeDto.class); if (outstandingLoanFeesForTopCustomer != null) { populateLoanFeesMap(outstandingLoanFeesGroupedByCustomerId, outstandingLoanFeesForTopCustomer); }/*from ww w.ja va 2 s .co m*/ final Map<String, Object> withinHierarchyQueryParameters = new HashMap<String, Object>(); withinHierarchyQueryParameters.put("BRANCH_ID", branchId); withinHierarchyQueryParameters.put("SEARCH_ID", searchId); withinHierarchyQueryParameters.put("TRANSACTION_DATE", transactionDate.toString()); final List<CollectionSheetLoanFeeDto> outstandingLoanFees = executeNamedQueryWithResultTransformer( "findOutstandingFeesForLoansOnCustomerHierarchyAsDto", withinHierarchyQueryParameters, CollectionSheetLoanFeeDto.class); if (outstandingLoanFees == null) { return outstandingLoanFeesGroupedByCustomerId; } populateLoanFeesMap(outstandingLoanFeesGroupedByCustomerId, outstandingLoanFees); return outstandingLoanFeesGroupedByCustomerId; }
From source file:org.mifos.application.collectionsheet.persistence.CollectionSheetDaoHibernate.java
License:Open Source License
@Override @SuppressWarnings("unchecked") public Map<Integer, List<CollectionSheetCustomerAccountCollectionDto>> findAccountCollectionsOnCustomerAccount( final Short branchId, final String searchId, final LocalDate transactionDate, final Integer customerAtTopOfHierarchyId) { final Map<String, Object> queryParameters = new HashMap<String, Object>(); queryParameters.put("CUSTOMER_ID", customerAtTopOfHierarchyId); queryParameters.put("TRANSACTION_DATE", transactionDate.toString()); final Map<Integer, List<CollectionSheetCustomerAccountCollectionDto>> accountCollectionsOnCustomerAccountGroupedByCustomerId = new HashMap<Integer, List<CollectionSheetCustomerAccountCollectionDto>>(); CollectionSheetCustomerAccountCollectionDto accountCollectionFeeForHierarchyCustomer = execUniqueResultNamedQueryWithResultTransformer( "findAccountCollectionsOnCustomerAccountForTopCustomerOfHierarchy", queryParameters, CollectionSheetCustomerAccountCollectionDto.class); if (accountCollectionFeeForHierarchyCustomer != null) { accountCollectionsOnCustomerAccountGroupedByCustomerId.put(customerAtTopOfHierarchyId, Arrays.asList(accountCollectionFeeForHierarchyCustomer)); }// w w w.j av a 2s . com final Map<String, Object> withinHierarchyQueryParameters = new HashMap<String, Object>(); withinHierarchyQueryParameters.put("BRANCH_ID", branchId); withinHierarchyQueryParameters.put("SEARCH_ID", searchId); withinHierarchyQueryParameters.put("TRANSACTION_DATE", transactionDate.toString()); final List<CollectionSheetCustomerAccountCollectionDto> customerAccountFees = executeNamedQueryWithResultTransformer( "findAccountCollectionsOnCustomerAccountForCustomerHierarchyAsDto", withinHierarchyQueryParameters, CollectionSheetCustomerAccountCollectionDto.class); for (CollectionSheetCustomerAccountCollectionDto accountCollectionFee : customerAccountFees) { final Integer customerId = accountCollectionFee.getCustomerId(); if (accountCollectionsOnCustomerAccountGroupedByCustomerId.containsKey(customerId)) { final List<CollectionSheetCustomerAccountCollectionDto> customerAccountFeesList = accountCollectionsOnCustomerAccountGroupedByCustomerId .get(customerId); Comparator<CollectionSheetCustomerAccountCollectionDto> comparator = new Comparator<CollectionSheetCustomerAccountCollectionDto>() { @Override public int compare(CollectionSheetCustomerAccountCollectionDto cseDto1, CollectionSheetCustomerAccountCollectionDto cseDto2) { return cseDto1.getAccountId().compareTo(cseDto2.getAccountId()); } }; Collections.sort(customerAccountFeesList, comparator); if (Collections.binarySearch(customerAccountFeesList, accountCollectionFee, comparator) < 0) { customerAccountFeesList.add(accountCollectionFee); } } else { final List<CollectionSheetCustomerAccountCollectionDto> customerAccountFeesList = new ArrayList<CollectionSheetCustomerAccountCollectionDto>(); customerAccountFeesList.add(accountCollectionFee); accountCollectionsOnCustomerAccountGroupedByCustomerId.put(customerId, customerAccountFeesList); } } return accountCollectionsOnCustomerAccountGroupedByCustomerId; }
From source file:org.mifos.application.collectionsheet.persistence.CollectionSheetDaoHibernate.java
License:Open Source License
@Override @SuppressWarnings("unchecked") public Map<Integer, List<CollectionSheetCustomerAccountCollectionDto>> findOutstandingFeesForCustomerAccountOnCustomerHierarchy( final Short branchId, final String searchId, final LocalDate transactionDate, final Integer customerAtTopOfHierarchyId) { final Map<String, Object> queryParameters = new HashMap<String, Object>(); queryParameters.put("CUSTOMER_ID", customerAtTopOfHierarchyId); queryParameters.put("TRANSACTION_DATE", transactionDate.toString()); final Map<Integer, List<CollectionSheetCustomerAccountCollectionDto>> accountCollectionsOnCustomerAccountGroupedByCustomerId = new HashMap<Integer, List<CollectionSheetCustomerAccountCollectionDto>>(); final CollectionSheetCustomerAccountCollectionDto accountCollectionFeeForHierarchyCustomer = execUniqueResultNamedQueryWithResultTransformer( "findOutstandingCustomerAccountFeesForTopCustomerOfHierarchyAsDto", queryParameters, CollectionSheetCustomerAccountCollectionDto.class); if (accountCollectionFeeForHierarchyCustomer != null) { accountCollectionsOnCustomerAccountGroupedByCustomerId.put(customerAtTopOfHierarchyId, Arrays.asList(accountCollectionFeeForHierarchyCustomer)); }/*from w w w .j a v a2 s. c o m*/ final Map<String, Object> withinHierarchyQueryParameters = new HashMap<String, Object>(); withinHierarchyQueryParameters.put("BRANCH_ID", branchId); withinHierarchyQueryParameters.put("SEARCH_ID", searchId); withinHierarchyQueryParameters.put("TRANSACTION_DATE", transactionDate.toString()); final List<CollectionSheetCustomerAccountCollectionDto> customerAccountFees = executeNamedQueryWithResultTransformer( "findOutstandingFeesForCustomerAccountOnCustomerHierarchyAsDto", withinHierarchyQueryParameters, CollectionSheetCustomerAccountCollectionDto.class); if (customerAccountFees == null) { return accountCollectionsOnCustomerAccountGroupedByCustomerId; } for (CollectionSheetCustomerAccountCollectionDto accountCollectionFee : customerAccountFees) { final Integer customerId = accountCollectionFee.getCustomerId(); if (accountCollectionsOnCustomerAccountGroupedByCustomerId.containsKey(customerId)) { final List<CollectionSheetCustomerAccountCollectionDto> customerAccountFeesList = accountCollectionsOnCustomerAccountGroupedByCustomerId .get(customerId); customerAccountFeesList.add(accountCollectionFee); } else { final List<CollectionSheetCustomerAccountCollectionDto> customerAccountFeesList = new ArrayList<CollectionSheetCustomerAccountCollectionDto>(); customerAccountFeesList.add(accountCollectionFee); accountCollectionsOnCustomerAccountGroupedByCustomerId.put(customerId, customerAccountFeesList); } } return accountCollectionsOnCustomerAccountGroupedByCustomerId; }
From source file:org.mifos.application.collectionsheet.persistence.CollectionSheetDaoHibernate.java
License:Open Source License
@Override @SuppressWarnings("unchecked") public Map<Integer, List<CollectionSheetCustomerLoanDto>> findLoanDisbursementsForCustomerHierarchy( final Short branchId, final String searchId, final LocalDate transactionDate, final Integer customerAtTopOfHierarchyId) { final Map<Integer, List<CollectionSheetCustomerLoanDto>> loanDisbursementsGroupedByCustomerId = new HashMap<Integer, List<CollectionSheetCustomerLoanDto>>(); final Map<String, Object> topOfHierarchyQueryParameters = new HashMap<String, Object>(); topOfHierarchyQueryParameters.put("BRANCH_ID", branchId); topOfHierarchyQueryParameters.put("CUSTOMER_ID", customerAtTopOfHierarchyId); topOfHierarchyQueryParameters.put("TRANSACTION_DATE", transactionDate.toString()); final List<CollectionSheetCustomerLoanDto> allLoanDisbursementsForTopCustomer = executeNamedQueryWithResultTransformer( "findLoanDisbursementsforCustomerAtTopOfHierarchyAsDto", topOfHierarchyQueryParameters, CollectionSheetCustomerLoanDto.class); if (allLoanDisbursementsForTopCustomer != null) { populateLoanDisbursement(loanDisbursementsGroupedByCustomerId, allLoanDisbursementsForTopCustomer); }/*from ww w.jav a 2 s.c o m*/ final Map<String, Object> withinHierarchyQueryParameters = new HashMap<String, Object>(); withinHierarchyQueryParameters.put("BRANCH_ID", branchId); withinHierarchyQueryParameters.put("SEARCH_ID", searchId); withinHierarchyQueryParameters.put("TRANSACTION_DATE", transactionDate.toString()); final List<CollectionSheetCustomerLoanDto> allLoanDisbursements = executeNamedQueryWithResultTransformer( "findLoanDisbursementsforCustomerHierarchyAsDto", withinHierarchyQueryParameters, CollectionSheetCustomerLoanDto.class); if (allLoanDisbursements != null) { populateLoanDisbursement(loanDisbursementsGroupedByCustomerId, allLoanDisbursements); } return loanDisbursementsGroupedByCustomerId; }
From source file:org.mifos.platform.accounting.dao.AccountingDaoImpl.java
License:Open Source License
@Override public final List<AccountingDto> getAccountingDataByDate(LocalDate startDate, LocalDate endDate) { Object[] parameter = new Object[] { startDate.toString(), endDate.toString() }; return jdbcTemplate.query(getAccountingDataQuery(), parameter, MAPPER); }
From source file:org.mifos.platform.accounting.dao.AccountingDaoImpl.java
License:Open Source License
@Override public final Integer getNumberOfTrxnByDate(LocalDate startDate, LocalDate endDate) { Object[] parameter = new Object[] { startDate.toString(), endDate.toString() }; return jdbcTemplate.queryForList( "select count(*) from financial_trxn where posted_date between date(?) and date(?) group by posted_date", parameter, Integer.class).size(); }
From source file:org.mifos.platform.accounting.dao.AccountingDaoImpl.java
License:Open Source License
@Override public final List<LocalDate> getTenTxnDate(LocalDate startDate, LocalDate endDate, Integer offset) { Object[] parameter = new Object[] { startDate.toString(), endDate.toString(), offset }; List<LocalDate> tenTrxn = jdbcTemplate.query(getTenTrxDataQuery(), parameter, new ParameterizedRowMapper<LocalDate>() { @Override//from ww w . j a va2 s . co m public LocalDate mapRow(ResultSet rs, int rowNum) throws SQLException { return new LocalDate(rs.getDate(1).getTime()); } }); return tenTrxn; }
From source file:org.mifos.platform.accounting.service.AccountingServiceImpl.java
License:Open Source License
private ExportFileInfo getNotGeneratedExportFileInfo(LocalDate startDate, LocalDate endDate) { String fileName = cacheManager.getExportFileName(startDate, endDate); String lastModified = new DateTime().toString("yyyy-MMM-dd HH:mm z"); Boolean existInCache = false; ExportFileInfo export = new ExportFileInfo(lastModified, fileName, startDate.toString(), endDate.toString(), existInCache);//from ww w . j a va2s .com return export; }