采用springboot+flowable快速实现工作流
文章目录
- 一、什么是BPMN?
- 二、什么是Flowable?
- 2.1. 官方描述如下
- 2.2. 大白话理解
- 2.3. 官方在线文档
- 2.4. Flowable官网
- 2.5. Flowable开源代码仓库
- 2.6. Flowable 最新版本(V6.4.2)截止目前下载地址
- 2.6.1. Tomcat 版本安装包
- 2.6.2. EAR版本版本安装包
- 2.6.3. Flowable源代码(V6.4.2)下载地址
- 三、 Flowable流程示例
- 3.1. Flowable的BPMN流程图
- 3.2. 流程图的BMPN文件如下
一、什么是BPMN?
- 大白话理解:
BPMN是一套符号的标准,这些符号描述了如果做一个业务,并且这个业务在做的过程中被人监控和控制。业务人员和开发人员通过这套图形可以很好的完成协作。
二、什么是Flowable?
2.1. 官方描述如下
- Flowable提供了一个组高效的核心开源业务流程引擎,为开发人员,系统管理员和业务用户提供工作流和业务流程管理(BPM)平台。全部用Java编写,并且基于Apache 2.0许可的开源,代码在社区维护。其核心是一个快速,经过试验和测试的动态BPMN流程引擎,附带DMN决策表和CMMN Case管理引擎。
2.2. 大白话理解
- Flowable是BPMN的一个基于java的软件实现,不过Flowable不仅仅包括BPMN,还有DMN决策表和CMMN Case管理引擎,并且有自己的用户管理、- 微服务API等一系列功能,是一个服务平台。
2.3. 官方在线文档
Flowable BPMN 用户手册 (v 6.5.0-SNAPSHOT)
http://www.shareniu.com/flowable6.5_zh_document/bpm/index.html#
Flowable DOCS (v 6.4.2):
https://www.flowable.org/docs/userguide/index.html
Flowable BPMN 用户手册 (v 6.3.0):
https://tkjohn.github.io/flowable-userguide/
2.4. Flowable官网
https://www.flowable.org/
2.5. Flowable开源代码仓库
https://github.com/flowable/flowable-engine
2.6. Flowable 最新版本(V6.4.2)截止目前下载地址
2.6.1. Tomcat 版本安装包
https://github.com/flowable/flowable-engine/releases/download/flowable-6.4.0/tomcat-flowable-6.4.0.zip
2.6.2. EAR版本版本安装包
https://github.com/flowable/flowable-engine/releases/download/flowable-6.4.2/flowable-6.4.2.zip
2.6.3. Flowable源代码(V6.4.2)下载地址
https://codeload.github.com/flowable/flowable-engine/zip/flowable-6.4.2
三、 Flowable流程示例
一个简单度假申请流程主要过程如下:
- 1、员工提交请假信息,如工号,请假天数
- 2、经理点击审批通过或者拒绝
- 3、如果拒绝直接进入系统发邮件服务通知员工
- 4、如果通过系统记录该员工的请假天数,减少可用天数
- 5、员工看到自己请假审批通过,点击完成请假。
3.1. Flowable的BPMN流程图
3.2. 流程图的BMPN文件如下
<?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="holidayRequest" name="Holiday Request" isExecutable="true"><startEvent id="startEvent"></startEvent><sequenceFlow id="sequenceFlow-3fa7af74-df9a-4d3a-b0eb-10b20e7dc202" sourceRef="startEvent" targetRef="approveTask"></sequenceFlow><userTask id="approveTask" name="经理通过或驳回申请"></userTask><sequenceFlow id="sequenceFlow-d9127dc0-158f-4169-b61b-99226ffe8494" sourceRef="approveTask" targetRef="decision"></sequenceFlow><exclusiveGateway id="decision"></exclusiveGateway><serviceTask id="externalSystemCall" name="系统记录申请天数" flowable:class="org.flowable.CallExternalSystemDelegate"></serviceTask><sequenceFlow id="sequenceFlow-6232f578-3975-4d7e-81f2-43b242d33ebd" sourceRef="externalSystemCall" targetRef="holidayApprovedTask"></sequenceFlow><userTask id="holidayApprovedTask" name="员工查看申请通过"></userTask><sequenceFlow id="sequenceFlow-29fd3375-9bcb-42f2-bb6f-63ae1f98813a" sourceRef="holidayApprovedTask" targetRef="approveEnd"></sequenceFlow><serviceTask id="sendRejectionMail" name="发送驳回邮件" flowable:class="org.flowable.SendRejectionMail"></serviceTask><sequenceFlow id="sequenceFlow-b390b442-2411-44a9-96eb-3c129d4c8408" sourceRef="sendRejectionMail" targetRef="rejectEnd"></sequenceFlow><endEvent id="approveEnd"></endEvent><endEvent id="rejectEnd"></endEvent><sequenceFlow id="sequenceFlow-6f21d3e2-2e49-4b00-9aae-0b71d861a177" name="驳回" sourceRef="decision" targetRef="sendRejectionMail"><conditionExpression xsi:type="tFormalExpression"><![CDATA[${!approved}]]></conditionExpression></sequenceFlow><sequenceFlow id="sequenceFlow-2470619b-fa36-440b-a231-b7bd226c23bb" name="通过" sourceRef="decision" targetRef="externalSystemCall"><conditionExpression xsi:type="tFormalExpression"><![CDATA[${approved}]]></conditionExpression></sequenceFlow></process><bpmndi:BPMNDiagram id="BPMNDiagram_holidayRequest"><bpmndi:BPMNPlane bpmnElement="holidayRequest" id="BPMNPlane_holidayRequest"><bpmndi:BPMNShape bpmnElement="startEvent" id="BPMNShape_startEvent"><omgdc:Bounds height="30.0" width="30.0" x="0.0" y="95.0"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNShape bpmnElement="approveTask" id="BPMNShape_approveTask"><omgdc:Bounds height="60.0" width="100.0" x="80.0" y="80.0"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNShape bpmnElement="decision" id="BPMNShape_decision"><omgdc:Bounds height="40.0" width="40.0" x="230.0" y="90.0"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNShape bpmnElement="externalSystemCall" id="BPMNShape_externalSystemCall"><omgdc:Bounds height="60.0" width="100.0" x="320.0" y="1.0"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNShape bpmnElement="holidayApprovedTask" id="BPMNShape_holidayApprovedTask"><omgdc:Bounds height="60.0" width="100.0" x="470.0" y="1.0"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNShape bpmnElement="sendRejectionMail" id="BPMNShape_sendRejectionMail"><omgdc:Bounds height="60.0" width="100.0" x="320.0" y="160.0"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNShape bpmnElement="approveEnd" id="BPMNShape_approveEnd"><omgdc:Bounds height="28.0" width="28.0" x="620.0" y="16.0"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNShape bpmnElement="rejectEnd" id="BPMNShape_rejectEnd"><omgdc:Bounds height="28.0" width="28.0" x="505.0" y="175.0"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNEdge bpmnElement="sequenceFlow-2470619b-fa36-440b-a231-b7bd226c23bb" id="BPMNEdge_sequenceFlow-2470619b-fa36-440b-a231-b7bd226c23bb"><omgdi:waypoint x="250.0" y="90.0"></omgdi:waypoint><omgdi:waypoint x="250.0" y="31.0"></omgdi:waypoint><omgdi:waypoint x="319.99999999999284" y="31.0"></omgdi:waypoint></bpmndi:BPMNEdge><bpmndi:BPMNEdge bpmnElement="sequenceFlow-3fa7af74-df9a-4d3a-b0eb-10b20e7dc202" id="BPMNEdge_sequenceFlow-3fa7af74-df9a-4d3a-b0eb-10b20e7dc202"><omgdi:waypoint x="29.949998618355412" y="110.0"></omgdi:waypoint><omgdi:waypoint x="80.0" y="110.0"></omgdi:waypoint></bpmndi:BPMNEdge><bpmndi:BPMNEdge bpmnElement="sequenceFlow-6232f578-3975-4d7e-81f2-43b242d33ebd" id="BPMNEdge_sequenceFlow-6232f578-3975-4d7e-81f2-43b242d33ebd"><omgdi:waypoint x="419.95000000000005" y="31.0"></omgdi:waypoint><omgdi:waypoint x="470.0" y="31.0"></omgdi:waypoint></bpmndi:BPMNEdge><bpmndi:BPMNEdge bpmnElement="sequenceFlow-b390b442-2411-44a9-96eb-3c129d4c8408" id="BPMNEdge_sequenceFlow-b390b442-2411-44a9-96eb-3c129d4c8408"><omgdi:waypoint x="419.949999999997" y="189.66442953020135"></omgdi:waypoint><omgdi:waypoint x="505.00030595247523" y="189.0936221647077"></omgdi:waypoint></bpmndi:BPMNEdge><bpmndi:BPMNEdge bpmnElement="sequenceFlow-d9127dc0-158f-4169-b61b-99226ffe8494" id="BPMNEdge_sequenceFlow-d9127dc0-158f-4169-b61b-99226ffe8494"><omgdi:waypoint x="179.9499999999898" y="110.0"></omgdi:waypoint><omgdi:waypoint x="230.0" y="110.0"></omgdi:waypoint></bpmndi:BPMNEdge><bpmndi:BPMNEdge bpmnElement="sequenceFlow-29fd3375-9bcb-42f2-bb6f-63ae1f98813a" id="BPMNEdge_sequenceFlow-29fd3375-9bcb-42f2-bb6f-63ae1f98813a"><omgdi:waypoint x="569.9499999999988" y="31.0"></omgdi:waypoint><omgdi:waypoint x="582.0" y="31.0"></omgdi:waypoint><omgdi:waypoint x="582.0" y="31.0"></omgdi:waypoint><omgdi:waypoint x="620.0025321198765" y="30.268220825690175"></omgdi:waypoint></bpmndi:BPMNEdge><bpmndi:BPMNEdge bpmnElement="sequenceFlow-6f21d3e2-2e49-4b00-9aae-0b71d861a177" id="BPMNEdge_sequenceFlow-6f21d3e2-2e49-4b00-9aae-0b71d861a177"><omgdi:waypoint x="250.0" y="129.9375468164794"></omgdi:waypoint><omgdi:waypoint x="250.0" y="190.0"></omgdi:waypoint><omgdi:waypoint x="319.99999999997794" y="190.0"></omgdi:waypoint></bpmndi:BPMNEdge></bpmndi:BPMNPlane></bpmndi:BPMNDiagram>
</definitions>
注:文件名为Holiday_Request.bpmn20.xml,flowable支持以BPMN和bpm
- n20.xml结尾的流程文件。
- 上面的xml看起来非常恐怖,不用担心,后面我会介绍Flowable的专门的流程绘制软件。
- 以上主要让大家对Flowable有个简单的了解,下一节介绍如何启动Flowable,并且介绍Flowable的启动包的相关内容。
下一篇:
第2篇:Flowable启动
https://blog.csdn.net/weixin_40816738/article/details/102875324