package com.boman.web.core.controller;

import com.alibaba.fastjson.JSONObject;
import com.boman.domain.dto.AjaxResult;
import com.boman.domain.dto.TaskDto;
import com.boman.web.core.service.jflow.JFlowTaskService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 *  任务中心控制器
 *
 * @author zhong.h
 * @date 2021-06-17
 * description:任务中心的web层
 */
@RequestMapping("/jflow/task")
@RestController
public class JFlowTaskController {

    @Autowired
    private JFlowTaskService jFlowTaskService;

    @ApiOperation(value = "历史详情查询")
    @RequestMapping(value = "/cs/task/history/list", method = RequestMethod.POST)
    public AjaxResult historyLoad(@RequestBody TaskDto taskDto) {
        return jFlowTaskService.historyLoad(taskDto);
    }

    @ApiOperation(value = "代办详情查询")
    @RequestMapping(value = "/cs/task/backlog/list", method = RequestMethod.POST)
    public AjaxResult pendingTaskSearch(@RequestBody TaskDto taskDto) {
        return jFlowTaskService.pendingTaskSearch(taskDto);
    }

    @ApiOperation(value = "同意操作")
    @RequestMapping(value = "/cs/task/page/pass", method = RequestMethod.POST)
    public AjaxResult pagePass(@RequestBody TaskDto taskDto) {
        return jFlowTaskService.pagePass(taskDto);
    }

    @ApiOperation(value = "驳回按钮操作")
    @RequestMapping(value = "/cs/task/page/deny", method = RequestMethod.POST)
    public AjaxResult pageDeny(@RequestBody TaskDto taskDto) {
        return jFlowTaskService.pageDeny(taskDto);
    }

    @ApiOperation(value = "审批数统计")
    @RequestMapping(value = "/cs/task/approval/statistics", method = RequestMethod.POST)
    public JSONObject approvalStatistics(@RequestBody TaskDto taskDto) {
        return jFlowTaskService.approvalStatistics(taskDto);
    }

    @ApiOperation(value = "审批明细查看")
    @RequestMapping(value = "/cs/task/backlog/detail", method = RequestMethod.POST)
    public AjaxResult pageDetail(@RequestBody TaskDto taskDto) {
        return jFlowTaskService.pageDetail(taskDto);
    }
}
