package com.ruoyi.postCheck.controller;

import java.util.Date;
import java.util.List;

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.PutMapping;
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.join.PostPlanJoinChecked;
import com.ruoyi.postCheck.service.IPostPlanJoinCheckedService;
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 2023-12-22
 */
@Api(tags = "3.1.1-岗检记录上传列表接口")
@RestController
@RequestMapping("/postCheck/postPlanJoinChecked")
public class PostPlanJoinCheckedController extends BaseController {
    @Autowired
    private IPostPlanJoinCheckedService postPlanJoinCheckedService;

    /**
     * 查询岗检记录上传列表列表
     */
    @ApiOperation("查询岗检记录上传列表列表")
    @ApiImplicitParams({
//                    @ApiImplicitParam(name = "id", value = "id", dataType = "Long", dataTypeClass = Long.class),
//                    @ApiImplicitParam(name = "name", value = "name", 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:postPlanJoinChecked:list')")
    @GetMapping("/list")
    public TableDataInfo list(PostPlanJoinChecked postPlanJoinChecked) {
        startPage();
        List<PostPlanJoinChecked> list = postPlanJoinCheckedService.selectPostPlanJoinCheckedList(postPlanJoinChecked);
        return getDataTable(list);
    }

    /**
     * 导出岗检记录上传列表列表
     @ApiOperation("导出岗检记录上传列表列表")
     @PreAuthorize("@ss.hasPermi('postCheck:postPlanJoinChecked:export')")
     @Log(title = "岗检记录上传列表", businessType = BusinessType.EXPORT)
     @PostMapping("/export") public void export(HttpServletResponse response, PostPlanJoinChecked postPlanJoinChecked)
     {
     List<PostPlanJoinChecked> list = postPlanJoinCheckedService.selectPostPlanJoinCheckedList(postPlanJoinChecked);
     ExcelUtil<PostPlanJoinChecked> util = new ExcelUtil<PostPlanJoinChecked>(PostPlanJoinChecked.class);
     util.exportExcel(response, list, "岗检记录上传列表数据");
     }
     */

    /**
     * 获取岗检记录上传列表详细信息
     @ApiOperation("获取岗检记录上传列表详细信息")
     @PreAuthorize("@ss.hasPermi('postCheck:postPlanJoinChecked:query')")
     @GetMapping(value = "/{id}")
     public AjaxResult getInfo(@PathVariable("id") Long id)
     {
     return success(postPlanJoinCheckedService.selectPostPlanJoinCheckedById(id));
     }
     */

    /**
     * 新增岗检记录上传列表
     *
     * @ApiOperation("新增岗检记录上传列表")
     * @ApiImplicitParams({
     * @ApiImplicitParam(name = "id", value = "id", dataType = "Long", dataTypeClass = Long.class),
     * @ApiImplicitParam(name = "name", value = "name", dataType = "Long", dataTypeClass = Long.class),
     * })
     * @PreAuthorize("@ss.hasPermi('postCheck:postPlanJoinChecked:add')")
     * @Log(title = "岗检记录上传列表", businessType = BusinessType.INSERT)
     * @PostMapping public AjaxResult add(@RequestBody PostPlanJoinChecked postPlanJoinChecked)
     * {
     * return toAjax(postPlanJoinCheckedService.insertPostPlanJoinChecked(postPlanJoinChecked));
     * }
     */


    @ApiOperation("岗检完成确认")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "planInfoId", value = "岗检计划明细ID", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "checkedUserId", value = "检查人ID", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "checkedTime", value = "检查时间(yyyy-MM-dd HH:mm:ss)", dataType = "Date", dataTypeClass = Date.class),
            @ApiImplicitParam(name = "checkedImg", value = "检查表照片(图片上传后的相对路径)", dataType = "String", dataTypeClass = String.class),

    })
//    @PreAuthorize("@ss.hasPermi('postCheck:postPlanJoinChecked:edit')")
    @Log(title = "岗检完成确认", businessType = BusinessType.UPDATE)
    @PutMapping("checked")
    public AjaxResult checked(Long planInfoId, Long checkedUserId, Date checkedTime, String checkedImg) {

        return toAjax(postPlanJoinCheckedService.checked(planInfoId, checkedUserId, checkedTime, checkedImg));
    }

    @ApiOperation("岗检完成确认后重新上传检查表照片")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "planInfoId", value = "岗检计划明细ID", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "checkedImg", value = "检查表照片(图片上传后的相对路径)", dataType = "String", dataTypeClass = String.class),

    })
//    @PreAuthorize("@ss.hasPermi('postCheck:postPlanJoinChecked:edit')")
    @Log(title = "岗检完成确认后重新上传检查表照片", businessType = BusinessType.UPDATE)
    @PutMapping("imgReUpload")
    public AjaxResult imgReUpload(Long planInfoId, String checkedImg) {
        return toAjax(postPlanJoinCheckedService.imgReUpload(planInfoId, checkedImg));
    }

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