├── .gitignore ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── README.md ├── doc ├── 007F3CC8ly1h2sp4gu9jvj31440mo42c.jpg ├── 007F3CC8ly1h2sp53129gj30qk0esacn.jpg ├── 007F3CC8ly1h2sp5ehtjdj30on0c740p.jpg └── cover.jpg ├── mvnw ├── mvnw.cmd ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── javapub │ │ └── flowable │ │ └── myflowable │ │ ├── SpringbootFlowableApplication.java │ │ ├── conf │ │ └── FlowableConfig.java │ │ ├── controller │ │ └── ExpenseController.java │ │ └── task │ │ ├── BossTaskHandler.java │ │ └── ManagerTaskHandler.java └── resources │ ├── application.properties │ ├── application.yml │ └── processes │ └── ExpenseProcess.bpmn20.xml └── test └── java └── com └── javapub └── flowable └── myflowable └── SpringbootFlowableApplicationTests.java /.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rodert/springboot-flowable/d8355583e9d20a5b3da0dbd57b2d643d5b126119/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 手把手实现springboot整合flowable、附源码-视频教程 2 | 3 | [GitHub](https://github.com/Rodert/springboot-flowable) | [Gitee](https://gitee.com/rodert/springboot-flowable) 4 | 5 | [toc] 6 | 7 | ## 视频教程 8 | 9 | [点击观看视频](https://www.bilibili.com/video/BV1fa411j7Q5/) | [点击下载原文](https://mp.weixin.qq.com/s/hWwzSu-SlyTzzzHUrA7OXQ) 10 | 11 | 12 | --- 13 | 14 | ![img](https://javapub-common-oss.oss-cn-beijing.aliyuncs.com/javapub/2024%2F05%2F25%2F20240525-151128.jpeg) 15 | 16 | ## 插件安装 17 | 18 | BPMN绘图可视化工具 19 | 20 | > Flowable BPMN visualizer 21 | 22 | ## 导入依赖 23 | 24 | ```xml 25 | 26 | 27 | org.springframework.boot 28 | spring-boot-starter-web 29 | 30 | 31 | 32 | org.flowable 33 | flowable-spring-boot-starter 34 | 6.3.0 35 | 36 | 37 | 38 | mysql 39 | mysql-connector-java 40 | 5.1.45 41 | 42 | ``` 43 | 44 | ## 新建数据库 45 | 46 | database 47 | 48 | > javapub-flowable2 49 | 50 | ## 修改配置 51 | 52 | ```yml 53 | spring: 54 | datasource: 55 | url: jdbc:mysql://bj-cdb-mw08tjgs.sql.tencentcdb.com:60042/javapub-flowable2?characterEncoding=UTF-8 56 | username: root 57 | password: password 58 | driver-class-name: com.mysql.jdbc.Driver 59 | flowable: 60 | #关闭定时任务JOB 61 | async-executor-activate: false 62 | database-schema-update: true 63 | server: 64 | port: 8081 65 | ``` 66 | 67 | **配置说明:** 68 | 69 | 70 | > database-schema-update: true 71 | 72 | 数据库更新策略,其取值有四个: 73 | 74 | ```xml 75 | flase: 默认值。activiti在启动时,会对比数据库表中保存的版本,如果没有表或者版本不匹配,将抛出异常。(生产环境常用) 76 | true: activiti会对数据库中所有表进行更新操作。如果表不存在,则自动创建。(开发时常用) 77 | create_drop: 在activiti启动时创建表,在关闭时删除表(必须手动关闭引擎,才能删除表)。(单元测试常用) 78 | drop-create: 在activiti启动时删除原来的旧表,然后在创建新表(不需要手动关闭引擎)。 79 | ``` 80 | 81 | 82 | ## 定义流程文件 83 | 84 | 这里还是用一个开源的流程文件 85 | 86 | 放在:resources/processes/ExpenseProcess.bpmn20.xml 87 | 88 | ```xml 89 | 90 | 95 | 96 | 报销流程 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 109 | 110 | 111 | 112 | 113 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 500}]]> 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | ``` 198 | 199 | ## 测试 200 | 201 | 1. 提交流程 202 | 203 | > http://localhost:8081/expense/add?userId=123&money=2000 204 | 205 | 提交成功.流程Id为:2501 206 | 207 | 2. 待办列表查询 208 | 209 | > http://localhost:8081/expense/list?userId=123 210 | 211 | Task[id=2507, name=出差报销] 212 | 213 | 3. 同意 214 | 215 | > http://localhost:8081/expense/apply?taskId=2507 216 | 217 | processed ok! 218 | 219 | 4. 生成流程图 220 | 221 | > http://localhost:8081/expense/processDiagram?processId=2501 222 | > 223 | 224 | --- 225 | 226 | ## 截图 227 | 228 | 229 | 230 | ![image](https://javapub-common-oss.oss-cn-beijing.aliyuncs.com/javapub/2024%2F05%2F25%2F20240525-154343.jpg) 231 | 232 | ![image](https://javapub-common-oss.oss-cn-beijing.aliyuncs.com/javapub/2024%2F05%2F25%2F20240525-154414.jpg) 233 | 234 | ![](https://javapub-common-oss.oss-cn-beijing.aliyuncs.com/javapub/2024%2F05%2F25%2F20240525-154422.jpg) 235 | 236 | 237 | 238 | --- 239 | 240 | ## 源码领取 241 | 242 | 公众号:JavaPub 243 | 244 | flowable 245 | 246 | ## 源码 247 | 248 | 源码下载: 249 | 250 | [https://github.com/Rodert/springboot-flowable](https://github.com/Rodert/springboot-flowable) 251 | 252 | [https://gitee.com/rodert/springboot-flowable](https://gitee.com/rodert/springboot-flowable) 253 | 254 | --- 255 | 256 | 向巨人们致敬! 257 | 258 | 公众号 259 | 260 | 261 | 262 | --- 263 | 264 | --- 265 | 266 | 267 | 268 | P哥微信: 269 | 270 | ![微信图片_20220616200142](https://javapub-common-oss.oss-cn-beijing.aliyuncs.com/javapub/2024%2F05%2F25%2F20240525-154502.jpg) 271 | 272 | 273 | 274 | --- 275 | 276 | 277 | 278 | 279 | 280 | ## 推荐阅读(附源码-附安装视频) 281 | 282 | `无套路,免费领取` 283 | 284 | 285 | 286 | 中国象棋:[下载地址1](https://javapub.blog.csdn.net/article/details/124503370) | [下载地址2](http://javapub.net.cn/project/game/chinese-chess-game.html) 287 | 288 | 植物大战僵尸:[下载地址1](https://javapub.blog.csdn.net/article/details/124238828) | [下载地址2](http://javapub.net.cn/project/game/plants-vs-zombies-game.html) 289 | 290 | 俄罗斯方块:[下载地址1](https://javapub.blog.csdn.net/article/details/124471774) | [下载地址2](http://javapub.net.cn/project/game/super-mario-game.html) 291 | 292 | 超级马里奥:[下载地址1](https://javapub.blog.csdn.net/article/details/124463555) | [下载地址2](http://javapub.net.cn/project/game/super-mario-game.html) 293 | 294 | 吃豆人游戏:[下载地址1](https://javapub.blog.csdn.net/article/details/124463461) | [下载地址2](http://javapub.net.cn/project/game/super-mario-game.html) 295 | 296 | 打地鼠:[下载地址1](https://javapub.blog.csdn.net/article/details/124463376) | [下载地址2](http://javapub.net.cn/project/game/super-mario-game.html) 297 | 298 | 捕鱼达人:[下载地址1](https://javapub.blog.csdn.net/article/details/123834030) | [下载地址2](http://javapub.net.cn/project/game/catch-fish-game.html) 299 | 300 | 打飞机:[下载地址1](https://javapub.blog.csdn.net/article/details/123699508) | [下载地址2](http://javapub.net.cn/project/game/super-mario-game.html) 301 | 302 | 坦克大战:[下载地址1](https://javapub.blog.csdn.net/article/details/123779963) | [下载地址2](http://javapub.net.cn/project/game/super-mario-game.html) 303 | 304 | 1024:[下载地址1](https://javapub.blog.csdn.net/article/details/123832950) | [下载地址2](http://javapub.net.cn/project/game/super-mario-game.html) 305 | 306 | 贪吃蛇:[下载地址1](https://javapub.blog.csdn.net/article/details/123833575) | [下载地址2](http://javapub.net.cn/project/game/super-mario-game.html) 307 | 308 | 3D赛车:[下载地址1](https://javapub.blog.csdn.net/article/details/124462822) | [下载地址2](http://javapub.net.cn/project/game/3d-racing-game.html) 309 | 310 | 311 | 312 | 313 | 汇总地址:[下载地址1](https://blog.csdn.net/qq_40374604/category_11788364.html) | [下载地址2](http://javapub.net.cn/category/%E5%B0%8F%E6%B8%B8%E6%88%8F/) 314 | 315 | 316 | 317 | ## 当前目录: 318 | 319 | 1. [springbootfirstdemo 【springboot入门初始化】](https://github.com/Rodert/SpringBoot-javapub/tree/main/springbootfirstdemo) 320 | 2. [spring-boot整合MyBatis批量更新](https://github.com/Rodert/SpringBoot-javapub/tree/main/spring-boot-mybatis) 321 | 3. [spring-boot自定义注解+AOP切面日志](https://github.com/Rodert/SpringBoot-javapub/tree/main/spring-boot-annotation ) 322 | 4. [spring-boot整合docker打包jar](https://github.com/Rodert/SpringBoot-javapub/tree/main/spring-boot-docker) 323 | 5. [spring-boot 整合elasticsearch手脚架](https://github.com/Rodert/SpringBoot-javapub/tree/main/spring-boot-elasticsearch) 324 | 6. [spring-boot整合解析excel](https://github.com/Rodert/SpringBoot-javapub/tree/main/spring-boot-excel) 325 | 7. [spring-boot实现全链路日志traceId](https://github.com/Rodert/SpringBoot-javapub/tree/main/spring-boot-trace) 326 | 8. [springboot整合flowable工作流](https://github.com/Rodert/springboot-flowable) [GitHub](https://github.com/Rodert/springboot-flowable) | [Gitee](https://gitee.com/rodert/springboot-flowable) 327 | 9. 328 | 329 | 330 | #### spring 331 | 332 | 1. [firstSpringProject 【spring初始化工程】](firstSpringProject) 333 | 2. [ssm_helloworld_web 【SSM整合】](ssm_helloworld_web) 334 | 335 | 336 | 337 | 338 | -------------------------------------------------------------------------------- /doc/007F3CC8ly1h2sp4gu9jvj31440mo42c.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rodert/springboot-flowable/d8355583e9d20a5b3da0dbd57b2d643d5b126119/doc/007F3CC8ly1h2sp4gu9jvj31440mo42c.jpg -------------------------------------------------------------------------------- /doc/007F3CC8ly1h2sp53129gj30qk0esacn.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rodert/springboot-flowable/d8355583e9d20a5b3da0dbd57b2d643d5b126119/doc/007F3CC8ly1h2sp53129gj30qk0esacn.jpg -------------------------------------------------------------------------------- /doc/007F3CC8ly1h2sp5ehtjdj30on0c740p.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rodert/springboot-flowable/d8355583e9d20a5b3da0dbd57b2d643d5b126119/doc/007F3CC8ly1h2sp5ehtjdj30on0c740p.jpg -------------------------------------------------------------------------------- /doc/cover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rodert/springboot-flowable/d8355583e9d20a5b3da0dbd57b2d643d5b126119/doc/cover.jpg -------------------------------------------------------------------------------- /mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # https://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ]; then 38 | 39 | if [ -f /usr/local/etc/mavenrc ]; then 40 | . /usr/local/etc/mavenrc 41 | fi 42 | 43 | if [ -f /etc/mavenrc ]; then 44 | . /etc/mavenrc 45 | fi 46 | 47 | if [ -f "$HOME/.mavenrc" ]; then 48 | . "$HOME/.mavenrc" 49 | fi 50 | 51 | fi 52 | 53 | # OS specific support. $var _must_ be set to either true or false. 54 | cygwin=false 55 | darwin=false 56 | mingw=false 57 | case "$(uname)" in 58 | CYGWIN*) cygwin=true ;; 59 | MINGW*) mingw=true ;; 60 | Darwin*) 61 | darwin=true 62 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 63 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 64 | if [ -z "$JAVA_HOME" ]; then 65 | if [ -x "/usr/libexec/java_home" ]; then 66 | export JAVA_HOME="$(/usr/libexec/java_home)" 67 | else 68 | export JAVA_HOME="/Library/Java/Home" 69 | fi 70 | fi 71 | ;; 72 | esac 73 | 74 | if [ -z "$JAVA_HOME" ]; then 75 | if [ -r /etc/gentoo-release ]; then 76 | JAVA_HOME=$(java-config --jre-home) 77 | fi 78 | fi 79 | 80 | if [ -z "$M2_HOME" ]; then 81 | ## resolve links - $0 may be a link to maven's home 82 | PRG="$0" 83 | 84 | # need this for relative symlinks 85 | while [ -h "$PRG" ]; do 86 | ls=$(ls -ld "$PRG") 87 | link=$(expr "$ls" : '.*-> \(.*\)$') 88 | if expr "$link" : '/.*' >/dev/null; then 89 | PRG="$link" 90 | else 91 | PRG="$(dirname "$PRG")/$link" 92 | fi 93 | done 94 | 95 | saveddir=$(pwd) 96 | 97 | M2_HOME=$(dirname "$PRG")/.. 98 | 99 | # make it fully qualified 100 | M2_HOME=$(cd "$M2_HOME" && pwd) 101 | 102 | cd "$saveddir" 103 | # echo Using m2 at $M2_HOME 104 | fi 105 | 106 | # For Cygwin, ensure paths are in UNIX format before anything is touched 107 | if $cygwin; then 108 | [ -n "$M2_HOME" ] && 109 | M2_HOME=$(cygpath --unix "$M2_HOME") 110 | [ -n "$JAVA_HOME" ] && 111 | JAVA_HOME=$(cygpath --unix "$JAVA_HOME") 112 | [ -n "$CLASSPATH" ] && 113 | CLASSPATH=$(cygpath --path --unix "$CLASSPATH") 114 | fi 115 | 116 | # For Mingw, ensure paths are in UNIX format before anything is touched 117 | if $mingw; then 118 | [ -n "$M2_HOME" ] && 119 | M2_HOME="$( ( 120 | cd "$M2_HOME" 121 | pwd 122 | ))" 123 | [ -n "$JAVA_HOME" ] && 124 | JAVA_HOME="$( ( 125 | cd "$JAVA_HOME" 126 | pwd 127 | ))" 128 | fi 129 | 130 | if [ -z "$JAVA_HOME" ]; then 131 | javaExecutable="$(which javac)" 132 | if [ -n "$javaExecutable" ] && ! [ "$(expr \"$javaExecutable\" : '\([^ ]*\)')" = "no" ]; then 133 | # readlink(1) is not available as standard on Solaris 10. 134 | readLink=$(which readlink) 135 | if [ ! $(expr "$readLink" : '\([^ ]*\)') = "no" ]; then 136 | if $darwin; then 137 | javaHome="$(dirname \"$javaExecutable\")" 138 | javaExecutable="$(cd \"$javaHome\" && pwd -P)/javac" 139 | else 140 | javaExecutable="$(readlink -f \"$javaExecutable\")" 141 | fi 142 | javaHome="$(dirname \"$javaExecutable\")" 143 | javaHome=$(expr "$javaHome" : '\(.*\)/bin') 144 | JAVA_HOME="$javaHome" 145 | export JAVA_HOME 146 | fi 147 | fi 148 | fi 149 | 150 | if [ -z "$JAVACMD" ]; then 151 | if [ -n "$JAVA_HOME" ]; then 152 | if [ -x "$JAVA_HOME/jre/sh/java" ]; then 153 | # IBM's JDK on AIX uses strange locations for the executables 154 | JAVACMD="$JAVA_HOME/jre/sh/java" 155 | else 156 | JAVACMD="$JAVA_HOME/bin/java" 157 | fi 158 | else 159 | JAVACMD="$( 160 | \unset -f command 161 | \command -v java 162 | )" 163 | fi 164 | fi 165 | 166 | if [ ! -x "$JAVACMD" ]; then 167 | echo "Error: JAVA_HOME is not defined correctly." >&2 168 | echo " We cannot execute $JAVACMD" >&2 169 | exit 1 170 | fi 171 | 172 | if [ -z "$JAVA_HOME" ]; then 173 | echo "Warning: JAVA_HOME environment variable is not set." 174 | fi 175 | 176 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 177 | 178 | # traverses directory structure from process work directory to filesystem root 179 | # first directory with .mvn subdirectory is considered project base directory 180 | find_maven_basedir() { 181 | 182 | if [ -z "$1" ]; then 183 | echo "Path not specified to find_maven_basedir" 184 | return 1 185 | fi 186 | 187 | basedir="$1" 188 | wdir="$1" 189 | while [ "$wdir" != '/' ]; do 190 | if [ -d "$wdir"/.mvn ]; then 191 | basedir=$wdir 192 | break 193 | fi 194 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 195 | if [ -d "${wdir}" ]; then 196 | wdir=$( 197 | cd "$wdir/.." 198 | pwd 199 | ) 200 | fi 201 | # end of workaround 202 | done 203 | echo "${basedir}" 204 | } 205 | 206 | # concatenates all lines of a file 207 | concat_lines() { 208 | if [ -f "$1" ]; then 209 | echo "$(tr -s '\n' ' ' <"$1")" 210 | fi 211 | } 212 | 213 | BASE_DIR=$(find_maven_basedir "$(pwd)") 214 | if [ -z "$BASE_DIR" ]; then 215 | exit 1 216 | fi 217 | 218 | ########################################################################################## 219 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 220 | # This allows using the maven wrapper in projects that prohibit checking in binary data. 221 | ########################################################################################## 222 | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then 223 | if [ "$MVNW_VERBOSE" = true ]; then 224 | echo "Found .mvn/wrapper/maven-wrapper.jar" 225 | fi 226 | else 227 | if [ "$MVNW_VERBOSE" = true ]; then 228 | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." 229 | fi 230 | if [ -n "$MVNW_REPOURL" ]; then 231 | jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 232 | else 233 | jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 234 | fi 235 | while IFS="=" read key value; do 236 | case "$key" in wrapperUrl) 237 | jarUrl="$value" 238 | break 239 | ;; 240 | esac 241 | done <"$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" 242 | if [ "$MVNW_VERBOSE" = true ]; then 243 | echo "Downloading from: $jarUrl" 244 | fi 245 | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" 246 | if $cygwin; then 247 | wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath") 248 | fi 249 | 250 | if command -v wget >/dev/null; then 251 | if [ "$MVNW_VERBOSE" = true ]; then 252 | echo "Found wget ... using wget" 253 | fi 254 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 255 | wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" 256 | else 257 | wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" 258 | fi 259 | elif command -v curl >/dev/null; then 260 | if [ "$MVNW_VERBOSE" = true ]; then 261 | echo "Found curl ... using curl" 262 | fi 263 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 264 | curl -o "$wrapperJarPath" "$jarUrl" -f 265 | else 266 | curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f 267 | fi 268 | 269 | else 270 | if [ "$MVNW_VERBOSE" = true ]; then 271 | echo "Falling back to using Java to download" 272 | fi 273 | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" 274 | # For Cygwin, switch paths to Windows format before running javac 275 | if $cygwin; then 276 | javaClass=$(cygpath --path --windows "$javaClass") 277 | fi 278 | if [ -e "$javaClass" ]; then 279 | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 280 | if [ "$MVNW_VERBOSE" = true ]; then 281 | echo " - Compiling MavenWrapperDownloader.java ..." 282 | fi 283 | # Compiling the Java class 284 | ("$JAVA_HOME/bin/javac" "$javaClass") 285 | fi 286 | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 287 | # Running the downloader 288 | if [ "$MVNW_VERBOSE" = true ]; then 289 | echo " - Running MavenWrapperDownloader.java ..." 290 | fi 291 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") 292 | fi 293 | fi 294 | fi 295 | fi 296 | ########################################################################################## 297 | # End of extension 298 | ########################################################################################## 299 | 300 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 301 | if [ "$MVNW_VERBOSE" = true ]; then 302 | echo $MAVEN_PROJECTBASEDIR 303 | fi 304 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 305 | 306 | # For Cygwin, switch paths to Windows format before running java 307 | if $cygwin; then 308 | [ -n "$M2_HOME" ] && 309 | M2_HOME=$(cygpath --path --windows "$M2_HOME") 310 | [ -n "$JAVA_HOME" ] && 311 | JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME") 312 | [ -n "$CLASSPATH" ] && 313 | CLASSPATH=$(cygpath --path --windows "$CLASSPATH") 314 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 315 | MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR") 316 | fi 317 | 318 | # Provide a "standardized" way to retrieve the CLI args that will 319 | # work with both Windows and non-Windows executions. 320 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" 321 | export MAVEN_CMD_LINE_ARGS 322 | 323 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 324 | 325 | exec "$JAVACMD" \ 326 | $MAVEN_OPTS \ 327 | $MAVEN_DEBUG_OPTS \ 328 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 329 | "-Dmaven.home=${M2_HOME}" \ 330 | "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 331 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 332 | -------------------------------------------------------------------------------- /mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* 50 | if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 124 | 125 | FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 127 | ) 128 | 129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 131 | if exist %WRAPPER_JAR% ( 132 | if "%MVNW_VERBOSE%" == "true" ( 133 | echo Found %WRAPPER_JAR% 134 | ) 135 | ) else ( 136 | if not "%MVNW_REPOURL%" == "" ( 137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 138 | ) 139 | if "%MVNW_VERBOSE%" == "true" ( 140 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 141 | echo Downloading from: %DOWNLOAD_URL% 142 | ) 143 | 144 | powershell -Command "&{"^ 145 | "$webclient = new-object System.Net.WebClient;"^ 146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 148 | "}"^ 149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ 150 | "}" 151 | if "%MVNW_VERBOSE%" == "true" ( 152 | echo Finished downloading %WRAPPER_JAR% 153 | ) 154 | ) 155 | @REM End of extension 156 | 157 | @REM Provide a "standardized" way to retrieve the CLI args that will 158 | @REM work with both Windows and non-Windows executions. 159 | set MAVEN_CMD_LINE_ARGS=%* 160 | 161 | %MAVEN_JAVA_EXE% ^ 162 | %JVM_CONFIG_MAVEN_PROPS% ^ 163 | %MAVEN_OPTS% ^ 164 | %MAVEN_DEBUG_OPTS% ^ 165 | -classpath %WRAPPER_JAR% ^ 166 | "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ 167 | %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 168 | if ERRORLEVEL 1 goto error 169 | goto end 170 | 171 | :error 172 | set ERROR_CODE=1 173 | 174 | :end 175 | @endlocal & set ERROR_CODE=%ERROR_CODE% 176 | 177 | if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost 178 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 179 | if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" 180 | if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" 181 | :skipRcPost 182 | 183 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 184 | if "%MAVEN_BATCH_PAUSE%"=="on" pause 185 | 186 | if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% 187 | 188 | cmd /C exit /B %ERROR_CODE% 189 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.7.0 9 | 10 | 11 | com.javapub.flowable 12 | myflowable 13 | 0.0.1-SNAPSHOT 14 | springboot-flowable 15 | 这是一个springboot整合flowable 案例 16 | 17 | 1.8 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-starter-test 28 | test 29 | 30 | 31 | 32 | org.springframework.boot 33 | spring-boot-starter-web 34 | 35 | 36 | 37 | org.flowable 38 | flowable-spring-boot-starter 39 | 6.3.0 40 | 41 | 42 | 43 | mysql 44 | mysql-connector-java 45 | 5.1.45 46 | 47 | 48 | 49 | 50 | 51 | 52 | org.springframework.boot 53 | spring-boot-maven-plugin 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /src/main/java/com/javapub/flowable/myflowable/SpringbootFlowableApplication.java: -------------------------------------------------------------------------------- 1 | package com.javapub.flowable.myflowable; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringbootFlowableApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringbootFlowableApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/javapub/flowable/myflowable/conf/FlowableConfig.java: -------------------------------------------------------------------------------- 1 | package com.javapub.flowable.myflowable.conf; 2 | 3 | /** 4 | * @Author: JavaPub 5 | * @License: https://github.com/Rodert/ https://gitee.com/rodert/ 6 | * @Contact: https://javapub.blog.csdn.net/ 7 | * @Date: 2022/6/1 10:19 8 | * @Version: 1.0 9 | * @Description: 10 | * @Author: JavaPub 11 | * @License: https://github.com/Rodert/ https://gitee.com/rodert/ 12 | * @Contact: https://javapub.blog.csdn.net/ 13 | * @Date: 2022/5/29 14:15 14 | * @Version: 1.0 15 | * @Description: 16 | * @Author: JavaPub 17 | * @License: https://github.com/Rodert/ https://gitee.com/rodert/ 18 | * @Contact: https://javapub.blog.csdn.net/ 19 | * @Date: 2022/5/29 14:15 20 | * @Version: 1.0 21 | * @Description: 22 | */ 23 | 24 | /** 25 | * @Author: JavaPub 26 | * @License: https://github.com/Rodert/ https://gitee.com/rodert/ 27 | * @Contact: https://javapub.blog.csdn.net/ 28 | * @Date: 2022/5/29 14:15 29 | * @Version: 1.0 30 | * @Description: 31 | */ 32 | 33 | import org.flowable.spring.SpringProcessEngineConfiguration; 34 | import org.flowable.spring.boot.EngineConfigurationConfigurer; 35 | import org.springframework.context.annotation.Configuration; 36 | 37 | /** 38 | * @author haiyangp 39 | * date: 2018/4/7 40 | * desc: flowable配置----为放置生成的流程图中中文乱码 41 | */ 42 | @Configuration 43 | public class FlowableConfig implements EngineConfigurationConfigurer { 44 | 45 | 46 | @Override 47 | public void configure(SpringProcessEngineConfiguration engineConfiguration) { 48 | engineConfiguration.setActivityFontName("宋体"); 49 | engineConfiguration.setLabelFontName("宋体"); 50 | engineConfiguration.setAnnotationFontName("宋体"); 51 | } 52 | } -------------------------------------------------------------------------------- /src/main/java/com/javapub/flowable/myflowable/controller/ExpenseController.java: -------------------------------------------------------------------------------- 1 | package com.javapub.flowable.myflowable.controller; 2 | 3 | /** 4 | * @Author: JavaPub 5 | * @License: https://github.com/Rodert/ https://gitee.com/rodert/ 6 | * @Contact: https://javapub.blog.csdn.net/ 7 | * @Date: 2022/6/1 10:11 8 | * @Version: 1.0 9 | * @Description: 10 | */ 11 | 12 | import org.flowable.bpmn.model.BpmnModel; 13 | import org.flowable.engine.*; 14 | import org.flowable.engine.runtime.Execution; 15 | import org.flowable.engine.runtime.ProcessInstance; 16 | import org.flowable.image.ProcessDiagramGenerator; 17 | import org.flowable.task.api.Task; 18 | import org.springframework.beans.factory.annotation.Autowired; 19 | import org.springframework.stereotype.Controller; 20 | import org.springframework.web.bind.annotation.RequestMapping; 21 | import org.springframework.web.bind.annotation.ResponseBody; 22 | 23 | import javax.servlet.http.HttpServletResponse; 24 | import java.io.InputStream; 25 | import java.io.OutputStream; 26 | import java.util.ArrayList; 27 | import java.util.HashMap; 28 | import java.util.List; 29 | 30 | @Controller 31 | @RequestMapping(value = "expense") 32 | public class ExpenseController { 33 | @Autowired 34 | private RuntimeService runtimeService; 35 | @Autowired 36 | private TaskService taskService; 37 | @Autowired 38 | private RepositoryService repositoryService; 39 | @Autowired 40 | private ProcessEngine processEngine; 41 | 42 | /***************此处为业务代码******************/ 43 | /** 44 | * 添加报销 45 | * 46 | * @param userId 用户Id 47 | * @param money 报销金额 48 | * @param descption 描述 49 | */ 50 | @RequestMapping(value = "add") 51 | @ResponseBody 52 | public String addExpense(String userId, Integer money, String descption) { 53 | //启动流程 54 | HashMap map = new HashMap<>(); 55 | map.put("taskUser", userId); 56 | map.put("money", money); 57 | ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("Expense", map); 58 | return "提交成功.流程Id为:" + processInstance.getId(); 59 | } 60 | 61 | /** 62 | * 获取审批管理列表 63 | */ 64 | @RequestMapping(value = "/list") 65 | @ResponseBody 66 | public Object list(String userId) { 67 | List tasks = taskService.createTaskQuery().taskAssignee(userId).orderByTaskCreateTime().desc().list(); 68 | for (Task task : tasks) { 69 | System.out.println(task.toString()); 70 | } 71 | return tasks.toArray().toString(); 72 | } 73 | 74 | /** 75 | * 批准 76 | * 77 | * @param taskId 任务ID 78 | */ 79 | @RequestMapping(value = "apply") 80 | @ResponseBody 81 | public String apply(String taskId) { 82 | Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); 83 | if (task == null) { 84 | throw new RuntimeException("流程不存在"); 85 | } 86 | //通过审核 87 | HashMap map = new HashMap<>(); 88 | map.put("outcome", "通过"); 89 | taskService.complete(taskId, map); 90 | return "processed ok!"; 91 | } 92 | 93 | /** 94 | * 拒绝 95 | */ 96 | @ResponseBody 97 | @RequestMapping(value = "reject") 98 | public String reject(String taskId) { 99 | HashMap map = new HashMap<>(); 100 | map.put("outcome", "驳回"); 101 | taskService.complete(taskId, map); 102 | return "reject"; 103 | } 104 | 105 | /** 106 | * 生成流程图 107 | * 108 | * @param processId 任务ID 109 | */ 110 | @RequestMapping(value = "processDiagram") 111 | public void genProcessDiagram(HttpServletResponse httpServletResponse, String processId) throws Exception { 112 | ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult(); 113 | 114 | //流程走完的不显示图 115 | if (pi == null) { 116 | return; 117 | } 118 | Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult(); 119 | //使用流程实例ID,查询正在执行的执行对象表,返回流程实例对象 120 | String InstanceId = task.getProcessInstanceId(); 121 | List executions = runtimeService 122 | .createExecutionQuery() 123 | .processInstanceId(InstanceId) 124 | .list(); 125 | 126 | //得到正在执行的Activity的Id 127 | List activityIds = new ArrayList<>(); 128 | List flows = new ArrayList<>(); 129 | for (Execution exe : executions) { 130 | List ids = runtimeService.getActiveActivityIds(exe.getId()); 131 | activityIds.addAll(ids); 132 | } 133 | 134 | //获取流程图 135 | BpmnModel bpmnModel = repositoryService.getBpmnModel(pi.getProcessDefinitionId()); 136 | ProcessEngineConfiguration engconf = processEngine.getProcessEngineConfiguration(); 137 | ProcessDiagramGenerator diagramGenerator = engconf.getProcessDiagramGenerator(); 138 | InputStream in = diagramGenerator.generateDiagram(bpmnModel, "png", activityIds, flows, engconf.getActivityFontName(), engconf.getLabelFontName(), engconf.getAnnotationFontName(), engconf.getClassLoader(), 1.0); 139 | OutputStream out = null; 140 | byte[] buf = new byte[1024]; 141 | int legth = 0; 142 | try { 143 | out = httpServletResponse.getOutputStream(); 144 | while ((legth = in.read(buf)) != -1) { 145 | out.write(buf, 0, legth); 146 | } 147 | } finally { 148 | if (in != null) { 149 | in.close(); 150 | } 151 | if (out != null) { 152 | out.close(); 153 | } 154 | } 155 | } 156 | } -------------------------------------------------------------------------------- /src/main/java/com/javapub/flowable/myflowable/task/BossTaskHandler.java: -------------------------------------------------------------------------------- 1 | package com.javapub.flowable.myflowable.task; 2 | 3 | import org.flowable.engine.delegate.TaskListener; 4 | import org.flowable.task.service.delegate.DelegateTask; 5 | 6 | /** 7 | * @Author: JavaPub 8 | * @License: https://github.com/Rodert/ https://gitee.com/rodert/ 9 | * @Contact: https://javapub.blog.csdn.net/ 10 | * @Date: 2022/6/1 10:09 11 | * @Version: 1.0 12 | * @Description: 13 | */ 14 | 15 | public class BossTaskHandler implements TaskListener { 16 | 17 | @Override 18 | public void notify(DelegateTask delegateTask) { 19 | delegateTask.setAssignee("老板"); 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /src/main/java/com/javapub/flowable/myflowable/task/ManagerTaskHandler.java: -------------------------------------------------------------------------------- 1 | package com.javapub.flowable.myflowable.task; 2 | 3 | /** 4 | * @Author: JavaPub 5 | * @License: https://github.com/Rodert/ https://gitee.com/rodert/ 6 | * @Contact: https://javapub.blog.csdn.net/ 7 | * @Date: 2022/6/1 10:09 8 | * @Version: 1.0 9 | * @Description: 10 | */ 11 | 12 | import org.flowable.engine.delegate.TaskListener; 13 | import org.flowable.task.service.delegate.DelegateTask; 14 | 15 | public class ManagerTaskHandler implements TaskListener { 16 | 17 | @Override 18 | public void notify(DelegateTask delegateTask) { 19 | delegateTask.setAssignee("经理"); 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | 2 | spring: 3 | datasource: 4 | url: jdbc:mysql://bj-cdb-mw08tjgs.sql.tencentcdb.com:60042/javapub-flowable2?characterEncoding=UTF-8 5 | username: root 6 | password: 1234qwer 7 | driver-class-name: com.mysql.jdbc.Driver 8 | flowable: 9 | #关闭定时任务JOB 10 | async-executor-activate: false 11 | database-schema-update: true 12 | server: 13 | port: 8081 14 | -------------------------------------------------------------------------------- /src/main/resources/processes/ExpenseProcess.bpmn20.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 报销流程 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 500}]]> 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /src/test/java/com/javapub/flowable/myflowable/SpringbootFlowableApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.javapub.flowable.myflowable; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringbootFlowableApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | --------------------------------------------------------------------------------