springboot+flowable工作流三三来迟

本文介绍了如何在SpringBoot应用中集成Flowable工作流,包括使用Flowable UI创建请假审批流程,详细展示了流程图及XML定义,并提供了SpringBoot工程的配置和接口实现,如发起请假、获取任务、审批操作等。

springboot集成flowable工作流之梅开三度,常言道温故而知新,咱也回故一下。
1、使用flowable-ui制作流程图
运行flowable-6.6.0官方demo,打开网址:http://localhost:8080/flowable-ui,输入账号admin/test登录即可,如下
在这里插入图片描述
进入APP.MODELER.TITLE创建流程,之后可以导出流程到项目中直接使用。
流程图如下
在这里插入图片描述
导出的工作流文件如下

<?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/processdef">
  <process id="leave4" name="请假审批" isExecutable="true">
    <startEvent id="start" name="开始" flowable:formFieldValidation="true"></startEvent>
    <userTask id="student" name="学生" flowable:assignee="${studentId}" flowable:formFieldValidation="true">
      <extensionElements>
        <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
      </extensionElements>
    </userTask>
    <userTask id="teacher" name="老师" flowable:assignee="${teacherId}" flowable:formFieldValidation="true">
      <extensionElements>
        <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
      </extensionElements>
    </userTask>
    <exclusiveGateway id="gate1"></exclusiveGateway>
    <userTask id="header" name="校长" flowable:assignee="${headerId}" flowable:formFieldValidation="true">
      <extensionElements>
        <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
      </extensionElements>
    </userTask>
    <exclusiveGateway id="gate2"></exclusiveGateway>
    <endEvent id="end" name="结束"></endEvent>
    <sequenceFlow id="flow1" sourceRef="start" targetRef="student"></sequenceFlow>
    <sequenceFlow id="flow2" name="请假" sourceRef="student" targetRef="teacher"></sequenceFlow>
    <sequenceFlow id="flow3" name="审批" sourceRef="teacher" targetRef="gate1"></sequenceFlow>
    <sequenceFlow id="flow4" name="拒绝" sourceRef="gate1" targetRef="student">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${command=='refuse'}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow5" name="同意" sourceRef="gate1" targetRef="header">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${command=='agree'}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow6" name="审批" sourceRef="header" targetRef="gate2"></sequenceFlow>
    <sequenceFlow id="flow7" name="同意" sourceRef="gate2" targetRef="end">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${command=='agree'}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow8" name="拒绝" sourceRef="gate2" targetRef="student">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${command=='refuse'}]]></conditionExpression>
    </sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_leave4">
    <bpmndi:BPMNPlane bpmnElement="leave4" id="BPMNPlane_leave4">
      <bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
        <omgdc:Bounds height="30.0"
评论 3
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值