基于若依的ruoyi-nbcio流程管理系统仿钉钉流程json转bpmn的flowable的xml格式(支持并行网关)

本文主要是介绍基于若依的ruoyi-nbcio流程管理系统仿钉钉流程json转bpmn的flowable的xml格式(支持并行网关),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

更多ruoyi-nbcio功能请看演示系统

gitee源代码地址

前后端代码: https://gitee.com/nbacheng/ruoyi-nbcio

演示地址:RuoYi-Nbcio后台管理系统

这个章节来完成并行网关,前端无需修改,直接后端修改就可以了。

1、并行网关后端修改如下:

 String createConcurrentGatewayBuilder(String formId, JSONObject flowNode) throws InvocationTargetException, IllegalAccessException {//String name = flowNode.getString("nodeName");ParallelGateway parallelGateway = new ParallelGateway();String parallelGatewayId = id("parallelGateway");parallelGateway.setId(parallelGatewayId);parallelGateway.setName("并行网关");ddProcess.addFlowElement(parallelGateway);ddProcess.addFlowElement(connect(formId, parallelGatewayId));if (Objects.isNull(flowNode.getJSONArray("concurrentNodes"))&& Objects.isNull(flowNode.getJSONObject("childNode"))) {return parallelGatewayId;}List<JSONObject> flowNodes = Optional.ofNullable(flowNode.getJSONArray("concurrentNodes")).map(e -> e.toJavaList(JSONObject.class)).orElse(Collections.emptyList());List<String> incoming = Lists.newArrayListWithCapacity(flowNodes.size());for (JSONObject element : flowNodes) {JSONObject childNode = element.getJSONObject("childNode");if (Objects.isNull(childNode)) {incoming.add(parallelGatewayId);continue;}String identifier = create(parallelGatewayId, childNode);if (Objects.nonNull(identifier)) {incoming.add(identifier);}}JSONObject childNode = flowNode.getJSONObject("childNode");if (Objects.nonNull(childNode)) {// 普通结束网关if (CollectionUtils.isEmpty(incoming)) {return create(parallelGatewayId, childNode);} else {// 所有 service task 连接 end parallel gatewaychildNode.put("incoming", incoming);FlowElement flowElement = ddBpmnModel.getFlowElement(incoming.get(0));// 1.0 先进行边连接, 暂存 nextNodeJSONObject nextNode = childNode.getJSONObject("childNode");childNode.put("childNode", null);String identifier = create(incoming.get(0), childNode);for (int i = 1; i < incoming.size(); i++) {FlowElement flowElement1 = ddBpmnModel.getFlowElement(incoming.get(i));ddProcess.addFlowElement(connect(flowElement1.getId(), identifier));}// 1.1 边连接完成后,在进行 nextNode 创建if (Objects.nonNull(nextNode)) {return create(identifier, nextNode);} else {return identifier;}}}return parallelGatewayId;}

2、效果图如下:

3、生产的xml如下:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.flowable.org/test"><process id="Process_1233c789-c986-4de2-8ab2-9c24ef0a2312" name="dingding演示流程" isExecutable="true"><startEvent id="start_36faea0bc7344384bc52078dd43c0829"></startEvent><parallelGateway id="parallelGateway_31fb5c2d6062402688b9bceb230610df" name="并行网关"></parallelGateway><sequenceFlow id="sequenceFlow_8f3fb2e6498847aea4e88ad7f8527720" sourceRef="start_36faea0bc7344384bc52078dd43c0829" targetRef="parallelGateway_31fb5c2d6062402688b9bceb230610df"></sequenceFlow><userTask id="userTask_261260b7d3c643f08d6000f422628363" name="审批人" flowable:assignee="ry" flowable:dataType="USERS" flowable:text="若依"></userTask><sequenceFlow id="sequenceFlow_ec473d524b1f4c70ac8d59c9d11cf20a" sourceRef="parallelGateway_31fb5c2d6062402688b9bceb230610df" targetRef="userTask_261260b7d3c643f08d6000f422628363"></sequenceFlow><userTask id="userTask_182b04b3cc0c465589ae5bb936185fe5" name="审批人" flowable:assignee="zhangsan" flowable:dataType="USERS" flowable:text="张三"></userTask><sequenceFlow id="sequenceFlow_9c0f2e6f0a434217996502850297b251" sourceRef="parallelGateway_31fb5c2d6062402688b9bceb230610df" targetRef="userTask_182b04b3cc0c465589ae5bb936185fe5"></sequenceFlow><userTask id="userTask_d81ef1ca0fa2436abf543dc6cb7d80df" name="审批人" flowable:assignee="admin" flowable:dataType="USERS" flowable:text="若依管理员"></userTask><sequenceFlow id="sequenceFlow_2227bd432d044dc889aa9a9132ca7589" sourceRef="userTask_261260b7d3c643f08d6000f422628363" targetRef="userTask_d81ef1ca0fa2436abf543dc6cb7d80df"></sequenceFlow><sequenceFlow id="sequenceFlow_8bb051d48a654b3bba4a687c6320eb29" sourceRef="userTask_182b04b3cc0c465589ae5bb936185fe5" targetRef="userTask_d81ef1ca0fa2436abf543dc6cb7d80df"></sequenceFlow><endEvent id="end_28c4b21fe4d145cfb6aa1019d13a24ac"></endEvent><sequenceFlow id="sequenceFlow_008d4f7e2c0e4246af7d5c4092af6a21" sourceRef="userTask_d81ef1ca0fa2436abf543dc6cb7d80df" targetRef="end_28c4b21fe4d145cfb6aa1019d13a24ac"></sequenceFlow></process><bpmndi:BPMNDiagram id="BPMNDiagram_Process_1233c789-c986-4de2-8ab2-9c24ef0a2312"><bpmndi:BPMNPlane bpmnElement="Process_1233c789-c986-4de2-8ab2-9c24ef0a2312" id="BPMNPlane_Process_1233c789-c986-4de2-8ab2-9c24ef0a2312"><bpmndi:BPMNShape bpmnElement="start_36faea0bc7344384bc52078dd43c0829" id="BPMNShape_start_36faea0bc7344384bc52078dd43c0829"><omgdc:Bounds height="30.0" width="30.0" x="0.0" y="95.0"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNShape bpmnElement="userTask_d81ef1ca0fa2436abf543dc6cb7d80df" id="BPMNShape_userTask_d81ef1ca0fa2436abf543dc6cb7d80df"><omgdc:Bounds height="60.0" width="100.0" x="320.0" y="80.0"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNShape bpmnElement="userTask_182b04b3cc0c465589ae5bb936185fe5" id="BPMNShape_userTask_182b04b3cc0c465589ae5bb936185fe5"><omgdc:Bounds height="60.0" width="100.0" x="170.0" y="160.0"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNShape bpmnElement="parallelGateway_31fb5c2d6062402688b9bceb230610df" id="BPMNShape_parallelGateway_31fb5c2d6062402688b9bceb230610df"><omgdc:Bounds height="40.0" width="40.0" x="80.0" y="90.0"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNShape bpmnElement="userTask_261260b7d3c643f08d6000f422628363" id="BPMNShape_userTask_261260b7d3c643f08d6000f422628363"><omgdc:Bounds height="60.0" width="100.0" x="170.0" y="0.0"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNShape bpmnElement="end_28c4b21fe4d145cfb6aa1019d13a24ac" id="BPMNShape_end_28c4b21fe4d145cfb6aa1019d13a24ac"><omgdc:Bounds height="30.0" width="30.0" x="470.0" y="95.0"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNEdge bpmnElement="sequenceFlow_8bb051d48a654b3bba4a687c6320eb29" id="BPMNEdge_sequenceFlow_8bb051d48a654b3bba4a687c6320eb29"><omgdi:waypoint x="270.0" y="190.0"></omgdi:waypoint><omgdi:waypoint x="282.0" y="190.0"></omgdi:waypoint><omgdi:waypoint x="282.0" y="110.0"></omgdi:waypoint><omgdi:waypoint x="320.0" y="110.0"></omgdi:waypoint></bpmndi:BPMNEdge><bpmndi:BPMNEdge bpmnElement="sequenceFlow_8f3fb2e6498847aea4e88ad7f8527720" id="BPMNEdge_sequenceFlow_8f3fb2e6498847aea4e88ad7f8527720"><omgdi:waypoint x="30.0" y="110.0"></omgdi:waypoint><omgdi:waypoint x="80.0" y="110.0"></omgdi:waypoint></bpmndi:BPMNEdge><bpmndi:BPMNEdge bpmnElement="sequenceFlow_ec473d524b1f4c70ac8d59c9d11cf20a" id="BPMNEdge_sequenceFlow_ec473d524b1f4c70ac8d59c9d11cf20a"><omgdi:waypoint x="120.0" y="102.5"></omgdi:waypoint><omgdi:waypoint x="132.0" y="102.5"></omgdi:waypoint><omgdi:waypoint x="132.0" y="30.000000000000007"></omgdi:waypoint><omgdi:waypoint x="170.0" y="30.000000000000007"></omgdi:waypoint></bpmndi:BPMNEdge><bpmndi:BPMNEdge bpmnElement="sequenceFlow_9c0f2e6f0a434217996502850297b251" id="BPMNEdge_sequenceFlow_9c0f2e6f0a434217996502850297b251"><omgdi:waypoint x="120.0" y="117.5"></omgdi:waypoint><omgdi:waypoint x="132.0" y="117.5"></omgdi:waypoint><omgdi:waypoint x="132.0" y="190.0"></omgdi:waypoint><omgdi:waypoint x="170.0" y="190.0"></omgdi:waypoint></bpmndi:BPMNEdge><bpmndi:BPMNEdge bpmnElement="sequenceFlow_008d4f7e2c0e4246af7d5c4092af6a21" id="BPMNEdge_sequenceFlow_008d4f7e2c0e4246af7d5c4092af6a21"><omgdi:waypoint x="420.0" y="110.0"></omgdi:waypoint><omgdi:waypoint x="470.0" y="110.0"></omgdi:waypoint></bpmndi:BPMNEdge><bpmndi:BPMNEdge bpmnElement="sequenceFlow_2227bd432d044dc889aa9a9132ca7589" id="BPMNEdge_sequenceFlow_2227bd432d044dc889aa9a9132ca7589"><omgdi:waypoint x="270.0" y="30.0"></omgdi:waypoint><omgdi:waypoint x="282.0" y="30.0"></omgdi:waypoint><omgdi:waypoint x="282.0" y="110.0"></omgdi:waypoint><omgdi:waypoint x="320.0" y="110.0"></omgdi:waypoint></bpmndi:BPMNEdge></bpmndi:BPMNPlane></bpmndi:BPMNDiagram>
</definitions>

4、在原来流程设计器打开如下:

这篇关于基于若依的ruoyi-nbcio流程管理系统仿钉钉流程json转bpmn的flowable的xml格式(支持并行网关)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/383344

相关文章

C#中读取XML文件的四种常用方法

《C#中读取XML文件的四种常用方法》Xml是Internet环境中跨平台的,依赖于内容的技术,是当前处理结构化文档信息的有力工具,下面我们就来看看C#中读取XML文件的方法都有哪些吧... 目录XML简介格式C#读取XML文件方法使用XmlDocument使用XmlTextReader/XmlTextWr

Linux流媒体服务器部署流程

《Linux流媒体服务器部署流程》文章详细介绍了流媒体服务器的部署步骤,包括更新系统、安装依赖组件、编译安装Nginx和RTMP模块、配置Nginx和FFmpeg,以及测试流媒体服务器的搭建... 目录流媒体服务器部署部署安装1.更新系统2.安装依赖组件3.解压4.编译安装(添加RTMP和openssl模块

定价129元!支持双频 Wi-Fi 5的华为AX1路由器发布

《定价129元!支持双频Wi-Fi5的华为AX1路由器发布》华为上周推出了其最新的入门级Wi-Fi5路由器——华为路由AX1,建议零售价129元,这款路由器配置如何?详细请看下文介... 华为 Wi-Fi 5 路由 AX1 已正式开售,新品支持双频 1200 兆、配有四个千兆网口、提供可视化智能诊断功能,建

0基础租个硬件玩deepseek,蓝耘元生代智算云|本地部署DeepSeek R1模型的操作流程

《0基础租个硬件玩deepseek,蓝耘元生代智算云|本地部署DeepSeekR1模型的操作流程》DeepSeekR1模型凭借其强大的自然语言处理能力,在未来具有广阔的应用前景,有望在多个领域发... 目录0基础租个硬件玩deepseek,蓝耘元生代智算云|本地部署DeepSeek R1模型,3步搞定一个应

轻松上手MYSQL之JSON函数实现高效数据查询与操作

《轻松上手MYSQL之JSON函数实现高效数据查询与操作》:本文主要介绍轻松上手MYSQL之JSON函数实现高效数据查询与操作的相关资料,MySQL提供了多个JSON函数,用于处理和查询JSON数... 目录一、jsON_EXTRACT 提取指定数据二、JSON_UNQUOTE 取消双引号三、JSON_KE

MySQL数据库函数之JSON_EXTRACT示例代码

《MySQL数据库函数之JSON_EXTRACT示例代码》:本文主要介绍MySQL数据库函数之JSON_EXTRACT的相关资料,JSON_EXTRACT()函数用于从JSON文档中提取值,支持对... 目录前言基本语法路径表达式示例示例 1: 提取简单值示例 2: 提取嵌套值示例 3: 提取数组中的值注意

使用C++将处理后的信号保存为PNG和TIFF格式

《使用C++将处理后的信号保存为PNG和TIFF格式》在信号处理领域,我们常常需要将处理结果以图像的形式保存下来,方便后续分析和展示,C++提供了多种库来处理图像数据,本文将介绍如何使用stb_ima... 目录1. PNG格式保存使用stb_imagephp_write库1.1 安装和包含库1.2 代码解

springboot启动流程过程

《springboot启动流程过程》SpringBoot简化了Spring框架的使用,通过创建`SpringApplication`对象,判断应用类型并设置初始化器和监听器,在`run`方法中,读取配... 目录springboot启动流程springboot程序启动入口1.创建SpringApplicat

SpringBoot定制JSON响应数据的实现

《SpringBoot定制JSON响应数据的实现》本文主要介绍了SpringBoot定制JSON响应数据的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们... 目录前言一、如何使用@jsonView这个注解?二、应用场景三、实战案例注解方式编程方式总结 前言

通过prometheus监控Tomcat运行状态的操作流程

《通过prometheus监控Tomcat运行状态的操作流程》文章介绍了如何安装和配置Tomcat,并使用Prometheus和TomcatExporter来监控Tomcat的运行状态,文章详细讲解了... 目录Tomcat安装配置以及prometheus监控Tomcat一. 安装并配置tomcat1、安装