工作流Flowable获取下一节点信息,返回用户列表

工作流Flowable获取下一节点信息,返回用户列表

public Result getUserListByRole(String procDefId) {
    log.info("获取的流程definedId是" + procDefId);
    Task task = taskService.createTaskQuery().processInstanceId(procDefId).active().singleResult();

    String taskId = task.getId();
    List<String> roleList = new ArrayList<>();
    List<SysUser> candidateUserNameList = new ArrayList<>();
    List<IdentityLink> idList = taskService.getIdentityLinksForTask(taskId);
    idList.forEach(identityLink -> {
        if (StringUtils.isNotBlank(identityLink.getGroupId()) && !roleList.contains(identityLink.getGroupId())) {
            roleList.add(identityLink.getGroupId());
        }
    });

    roleList.forEach(role -> {
        List<SysUser> candidateUserList = iFlowThirdService.getUsersByRoleId(role);
        for (SysUser candidateUser : candidateUserList) {
            SysUser sysUserTemp = iFlowThirdService.getUserByUsername(candidateUser.getUsername());
            List<String> listdepname = iFlowThirdService.getDepartNamesByUsername(candidateUser.getUsername());
            if (listdepname.size() > 0) {
                sysUserTemp.setOrgCodeTxt(listdepname.get(0).toString());
            }
            candidateUserNameList.add(sysUserTemp);
        }
    });

    return Result.OK("成功", candidateUserNameList);
}

流程按照条件进行流转

工作流Flowable获取下一节点信息,返回用户列表_第1张图片

工作流Flowable获取下一节点信息,返回用户列表_第2张图片

自定义表单表达式:

${variables:get(自定义表单属性值) == "某一个值"|| variables:get(自定义表单属性值)  =="另一个值"}

表单配置表达式:

${表单中的id属性值=="某一个值"}

你可能感兴趣的:(java,flowable)