Skip to content

FuriousPws002/camunda-bpm-spring-boot-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

camunda-bpm-spring-boot-example

初衷

由于公司项目使用了工作流,自己也是初次接触,为了加深理解,所以自己写了例子。主要参考了camunda官方文档

准备工作

  • jdk1.8+
  • 流程图工具modeler
  • 管理系统bpm 现在大多数java服务都会采用springboot的方式快速开发,同时,业务数据都会基于数据库。所以,上面的管理系统bpm不是必须,只需要集成到springboot中即可。下载的zip中sql文件夹下,需要自行提取sql文件。已经提取到项目中resource/sql中了。我这里使用的mysql数据库,所以建立了数据库camunda,再去执行mysql_identity_7.13.0.sqlmysql_identity_7.13.0.sql两个sql脚本,完成表的建立和数据的初始化工作。

说明

我们平常应该都接触过请假流程,在这里,就以请假流程为例,从0到1完成我们的流程开发。 使用工具 modeler 绘制流程图,完成后的效果大概是这样的

img/leave.png

绘制好流程图后,导出为leave.bpmn文件,存放到resource路径中。

设置配置文件application.yml为如下内容

camunda.bpm:
  admin-user:
    id: demo
    password: demo
    firstName: Demo
  filter:
    create: All tasks

spring:
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://localhost:3306/camunda?autoReconnect=true
    username: root
    password: root

编写LeaveController,其中三个方法如下

  • apply 请假申请
  • task 审批人查看自己的审批任务列表
  • approval 审批请假流程

启动项目后,执行上面的方法就可以推动流程节点的流转。当请假流程发起后,可以登录http://localhost:8080访问管理系统。用户名/密码为demo/demo,登录后,就可以查看taskList中的流程信息。

About

Spring Boot and database integration camunda bpmn

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages