package com.ruoyi.postCheck.controller;

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

import com.ruoyi.postCheck.domain.problemStatistics.ProblemNumberBase;
import com.ruoyi.postCheck.domain.tools.ProblemCategory;
import io.swagger.annotations.*;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.postCheck.domain.PostCheckedProblem;
import com.ruoyi.postCheck.service.IPostCheckedProblemService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 岗检问题表Controller
 *
 * @author csg
 * @date 2023-12-23
 */
@Api(tags = "3.3.1/6.2.1-岗检问题表接口")
@RestController
@RequestMapping("/postCheck/postCheckedProblem")
public class PostCheckedProblemController extends BaseController {
    @Autowired
    private IPostCheckedProblemService postCheckedProblemService;

    /**
     * 查询岗检问题表列表
     */
    @ApiOperation("6.2.1-岗检问题库：查询岗检问题表列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "主键", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "status", value = "状态：1-待指定整改人（问题录入完成时）；2-待填写方案（部门管理员指定整改人后）；3-方案填写完成；10-部门审核通过；11-部门审核驳回；20-专业部门人审核（非必填）通过；21-专业部门人审核驳回（非必填）；30-整改人待上传实施（整改人上传实施图片）；31-上传实施照片完成；40-复查部门人审核通过；41-复查部门人审核驳回", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "problemNo", value = "问题编号（需要甲方提供规则规则）", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "checkWorkgroupId", value = "检查工作组ID", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "checkGroupId", value = "检查小组ID", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "checkUserId", value = "检查人员ID", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "deptApproveUserId", value = "审核1：整改部门经理ID", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "deptApproveTime", value = "审核1：整改部门经理审核时间", dataType = "Date", dataTypeClass = Date.class),
            @ApiImplicitParam(name = "specialityDepartmentReviewerId", value = "审核2：专业部门的审核人ID（非必选，方案填写人选择）", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "specialityDepartmentReviewTime", value = "审核2：专业部门审核人审核时间", dataType = "Date", dataTypeClass = Date.class),
            @ApiImplicitParam(name = "problemLevel", value = "问题等级（一般、重要）", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "dutyType", value = "职责类别：1-业务职责；2-党建及党风廉政；3-安全环保职责；4-合规保密职；", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "problemAttribute", value = "问题属性（完整问题、有效性问题、适宜性问题）", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "problemCategory", value = "问题类别（职责权限问题、工作内容问题、工作标准问题、考核奖励问题、任职资格问题、其他）", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "description", value = "问题描述", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "problemCause", value = "问题原因", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "isImmediatelyCorrected", value = "是否立行立改(1-Yes；2-No；)", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "rectificationMeasure", value = "整改措施", dataType = "String", dataTypeClass = String.class),

            @ApiImplicitParam(name = "checkedDeptId", value = "整改责任部门ID（被检查部门ID）", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "checkedPostId", value = "整改责任岗位ID（被检查岗位ID）", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "checkedDeptName", value = "整改责任部门名称（被检查部门名称）", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "checkedPostName", value = "整改责任岗位名称（被检查岗位名称）", dataType = "String", dataTypeClass = String.class),

            @ApiImplicitParam(name = "rectificationResponsibleUserId", value = "整改责任人ID", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "rectificationPeriod", value = "整改期限", dataType = "Date", dataTypeClass = Date.class),
            @ApiImplicitParam(name = "isRectificationCompleted", value = "整改情况-是否完成(1-Yes；2-No；)", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "rectificationCompletionTime", value = "整改完成时间", dataType = "Date", dataTypeClass = Date.class),
            @ApiImplicitParam(name = "rectificationCompletionImg", value = "整改完成图片磁盘路径", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "reviewDepartmentReviewerId", value = "审核3：复查部门的审核人ID（措施上传时必选，实施人选择）", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "reviewDepartmentReviewerTime", value = "审核3：复查部门的审核人复查时间", dataType = "Date", dataTypeClass = Date.class),
            @ApiImplicitParam(name = "reviewConclusion", value = "复查结论", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "reason", value = "未通过理由", dataType = "String", dataTypeClass = String.class),
//            @ApiImplicitParam(name = "delFlag", value = "删除标志（0代表存在 2代表删除）", dataType = "Integer", dataTypeClass = Integer.class),
//            @ApiImplicitParam(name = "createUserId", value = "创建者用户ID", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "checkTime", 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),
            @ApiImplicitParam(name = "orderBy", value = "排序字段", dataType = "String", dataTypeClass = String.class)
    })
    @PreAuthorize("@ss.hasPermi('postCheck:postCheckedProblem:list')")
    @GetMapping("/list")
    public TableDataInfo list(PostCheckedProblem postCheckedProblem) {

//        startPage();
        startPage("desc","t1.create_time");
        List<PostCheckedProblem> list = postCheckedProblemService.selectPostCheckedProblemList(postCheckedProblem);
        return getDataTable(list);
    }

    /**
     * 导出岗检问题表列表
     */
    @ApiOperation("导出岗检问题表列表")
    @PreAuthorize("@ss.hasPermi('postCheck:postCheckedProblem:export')")
    @Log(title = "岗检问题表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PostCheckedProblem postCheckedProblem) {
        List<PostCheckedProblem> list = postCheckedProblemService.selectPostCheckedProblemList(postCheckedProblem);
        ExcelUtil<PostCheckedProblem> util = new ExcelUtil<PostCheckedProblem>(PostCheckedProblem.class);
        util.exportExcel(response, list, "岗检问题表数据");
    }

    /**
     * 获取岗检问题表详细信息
     */
    @ApiOperation("获取岗检问题表详细信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "主键", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "status", value = "状态：1-待指定整改人（问题录入完成时）；2-待填写方案（部门管理员指定整改人后）；3-方案填写完成；10-部门审核通过；11-部门审核驳回；20-专业部门人审核（非必填）通过；21-专业部门人审核驳回（非必填）；30-整改人待上传实施（整改人上传实施图片）；31-上传实施照片完成；40-复查部门人审核通过；41-复查部门人审核驳回", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "problemNo", value = "问题编号（需要甲方提供规则规则）", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "checkWorkgroupId", value = "检查工作组ID", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "checkGroupId", value = "检查小组ID", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "checkUserId", value = "检查人员ID", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "checkUserName", value = "检查人姓名", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "deptApproveUserId", value = "审核1：整改部门经理ID", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "deptApproveTime", value = "审核1：整改部门经理审核时间", dataType = "Date", dataTypeClass = Date.class),
            @ApiImplicitParam(name = "specialityDepartmentReviewerId", value = "审核2：专业部门的审核人ID（非必选，方案填写人选择）", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "specialityDepartmentReviewTime", value = "审核2：专业部门审核人审核时间", dataType = "Date", dataTypeClass = Date.class),
            @ApiImplicitParam(name = "problemLevel", value = "问题等级（一般、重要）", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "dutyType", value = "职责类别：1-业务职责；2-党建及党风廉政；3-安全环保职责；4-合规保密职；", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "problemAttribute", value = "问题属性（完整问题、有效性问题、适宜性问题）", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "problemCategory", value = "问题类别（职责权限问题、工作内容问题、工作标准问题、考核奖励问题、任职资格问题、其他）", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "description", value = "问题描述", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "problemCause", value = "问题原因", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "isImmediatelyCorrected", value = "是否立行立改(1-Yes；2-No；)", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "rectificationMeasure", value = "整改措施", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "checkedDeptId", value = "整改责任部门ID（被检查部门ID）", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "checkedPostId", value = "整改责任岗位ID（被检查岗位ID）", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "rectificationResponsibleUserId", value = "整改责任人ID", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "rectificationPeriod", value = "整改期限", dataType = "Date", dataTypeClass = Date.class),
            @ApiImplicitParam(name = "isRectificationCompleted", value = "整改情况-是否完成(1-Yes；2-No；)", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "rectificationCompletionTime", value = "整改完成时间", dataType = "Date", dataTypeClass = Date.class),
            @ApiImplicitParam(name = "rectificationCompletionImg", value = "整改完成图片磁盘路径", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "reviewDepartmentReviewerId", value = "审核3：复查部门的审核人ID（措施上传时必选，实施人选择）", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "reviewDepartmentReviewerTime", value = "审核3：复查部门的审核人复查时间", dataType = "Date", dataTypeClass = Date.class),
            @ApiImplicitParam(name = "reviewConclusion", value = "复查结论", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "reason", value = "未通过理由", dataType = "String", dataTypeClass = String.class),
//            @ApiImplicitParam(name = "delFlag", value = "删除标志（0代表存在 2代表删除）", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "createUserId", value = "创建者用户ID", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "checkTime", value = "检查时间", dataType = "Date", dataTypeClass = Date.class),
    })
    @PreAuthorize("@ss.hasPermi('postCheck:postCheckedProblem:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(postCheckedProblemService.selectPostCheckedProblemById(id));
    }

    /**
     * 新增岗检问题表
     */
    @ApiOperation("新增岗检问题表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "planInfoId", value = "岗检计划明细ID（岗检问题录入时列表的唯一标识）", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "id", value = "主键", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "status", value = "状态：1-待指定整改人（问题录入完成时）；2-待填写方案（部门管理员指定整改人后）；3-方案填写完成；10-部门审核通过；11-部门审核驳回；20-专业部门人审核（非必填）通过；21-专业部门人审核驳回（非必填）；30-整改人待上传实施（整改人上传实施图片）；31-上传实施照片完成；40-复查部门人审核通过；41-复查部门人审核驳回", dataType = "Integer", dataTypeClass = Integer.class),
//            @ApiImplicitParam(name = "problemNo", value = "问题编号（需要甲方提供规则规则）", dataType = "String", dataTypeClass = String.class),
//            @ApiImplicitParam(name = "checkWorkgroupId", value = "检查工作组ID", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "checkGroupId", value = "检查小组ID", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "checkUserId", value = "检查人员ID", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "deptApproveUserId", value = "审核1：整改部门经理ID", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "deptApproveTime", value = "审核1：整改部门经理审核时间", dataType = "Date", dataTypeClass = Date.class),
//            @ApiImplicitParam(name = "specialityDepartmentReviewerId", value = "审核2：专业部门的审核人ID（非必选，方案填写人选择）", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "specialityDepartmentReviewTime", value = "审核2：专业部门审核人审核时间", dataType = "Date", dataTypeClass = Date.class),
            @ApiImplicitParam(name = "checkUserName", value = "检查人姓名", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "problemLevel", value = "问题等级（一般、重要）", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "dutyType", value = "职责类别：1-业务职责；2-党建及党风廉政；3-安全环保职责；4-合规保密职；", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "problemAttribute", value = "问题属性（完整问题、有效性问题、适宜性问题）", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "problemCategory", value = "问题类别（职责权限问题、工作内容问题、工作标准问题、考核奖励问题、任职资格问题、其他）", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "description", value = "问题描述", dataType = "String", dataTypeClass = String.class),
//            @ApiImplicitParam(name = "problemCause", value = "问题原因", dataType = "String", dataTypeClass = String.class),
//            @ApiImplicitParam(name = "isImmediatelyCorrected", value = "是否立行立改(1-Yes；2-No；)", dataType = "Integer", dataTypeClass = Integer.class),
//            @ApiImplicitParam(name = "rectificationMeasure", value = "整改措施", dataType = "String", dataTypeClass = String.class),
//            @ApiImplicitParam(name = "checkedDeptId", value = "整改责任部门ID（被检查部门ID）", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "checkedPostId", value = "整改责任岗位ID（被检查岗位ID）", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "rectificationResponsibleUserId", value = "整改责任人ID", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "rectificationPeriod", value = "整改期限", dataType = "Date", dataTypeClass = Date.class),
//            @ApiImplicitParam(name = "isRectificationCompleted", value = "整改情况-是否完成(1-Yes；2-No；)", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "rectificationCompletionTime", value = "整改完成时间", dataType = "Date", dataTypeClass = Date.class),
//            @ApiImplicitParam(name = "rectificationCompletionImg", value = "整改完成图片磁盘路径", dataType = "String", dataTypeClass = String.class),
//            @ApiImplicitParam(name = "reviewDepartmentReviewerId", value = "审核3：复查部门的审核人ID（措施上传时必选，实施人选择）", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "reviewDepartmentReviewerTime", value = "审核3：复查部门的审核人复查时间", dataType = "Date", dataTypeClass = Date.class),
//            @ApiImplicitParam(name = "reviewConclusion", value = "复查结论", dataType = "String", dataTypeClass = String.class),
//            @ApiImplicitParam(name = "reason", value = "未通过理由", dataType = "String", dataTypeClass = String.class),
//            @ApiImplicitParam(name = "delFlag", value = "删除标志（0代表存在 2代表删除）", dataType = "Integer", dataTypeClass = Integer.class),
//            @ApiImplicitParam(name = "createUserId", value = "创建者用户ID", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "checkTime", value = "检查时间", dataType = "Date", dataTypeClass = Date.class),
    })
    @PreAuthorize("@ss.hasPermi('postCheck:postCheckedProblem:add')")
    @Log(title = "岗检问题表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody List<PostCheckedProblem> postCheckedProblemList) {
        return toAjax(postCheckedProblemService.insertPostCheckedProblem(postCheckedProblemList));
//        return toAjax(1);
    }

    /**
     * 修改岗检问题表
     */
    @ApiOperation("修改岗检问题表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "主键", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "status", value = "状态：1-待指定整改人（问题录入完成时）；2-待填写方案（部门管理员指定整改人后）；3-方案填写完成；10-部门审核通过；11-部门审核驳回；20-专业部门人审核（非必填）通过；21-专业部门人审核驳回（非必填）；30-整改人待上传实施（整改人上传实施图片）；31-上传实施照片完成；40-复查部门人审核通过；41-复查部门人审核驳回", dataType = "Integer", dataTypeClass = Integer.class),
//            @ApiImplicitParam(name = "problemNo", value = "问题编号（需要甲方提供规则规则）", dataType = "String", dataTypeClass = String.class),
//            @ApiImplicitParam(name = "checkWorkgroupId", value = "检查工作组ID", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "checkGroupId", value = "检查小组ID", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "checkUserId", value = "检查人员ID", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "deptApproveUserId", value = "审核1：整改部门经理ID", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "deptApproveTime", value = "审核1：整改部门经理审核时间", dataType = "Date", dataTypeClass = Date.class),
//            @ApiImplicitParam(name = "specialityDepartmentReviewerId", value = "审核2：专业部门的审核人ID（非必选，方案填写人选择）", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "specialityDepartmentReviewTime", value = "审核2：专业部门审核人审核时间", dataType = "Date", dataTypeClass = Date.class),
            @ApiImplicitParam(name = "checkUserName", value = "检查人姓名", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "problemLevel", value = "问题等级（一般、重要）", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "problemAttribute", value = "问题属性（完整问题、有效性问题、适宜性问题）", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "problemCategory", value = "问题类别（职责权限问题、工作内容问题、工作标准问题、考核奖励问题、任职资格问题、其他）", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "description", value = "问题描述", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "problemCause", value = "问题原因", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "isImmediatelyCorrected", value = "是否立行立改(1-Yes；2-No；)", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "rectificationMeasure", value = "整改措施", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "checkedDeptId", value = "整改责任部门ID（被检查部门ID）", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "checkedPostId", value = "整改责任岗位ID（被检查岗位ID）", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "rectificationResponsibleUserId", value = "整改责任人ID", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "rectificationPeriod", value = "整改期限", dataType = "Date", dataTypeClass = Date.class),
            @ApiImplicitParam(name = "isRectificationCompleted", value = "整改情况-是否完成(1-Yes；2-No；)", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "rectificationCompletionTime", value = "整改完成时间", dataType = "Date", dataTypeClass = Date.class),
            @ApiImplicitParam(name = "rectificationCompletionImg", value = "整改完成图片磁盘路径", dataType = "String", dataTypeClass = String.class),
//            @ApiImplicitParam(name = "reviewDepartmentReviewerId", value = "审核3：复查部门的审核人ID（措施上传时必选，实施人选择）", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "reviewDepartmentReviewerTime", value = "审核3：复查部门的审核人复查时间", dataType = "Date", dataTypeClass = Date.class),
//            @ApiImplicitParam(name = "reviewConclusion", value = "复查结论", dataType = "String", dataTypeClass = String.class),
//            @ApiImplicitParam(name = "reason", value = "未通过理由", dataType = "String", dataTypeClass = String.class),
//            @ApiImplicitParam(name = "delFlag", value = "删除标志（0代表存在 2代表删除）", dataType = "Integer", dataTypeClass = Integer.class),
//            @ApiImplicitParam(name = "createUserId", value = "创建者用户ID", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "checkTime", value = "检查时间", dataType = "Date", dataTypeClass = Date.class),
            @ApiImplicitParam(name = "dutyType", value = "职责类别：1-业务职责；2-党建及党风廉政；3-安全环保职责；4-合规保密职；", dataType = "Integer", dataTypeClass = Integer.class),
    })
    @PreAuthorize("@ss.hasPermi('postCheck:postCheckedProblem:edit')")
    @Log(title = "岗检问题表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody List<PostCheckedProblem> postCheckedProblemList) {
        return toAjax(postCheckedProblemService.updatePostCheckedProblem(postCheckedProblemList));
    }

    /**
     * 删除岗检问题表
     */
    @ApiOperation("删除岗检问题表")
    @ApiImplicitParam(name = "ids", value = "Long类型的主键数组", dataType = "Long[]", dataTypeClass = Long[].class)
    @PreAuthorize("@ss.hasPermi('postCheck:postCheckedProblem:remove')")
    @Log(title = "岗检问题表", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(postCheckedProblemService.deletePostCheckedProblemByIds(ids));
    }


    @ApiOperation("步骤1->指定方案填写人：设置整改责任人")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ids", value = "多个主键英文逗号拼接", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "rectificationResponsibleUserId", value = "整改责任人ID", dataType = "Long", dataTypeClass = Long.class)
    })
    @Log(title = "指定方案填写人", businessType = BusinessType.UPDATE)
    @PutMapping("/setRectificationResponsibleUserId")
//    public AjaxResult setRectificationResponsibleUserId(Long id, Long rectificationResponsibleUserId) {
    public AjaxResult setRectificationResponsibleUserId(String ids, Long rectificationResponsibleUserId) {
        return toAjax(postCheckedProblemService.setRectificationResponsibleUserId(ids, rectificationResponsibleUserId));
    }

    @ApiOperation("步骤2->方案整改：整改实施人填写方案")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "主键", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "problemCause", value = "问题原因", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "isImmediatelyCorrected", value = "是否立行立改(1-Yes；2-No；)", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "rectificationMeasure", value = "整改措施/建议", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "rectificationResponsibleUserId", value = "整改责任人ID", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "rectificationPeriod", value = "整改期限", dataType = "Date", dataTypeClass = Date.class),
    })
    @Log(title = "方案整改", businessType = BusinessType.UPDATE)
    @PutMapping("/updateRectificationMeasure")
    public AjaxResult updateRectificationMeasure(Long id, String problemCause, Integer isImmediatelyCorrected, String rectificationMeasure, Long rectificationResponsibleUserId, Date rectificationPeriod) {
        return toAjax(postCheckedProblemService.updateRectificationMeasure(id, problemCause, isImmediatelyCorrected, rectificationMeasure, rectificationResponsibleUserId, rectificationPeriod));
    }


    @ApiOperation("步骤3->指定专业部门的审核人（非必选操作）")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "主键", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "specialityDepartmentReviewerId", value = "专业部门的审核人ID", dataType = "Long", dataTypeClass = Long.class)
    })
    @Log(title = "指定专业部门的审核人", businessType = BusinessType.UPDATE)
    @PutMapping("/setSpecialityDepartmentReviewerId")
    public AjaxResult setSpecialityDepartmentReviewerId(Long id, Long specialityDepartmentReviewerId) {
        return toAjax(postCheckedProblemService.setSpecialityDepartmentReviewerId(id, specialityDepartmentReviewerId));
    }



    @ApiOperation("步骤4->审核1：部门经理审核")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "主键", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "status", value = "10-部门审核通过；11-部门审核驳回；", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "reason", value = "未通过理由", dataType = "String", dataTypeClass = String.class),
    })
    @Log(title = "审核1：部门经理审核", businessType = BusinessType.UPDATE)
    @PutMapping("/setDeptApproveTime")
    public AjaxResult setDeptApproveTime(Long id, Integer status, String reason) {
        return toAjax(postCheckedProblemService.setDeptApproveTime(id, status,  reason));
    }



    @ApiOperation("步骤5->审核2：专业部门审核人审核")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "主键", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "status", value = "20-专业部门人审核（非必填）通过；21-专业部门人审核驳回（非必填）；", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "reason", value = "未通过理由", dataType = "String", dataTypeClass = String.class),
    })
    @Log(title = "审核2：专业部门审核人审核", businessType = BusinessType.UPDATE)
    @PutMapping("/setSpecialityDepartmentReviewTime")
    public AjaxResult setSpecialityDepartmentReviewTime(Long id, Integer status, String reason) {
        return toAjax(postCheckedProblemService.setSpecialityDepartmentReviewTime(id, status,  reason));
    }


    @ApiOperation("步骤6->实施整改：上传实施照片")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "主键", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "isRectificationCompleted", value = "整改情况-是否完成(1-Yes；2-No；)", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "rectificationCompletionTime", value = "整改完成时间", dataType = "Date", dataTypeClass = Date.class),
            @ApiImplicitParam(name = "rectificationCompletionImg", value = "整改完成图片磁盘路径", dataType = "String", dataTypeClass = String.class),
    })
    @Log(title = "实施整改", businessType = BusinessType.UPDATE)
    @PutMapping("/updateRectificationCompletionImg")
    public AjaxResult updateRectificationCompletionImg(Long id, Integer isRectificationCompleted, Date rectificationCompletionTime, String rectificationCompletionImg) {
        return toAjax(postCheckedProblemService.updateRectificationCompletionImg(id, isRectificationCompleted, rectificationCompletionTime, rectificationCompletionImg));
    }


    @ApiOperation("步骤7->指定复查人")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "主键", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "reviewDepartmentReviewerId", value = "复查人ID", dataType = "Long", dataTypeClass = Long.class)
    })
    @Log(title = "指定复查人", businessType = BusinessType.UPDATE)
    @PutMapping("/setReviewDepartmentReviewerId")
    public AjaxResult setReviewDepartmentReviewerId(Long id, Long reviewDepartmentReviewerId) {
        return toAjax(postCheckedProblemService.setReviewDepartmentReviewerId(id, reviewDepartmentReviewerId));
    }


    @ApiOperation("步骤8->审核3：复查部门的审核人复查")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "主键", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "status", value = "30-复查部门人审核通过；31-复查部门人审核驳回", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "reviewConclusion", value = "复查结论", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "reason", value = "未通过理由", dataType = "String", dataTypeClass = String.class),
    })
    @Log(title = "审核3：复查部门的审核人复查", businessType = BusinessType.UPDATE)
    @PutMapping("/setReviewDepartmentReviewerTime")
    public AjaxResult setReviewDepartmentReviewerTime(Long id, Integer status, String reviewConclusion, String reason) {
        return toAjax(postCheckedProblemService.setReviewDepartmentReviewerTime(id, status, reviewConclusion, reason));
    }



    @ApiOperation("Tools-1、按问题属性分组统计问题类别")
    @GetMapping("/problemCategoryByAttribute")
    public AjaxResult problemCategoryByAttribute(ProblemCategory noParam) {

// GROUP BY problem_attribute -- 问题属性（1-完整问题；2-有效性问题；3-适宜性问题；）
// GROUP BY problem_category -- 问题类别（职责权限问题、工作内容问题、工作标准问题、考核奖励问题、任职资格问题、其他）

        List<ProblemCategory> problemCategoryByAttributeList = postCheckedProblemService.problemCategoryByAttribute();

        return success(problemCategoryByAttributeList);
    }

}
