Search in sources :

Example 1 with WfNextDto

use of com.ruoyi.workflow.domain.dto.WfNextDto in project RuoYi-Flowable-Plus by KonBAI-Q.

the class WfTaskServiceImpl method getNextFlowNode.

/**
 * 获取下一节点
 *
 * @param bo 任务
 * @return
 */
@Override
public R getNextFlowNode(WfTaskBo bo) {
    Task task = taskService.createTaskQuery().taskId(bo.getTaskId()).singleResult();
    WfNextDto nextDto = new WfNextDto();
    if (Objects.nonNull(task)) {
        List<UserTask> nextUserTask = FindNextNodeUtil.getNextUserTasks(repositoryService, task, new HashMap<>());
        if (CollectionUtils.isNotEmpty(nextUserTask)) {
            for (UserTask userTask : nextUserTask) {
                MultiInstanceLoopCharacteristics multiInstance = userTask.getLoopCharacteristics();
                // 会签节点
                if (Objects.nonNull(multiInstance)) {
                    List<SysUser> list = sysUserService.selectUserList(new SysUser());
                    nextDto.setVars(ProcessConstants.PROCESS_MULTI_INSTANCE_USER);
                    nextDto.setType(ProcessConstants.PROCESS_MULTI_INSTANCE);
                    nextDto.setUserList(list);
                } else {
                    // 读取自定义节点属性 判断是否是否需要动态指定任务接收人员、组
                    String dataType = userTask.getAttributeValue(ProcessConstants.NAMASPASE, ProcessConstants.PROCESS_CUSTOM_DATA_TYPE);
                    String userType = userTask.getAttributeValue(ProcessConstants.NAMASPASE, ProcessConstants.PROCESS_CUSTOM_USER_TYPE);
                    if (ProcessConstants.DATA_TYPE.equals(dataType)) {
                        // 指定单个人员
                        if (ProcessConstants.USER_TYPE_ASSIGNEE.equals(userType)) {
                            List<SysUser> list = sysUserService.selectUserList(new SysUser());
                            nextDto.setVars(ProcessConstants.PROCESS_APPROVAL);
                            nextDto.setType(ProcessConstants.USER_TYPE_ASSIGNEE);
                            nextDto.setUserList(list);
                        }
                        // 候选人员(多个)
                        if (ProcessConstants.USER_TYPE_USERS.equals(userType)) {
                            List<SysUser> list = sysUserService.selectUserList(new SysUser());
                            nextDto.setVars(ProcessConstants.PROCESS_APPROVAL);
                            nextDto.setType(ProcessConstants.USER_TYPE_USERS);
                            nextDto.setUserList(list);
                        }
                        // 候选组
                        if (ProcessConstants.USER_TYPE_ROUPS.equals(userType)) {
                            List<SysRole> sysRoles = sysRoleService.selectRoleAll();
                            nextDto.setVars(ProcessConstants.PROCESS_APPROVAL);
                            nextDto.setType(ProcessConstants.USER_TYPE_ROUPS);
                            nextDto.setRoleList(sysRoles);
                        }
                    }
                }
            }
        } else {
            return R.ok("流程已完结", null);
        }
    }
    return R.ok(nextDto);
}
Also used : Task(org.flowable.task.api.Task) WfNextDto(com.ruoyi.workflow.domain.dto.WfNextDto) SysUser(com.ruoyi.common.core.domain.entity.SysUser) SysRole(com.ruoyi.common.core.domain.entity.SysRole)

Aggregations

SysRole (com.ruoyi.common.core.domain.entity.SysRole)1 SysUser (com.ruoyi.common.core.domain.entity.SysUser)1 WfNextDto (com.ruoyi.workflow.domain.dto.WfNextDto)1 Task (org.flowable.task.api.Task)1