package com.njcn.process.controller.flowable;


import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.process.pojo.vo.flowable.FlowQueryVo;
import com.njcn.process.pojo.vo.flowable.FlowTaskVo;
import com.njcn.process.service.flowable.IFlowTaskService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;

/**
 * <p>工作流任务管理<p>
 *
 * @author Tony
 * @date 2021-04-03
 */
@Slf4j
@Api(tags = "工作流流程任务管理")
@RestController
@RequestMapping("/flowable/task")
@RequiredArgsConstructor
public class FlowTaskController extends BaseController {


    private final IFlowTaskService flowTaskService;





    @ApiOperation(value = "工作流_审批任务")
    @PostMapping(value = "/complete")
    public HttpResult complete(@RequestBody FlowTaskVo flowTaskVo) {
        boolean res = flowTaskService.complete(flowTaskVo);
        return null;
    }



    /**
     * 流程节点信息
     *
     * @param procInsId 流程实例id
     * @return
     */
    @GetMapping("/flowXmlAndNode")
    @ApiOperation(value = "工作流_流程节点信息")
    public HttpResult flowXmlAndNode(@RequestParam(value = "procInsId", required = false) String procInsId,
                                     @RequestParam(value = "deployId", required = false) String deployId) {
        String methodDescribe = getMethodDescribe("flowXmlAndNode");

        Map<String, Object> res = flowTaskService.flowXmlAndNode(procInsId, deployId);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
    }



}
