package com.zjrs.zwnw.rlzysc.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.mohrss.leaf.core.framework.web.controller.AjaxResponse;
import com.zjrs.zwnw.rlzysc.bpo.CxtjBPO;
import com.zjrs.zwnw.rlzysc.dto.CxtjQueryDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import java.io.IOException;

@Api("查询统计")
@RestController
@RequestMapping("/api/rlzysc/cxtj")
public class CxtjController {

    private static final Logger logger = LoggerFactory.getLogger(CxtjController.class);

    @Resource
    private CxtjBPO cxtjBPO;

    @ApiOperation(value = "获取单位岗位推荐列表", notes = "获取单位岗位推荐列表")
    @PostMapping(value = "/dwgwtj/list")
    public AjaxResponse dwtjcxList(@RequestBody @Valid CxtjQueryDTO dto){
        AjaxResponse ajaxResponse = new AjaxResponse();
        ajaxResponse.setData("data", cxtjBPO.dwtjcxList(dto));
        ajaxResponse.setData("pagenum", dto.getPagenum());
        ajaxResponse.setData("pagesize", dto.getPagesize());
        return ajaxResponse;
    }

    @ApiOperation(value = "获取个人求职推荐列表", notes = "获取个人求职推荐列表")
    @PostMapping(value = "/grqztj/list")
    public AjaxResponse grqztjList(@RequestBody @Valid CxtjQueryDTO dto){
        AjaxResponse ajaxResponse = new AjaxResponse();
        ajaxResponse.setData("data", cxtjBPO.grqztjList(dto));
        ajaxResponse.setData("pagenum", dto.getPagenum());
        ajaxResponse.setData("pagesize", dto.getPagesize());
        return ajaxResponse;
    }

    @ApiOperation(value = "获取简历预览历史列表", notes = "获取简历预览历史列表")
    @PostMapping(value = "/jlylls/list")
    public AjaxResponse jlyllsList(@RequestBody @Valid CxtjQueryDTO dto){
        AjaxResponse ajaxResponse = new AjaxResponse();
        ajaxResponse.setData("data", cxtjBPO.jlyllsList(dto));
        ajaxResponse.setData("pagenum", dto.getPagenum());
        ajaxResponse.setData("pagesize", dto.getPagesize());
        return ajaxResponse;
    }

    @ApiOperation(value = "单位岗位推荐列表导出")
    @PostMapping(value = "/dwgwtj/exp")
    public void dwtjcxExp(@RequestBody CxtjQueryDTO dto, HttpServletResponse res) throws IOException {
        cxtjBPO.dwtjcxExp(dto, res);
    }

    @ApiOperation(value = "个人求职推荐列表导出")
    @PostMapping(value = "/grqztj/exp")
    public void grqztjExp(@RequestBody CxtjQueryDTO dto, HttpServletResponse res) throws IOException {
        cxtjBPO.grqztjExp(dto, res);
    }

    @ApiOperation(value = "个人求职推荐列表导出")
    @PostMapping(value = "/jlylls/exp")
    public void jlyllsExp(@RequestBody CxtjQueryDTO dto, HttpServletResponse res) throws IOException {
        cxtjBPO.jlyllsExp(dto, res);
    }
}
