package com.xintong.visualinspection.visuallnspection_qzd.controller;

import com.xintong.visualinspection.bean.FwqCheckOther;
import com.xintong.visualinspection.bean.FwqDeptStatistic;
import com.xintong.visualinspection.bean.FwqStatisticsBean;
import com.xintong.visualinspection.util.DateUtil;
import com.xintong.visualinspection.visuallnspection_qzd.service.CheckOtherService_F;
import com.xintong.visualinspection.visuallnspection_qzd.service.StatisticsService_F;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;

@RestController
@RequestMapping("/f/file")
public class FileExcelController_Q extends BaseController {

    @Autowired
    private CheckOtherService_F checkOtherService_f;
    @Autowired
    private StatisticsService_F statisticsService_f;

    /**
     * 稽查管理导出
     * @param req
     * @param resp
     * @param fwqCheckOther
     * @return
     */
    @RequestMapping(value = "/other/check/excel",method=RequestMethod.GET)
    public String getOtherCheck(HttpServletRequest req,HttpServletResponse resp,
                                FwqCheckOther fwqCheckOther){
        checkOtherService_f.getOtherCheckExcel(fwqCheckOther, req, resp);
        return super.returnSuccessResult(null);
    }

    /**
     * 稽查统计-导出
     * @param req
     * @param resp
     * @param fwqCheckOther
     * @returnE
     */
    @RequestMapping(value = "/other/check/static/excel",method= RequestMethod.GET)
    public String getOtherCheckststic(HttpServletRequest req,HttpServletResponse resp,
                                      FwqCheckOther fwqCheckOther){
        checkOtherService_f.getExcel(fwqCheckOther, req, resp);
        return super.returnSuccessResult(null);
    }

    /**
     * 服务区-营运管理综合检查情况统计导出
     * @param req
     * @param resp
     * @param start_date
     * @param end_date
     * @return
     */
    @RequestMapping(value = "/operation/manage/integration",method=RequestMethod.GET)
    public String getOperationInfo(HttpServletRequest req, HttpServletResponse resp,
                                   @RequestParam String start_date, @RequestParam String end_date){
        FwqStatisticsBean obj = new FwqStatisticsBean();
        Date start = DateUtil.strParseDate(start_date);
        Date end = DateUtil.strParseDate(end_date);
        obj.setStart_date(start);
        obj.setEnd_date(end);
        statisticsService_f.getOperationInfo(obj, req, resp);
        return super.returnSuccessResult(null);
    }

    /**
     * 营运管理提升综合成绩汇总表导出
     * @param req
     * @param resp
     * @param fwqDeptStatistic
     * @return
     */
    @RequestMapping(value = "/dept/static/excel",method=RequestMethod.GET)
    public String getDeptCheckststic(HttpServletRequest req,HttpServletResponse resp,
                                     FwqDeptStatistic fwqDeptStatistic){
        statisticsService_f.getDeptStatisticExcel(fwqDeptStatistic, req, resp);
        return super.returnSuccessResult(null);
    }

    /**
     * 考核问题分布报表
     */
    @RequestMapping(value = "/score/item/info",method=RequestMethod.GET)
    public String getScoreItemInfo(HttpServletRequest req,HttpServletResponse resp,
                                   @RequestParam String start_date,@RequestParam String end_date){
        FwqStatisticsBean obj = new FwqStatisticsBean();
        Date start = DateUtil.strParseDate(start_date);
        Date end = DateUtil.strParseDate(end_date);
        obj.setStart_date(start);
        obj.setEnd_date(end);
        statisticsService_f.getFeeStationCheckItemScore(obj, req, resp);
        return super.returnSuccessResult(null);
    }

}
