Search in sources :

Example 1 with SavingsRecentActivityDto

use of org.mifos.dto.screen.SavingsRecentActivityDto in project head by mifos.

the class SavingsAction method getRecentActivity.

@TransactionDemarcate(joinToken = true)
public ActionForward getRecentActivity(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    logger.debug("In SavingsAction::getRecentActivity()");
    SavingsBO savings = (SavingsBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
    Long savingsId = savings.getAccountId().longValue();
    List<SavingsRecentActivityDto> recentActivity = this.savingsServiceFacade.retrieveRecentSavingsActivities(savingsId);
    SessionUtils.setCollectionAttribute(SavingsConstants.RECENTY_ACTIVITY_LIST, recentActivity, request);
    return mapping.findForward("getRecentActivity_success");
}
Also used : SavingsRecentActivityDto(org.mifos.dto.screen.SavingsRecentActivityDto) SavingsBO(org.mifos.accounts.savings.business.SavingsBO) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 2 with SavingsRecentActivityDto

use of org.mifos.dto.screen.SavingsRecentActivityDto in project head by mifos.

the class SavingsActionStrutsTest method testSuccessfulGetRecentActivity.

@Test
public void testSuccessfulGetRecentActivity() throws Exception {
    createInitialObjects();
    Date currentDate = new Date(System.currentTimeMillis());
    savingsOffering = TestObjectFactory.createSavingsProduct("sav prd1", "prd1", currentDate, RecommendedAmountUnit.COMPLETE_GROUP);
    savings = createSavingsAccount("000X00000000018", savingsOffering, AccountState.SAVINGS_PARTIAL_APPLICATION);
    savingsOffering = null;
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, savings, request);
    SessionUtils.setAttribute(Constants.USER_CONTEXT_KEY, TestUtils.makeUser(), request.getSession());
    setRequestPathInfo("/savingsAction.do");
    addRequestParameter("method", "getRecentActivity");
    addRequestParameter("globalAccountNum", savings.getGlobalAccountNum());
    actionPerform();
    verifyForward("getRecentActivity_success");
    verifyNoActionErrors();
    verifyNoActionMessages();
    Assert.assertEquals(0, ((List<SavingsRecentActivityDto>) SessionUtils.getAttribute(SavingsConstants.RECENTY_ACTIVITY_LIST, request)).size());
}
Also used : SavingsRecentActivityDto(org.mifos.dto.screen.SavingsRecentActivityDto) Date(java.util.Date) Test(org.junit.Test)

Example 3 with SavingsRecentActivityDto

use of org.mifos.dto.screen.SavingsRecentActivityDto in project head by mifos.

the class SavingsAccountController method showSavingsAccountRecentActivity.

@RequestMapping(value = "/viewSavingsAccountRecentActivity", method = RequestMethod.GET)
public ModelAndView showSavingsAccountRecentActivity(HttpServletRequest request, HttpServletResponse response) {
    ModelAndView modelAndView = new ModelAndView();
    sitePreferenceHelper.resolveSiteType(modelAndView, "viewSavingsAccountRecentActivity", request);
    modelAndView.addObject("include_page", new IncludePage(request, response));
    String globalAccountNum = request.getParameter("globalAccountNum");
    SavingsAccountDetailDto savingsAccountDetailDto = savingsServiceFacade.retrieveSavingsAccountDetails(globalAccountNum);
    modelAndView.addObject("savingsAccountDetailDto", savingsAccountDetailDto);
    modelAndView.addObject("currentDate", new Date());
    List<SavingsRecentActivityDto> recentActivity = this.savingsServiceFacade.retrieveRecentSavingsActivities(savingsAccountDetailDto.getAccountId().longValue());
    request.setAttribute("recentActivityList", recentActivity);
    savingsServiceFacade.putSavingsBusinessKeyInSession(globalAccountNum, request);
    return modelAndView;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) IncludePage(freemarker.ext.servlet.IncludePage) SavingsRecentActivityDto(org.mifos.dto.screen.SavingsRecentActivityDto) SavingsAccountDetailDto(org.mifos.dto.domain.SavingsAccountDetailDto) Date(java.util.Date) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with SavingsRecentActivityDto

use of org.mifos.dto.screen.SavingsRecentActivityDto in project head by mifos.

the class SavingsBO method toDto.

public SavingsAccountDetailDto toDto() {
    List<SavingsRecentActivityDto> recentActivity = this.getRecentAccountActivity(3);
    List<CustomerNoteDto> recentNoteDtos = new ArrayList<CustomerNoteDto>();
    List<AccountNotesEntity> recentNotes = this.getRecentAccountNotes();
    for (AccountNotesEntity accountNotesEntity : recentNotes) {
        recentNoteDtos.add(new CustomerNoteDto(accountNotesEntity.getCommentDate(), accountNotesEntity.getComment(), accountNotesEntity.getPersonnelName()));
    }
    SavingsPerformanceHistoryDto savingsPerformanceHistoryDto = new SavingsPerformanceHistoryDto(getActivationDate(), savingsPerformance.getTotalDeposits().toString(), savingsPerformance.getTotalWithdrawals().toString(), savingsPerformance.getTotalInterestEarned().toString(), savingsPerformance.getMissedDeposits() != null ? savingsPerformance.getMissedDeposits().toString() : "0");
    AccountActionDateEntity nextInstallment = getDetailsOfNextInstallment();
    return new SavingsAccountDetailDto(this.savingsOffering.toFullDto(), recentActivity, recentNoteDtos, this.recommendedAmount.toString(), this.globalAccountNum, getAccountId(), getState().getValue(), getState().name(), getSavingsBalance().toString(), nextInstallment != null ? nextInstallment.getActionDate() : null, getTotalAmountDue().toString(), getTotalAmountDueForNextInstallment().toString(), getTotalAmountInArrears().toString(), savingsPerformanceHistoryDto, this.savingsOffering.getSavingsTypeAsEnum().name(), this.customer.getCustomerId());
}
Also used : AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) CustomerNoteDto(org.mifos.dto.domain.CustomerNoteDto) ArrayList(java.util.ArrayList) SavingsRecentActivityDto(org.mifos.dto.screen.SavingsRecentActivityDto) AccountNotesEntity(org.mifos.accounts.business.AccountNotesEntity) SavingsPerformanceHistoryDto(org.mifos.dto.domain.SavingsPerformanceHistoryDto) SavingsAccountDetailDto(org.mifos.dto.domain.SavingsAccountDetailDto)

Example 5 with SavingsRecentActivityDto

use of org.mifos.dto.screen.SavingsRecentActivityDto in project head by mifos.

the class SavingsBO method createSavingsRecentActivityView.

private SavingsRecentActivityDto createSavingsRecentActivityView(final SavingsActivityEntity savingActivity) {
    SavingsRecentActivityDto savingsRecentActivityDto = new SavingsRecentActivityDto();
    savingsRecentActivityDto.setAccountTrxnId(savingActivity.getId());
    savingsRecentActivityDto.setActionDate(savingActivity.getTrxnCreatedDate());
    String preferredDate = DateUtils.getUserLocaleDate(this.userContext.getPreferredLocale(), savingActivity.getTrxnCreatedDate().toString());
    savingsRecentActivityDto.setUserPrefferedDate(preferredDate);
    savingsRecentActivityDto.setAmount(removeSign(savingActivity.getAmount()).toString());
    savingsRecentActivityDto.setActivity(savingActivity.getActivity().getName());
    savingsRecentActivityDto.setRunningBalance(savingActivity.getBalanceAmount().toString());
    return savingsRecentActivityDto;
}
Also used : SavingsRecentActivityDto(org.mifos.dto.screen.SavingsRecentActivityDto)

Aggregations

SavingsRecentActivityDto (org.mifos.dto.screen.SavingsRecentActivityDto)6 Date (java.util.Date)3 Test (org.junit.Test)2 SavingsAccountDetailDto (org.mifos.dto.domain.SavingsAccountDetailDto)2 IncludePage (freemarker.ext.servlet.IncludePage)1 ArrayList (java.util.ArrayList)1 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)1 AccountNotesEntity (org.mifos.accounts.business.AccountNotesEntity)1 SavingsActivityEntity (org.mifos.accounts.savings.business.SavingsActivityEntity)1 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)1 CustomerNoteDto (org.mifos.dto.domain.CustomerNoteDto)1 SavingsPerformanceHistoryDto (org.mifos.dto.domain.SavingsPerformanceHistoryDto)1 Money (org.mifos.framework.util.helpers.Money)1 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ModelAndView (org.springframework.web.servlet.ModelAndView)1