18.flowable 流程任务的转办

项目地址:https://gitee.com/lwj/flowable.git 分支flowable-base
视频讲解地址
https://www.bilibili.com/video/av78184848/

1、演示

18.flowable 流程任务的转办_第1张图片
18.flowable 流程任务的转办_第2张图片

2、代码分享

public ReturnVo<String> turnTask(TurnTaskVo turnTaskVo) {
        ReturnVo<String> returnVo = null;
        TaskEntityImpl currTask = (TaskEntityImpl) taskService.createTaskQuery().taskId(turnTaskVo.getTaskId()).singleResult();
        if (currTask != null) {
            //1.生成历史记录
            TaskEntity task = this.createSubTask(currTask, turnTaskVo.getUserCode());
            //2.添加审批意见
            this.addComment(task.getId(), turnTaskVo.getUserCode(), turnTaskVo.getProcessInstanceId(), CommentTypeEnum.ZB.toString(), turnTaskVo.getMessage());
            taskService.saveTask(task);
            taskService.complete(task.getId());
            //3.转办
            taskService.setAssignee(turnTaskVo.getTaskId(), turnTaskVo.getTurnToUserId());
            taskService.setOwner(turnTaskVo.getTaskId(), turnTaskVo.getUserCode());
            returnVo = new ReturnVo<>(ReturnCode.SUCCESS, "转办成功");
        } else {
            returnVo = new ReturnVo<>(ReturnCode.FAIL, "没有运行时的任务实例,请确认!");
        }
        return returnVo;
    }

你可能感兴趣的:(Flowable基础)