package com.ym.mec.education.controller;

import com.ym.mec.education.base.BaseResponse;
import com.ym.mec.education.base.PageResponse;
import com.ym.mec.education.req.ApprovalReq;
import com.ym.mec.education.service.ApprovalService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: mec
 * @description: 审批
 * @author: xw
 * @create: 2019-10-10 09:37
 */
@RestController
@RequestMapping("api/approval")
@Api(tags = "审批")
@Slf4j
public class ApprovalController {

    @Autowired
    private ApprovalService approvalService;

    @PostMapping("/processingList")
    @ApiOperation("审批-待处理列表")
    public PageResponse processingList(@RequestBody ApprovalReq approvalReq) {
        return approvalService.getProcessingList(approvalReq);
    }

    @PostMapping("/processedList")
    @ApiOperation("审批-已处理列表")
    public PageResponse processedList(@RequestBody ApprovalReq approvalReq) {
        return approvalService.getProcessedList(approvalReq);
    }

    @PostMapping("/launchList")
    @ApiOperation("审批-我发起的审批列表")
    public PageResponse launchList(@RequestBody ApprovalReq approvalReq) {
        return approvalService.getLaunchList(approvalReq);
    }

    @PostMapping("/launchInfo")
    @ApiOperation("审批-我发起的审批详情")
    public BaseResponse launchInfo(@RequestBody ApprovalReq approvalReq) {
        return approvalService.getLaunchInfo(approvalReq);
    }

    @PostMapping("/cancel")
    @ApiOperation("审批-我发起的审批详情-取消审批")
    public BaseResponse cancel(@RequestBody ApprovalReq approvalReq) {
        return approvalService.cancel(approvalReq);
    }

    @PostMapping("/ccList")
    @ApiOperation("审批-抄送列表")
    public PageResponse ccList(@RequestBody ApprovalReq approvalReq) {
        return approvalService.getCcList(approvalReq);
    }
}
