package org.dromara.app.controller;

import org.dromara.common.core.domain.R;
import org.dromara.wflow.utils.UserUtil;
import org.dromara.wflow.workflow.bean.vo.ProcessHandlerParamsVo;
import org.dromara.wflow.workflow.service.ProcessTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @author : willian fu
 * @date : 2022/8/25
 */
@RestController
@RequestMapping("/app/wflow/process/task")
public class ProcessInstanceTaskControllerApp {

    @Autowired
    private ProcessTaskService taskService;

    /**
     * 用户处理任务，审批、转交、评论、撤销等操作
     *
     * @param params 操作参数
     * @return 操作结果
     */
    @PostMapping("handler")
    public R<Void> approvalTask(@RequestBody ProcessHandlerParamsVo params) {
        String userId = UserUtil.getLoginUserId();
        taskService.approvalTask(userId, userId, params);
        return R.ok("处理成功");
    }

}
