package com.hz.pm.api.performance.controller;

import javax.validation.Valid;

import com.ningdatech.log.annotation.WebLog;
import org.springframework.web.bind.annotation.*;

import com.ningdatech.basic.model.PageVo;
import com.hz.pm.api.performance.manage.RectifyManage;
import com.hz.pm.api.performance.model.dto.ProjectAppraisalDTO;
import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq;
import com.hz.pm.api.performance.model.vo.PerformanceAppraisalProjectVO;
import com.hz.pm.api.performance.model.vo.PerformanceAppraisalVO;
import com.hz.pm.api.performance.model.vo.RectifyDetailVO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;

/**
 * RectifyController
 * 
 * @return
 * @author CMM
 * @since 2023/08/12 15:45
 */
@RestController
@RequiredArgsConstructor
@Api(tags = "绩效评价-项目整改")
@RequestMapping("/api/v1/rectify")
public class RectifyController {

    private final RectifyManage rectifyManage;

    @GetMapping("/list")
    @ApiOperation("当前用户的绩效评价整改计划列表")
    public PageVo<PerformanceAppraisalVO> list(PerformanceAppraisalListReq req) {
        return rectifyManage.list(req);
    }

    @GetMapping("/unRectify-list/{planId}")
    @ApiOperation("当前绩效评价待整改列表")
    public PageVo<PerformanceAppraisalProjectVO> unRectifyList(@PathVariable Long planId,
        PerformanceAppraisalListReq req) {
        return rectifyManage.unRectifyList(planId, req);
    }

    @GetMapping("/rectified-list/{planId}")
    @ApiOperation("当前绩效评价已整改列表")
    public PageVo<PerformanceAppraisalProjectVO> rectifiedList(@PathVariable Long planId,
        PerformanceAppraisalListReq req) {
        return rectifyManage.rectifiedList(planId, req);
    }

    @GetMapping("/get-rectify-detail/{planId}/{projectCode}")
    @ApiOperation("查看整改详情")
    public RectifyDetailVO getRectifyDetail(@PathVariable Long planId, @PathVariable String projectCode) {
        return rectifyManage.getRectifyDetail(planId, projectCode);
    }

    @PostMapping("/fill-out-result")
    @ApiOperation("填写整改情况")
    @WebLog(value = "填写整改情况",modular = "绩效评价-项目整改")
    public String fillOutResult(@Valid @RequestBody ProjectAppraisalDTO param) {
        return rectifyManage.fillOutResult(param);
    }

}
