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"

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





