use of org.mifos.dto.screen.LoanCycleCounter in project head by mifos.
the class CustomerDaoHibernate method runLoanCycleQuery.
@SuppressWarnings("unchecked")
private List<LoanCycleCounter> runLoanCycleQuery(final String queryName, final Integer customerId) {
Map<String, Object> queryParameters = new HashMap<String, Object>();
queryParameters.put("customerId", customerId);
List<LoanCycleCounter> loanCycleCounters = new ArrayList<LoanCycleCounter>();
List<Object[]> queryResult = (List<Object[]>) genericDao.executeNamedQuery(queryName, queryParameters);
if (null != queryResult && queryResult.size() > 0) {
for (Object[] objects : queryResult) {
loanCycleCounters.add(new LoanCycleCounter((String) objects[0], (Integer) objects[1]));
}
}
return loanCycleCounters;
}
use of org.mifos.dto.screen.LoanCycleCounter in project head by mifos.
the class GroupServiceFacadeWebTier method assembleGroupPerformanceHistoryDto.
private GroupPerformanceHistoryDto assembleGroupPerformanceHistoryDto(GroupPerformanceHistoryEntity groupPerformanceHistory, String searchId, Short branchId, Integer groupId) {
Integer activeClientCount = this.customerDao.getActiveAndOnHoldClientCountForGroup(searchId, branchId);
Money lastGroupLoanAmountMoney = groupPerformanceHistory.getLastGroupLoanAmount();
String lastGroupLoanAmount = "";
if (lastGroupLoanAmountMoney != null) {
lastGroupLoanAmount = lastGroupLoanAmountMoney.toString();
}
String avgLoanAmountForMember = this.customerDao.getAvgLoanAmountForMemberInGoodOrBadStanding(searchId, branchId);
String totalLoanAmountForGroup = this.customerDao.getTotalLoanAmountForGroup(searchId, branchId);
String portfolioAtRisk;
String totalSavingsAmount;
try {
if (groupPerformanceHistory.getPortfolioAtRisk() == null) {
portfolioAtRisk = "0";
} else {
portfolioAtRisk = groupPerformanceHistory.getPortfolioAtRisk().toString();
}
} catch (CurrencyMismatchException e) {
portfolioAtRisk = localizedMessageLookup("errors.multipleCurrencies");
}
totalSavingsAmount = this.customerDao.getTotalSavingsAmountForGroupandClientsOfGroup(searchId, branchId);
List<LoanCycleCounter> loanCycleCounters = this.customerDao.fetchLoanCycleCounter(groupId, CustomerLevel.GROUP.getValue());
return new GroupPerformanceHistoryDto(activeClientCount.toString(), lastGroupLoanAmount, avgLoanAmountForMember, totalLoanAmountForGroup, portfolioAtRisk, totalSavingsAmount, loanCycleCounters);
}
use of org.mifos.dto.screen.LoanCycleCounter in project head by mifos.
the class LoanCycleCounterTest method testEqualsObject.
public void testEqualsObject() {
LoanCycleCounter x = new LoanCycleCounter();
LoanCycleCounter notx = new LoanCycleCounter();
LoanCycleCounter y = new LoanCycleCounter();
LoanCycleCounter z = new LoanCycleCounter();
x.setOfferingName("Loan1");
notx.setOfferingName("Loan2");
y.setOfferingName("Loan1");
z.setOfferingName("Loan1");
TestUtils.assertEqualsAndHashContract(x, notx, y, z);
}
use of org.mifos.dto.screen.LoanCycleCounter in project head by mifos.
the class ClientServiceFacadeWebTier method assembleClientPerformanceHistoryDto.
private ClientPerformanceHistoryDto assembleClientPerformanceHistoryDto(ClientPerformanceHistoryEntity clientPerformanceHistory, Integer clientId) {
Integer loanCycleNumber = clientPerformanceHistory.getLoanCycleNumber();
Money lastLoanAmount = clientPerformanceHistory.getLastLoanAmount();
Integer noOfActiveLoans = clientPerformanceHistory.getNoOfActiveLoans();
String delinquentPortfolioAmountString;
try {
Money delinquentPortfolioAmount = clientPerformanceHistory.getDelinquentPortfolioAmount();
delinquentPortfolioAmountString = delinquentPortfolioAmount.toString();
} catch (CurrencyMismatchException e) {
delinquentPortfolioAmountString = localizedMessageLookup("errors.multipleCurrencies");
}
// TODO currency mismatch check
Money totalSavingsAmount = clientPerformanceHistory.getTotalSavingsAmount();
Integer meetingsAttended = this.customerDao.numberOfMeetings(true, clientId).getMeetingsAttended();
Integer meetingsMissed = customerDao.numberOfMeetings(false, clientId).getMeetingsMissed();
List<LoanCycleCounter> loanCycleCounters = this.customerDao.fetchLoanCycleCounter(clientId, CustomerLevel.CLIENT.getValue());
return new ClientPerformanceHistoryDto(loanCycleNumber, lastLoanAmount.toString(), noOfActiveLoans, delinquentPortfolioAmountString, totalSavingsAmount.toString(), meetingsAttended, meetingsMissed, loanCycleCounters);
}
use of org.mifos.dto.screen.LoanCycleCounter in project head by mifos.
the class CustomerHelpersIntegrationTest method testLoanCycleCounter.
@Test
public void testLoanCycleCounter() {
LoanCycleCounter loanCycleCounter = new LoanCycleCounter();
loanCycleCounter.setCounter(1);
loanCycleCounter.setOfferingName("offeringName");
Assert.assertEquals("value of counter", 1, loanCycleCounter.getCounter());
Assert.assertEquals("value of offering name", "offeringName", loanCycleCounter.getOfferingName());
loanCycleCounter = new LoanCycleCounter("offeringName");
LoanCycleCounter loanCycleCounter1 = new LoanCycleCounter("offeringName");
LoanCycleCounter loanCycleCounter2 = new LoanCycleCounter("offeringName1");
Assert.assertTrue(loanCycleCounter.equals(loanCycleCounter1));
Assert.assertFalse(loanCycleCounter.equals(loanCycleCounter2));
}
Aggregations