springCloud集成activiti5.22.0流程引擎(分支)

news2024/9/26 1:21:38

springCloud集成activiti5.22.0流程引擎

   点关注不迷路,欢迎再访!	

精简博客内容,尽量已行业术语来分享。
努力做到对每一位认可自己的读者负责。
帮助别人的同时更是丰富自己的良机。

文章目录

    • springCloud集成activiti5.22.0流程引擎
      • 一.Spring boot2.x与Activiti 5.22.0整合
        • 1.POM文件中添加依赖
      • 二.制作bpmn流程文件
        • 创建bpmn文件
      • 三.流程演示
        • 分支审批

一.Spring boot2.x与Activiti 5.22.0整合

1.POM文件中添加依赖
<dependency>
		<groupId>org.activiti</groupId>
			<artifactId>activiti-spring-boot-starter-basic</artifactId>
		<version>5.22.0</version>
		<exclusions>
		<!-- 排除activiti的mybatis,避免和外面的mybatis-plus冲突 -->
			<exclusion>
				<artifactId>mybatis</artifactId>
				<groupId>org.mybatis</groupId>
			</exclusion>
		</exclusions>
</dependency>

二.制作bpmn流程文件

创建bpmn文件

右键该文件夹New–>BPMN File 创建名为leave_flow的流程文件
在这里插入图片描述

文件名"xxx.bpmn" 更改为 “xxx.bpmn.xml”
注: 因为activiti的默认流程图格式是bpmn, 但是idea必须xml格式才能生成图片, 所以改为这样, 后面部署流程的时候才可以部署上去, 否则是存不进数据库.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:tns="http://www.activiti.org/testm1723732311976" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" expressionLanguage="http://www.w3.org/1999/XPath" id="m1723732311976" name="" targetNamespace="http://www.activiti.org/testm1723732311976" typeLanguage="http://www.w3.org/2001/XMLSchema">
  <process id="leaveProcess" isClosed="false" isExecutable="true" name="请假审批流程" processType="None">
    <startEvent id="STEP1" name="开始"/>
    <userTask activiti:assignee="${userId}" activiti:exclusive="true" id="STEP2" name="员工"/>
    <userTask activiti:assignee="${userId}" activiti:exclusive="true" id="STEP3" name="经理"/>
    <endEvent id="STEP4" name="结束"/>
    <sequenceFlow id="_6" sourceRef="STEP1" targetRef="STEP2"/>
    <sequenceFlow id="_7" sourceRef="STEP2" targetRef="STEP3"/>
    <exclusiveGateway gatewayDirection="Unspecified" id="_8" name="ExclusiveGateway"/>
    <sequenceFlow id="_2" name="同意" sourceRef="_8" targetRef="STEP4">
      <conditionExpression xsi:type="tFormalExpression">
        <![CDATA[${accept==”同意”}]]>
      </conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="_3" sourceRef="STEP3" targetRef="_8"/>
    <sequenceFlow id="_4" name="驳回" sourceRef="_8" targetRef="STEP2">
      <conditionExpression xsi:type="tFormalExpression">
        <![CDATA[${accept==”驳回”}]]>
      </conditionExpression>
    </sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram documentation="background=#3C3F41;count=1;horizontalcount=1;orientation=0;width=842.4;height=1195.2;imageableWidth=832.4;imageableHeight=1185.2;imageableX=5.0;imageableY=5.0" id="Diagram-_1" name="New Diagram">
    <bpmndi:BPMNPlane bpmnElement="leaveProcess">
      <bpmndi:BPMNShape bpmnElement="STEP1" id="Shape-STEP1">
        <dc:Bounds height="32.0" width="32.0" x="160.0" y="40.0"/>
        <bpmndi:BPMNLabel>
          <dc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="STEP2" id="Shape-STEP2">
        <dc:Bounds height="55.0" width="85.0" x="130.0" y="145.0"/>
        <bpmndi:BPMNLabel>
          <dc:Bounds height="55.0" width="85.0" x="0.0" y="0.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="STEP3" id="Shape-STEP3">
        <dc:Bounds height="55.0" width="85.0" x="135.0" y="275.0"/>
        <bpmndi:BPMNLabel>
          <dc:Bounds height="55.0" width="85.0" x="0.0" y="0.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="STEP4" id="Shape-STEP4">
        <dc:Bounds height="32.0" width="32.0" x="325.0" y="525.0"/>
        <bpmndi:BPMNLabel>
          <dc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="_8" id="Shape-_8" isMarkerVisible="false">
        <dc:Bounds height="32.0" width="32.0" x="325.0" y="400.0"/>
        <bpmndi:BPMNLabel>
          <dc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="_2" id="BPMNEdge__2" sourceElement="_8" targetElement="STEP4">
        <di:waypoint x="341.0" y="432.0"/>
        <di:waypoint x="341.0" y="525.0"/>
        <bpmndi:BPMNLabel>
          <dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="_3" id="BPMNEdge__3" sourceElement="STEP3" targetElement="_8">
        <di:waypoint x="175.0" y="330.0"/>
        <di:waypoint x="175.0" y="410.0"/>
        <di:waypoint x="331.0" y="410.0"/>
        <bpmndi:BPMNLabel>
          <dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="_4" id="BPMNEdge__4" sourceElement="_8" targetElement="STEP2">
        <di:waypoint x="340.0" y="401.0"/>
        <di:waypoint x="340.0" y="285.0"/>
        <di:waypoint x="215.0" y="172.5"/>
        <bpmndi:BPMNLabel>
          <dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="_6" id="BPMNEdge__6" sourceElement="STEP1" targetElement="STEP2">
        <di:waypoint x="176.0" y="72.0"/>
        <di:waypoint x="176.0" y="145.0"/>
        <bpmndi:BPMNLabel>
          <dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="_7" id="BPMNEdge__7" sourceElement="STEP2" targetElement="STEP3">
        <di:waypoint x="175.0" y="200.0"/>
        <di:waypoint x="175.0" y="275.0"/>
        <bpmndi:BPMNLabel>
          <dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

三.流程演示

分支审批
/**
   * @param processInstanceId  流程实例
   * @param isAccept   0:同意  1:驳回
   * @param userId   审批人
*/
 @Override
 public void assginLeaveWorkFlow(String processInstanceId,int isAccept,String userId) {
        Map<String,Object> map = new HashMap<>();
        //得到当前实例下的task
        Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult();
        taskService.addComment(task.getId(), processInstanceId, "审核人是否同意该请假流程");
        if(isAccept == 0){
            map.put("accept","同意");
            task.setAssignee(userId);
            map.put("userId", userId);
        }else{
            map.put("accept","驳回");
            //审核驳回后
            task.setAssignee("发起人");
            map.put("auditor","发起人");
        }
        task.setDescription("请假的描述信息");
        //执行当前这个工作流任务
        taskService.saveTask(task);
        taskService.complete(task.getId(), map);
    }

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2053055.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

你知道家电的保质期吗?

家人们&#xff0c;你们有关注过家里的电器用了多少年了吗&#xff1f; “家电不坏&#xff0c;就能一直用。” “坏了修一修&#xff0c;一样能用。” 很多家长都有这样的想法&#xff0c;家里的电器即使出了故障&#xff0c;修一修也就继续用了。 其实&#xff0c;家电也…

打造智能化直播商城平台:AI与大数据在平台开发中的应用

在当今竞争激烈的电商市场中&#xff0c;直播商城平台已经成为品牌和商家实现差异化竞争的重要工具。随着人工智能&#xff08;AI&#xff09;和大数据技术的不断进步&#xff0c;智能化直播商城平台的开发成为了行业的新趋势。这些技术不仅可以优化用户体验&#xff0c;还能提…

AI革新体育:IBM携手USTA升级美国公开赛观赛体验

IBM和美国网球协会&#xff08;USTA&#xff09;合作&#xff0c;在2024年美国网球公开赛中引入了创新的AI技术&#xff0c;为观众和选手带来全新的体验。8月19日赛事开幕&#xff0c;IBM的watsonx平台将推出多项新功能&#xff0c;增强三周赛事的互动性。 喜好儿网 IBM的Gra…

Prometheus:pushgateway使用

1 项目目标 &#xff08;1&#xff09;熟练部署pushgateway &#xff08;2&#xff09;使用api增删改查数据 &#xff08;3&#xff09;使用python Client SDK Push数据到pushgateway 2.1 规划节点 主机名 主机IP 节点规划 prome-master01 10.0.1.10 服务端 prome-no…

探索PyUSB:Python与USB设备的桥梁

文章目录 探索PyUSB&#xff1a;Python与USB设备的桥梁背景&#xff1a;为何选择PyUSB&#xff1f;什么是PyUSB&#xff1f;如何安装PyUSB&#xff1f;简单的库函数使用方法场景应用常见问题与解决方案总结 探索PyUSB&#xff1a;Python与USB设备的桥梁 背景&#xff1a;为何选…

GD32F470 FREERTOS + lwip UDP丢包问题解决

现象&#xff1a;使用GD32F470Z评估板已经官方FreeRTOSUDP例程测试&#xff0c;使用上位机UDP测试工具&#xff0c;连续收发UDP数据包&#xff0c;每发送65535次数据&#xff0c;第65536包数据就会丢。如下图所示&#xff1a; 测试了很多次&#xff0c;都是在65536的时候停了&a…

NVR方案背景与产品介绍与构建一套完整的NVR产品解决方案

一、NVR和DVR 在视频监控领域&#xff0c;DVR和NVR是两种常用的录像技术。它们在系统结构、视频处理、存储和访问方式等方面存在明显的区别。&#xff0c;但都在视频监控中扮演着重要的角色。首先来了解它们的区别和特点&#xff0c;这有助于在选择合适的设备时做出明智的决策…

HDMI切换器(2进1,1进2,三切1)介绍

目录 HDMI介绍: 二进一出HDMI切换器: 通俗的解释: 一进二出HDMI切换器&#xff1a; 通俗解释: HDMI1进2和2进1的区别&#xff1a; 三进1出HDMI切换器&#xff1a; 通俗的解释: HDMI介绍: HDMI描述全称高清多媒体接口&#xff08;High Definition Multimedia Interface&…

太阳能光伏气象站——助力光伏发电

在光伏产业蓬勃发展的今天&#xff0c;‌太阳能光伏气象站作为专为光伏发电站打造的环境监测系统&#xff0c;‌其重要性日益凸显。‌它不仅是电站运维优化、‌智能控制的关键环节&#xff0c;‌更是提高发电效率、‌保障光伏电站稳定运行的重要工具。‌ 首先&#xff0c;‌太阳…

Linux--传输层协议TCP

目录 1.理解TCP的部分字段 2.TCP的策略以及其它报头 确认应答(ACK)机制​编辑 超时重传机制 连接管理机制 建立连接为什么要三次握手&#xff1f; 为什么要四次挥手&#xff1f; 验证两种状态&#xff0c;CLOSE_WAIT&#xff08;不关闭文件fd即可&#xff09;和TIME_WA…

langchian 批次调用 prompt

目录 基础不使用批次 batch 批次调用 关于 langchian 额一些应用&#xff0c;可以查看案例&#xff1a; GitHub - 5zjk5/prompt-engineering: prompt 工程项目案例 基础不使用批次 from dotenv import load_dotenv import time import os from langchain_core.prompts imp…

【JUC】07-死锁

1. 死锁 死锁指的是两个或以上的线程在执行过程中&#xff0c;因争夺资源而造成的一种互相等待的现象。 // 死锁代码 public class DeadLockDemo {public static void main(String[] args) {final Object objectA new Object();final Object objectB new Object();new Threa…

【Linux 驱动】IMX6ULL gpio驱动

1. 概述 如果 pinctrl子系统将一个 PIN 复用为 GPIO 的话&#xff0c;那么接下来要用到 gpio 子系统了。gpio 子系统顾名思义&#xff0c;就是用于初始化 GPIO 并且提供相应的 API 函数&#xff0c;比如设置 GPIO为输入输出&#xff0c;设置读取 GPIO 的值等。 gpio 子系统的主…

kettle-spoon界面空白

点击spoon的connect、save、打开资源库等等&#xff0c;出现以下界面空白&#xff0c;已排查IE11的问题。 解决办法&#xff1a;清除kettle的配置文件&#xff0c;包括:Data Integration/.kettle、C:\Users\XXX.kettle等所有配置文件。

【机器学习】YOLO 关闭控制台推理日志

问题背景 使用 YOLO v8 推理时&#xff0c;每次推理都会在控制台输出日志&#xff0c;大批量推理时会把自己打印的日志给冲掉&#xff0c;现想关闭 YOLO v8 的推理日志。 解决方案 方案一&#xff1a; 在预测接口的参数列表里加上 verboseFalse 即可关闭控制台输出日志。 m…

全志 HDMI 显示亮度低

一、问题描述 全志T527在适配HDMI,让HDMI作为主显示时,出现亮度太低的问题 二、解决办法 1、调整uboot参数,显示720P画面 vi device/config/chips/t527/configs/sany_v7/uboot-board.dts 在T527中有显示相关的接口,enhance 该接口用于设置图像的亮度/对比度/饱和度/边缘…

有关软件开发中的项目管理:关键性问题解答(二)

继上篇内容《有关软件开发中的项目管理&#xff1a;关键性问题解答&#xff08;一&#xff09;》&#xff0c;咱们继续讲解没讲解完的项目管理问题。 瀑布式与敏捷项目管理之间存在着哪些显著的差异呢&#xff1f; 下面&#xff0c;我们将以更加详尽深入的视角来对比瀑布式与敏…

XSS游戏

目录 XSS游戏-WarmupsMa Spaghet!JefffUgandan KnucklesRicardo MilosAh Thats HawtLigmaMafiaOk, BoomerWW3 XSS游戏-Warmups Ma Spaghet! 1. 尝试注入&#xff0c;输入aaaaaaaa 2. 显示在<h2>标签内3. 输入标签&#xff0c;添加onmouseover属性值为alert(1337)&…

cloudcompare制作点云分割数据集

本文使用一个植物的数据集&#xff0c;进行标注从而能用于深度学习点云目标检测和分割任务 论文出处 Soybean-MVS: Annotated Three-Dimensional Model Dataset of Whole Growth Period Soybeans for 3D Plant Organ Segmentation 其中主要解决问题 如何使用网格mesh和点云进行…

番茄插件(Visual Assist)运行安装无反应的问题

1、运行安装无反应 直接双击运行没有反应&#xff0c;右键点击“以管理员方式运行”也没有反应。 &#xff08;只是蓝水的小圆圈转了一下后&#xff0c;就没有反应了&#xff09; 2、 则必须对程序的兼容性进行设置 3、安装程序就可以运行了 如下图&#xff1a;