flowable获取流程节点顺序,预测审批路径

之前基于flowable为公司开发了套轻量级的OA系统,最近有个需求,要求在正式发起审批前或者流程被驳回后重新发起前预测审批路径,参考了下flowable获取流程节点的顺序数据_10973441的技术博客_51CTO博客这篇文章,做了一些修改和补充。

准备工作

添加以下依赖

<dependency>
    <groupId>org.flowable</groupId>
    <artifactId>flowable-spring-boot-starter</artifactId>
    <version>6.4.0</version>
</dependency>
<dependency>
    <groupId>org.flowable</groupId>
    <artifactId>flowable-ui-modeler-logic</artifactId>
    <version>6.4.0</version>
</dependency>

代码片段

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.flowable.bpmn.model.*;
import org.flowable.engine.ManagementService;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.ui.modeler.domain.Model;
import org.flowable.ui.modeler.serviceapi.ModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

@Slf4j
@Service
public class ProcessService {
    @Autowired
    RuntimeService runtimeService;

    @Autowired
    RepositoryService repositoryService;

    @Autowired
    ModelService modelService;

    @Autowired
    ManagementService managementService;

    @Autowired
    ProcessEngineConfigurationImpl processEngineConfiguration;

    /**
     * 1. 首先拿到BpmnModel,所有流程定义信息都可以通过BpmnModel获取;若流程尚未发起,则用modelId查询最新部署的流程定义数据;
     * 若流程已经发起,可以通过流程实例的processDefinitionId查询流程定义的历史数据。
     * @param variableMap 流程变量,用于计算条件分支
     */
    public List<FlowElement> calApprovePath(String processInstanceId, String modelId, Map<String, Object> variableMap){
        BpmnModel bpmnModel;
        if(StringUtils.isNotBlank(processInstanceId)){
 
  • 6
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 20
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 20
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值