基于若依的ruoyi-nbcio流程管理系统仿钉钉流程json转bpmn的flowable的xml格式(排它条件网关)

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

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

gitee源代码地址

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

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

这个章节来完成并行网关与排它条件网关的功能

1、前端

    目前就修改了排它条件网关的前端条件部分,简化条件公式,考虑与原有流程设计器兼容。

  主要是以下部分修改

 <!-- 条件  --><section class="condition-pane" v-if="value && isConditionNode()"><!-- 字符串条件 --><el-input placeholder="请输入条件表达式" v-model="pconditions"><template slot="prepend">条件表达式:</template></el-input></section>/*** 条件节点确认保存得回调*/conditionNodeComfirm() {this.properties.conditions = this.pconditions// 发起人虽然是条件 但是这里把发起人放到外部单独判断this.properties.initiator = this.initiator['dep&user']//this.initiator['dep&user'] && (nodeContent = `[发起人: ${this.getOrgSelectLabel('condition')}]` + '\n' + nodeContent)this.$emit("confirm", this.properties, this.pconditions || '请设置条件表达式');this.visible = false;},/*** 初始化条件节点数据*/initConditionNodeData(){this.pconditions = this.value.content},

2、排它条件网关后端修改

String createExclusiveGatewayBuilder(String formId, JSONObject flowNode) throws InvocationTargetException, IllegalAccessException {//String name = flowNode.getString("nodeName");String exclusiveGatewayId = id("exclusiveGateway");ExclusiveGateway exclusiveGateway = new ExclusiveGateway();exclusiveGateway.setId(exclusiveGatewayId);exclusiveGateway.setName("排它条件网关");ddProcess.addFlowElement(exclusiveGateway);ddProcess.addFlowElement(connect(formId, exclusiveGatewayId));if (Objects.isNull(flowNode.getJSONArray("conditionNodes")) && Objects.isNull(flowNode.getJSONObject("childNode"))) {return exclusiveGatewayId;}List<JSONObject> flowNodes = Optional.ofNullable(flowNode.getJSONArray("conditionNodes")).map(e -> e.toJavaList(JSONObject.class)).orElse(Collections.emptyList());List<String> incoming = Lists.newArrayListWithCapacity(flowNodes.size());List<JSONObject> conditions = Lists.newCopyOnWriteArrayList();for (JSONObject element : flowNodes) {JSONObject childNode = element.getJSONObject("childNode");JSONObject properties = element.getJSONObject("properties");String nodeName = properties.getString("title");String expression = properties.getString("conditions");if (Objects.isNull(childNode)) {incoming.add(exclusiveGatewayId);JSONObject condition = new JSONObject();condition.fluentPut("nodeName", nodeName).fluentPut("expression", expression);conditions.add(condition);continue;}// 只生成一个任务,同时设置当前任务的条件childNode.put("incoming", Collections.singletonList(exclusiveGatewayId));String identifier = create(exclusiveGatewayId, childNode);List<SequenceFlow> flows = ddSequenceFlows.stream().filter(flow -> StringUtils.equals(exclusiveGatewayId, flow.getSourceRef())).collect(Collectors.toList());flows.stream().forEach(e -> {if (StringUtils.isBlank(e.getName()) && StringUtils.isNotBlank(nodeName)) {e.setName(nodeName);}// 设置条件表达式if (Objects.isNull(e.getConditionExpression()) && StringUtils.isNotBlank(expression)) {e.setConditionExpression(expression);}});if (Objects.nonNull(identifier)) {incoming.add(identifier);}}JSONObject childNode = flowNode.getJSONObject("childNode");if (Objects.nonNull(childNode)) {if (incoming == null || incoming.isEmpty()) {return create(exclusiveGatewayId, childNode);} else {// 所有 service task 连接 end exclusive 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(flowElement.getId(), childNode);for (int i = 1; i < incoming.size(); i++) {ddProcess.addFlowElement(connect(incoming.get(i), identifier));}//  针对 gateway 空任务分支 添加条件表达式if (!conditions.isEmpty()) {FlowElement flowElement1 = ddBpmnModel.getFlowElement(identifier);// 获取从 gateway 到目标节点 未设置条件表达式的节点List<SequenceFlow> flows = ddSequenceFlows.stream().filter(flow -> StringUtils.equals(flowElement1.getId(), flow.getTargetRef())).filter(flow -> StringUtils.equals(flow.getSourceRef(), exclusiveGatewayId)).collect(Collectors.toList());flows.stream().forEach(sequenceFlow -> {if (!conditions.isEmpty()) {JSONObject condition = conditions.get(0);String nodeName = condition.getString("content");String expression = condition.getString("expression");if (StringUtils.isBlank(sequenceFlow.getName()) && StringUtils.isNotBlank(nodeName)) {sequenceFlow.setName(nodeName);}// 设置条件表达式if (Objects.isNull(sequenceFlow.getConditionExpression()) && StringUtils.isNotBlank(expression)) {sequenceFlow.setConditionExpression(expression);}conditions.remove(0);}});}// 1.1 边连接完成后,在进行 nextNode 创建if (Objects.nonNull(nextNode)) {return create(identifier, nextNode);} else {return identifier;}}}return exclusiveGatewayId;}

4、效果图如下:

还是有bug,后面的审批人连接有问题,后续修改吧。

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



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

相关文章

Security OAuth2 单点登录流程

单点登录(英语:Single sign-on,缩写为 SSO),又译为单一签入,一种对于许多相互关连,但是又是各自独立的软件系统,提供访问控制的属性。当拥有这项属性时,当用户登录时,就可以获取所有系统的访问权限,不用对每个单一系统都逐一登录。这项功能通常是以轻型目录访问协议(LDAP)来实现,在服务器上会将用户信息存储到LDAP数据库中。相同的,单一注销(single sign-off)就是指

Spring Security基于数据库验证流程详解

Spring Security 校验流程图 相关解释说明(认真看哦) AbstractAuthenticationProcessingFilter 抽象类 /*** 调用 #requiresAuthentication(HttpServletRequest, HttpServletResponse) 决定是否需要进行验证操作。* 如果需要验证,则会调用 #attemptAuthentica

Vue3项目开发——新闻发布管理系统(六)

文章目录 八、首页设计开发1、页面设计2、登录访问拦截实现3、用户基本信息显示①封装用户基本信息获取接口②用户基本信息存储③用户基本信息调用④用户基本信息动态渲染 4、退出功能实现①注册点击事件②添加退出功能③数据清理 5、代码下载 八、首页设计开发 登录成功后,系统就进入了首页。接下来,也就进行首页的开发了。 1、页面设计 系统页面主要分为三部分,左侧为系统的菜单栏,右侧

工厂ERP管理系统实现源码(JAVA)

工厂进销存管理系统是一个集采购管理、仓库管理、生产管理和销售管理于一体的综合解决方案。该系统旨在帮助企业优化流程、提高效率、降低成本,并实时掌握各环节的运营状况。 在采购管理方面,系统能够处理采购订单、供应商管理和采购入库等流程,确保采购过程的透明和高效。仓库管理方面,实现库存的精准管理,包括入库、出库、盘点等操作,确保库存数据的准确性和实时性。 生产管理模块则涵盖了生产计划制定、物料需求计划、

intellij idea generatorConfig.xml

generatorConfig.xml <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE generatorConfigurationPUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN""http://mybatis.org/dtd/mybatis-ge

easyui同时验证账户格式和ajax是否存在

accountName: {validator: function (value, param) {if (!/^[a-zA-Z][a-zA-Z0-9_]{3,15}$/i.test(value)) {$.fn.validatebox.defaults.rules.accountName.message = '账户名称不合法(字母开头,允许4-16字节,允许字母数字下划线)';return fal

kubelet组件的启动流程源码分析

概述 摘要: 本文将总结kubelet的作用以及原理,在有一定基础认识的前提下,通过阅读kubelet源码,对kubelet组件的启动流程进行分析。 正文 kubelet的作用 这里对kubelet的作用做一个简单总结。 节点管理 节点的注册 节点状态更新 容器管理(pod生命周期管理) 监听apiserver的容器事件 容器的创建、删除(CRI) 容器的网络的创建与删除

STL经典案例(四)——实验室预约综合管理系统(项目涉及知识点很全面,内容有点多,耐心看完会有收获的!)

项目干货满满,内容有点过多,看起来可能会有点卡。系统提示读完超过俩小时,建议分多篇发布,我觉得分篇就不完整了,失去了这个项目的灵魂 一、需求分析 高校实验室预约管理系统包括三种不同身份:管理员、实验室教师、学生 管理员:给学生和实验室教师创建账号并分发 实验室教师:审核学生的预约申请 学生:申请使用实验室 高校实验室包括:超景深实验室(可容纳10人)、大数据实验室(可容纳20人)、物联网实验

火语言RPA流程组件介绍--浏览网页

🚩【组件功能】:浏览器打开指定网址或本地html文件 配置预览 配置说明 网址URL 支持T或# 默认FLOW输入项 输入需要打开的网址URL 超时时间 支持T或# 打开网页超时时间 执行后后等待时间(ms) 支持T或# 当前组件执行完成后继续等待的时间 UserAgent 支持T或# User Agent中文名为用户代理,简称 UA,它是一个特殊字符串头,使得服务器

php中json_decode()和json_encode()

1.json_decode() json_decode (PHP 5 >= 5.2.0, PECL json >= 1.2.0) json_decode — 对 JSON 格式的字符串进行编码 说明 mixed json_decode ( string $json [, bool $assoc ] ) 接受一个 JSON 格式的字符串并且把它转换为 PHP 变量 参数 json