package com.ruoyi.postCheck.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.postCheck.model.DeptDetaailViewModel;
import com.ruoyi.postCheck.service.IPostCheckedReportService;
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysPostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 岗检报告管理Controller
 *
 * @author csg
 * @date 2023-12-28
 */
//@Api(tags = "99.1.1-岗检历史")
@RestController
@RequestMapping("/postCheck/history")
public class PostCheckedHistoryController extends BaseController {
    @Autowired
    private IPostCheckedReportService postCheckedReportService;

    @Autowired
    private ISysDeptService sysDeptService;

    @Autowired
    private ISysPostService sysPostService;


   /* @ApiOperation("1、岗检历史列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "主键ID", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "reportNo", value = "编码", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "reportName", value = "岗检报告名称", dataType = "String", dataTypeClass = String.class),
//            @ApiImplicitParam(name = "generateTime", value = "生成时间", dataType = "Date", dataTypeClass = Date.class),
            @ApiImplicitParam(name = "pageNum", value = "页码从1开始", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "pageSize", value = "分页大小", dataType = "Integer", dataTypeClass = Integer.class)
    })
    @GetMapping("/list")
    public TableDataInfo list(PostCheckedReport postCheckedReport) {
        startPage("desc", "t1.create_time");
        postCheckedReport.setStatus(PostCheckedReportEnum.STATUS_PASS.getValue());
        List<PostCheckedReport> list = postCheckedReportService.selectPostCheckedReportList(postCheckedReport);
        return getDataTable(list);
    }
*/

//    @ApiOperation("2、查看-第一个表格：1-检查部门；2-岗检岗位；3-完整性问题；4-有效性问题；5-适宜性问题；6-问题总数；7-已整改问题；")
    @GetMapping("/checkStatistics")
    public AjaxResult checkStatistics(Long id) {

//        第一步：、1-检查部门；2-岗检岗位；
//        select * from "public"."post_plan";
//        select * from "public"."post_plan_info";
//        第二步、3-完整性问题；4-有效性问题；5-适宜性问题；6-问题总数；7-已整改问题；
//        select * from "public"."post_checked_problem";

        return success(postCheckedReportService.checkStatistics());
    }

//    @ApiOperation("3、查看-第二个表格：岗检问题")
    @GetMapping("/deptDetaailView")
//    @ApiImplicitParam(name = "id", value = "岗检报告的主键ID", dataType = "Long", dataTypeClass = Long.class)
//    public AjaxResult deptDetaailView(DeptDetaailViewModel model) { //notParam不是参数-是返回信息-方便接口联调
    public AjaxResult deptDetaailView(DeptDetaailViewModel model) { //notParam不是参数-是返回信息-方便接口联调

        //TODO 原型上Table第三列列是“岗位”，和产品沟通一下，应该无法匹配到这个信息，因为问题录入时没有设置岗位信息，是否考虑把这列删除掉
//        查询问题表：按duty_type（职责类别：1-业务职责；2-党建及党风廉政；3-安全环保职责；4-合规保密职；）分组统计问题属性的数量（problem_attribute问题属性（1-完整问题；2-有效性问题；3-适宜性问题；））
//        select * from "public"."post_checked_problem";


        return success(postCheckedReportService.deptDetaailView(model));
    }

}
