class AccountingDataController {

    @RequestMapping("renderAccountingData.ftl")
    public final ModelAndView showAccountingDataFor(@RequestParam(value = FROM_DATE) String paramFromDate,
            @RequestParam(value = TO_DATE) String paramToDate) {
        DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd");
        LocalDate fromDate = fmt.parseDateTime(paramFromDate).toLocalDate();
        LocalDate toDate = fmt.parseDateTime(paramToDate).toLocalDate();
        Boolean hasAlreadyRanQuery = Boolean.FALSE;
        String fileName = null;

        List<AccountingDto> accountingData = new ArrayList<AccountingDto>();
        try {
            fileName = accountingService.getExportOutputFileName(fromDate, toDate).replace(".xml", "");
            hasAlreadyRanQuery = accountingService.hasAlreadyRanQuery(fromDate, toDate);
            accountingData = accountingService.getExportDetails(fromDate, toDate);
        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
        }

        ModelAndView mav = new ModelAndView("renderAccountingData");
        List<BreadCrumbsLinks> breadcrumbs = new AdminBreadcrumbBuilder()
                .withLink("accounting.viewaccountingexports", "renderAccountingDataCacheInfo.ftl")
                .withLink(fileName, "").build();
        mav.addObject("breadcrumbs", breadcrumbs);
        mav.addObject("accountingData", accountingData);
        mav.addObject("hasAlreadyRanQuery", hasAlreadyRanQuery);
        mav.addObject("fileName", fileName);
        mav.addObject("fromDate", fromDate);
        mav.addObject("toDate", toDate);

        return mav;
    }

    @Autowired public  AccountingDataController(AccountingService accountingService);

}