use of org.mifos.dto.domain.CenterPerformanceHistoryDto 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);
}
use of org.mifos.dto.domain.CenterPerformanceHistoryDto in project head by mifos.
the class CustomerDaoHibernate method getCenterPerformanceHistory.
/**
* FIXME: THIS METHOD DOES NOT WORK. Specifically, the portfolioAtRisk calculation. Please see issue 2204.
*/
@Override
public CenterPerformanceHistoryDto getCenterPerformanceHistory(String searchId, Short officeId) {
Integer activeAndOnHoldGroupCount;
Integer activeAndOnHoldClientCount;
String totalSavings;
String totalLoan;
activeAndOnHoldGroupCount = getActiveAndOnHoldChildrenCount(searchId, officeId, CustomerLevel.GROUP);
activeAndOnHoldClientCount = getActiveAndOnHoldChildrenCount(searchId, officeId, CustomerLevel.CLIENT);
try {
totalSavings = retrieveTotalSavings(searchId, officeId).toString();
} catch (CurrencyMismatchException e) {
totalSavings = localizedMessageLookup("errors.multipleCurrencies");
}
try {
totalLoan = retrieveTotalLoan(searchId, officeId).toString();
} catch (CurrencyMismatchException e) {
totalLoan = localizedMessageLookup("errors.multipleCurrencies");
}
String portfolioAtRisk = "0.2";
return new CenterPerformanceHistoryDto(activeAndOnHoldGroupCount, activeAndOnHoldClientCount, totalLoan, totalSavings, portfolioAtRisk);
}
Aggregations