class CostEffectivenessExcelController extends ExcelChartOCDSController {

    @ApiOperation(value = "Exports *Cost effectiveness* dashboard in Excel format.")
    @RequestMapping(value = "/api/ocds/costEffectivenessExcelChart", method = {RequestMethod.GET, RequestMethod.POST})
    public void costEffectivenessExcelChart(@ModelAttribute @Valid final LangGroupingFilterPagingRequest filter,
                                            final HttpServletResponse response) throws IOException {
        final String chartTitle = translationService.getValue(filter.getLanguage(),
                "charts:costEffectiveness:title");

        // fetch the data that will be displayed in the chart
        final ArrayList<Document> costEffectivenessTenderAwardAmount =
                costEffectivenessVisualsController.costEffectivenessTenderAwardAmount(filter);

        final List<?> categories = excelChartHelper.getCategoriesFromDBObject(getExportYearMonthXAxis(filter),
                costEffectivenessTenderAwardAmount);

        final List<List<? extends Number>> values = new ArrayList<>();

        final List<Number> tenderPrice = excelChartHelper.getValuesFromDBObject(costEffectivenessTenderAwardAmount,
                categories, getExportYearMonthXAxis(filter),
                CostEffectivenessVisualsController.Keys.TOTAL_TENDER_AMOUNT);
        final List<Number> diffPrice = excelChartHelper.getValuesFromDBObject(costEffectivenessTenderAwardAmount,
                categories,  getExportYearMonthXAxis(filter),
                CostEffectivenessVisualsController.Keys.DIFF_TENDER_AWARD_AMOUNT);
        if (!tenderPrice.isEmpty()) {
            values.add(tenderPrice);
        }
        if (!diffPrice.isEmpty()) {
            values.add(diffPrice);
        }

        // check if we have anything to display before setting the *seriesTitle*.
        final List<String> seriesTitle;
        if (!values.isEmpty()) {
            seriesTitle = Arrays.asList(
                    translationService.getValue(filter.getLanguage(),
                            "charts:costEffectiveness:traces:tenderPrice"),
                    translationService.getValue(filter.getLanguage(), "charts:costEffectiveness:traces:awardPrice")
            );
        } else {
            seriesTitle = new ArrayList<>();
        }

        response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
        response.setHeader("Content-Disposition", "attachment; filename=" + chartTitle + ".xlsx");

        response.getOutputStream().write(
                excelChartGenerator.getExcelChart(
                        ChartType.stackedcol,
                        chartTitle,
                        seriesTitle,
                        categories, values));
    }

}