package thyyxxk.webserver.controller.highreport;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import thyyxxk.webserver.config.auth.PassToken;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.highreport.HighReportDto;
import thyyxxk.webserver.entity.highreport.ReportBaseInfo;
import thyyxxk.webserver.service.highreport.HighReportService;

import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * @Description: 指控指标报表统一查询入口
 * @Author: hsh
 * @CreateTime: 2022-10-31  17:03
 * @Version: 1.0
 */
@RestController
@RequestMapping("/highReport")
public class HighReportController {

    private final HighReportService service;

    @Autowired
    public HighReportController(HighReportService service) {
        this.service = service;
    }

    @PassToken
    @PostMapping("/selectReportPortal")
    public ResultVo<Map<String, Object>> selectReportPortal(@RequestBody @Validated HighReportDto dto){
        return service.selectReportPortal(dto);
    }

    @PassToken
    @PostMapping("/selectReportPortalMenu")
    public ResultVo<ReportBaseInfo> selectReportPortalMenu(@RequestBody @Validated HighReportDto dto){
        return service.selectReportPortalMenu(dto);
    }

    @PassToken
    @PostMapping("/exportReportPortalData")
    public void exportReportPortalData(HttpServletResponse response, @RequestBody @Validated HighReportDto dto){
        service.exportReportPortalData(response, dto);
    }

    @PassToken
    @PostMapping("/selectReportGroup")
    public ResultVo<Map<String, Object>> selectReportGroup(@RequestBody @Validated HighReportDto dto){
        return service.selectReportGroup(dto);
    }

    @PassToken
    @PostMapping("/selectReportInfoData")
    public ResultVo<ReportBaseInfo> selectReportInfoData(@RequestBody @Validated HighReportDto dto){
        return service.selectReportInfoData(dto);
    }

}
