package com.ruoyi.postCheck.controller;

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

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.PostAssessmentRatingOtherInfo;
import com.ruoyi.postCheck.service.IPostAssessmentRatingOtherInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiImplicitParam;

/**
 * 打分表明细(职能互评生产日常)Controller
 *
 * @author csg
 * @date 2024-01-01
 */
@Api(tags = "4.2.1.1-打分表明细(职能互评生产日常)接口")
@RestController
@RequestMapping("/postCheck/postAssessmentRatingOtherInfo")
public class PostAssessmentRatingOtherInfoController extends BaseController {
    @Autowired
    private IPostAssessmentRatingOtherInfoService postAssessmentRatingOtherInfoService;

    /**
     * 查询打分表明细(职能互评生产日常)列表
     */
    @ApiOperation("查询打分表明细(职能互评生产日常)列表")
    @ApiImplicitParams({
//            @ApiImplicitParam(name = "id", value = "主键", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "ratingOtherId", value = "打分表ID", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "dutyType", value = "评分分类/项目/专业：职责类别：1-业务职责；2-党建及党风廉政；3-安全环保职责；4-合规与保密职责；5-任职资格与能力素质要求；6-岗位责任制文件完整性与适宜性；10-工作态度；11-部门协作；12-廉洁从业；13-主要工作完成情况；20-HSE；21-生产；22-设备；", dataType = "Integer", dataTypeClass = Integer.class),
//            @ApiImplicitParam(name = "scoreWeight", value = "分值/权重；（当前考核规则的分和权重镜像到这里）", dataType = "BigDecimal", dataTypeClass = BigDecimal.class),
//            @ApiImplicitParam(name = "rule", value = "考核规则/评分标准（岗检和职能部门时有值）", dataType = "String", dataTypeClass = String.class),
//            @ApiImplicitParam(name = "byDeptId", value = "被评分部门ID", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "byDeptScore", value = "被评分部门得分", dataType = "BigDecimal", dataTypeClass = BigDecimal.class),
//            @ApiImplicitParam(name = "improvementSuggestions", value = "改进建议", dataType = "String", dataTypeClass = String.class),
//            @ApiImplicitParam(name = "createUserId", value = "创建者用户ID", dataType = "Long", dataTypeClass = Long.class),
//            @ApiImplicitParam(name = "delFlag", value = "删除标志（0代表存在 2代表删除）", dataType = "Long", dataTypeClass = Long.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:postAssessmentRatingOtherInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(PostAssessmentRatingOtherInfo postAssessmentRatingOtherInfo) {
        startPage();
        List<PostAssessmentRatingOtherInfo> list = postAssessmentRatingOtherInfoService.selectPostAssessmentRatingOtherInfoList(postAssessmentRatingOtherInfo);
        return getDataTable(list);
    }

    /**
     * 导出打分表明细(职能互评生产日常)列表
     */
    @ApiOperation("导出打分表明细(职能互评生产日常)列表")
    @PreAuthorize("@ss.hasPermi('postCheck:postAssessmentRatingOtherInfo:export')")
    @Log(title = "打分表明细(职能互评生产日常)", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PostAssessmentRatingOtherInfo postAssessmentRatingOtherInfo) {
        List<PostAssessmentRatingOtherInfo> list = postAssessmentRatingOtherInfoService.selectPostAssessmentRatingOtherInfoList(postAssessmentRatingOtherInfo);
        ExcelUtil<PostAssessmentRatingOtherInfo> util = new ExcelUtil<PostAssessmentRatingOtherInfo>(PostAssessmentRatingOtherInfo.class);
        util.exportExcel(response, list, "打分表明细(职能互评生产日常)数据");
    }

    /**
     * 获取打分表明细(职能互评生产日常)详细信息
     */
    @ApiOperation("获取打分表明细(职能互评生产日常)详细信息")
    @PreAuthorize("@ss.hasPermi('postCheck:postAssessmentRatingOtherInfo:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(postAssessmentRatingOtherInfoService.selectPostAssessmentRatingOtherInfoById(id));
    }

    /**
     * 新增打分表明细(职能互评生产日常)
     */
    @ApiOperation("新增打分表明细(职能互评生产日常)")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "主键", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "ratingOtherId", value = "打分表ID", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "dutyType", value = "评分分类/项目/专业：职责类别：1-业务职责；2-党建及党风廉政；3-安全环保职责；4-合规与保密职责；5-任职资格与能力素质要求；6-岗位责任制文件完整性与适宜性；10-工作态度；11-部门协作；12-廉洁从业；13-主要工作完成情况；20-HSE；21-生产；22-设备；", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "scoreWeight", value = "分值/权重；（当前考核规则的分和权重镜像到这里）", dataType = "BigDecimal", dataTypeClass = BigDecimal.class),
            @ApiImplicitParam(name = "rule", value = "考核规则/评分标准（岗检和职能部门时有值）", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "byDeptId", value = "被评分部门ID", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "byDeptScore", value = "被评分部门得分", dataType = "BigDecimal", dataTypeClass = BigDecimal.class),
            @ApiImplicitParam(name = "improvementSuggestions", value = "改进建议", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "createUserId", value = "创建者用户ID", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "delFlag", value = "删除标志（0代表存在 2代表删除）", dataType = "Long", dataTypeClass = Long.class),
    })
    @PreAuthorize("@ss.hasPermi('postCheck:postAssessmentRatingOtherInfo:add')")
    @Log(title = "打分表明细(职能互评生产日常)", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PostAssessmentRatingOtherInfo postAssessmentRatingOtherInfo) {
        return toAjax(postAssessmentRatingOtherInfoService.insertPostAssessmentRatingOtherInfo(postAssessmentRatingOtherInfo));
    }

    /**
     * 修改打分表明细(职能互评生产日常)
     */
    @ApiOperation("修改打分表明细(职能互评生产日常)")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "主键", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "ratingOtherId", value = "打分表ID", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "dutyType", value = "评分分类/项目/专业：职责类别：1-业务职责；2-党建及党风廉政；3-安全环保职责；4-合规与保密职责；5-任职资格与能力素质要求；6-岗位责任制文件完整性与适宜性；10-工作态度；11-部门协作；12-廉洁从业；13-主要工作完成情况；20-HSE；21-生产；22-设备；", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "scoreWeight", value = "分值/权重；（当前考核规则的分和权重镜像到这里）", dataType = "BigDecimal", dataTypeClass = BigDecimal.class),
            @ApiImplicitParam(name = "rule", value = "考核规则/评分标准（岗检和职能部门时有值）", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "byDeptId", value = "被评分部门ID", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "byDeptScore", value = "被评分部门得分", dataType = "BigDecimal", dataTypeClass = BigDecimal.class),
            @ApiImplicitParam(name = "improvementSuggestions", value = "改进建议", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "createUserId", value = "创建者用户ID", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "delFlag", value = "删除标志（0代表存在 2代表删除）", dataType = "Long", dataTypeClass = Long.class),
    })
    @PreAuthorize("@ss.hasPermi('postCheck:postAssessmentRatingOtherInfo:edit')")
    @Log(title = "打分表明细(职能互评生产日常)", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PostAssessmentRatingOtherInfo postAssessmentRatingOtherInfo) {
        return toAjax(postAssessmentRatingOtherInfoService.updatePostAssessmentRatingOtherInfo(postAssessmentRatingOtherInfo));
    }

    /**
     * 删除打分表明细(职能互评生产日常)
     */
    @ApiOperation("删除打分表明细(职能互评生产日常)")
    @ApiImplicitParam(name = "ids", value = "Long类型的主键数组", dataType = "Long[]", dataTypeClass = Long[].class)
    @PreAuthorize("@ss.hasPermi('postCheck:postAssessmentRatingOtherInfo:remove')")
    @Log(title = "打分表明细(职能互评生产日常)", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(postAssessmentRatingOtherInfoService.deletePostAssessmentRatingOtherInfoByIds(ids));
    }
}
