基于若依的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

相关文章

MySQL 中的 JSON 查询案例详解

《MySQL中的JSON查询案例详解》:本文主要介绍MySQL的JSON查询的相关知识,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录mysql 的 jsON 路径格式基本结构路径组件详解特殊语法元素实际示例简单路径复杂路径简写操作符注意MySQL 的 J

Spring Boot中JSON数值溢出问题从报错到优雅解决办法

《SpringBoot中JSON数值溢出问题从报错到优雅解决办法》:本文主要介绍SpringBoot中JSON数值溢出问题从报错到优雅的解决办法,通过修改字段类型为Long、添加全局异常处理和... 目录一、问题背景:为什么我的接口突然报错了?二、为什么会发生这个错误?1. Java 数据类型的“容量”限制

Spring 请求之传递 JSON 数据的操作方法

《Spring请求之传递JSON数据的操作方法》JSON就是一种数据格式,有自己的格式和语法,使用文本表示一个对象或数组的信息,因此JSON本质是字符串,主要负责在不同的语言中数据传递和交换,这... 目录jsON 概念JSON 语法JSON 的语法JSON 的两种结构JSON 字符串和 Java 对象互转

Python利用ElementTree实现快速解析XML文件

《Python利用ElementTree实现快速解析XML文件》ElementTree是Python标准库的一部分,而且是Python标准库中用于解析和操作XML数据的模块,下面小编就来和大家详细讲讲... 目录一、XML文件解析到底有多重要二、ElementTree快速入门1. 加载XML的两种方式2.

HTML5表格语法格式详解

《HTML5表格语法格式详解》在HTML语法中,表格主要通过table、tr和td3个标签构成,本文通过实例代码讲解HTML5表格语法格式,感兴趣的朋友一起看看吧... 目录一、表格1.表格语法格式2.表格属性 3.例子二、不规则表格1.跨行2.跨列3.例子一、表格在html语法中,表格主要通过< tab

Spring 基于XML配置 bean管理 Bean-IOC的方法

《Spring基于XML配置bean管理Bean-IOC的方法》:本文主要介绍Spring基于XML配置bean管理Bean-IOC的方法,本文给大家介绍的非常详细,对大家的学习或工作具有一... 目录一. spring学习的核心内容二. 基于 XML 配置 bean1. 通过类型来获取 bean2. 通过

将Java项目提交到云服务器的流程步骤

《将Java项目提交到云服务器的流程步骤》所谓将项目提交到云服务器即将你的项目打成一个jar包然后提交到云服务器即可,因此我们需要准备服务器环境为:Linux+JDK+MariDB(MySQL)+Gi... 目录1. 安装 jdk1.1 查看 jdk 版本1.2 下载 jdk2. 安装 mariadb(my

MySQL 中查询 VARCHAR 类型 JSON 数据的问题记录

《MySQL中查询VARCHAR类型JSON数据的问题记录》在数据库设计中,有时我们会将JSON数据存储在VARCHAR或TEXT类型字段中,本文将详细介绍如何在MySQL中有效查询存储为V... 目录一、问题背景二、mysql jsON 函数2.1 常用 JSON 函数三、查询示例3.1 基本查询3.2

使用Python将JSON,XML和YAML数据写入Excel文件

《使用Python将JSON,XML和YAML数据写入Excel文件》JSON、XML和YAML作为主流结构化数据格式,因其层次化表达能力和跨平台兼容性,已成为系统间数据交换的通用载体,本文将介绍如何... 目录如何使用python写入数据到Excel工作表用Python导入jsON数据到Excel工作表用

Python将博客内容html导出为Markdown格式

《Python将博客内容html导出为Markdown格式》Python将博客内容html导出为Markdown格式,通过博客url地址抓取文章,分析并提取出文章标题和内容,将内容构建成html,再转... 目录一、为什么要搞?二、准备如何搞?三、说搞咱就搞!抓取文章提取内容构建html转存markdown