package com.ningdatech.carapi.car.rpt.controller;


import com.ningdatech.carapi.car.rpt.manage.RptDailyManage;
import com.ningdatech.carapi.car.rpt.model.dto.*;
import com.ningdatech.carapi.car.rpt.model.vo.*;
import com.ningdatech.carapi.common.util.ExcelDownUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 * 报表统计 前端控制器
 * </p>
 *
 * @author PoffyZhang
 * @since 2022-11-08
 */

@RequestMapping("/api/car-rpt")
@RequiredArgsConstructor
@RestController
@Api(tags = "车辆管理-统计报表")
@Validated
public class RptDailyController {

    private final RptDailyManage rptDailyManage;

    @ApiOperation("浙江省专用车辆上线率日报")
    @GetMapping("/daily-special-vehicles-launch-rate")
    public List<RptDailySpecialVehiclesLaunchRateVO> dailySpecialVehiclesLaunchRate(
            @Valid @ModelAttribute RptDailySpecialVehiclesLaunchRateParamDTO param) {
        return rptDailyManage.dailySpecialVehiclesLaunchRate(param);
    }

    @ApiOperation("浙江省运营商车辆上线率日报")
    @GetMapping("/daily-operator-vehicles-launch-rate")
    public List<RptDailyOperatorVehiclesLaunchRateVO> dailyOperatorVehiclesLaunchRate(
            @Valid @ModelAttribute RptDailyOperatorVehiclesLaunchRateParamDTO param) {
        return rptDailyManage.dailyOperatorVehiclesLaunchRate(param);
    }

    @ApiOperation("专用车辆企业上线率低于60日报")
    @GetMapping("/daily-special-vehicles-company-launch-rate-60")
    public List<RptDailySpecialVehiclesCompanyLaunchRate60VO> dailySpecialVehiclesCompanyLaunchRate(
            @Valid @ModelAttribute RptDailySpecialVehiclesCompanyLaunchRateParamDTO param) {
        return rptDailyManage.dailySpecialVehiclesCompanyLaunchRate(param);
    }

    @ApiOperation("专用车辆超速日报")
    @GetMapping("/daily-special-vehicles-overspeed")
    public List<RptDailySpecialVehiclesOverspeedVO> dailySpecialVehiclesOverspeed(
            @Valid @ModelAttribute RptDailySpecialVehiclesOverspeedParamDTO param) {
        return rptDailyManage.dailySpecialVehiclesOverspeed(param);
    }

    @ApiOperation("超速企业情况日报")
    @GetMapping("/daily-overspeed-company")
    public List<RptDailyOverspeedCompanyVO> dailyOverspeedCompany(
            @Valid @ModelAttribute RptDailyOverspeedCompanyParamDTO param) {
        return rptDailyManage.dailyOverspeedCompany(param);
    }

    @ApiOperation("超速专用车辆日报")
    @GetMapping("/daily-overspeed-special-vehicles")
    public List<RptDailyOverspeedSpecialVehiclesVO> dailyOverspeedSpecialVehicles(
            @Valid @ModelAttribute RptDailyOverspeedSpecialVehiclesParamDTO param) {
        return rptDailyManage.dailyOverspeedSpecialVehicles(param);
    }

    @ApiOperation("浙江省专用车辆上线率日报表导出")
    @GetMapping("/ZJ-special-vehicles-onlineRate-dailyReport-export")
    public void specialVehiclesOnlineRateDailyReportExport(RptDailySpecialVehiclesLaunchRateParamDTO req, HttpServletResponse response){
        ExcelDownUtil.downXls(response,req,rptDailyManage::specialVehiclesOnlineRateDailyReportExport);
    }

    @ApiOperation("运营商车辆上线率日报表导出")
    @GetMapping("/operators-vehicles-onlineRate-dailyReport-export")
    public void operatorsVehiclesOnlineRateDailyReportExport(RptDailyOperatorVehiclesLaunchRateParamDTO req, HttpServletResponse response){
        ExcelDownUtil.downXls(response,req,rptDailyManage::operatorsVehiclesOnlineRateDailyReportExport);
    }

    @ApiOperation("浙江省专用车辆上线率低于60%的企业日报表导出")
    @GetMapping("/ZJ-special-vehicles-onlineRate-enterprise-dailyReport-export-60")
    public void specialVehiclesOnlineRateEnterpriseDailyReportExport60(RptDailySpecialVehiclesCompanyLaunchRateParamDTO req, HttpServletResponse response){
        ExcelDownUtil.downXls(response,req,rptDailyManage::specialVehiclesOnlineRateEnterpriseDailyReportExport60);
    }

    @ApiOperation("浙江省专用车辆超速情况日报表导出")
    @GetMapping("/ZJ-special-vehicles-overSpeed-dailyReport-export")
    public void specialVehiclesOverSpeedDailyReportExport(RptDailySpecialVehiclesOverspeedParamDTO req, HttpServletResponse response){
        ExcelDownUtil.downXls(response,req,rptDailyManage::specialVehiclesOverSpeedDailyReportExport);
    }

    @ApiOperation("浙江省超速企业排名日报表导出")
    @GetMapping("/ZJ-overSpeed-enterprise-rank-dailyReport-export")
    public void overSpeedEnterpriseRankDailyReportExport(RptDailyOverspeedCompanyParamDTO req, HttpServletResponse response){
        ExcelDownUtil.downXls(response,req,rptDailyManage::overSpeedEnterpriseRankDailyReportExport);
    }

    @ApiOperation("浙江省超速专用车辆排名日报表导出")
    @GetMapping("/ZJ-overSpeed-special-vehicles-rank-dailyReport-export")
    public void overSpeedSpecialVehiclesRankDailyReportExport(RptDailyOverspeedSpecialVehiclesParamDTO req, HttpServletResponse response){
        ExcelDownUtil.downXls(response,req,rptDailyManage::overSpeedSpecialVehiclesRankDailyReportExport);
    }


}
