Browse Source

新增flowable集成

11932 1 month ago
parent
commit
6c63e1672b
65 changed files with 7095 additions and 8 deletions
  1. 12 0
      RuoYi-Vue-master/RuoYi-Vue-master/doubleDefense/pom.xml
  2. 23 5
      RuoYi-Vue-master/RuoYi-Vue-master/pom.xml
  3. 4 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-admin/pom.xml
  4. 6 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-admin/src/main/resources/application-druid-dev.yml
  5. 12 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-common/pom.xml
  6. 43 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-common/src/main/java/com/ruoyi/common/exception/CustomException.java
  7. 104 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/pom.xml
  8. 80 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/common/constant/ProcessConstants.java
  9. 43 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/common/enums/FlowComment.java
  10. 12 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/common/expand/el/BaseEl.java
  11. 32 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/common/expand/el/FlowEl.java
  12. 24 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/config/FlowableConfig.java
  13. 95 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/config/MyDefaultProcessDiagramCanvas.java
  14. 209 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/controller/FlowDefinitionController.java
  15. 277 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/controller/FlowTaskController.java
  16. 104 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/controller/SysExpressionController.java
  17. 117 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/controller/SysFormController.java
  18. 104 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/controller/SysListenerController.java
  19. 25 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/dto/FlowCommentDto.java
  20. 15 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/dto/FlowFromFieldDTO.java
  21. 33 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/dto/FlowNextDto.java
  22. 28 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/dto/FlowSaveXmlVo.java
  23. 105 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/dto/FlowTaskDto.java
  24. 23 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/dto/FlowViewerDto.java
  25. 36 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/vo/FlowQueryVo.java
  26. 56 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/vo/FlowTaskVo.java
  27. 26 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/vo/ReturnTaskNodeVo.java
  28. 41 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/factory/FlowServiceFactory.java
  29. 370 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/flow/CustomProcessDiagramCanvas.java
  30. 404 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/flow/CustomProcessDiagramGenerator.java
  31. 266 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/flow/FindNextNodeUtil.java
  32. 702 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/flow/FlowableUtils.java
  33. 36 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/listener/FlowExecutionListener.java
  34. 32 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/listener/FlowTaskListener.java
  35. 80 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/IFlowDefinitionService.java
  36. 53 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/IFlowInstanceService.java
  37. 218 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/IFlowTaskService.java
  38. 69 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/ISysDeployFormService.java
  39. 60 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/ISysFormService.java
  40. 248 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowDefinitionServiceImpl.java
  41. 122 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowInstanceServiceImpl.java
  42. 1262 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowTaskServiceImpl.java
  43. 112 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/SysDeployFormServiceImpl.java
  44. 96 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/SysFormServiceImpl.java
  45. 13 1
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-framework/pom.xml
  46. 13 1
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-generator/pom.xml
  47. 13 1
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/pom.xml
  48. 56 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/domain/FlowProcDefDto.java
  49. 64 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysDeployForm.java
  50. 95 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysExpression.java
  51. 70 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysForm.java
  52. 126 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysListener.java
  53. 22 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/mapper/FlowDeployMapper.java
  54. 74 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeployFormMapper.java
  55. 64 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysExpressionMapper.java
  56. 64 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysFormMapper.java
  57. 64 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysListenerMapper.java
  58. 62 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysExpressionService.java
  59. 62 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysListenerService.java
  60. 97 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysExpressionServiceImpl.java
  61. 97 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysListenerServiceImpl.java
  62. 90 0
      RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/resources/mapper/system/SysExpressionMapper.xml
  63. 110 0
      RuoYi-Vue-master/RuoYi-Vue-master/sql/tony-flowable.sql
  64. 12 0
      RuoYi-Vue-master/RuoYi-Vue-master/train/pom.xml
  65. 8 0
      RuoYi-Vue-master/RuoYi-Vue-master/workTecket/pom.xml

+ 12 - 0
RuoYi-Vue-master/RuoYi-Vue-master/doubleDefense/pom.xml

@@ -2,6 +2,18 @@
2 2
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3 3
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4 4
     <modelVersion>4.0.0</modelVersion>
5
+    <build>
6
+        <plugins>
7
+            <plugin>
8
+                <groupId>org.apache.maven.plugins</groupId>
9
+                <artifactId>maven-compiler-plugin</artifactId>
10
+                <configuration>
11
+                    <source>8</source>
12
+                    <target>8</target>
13
+                </configuration>
14
+            </plugin>
15
+        </plugins>
16
+    </build>
5 17
     <parent>
6 18
         <artifactId>ruoyi</artifactId>
7 19
         <groupId>com.ruoyi</groupId>

+ 23 - 5
RuoYi-Vue-master/RuoYi-Vue-master/pom.xml

@@ -3,7 +3,7 @@
3 3
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 4
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5 5
 	<modelVersion>4.0.0</modelVersion>
6
-	
6
+
7 7
     <groupId>com.ruoyi</groupId>
8 8
     <artifactId>ruoyi</artifactId>
9 9
     <version>3.8.6</version>
@@ -11,7 +11,7 @@
11 11
     <name>ruoyi</name>
12 12
     <url>http://www.ruoyi.vip</url>
13 13
     <description>若依管理系统</description>
14
-    
14
+
15 15
     <properties>
16 16
         <ruoyi.version>3.8.6</ruoyi.version>
17 17
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -34,12 +34,15 @@
34 34
         <mybatis.plus.extension.version>3.5.3</mybatis.plus.extension.version>
35 35
         <mybatis-plus-core.version>3.5.3</mybatis-plus-core.version>
36 36
         <mybatis-plus-annotation.version>3.5.3</mybatis-plus-annotation.version>
37
+        <flowable.version>6.8.0</flowable.version>
37 38
     </properties>
38
-	
39
+
39 40
     <!-- 依赖声明 -->
40 41
     <dependencyManagement>
41 42
         <dependencies>
42 43
 
44
+
45
+
43 46
             <!-- SpringBoot的依赖配置-->
44 47
             <dependency>
45 48
                 <groupId>org.springframework.boot</groupId>
@@ -153,6 +156,18 @@
153 156
                 <artifactId>ruoyi-generator</artifactId>
154 157
                 <version>${ruoyi.version}</version>
155 158
             </dependency>
159
+            <!-- flowable的依赖配置-->
160
+            <dependency>
161
+                <groupId>com.ruoyi</groupId>
162
+                <artifactId>ruoyi-flowable</artifactId>
163
+                <version>${ruoyi.version}</version>
164
+            </dependency>
165
+            <dependency>
166
+                <groupId>org.flowable</groupId>
167
+                <artifactId>flowable-spring-boot-starter</artifactId>
168
+                <version>${flowable.version}</version>
169
+            </dependency>
170
+
156 171
 
157 172
             <!-- 核心模块-->
158 173
             <dependency>
@@ -245,6 +260,7 @@
245 260
         <module>workTecket</module>
246 261
         <module>drill</module>
247 262
         <module>drill-deduction</module>
263
+        <module>ruoyi-flowable</module>
248 264
     </modules>
249 265
     <packaging>pom</packaging>
250 266
 
@@ -263,7 +279,7 @@
263 279
         </plugins>
264 280
     </build>
265 281
 
266
-    <repositories>
282
+   <repositories>
267 283
         <repository>
268 284
             <id>public</id>
269 285
             <name>aliyun nexus</name>
@@ -274,6 +290,8 @@
274 290
         </repository>
275 291
     </repositories>
276 292
 
293
+
294
+
277 295
     <pluginRepositories>
278 296
         <pluginRepository>
279 297
             <id>public</id>
@@ -288,4 +306,4 @@
288 306
         </pluginRepository>
289 307
     </pluginRepositories>
290 308
 
291
-</project>
309
+</project>

+ 4 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-admin/pom.xml

@@ -69,6 +69,10 @@
69 69
             <groupId>com.ruoyi</groupId>
70 70
             <artifactId>drill-deduction</artifactId>
71 71
         </dependency>
72
+        <dependency>
73
+            <groupId>com.ruoyi</groupId>
74
+            <artifactId>ruoyi-flowable</artifactId>
75
+        </dependency>
72 76
         <!-- 双重防预模块-->
73 77
         <dependency>
74 78
             <groupId>com.ruoyi</groupId>

+ 6 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-admin/src/main/resources/application-druid-dev.yml

@@ -86,3 +86,9 @@ spring:
86 86
                 max-active: 8
87 87
                 # #连接池最大阻塞等待时间(使用负值表示没有限制)
88 88
                 max-wait: -1ms
89
+    # flowable相关表
90
+    flowable:
91
+        # true 会对数据库中所有表进行更新操作。如果表不存在,则自动创建(建议开发时使用)
92
+        database-schema-update: true #数据库中不存在流程表时,将该值设置为true
93
+        # 关闭定时任务JOB
94
+        async-executor-activate: false

+ 12 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-common/pom.xml

@@ -14,6 +14,18 @@
14 14
     <description>
15 15
         common通用工具
16 16
     </description>
17
+    <build>
18
+        <plugins>
19
+            <plugin>
20
+                <groupId>org.apache.maven.plugins</groupId>
21
+                <artifactId>maven-compiler-plugin</artifactId>
22
+                <configuration>
23
+                    <source>8</source>
24
+                    <target>8</target>
25
+                </configuration>
26
+            </plugin>
27
+        </plugins>
28
+    </build>
17 29
 
18 30
     <dependencies>
19 31
 

+ 43 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-common/src/main/java/com/ruoyi/common/exception/CustomException.java

@@ -0,0 +1,43 @@
1
+package com.ruoyi.common.exception;
2
+
3
+/**
4
+ * 自定义异常
5
+ * 
6
+ * @author ruoyi
7
+ */
8
+public class CustomException extends RuntimeException
9
+{
10
+    private static final long serialVersionUID = 1L;
11
+
12
+    private Integer code;
13
+
14
+    private String message;
15
+
16
+    public CustomException(String message)
17
+    {
18
+        this.message = message;
19
+    }
20
+
21
+    public CustomException(String message, Integer code)
22
+    {
23
+        this.message = message;
24
+        this.code = code;
25
+    }
26
+
27
+    public CustomException(String message, Throwable e)
28
+    {
29
+        super(message, e);
30
+        this.message = message;
31
+    }
32
+
33
+    @Override
34
+    public String getMessage()
35
+    {
36
+        return message;
37
+    }
38
+
39
+    public Integer getCode()
40
+    {
41
+        return code;
42
+    }
43
+}

+ 104 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/pom.xml

@@ -0,0 +1,104 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4
+	<parent>
5
+		<artifactId>ruoyi</artifactId>
6
+		<groupId>com.ruoyi</groupId>
7
+		<version>3.8.6</version>
8
+	</parent>
9
+	<modelVersion>4.0.0</modelVersion>
10
+
11
+	<artifactId>ruoyi-flowable</artifactId>
12
+    <build>
13
+        <plugins>
14
+            <plugin>
15
+                <groupId>org.apache.maven.plugins</groupId>
16
+                <artifactId>maven-compiler-plugin</artifactId>
17
+                <configuration>
18
+                    <source>8</source>
19
+                    <target>8</target>
20
+                </configuration>
21
+            </plugin>
22
+        </plugins>
23
+    </build>
24
+
25
+    <dependencies>
26
+
27
+		<dependency>
28
+			<groupId>com.ruoyi</groupId>
29
+			<artifactId>ruoyi-framework</artifactId>
30
+		</dependency>
31
+		<dependency>
32
+			<groupId>com.ruoyi</groupId>
33
+			<artifactId>ruoyi-system</artifactId>
34
+		</dependency>
35
+		<dependency>
36
+			<groupId>com.ruoyi</groupId>
37
+			<artifactId>ruoyi-common</artifactId>
38
+		</dependency>
39
+
40
+		<!--常用工具类 -->
41
+		<dependency>
42
+			<groupId>org.apache.commons</groupId>
43
+			<artifactId>commons-lang3</artifactId>
44
+		</dependency>
45
+
46
+		<!-- JSON工具类 -->
47
+		<dependency>
48
+			<groupId>com.fasterxml.jackson.core</groupId>
49
+			<artifactId>jackson-databind</artifactId>
50
+		</dependency>
51
+
52
+		<!-- 阿里JSON解析器 -->
53
+		<dependency>
54
+			<groupId>com.alibaba.fastjson2</groupId>
55
+			<artifactId>fastjson2</artifactId>
56
+		</dependency>
57
+
58
+		<dependency>
59
+			<groupId>org.projectlombok</groupId>
60
+			<artifactId>lombok</artifactId>
61
+			<optional>true</optional>
62
+		</dependency>
63
+
64
+		<dependency>
65
+			<groupId>org.flowable</groupId>
66
+			<artifactId>flowable-spring-boot-starter</artifactId>
67
+			<!-- 排除flowable自带的权限认证 -->
68
+			<exclusions>
69
+				<exclusion>
70
+					<groupId>org.flowable</groupId>
71
+					<artifactId>flowable-spring-security</artifactId>
72
+				</exclusion>
73
+			</exclusions>
74
+		</dependency>
75
+		<dependency>
76
+			<groupId>com.baomidou</groupId>
77
+			<artifactId>mybatis-plus-boot-starter</artifactId>
78
+		</dependency>
79
+
80
+		<dependency>
81
+			<!-- websocket -->
82
+			<groupId>org.springframework.boot</groupId>
83
+			<artifactId>spring-boot-starter-websocket</artifactId>
84
+		</dependency>
85
+
86
+		<!--el表达式计算-->
87
+		<dependency>
88
+			<groupId>com.googlecode.aviator</groupId>
89
+			<artifactId>aviator</artifactId>
90
+			<version>5.3.3</version>
91
+		</dependency>
92
+
93
+	</dependencies>
94
+
95
+<!--	<build>-->
96
+<!--		<plugins>-->
97
+<!--			<plugin>-->
98
+<!--				<groupId>org.springframework.boot</groupId>-->
99
+<!--				<artifactId>spring-boot-maven-plugin</artifactId>-->
100
+<!--			</plugin>-->
101
+<!--		</plugins>-->
102
+<!--	</build>-->
103
+
104
+</project>

+ 80 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/common/constant/ProcessConstants.java

@@ -0,0 +1,80 @@
1
+package com.ruoyi.flowable.common.constant;
2
+
3
+/**
4
+ * 流程常量信息
5
+ *
6
+ * @author Tony
7
+ * @date 2021/4/17 22:46
8
+ */
9
+public class ProcessConstants {
10
+
11
+    /**
12
+     * 动态数据
13
+     */
14
+    public static final String DYNAMIC = "dynamic";
15
+
16
+    /**
17
+     * 固定任务接收
18
+     */
19
+    public static final String FIXED = "fixed";
20
+
21
+    /**
22
+     * 单个审批人
23
+     */
24
+    public static final String ASSIGNEE = "assignee";
25
+
26
+
27
+    /**
28
+     * 候选人
29
+     */
30
+    public static final String CANDIDATE_USERS = "candidateUsers";
31
+
32
+
33
+    /**
34
+     * 审批组
35
+     */
36
+    public static final String CANDIDATE_GROUPS = "candidateGroups";
37
+
38
+    /**
39
+     * 单个审批人
40
+     */
41
+    public static final String PROCESS_APPROVAL = "approval";
42
+
43
+    /**
44
+     * 会签人员
45
+     */
46
+    public static final String PROCESS_MULTI_INSTANCE_USER = "userList";
47
+
48
+    /**
49
+     * nameapace
50
+     */
51
+    public static final String NAMASPASE = "http://flowable.org/bpmn";
52
+
53
+    /**
54
+     * 会签节点
55
+     */
56
+    public static final String PROCESS_MULTI_INSTANCE = "multiInstance";
57
+
58
+    /**
59
+     * 自定义属性 dataType
60
+     */
61
+    public static final String PROCESS_CUSTOM_DATA_TYPE = "dataType";
62
+
63
+    /**
64
+     * 自定义属性 userType
65
+     */
66
+    public static final String PROCESS_CUSTOM_USER_TYPE = "userType";
67
+
68
+    /**
69
+     * 初始化人员
70
+     */
71
+    public static final String PROCESS_INITIATOR = "INITIATOR";
72
+
73
+
74
+    /**
75
+     * 流程跳过
76
+     */
77
+    public static final String FLOWABLE_SKIP_EXPRESSION_ENABLED = "_FLOWABLE_SKIP_EXPRESSION_ENABLED";
78
+
79
+
80
+}

+ 43 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/common/enums/FlowComment.java

@@ -0,0 +1,43 @@
1
+package com.ruoyi.flowable.common.enums;
2
+
3
+/**
4
+ * 流程意见类型
5
+ *
6
+ * @author Tony
7
+ * @date 2021/4/19
8
+ */
9
+public enum FlowComment {
10
+
11
+    /**
12
+     * 说明
13
+     */
14
+    NORMAL("1", "正常意见"),
15
+    REBACK("2", "退回意见"),
16
+    REJECT("3", "驳回意见"),
17
+    DELEGATE("4", "委派意见"),
18
+    ASSIGN("5", "转办意见"),
19
+    STOP("6", "终止流程");
20
+
21
+    /**
22
+     * 类型
23
+     */
24
+    private final String type;
25
+
26
+    /**
27
+     * 说明
28
+     */
29
+    private final String remark;
30
+
31
+    FlowComment(String type, String remark) {
32
+        this.type = type;
33
+        this.remark = remark;
34
+    }
35
+
36
+    public String getType() {
37
+        return type;
38
+    }
39
+
40
+    public String getRemark() {
41
+        return remark;
42
+    }
43
+}

+ 12 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/common/expand/el/BaseEl.java

@@ -0,0 +1,12 @@
1
+package com.ruoyi.flowable.common.expand.el;
2
+
3
+/**
4
+ * 扩展表达式
5
+ *
6
+ * @author Tony
7
+ * @date 2023-03-04 09:10
8
+ */
9
+public interface BaseEl {
10
+
11
+}
12
+

+ 32 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/common/expand/el/FlowEl.java

@@ -0,0 +1,32 @@
1
+package com.ruoyi.flowable.common.expand.el;
2
+
3
+import com.ruoyi.system.service.ISysDeptService;
4
+import lombok.extern.slf4j.Slf4j;
5
+import org.springframework.stereotype.Component;
6
+
7
+import javax.annotation.Resource;
8
+
9
+/**
10
+ * 扩展表达式
11
+ *
12
+ * @author Tony
13
+ * @date 2023-03-04 12:10
14
+ */
15
+@Component
16
+@Slf4j
17
+public class FlowEl implements BaseEl {
18
+
19
+    @Resource
20
+    private ISysDeptService sysDeptService;
21
+
22
+    public String findDeptLeader(String name){
23
+        log.info("开始查询表达式变量值,getName");
24
+        return name;
25
+    }
26
+
27
+    public String getName(String name){
28
+        log.info("开始查询表达式变量值,getName");
29
+        return name;
30
+    }
31
+}
32
+

+ 24 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/config/FlowableConfig.java

@@ -0,0 +1,24 @@
1
+package com.ruoyi.flowable.config;
2
+
3
+import org.flowable.engine.impl.db.DbIdGenerator;
4
+import org.flowable.spring.SpringProcessEngineConfiguration;
5
+import org.flowable.spring.boot.EngineConfigurationConfigurer;
6
+import org.springframework.context.annotation.Configuration;
7
+
8
+/**
9
+ * 扩展流程配置
10
+ * @author Tony
11
+ * @date 2022-12-26 10:24
12
+ */
13
+@Configuration
14
+public class FlowableConfig implements EngineConfigurationConfigurer<SpringProcessEngineConfiguration> {
15
+
16
+    @Override
17
+    public void configure(SpringProcessEngineConfiguration engineConfiguration) {
18
+        engineConfiguration.setActivityFontName("宋体");
19
+        engineConfiguration.setLabelFontName("宋体");
20
+        engineConfiguration.setAnnotationFontName("宋体");
21
+        engineConfiguration.setIdGenerator(new DbIdGenerator());
22
+    }
23
+
24
+}

+ 95 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/config/MyDefaultProcessDiagramCanvas.java

@@ -0,0 +1,95 @@
1
+//package com.ruoyi.flowable.config;
2
+//
3
+//import com.sun.prism.paint.Color;
4
+//import org.flowable.bpmn.model.AssociationDirection;
5
+//import org.flowable.image.impl.DefaultProcessDiagramCanvas;
6
+//
7
+//import java.awt.*;
8
+//import java.awt.geom.Line2D;
9
+//import java.awt.geom.RoundRectangle2D;
10
+//
11
+///**
12
+// * @author Tony
13
+// * @date 2021-04-03
14
+// */
15
+//public class MyDefaultProcessDiagramCanvas extends DefaultProcessDiagramCanvas {
16
+//    //设置高亮线的颜色  这里我设置成绿色
17
+//    protected static Color HIGHLIGHT_SEQUENCEFLOW_COLOR = Color.GREEN;
18
+//
19
+//    public MyDefaultProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType, String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader) {
20
+//        super(width, height, minX, minY, imageType, activityFontName, labelFontName, annotationFontName, customClassLoader);
21
+//    }
22
+//
23
+//    public MyDefaultProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType) {
24
+//        super(width, height, minX, minY, imageType);
25
+//    }
26
+//
27
+//
28
+//    /**
29
+//     * 画线颜色设置
30
+//     */
31
+//    @Override
32
+//    public void drawConnection(int[] xPoints, int[] yPoints, boolean conditional, boolean isDefault, String connectionType,
33
+//                               AssociationDirection associationDirection, boolean highLighted, double scaleFactor) {
34
+//
35
+//        Paint originalPaint = g.getPaint();
36
+//        Stroke originalStroke = g.getStroke();
37
+//
38
+//        g.setPaint(CONNECTION_COLOR);
39
+//        if (connectionType.equals("association")) {
40
+//            g.setStroke(ASSOCIATION_STROKE);
41
+//        } else if (highLighted) {
42
+//            //设置线的颜色
43
+//            g.setPaint(originalPaint);
44
+//            g.setStroke(HIGHLIGHT_FLOW_STROKE);
45
+//        }
46
+//
47
+//        for (int i = 1; i < xPoints.length; i++) {
48
+//            Integer sourceX = xPoints[i - 1];
49
+//            Integer sourceY = yPoints[i - 1];
50
+//            Integer targetX = xPoints[i];
51
+//            Integer targetY = yPoints[i];
52
+//            Line2D.Double line = new Line2D.Double(sourceX, sourceY, targetX, targetY);
53
+//            g.draw(line);
54
+//        }
55
+//
56
+//        if (isDefault) {
57
+//            Line2D.Double line = new Line2D.Double(xPoints[0], yPoints[0], xPoints[1], yPoints[1]);
58
+//            drawDefaultSequenceFlowIndicator(line, scaleFactor);
59
+//        }
60
+//
61
+//        if (conditional) {
62
+//            Line2D.Double line = new Line2D.Double(xPoints[0], yPoints[0], xPoints[1], yPoints[1]);
63
+//            drawConditionalSequenceFlowIndicator(line, scaleFactor);
64
+//        }
65
+//
66
+//        if (associationDirection == AssociationDirection.ONE || associationDirection == AssociationDirection.BOTH) {
67
+//            Line2D.Double line = new Line2D.Double(xPoints[xPoints.length - 2], yPoints[xPoints.length - 2], xPoints[xPoints.length - 1], yPoints[xPoints.length - 1]);
68
+//            drawArrowHead(line, scaleFactor);
69
+//        }
70
+//        if (associationDirection == AssociationDirection.BOTH) {
71
+//            Line2D.Double line = new Line2D.Double(xPoints[1], yPoints[1], xPoints[0], yPoints[0]);
72
+//            drawArrowHead(line, scaleFactor);
73
+//        }
74
+//        g.setPaint(originalPaint);
75
+//        g.setStroke(originalStroke);
76
+//    }
77
+//
78
+//    /**
79
+//     * 高亮节点设置
80
+//     */
81
+//    @Override
82
+//    public void drawHighLight(int x, int y, int width, int height) {
83
+//        Paint originalPaint = g.getPaint();
84
+//        Stroke originalStroke = g.getStroke();
85
+//        //设置高亮节点的颜色
86
+//        g.setPaint(HIGHLIGHT_COLOR);
87
+//        g.setStroke(THICK_TASK_BORDER_STROKE);
88
+//
89
+//        RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, 20, 20);
90
+//        g.draw(rect);
91
+//
92
+//        g.setPaint(originalPaint);
93
+//        g.setStroke(originalStroke);
94
+//    }
95
+//}

+ 209 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/controller/FlowDefinitionController.java

@@ -0,0 +1,209 @@
1
+package com.ruoyi.flowable.controller;
2
+
3
+import com.ruoyi.common.annotation.Log;
4
+import com.ruoyi.common.core.controller.BaseController;
5
+import com.ruoyi.common.core.domain.AjaxResult;
6
+import com.ruoyi.common.core.domain.entity.SysRole;
7
+import com.ruoyi.common.core.domain.entity.SysUser;
8
+import com.ruoyi.common.core.page.TableDataInfo;
9
+import com.ruoyi.common.enums.BusinessType;
10
+import com.ruoyi.system.domain.FlowProcDefDto;
11
+import com.ruoyi.flowable.domain.dto.FlowSaveXmlVo;
12
+import com.ruoyi.flowable.service.IFlowDefinitionService;
13
+import com.ruoyi.system.domain.SysExpression;
14
+import com.ruoyi.system.service.ISysExpressionService;
15
+import com.ruoyi.system.service.ISysRoleService;
16
+import com.ruoyi.system.service.ISysUserService;
17
+import io.swagger.annotations.Api;
18
+import io.swagger.annotations.ApiOperation;
19
+import io.swagger.annotations.ApiParam;
20
+import lombok.extern.slf4j.Slf4j;
21
+import org.springframework.beans.factory.annotation.Autowired;
22
+import org.springframework.security.access.prepost.PreAuthorize;
23
+import org.springframework.web.bind.annotation.*;
24
+import org.springframework.web.multipart.MultipartFile;
25
+
26
+import javax.annotation.Resource;
27
+import javax.imageio.ImageIO;
28
+import javax.servlet.http.HttpServletResponse;
29
+import java.awt.image.BufferedImage;
30
+import java.io.ByteArrayInputStream;
31
+import java.io.IOException;
32
+import java.io.InputStream;
33
+import java.io.OutputStream;
34
+import java.nio.charset.StandardCharsets;
35
+import java.util.List;
36
+import java.util.Map;
37
+
38
+/**
39
+ * <p>
40
+ * 工作流程定义
41
+ * </p>
42
+ *
43
+ * @author Tony
44
+ * @date 2021-04-03
45
+ */
46
+@Slf4j
47
+@Api(tags = "流程定义")
48
+@RestController
49
+@RequestMapping("/flowable/definition")
50
+public class FlowDefinitionController extends BaseController {
51
+
52
+    @Autowired
53
+    private IFlowDefinitionService flowDefinitionService;
54
+
55
+    @Autowired
56
+    private ISysUserService userService;
57
+
58
+    @Resource
59
+    private ISysRoleService sysRoleService;
60
+    @Resource
61
+    private ISysExpressionService sysExpressionService;
62
+
63
+    @GetMapping(value = "/list")
64
+    @ApiOperation(value = "流程定义列表", response = FlowProcDefDto.class)
65
+    public AjaxResult list(@ApiParam(value = "当前页码", required = true) @RequestParam Integer pageNum,
66
+                           @ApiParam(value = "每页条数", required = true) @RequestParam Integer pageSize,
67
+                           @ApiParam(value = "流程名称", required = false) @RequestParam(required = false) String name) {
68
+        return AjaxResult.success(flowDefinitionService.list(name, pageNum, pageSize));
69
+    }
70
+
71
+
72
+    @ApiOperation(value = "导入流程文件", notes = "上传bpmn20的xml文件")
73
+    @PostMapping("/import")
74
+    public AjaxResult importFile(@RequestParam(required = false) String name,
75
+                                 @RequestParam(required = false) String category,
76
+                                 MultipartFile file) {
77
+        InputStream in = null;
78
+        try {
79
+            in = file.getInputStream();
80
+            flowDefinitionService.importFile(name, category, in);
81
+        } catch (Exception e) {
82
+            log.error("导入失败:", e);
83
+            return AjaxResult.success(e.getMessage());
84
+        } finally {
85
+            try {
86
+                if (in != null) {
87
+                    in.close();
88
+                }
89
+            } catch (IOException e) {
90
+                log.error("关闭输入流出错", e);
91
+            }
92
+        }
93
+
94
+        return AjaxResult.success("导入成功");
95
+    }
96
+
97
+
98
+    @ApiOperation(value = "读取xml文件")
99
+    @GetMapping("/readXml/{deployId}")
100
+    public AjaxResult readXml(@ApiParam(value = "流程定义id") @PathVariable(value = "deployId") String deployId) {
101
+        try {
102
+            return flowDefinitionService.readXml(deployId);
103
+        } catch (Exception e) {
104
+            return AjaxResult.error("加载xml文件异常");
105
+        }
106
+
107
+    }
108
+
109
+    @ApiOperation(value = "读取图片文件")
110
+    @GetMapping("/readImage/{deployId}")
111
+    public void readImage(@ApiParam(value = "流程定义id") @PathVariable(value = "deployId") String deployId, HttpServletResponse response) {
112
+        OutputStream os = null;
113
+        BufferedImage image = null;
114
+        try {
115
+            image = ImageIO.read(flowDefinitionService.readImage(deployId));
116
+            response.setContentType("image/png");
117
+            os = response.getOutputStream();
118
+            if (image != null) {
119
+                ImageIO.write(image, "png", os);
120
+            }
121
+        } catch (Exception e) {
122
+            e.printStackTrace();
123
+        } finally {
124
+            try {
125
+                if (os != null) {
126
+                    os.flush();
127
+                    os.close();
128
+                }
129
+            } catch (IOException e) {
130
+                e.printStackTrace();
131
+            }
132
+        }
133
+
134
+    }
135
+
136
+
137
+    @ApiOperation(value = "保存流程设计器内的xml文件")
138
+    @Log(title = "流程定义", businessType = BusinessType.INSERT)
139
+    @PostMapping("/save")
140
+    public AjaxResult save(@RequestBody FlowSaveXmlVo vo) {
141
+        InputStream in = null;
142
+        try {
143
+            in = new ByteArrayInputStream(vo.getXml().getBytes(StandardCharsets.UTF_8));
144
+            flowDefinitionService.importFile(vo.getName(), vo.getCategory(), in);
145
+        } catch (Exception e) {
146
+            log.error("导入失败:", e);
147
+            return AjaxResult.error(e.getMessage());
148
+        } finally {
149
+            try {
150
+                if (in != null) {
151
+                    in.close();
152
+                }
153
+            } catch (IOException e) {
154
+                log.error("关闭输入流出错", e);
155
+            }
156
+        }
157
+
158
+        return AjaxResult.success("导入成功");
159
+    }
160
+
161
+    @ApiOperation(value = "发起流程")
162
+    @Log(title = "发起流程", businessType = BusinessType.INSERT)
163
+    @PostMapping("/start/{procDefId}")
164
+    public AjaxResult start(@ApiParam(value = "流程定义id") @PathVariable(value = "procDefId") String procDefId,
165
+                            @ApiParam(value = "变量集合,json对象") @RequestBody Map<String, Object> variables) {
166
+        return flowDefinitionService.startProcessInstanceById(procDefId, variables);
167
+    }
168
+
169
+    @ApiOperation(value = "激活或挂起流程定义")
170
+    @Log(title = "激活/挂起流程", businessType = BusinessType.UPDATE)
171
+    @PutMapping(value = "/updateState")
172
+    public AjaxResult updateState(@ApiParam(value = "1:激活,2:挂起", required = true) @RequestParam Integer state,
173
+                                  @ApiParam(value = "流程部署ID", required = true) @RequestParam String deployId) {
174
+        flowDefinitionService.updateState(state, deployId);
175
+        return AjaxResult.success();
176
+    }
177
+
178
+    @ApiOperation(value = "删除流程")
179
+    @Log(title = "删除流程", businessType = BusinessType.DELETE)
180
+    @DeleteMapping(value = "/{deployIds}")
181
+    public AjaxResult delete(@PathVariable String[] deployIds) {
182
+        for (String deployId : deployIds) {
183
+            flowDefinitionService.delete(deployId);
184
+        }
185
+        return AjaxResult.success();
186
+    }
187
+
188
+    @ApiOperation(value = "指定流程办理人员列表")
189
+    @GetMapping("/userList")
190
+    public AjaxResult userList(SysUser user) {
191
+        List<SysUser> list = userService.selectUserList(user);
192
+        return AjaxResult.success(list);
193
+    }
194
+
195
+    @ApiOperation(value = "指定流程办理组列表")
196
+    @GetMapping("/roleList")
197
+    public AjaxResult roleList(SysRole role) {
198
+        List<SysRole> list = sysRoleService.selectRoleList(role);
199
+        return AjaxResult.success(list);
200
+    }
201
+
202
+    @ApiOperation(value = "指定流程达式列表")
203
+    @GetMapping("/expList")
204
+    public AjaxResult expList(SysExpression sysExpression) {
205
+        List<SysExpression> list = sysExpressionService.selectSysExpressionList(sysExpression);
206
+        return AjaxResult.success(list);
207
+    }
208
+
209
+}

+ 277 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/controller/FlowTaskController.java

@@ -0,0 +1,277 @@
1
+package com.ruoyi.flowable.controller;
2
+
3
+import com.ruoyi.common.annotation.Log;
4
+import com.ruoyi.common.core.controller.BaseController;
5
+import com.ruoyi.common.core.domain.AjaxResult;
6
+import com.ruoyi.common.enums.BusinessType;
7
+import com.ruoyi.flowable.domain.dto.FlowTaskDto;
8
+import com.ruoyi.flowable.domain.vo.FlowQueryVo;
9
+import com.ruoyi.flowable.domain.vo.FlowTaskVo;
10
+import com.ruoyi.flowable.service.IFlowTaskService;
11
+import io.swagger.annotations.Api;
12
+import io.swagger.annotations.ApiOperation;
13
+import io.swagger.annotations.ApiParam;
14
+import lombok.extern.slf4j.Slf4j;
15
+import org.springframework.beans.factory.annotation.Autowired;
16
+import org.springframework.web.bind.annotation.*;
17
+
18
+import javax.imageio.ImageIO;
19
+import javax.servlet.http.HttpServletResponse;
20
+import java.awt.image.BufferedImage;
21
+import java.io.IOException;
22
+import java.io.InputStream;
23
+import java.io.OutputStream;
24
+
25
+/**
26
+ * <p>工作流任务管理<p>
27
+ *
28
+ * @author Tony
29
+ * @date 2021-04-03
30
+ */
31
+@Slf4j
32
+@Api(tags = "工作流流程任务管理")
33
+@RestController
34
+@RequestMapping("/flowable/task")
35
+public class FlowTaskController extends BaseController {
36
+
37
+    @Autowired
38
+    private IFlowTaskService flowTaskService;
39
+
40
+    @ApiOperation(value = "我发起的流程", response = FlowTaskDto.class)
41
+    @GetMapping(value = "/myProcess")
42
+    public AjaxResult myProcess(FlowQueryVo queryVo) {
43
+        return flowTaskService.myProcess(queryVo);
44
+    }
45
+
46
+    @ApiOperation(value = "取消申请", response = FlowTaskDto.class)
47
+    @Log(title = "取消申请", businessType = BusinessType.UPDATE)
48
+    @PostMapping(value = "/stopProcess")
49
+    public AjaxResult stopProcess(@RequestBody FlowTaskVo flowTaskVo) {
50
+        return flowTaskService.stopProcess(flowTaskVo);
51
+    }
52
+
53
+    @ApiOperation(value = "撤回流程", response = FlowTaskDto.class)
54
+    @Log(title = "撤回流程", businessType = BusinessType.UPDATE)
55
+    @PostMapping(value = "/revokeProcess")
56
+    public AjaxResult revokeProcess(@RequestBody FlowTaskVo flowTaskVo) {
57
+        return flowTaskService.revokeProcess(flowTaskVo);
58
+    }
59
+
60
+    @ApiOperation(value = "获取待办列表", response = FlowTaskDto.class)
61
+    @GetMapping(value = "/todoList")
62
+    public AjaxResult todoList(FlowQueryVo queryVo) {
63
+        return flowTaskService.todoList(queryVo);
64
+    }
65
+
66
+    @ApiOperation(value = "获取已办任务", response = FlowTaskDto.class)
67
+    @GetMapping(value = "/finishedList")
68
+    public AjaxResult finishedList(FlowQueryVo queryVo) {
69
+        return flowTaskService.finishedList(queryVo);
70
+    }
71
+
72
+
73
+    @ApiOperation(value = "流程历史流转记录", response = FlowTaskDto.class)
74
+    @GetMapping(value = "/flowRecord")
75
+    public AjaxResult flowRecord(String procInsId, String deployId) {
76
+        return flowTaskService.flowRecord(procInsId, deployId);
77
+    }
78
+
79
+    @ApiOperation(value = "根据任务ID查询挂载的表单信息")
80
+    @GetMapping(value = "/getTaskForm")
81
+    public AjaxResult getTaskForm(String taskId) {
82
+        return flowTaskService.getTaskForm(taskId);
83
+    }
84
+
85
+
86
+    @ApiOperation(value = "流程初始化表单", response = FlowTaskDto.class)
87
+    @GetMapping(value = "/flowFormData")
88
+    public AjaxResult flowFormData(String deployId) {
89
+        return flowTaskService.flowFormData(deployId);
90
+    }
91
+
92
+    @ApiOperation(value = "获取流程变量", response = FlowTaskDto.class)
93
+    @GetMapping(value = "/processVariables/{taskId}")
94
+    public AjaxResult processVariables(@ApiParam(value = "流程任务Id") @PathVariable(value = "taskId") String taskId) {
95
+        return flowTaskService.processVariables(taskId);
96
+    }
97
+
98
+    @ApiOperation(value = "审批任务")
99
+    @Log(title = "审批任务", businessType = BusinessType.UPDATE)
100
+    @PostMapping(value = "/complete")
101
+    public AjaxResult complete(@RequestBody FlowTaskVo flowTaskVo) {
102
+        return flowTaskService.complete(flowTaskVo);
103
+    }
104
+
105
+    @ApiOperation(value = "驳回任务")
106
+    @Log(title = "驳回任务", businessType = BusinessType.UPDATE)
107
+    @PostMapping(value = "/reject")
108
+    public AjaxResult taskReject(@RequestBody FlowTaskVo flowTaskVo) {
109
+        flowTaskService.taskReject(flowTaskVo);
110
+        return AjaxResult.success();
111
+    }
112
+
113
+    @ApiOperation(value = "退回任务")
114
+    @Log(title = "退回任务", businessType = BusinessType.UPDATE)
115
+    @PostMapping(value = "/return")
116
+    public AjaxResult taskReturn(@RequestBody FlowTaskVo flowTaskVo) {
117
+        flowTaskService.taskReturn(flowTaskVo);
118
+        return AjaxResult.success();
119
+    }
120
+
121
+    @ApiOperation(value = "获取所有可回退的节点")
122
+    @PostMapping(value = "/returnList")
123
+    public AjaxResult findReturnTaskList(@RequestBody FlowTaskVo flowTaskVo) {
124
+        return flowTaskService.findReturnTaskList(flowTaskVo);
125
+    }
126
+
127
+    @ApiOperation(value = "删除任务")
128
+    @Log(title = "删除任务", businessType = BusinessType.DELETE)
129
+    @DeleteMapping(value = "/delete")
130
+    public AjaxResult delete(@RequestBody FlowTaskVo flowTaskVo) {
131
+        flowTaskService.deleteTask(flowTaskVo);
132
+        return AjaxResult.success();
133
+    }
134
+
135
+    @ApiOperation(value = "认领/签收任务")
136
+    @PostMapping(value = "/claim")
137
+    public AjaxResult claim(@RequestBody FlowTaskVo flowTaskVo) {
138
+        flowTaskService.claim(flowTaskVo);
139
+        return AjaxResult.success();
140
+    }
141
+
142
+    @ApiOperation(value = "取消认领/签收任务")
143
+    @PostMapping(value = "/unClaim")
144
+    public AjaxResult unClaim(@RequestBody FlowTaskVo flowTaskVo) {
145
+        flowTaskService.unClaim(flowTaskVo);
146
+        return AjaxResult.success();
147
+    }
148
+
149
+    @ApiOperation(value = "委派任务")
150
+    @PostMapping(value = "/delegateTask")
151
+    public AjaxResult delegate(@RequestBody FlowTaskVo flowTaskVo) {
152
+        flowTaskService.delegateTask(flowTaskVo);
153
+        return AjaxResult.success();
154
+    }
155
+
156
+    @ApiOperation(value = "任务归还")
157
+    @PostMapping(value = "/resolveTask")
158
+    public AjaxResult resolveTask(@RequestBody FlowTaskVo flowTaskVo) {
159
+        flowTaskService.resolveTask(flowTaskVo);
160
+        return AjaxResult.success();
161
+    }
162
+
163
+    @ApiOperation(value = "转办任务")
164
+    @PostMapping(value = "/assignTask")
165
+    public AjaxResult assign(@RequestBody FlowTaskVo flowTaskVo) {
166
+        flowTaskService.assignTask(flowTaskVo);
167
+        return AjaxResult.success();
168
+    }
169
+
170
+    @PostMapping(value = "/addMultiInstanceExecution")
171
+    @ApiOperation(value = "多实例加签")
172
+    public AjaxResult addMultiInstanceExecution(@RequestBody FlowTaskVo flowTaskVo) {
173
+        flowTaskService.addMultiInstanceExecution(flowTaskVo);
174
+        return AjaxResult.success("加签成功");
175
+    }
176
+
177
+    @PostMapping(value = "/deleteMultiInstanceExecution")
178
+    @ApiOperation(value = "多实例减签")
179
+    public AjaxResult deleteMultiInstanceExecution(@RequestBody FlowTaskVo flowTaskVo) {
180
+        flowTaskService.deleteMultiInstanceExecution(flowTaskVo);
181
+        return AjaxResult.success("减签成功");
182
+    }
183
+
184
+    @ApiOperation(value = "获取下一节点")
185
+    @PostMapping(value = "/nextFlowNode")
186
+    public AjaxResult getNextFlowNode(@RequestBody FlowTaskVo flowTaskVo) {
187
+        return flowTaskService.getNextFlowNode(flowTaskVo);
188
+    }
189
+
190
+    @ApiOperation(value = "流程发起时获取下一节点")
191
+    @PostMapping(value = "/nextFlowNodeByStart")
192
+    public AjaxResult getNextFlowNodeByStart(@RequestBody FlowTaskVo flowTaskVo) {
193
+        return flowTaskService.getNextFlowNodeByStart(flowTaskVo);
194
+    }
195
+
196
+    /**
197
+     * 生成流程图
198
+     *
199
+     * @param processId 任务ID
200
+     */
201
+    @GetMapping("/diagram/{processId}")
202
+    public void genProcessDiagram(HttpServletResponse response,
203
+                                  @PathVariable("processId") String processId) {
204
+        InputStream inputStream = flowTaskService.diagram(processId);
205
+        OutputStream os = null;
206
+        BufferedImage image = null;
207
+        try {
208
+            image = ImageIO.read(inputStream);
209
+            response.setContentType("image/png");
210
+            os = response.getOutputStream();
211
+            if (image != null) {
212
+                ImageIO.write(image, "png", os);
213
+            }
214
+        } catch (Exception e) {
215
+            e.printStackTrace();
216
+        } finally {
217
+            try {
218
+                if (os != null) {
219
+                    os.flush();
220
+                    os.close();
221
+                }
222
+            } catch (IOException e) {
223
+                e.printStackTrace();
224
+            }
225
+        }
226
+    }
227
+
228
+    /**
229
+     * 获取流程执行节点
230
+     *
231
+     * @param procInsId 流程实例编号
232
+     * @param procInsId 任务执行编号
233
+     */
234
+    @GetMapping("/flowViewer/{procInsId}/{executionId}")
235
+    public AjaxResult getFlowViewer(@PathVariable("procInsId") String procInsId,
236
+                                    @PathVariable("executionId") String executionId) {
237
+        return flowTaskService.getFlowViewer(procInsId, executionId);
238
+    }
239
+
240
+    /**
241
+     * 流程节点信息
242
+     *
243
+     * @param procInsId 流程实例id
244
+     * @return
245
+     */
246
+    @GetMapping("/flowXmlAndNode")
247
+    public AjaxResult flowXmlAndNode(@RequestParam(value = "procInsId", required = false) String procInsId,
248
+                                     @RequestParam(value = "deployId", required = false) String deployId) {
249
+        return flowTaskService.flowXmlAndNode(procInsId, deployId);
250
+    }
251
+
252
+    /**
253
+     * 流程节点表单
254
+     *
255
+     * @param taskId 流程任务编号
256
+     * @return
257
+     */
258
+    @GetMapping("/flowTaskForm")
259
+    public AjaxResult flowTaskForm(@RequestParam(value = "taskId", required = false) String taskId) throws Exception {
260
+        return flowTaskService.flowTaskForm(taskId);
261
+    }
262
+
263
+
264
+    /**
265
+     * 流程节点信息
266
+     *
267
+     * @param procInsId 流程实例编号
268
+     * @param elementId 流程节点编号
269
+     * @return
270
+     */
271
+    @GetMapping("/flowTaskInfo")
272
+    public AjaxResult flowTaskInfo(@RequestParam(value = "procInsId") String procInsId,
273
+                                   @RequestParam(value = "elementId") String elementId){
274
+        return flowTaskService.flowTaskInfo(procInsId,elementId);
275
+    }
276
+
277
+}

+ 104 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/controller/SysExpressionController.java

@@ -0,0 +1,104 @@
1
+package com.ruoyi.flowable.controller;
2
+
3
+import java.util.List;
4
+import javax.servlet.http.HttpServletResponse;
5
+import org.springframework.security.access.prepost.PreAuthorize;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.web.bind.annotation.GetMapping;
8
+import org.springframework.web.bind.annotation.PostMapping;
9
+import org.springframework.web.bind.annotation.PutMapping;
10
+import org.springframework.web.bind.annotation.DeleteMapping;
11
+import org.springframework.web.bind.annotation.PathVariable;
12
+import org.springframework.web.bind.annotation.RequestBody;
13
+import org.springframework.web.bind.annotation.RequestMapping;
14
+import org.springframework.web.bind.annotation.RestController;
15
+import com.ruoyi.common.annotation.Log;
16
+import com.ruoyi.common.core.controller.BaseController;
17
+import com.ruoyi.common.core.domain.AjaxResult;
18
+import com.ruoyi.common.enums.BusinessType;
19
+import com.ruoyi.system.domain.SysExpression;
20
+import com.ruoyi.system.service.ISysExpressionService;
21
+import com.ruoyi.common.utils.poi.ExcelUtil;
22
+import com.ruoyi.common.core.page.TableDataInfo;
23
+
24
+/**
25
+ * 流程达式Controller
26
+ *
27
+ * @author ruoyi
28
+ * @date 2022-12-12
29
+ */
30
+@RestController
31
+@RequestMapping("/system/expression")
32
+public class SysExpressionController extends BaseController
33
+{
34
+    @Autowired
35
+    private ISysExpressionService sysExpressionService;
36
+
37
+    /**
38
+     * 查询流程达式列表
39
+     */
40
+    @PreAuthorize("@ss.hasPermi('system:expression:list')")
41
+    @GetMapping("/list")
42
+    public TableDataInfo list(SysExpression sysExpression)
43
+    {
44
+        startPage();
45
+        List<SysExpression> list = sysExpressionService.selectSysExpressionList(sysExpression);
46
+        return getDataTable(list);
47
+    }
48
+
49
+    /**
50
+     * 导出流程达式列表
51
+     */
52
+    @PreAuthorize("@ss.hasPermi('system:expression:export')")
53
+    @Log(title = "流程达式", businessType = BusinessType.EXPORT)
54
+    @PostMapping("/export")
55
+    public void export(HttpServletResponse response, SysExpression sysExpression)
56
+    {
57
+        List<SysExpression> list = sysExpressionService.selectSysExpressionList(sysExpression);
58
+        ExcelUtil<SysExpression> util = new ExcelUtil<SysExpression>(SysExpression.class);
59
+        util.exportExcel(response, list, "流程达式数据");
60
+    }
61
+
62
+    /**
63
+     * 获取流程达式详细信息
64
+     */
65
+    @PreAuthorize("@ss.hasPermi('system:expression:query')")
66
+    @GetMapping(value = "/{id}")
67
+    public AjaxResult getInfo(@PathVariable("id") Long id)
68
+    {
69
+        return success(sysExpressionService.selectSysExpressionById(id));
70
+    }
71
+
72
+    /**
73
+     * 新增流程达式
74
+     */
75
+    @PreAuthorize("@ss.hasPermi('system:expression:add')")
76
+    @Log(title = "流程达式", businessType = BusinessType.INSERT)
77
+    @PostMapping
78
+    public AjaxResult add(@RequestBody SysExpression sysExpression)
79
+    {
80
+        return toAjax(sysExpressionService.insertSysExpression(sysExpression));
81
+    }
82
+
83
+    /**
84
+     * 修改流程达式
85
+     */
86
+    @PreAuthorize("@ss.hasPermi('system:expression:edit')")
87
+    @Log(title = "流程达式", businessType = BusinessType.UPDATE)
88
+    @PutMapping
89
+    public AjaxResult edit(@RequestBody SysExpression sysExpression)
90
+    {
91
+        return toAjax(sysExpressionService.updateSysExpression(sysExpression));
92
+    }
93
+
94
+    /**
95
+     * 删除流程达式
96
+     */
97
+    @PreAuthorize("@ss.hasPermi('system:expression:remove')")
98
+    @Log(title = "流程达式", businessType = BusinessType.DELETE)
99
+	@DeleteMapping("/{ids}")
100
+    public AjaxResult remove(@PathVariable Long[] ids)
101
+    {
102
+        return toAjax(sysExpressionService.deleteSysExpressionByIds(ids));
103
+    }
104
+}

+ 117 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/controller/SysFormController.java

@@ -0,0 +1,117 @@
1
+package com.ruoyi.flowable.controller;
2
+
3
+import java.util.List;
4
+
5
+import com.ruoyi.flowable.service.ISysDeployFormService;
6
+import com.ruoyi.system.domain.SysDeployForm;
7
+import org.springframework.security.access.prepost.PreAuthorize;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.web.bind.annotation.GetMapping;
10
+import org.springframework.web.bind.annotation.PostMapping;
11
+import org.springframework.web.bind.annotation.PutMapping;
12
+import org.springframework.web.bind.annotation.DeleteMapping;
13
+import org.springframework.web.bind.annotation.PathVariable;
14
+import org.springframework.web.bind.annotation.RequestBody;
15
+import org.springframework.web.bind.annotation.RequestMapping;
16
+import org.springframework.web.bind.annotation.RestController;
17
+import com.ruoyi.common.annotation.Log;
18
+import com.ruoyi.common.core.controller.BaseController;
19
+import com.ruoyi.common.core.domain.AjaxResult;
20
+import com.ruoyi.common.enums.BusinessType;
21
+import com.ruoyi.system.domain.SysForm;
22
+import com.ruoyi.flowable.service.ISysFormService;
23
+import com.ruoyi.common.utils.poi.ExcelUtil;
24
+import com.ruoyi.common.core.page.TableDataInfo;
25
+
26
+/**
27
+ * 流程表单Controller
28
+ *
29
+ * @author Tony
30
+ * @date 2021-04-03
31
+ */
32
+@RestController
33
+@RequestMapping("/flowable/form")
34
+public class SysFormController extends BaseController {
35
+    @Autowired
36
+    private ISysFormService SysFormService;
37
+
38
+    @Autowired
39
+    private ISysDeployFormService sysDeployFormService;
40
+
41
+    /**
42
+     * 查询流程表单列表
43
+     */
44
+    @PreAuthorize("@ss.hasPermi('flowable:form:list')")
45
+    @GetMapping("/list")
46
+    public TableDataInfo list(SysForm sysForm) {
47
+        startPage();
48
+        List<SysForm> list = SysFormService.selectSysFormList(sysForm);
49
+        return getDataTable(list);
50
+    }
51
+
52
+    @GetMapping("/formList")
53
+    public AjaxResult formList(SysForm sysForm) {
54
+        List<SysForm> list = SysFormService.selectSysFormList(sysForm);
55
+        return AjaxResult.success(list);
56
+    }
57
+    /**
58
+     * 导出流程表单列表
59
+     */
60
+    @PreAuthorize("@ss.hasPermi('flowable:form:export')")
61
+    @Log(title = "流程表单", businessType = BusinessType.EXPORT)
62
+    @GetMapping("/export")
63
+    public AjaxResult export(SysForm sysForm) {
64
+        List<SysForm> list = SysFormService.selectSysFormList(sysForm);
65
+        ExcelUtil<SysForm> util = new ExcelUtil<SysForm>(SysForm.class);
66
+        return util.exportExcel(list, "form");
67
+    }
68
+
69
+    /**
70
+     * 获取流程表单详细信息
71
+     */
72
+    @PreAuthorize("@ss.hasPermi('flowable:form:query')")
73
+    @GetMapping(value = "/{formId}")
74
+    public AjaxResult getInfo(@PathVariable("formId") Long formId) {
75
+        return AjaxResult.success(SysFormService.selectSysFormById(formId));
76
+    }
77
+
78
+    /**
79
+     * 新增流程表单
80
+     */
81
+    @PreAuthorize("@ss.hasPermi('flowable:form:add')")
82
+    @Log(title = "流程表单", businessType = BusinessType.INSERT)
83
+    @PostMapping
84
+    public AjaxResult add(@RequestBody SysForm sysForm) {
85
+        return toAjax(SysFormService.insertSysForm(sysForm));
86
+    }
87
+
88
+    /**
89
+     * 修改流程表单
90
+     */
91
+    @PreAuthorize("@ss.hasPermi('flowable:form:edit')")
92
+    @Log(title = "流程表单", businessType = BusinessType.UPDATE)
93
+    @PutMapping
94
+    public AjaxResult edit(@RequestBody SysForm sysForm) {
95
+        return toAjax(SysFormService.updateSysForm(sysForm));
96
+    }
97
+
98
+    /**
99
+     * 删除流程表单
100
+     */
101
+    @PreAuthorize("@ss.hasPermi('flowable:form:remove')")
102
+    @Log(title = "流程表单", businessType = BusinessType.DELETE)
103
+    @DeleteMapping("/{formIds}")
104
+    public AjaxResult remove(@PathVariable Long[] formIds) {
105
+        return toAjax(SysFormService.deleteSysFormByIds(formIds));
106
+    }
107
+
108
+
109
+    /**
110
+     * 挂载流程表单
111
+     */
112
+    @Log(title = "流程表单", businessType = BusinessType.INSERT)
113
+    @PostMapping("/addDeployForm")
114
+    public AjaxResult addDeployForm(@RequestBody SysDeployForm sysDeployForm) {
115
+        return toAjax(sysDeployFormService.insertSysDeployForm(sysDeployForm));
116
+    }
117
+}

+ 104 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/controller/SysListenerController.java

@@ -0,0 +1,104 @@
1
+package com.ruoyi.flowable.controller;
2
+
3
+import java.util.List;
4
+import javax.servlet.http.HttpServletResponse;
5
+import org.springframework.security.access.prepost.PreAuthorize;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.web.bind.annotation.GetMapping;
8
+import org.springframework.web.bind.annotation.PostMapping;
9
+import org.springframework.web.bind.annotation.PutMapping;
10
+import org.springframework.web.bind.annotation.DeleteMapping;
11
+import org.springframework.web.bind.annotation.PathVariable;
12
+import org.springframework.web.bind.annotation.RequestBody;
13
+import org.springframework.web.bind.annotation.RequestMapping;
14
+import org.springframework.web.bind.annotation.RestController;
15
+import com.ruoyi.common.annotation.Log;
16
+import com.ruoyi.common.core.controller.BaseController;
17
+import com.ruoyi.common.core.domain.AjaxResult;
18
+import com.ruoyi.common.enums.BusinessType;
19
+import com.ruoyi.system.domain.SysListener;
20
+import com.ruoyi.system.service.ISysListenerService;
21
+import com.ruoyi.common.utils.poi.ExcelUtil;
22
+import com.ruoyi.common.core.page.TableDataInfo;
23
+
24
+/**
25
+ * 流程监听Controller
26
+ *
27
+ * @author Tony
28
+ * @date 2022-12-25
29
+ */
30
+@RestController
31
+@RequestMapping("/system/listener")
32
+public class SysListenerController extends BaseController
33
+{
34
+    @Autowired
35
+    private ISysListenerService sysListenerService;
36
+
37
+    /**
38
+     * 查询流程监听列表
39
+     */
40
+    @PreAuthorize("@ss.hasPermi('system:listener:list')")
41
+    @GetMapping("/list")
42
+    public TableDataInfo list(SysListener sysListener)
43
+    {
44
+        startPage();
45
+        List<SysListener> list = sysListenerService.selectSysListenerList(sysListener);
46
+        return getDataTable(list);
47
+    }
48
+
49
+    /**
50
+     * 导出流程监听列表
51
+     */
52
+    @PreAuthorize("@ss.hasPermi('system:listener:export')")
53
+    @Log(title = "流程监听", businessType = BusinessType.EXPORT)
54
+    @PostMapping("/export")
55
+    public void export(HttpServletResponse response, SysListener sysListener)
56
+    {
57
+        List<SysListener> list = sysListenerService.selectSysListenerList(sysListener);
58
+        ExcelUtil<SysListener> util = new ExcelUtil<SysListener>(SysListener.class);
59
+        util.exportExcel(response, list, "流程监听数据");
60
+    }
61
+
62
+    /**
63
+     * 获取流程监听详细信息
64
+     */
65
+    @PreAuthorize("@ss.hasPermi('system:listener:query')")
66
+    @GetMapping(value = "/{id}")
67
+    public AjaxResult getInfo(@PathVariable("id") Long id)
68
+    {
69
+        return success(sysListenerService.selectSysListenerById(id));
70
+    }
71
+
72
+    /**
73
+     * 新增流程监听
74
+     */
75
+    @PreAuthorize("@ss.hasPermi('system:listener:add')")
76
+    @Log(title = "流程监听", businessType = BusinessType.INSERT)
77
+    @PostMapping
78
+    public AjaxResult add(@RequestBody SysListener sysListener)
79
+    {
80
+        return toAjax(sysListenerService.insertSysListener(sysListener));
81
+    }
82
+
83
+    /**
84
+     * 修改流程监听
85
+     */
86
+    @PreAuthorize("@ss.hasPermi('system:listener:edit')")
87
+    @Log(title = "流程监听", businessType = BusinessType.UPDATE)
88
+    @PutMapping
89
+    public AjaxResult edit(@RequestBody SysListener sysListener)
90
+    {
91
+        return toAjax(sysListenerService.updateSysListener(sysListener));
92
+    }
93
+
94
+    /**
95
+     * 删除流程监听
96
+     */
97
+    @PreAuthorize("@ss.hasPermi('system:listener:remove')")
98
+    @Log(title = "流程监听", businessType = BusinessType.DELETE)
99
+	@DeleteMapping("/{ids}")
100
+    public AjaxResult remove(@PathVariable Long[] ids)
101
+    {
102
+        return toAjax(sysListenerService.deleteSysListenerByIds(ids));
103
+    }
104
+}

+ 25 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/dto/FlowCommentDto.java

@@ -0,0 +1,25 @@
1
+package com.ruoyi.flowable.domain.dto;
2
+
3
+import lombok.Builder;
4
+import lombok.Data;
5
+
6
+import java.io.Serializable;
7
+
8
+/**
9
+ * @author Tony
10
+ * @date 2021/3/28 15:50
11
+ */
12
+@Data
13
+@Builder
14
+public class FlowCommentDto implements Serializable {
15
+
16
+    /**
17
+     * 意见类别 0 正常意见  1 退回意见 2 驳回意见
18
+     */
19
+    private String type;
20
+
21
+    /**
22
+     * 意见内容
23
+     */
24
+    private String comment;
25
+}

+ 15 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/dto/FlowFromFieldDTO.java

@@ -0,0 +1,15 @@
1
+package com.ruoyi.flowable.domain.dto;
2
+
3
+import lombok.Data;
4
+
5
+import java.io.Serializable;
6
+
7
+/**
8
+ * @author Tony
9
+ * @date 2021/3/31 23:20
10
+ */
11
+@Data
12
+public class FlowFromFieldDTO implements Serializable {
13
+
14
+    private Object fields;
15
+}

+ 33 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/dto/FlowNextDto.java

@@ -0,0 +1,33 @@
1
+package com.ruoyi.flowable.domain.dto;
2
+
3
+import com.ruoyi.common.core.domain.entity.SysRole;
4
+import com.ruoyi.common.core.domain.entity.SysUser;
5
+import lombok.Data;
6
+
7
+import java.io.Serializable;
8
+import java.util.List;
9
+
10
+/**
11
+ * 动态人员、组
12
+ * @author Tony
13
+ * @date 2021/4/17 22:59
14
+ */
15
+@Data
16
+public class FlowNextDto implements Serializable {
17
+
18
+    /**
19
+     * 审批人类型
20
+     */
21
+    private String type;
22
+
23
+    /**
24
+     * 是否需要动态指定任务审批人
25
+     */
26
+    private String dataType;
27
+
28
+    /**
29
+     * 流程变量
30
+     */
31
+    private String vars;
32
+
33
+}

+ 28 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/dto/FlowSaveXmlVo.java

@@ -0,0 +1,28 @@
1
+package com.ruoyi.flowable.domain.dto;
2
+
3
+import lombok.Data;
4
+
5
+import java.io.Serializable;
6
+
7
+/**
8
+ * @author Tony
9
+ * @date 2021/3/28 19:48
10
+ */
11
+@Data
12
+public class FlowSaveXmlVo implements Serializable {
13
+
14
+    /**
15
+     * 流程名称
16
+     */
17
+    private String name;
18
+
19
+    /**
20
+     * 流程分类
21
+     */
22
+    private String category;
23
+
24
+    /**
25
+     * xml 文件
26
+     */
27
+    private String xml;
28
+}

+ 105 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/dto/FlowTaskDto.java

@@ -0,0 +1,105 @@
1
+package com.ruoyi.flowable.domain.dto;
2
+
3
+import com.fasterxml.jackson.annotation.JsonFormat;
4
+import com.ruoyi.common.core.domain.entity.SysUser;
5
+import io.swagger.annotations.ApiModel;
6
+import io.swagger.annotations.ApiModelProperty;
7
+import lombok.Getter;
8
+import lombok.Setter;
9
+
10
+import java.io.Serializable;
11
+import java.util.Date;
12
+import java.util.List;
13
+import java.util.Map;
14
+
15
+/**
16
+ * <p>工作流任务<p>
17
+ *
18
+ * @author Tony
19
+ * @date 2021-04-03
20
+ */
21
+@Getter
22
+@Setter
23
+@ApiModel("工作流任务相关-返回参数")
24
+public class FlowTaskDto implements Serializable {
25
+
26
+    @ApiModelProperty("任务编号")
27
+    private String taskId;
28
+
29
+    @ApiModelProperty("任务执行编号")
30
+    private String executionId;
31
+
32
+    @ApiModelProperty("任务名称")
33
+    private String taskName;
34
+
35
+    @ApiModelProperty("任务Key")
36
+    private String taskDefKey;
37
+
38
+    @ApiModelProperty("任务执行人Id")
39
+    private Long assigneeId;
40
+
41
+    @ApiModelProperty("部门名称")
42
+    private String deptName;
43
+
44
+    @ApiModelProperty("流程发起人部门名称")
45
+    private String startDeptName;
46
+
47
+    @ApiModelProperty("任务执行人名称")
48
+    private String assigneeName;
49
+    @ApiModelProperty("任务执行人部门")
50
+    private String assigneeDeptName;;
51
+
52
+    @ApiModelProperty("流程发起人Id")
53
+    private String startUserId;
54
+
55
+    @ApiModelProperty("流程发起人名称")
56
+    private String startUserName;
57
+
58
+    @ApiModelProperty("流程类型")
59
+    private String category;
60
+
61
+    @ApiModelProperty("流程变量信息")
62
+    private Object variables;
63
+
64
+    @ApiModelProperty("局部变量信息")
65
+    private Object taskLocalVars;
66
+
67
+    @ApiModelProperty("流程部署编号")
68
+    private String deployId;
69
+
70
+    @ApiModelProperty("流程ID")
71
+    private String procDefId;
72
+
73
+    @ApiModelProperty("流程key")
74
+    private String procDefKey;
75
+
76
+    @ApiModelProperty("流程定义名称")
77
+    private String procDefName;
78
+
79
+    @ApiModelProperty("流程定义内置使用版本")
80
+    private int procDefVersion;
81
+
82
+    @ApiModelProperty("流程实例ID")
83
+    private String procInsId;
84
+
85
+    @ApiModelProperty("历史流程实例ID")
86
+    private String hisProcInsId;
87
+
88
+    @ApiModelProperty("任务耗时")
89
+    private String duration;
90
+
91
+    @ApiModelProperty("任务意见")
92
+    private FlowCommentDto comment;
93
+
94
+    @ApiModelProperty("候选执行人")
95
+    private String candidate;
96
+
97
+    @ApiModelProperty("任务创建时间")
98
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
99
+    private Date createTime;
100
+
101
+    @ApiModelProperty("任务完成时间")
102
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
103
+    private Date finishTime;
104
+
105
+}

+ 23 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/dto/FlowViewerDto.java

@@ -0,0 +1,23 @@
1
+package com.ruoyi.flowable.domain.dto;
2
+
3
+import lombok.Data;
4
+
5
+import java.io.Serializable;
6
+
7
+/**
8
+ * @author Tony
9
+ * @date 2021/4/21 20:55
10
+ */
11
+@Data
12
+public class FlowViewerDto implements Serializable {
13
+
14
+    /**
15
+     * 流程key
16
+     */
17
+    private String key;
18
+
19
+    /**
20
+     * 是否完成(已经审批)
21
+     */
22
+    private boolean completed;
23
+}

+ 36 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/vo/FlowQueryVo.java

@@ -0,0 +1,36 @@
1
+package com.ruoyi.flowable.domain.vo;
2
+
3
+import io.swagger.annotations.ApiModel;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+
7
+import java.util.List;
8
+import java.util.Map;
9
+
10
+/**
11
+ * <p>流程任务<p>
12
+ *
13
+ * @author Tony
14
+ * @date 2021-04-03
15
+ */
16
+@Data
17
+@ApiModel("工作流任务相关--请求参数")
18
+public class FlowQueryVo {
19
+
20
+    @ApiModelProperty("流程名称")
21
+    private String name;
22
+
23
+    @ApiModelProperty("开始时间")
24
+    private String startTime;
25
+
26
+    @ApiModelProperty("结束时间")
27
+    private String endTime;
28
+
29
+    @ApiModelProperty("当前页码")
30
+    private Integer pageNum;
31
+
32
+    @ApiModelProperty("每页条数")
33
+    private Integer pageSize;
34
+
35
+
36
+}

+ 56 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/vo/FlowTaskVo.java

@@ -0,0 +1,56 @@
1
+package com.ruoyi.flowable.domain.vo;
2
+
3
+import io.swagger.annotations.ApiModel;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+
7
+import java.util.List;
8
+import java.util.Map;
9
+
10
+/**
11
+ * <p>流程任务<p>
12
+ *
13
+ * @author Tony
14
+ * @date 2021-04-03
15
+ */
16
+@Data
17
+@ApiModel("工作流任务相关--请求参数")
18
+public class FlowTaskVo {
19
+
20
+    @ApiModelProperty("任务Id")
21
+    private String taskId;
22
+
23
+    @ApiModelProperty("用户Id")
24
+    private String userId;
25
+
26
+    @ApiModelProperty("任务意见")
27
+    private String comment;
28
+
29
+    @ApiModelProperty("流程实例Id")
30
+    private String instanceId;
31
+
32
+    @ApiModelProperty("节点")
33
+    private String targetKey;
34
+
35
+    private String deploymentId;
36
+    @ApiModelProperty("流程环节定义ID")
37
+    private String defId;
38
+
39
+    @ApiModelProperty("子执行流ID")
40
+    private String currentChildExecutionId;
41
+
42
+    @ApiModelProperty("子执行流是否已执行")
43
+    private Boolean flag;
44
+
45
+    @ApiModelProperty("流程变量信息")
46
+    private Map<String, Object> variables;
47
+
48
+    @ApiModelProperty("审批人")
49
+    private String assignee;
50
+
51
+    @ApiModelProperty("候选人")
52
+    private List<String> candidateUsers;
53
+
54
+    @ApiModelProperty("审批组")
55
+    private List<String> candidateGroups;
56
+}

+ 26 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/vo/ReturnTaskNodeVo.java

@@ -0,0 +1,26 @@
1
+package com.ruoyi.flowable.domain.vo;
2
+
3
+import io.swagger.annotations.ApiModel;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+
7
+import java.util.List;
8
+import java.util.Map;
9
+
10
+/**
11
+ * <p>可退回节点<p>
12
+ *
13
+ * @author tony
14
+ * @date 2022-04-23 11:01:52
15
+ */
16
+@Data
17
+@ApiModel("可退回节点")
18
+public class ReturnTaskNodeVo {
19
+
20
+    @ApiModelProperty("任务Id")
21
+    private String id;
22
+
23
+    @ApiModelProperty("用户Id")
24
+    private String name;
25
+
26
+}

+ 41 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/factory/FlowServiceFactory.java

@@ -0,0 +1,41 @@
1
+package com.ruoyi.flowable.factory;
2
+
3
+import lombok.Getter;
4
+import org.flowable.engine.*;
5
+import org.springframework.beans.factory.annotation.Qualifier;
6
+import org.springframework.stereotype.Component;
7
+
8
+import javax.annotation.Resource;
9
+
10
+/**
11
+ * flowable 引擎注入封装
12
+ * @author Tony
13
+ * @date 2021-04-03
14
+ */
15
+@Component
16
+@Getter
17
+public class FlowServiceFactory {
18
+
19
+    @Resource
20
+    protected RepositoryService repositoryService;
21
+
22
+    @Resource
23
+    protected RuntimeService runtimeService;
24
+
25
+    @Resource
26
+    protected IdentityService identityService;
27
+
28
+    @Resource
29
+    protected TaskService taskService;
30
+
31
+    @Resource
32
+    protected HistoryService historyService;
33
+
34
+    @Resource
35
+    protected ManagementService managementService;
36
+
37
+    @Qualifier("processEngine")
38
+    @Resource
39
+    protected ProcessEngine processEngine;
40
+
41
+}

+ 370 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/flow/CustomProcessDiagramCanvas.java

@@ -0,0 +1,370 @@
1
+package com.ruoyi.flowable.flow;
2
+
3
+import org.flowable.bpmn.model.AssociationDirection;
4
+import org.flowable.bpmn.model.GraphicInfo;
5
+import org.flowable.image.impl.DefaultProcessDiagramCanvas;
6
+import org.flowable.image.util.ReflectUtil;
7
+
8
+import javax.imageio.ImageIO;
9
+import java.awt.*;
10
+import java.awt.font.FontRenderContext;
11
+import java.awt.font.LineBreakMeasurer;
12
+import java.awt.font.TextAttribute;
13
+import java.awt.font.TextLayout;
14
+import java.awt.geom.Ellipse2D;
15
+import java.awt.geom.Rectangle2D;
16
+import java.awt.geom.RoundRectangle2D;
17
+import java.awt.image.BufferedImage;
18
+import java.io.IOException;
19
+import java.text.AttributedCharacterIterator;
20
+import java.text.AttributedString;
21
+
22
+/**
23
+ * @author Tony
24
+ * @date 2021/4/4 23:58
25
+ */
26
+public class CustomProcessDiagramCanvas extends DefaultProcessDiagramCanvas {
27
+    //定义走过流程连线颜色为绿色
28
+    protected static Color HIGHLIGHT_SequenceFlow_COLOR = Color.GREEN;
29
+    //设置未走过流程的连接线颜色
30
+    protected static Color CONNECTION_COLOR = Color.BLACK;
31
+    //设置flows连接线字体颜色red
32
+    protected static Color LABEL_COLOR = new Color(0, 0, 0);
33
+    //高亮显示task框颜色
34
+    protected static Color HIGHLIGHT_COLOR = Color.GREEN;
35
+    protected static Color HIGHLIGHT_COLOR1 = Color.RED;
36
+
37
+    public CustomProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType, String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader) {
38
+        super(width, height, minX, minY, imageType, activityFontName, labelFontName, annotationFontName, customClassLoader);
39
+        this.initialize(imageType);
40
+    }
41
+
42
+    /**
43
+     * 重写绘制连线的方式,设置绘制颜色
44
+     * @param xPoints
45
+     * @param yPoints
46
+     * @param conditional
47
+     * @param isDefault
48
+     * @param connectionType
49
+     * @param associationDirection
50
+     * @param highLighted
51
+     * @param scaleFactor
52
+     */
53
+    @Override
54
+    public void drawConnection(int[] xPoints, int[] yPoints, boolean conditional, boolean isDefault, String connectionType, AssociationDirection associationDirection, boolean highLighted, double scaleFactor) {
55
+        Paint originalPaint = this.g.getPaint();
56
+        Stroke originalStroke = this.g.getStroke();
57
+        this.g.setPaint(CONNECTION_COLOR);
58
+        if (connectionType.equals("association")) {
59
+            this.g.setStroke(ASSOCIATION_STROKE);
60
+        } else if (highLighted) {
61
+            this.g.setPaint(HIGHLIGHT_SequenceFlow_COLOR);
62
+            this.g.setStroke(HIGHLIGHT_FLOW_STROKE);
63
+        }
64
+
65
+        for (int i = 1; i < xPoints.length; ++i) {
66
+            Integer sourceX = xPoints[i - 1];
67
+            Integer sourceY = yPoints[i - 1];
68
+            Integer targetX = xPoints[i];
69
+            Integer targetY = yPoints[i];
70
+            java.awt.geom.Line2D.Double line = new java.awt.geom.Line2D.Double((double) sourceX, (double) sourceY, (double) targetX, (double) targetY);
71
+            this.g.draw(line);
72
+        }
73
+
74
+        java.awt.geom.Line2D.Double line;
75
+        if (isDefault) {
76
+            line = new java.awt.geom.Line2D.Double((double) xPoints[0], (double) yPoints[0], (double) xPoints[1], (double) yPoints[1]);
77
+            this.drawDefaultSequenceFlowIndicator(line, scaleFactor);
78
+        }
79
+
80
+        if (conditional) {
81
+            line = new java.awt.geom.Line2D.Double((double) xPoints[0], (double) yPoints[0], (double) xPoints[1], (double) yPoints[1]);
82
+            this.drawConditionalSequenceFlowIndicator(line, scaleFactor);
83
+        }
84
+
85
+        if (associationDirection.equals(AssociationDirection.ONE) || associationDirection.equals(AssociationDirection.BOTH)) {
86
+            line = new java.awt.geom.Line2D.Double((double) xPoints[xPoints.length - 2], (double) yPoints[xPoints.length - 2], (double) xPoints[xPoints.length - 1], (double) yPoints[xPoints.length - 1]);
87
+            this.drawArrowHead(line, scaleFactor);
88
+        }
89
+
90
+        if (associationDirection.equals(AssociationDirection.BOTH)) {
91
+            line = new java.awt.geom.Line2D.Double((double) xPoints[1], (double) yPoints[1], (double) xPoints[0], (double) yPoints[0]);
92
+            this.drawArrowHead(line, scaleFactor);
93
+        }
94
+
95
+        this.g.setPaint(originalPaint);
96
+        this.g.setStroke(originalStroke);
97
+    }
98
+
99
+    /**
100
+     * 设置字体大小图标颜色
101
+     * @param imageType
102
+     */
103
+    @Override
104
+    public void initialize(String imageType) {
105
+        if ("png".equalsIgnoreCase(imageType)) {
106
+            this.processDiagram = new BufferedImage(this.canvasWidth, this.canvasHeight, 2);
107
+        } else {
108
+            this.processDiagram = new BufferedImage(this.canvasWidth, this.canvasHeight, 1);
109
+        }
110
+
111
+        this.g = this.processDiagram.createGraphics();
112
+        if (!"png".equalsIgnoreCase(imageType)) {
113
+            this.g.setBackground(new Color(255, 255, 255, 0));
114
+            this.g.clearRect(0, 0, this.canvasWidth, this.canvasHeight);
115
+        }
116
+
117
+        this.g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
118
+        //修改图标颜色,修改图标字体大小
119
+        this.g.setPaint(Color.black);
120
+        Font font = new Font(this.activityFontName, 10, 14);
121
+        this.g.setFont(font);
122
+        this.fontMetrics = this.g.getFontMetrics();
123
+        //修改连接线字体大小
124
+        LABEL_FONT = new Font(this.labelFontName, 10, 15);
125
+        ANNOTATION_FONT = new Font(this.annotationFontName, 0, 11);
126
+
127
+        try {
128
+            USERTASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/userTask.png", this.customClassLoader));
129
+            SCRIPTTASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/scriptTask.png", this.customClassLoader));
130
+            SERVICETASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/serviceTask.png", this.customClassLoader));
131
+            RECEIVETASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/receiveTask.png", this.customClassLoader));
132
+            SENDTASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/sendTask.png", this.customClassLoader));
133
+            MANUALTASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/manualTask.png", this.customClassLoader));
134
+            BUSINESS_RULE_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/businessRuleTask.png", this.customClassLoader));
135
+            SHELL_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/shellTask.png", this.customClassLoader));
136
+            DMN_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/dmnTask.png", this.customClassLoader));
137
+            CAMEL_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/camelTask.png", this.customClassLoader));
138
+            MULE_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/muleTask.png", this.customClassLoader));
139
+            HTTP_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/httpTask.png", this.customClassLoader));
140
+            TIMER_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/timer.png", this.customClassLoader));
141
+            COMPENSATE_THROW_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/compensate-throw.png", this.customClassLoader));
142
+            COMPENSATE_CATCH_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/compensate.png", this.customClassLoader));
143
+            ERROR_THROW_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/error-throw.png", this.customClassLoader));
144
+            ERROR_CATCH_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/error.png", this.customClassLoader));
145
+            MESSAGE_THROW_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/message-throw.png", this.customClassLoader));
146
+            MESSAGE_CATCH_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/message.png", this.customClassLoader));
147
+            SIGNAL_THROW_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/signal-throw.png", this.customClassLoader));
148
+            SIGNAL_CATCH_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/signal.png", this.customClassLoader));
149
+        } catch (IOException var4) {
150
+            LOGGER.warn("Could not load image for process diagram creation: {}", var4.getMessage());
151
+        }
152
+
153
+    }
154
+
155
+    /**
156
+     * 设置连接线字体
157
+     * @param text
158
+     * @param graphicInfo
159
+     * @param centered
160
+     */
161
+    @Override
162
+    public void drawLabel(String text, GraphicInfo graphicInfo, boolean centered) {
163
+        float interline = 1.0f;
164
+
165
+        // text
166
+        if (text != null && text.length() > 0) {
167
+            Paint originalPaint = g.getPaint();
168
+            Font originalFont = g.getFont();
169
+
170
+            g.setPaint(LABEL_COLOR);
171
+            g.setFont(LABEL_FONT);
172
+
173
+            int wrapWidth = 100;
174
+            int textY = (int) graphicInfo.getY();
175
+
176
+            // TODO: use drawMultilineText()
177
+            AttributedString as = new AttributedString(text);
178
+            as.addAttribute(TextAttribute.FOREGROUND, g.getPaint());
179
+            as.addAttribute(TextAttribute.FONT, g.getFont());
180
+            AttributedCharacterIterator aci = as.getIterator();
181
+            FontRenderContext frc = new FontRenderContext(null, true, false);
182
+            LineBreakMeasurer lbm = new LineBreakMeasurer(aci, frc);
183
+
184
+            while (lbm.getPosition() < text.length()) {
185
+                TextLayout tl = lbm.nextLayout(wrapWidth);
186
+                textY += tl.getAscent();
187
+
188
+                Rectangle2D bb = tl.getBounds();
189
+                double tX = graphicInfo.getX();
190
+
191
+                if (centered) {
192
+                    tX += (int) (graphicInfo.getWidth() / 2 - bb.getWidth() / 2);
193
+                }
194
+                tl.draw(g, (float) tX, textY);
195
+                textY += tl.getDescent() + tl.getLeading() + (interline - 1.0f) * tl.getAscent();
196
+            }
197
+
198
+            // restore originals
199
+            g.setFont(originalFont);
200
+            g.setPaint(originalPaint);
201
+        }
202
+    }
203
+
204
+    /**
205
+     * 高亮显示task框完成的
206
+     * @param x
207
+     * @param y
208
+     * @param width
209
+     * @param height
210
+     */
211
+    @Override
212
+    public void drawHighLight(int x, int y, int width, int height) {
213
+        Paint originalPaint = g.getPaint();
214
+        Stroke originalStroke = g.getStroke();
215
+
216
+        g.setPaint(HIGHLIGHT_COLOR);
217
+        g.setStroke(THICK_TASK_BORDER_STROKE);
218
+
219
+        RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, 20, 20);
220
+        g.draw(rect);
221
+
222
+        g.setPaint(originalPaint);
223
+        g.setStroke(originalStroke);
224
+    }
225
+
226
+    /**
227
+     * 自定义task框当前的位置
228
+     * @param x
229
+     * @param y
230
+     * @param width
231
+     * @param height
232
+     */
233
+    public void drawHighLightNow(int x, int y, int width, int height) {
234
+        Paint originalPaint = g.getPaint();
235
+        Stroke originalStroke = g.getStroke();
236
+
237
+        g.setPaint(HIGHLIGHT_COLOR1);
238
+        g.setStroke(THICK_TASK_BORDER_STROKE);
239
+
240
+        RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, 20, 20);
241
+        g.draw(rect);
242
+
243
+        g.setPaint(originalPaint);
244
+        g.setStroke(originalStroke);
245
+    }
246
+
247
+    /**
248
+     * 自定义结束节点
249
+     * @param x
250
+     * @param y
251
+     * @param width
252
+     * @param height
253
+     */
254
+    public void drawHighLightEnd(int x, int y, int width, int height) {
255
+        Paint originalPaint = g.getPaint();
256
+        Stroke originalStroke = g.getStroke();
257
+
258
+        g.setPaint(HIGHLIGHT_COLOR);
259
+        g.setStroke(THICK_TASK_BORDER_STROKE);
260
+
261
+        RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, 20, 20);
262
+        g.draw(rect);
263
+
264
+        g.setPaint(originalPaint);
265
+        g.setStroke(originalStroke);
266
+    }
267
+
268
+    /**
269
+     * task框自定义文字
270
+     * @param name
271
+     * @param graphicInfo
272
+     * @param thickBorder
273
+     * @param scaleFactor
274
+     */
275
+    @Override
276
+    protected void drawTask(String name, GraphicInfo graphicInfo, boolean thickBorder, double scaleFactor) {
277
+
278
+        Paint originalPaint = g.getPaint();
279
+        int x = (int) graphicInfo.getX();
280
+        int y = (int) graphicInfo.getY();
281
+        int width = (int) graphicInfo.getWidth();
282
+        int height = (int) graphicInfo.getHeight();
283
+
284
+        // Create a new gradient paint for every task box, gradient depends on x and y and is not relative
285
+        g.setPaint(TASK_BOX_COLOR);
286
+
287
+        int arcR = 6;
288
+        if (thickBorder) {
289
+            arcR = 3;
290
+        }
291
+
292
+        // shape
293
+        RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, arcR, arcR);
294
+        g.fill(rect);
295
+        g.setPaint(TASK_BORDER_COLOR);
296
+
297
+        if (thickBorder) {
298
+            Stroke originalStroke = g.getStroke();
299
+            g.setStroke(THICK_TASK_BORDER_STROKE);
300
+            g.draw(rect);
301
+            g.setStroke(originalStroke);
302
+        } else {
303
+            g.draw(rect);
304
+        }
305
+
306
+        g.setPaint(originalPaint);
307
+        // text
308
+        if (scaleFactor == 1.0 && name != null && name.length() > 0) {
309
+            int boxWidth = width - (2 * TEXT_PADDING);
310
+            int boxHeight = height - 16 - ICON_PADDING - ICON_PADDING - MARKER_WIDTH - 2 - 2;
311
+            int boxX = x + width / 2 - boxWidth / 2;
312
+            int boxY = y + height / 2 - boxHeight / 2 + ICON_PADDING + ICON_PADDING - 2 - 2;
313
+
314
+            drawMultilineCentredText(name, boxX, boxY, boxWidth, boxHeight);
315
+        }
316
+    }
317
+
318
+    protected static Color EVENT_COLOR = new Color(255, 255, 255);
319
+
320
+    /**
321
+     * 重写开始事件
322
+     * @param graphicInfo
323
+     * @param image
324
+     * @param scaleFactor
325
+     */
326
+    @Override
327
+    public void drawStartEvent(GraphicInfo graphicInfo, BufferedImage image, double scaleFactor) {
328
+        Paint originalPaint = g.getPaint();
329
+        g.setPaint(EVENT_COLOR);
330
+        Ellipse2D circle = new Ellipse2D.Double(graphicInfo.getX(), graphicInfo.getY(),
331
+                graphicInfo.getWidth(), graphicInfo.getHeight());
332
+        g.fill(circle);
333
+        g.setPaint(EVENT_BORDER_COLOR);
334
+        g.draw(circle);
335
+        g.setPaint(originalPaint);
336
+        if (image != null) {
337
+            // calculate coordinates to center image
338
+            int imageX = (int) Math.round(graphicInfo.getX() + (graphicInfo.getWidth() / 2) - (image.getWidth() / (2 * scaleFactor)));
339
+            int imageY = (int) Math.round(graphicInfo.getY() + (graphicInfo.getHeight() / 2) - (image.getHeight() / (2 * scaleFactor)));
340
+            g.drawImage(image, imageX, imageY,
341
+                    (int) (image.getWidth() / scaleFactor), (int) (image.getHeight() / scaleFactor), null);
342
+        }
343
+
344
+    }
345
+
346
+    /**
347
+     * 重写结束事件
348
+     * @param graphicInfo
349
+     * @param scaleFactor
350
+     */
351
+    @Override
352
+    public void drawNoneEndEvent(GraphicInfo graphicInfo, double scaleFactor) {
353
+        Paint originalPaint = g.getPaint();
354
+        Stroke originalStroke = g.getStroke();
355
+        g.setPaint(EVENT_COLOR);
356
+        Ellipse2D circle = new Ellipse2D.Double(graphicInfo.getX(), graphicInfo.getY(),
357
+                graphicInfo.getWidth(), graphicInfo.getHeight());
358
+        g.fill(circle);
359
+        g.setPaint(EVENT_BORDER_COLOR);
360
+//        g.setPaint(HIGHLIGHT_COLOR);
361
+        if (scaleFactor == 1.0) {
362
+            g.setStroke(END_EVENT_STROKE);
363
+        } else {
364
+            g.setStroke(new BasicStroke(2.0f));
365
+        }
366
+        g.draw(circle);
367
+        g.setStroke(originalStroke);
368
+        g.setPaint(originalPaint);
369
+    }
370
+}

+ 404 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/flow/CustomProcessDiagramGenerator.java

@@ -0,0 +1,404 @@
1
+package com.ruoyi.flowable.flow;
2
+
3
+
4
+import org.flowable.bpmn.model.Process;
5
+import org.flowable.bpmn.model.*;
6
+import org.flowable.image.impl.DefaultProcessDiagramCanvas;
7
+import org.flowable.image.impl.DefaultProcessDiagramGenerator;
8
+
9
+import java.util.Iterator;
10
+import java.util.List;
11
+
12
+/**
13
+ * @author Tony
14
+ * @date 2021/4/5 0:31
15
+ */
16
+public class CustomProcessDiagramGenerator extends DefaultProcessDiagramGenerator {
17
+    @Override
18
+    protected DefaultProcessDiagramCanvas generateProcessDiagram(BpmnModel bpmnModel, String imageType, List<String> highLightedActivities, List<String> highLightedFlows, String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader, double scaleFactor, boolean drawSequenceFlowNameWithNoLabelDI) {
19
+        this.prepareBpmnModel(bpmnModel);
20
+        DefaultProcessDiagramCanvas processDiagramCanvas = initProcessDiagramCanvas(bpmnModel, imageType, activityFontName, labelFontName, annotationFontName, customClassLoader);
21
+        Iterator var13 = bpmnModel.getPools().iterator();
22
+
23
+        while (var13.hasNext()) {
24
+            Pool process = (Pool) var13.next();
25
+            GraphicInfo subProcesses = bpmnModel.getGraphicInfo(process.getId());
26
+            processDiagramCanvas.drawPoolOrLane(process.getName(), subProcesses, scaleFactor);
27
+        }
28
+
29
+        var13 = bpmnModel.getProcesses().iterator();
30
+
31
+        Process process1;
32
+        Iterator subProcesses1;
33
+        while (var13.hasNext()) {
34
+            process1 = (Process) var13.next();
35
+            subProcesses1 = process1.getLanes().iterator();
36
+
37
+            while (subProcesses1.hasNext()) {
38
+                Lane artifact = (Lane) subProcesses1.next();
39
+                GraphicInfo subProcess = bpmnModel.getGraphicInfo(artifact.getId());
40
+                processDiagramCanvas.drawPoolOrLane(artifact.getName(), subProcess, scaleFactor);
41
+            }
42
+        }
43
+
44
+        var13 = bpmnModel.getProcesses().iterator();
45
+
46
+        while (var13.hasNext()) {
47
+            process1 = (Process) var13.next();
48
+            subProcesses1 = process1.findFlowElementsOfType(FlowNode.class).iterator();
49
+
50
+            while (subProcesses1.hasNext()) {
51
+                FlowNode artifact1 = (FlowNode) subProcesses1.next();
52
+                if (!this.isPartOfCollapsedSubProcess(artifact1, bpmnModel)) {
53
+                    this.drawActivity(processDiagramCanvas, bpmnModel, artifact1, highLightedActivities, highLightedFlows, scaleFactor, Boolean.valueOf(drawSequenceFlowNameWithNoLabelDI));
54
+                }
55
+            }
56
+        }
57
+
58
+        var13 = bpmnModel.getProcesses().iterator();
59
+
60
+        label75:
61
+        while (true) {
62
+            List subProcesses2;
63
+            do {
64
+                if (!var13.hasNext()) {
65
+                    return processDiagramCanvas;
66
+                }
67
+
68
+                process1 = (Process) var13.next();
69
+                subProcesses1 = process1.getArtifacts().iterator();
70
+
71
+                while (subProcesses1.hasNext()) {
72
+                    Artifact artifact2 = (Artifact) subProcesses1.next();
73
+                    this.drawArtifact(processDiagramCanvas, bpmnModel, artifact2);
74
+                }
75
+
76
+                subProcesses2 = process1.findFlowElementsOfType(SubProcess.class, true);
77
+            } while (subProcesses2 == null);
78
+
79
+            Iterator artifact3 = subProcesses2.iterator();
80
+
81
+            while (true) {
82
+                GraphicInfo graphicInfo;
83
+                SubProcess subProcess1;
84
+                do {
85
+                    do {
86
+                        if (!artifact3.hasNext()) {
87
+                            continue label75;
88
+                        }
89
+
90
+                        subProcess1 = (SubProcess) artifact3.next();
91
+                        graphicInfo = bpmnModel.getGraphicInfo(subProcess1.getId());
92
+                    } while (graphicInfo != null && graphicInfo.getExpanded() != null && !graphicInfo.getExpanded().booleanValue());
93
+                } while (this.isPartOfCollapsedSubProcess(subProcess1, bpmnModel));
94
+
95
+                Iterator var19 = subProcess1.getArtifacts().iterator();
96
+
97
+                while (var19.hasNext()) {
98
+                    Artifact subProcessArtifact = (Artifact) var19.next();
99
+                    this.drawArtifact(processDiagramCanvas, bpmnModel, subProcessArtifact);
100
+                }
101
+            }
102
+        }
103
+    }
104
+
105
+    protected static DefaultProcessDiagramCanvas initProcessDiagramCanvas(BpmnModel bpmnModel, String imageType, String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader) {
106
+        double minX = 1.7976931348623157E308D;
107
+        double maxX = 0.0D;
108
+        double minY = 1.7976931348623157E308D;
109
+        double maxY = 0.0D;
110
+
111
+        GraphicInfo nrOfLanes;
112
+        for (Iterator flowNodes = bpmnModel.getPools().iterator(); flowNodes.hasNext(); maxY = nrOfLanes.getY() + nrOfLanes.getHeight()) {
113
+            Pool artifacts = (Pool) flowNodes.next();
114
+            nrOfLanes = bpmnModel.getGraphicInfo(artifacts.getId());
115
+            minX = nrOfLanes.getX();
116
+            maxX = nrOfLanes.getX() + nrOfLanes.getWidth();
117
+            minY = nrOfLanes.getY();
118
+        }
119
+
120
+        List var23 = gatherAllFlowNodes(bpmnModel);
121
+        Iterator var24 = var23.iterator();
122
+
123
+        label155:
124
+        while (var24.hasNext()) {
125
+            FlowNode var26 = (FlowNode) var24.next();
126
+            GraphicInfo artifact = bpmnModel.getGraphicInfo(var26.getId());
127
+            if (artifact.getX() + artifact.getWidth() > maxX) {
128
+                maxX = artifact.getX() + artifact.getWidth();
129
+            }
130
+
131
+            if (artifact.getX() < minX) {
132
+                minX = artifact.getX();
133
+            }
134
+
135
+            if (artifact.getY() + artifact.getHeight() > maxY) {
136
+                maxY = artifact.getY() + artifact.getHeight();
137
+            }
138
+
139
+            if (artifact.getY() < minY) {
140
+                minY = artifact.getY();
141
+            }
142
+
143
+            Iterator process = var26.getOutgoingFlows().iterator();
144
+
145
+            while (true) {
146
+                List l;
147
+                do {
148
+                    if (!process.hasNext()) {
149
+                        continue label155;
150
+                    }
151
+
152
+                    SequenceFlow graphicInfoList = (SequenceFlow) process.next();
153
+                    l = bpmnModel.getFlowLocationGraphicInfo(graphicInfoList.getId());
154
+                } while (l == null);
155
+
156
+                Iterator graphicInfo = l.iterator();
157
+
158
+                while (graphicInfo.hasNext()) {
159
+                    GraphicInfo graphicInfo1 = (GraphicInfo) graphicInfo.next();
160
+                    if (graphicInfo1.getX() > maxX) {
161
+                        maxX = graphicInfo1.getX();
162
+                    }
163
+
164
+                    if (graphicInfo1.getX() < minX) {
165
+                        minX = graphicInfo1.getX();
166
+                    }
167
+
168
+                    if (graphicInfo1.getY() > maxY) {
169
+                        maxY = graphicInfo1.getY();
170
+                    }
171
+
172
+                    if (graphicInfo1.getY() < minY) {
173
+                        minY = graphicInfo1.getY();
174
+                    }
175
+                }
176
+            }
177
+        }
178
+
179
+        List var25 = gatherAllArtifacts(bpmnModel);
180
+        Iterator var27 = var25.iterator();
181
+
182
+        GraphicInfo var37;
183
+        while (var27.hasNext()) {
184
+            Artifact var29 = (Artifact) var27.next();
185
+            GraphicInfo var31 = bpmnModel.getGraphicInfo(var29.getId());
186
+            if (var31 != null) {
187
+                if (var31.getX() + var31.getWidth() > maxX) {
188
+                    maxX = var31.getX() + var31.getWidth();
189
+                }
190
+
191
+                if (var31.getX() < minX) {
192
+                    minX = var31.getX();
193
+                }
194
+
195
+                if (var31.getY() + var31.getHeight() > maxY) {
196
+                    maxY = var31.getY() + var31.getHeight();
197
+                }
198
+
199
+                if (var31.getY() < minY) {
200
+                    minY = var31.getY();
201
+                }
202
+            }
203
+
204
+            List var33 = bpmnModel.getFlowLocationGraphicInfo(var29.getId());
205
+            if (var33 != null) {
206
+                Iterator var35 = var33.iterator();
207
+
208
+                while (var35.hasNext()) {
209
+                    var37 = (GraphicInfo) var35.next();
210
+                    if (var37.getX() > maxX) {
211
+                        maxX = var37.getX();
212
+                    }
213
+
214
+                    if (var37.getX() < minX) {
215
+                        minX = var37.getX();
216
+                    }
217
+
218
+                    if (var37.getY() > maxY) {
219
+                        maxY = var37.getY();
220
+                    }
221
+
222
+                    if (var37.getY() < minY) {
223
+                        minY = var37.getY();
224
+                    }
225
+                }
226
+            }
227
+        }
228
+
229
+        int var28 = 0;
230
+        Iterator var30 = bpmnModel.getProcesses().iterator();
231
+
232
+        while (var30.hasNext()) {
233
+            Process var32 = (Process) var30.next();
234
+            Iterator var34 = var32.getLanes().iterator();
235
+
236
+            while (var34.hasNext()) {
237
+                Lane var36 = (Lane) var34.next();
238
+                ++var28;
239
+                var37 = bpmnModel.getGraphicInfo(var36.getId());
240
+                if (var37.getX() + var37.getWidth() > maxX) {
241
+                    maxX = var37.getX() + var37.getWidth();
242
+                }
243
+
244
+                if (var37.getX() < minX) {
245
+                    minX = var37.getX();
246
+                }
247
+
248
+                if (var37.getY() + var37.getHeight() > maxY) {
249
+                    maxY = var37.getY() + var37.getHeight();
250
+                }
251
+
252
+                if (var37.getY() < minY) {
253
+                    minY = var37.getY();
254
+                }
255
+            }
256
+        }
257
+
258
+        if (var23.isEmpty() && bpmnModel.getPools().isEmpty() && var28 == 0) {
259
+            minX = 0.0D;
260
+            minY = 0.0D;
261
+        }
262
+
263
+        return new CustomProcessDiagramCanvas((int) maxX + 10, (int) maxY + 10, (int) minX, (int) minY, imageType, activityFontName, labelFontName, annotationFontName, customClassLoader);
264
+    }
265
+
266
+
267
+    private static void drawHighLight(DefaultProcessDiagramCanvas processDiagramCanvas, GraphicInfo graphicInfo) {
268
+        processDiagramCanvas.drawHighLight((int) graphicInfo.getX(), (int) graphicInfo.getY(), (int) graphicInfo.getWidth(), (int) graphicInfo.getHeight());
269
+
270
+    }
271
+
272
+    private static void drawHighLightNow(CustomProcessDiagramCanvas processDiagramCanvas, GraphicInfo graphicInfo) {
273
+        processDiagramCanvas.drawHighLightNow((int) graphicInfo.getX(), (int) graphicInfo.getY(), (int) graphicInfo.getWidth(), (int) graphicInfo.getHeight());
274
+
275
+    }
276
+
277
+    private static void drawHighLightEnd(CustomProcessDiagramCanvas processDiagramCanvas, GraphicInfo graphicInfo) {
278
+        processDiagramCanvas.drawHighLightEnd((int) graphicInfo.getX(), (int) graphicInfo.getY(), (int) graphicInfo.getWidth(), (int) graphicInfo.getHeight());
279
+
280
+    }
281
+
282
+    @Override
283
+    protected void drawActivity(DefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel,
284
+                                FlowNode flowNode, java.util.List<String> highLightedActivities, java.util.List<String> highLightedFlows, double scaleFactor, Boolean drawSequenceFlowNameWithNoLabelDI) {
285
+
286
+        DefaultProcessDiagramGenerator.ActivityDrawInstruction drawInstruction = activityDrawInstructions.get(flowNode.getClass());
287
+        if (drawInstruction != null) {
288
+
289
+            drawInstruction.draw(processDiagramCanvas, bpmnModel, flowNode);
290
+
291
+            // Gather info on the multi instance marker
292
+            boolean multiInstanceSequential = false;
293
+            boolean multiInstanceParallel = false;
294
+            boolean collapsed = false;
295
+            if (flowNode instanceof Activity) {
296
+                Activity activity = (Activity) flowNode;
297
+                MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics = activity.getLoopCharacteristics();
298
+                if (multiInstanceLoopCharacteristics != null) {
299
+                    multiInstanceSequential = multiInstanceLoopCharacteristics.isSequential();
300
+                    multiInstanceParallel = !multiInstanceSequential;
301
+                }
302
+            }
303
+
304
+            // Gather info on the collapsed marker
305
+            GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId());
306
+            if (flowNode instanceof SubProcess) {
307
+                collapsed = graphicInfo.getExpanded() != null && !graphicInfo.getExpanded();
308
+            } else if (flowNode instanceof CallActivity) {
309
+                collapsed = true;
310
+            }
311
+
312
+            if (scaleFactor == 1.0) {
313
+                // Actually draw the markers
314
+                processDiagramCanvas.drawActivityMarkers((int) graphicInfo.getX(), (int) graphicInfo.getY(), (int) graphicInfo.getWidth(), (int) graphicInfo.getHeight(),
315
+                        multiInstanceSequential, multiInstanceParallel, collapsed);
316
+            }
317
+
318
+            // Draw highlighted activities
319
+            if (highLightedActivities.contains(flowNode.getId())) {
320
+
321
+                if (highLightedActivities.get(highLightedActivities.size() - 1).equals(flowNode.getId())
322
+                        && !"endenv".equals(flowNode.getId())) {
323
+                    if ((flowNode.getId().contains("Event_"))) {
324
+                        drawHighLightEnd((CustomProcessDiagramCanvas) processDiagramCanvas, bpmnModel.getGraphicInfo(flowNode.getId()));
325
+                    } else {
326
+                        drawHighLightNow((CustomProcessDiagramCanvas) processDiagramCanvas, bpmnModel.getGraphicInfo(flowNode.getId()));
327
+                    }
328
+                } else {
329
+                    drawHighLight(processDiagramCanvas, bpmnModel.getGraphicInfo(flowNode.getId()));
330
+                }
331
+
332
+
333
+            }
334
+
335
+        }
336
+
337
+        // Outgoing transitions of activity
338
+        for (SequenceFlow sequenceFlow : flowNode.getOutgoingFlows()) {
339
+            boolean highLighted = (highLightedFlows.contains(sequenceFlow.getId()));
340
+            String defaultFlow = null;
341
+            if (flowNode instanceof Activity) {
342
+                defaultFlow = ((Activity) flowNode).getDefaultFlow();
343
+            } else if (flowNode instanceof Gateway) {
344
+                defaultFlow = ((Gateway) flowNode).getDefaultFlow();
345
+            }
346
+
347
+            boolean isDefault = false;
348
+            if (defaultFlow != null && defaultFlow.equalsIgnoreCase(sequenceFlow.getId())) {
349
+                isDefault = true;
350
+            }
351
+            boolean drawConditionalIndicator = sequenceFlow.getConditionExpression() != null && !(flowNode instanceof Gateway);
352
+
353
+            String sourceRef = sequenceFlow.getSourceRef();
354
+            String targetRef = sequenceFlow.getTargetRef();
355
+            FlowElement sourceElement = bpmnModel.getFlowElement(sourceRef);
356
+            FlowElement targetElement = bpmnModel.getFlowElement(targetRef);
357
+            java.util.List<GraphicInfo> graphicInfoList = bpmnModel.getFlowLocationGraphicInfo(sequenceFlow.getId());
358
+            if (graphicInfoList != null && graphicInfoList.size() > 0) {
359
+                graphicInfoList = connectionPerfectionizer(processDiagramCanvas, bpmnModel, sourceElement, targetElement, graphicInfoList);
360
+                int xPoints[] = new int[graphicInfoList.size()];
361
+                int yPoints[] = new int[graphicInfoList.size()];
362
+
363
+                for (int i = 1; i < graphicInfoList.size(); i++) {
364
+                    GraphicInfo graphicInfo = graphicInfoList.get(i);
365
+                    GraphicInfo previousGraphicInfo = graphicInfoList.get(i - 1);
366
+
367
+                    if (i == 1) {
368
+                        xPoints[0] = (int) previousGraphicInfo.getX();
369
+                        yPoints[0] = (int) previousGraphicInfo.getY();
370
+                    }
371
+                    xPoints[i] = (int) graphicInfo.getX();
372
+                    yPoints[i] = (int) graphicInfo.getY();
373
+
374
+                }
375
+
376
+                processDiagramCanvas.drawSequenceflow(xPoints, yPoints, drawConditionalIndicator, isDefault, highLighted, scaleFactor);
377
+
378
+
379
+                // Draw sequenceflow label
380
+                GraphicInfo labelGraphicInfo = bpmnModel.getLabelGraphicInfo(sequenceFlow.getId());
381
+                if (labelGraphicInfo != null) {
382
+                    processDiagramCanvas.drawLabel(sequenceFlow.getName(), labelGraphicInfo, false);
383
+                } else {
384
+                    if (drawSequenceFlowNameWithNoLabelDI) {
385
+                        GraphicInfo lineCenter = getLineCenter(graphicInfoList);
386
+                        processDiagramCanvas.drawLabel(sequenceFlow.getName(), lineCenter, false);
387
+                    }
388
+
389
+                }
390
+            }
391
+        }
392
+
393
+        // Nested elements
394
+        if (flowNode instanceof FlowElementsContainer) {
395
+            for (FlowElement nestedFlowElement : ((FlowElementsContainer) flowNode).getFlowElements()) {
396
+                if (nestedFlowElement instanceof FlowNode && !isPartOfCollapsedSubProcess(nestedFlowElement, bpmnModel)) {
397
+                    drawActivity(processDiagramCanvas, bpmnModel, (FlowNode) nestedFlowElement,
398
+                            highLightedActivities, highLightedFlows, scaleFactor, drawSequenceFlowNameWithNoLabelDI);
399
+                }
400
+            }
401
+        }
402
+    }
403
+}
404
+

+ 266 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/flow/FindNextNodeUtil.java

@@ -0,0 +1,266 @@
1
+package com.ruoyi.flowable.flow;
2
+
3
+import com.googlecode.aviator.AviatorEvaluator;
4
+import com.googlecode.aviator.Expression;
5
+//import com.greenpineyu.fel.FelEngine;
6
+//import com.greenpineyu.fel.FelEngineImpl;
7
+//import com.greenpineyu.fel.context.FelContext;
8
+//import org.apache.commons.jexl2.JexlContext;
9
+//import org.apache.commons.jexl2.JexlEngine;
10
+//import org.apache.commons.jexl2.MapContext;
11
+//import org.apache.commons.lang3.StringUtils;
12
+import org.flowable.bpmn.model.Process;
13
+import org.flowable.bpmn.model.*;
14
+import org.flowable.engine.RepositoryService;
15
+import org.flowable.engine.repository.ProcessDefinition;
16
+
17
+import java.util.*;
18
+
19
+/**
20
+ * @author Tony
21
+ * @date 2021/4/19 20:51
22
+ */
23
+public class FindNextNodeUtil {
24
+
25
+    /**
26
+     * 获取下一步骤的用户任务
27
+     *
28
+     * @param repositoryService
29
+     * @param map
30
+     * @return
31
+     */
32
+    public static List<UserTask> getNextUserTasks(RepositoryService repositoryService, org.flowable.task.api.Task task, Map<String, Object> map) {
33
+        List<UserTask> data = new ArrayList<>();
34
+        ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(task.getProcessDefinitionId()).singleResult();
35
+        BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId());
36
+        Process mainProcess = bpmnModel.getMainProcess();
37
+        Collection<FlowElement> flowElements = mainProcess.getFlowElements();
38
+        String key = task.getTaskDefinitionKey();
39
+        FlowElement flowElement = bpmnModel.getFlowElement(key);
40
+        next(flowElements, flowElement, map, data);
41
+        return data;
42
+    }
43
+
44
+    /**
45
+     * 启动流程时获取下一步骤的用户任务
46
+     *
47
+     * @param repositoryService
48
+     * @param map
49
+     * @return
50
+     */
51
+    public static List<UserTask> getNextUserTasksByStart(RepositoryService repositoryService, ProcessDefinition processDefinition, Map<String, Object> map) {
52
+        List<UserTask> data = new ArrayList<>();
53
+        BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId());
54
+        Process mainProcess = bpmnModel.getMainProcess();
55
+        Collection<FlowElement> flowElements = mainProcess.getFlowElements();
56
+        String key = null;
57
+        // 找到开始节点 并获取唯一key
58
+        for (FlowElement flowElement : flowElements) {
59
+            if (flowElement instanceof StartEvent) {
60
+                key = flowElement.getId();
61
+                break;
62
+            }
63
+        }
64
+        FlowElement flowElement = bpmnModel.getFlowElement(key);
65
+        List<SequenceFlow> sequenceFlows = ((StartEvent)flowElement).getOutgoingFlows();
66
+        // 获取出口连线, 此时从开始节点往后,只能是一个出口
67
+        if (!sequenceFlows.isEmpty()) {
68
+            SequenceFlow sequenceFlow = sequenceFlows.get(0);
69
+            FlowElement targetFlowElement = sequenceFlow.getTargetFlowElement();
70
+            next(flowElements, targetFlowElement, map, data);
71
+        }
72
+        return data;
73
+    }
74
+
75
+
76
+    /**
77
+     * 查找下一节点
78
+     *
79
+     * @param flowElements
80
+     * @param flowElement
81
+     * @param map
82
+     * @param nextUser
83
+     */
84
+    public static void next(Collection<FlowElement> flowElements, FlowElement flowElement, Map<String, Object> map, List<UserTask> nextUser) {
85
+        //如果是结束节点
86
+        if (flowElement instanceof EndEvent) {
87
+            //如果是子任务的结束节点
88
+            if (getSubProcess(flowElements, flowElement) != null) {
89
+                flowElement = getSubProcess(flowElements, flowElement);
90
+            }
91
+        }
92
+        //获取Task的出线信息--可以拥有多个
93
+        List<SequenceFlow> outGoingFlows = null;
94
+        if (flowElement instanceof Task) {
95
+            outGoingFlows = ((Task) flowElement).getOutgoingFlows();
96
+        } else if (flowElement instanceof Gateway) {
97
+            outGoingFlows = ((Gateway) flowElement).getOutgoingFlows();
98
+        } else if (flowElement instanceof StartEvent) {
99
+            outGoingFlows = ((StartEvent) flowElement).getOutgoingFlows();
100
+        } else if (flowElement instanceof SubProcess) {
101
+            outGoingFlows = ((SubProcess) flowElement).getOutgoingFlows();
102
+        } else if (flowElement instanceof CallActivity) {
103
+            outGoingFlows = ((CallActivity) flowElement).getOutgoingFlows();
104
+        }
105
+        if (outGoingFlows != null && outGoingFlows.size() > 0) {
106
+            //遍历所有的出线--找到可以正确执行的那一条
107
+            for (SequenceFlow sequenceFlow : outGoingFlows) {
108
+                //1.有表达式,且为true
109
+                //2.无表达式
110
+                String expression = sequenceFlow.getConditionExpression();
111
+                if (expression == null ||
112
+                        expressionResult(map, expression.substring(expression.lastIndexOf("{") + 1, expression.lastIndexOf("}")))) {
113
+                    //出线的下一节点
114
+                    String nextFlowElementID = sequenceFlow.getTargetRef();
115
+                    if (checkSubProcess(nextFlowElementID, flowElements, nextUser)) {
116
+                        continue;
117
+                    }
118
+
119
+                    //查询下一节点的信息
120
+                    FlowElement nextFlowElement = getFlowElementById(nextFlowElementID, flowElements);
121
+                    //调用流程
122
+                    if (nextFlowElement instanceof CallActivity) {
123
+                        CallActivity ca = (CallActivity) nextFlowElement;
124
+                        if (ca.getLoopCharacteristics() != null) {
125
+                            UserTask userTask = new UserTask();
126
+                            userTask.setId(ca.getId());
127
+
128
+                            userTask.setId(ca.getId());
129
+                            userTask.setLoopCharacteristics(ca.getLoopCharacteristics());
130
+                            userTask.setName(ca.getName());
131
+                            nextUser.add(userTask);
132
+                        }
133
+                        next(flowElements, nextFlowElement, map, nextUser);
134
+                    }
135
+                    //用户任务
136
+                    if (nextFlowElement instanceof UserTask) {
137
+                        nextUser.add((UserTask) nextFlowElement);
138
+                    }
139
+                    //排他网关
140
+                    else if (nextFlowElement instanceof ExclusiveGateway) {
141
+                        next(flowElements, nextFlowElement, map, nextUser);
142
+                    }
143
+                    //并行网关
144
+                    else if (nextFlowElement instanceof ParallelGateway) {
145
+                        next(flowElements, nextFlowElement, map, nextUser);
146
+                    }
147
+                    //接收任务
148
+                    else if (nextFlowElement instanceof ReceiveTask) {
149
+                        next(flowElements, nextFlowElement, map, nextUser);
150
+                    }
151
+                    //服务任务
152
+                    else if (nextFlowElement instanceof ServiceTask) {
153
+                        next(flowElements, nextFlowElement, map, nextUser);
154
+                    }
155
+                    //子任务的起点
156
+                    else if (nextFlowElement instanceof StartEvent) {
157
+                        next(flowElements, nextFlowElement, map, nextUser);
158
+                    }
159
+                    //结束节点
160
+                    else if (nextFlowElement instanceof EndEvent) {
161
+                        next(flowElements, nextFlowElement, map, nextUser);
162
+                    }
163
+                }
164
+            }
165
+        }
166
+    }
167
+
168
+    /**
169
+     * 判断是否是多实例子流程并且需要设置集合类型变量
170
+     */
171
+    public static boolean checkSubProcess(String id, Collection<FlowElement> flowElements, List<UserTask> nextUser) {
172
+        for (FlowElement flowElement1 : flowElements) {
173
+            if (flowElement1 instanceof SubProcess && flowElement1.getId().equals(id)) {
174
+
175
+                SubProcess sp = (SubProcess) flowElement1;
176
+                if (sp.getLoopCharacteristics() != null) {
177
+//                    String inputDataItem = sp.getLoopCharacteristics().getInputDataItem();
178
+                    UserTask userTask = new UserTask();
179
+                    userTask.setId(sp.getId());
180
+                    userTask.setLoopCharacteristics(sp.getLoopCharacteristics());
181
+                    userTask.setName(sp.getName());
182
+                    nextUser.add(userTask);
183
+                    return true;
184
+                }
185
+            }
186
+        }
187
+
188
+        return false;
189
+
190
+    }
191
+
192
+    /**
193
+     * 查询一个节点的是否子任务中的节点,如果是,返回子任务
194
+     *
195
+     * @param flowElements 全流程的节点集合
196
+     * @param flowElement  当前节点
197
+     * @return
198
+     */
199
+    public static FlowElement getSubProcess(Collection<FlowElement> flowElements, FlowElement flowElement) {
200
+        for (FlowElement flowElement1 : flowElements) {
201
+            if (flowElement1 instanceof SubProcess) {
202
+                for (FlowElement flowElement2 : ((SubProcess) flowElement1).getFlowElements()) {
203
+                    if (flowElement.equals(flowElement2)) {
204
+                        return flowElement1;
205
+                    }
206
+                }
207
+            }
208
+        }
209
+        return null;
210
+    }
211
+
212
+
213
+    /**
214
+     * 根据ID查询流程节点对象, 如果是子任务,则返回子任务的开始节点
215
+     *
216
+     * @param Id           节点ID
217
+     * @param flowElements 流程节点集合
218
+     * @return
219
+     */
220
+    public static FlowElement getFlowElementById(String Id, Collection<FlowElement> flowElements) {
221
+        for (FlowElement flowElement : flowElements) {
222
+            if (flowElement.getId().equals(Id)) {
223
+                //如果是子任务,则查询出子任务的开始节点
224
+                if (flowElement instanceof SubProcess) {
225
+                    return getStartFlowElement(((SubProcess) flowElement).getFlowElements());
226
+                }
227
+                return flowElement;
228
+            }
229
+            if (flowElement instanceof SubProcess) {
230
+                FlowElement flowElement1 = getFlowElementById(Id, ((SubProcess) flowElement).getFlowElements());
231
+                if (flowElement1 != null) {
232
+                    return flowElement1;
233
+                }
234
+            }
235
+        }
236
+        return null;
237
+    }
238
+
239
+    /**
240
+     * 返回流程的开始节点
241
+     *
242
+     * @param flowElements 节点集合
243
+     * @description:
244
+     */
245
+    public static FlowElement getStartFlowElement(Collection<FlowElement> flowElements) {
246
+        for (FlowElement flowElement : flowElements) {
247
+            if (flowElement instanceof StartEvent) {
248
+                return flowElement;
249
+            }
250
+        }
251
+        return null;
252
+    }
253
+
254
+    /**
255
+     * 校验el表达式
256
+     *
257
+     * @param map
258
+     * @param expression
259
+     * @return
260
+     */
261
+    public static boolean expressionResult(Map<String, Object> map, String expression) {
262
+        Expression exp = AviatorEvaluator.compile(expression);
263
+        return (Boolean) exp.execute(map);
264
+//        return true;
265
+    }
266
+}

+ 702 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/flow/FlowableUtils.java

@@ -0,0 +1,702 @@
1
+package com.ruoyi.flowable.flow;
2
+
3
+import lombok.extern.slf4j.Slf4j;
4
+import org.flowable.bpmn.model.*;
5
+import org.flowable.engine.RepositoryService;
6
+import org.flowable.engine.impl.bpmn.behavior.ParallelMultiInstanceBehavior;
7
+import org.flowable.engine.impl.bpmn.behavior.SequentialMultiInstanceBehavior;
8
+import org.flowable.engine.repository.ProcessDefinition;
9
+import org.flowable.task.api.history.HistoricTaskInstance;
10
+
11
+import java.util.*;
12
+import java.util.stream.Collectors;
13
+
14
+/**
15
+ * @author Tony
16
+ * @date 2021-04-03 23:57
17
+ */
18
+@Slf4j
19
+public class FlowableUtils {
20
+
21
+    /**
22
+     * 根据节点,获取入口连线
23
+     *
24
+     * @param source
25
+     * @return
26
+     */
27
+    public static List<SequenceFlow> getElementIncomingFlows(FlowElement source) {
28
+        List<SequenceFlow> sequenceFlows = null;
29
+        if (source instanceof FlowNode) {
30
+            sequenceFlows = ((FlowNode) source).getIncomingFlows();
31
+        } else if (source instanceof Gateway) {
32
+            sequenceFlows = ((Gateway) source).getIncomingFlows();
33
+        } else if (source instanceof SubProcess) {
34
+            sequenceFlows = ((SubProcess) source).getIncomingFlows();
35
+        } else if (source instanceof StartEvent) {
36
+            sequenceFlows = ((StartEvent) source).getIncomingFlows();
37
+        } else if (source instanceof EndEvent) {
38
+            sequenceFlows = ((EndEvent) source).getIncomingFlows();
39
+        }
40
+        return sequenceFlows;
41
+    }
42
+
43
+    /**
44
+     * 根据节点,获取出口连线
45
+     *
46
+     * @param source
47
+     * @return
48
+     */
49
+    public static List<SequenceFlow> getElementOutgoingFlows(FlowElement source) {
50
+        List<SequenceFlow> sequenceFlows = null;
51
+        if (source instanceof FlowNode) {
52
+            sequenceFlows = ((FlowNode) source).getOutgoingFlows();
53
+        } else if (source instanceof Gateway) {
54
+            sequenceFlows = ((Gateway) source).getOutgoingFlows();
55
+        } else if (source instanceof SubProcess) {
56
+            sequenceFlows = ((SubProcess) source).getOutgoingFlows();
57
+        } else if (source instanceof StartEvent) {
58
+            sequenceFlows = ((StartEvent) source).getOutgoingFlows();
59
+        } else if (source instanceof EndEvent) {
60
+            sequenceFlows = ((EndEvent) source).getOutgoingFlows();
61
+        }
62
+        return sequenceFlows;
63
+    }
64
+
65
+    /**
66
+     * 获取全部节点列表,包含子流程节点
67
+     *
68
+     * @param flowElements
69
+     * @param allElements
70
+     * @return
71
+     */
72
+    public static Collection<FlowElement> getAllElements(Collection<FlowElement> flowElements, Collection<FlowElement> allElements) {
73
+        allElements = allElements == null ? new ArrayList<>() : allElements;
74
+
75
+        for (FlowElement flowElement : flowElements) {
76
+            allElements.add(flowElement);
77
+            if (flowElement instanceof SubProcess) {
78
+                // 继续深入子流程,进一步获取子流程
79
+                allElements = FlowableUtils.getAllElements(((SubProcess) flowElement).getFlowElements(), allElements);
80
+            }
81
+        }
82
+        return allElements;
83
+    }
84
+
85
+    /**
86
+     * 迭代获取父级任务节点列表,向前找
87
+     *
88
+     * @param source          起始节点
89
+     * @param hasSequenceFlow 已经经过的连线的 ID,用于判断线路是否重复
90
+     * @param userTaskList    已找到的用户任务节点
91
+     * @return
92
+     */
93
+    public static List<UserTask> iteratorFindParentUserTasks(FlowElement source, Set<String> hasSequenceFlow, List<UserTask> userTaskList) {
94
+        userTaskList = userTaskList == null ? new ArrayList<>() : userTaskList;
95
+        hasSequenceFlow = hasSequenceFlow == null ? new HashSet<>() : hasSequenceFlow;
96
+
97
+        // 如果该节点为开始节点,且存在上级子节点,则顺着上级子节点继续迭代
98
+        if (source instanceof StartEvent && source.getSubProcess() != null) {
99
+            userTaskList = iteratorFindParentUserTasks(source.getSubProcess(), hasSequenceFlow, userTaskList);
100
+        }
101
+
102
+        // 根据类型,获取入口连线
103
+        List<SequenceFlow> sequenceFlows = getElementIncomingFlows(source);
104
+
105
+        if (sequenceFlows != null) {
106
+            // 循环找到目标元素
107
+            for (SequenceFlow sequenceFlow : sequenceFlows) {
108
+                // 如果发现连线重复,说明循环了,跳过这个循环
109
+                if (hasSequenceFlow.contains(sequenceFlow.getId())) {
110
+                    continue;
111
+                }
112
+                // 添加已经走过的连线
113
+                hasSequenceFlow.add(sequenceFlow.getId());
114
+                // 类型为用户节点,则新增父级节点
115
+                if (sequenceFlow.getSourceFlowElement() instanceof UserTask) {
116
+                    userTaskList.add((UserTask) sequenceFlow.getSourceFlowElement());
117
+                    continue;
118
+                }
119
+                // 类型为子流程,则添加子流程开始节点出口处相连的节点
120
+                if (sequenceFlow.getSourceFlowElement() instanceof SubProcess) {
121
+                    // 获取子流程用户任务节点
122
+                    List<UserTask> childUserTaskList = findChildProcessUserTasks((StartEvent) ((SubProcess) sequenceFlow.getSourceFlowElement()).getFlowElements().toArray()[0], null, null);
123
+                    // 如果找到节点,则说明该线路找到节点,不继续向下找,反之继续
124
+                    if (childUserTaskList != null && childUserTaskList.size() > 0) {
125
+                        userTaskList.addAll(childUserTaskList);
126
+                        continue;
127
+                    }
128
+                }
129
+                // 继续迭代
130
+                userTaskList = iteratorFindParentUserTasks(sequenceFlow.getSourceFlowElement(), hasSequenceFlow, userTaskList);
131
+            }
132
+        }
133
+        return userTaskList;
134
+    }
135
+
136
+    /**
137
+     * 根据正在运行的任务节点,迭代获取子级任务节点列表,向后找
138
+     *
139
+     * @param source          起始节点(退回节点)
140
+     * @param runTaskKeyList  正在运行的任务 Key,用于校验任务节点是否是正在运行的节点
141
+     * @param hasSequenceFlow 已经经过的连线的 ID,用于判断线路是否重复
142
+     * @param userTaskList    需要撤回的用户任务列表
143
+     * @return
144
+     */
145
+    public static List<UserTask> iteratorFindChildUserTasks(FlowElement source, List<String> runTaskKeyList, Set<String> hasSequenceFlow, List<UserTask> userTaskList) {
146
+        hasSequenceFlow = hasSequenceFlow == null ? new HashSet<>() : hasSequenceFlow;
147
+        userTaskList = userTaskList == null ? new ArrayList<>() : userTaskList;
148
+
149
+        // 如果该节点为开始节点,且存在上级子节点,则顺着上级子节点继续迭代
150
+        if (source instanceof EndEvent && source.getSubProcess() != null) {
151
+            userTaskList = iteratorFindChildUserTasks(source.getSubProcess(), runTaskKeyList, hasSequenceFlow, userTaskList);
152
+        }
153
+
154
+        // 根据类型,获取出口连线
155
+        List<SequenceFlow> sequenceFlows = getElementOutgoingFlows(source);
156
+
157
+        if (sequenceFlows != null) {
158
+            // 循环找到目标元素
159
+            for (SequenceFlow sequenceFlow : sequenceFlows) {
160
+                // 如果发现连线重复,说明循环了,跳过这个循环
161
+                if (hasSequenceFlow.contains(sequenceFlow.getId())) {
162
+                    continue;
163
+                }
164
+                // 添加已经走过的连线
165
+                hasSequenceFlow.add(sequenceFlow.getId());
166
+                // 如果为用户任务类型,且任务节点的 Key 正在运行的任务中存在,添加
167
+                if (sequenceFlow.getTargetFlowElement() instanceof UserTask && runTaskKeyList.contains((sequenceFlow.getTargetFlowElement()).getId())) {
168
+                    userTaskList.add((UserTask) sequenceFlow.getTargetFlowElement());
169
+                    continue;
170
+                }
171
+                // 如果节点为子流程节点情况,则从节点中的第一个节点开始获取
172
+                if (sequenceFlow.getTargetFlowElement() instanceof SubProcess) {
173
+                    List<UserTask> childUserTaskList = iteratorFindChildUserTasks((FlowElement) (((SubProcess) sequenceFlow.getTargetFlowElement()).getFlowElements().toArray()[0]), runTaskKeyList, hasSequenceFlow, null);
174
+                    // 如果找到节点,则说明该线路找到节点,不继续向下找,反之继续
175
+                    if (childUserTaskList != null && childUserTaskList.size() > 0) {
176
+                        userTaskList.addAll(childUserTaskList);
177
+                        continue;
178
+                    }
179
+                }
180
+                // 继续迭代
181
+                userTaskList = iteratorFindChildUserTasks(sequenceFlow.getTargetFlowElement(), runTaskKeyList, hasSequenceFlow, userTaskList);
182
+            }
183
+        }
184
+        return userTaskList;
185
+    }
186
+
187
+    /**
188
+     * 迭代获取子流程用户任务节点
189
+     *
190
+     * @param source          起始节点
191
+     * @param hasSequenceFlow 已经经过的连线的 ID,用于判断线路是否重复
192
+     * @param userTaskList    需要撤回的用户任务列表
193
+     * @return
194
+     */
195
+    public static List<UserTask> findChildProcessUserTasks(FlowElement source, Set<String> hasSequenceFlow, List<UserTask> userTaskList) {
196
+        hasSequenceFlow = hasSequenceFlow == null ? new HashSet<>() : hasSequenceFlow;
197
+        userTaskList = userTaskList == null ? new ArrayList<>() : userTaskList;
198
+
199
+        // 根据类型,获取出口连线
200
+        List<SequenceFlow> sequenceFlows = getElementOutgoingFlows(source);
201
+
202
+        if (sequenceFlows != null) {
203
+            // 循环找到目标元素
204
+            for (SequenceFlow sequenceFlow : sequenceFlows) {
205
+                // 如果发现连线重复,说明循环了,跳过这个循环
206
+                if (hasSequenceFlow.contains(sequenceFlow.getId())) {
207
+                    continue;
208
+                }
209
+                // 添加已经走过的连线
210
+                hasSequenceFlow.add(sequenceFlow.getId());
211
+                // 如果为用户任务类型,且任务节点的 Key 正在运行的任务中存在,添加
212
+                if (sequenceFlow.getTargetFlowElement() instanceof UserTask) {
213
+                    userTaskList.add((UserTask) sequenceFlow.getTargetFlowElement());
214
+                    continue;
215
+                }
216
+                // 如果节点为子流程节点情况,则从节点中的第一个节点开始获取
217
+                if (sequenceFlow.getTargetFlowElement() instanceof SubProcess) {
218
+                    List<UserTask> childUserTaskList = findChildProcessUserTasks((FlowElement) (((SubProcess) sequenceFlow.getTargetFlowElement()).getFlowElements().toArray()[0]), hasSequenceFlow, null);
219
+                    // 如果找到节点,则说明该线路找到节点,不继续向下找,反之继续
220
+                    if (childUserTaskList != null && childUserTaskList.size() > 0) {
221
+                        userTaskList.addAll(childUserTaskList);
222
+                        continue;
223
+                    }
224
+                }
225
+                // 继续迭代
226
+                userTaskList = findChildProcessUserTasks(sequenceFlow.getTargetFlowElement(), hasSequenceFlow, userTaskList);
227
+            }
228
+        }
229
+        return userTaskList;
230
+    }
231
+
232
+    /**
233
+     * 从后向前寻路,获取所有脏线路上的点
234
+     *
235
+     * @param source          起始节点
236
+     * @param passRoads       已经经过的点集合
237
+     * @param hasSequenceFlow 已经经过的连线的 ID,用于判断线路是否重复
238
+     * @param targets         目标脏线路终点
239
+     * @param dirtyRoads      确定为脏数据的点,因为不需要重复,因此使用 set 存储
240
+     * @return
241
+     */
242
+    public static Set<String> iteratorFindDirtyRoads(FlowElement source, List<String> passRoads, Set<String> hasSequenceFlow, List<String> targets, Set<String> dirtyRoads) {
243
+        passRoads = passRoads == null ? new ArrayList<>() : passRoads;
244
+        dirtyRoads = dirtyRoads == null ? new HashSet<>() : dirtyRoads;
245
+        hasSequenceFlow = hasSequenceFlow == null ? new HashSet<>() : hasSequenceFlow;
246
+
247
+        // 如果该节点为开始节点,且存在上级子节点,则顺着上级子节点继续迭代
248
+        if (source instanceof StartEvent && source.getSubProcess() != null) {
249
+            dirtyRoads = iteratorFindDirtyRoads(source.getSubProcess(), passRoads, hasSequenceFlow, targets, dirtyRoads);
250
+        }
251
+
252
+        // 根据类型,获取入口连线
253
+        List<SequenceFlow> sequenceFlows = getElementIncomingFlows(source);
254
+
255
+        if (sequenceFlows != null) {
256
+            // 循环找到目标元素
257
+            for (SequenceFlow sequenceFlow : sequenceFlows) {
258
+                // 如果发现连线重复,说明循环了,跳过这个循环
259
+                if (hasSequenceFlow.contains(sequenceFlow.getId())) {
260
+                    continue;
261
+                }
262
+                // 添加已经走过的连线
263
+                hasSequenceFlow.add(sequenceFlow.getId());
264
+                // 新增经过的路线
265
+                passRoads.add(sequenceFlow.getSourceFlowElement().getId());
266
+                // 如果此点为目标点,确定经过的路线为脏线路,添加点到脏线路中,然后找下个连线
267
+                if (targets.contains(sequenceFlow.getSourceFlowElement().getId())) {
268
+                    dirtyRoads.addAll(passRoads);
269
+                    continue;
270
+                }
271
+                // 如果该节点为开始节点,且存在上级子节点,则顺着上级子节点继续迭代
272
+                if (sequenceFlow.getSourceFlowElement() instanceof SubProcess) {
273
+                    dirtyRoads = findChildProcessAllDirtyRoad((StartEvent) ((SubProcess) sequenceFlow.getSourceFlowElement()).getFlowElements().toArray()[0], null, dirtyRoads);
274
+                    // 是否存在子流程上,true 是,false 否
275
+                    Boolean isInChildProcess = dirtyTargetInChildProcess((StartEvent) ((SubProcess) sequenceFlow.getSourceFlowElement()).getFlowElements().toArray()[0], null, targets, null);
276
+                    if (isInChildProcess) {
277
+                        // 已在子流程上找到,该路线结束
278
+                        continue;
279
+                    }
280
+                }
281
+                // 继续迭代
282
+                dirtyRoads = iteratorFindDirtyRoads(sequenceFlow.getSourceFlowElement(), passRoads, hasSequenceFlow, targets, dirtyRoads);
283
+            }
284
+        }
285
+        return dirtyRoads;
286
+    }
287
+
288
+    /**
289
+     * 迭代获取子流程脏路线
290
+     * 说明,假如回退的点就是子流程,那么也肯定会回退到子流程最初的用户任务节点,因此子流程中的节点全是脏路线
291
+     *
292
+     * @param source          起始节点
293
+     * @param hasSequenceFlow 已经经过的连线的 ID,用于判断线路是否重复
294
+     * @param dirtyRoads      确定为脏数据的点,因为不需要重复,因此使用 set 存储
295
+     * @return
296
+     */
297
+    public static Set<String> findChildProcessAllDirtyRoad(FlowElement source, Set<String> hasSequenceFlow, Set<String> dirtyRoads) {
298
+        hasSequenceFlow = hasSequenceFlow == null ? new HashSet<>() : hasSequenceFlow;
299
+        dirtyRoads = dirtyRoads == null ? new HashSet<>() : dirtyRoads;
300
+
301
+        // 根据类型,获取出口连线
302
+        List<SequenceFlow> sequenceFlows = getElementOutgoingFlows(source);
303
+
304
+        if (sequenceFlows != null) {
305
+            // 循环找到目标元素
306
+            for (SequenceFlow sequenceFlow : sequenceFlows) {
307
+                // 如果发现连线重复,说明循环了,跳过这个循环
308
+                if (hasSequenceFlow.contains(sequenceFlow.getId())) {
309
+                    continue;
310
+                }
311
+                // 添加已经走过的连线
312
+                hasSequenceFlow.add(sequenceFlow.getId());
313
+                // 添加脏路线
314
+                dirtyRoads.add(sequenceFlow.getTargetFlowElement().getId());
315
+                // 如果节点为子流程节点情况,则从节点中的第一个节点开始获取
316
+                if (sequenceFlow.getTargetFlowElement() instanceof SubProcess) {
317
+                    dirtyRoads = findChildProcessAllDirtyRoad((FlowElement) (((SubProcess) sequenceFlow.getTargetFlowElement()).getFlowElements().toArray()[0]), hasSequenceFlow, dirtyRoads);
318
+                }
319
+                // 继续迭代
320
+                dirtyRoads = findChildProcessAllDirtyRoad(sequenceFlow.getTargetFlowElement(), hasSequenceFlow, dirtyRoads);
321
+            }
322
+        }
323
+        return dirtyRoads;
324
+    }
325
+
326
+    /**
327
+     * 判断脏路线结束节点是否在子流程上
328
+     *
329
+     * @param source          起始节点
330
+     * @param hasSequenceFlow 已经经过的连线的 ID,用于判断线路是否重复
331
+     * @param targets         判断脏路线节点是否存在子流程上,只要存在一个,说明脏路线只到子流程为止
332
+     * @param inChildProcess  是否存在子流程上,true 是,false 否
333
+     * @return
334
+     */
335
+    public static Boolean dirtyTargetInChildProcess(FlowElement source, Set<String> hasSequenceFlow, List<String> targets, Boolean inChildProcess) {
336
+        hasSequenceFlow = hasSequenceFlow == null ? new HashSet<>() : hasSequenceFlow;
337
+        inChildProcess = inChildProcess != null && inChildProcess;
338
+
339
+        // 根据类型,获取出口连线
340
+        List<SequenceFlow> sequenceFlows = getElementOutgoingFlows(source);
341
+
342
+        if (sequenceFlows != null && !inChildProcess) {
343
+            // 循环找到目标元素
344
+            for (SequenceFlow sequenceFlow : sequenceFlows) {
345
+                // 如果发现连线重复,说明循环了,跳过这个循环
346
+                if (hasSequenceFlow.contains(sequenceFlow.getId())) {
347
+                    continue;
348
+                }
349
+                // 添加已经走过的连线
350
+                hasSequenceFlow.add(sequenceFlow.getId());
351
+                // 如果发现目标点在子流程上存在,说明只到子流程为止
352
+                if (targets.contains(sequenceFlow.getTargetFlowElement().getId())) {
353
+                    inChildProcess = true;
354
+                    break;
355
+                }
356
+                // 如果节点为子流程节点情况,则从节点中的第一个节点开始获取
357
+                if (sequenceFlow.getTargetFlowElement() instanceof SubProcess) {
358
+                    inChildProcess = dirtyTargetInChildProcess((FlowElement) (((SubProcess) sequenceFlow.getTargetFlowElement()).getFlowElements().toArray()[0]), hasSequenceFlow, targets, inChildProcess);
359
+                }
360
+                // 继续迭代
361
+                inChildProcess = dirtyTargetInChildProcess(sequenceFlow.getTargetFlowElement(), hasSequenceFlow, targets, inChildProcess);
362
+            }
363
+        }
364
+        return inChildProcess;
365
+    }
366
+
367
+    /**
368
+     * 迭代从后向前扫描,判断目标节点相对于当前节点是否是串行
369
+     * 不存在直接回退到子流程中的情况,但存在从子流程出去到父流程情况
370
+     *
371
+     * @param source          起始节点
372
+     * @param isSequential    是否串行
373
+     * @param hasSequenceFlow 已经经过的连线的 ID,用于判断线路是否重复
374
+     * @param targetKsy       目标节点
375
+     * @return
376
+     */
377
+    public static Boolean iteratorCheckSequentialReferTarget(FlowElement source, String targetKsy, Set<String> hasSequenceFlow, Boolean isSequential) {
378
+        isSequential = isSequential == null || isSequential;
379
+        hasSequenceFlow = hasSequenceFlow == null ? new HashSet<>() : hasSequenceFlow;
380
+
381
+        // 如果该节点为开始节点,且存在上级子节点,则顺着上级子节点继续迭代
382
+        if (source instanceof StartEvent && source.getSubProcess() != null) {
383
+            isSequential = iteratorCheckSequentialReferTarget(source.getSubProcess(), targetKsy, hasSequenceFlow, isSequential);
384
+        }
385
+
386
+        // 根据类型,获取入口连线
387
+        List<SequenceFlow> sequenceFlows = getElementIncomingFlows(source);
388
+
389
+        if (sequenceFlows != null) {
390
+            // 循环找到目标元素
391
+            for (SequenceFlow sequenceFlow : sequenceFlows) {
392
+                // 如果发现连线重复,说明循环了,跳过这个循环
393
+                if (hasSequenceFlow.contains(sequenceFlow.getId())) {
394
+                    continue;
395
+                }
396
+                // 添加已经走过的连线
397
+                hasSequenceFlow.add(sequenceFlow.getId());
398
+                // 如果目标节点已被判断为并行,后面都不需要执行,直接返回
399
+                if (!isSequential) {
400
+                    break;
401
+                }
402
+                // 这条线路存在目标节点,这条线路完成,进入下个线路
403
+                if (targetKsy.equals(sequenceFlow.getSourceFlowElement().getId())) {
404
+                    continue;
405
+                }
406
+                if (sequenceFlow.getSourceFlowElement() instanceof StartEvent) {
407
+                    isSequential = false;
408
+                    break;
409
+                }
410
+                // 否则就继续迭代
411
+                isSequential = iteratorCheckSequentialReferTarget(sequenceFlow.getSourceFlowElement(), targetKsy, hasSequenceFlow, isSequential);
412
+            }
413
+        }
414
+        return isSequential;
415
+    }
416
+
417
+    /**
418
+     * 从后向前寻路,获取到达节点的所有路线
419
+     * 不存在直接回退到子流程,但是存在回退到父级流程的情况
420
+     *
421
+     * @param source    起始节点
422
+     * @param passRoads 已经经过的点集合
423
+     * @param roads     路线
424
+     * @return
425
+     */
426
+    public static List<List<UserTask>> findRoad(FlowElement source, List<UserTask> passRoads, Set<String> hasSequenceFlow, List<List<UserTask>> roads) {
427
+        passRoads = passRoads == null ? new ArrayList<>() : passRoads;
428
+        roads = roads == null ? new ArrayList<>() : roads;
429
+        hasSequenceFlow = hasSequenceFlow == null ? new HashSet<>() : hasSequenceFlow;
430
+
431
+        // 如果该节点为开始节点,且存在上级子节点,则顺着上级子节点继续迭代
432
+        if (source instanceof StartEvent && source.getSubProcess() != null) {
433
+            roads = findRoad(source.getSubProcess(), passRoads, hasSequenceFlow, roads);
434
+        }
435
+
436
+        // 根据类型,获取入口连线
437
+        List<SequenceFlow> sequenceFlows = getElementIncomingFlows(source);
438
+
439
+        if (sequenceFlows != null && sequenceFlows.size() != 0) {
440
+            for (SequenceFlow sequenceFlow : sequenceFlows) {
441
+                // 如果发现连线重复,说明循环了,跳过这个循环
442
+                if (hasSequenceFlow.contains(sequenceFlow.getId())) {
443
+                    continue;
444
+                }
445
+                // 添加已经走过的连线
446
+                hasSequenceFlow.add(sequenceFlow.getId());
447
+                // 添加经过路线
448
+                if (sequenceFlow.getSourceFlowElement() instanceof UserTask) {
449
+                    passRoads.add((UserTask) sequenceFlow.getSourceFlowElement());
450
+                }
451
+                // 继续迭代
452
+                roads = findRoad(sequenceFlow.getSourceFlowElement(), passRoads, hasSequenceFlow, roads);
453
+            }
454
+        } else {
455
+            // 添加路线
456
+            roads.add(passRoads);
457
+        }
458
+        return roads;
459
+    }
460
+
461
+    /**
462
+     * 历史节点数据清洗,清洗掉又回滚导致的脏数据
463
+     *
464
+     * @param allElements              全部节点信息
465
+     * @param historicTaskInstanceList 历史任务实例信息,数据采用开始时间升序
466
+     * @return
467
+     */
468
+    public static List<String> historicTaskInstanceClean(Collection<FlowElement> allElements, List<HistoricTaskInstance> historicTaskInstanceList) {
469
+        // 会签节点收集
470
+        List<String> multiTask = new ArrayList<>();
471
+        allElements.forEach(flowElement -> {
472
+            if (flowElement instanceof UserTask) {
473
+                // 如果该节点的行为为会签行为,说明该节点为会签节点
474
+                if (((UserTask) flowElement).getBehavior() instanceof ParallelMultiInstanceBehavior || ((UserTask) flowElement).getBehavior() instanceof SequentialMultiInstanceBehavior) {
475
+                    multiTask.add(flowElement.getId());
476
+                }
477
+            }
478
+        });
479
+        // 循环放入栈,栈 LIFO:后进先出
480
+        Stack<HistoricTaskInstance> stack = new Stack<>();
481
+        historicTaskInstanceList.forEach(stack::push);
482
+        // 清洗后的历史任务实例
483
+        List<String> lastHistoricTaskInstanceList = new ArrayList<>();
484
+        // 网关存在可能只走了部分分支情况,且还存在跳转废弃数据以及其他分支数据的干扰,因此需要对历史节点数据进行清洗
485
+        // 临时用户任务 key
486
+        StringBuilder userTaskKey = null;
487
+        // 临时被删掉的任务 key,存在并行情况
488
+        List<String> deleteKeyList = new ArrayList<>();
489
+        // 临时脏数据线路
490
+        List<Set<String>> dirtyDataLineList = new ArrayList<>();
491
+        // 由某个点跳到会签点,此时出现多个会签实例对应 1 个跳转情况,需要把这些连续脏数据都找到
492
+        // 会签特殊处理下标
493
+        int multiIndex = -1;
494
+        // 会签特殊处理 key
495
+        StringBuilder multiKey = null;
496
+        // 会签特殊处理操作标识
497
+        boolean multiOpera = false;
498
+        while (!stack.empty()) {
499
+            // 从这里开始 userTaskKey 都还是上个栈的 key
500
+            // 是否是脏数据线路上的点
501
+            final boolean[] isDirtyData = {false};
502
+            for (Set<String> oldDirtyDataLine : dirtyDataLineList) {
503
+                if (oldDirtyDataLine.contains(stack.peek().getTaskDefinitionKey())) {
504
+                    isDirtyData[0] = true;
505
+                }
506
+            }
507
+            // 删除原因不为空,说明从这条数据开始回跳或者回退的
508
+            // MI_END:会签完成后,其他未签到节点的删除原因,不在处理范围内
509
+            if (stack.peek().getDeleteReason() != null && !"MI_END".equals(stack.peek().getDeleteReason())) {
510
+                // 可以理解为脏线路起点
511
+                String dirtyPoint = "";
512
+                if (stack.peek().getDeleteReason().contains("Change activity to ")) {
513
+                    dirtyPoint = stack.peek().getDeleteReason().replace("Change activity to ", "");
514
+                }
515
+                // 会签回退删除原因有点不同
516
+                if (stack.peek().getDeleteReason().contains("Change parent activity to ")) {
517
+                    dirtyPoint = stack.peek().getDeleteReason().replace("Change parent activity to ", "");
518
+                }
519
+                FlowElement dirtyTask = null;
520
+                // 获取变更节点的对应的入口处连线
521
+                // 如果是网关并行回退情况,会变成两条脏数据路线,效果一样
522
+                for (FlowElement flowElement : allElements) {
523
+                    if (flowElement.getId().equals(stack.peek().getTaskDefinitionKey())) {
524
+                        dirtyTask = flowElement;
525
+                    }
526
+                }
527
+                // 获取脏数据线路
528
+                Set<String> dirtyDataLine = FlowableUtils.iteratorFindDirtyRoads(dirtyTask, null, null, Arrays.asList(dirtyPoint.split(",")), null);
529
+                // 自己本身也是脏线路上的点,加进去
530
+                dirtyDataLine.add(stack.peek().getTaskDefinitionKey());
531
+                log.info(stack.peek().getTaskDefinitionKey() + "点脏路线集合:" + dirtyDataLine);
532
+                // 是全新的需要添加的脏线路
533
+                boolean isNewDirtyData = true;
534
+                for (int i = 0; i < dirtyDataLineList.size(); i++) {
535
+                    // 如果发现他的上个节点在脏线路内,说明这个点可能是并行的节点,或者连续驳回
536
+                    // 这时,都以之前的脏线路节点为标准,只需合并脏线路即可,也就是路线补全
537
+                    if (dirtyDataLineList.get(i).contains(userTaskKey.toString())) {
538
+                        isNewDirtyData = false;
539
+                        dirtyDataLineList.get(i).addAll(dirtyDataLine);
540
+                    }
541
+                }
542
+                // 已确定时全新的脏线路
543
+                if (isNewDirtyData) {
544
+                    // deleteKey 单一路线驳回到并行,这种同时生成多个新实例记录情况,这时 deleteKey 其实是由多个值组成
545
+                    // 按照逻辑,回退后立刻生成的实例记录就是回退的记录
546
+                    // 至于驳回所生成的 Key,直接从删除原因中获取,因为存在驳回到并行的情况
547
+                    deleteKeyList.add(dirtyPoint + ",");
548
+                    dirtyDataLineList.add(dirtyDataLine);
549
+                }
550
+                // 添加后,现在这个点变成脏线路上的点了
551
+                isDirtyData[0] = true;
552
+            }
553
+            // 如果不是脏线路上的点,说明是有效数据,添加历史实例 Key
554
+            if (!isDirtyData[0]) {
555
+                lastHistoricTaskInstanceList.add(stack.peek().getTaskDefinitionKey());
556
+            }
557
+            // 校验脏线路是否结束
558
+            for (int i = 0; i < deleteKeyList.size(); i++) {
559
+                // 如果发现脏数据属于会签,记录下下标与对应 Key,以备后续比对,会签脏数据范畴开始
560
+                if (multiKey == null && multiTask.contains(stack.peek().getTaskDefinitionKey())
561
+                        && deleteKeyList.get(i).contains(stack.peek().getTaskDefinitionKey())) {
562
+                    multiIndex = i;
563
+                    multiKey = new StringBuilder(stack.peek().getTaskDefinitionKey());
564
+                }
565
+                // 会签脏数据处理,节点退回会签清空
566
+                // 如果在会签脏数据范畴中发现 Key改变,说明会签脏数据在上个节点就结束了,可以把会签脏数据删掉
567
+                if (multiKey != null && !multiKey.toString().equals(stack.peek().getTaskDefinitionKey())) {
568
+                    deleteKeyList.set(multiIndex, deleteKeyList.get(multiIndex).replace(stack.peek().getTaskDefinitionKey() + ",", ""));
569
+                    multiKey = null;
570
+                    // 结束进行下校验删除
571
+                    multiOpera = true;
572
+                }
573
+                // 其他脏数据处理
574
+                // 发现该路线最后一条脏数据,说明这条脏数据线路处理完了,删除脏数据信息
575
+                // 脏数据产生的新实例中是否包含这条数据
576
+                if (multiKey == null && deleteKeyList.get(i).contains(stack.peek().getTaskDefinitionKey())) {
577
+                    // 删除匹配到的部分
578
+                    deleteKeyList.set(i, deleteKeyList.get(i).replace(stack.peek().getTaskDefinitionKey() + ",", ""));
579
+                }
580
+                // 如果每组中的元素都以匹配过,说明脏数据结束
581
+                if ("".equals(deleteKeyList.get(i))) {
582
+                    // 同时删除脏数据
583
+                    deleteKeyList.remove(i);
584
+                    dirtyDataLineList.remove(i);
585
+                    break;
586
+                }
587
+            }
588
+            // 会签数据处理需要在循环外处理,否则可能导致溢出
589
+            // 会签的数据肯定是之前放进去的所以理论上不会溢出,但还是校验下
590
+            if (multiOpera && deleteKeyList.size() > multiIndex && "".equals(deleteKeyList.get(multiIndex))) {
591
+                // 同时删除脏数据
592
+                deleteKeyList.remove(multiIndex);
593
+                dirtyDataLineList.remove(multiIndex);
594
+                multiIndex = -1;
595
+                multiOpera = false;
596
+            }
597
+            // pop() 方法与 peek() 方法不同,在返回值的同时,会把值从栈中移除
598
+            // 保存新的 userTaskKey 在下个循环中使用
599
+            userTaskKey = new StringBuilder(stack.pop().getTaskDefinitionKey());
600
+        }
601
+        log.info("清洗后的历史节点数据:" + lastHistoricTaskInstanceList);
602
+        return lastHistoricTaskInstanceList;
603
+    }
604
+
605
+    /**
606
+     * 从 flowElement 获取 指定名称的 拓展元素
607
+     *
608
+     * @param flowElement          元素
609
+     * @param extensionElementName 拓展元素名称
610
+     */
611
+    public static ExtensionElement getExtensionElementFromFlowElementByName(FlowElement flowElement, String extensionElementName) {
612
+
613
+        if (flowElement == null) {
614
+            return null;
615
+        }
616
+        Map<String, List<ExtensionElement>> extensionElements = flowElement.getExtensionElements();
617
+        for (Map.Entry<String, List<ExtensionElement>> stringEntry : extensionElements.entrySet()) {
618
+            if (stringEntry.getKey().equals(extensionElementName)) {
619
+                for (ExtensionElement extensionElement : stringEntry.getValue()) {
620
+                    if (extensionElement.getName().equals(extensionElementName)) {
621
+                        return extensionElement;
622
+                    }
623
+                }
624
+            }
625
+        }
626
+
627
+        return null;
628
+    }
629
+
630
+    /**
631
+     * 获取当前任务节点扩展属性信息
632
+     *
633
+     * @param repositoryService
634
+     * @param task 当前任务
635
+     * @return 自定义属性列表
636
+     */
637
+    public static List<Object> getPropertyElement(RepositoryService repositoryService, org.flowable.task.api.Task task) {
638
+        FlowElement flowElement = getCurrentElement(repositoryService, task);
639
+        ExtensionElement extensionElement = FlowableUtils.getExtensionElementFromFlowElementByName(flowElement, "properties");
640
+        if (extensionElement == null) {
641
+            return Collections.emptyList();
642
+        }
643
+        return getPropertyExtensionElementByName(extensionElement, "property");
644
+    }
645
+
646
+    /**
647
+     * 获取当前任务节点
648
+     *
649
+     * @param repositoryService
650
+     * @param task
651
+     * @return
652
+     */
653
+    public static FlowElement getCurrentElement(RepositoryService repositoryService, org.flowable.task.api.Task task) {
654
+        ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(task.getProcessDefinitionId()).singleResult();
655
+        BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId());
656
+        return bpmnModel.getFlowElement(task.getTaskDefinitionKey());
657
+    }
658
+
659
+    /**
660
+     * 根据属性名获取扩展元素中的扩展属性列表
661
+     *
662
+     * @param extensionElement 扩展元素
663
+     * @param attributesName   属性名
664
+     * @return 扩展属性列表
665
+     */
666
+    public static List<Object> getPropertyExtensionElementByName(ExtensionElement extensionElement, String attributesName) {
667
+        try {
668
+            // 获取名称为attributesName的子元素
669
+            return Optional.ofNullable(extensionElement.getChildElements().get(attributesName))
670
+                    .orElse(Collections.emptyList()) // 如果子元素不存在则返回空集合,避免null引用
671
+                    .stream()
672
+                    .map(element -> {
673
+                        // 获取子元素的属性
674
+                        Map<String, List<ExtensionAttribute>> attributes = element.getAttributes();
675
+                        Object propertyDto = new Object();
676
+                        // 获取FlowPropertyDto的所有属性
677
+                        Arrays.stream(propertyDto.getClass().getDeclaredFields())
678
+                                .forEach(field -> {
679
+                                    field.setAccessible(true);
680
+                                    // 获取属性名称和值
681
+                                    attributes.getOrDefault(field.getName(), Collections.emptyList())
682
+                                            .stream()
683
+                                            .findFirst()
684
+                                            .ifPresent(attribute -> {
685
+                                                try {
686
+                                                    // 反射设置属性值
687
+                                                    field.set(propertyDto, attribute.getValue());
688
+                                                } catch (IllegalAccessException e) {
689
+                                                    e.printStackTrace();
690
+                                                    // 如果反射设置失败则忽略该属性
691
+                                                }
692
+                                            });
693
+                                });
694
+                        return propertyDto;
695
+                    }).collect(Collectors.toList());
696
+        } catch (Exception e) {
697
+            e.printStackTrace();
698
+            return Collections.emptyList(); // 如果发生异常则返回空列表
699
+        }
700
+    }
701
+
702
+}

+ 36 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/listener/FlowExecutionListener.java

@@ -0,0 +1,36 @@
1
+package com.ruoyi.flowable.listener;
2
+
3
+import lombok.extern.slf4j.Slf4j;
4
+import org.flowable.common.engine.api.delegate.Expression;
5
+import org.flowable.engine.delegate.DelegateExecution;
6
+import org.flowable.engine.delegate.ExecutionListener;
7
+import org.springframework.stereotype.Component;
8
+
9
+/**
10
+ * 执行监听器
11
+ *
12
+ * 执行监听器允许在执行过程中执行Java代码。
13
+ * 执行监听器可以捕获事件的类型:
14
+ * 流程实例启动,结束
15
+ * 输出流捕获
16
+ * 获取启动,结束
17
+ * 路由开始,结束
18
+ * 中间事件开始,结束
19
+ * 触发开始事件,触发结束事件
20
+ *
21
+ * @author Tony
22
+ * @date 2022/12/16
23
+ */
24
+@Slf4j
25
+@Component
26
+public class FlowExecutionListener implements ExecutionListener {
27
+    /**
28
+     * 流程设计器添加的参数
29
+     */
30
+    private Expression param;
31
+
32
+    @Override
33
+    public void notify(DelegateExecution execution) {
34
+        log.info("执行监听器:{}", execution);
35
+    }
36
+}

+ 32 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/listener/FlowTaskListener.java

@@ -0,0 +1,32 @@
1
+package com.ruoyi.flowable.listener;
2
+
3
+import lombok.extern.slf4j.Slf4j;
4
+import org.flowable.engine.delegate.TaskListener;
5
+import org.flowable.task.service.delegate.DelegateTask;
6
+import org.springframework.stereotype.Component;
7
+
8
+/**
9
+ * 任务监听器
10
+ *
11
+ * create(创建):在任务被创建且所有的任务属性设置完成后才触发
12
+ * assignment(指派):在任务被分配给某个办理人之后触发
13
+ * complete(完成):在配置了监听器的上一个任务完成时触发
14
+ * delete(删除):在任务即将被删除前触发。请注意任务由completeTask正常完成时也会触发
15
+ *
16
+ * @author Tony
17
+ * @date 2021/4/20
18
+ */
19
+@Slf4j
20
+@Component
21
+public class FlowTaskListener implements TaskListener{
22
+
23
+    @Override
24
+    public void notify(DelegateTask delegateTask) {
25
+
26
+        log.info("任务监听器:{}", delegateTask);
27
+        // TODO  获取事件类型 delegateTask.getEventName(),可以通过监听器给任务执行人发送相应的通知消息
28
+
29
+
30
+    }
31
+
32
+}

+ 80 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/IFlowDefinitionService.java

@@ -0,0 +1,80 @@
1
+package com.ruoyi.flowable.service;
2
+
3
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4
+import com.ruoyi.common.core.domain.AjaxResult;
5
+import com.ruoyi.system.domain.FlowProcDefDto;
6
+
7
+import java.io.IOException;
8
+import java.io.InputStream;
9
+import java.util.Map;
10
+
11
+/**
12
+ * @author Tony
13
+ * @date 2021-04-03 14:41
14
+ */
15
+public interface IFlowDefinitionService {
16
+
17
+    boolean exist(String processDefinitionKey);
18
+
19
+
20
+    /**
21
+     * 流程定义列表
22
+     *
23
+     * @param pageNum  当前页码
24
+     * @param pageSize 每页条数
25
+     * @return 流程定义分页列表数据
26
+     */
27
+    Page<FlowProcDefDto> list(String name,Integer pageNum, Integer pageSize);
28
+
29
+    /**
30
+     * 导入流程文件
31
+     * 当每个key的流程第一次部署时,指定版本为1。对其后所有使用相同key的流程定义,
32
+     * 部署时版本会在该key当前已部署的最高版本号基础上加1。key参数用于区分流程定义
33
+     * @param name
34
+     * @param category
35
+     * @param in
36
+     */
37
+    void importFile(String name, String category, InputStream in);
38
+
39
+    /**
40
+     * 读取xml
41
+     * @param deployId
42
+     * @return
43
+     */
44
+    AjaxResult readXml(String deployId) throws IOException;
45
+
46
+    /**
47
+     * 根据流程定义ID启动流程实例
48
+     *
49
+     * @param procDefId
50
+     * @param variables
51
+     * @return
52
+     */
53
+
54
+    AjaxResult startProcessInstanceById(String procDefId, Map<String, Object> variables);
55
+
56
+
57
+    /**
58
+     * 激活或挂起流程定义
59
+     *
60
+     * @param state    状态
61
+     * @param deployId 流程部署ID
62
+     */
63
+    void updateState(Integer state, String deployId);
64
+
65
+
66
+    /**
67
+     * 删除流程定义
68
+     *
69
+     * @param deployId 流程部署ID act_ge_bytearray 表中 deployment_id值
70
+     */
71
+    void delete(String deployId);
72
+
73
+
74
+    /**
75
+     * 读取图片文件
76
+     * @param deployId
77
+     * @return
78
+     */
79
+    InputStream readImage(String deployId);
80
+}

+ 53 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/IFlowInstanceService.java

@@ -0,0 +1,53 @@
1
+package com.ruoyi.flowable.service;
2
+
3
+import com.ruoyi.common.core.domain.AjaxResult;
4
+import com.ruoyi.flowable.domain.vo.FlowTaskVo;
5
+import org.flowable.engine.history.HistoricProcessInstance;
6
+import java.util.Map;
7
+
8
+/**
9
+ * @author Tony
10
+ * @date 2021-04-03 14:40
11
+ */
12
+public interface IFlowInstanceService {
13
+
14
+    /**
15
+     * 结束流程实例
16
+     *
17
+     * @param vo
18
+     */
19
+    void stopProcessInstance(FlowTaskVo vo);
20
+
21
+    /**
22
+     * 激活或挂起流程实例
23
+     *
24
+     * @param state      状态
25
+     * @param instanceId 流程实例ID
26
+     */
27
+    void updateState(Integer state, String instanceId);
28
+
29
+    /**
30
+     * 删除流程实例ID
31
+     *
32
+     * @param instanceId   流程实例ID
33
+     * @param deleteReason 删除原因
34
+     */
35
+    void delete(String instanceId, String deleteReason);
36
+
37
+    /**
38
+     * 根据实例ID查询历史实例数据
39
+     *
40
+     * @param processInstanceId
41
+     * @return
42
+     */
43
+    HistoricProcessInstance getHistoricProcessInstanceById(String processInstanceId);
44
+
45
+    /**
46
+     * 根据流程定义ID启动流程实例
47
+     *
48
+     * @param procDefId 流程定义Id
49
+     * @param variables 流程变量
50
+     * @return
51
+     */
52
+    AjaxResult startProcessInstanceById(String procDefId, Map<String, Object> variables);
53
+}

+ 218 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/IFlowTaskService.java

@@ -0,0 +1,218 @@
1
+package com.ruoyi.flowable.service;
2
+
3
+import com.ruoyi.common.core.domain.AjaxResult;
4
+import com.ruoyi.flowable.domain.vo.FlowQueryVo;
5
+import com.ruoyi.flowable.domain.vo.FlowTaskVo;
6
+import org.flowable.task.api.Task;
7
+
8
+import java.io.InputStream;
9
+import java.util.List;
10
+
11
+/**
12
+ * @author Tony
13
+ * @date 2021-04-03 14:42
14
+ */
15
+public interface IFlowTaskService {
16
+
17
+    /**
18
+     * 审批任务
19
+     *
20
+     * @param task 请求实体参数
21
+     */
22
+    AjaxResult complete(FlowTaskVo task);
23
+
24
+    /**
25
+     * 驳回任务
26
+     *
27
+     * @param flowTaskVo
28
+     */
29
+    void taskReject(FlowTaskVo flowTaskVo);
30
+
31
+
32
+    /**
33
+     * 退回任务
34
+     *
35
+     * @param flowTaskVo 请求实体参数
36
+     */
37
+    void taskReturn(FlowTaskVo flowTaskVo);
38
+
39
+    /**
40
+     * 获取所有可回退的节点
41
+     *
42
+     * @param flowTaskVo
43
+     * @return
44
+     */
45
+    AjaxResult findReturnTaskList(FlowTaskVo flowTaskVo);
46
+
47
+    /**
48
+     * 删除任务
49
+     *
50
+     * @param flowTaskVo 请求实体参数
51
+     */
52
+    void deleteTask(FlowTaskVo flowTaskVo);
53
+
54
+    /**
55
+     * 认领/签收任务
56
+     *
57
+     * @param flowTaskVo 请求实体参数
58
+     */
59
+    void claim(FlowTaskVo flowTaskVo);
60
+
61
+    /**
62
+     * 取消认领/签收任务
63
+     *
64
+     * @param flowTaskVo 请求实体参数
65
+     */
66
+    void unClaim(FlowTaskVo flowTaskVo);
67
+
68
+    /**
69
+     * 委派任务
70
+     *
71
+     * @param flowTaskVo 请求实体参数
72
+     */
73
+    void delegateTask(FlowTaskVo flowTaskVo);
74
+
75
+    /**
76
+     * 任务归还
77
+     *
78
+     * @param flowTaskVo 请求实体参数
79
+     */
80
+    void resolveTask(FlowTaskVo flowTaskVo);
81
+
82
+
83
+    /**
84
+     * 转办任务
85
+     *
86
+     * @param flowTaskVo 请求实体参数
87
+     */
88
+    void assignTask(FlowTaskVo flowTaskVo);
89
+
90
+
91
+    /**
92
+     * 多实例加签
93
+     * @param flowTaskVo
94
+     */
95
+    void addMultiInstanceExecution(FlowTaskVo flowTaskVo);
96
+
97
+    /**
98
+     * 多实例减签
99
+     * @param flowTaskVo
100
+     */
101
+    void deleteMultiInstanceExecution(FlowTaskVo flowTaskVo);
102
+
103
+    /**
104
+     * 我发起的流程
105
+     * @param queryVo  请求参数
106
+     * @return
107
+     */
108
+    AjaxResult myProcess(FlowQueryVo queryVo);
109
+
110
+    /**
111
+     * 取消申请
112
+     * 目前实现方式: 直接将当前流程变更为已完成
113
+     * @param flowTaskVo
114
+     * @return
115
+     */
116
+    AjaxResult stopProcess(FlowTaskVo flowTaskVo);
117
+
118
+    /**
119
+     * 撤回流程
120
+     * @param flowTaskVo
121
+     * @return
122
+     */
123
+    AjaxResult revokeProcess(FlowTaskVo flowTaskVo);
124
+
125
+
126
+    /**
127
+     * 代办任务列表
128
+     *
129
+     * @param queryVo  请求参数
130
+     * @return
131
+     */
132
+    AjaxResult todoList(FlowQueryVo queryVo);
133
+
134
+
135
+    /**
136
+     * 已办任务列表
137
+     *
138
+     * @param queryVo  请求参数
139
+     * @return
140
+     */
141
+    AjaxResult finishedList(FlowQueryVo queryVo);
142
+
143
+    /**
144
+     * 流程历史流转记录
145
+     *
146
+     * @param procInsId 流程实例Id
147
+     * @return
148
+     */
149
+    AjaxResult flowRecord(String procInsId,String deployId);
150
+
151
+    /**
152
+     * 根据任务ID查询挂载的表单信息
153
+     *
154
+     * @param taskId 任务Id
155
+     * @return
156
+     */
157
+    AjaxResult getTaskForm(String taskId);
158
+
159
+    /**
160
+     * 获取流程过程图
161
+     * @param processId
162
+     * @return
163
+     */
164
+    InputStream diagram(String processId);
165
+
166
+    /**
167
+     * 获取流程执行节点
168
+     * @param procInsId
169
+     * @return
170
+     */
171
+    AjaxResult getFlowViewer(String procInsId,String executionId);
172
+
173
+    /**
174
+     * 获取流程变量
175
+     * @param taskId
176
+     * @return
177
+     */
178
+    AjaxResult processVariables(String taskId);
179
+
180
+    /**
181
+     * 获取下一节点
182
+     * @param flowTaskVo 任务
183
+     * @return
184
+     */
185
+    AjaxResult getNextFlowNode(FlowTaskVo flowTaskVo);
186
+
187
+    AjaxResult getNextFlowNodeByStart(FlowTaskVo flowTaskVo);
188
+
189
+    /**
190
+     * 流程初始化表单
191
+     * @param deployId
192
+     * @return
193
+     */
194
+    AjaxResult flowFormData(String deployId);
195
+
196
+    /**
197
+     * 流程节点信息
198
+     * @param procInsId
199
+     * @return
200
+     */
201
+    AjaxResult flowXmlAndNode(String procInsId,String deployId);
202
+
203
+    /**
204
+     * 流程节点表单
205
+     * @param taskId 流程任务编号
206
+     * @return
207
+     */
208
+    AjaxResult flowTaskForm(String taskId) throws Exception;
209
+
210
+
211
+    /**
212
+     * 流程节点信息
213
+     * @param procInsId
214
+     * @param elementId
215
+     * @return
216
+     */
217
+    AjaxResult flowTaskInfo(String procInsId, String elementId);
218
+}

+ 69 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/ISysDeployFormService.java

@@ -0,0 +1,69 @@
1
+package com.ruoyi.flowable.service;
2
+
3
+import java.util.List;
4
+import com.ruoyi.system.domain.SysDeployForm;
5
+import com.ruoyi.system.domain.SysForm;
6
+
7
+/**
8
+ * 流程实例关联表单Service接口
9
+ * 
10
+ * @author Tony
11
+ * @date 2021-04-03
12
+ */
13
+public interface ISysDeployFormService 
14
+{
15
+    /**
16
+     * 查询流程实例关联表单
17
+     * 
18
+     * @param id 流程实例关联表单ID
19
+     * @return 流程实例关联表单
20
+     */
21
+    public SysDeployForm selectSysDeployFormById(Long id);
22
+
23
+    /**
24
+     * 查询流程实例关联表单列表
25
+     * 
26
+     * @param sysDeployForm 流程实例关联表单
27
+     * @return 流程实例关联表单集合
28
+     */
29
+    public List<SysDeployForm> selectSysDeployFormList(SysDeployForm sysDeployForm);
30
+
31
+    /**
32
+     * 新增流程实例关联表单
33
+     * 
34
+     * @param sysDeployForm 流程实例关联表单
35
+     * @return 结果
36
+     */
37
+    public int insertSysDeployForm(SysDeployForm sysDeployForm);
38
+
39
+    /**
40
+     * 修改流程实例关联表单
41
+     * 
42
+     * @param sysDeployForm 流程实例关联表单
43
+     * @return 结果
44
+     */
45
+    public int updateSysDeployForm(SysDeployForm sysDeployForm);
46
+
47
+    /**
48
+     * 批量删除流程实例关联表单
49
+     * 
50
+     * @param ids 需要删除的流程实例关联表单ID
51
+     * @return 结果
52
+     */
53
+    public int deleteSysDeployFormByIds(Long[] ids);
54
+
55
+    /**
56
+     * 删除流程实例关联表单信息
57
+     * 
58
+     * @param id 流程实例关联表单ID
59
+     * @return 结果
60
+     */
61
+    public int deleteSysDeployFormById(Long id);
62
+
63
+    /**
64
+     * 查询流程挂着的表单
65
+     * @param deployId
66
+     * @return
67
+     */
68
+    SysForm selectSysDeployFormByDeployId(String deployId);
69
+}

+ 60 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/ISysFormService.java

@@ -0,0 +1,60 @@
1
+package com.ruoyi.flowable.service;
2
+
3
+import java.util.List;
4
+import com.ruoyi.system.domain.SysForm;
5
+
6
+/**
7
+ * 表单
8
+ * @author Tony
9
+ * @date 2021-04-03
10
+ */
11
+public interface ISysFormService 
12
+{
13
+    /**
14
+     * 查询流程表单
15
+     * 
16
+     * @param formId 流程表单ID
17
+     * @return 流程表单
18
+     */
19
+    public SysForm selectSysFormById(Long formId);
20
+
21
+    /**
22
+     * 查询流程表单列表
23
+     * 
24
+     * @param sysForm 流程表单
25
+     * @return 流程表单集合
26
+     */
27
+    public List<SysForm> selectSysFormList(SysForm sysForm);
28
+
29
+    /**
30
+     * 新增流程表单
31
+     * 
32
+     * @param sysForm 流程表单
33
+     * @return 结果
34
+     */
35
+    public int insertSysForm(SysForm sysForm);
36
+
37
+    /**
38
+     * 修改流程表单
39
+     * 
40
+     * @param sysForm 流程表单
41
+     * @return 结果
42
+     */
43
+    public int updateSysForm(SysForm sysForm);
44
+
45
+    /**
46
+     * 批量删除流程表单
47
+     * 
48
+     * @param formIds 需要删除的流程表单ID
49
+     * @return 结果
50
+     */
51
+    public int deleteSysFormByIds(Long[] formIds);
52
+
53
+    /**
54
+     * 删除流程表单信息
55
+     * 
56
+     * @param formId 流程表单ID
57
+     * @return 结果
58
+     */
59
+    public int deleteSysFormById(Long formId);
60
+}

+ 248 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowDefinitionServiceImpl.java

@@ -0,0 +1,248 @@
1
+package com.ruoyi.flowable.service.impl;
2
+
3
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4
+import com.github.pagehelper.PageHelper;
5
+import com.github.pagehelper.PageInfo;
6
+import com.ruoyi.flowable.common.constant.ProcessConstants;
7
+import com.ruoyi.common.core.domain.AjaxResult;
8
+import com.ruoyi.common.core.domain.entity.SysUser;
9
+import com.ruoyi.common.utils.SecurityUtils;
10
+import com.ruoyi.flowable.common.enums.FlowComment;
11
+import com.ruoyi.system.domain.FlowProcDefDto;
12
+import com.ruoyi.flowable.factory.FlowServiceFactory;
13
+import com.ruoyi.flowable.service.IFlowDefinitionService;
14
+import com.ruoyi.flowable.service.ISysDeployFormService;
15
+import com.ruoyi.system.domain.SysForm;
16
+import com.ruoyi.system.mapper.FlowDeployMapper;
17
+import com.ruoyi.system.service.ISysDeptService;
18
+import com.ruoyi.system.service.ISysPostService;
19
+import com.ruoyi.system.service.ISysUserService;
20
+import lombok.extern.slf4j.Slf4j;
21
+import org.apache.commons.io.IOUtils;
22
+import org.apache.commons.lang3.StringUtils;
23
+import org.flowable.bpmn.model.BpmnModel;
24
+import org.flowable.engine.repository.Deployment;
25
+import org.flowable.engine.repository.ProcessDefinition;
26
+import org.flowable.engine.repository.ProcessDefinitionQuery;
27
+import org.flowable.engine.runtime.ProcessInstance;
28
+import org.flowable.image.impl.DefaultProcessDiagramGenerator;
29
+import org.flowable.task.api.Task;
30
+import org.springframework.beans.BeanUtils;
31
+import org.springframework.stereotype.Service;
32
+
33
+import javax.annotation.Resource;
34
+import java.io.IOException;
35
+import java.io.InputStream;
36
+import java.nio.charset.StandardCharsets;
37
+import java.util.*;
38
+
39
+/**
40
+ * 流程定义
41
+ *
42
+ * @author Tony
43
+ * @date 2021-04-03
44
+ */
45
+@Service
46
+@Slf4j
47
+public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFlowDefinitionService {
48
+
49
+    @Resource
50
+    private ISysDeployFormService sysDeployFormService;
51
+
52
+    @Resource
53
+    private ISysUserService sysUserService;
54
+
55
+    @Resource
56
+    private ISysDeptService sysDeptService;
57
+
58
+    @Resource
59
+    private FlowDeployMapper flowDeployMapper;
60
+
61
+    private static final String BPMN_FILE_SUFFIX = ".bpmn";
62
+
63
+    @Override
64
+    public boolean exist(String processDefinitionKey) {
65
+        ProcessDefinitionQuery processDefinitionQuery
66
+                = repositoryService.createProcessDefinitionQuery().processDefinitionKey(processDefinitionKey);
67
+        long count = processDefinitionQuery.count();
68
+        return count > 0 ? true : false;
69
+    }
70
+
71
+
72
+    /**
73
+     * 流程定义列表
74
+     *
75
+     * @param pageNum  当前页码
76
+     * @param pageSize 每页条数
77
+     * @return 流程定义分页列表数据
78
+     */
79
+    @Override
80
+    public Page<FlowProcDefDto> list(String name, Integer pageNum, Integer pageSize) {
81
+        Page<FlowProcDefDto> page = new Page<>();
82
+//        // 流程定义列表数据查询
83
+//        final ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
84
+//        if (StringUtils.isNotEmpty(name)) {
85
+//            processDefinitionQuery.processDefinitionNameLike(name);
86
+//        }
87
+////        processDefinitionQuery.orderByProcessDefinitionKey().asc();
88
+//        page.setTotal(processDefinitionQuery.count());
89
+//        List<ProcessDefinition> processDefinitionList = processDefinitionQuery.listPage(pageSize * (pageNum - 1), pageSize);
90
+//
91
+//        List<FlowProcDefDto> dataList = new ArrayList<>();
92
+//        for (ProcessDefinition processDefinition : processDefinitionList) {
93
+//            String deploymentId = processDefinition.getDeploymentId();
94
+//            Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
95
+//            FlowProcDefDto reProcDef = new FlowProcDefDto();
96
+//            BeanUtils.copyProperties(processDefinition, reProcDef);
97
+//            SysForm sysForm = sysDeployFormService.selectSysDeployFormByDeployId(deploymentId);
98
+//            if (Objects.nonNull(sysForm)) {
99
+//                reProcDef.setFormName(sysForm.getFormName());
100
+//                reProcDef.setFormId(sysForm.getFormId());
101
+//            }
102
+//            // 流程定义时间
103
+//            reProcDef.setDeploymentTime(deployment.getDeploymentTime());
104
+//            dataList.add(reProcDef);
105
+//        }
106
+        PageHelper.startPage(pageNum, pageSize);
107
+        final List<FlowProcDefDto> dataList = flowDeployMapper.selectDeployList(name);
108
+        // 加载挂表单
109
+        for (FlowProcDefDto procDef : dataList) {
110
+            SysForm sysForm = sysDeployFormService.selectSysDeployFormByDeployId(procDef.getDeploymentId());
111
+            if (Objects.nonNull(sysForm)) {
112
+                procDef.setFormName(sysForm.getFormName());
113
+                procDef.setFormId(sysForm.getFormId());
114
+            }
115
+        }
116
+        page.setTotal(new PageInfo(dataList).getTotal());
117
+        page.setRecords(dataList);
118
+        return page;
119
+    }
120
+
121
+
122
+    /**
123
+     * 导入流程文件
124
+     *
125
+     * 当每个key的流程第一次部署时,指定版本为1。对其后所有使用相同key的流程定义,
126
+     * 部署时版本会在该key当前已部署的最高版本号基础上加1。key参数用于区分流程定义
127
+     * @param name
128
+     * @param category
129
+     * @param in
130
+     */
131
+    @Override
132
+    public void importFile(String name, String category, InputStream in) {
133
+        Deployment deploy = repositoryService.createDeployment().addInputStream(name + BPMN_FILE_SUFFIX, in).name(name).category(category).deploy();
134
+        ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().deploymentId(deploy.getId()).singleResult();
135
+        repositoryService.setProcessDefinitionCategory(definition.getId(), category);
136
+
137
+    }
138
+
139
+    /**
140
+     * 读取xml
141
+     *
142
+     * @param deployId
143
+     * @return
144
+     */
145
+    @Override
146
+    public AjaxResult readXml(String deployId) throws IOException {
147
+        ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().deploymentId(deployId).singleResult();
148
+        InputStream inputStream = repositoryService.getResourceAsStream(definition.getDeploymentId(), definition.getResourceName());
149
+        String result = IOUtils.toString(inputStream, StandardCharsets.UTF_8.name());
150
+        return AjaxResult.success("", result);
151
+    }
152
+
153
+    /**
154
+     * 读取xml
155
+     *
156
+     * @param deployId
157
+     * @return
158
+     */
159
+    @Override
160
+    public InputStream readImage(String deployId) {
161
+        ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deployId).singleResult();
162
+        //获得图片流
163
+        DefaultProcessDiagramGenerator diagramGenerator = new DefaultProcessDiagramGenerator();
164
+        BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId());
165
+        //输出为图片
166
+        return diagramGenerator.generateDiagram(
167
+                bpmnModel,
168
+                "png",
169
+                Collections.emptyList(),
170
+                Collections.emptyList(),
171
+                "宋体",
172
+                "宋体",
173
+                "宋体",
174
+                null,
175
+                1.0,
176
+                false);
177
+
178
+    }
179
+
180
+    /**
181
+     * 根据流程定义ID启动流程实例
182
+     *
183
+     * @param procDefId 流程模板ID
184
+     * @param variables 流程变量
185
+     * @return
186
+     */
187
+    @Override
188
+    public AjaxResult startProcessInstanceById(String procDefId, Map<String, Object> variables) {
189
+        try {
190
+            ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(procDefId)
191
+                    .latestVersion().singleResult();
192
+            if (Objects.nonNull(processDefinition) && processDefinition.isSuspended()) {
193
+                return AjaxResult.error("流程已被挂起,请先激活流程");
194
+            }
195
+            // 设置流程发起人Id到流程中
196
+            SysUser sysUser = SecurityUtils.getLoginUser().getUser();
197
+            identityService.setAuthenticatedUserId(sysUser.getUserId().toString());
198
+            variables.put(ProcessConstants.PROCESS_INITIATOR, sysUser.getUserId());
199
+
200
+            // 流程发起时 跳过发起人节点
201
+            ProcessInstance processInstance = runtimeService.startProcessInstanceById(procDefId, variables);
202
+            // 给第一步申请人节点设置任务执行人和意见
203
+            Task task = taskService.createTaskQuery().processInstanceId(processInstance.getProcessInstanceId()).singleResult();
204
+            if (Objects.nonNull(task)) {
205
+                taskService.addComment(task.getId(), processInstance.getProcessInstanceId(), FlowComment.NORMAL.getType(), sysUser.getNickName() + "发起流程申请");
206
+                taskService.complete(task.getId(), variables);
207
+            }
208
+            return AjaxResult.success("流程启动成功");
209
+        } catch (Exception e) {
210
+            e.printStackTrace();
211
+            return AjaxResult.error("流程启动错误");
212
+        }
213
+    }
214
+
215
+
216
+    /**
217
+     * 激活或挂起流程定义
218
+     *
219
+     * @param state    状态
220
+     * @param deployId 流程部署ID
221
+     */
222
+    @Override
223
+    public void updateState(Integer state, String deployId) {
224
+        ProcessDefinition procDef = repositoryService.createProcessDefinitionQuery().deploymentId(deployId).singleResult();
225
+        // 激活
226
+        if (state == 1) {
227
+            repositoryService.activateProcessDefinitionById(procDef.getId(), true, null);
228
+        }
229
+        // 挂起
230
+        if (state == 2) {
231
+            repositoryService.suspendProcessDefinitionById(procDef.getId(), true, null);
232
+        }
233
+    }
234
+
235
+
236
+    /**
237
+     * 删除流程定义
238
+     *
239
+     * @param deployId 流程部署ID act_ge_bytearray 表中 deployment_id值
240
+     */
241
+    @Override
242
+    public void delete(String deployId) {
243
+        // true 允许级联删除 ,不设置会导致数据库外键关联异常
244
+        repositoryService.deleteDeployment(deployId, true);
245
+    }
246
+
247
+
248
+}

+ 122 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowInstanceServiceImpl.java

@@ -0,0 +1,122 @@
1
+package com.ruoyi.flowable.service.impl;
2
+
3
+
4
+import com.ruoyi.common.core.domain.AjaxResult;
5
+import com.ruoyi.common.utils.SecurityUtils;
6
+import com.ruoyi.flowable.domain.vo.FlowTaskVo;
7
+import com.ruoyi.flowable.factory.FlowServiceFactory;
8
+import com.ruoyi.flowable.service.IFlowInstanceService;
9
+import lombok.extern.slf4j.Slf4j;
10
+import org.flowable.common.engine.api.FlowableObjectNotFoundException;
11
+import org.flowable.engine.history.HistoricProcessInstance;
12
+import org.flowable.task.api.Task;
13
+import org.springframework.stereotype.Service;
14
+import org.springframework.transaction.annotation.Transactional;
15
+
16
+import java.util.HashMap;
17
+import java.util.List;
18
+import java.util.Map;
19
+import java.util.Objects;
20
+
21
+/**
22
+ * <p>工作流流程实例管理<p>
23
+ *
24
+ * @author Tony
25
+ * @date 2021-04-03
26
+ */
27
+@Service
28
+@Slf4j
29
+public class FlowInstanceServiceImpl extends FlowServiceFactory implements IFlowInstanceService {
30
+
31
+    /**
32
+     * 结束流程实例
33
+     *
34
+     * @param vo
35
+     */
36
+    @Override
37
+    public void stopProcessInstance(FlowTaskVo vo) {
38
+        String taskId = vo.getTaskId();
39
+
40
+    }
41
+
42
+    /**
43
+     * 激活或挂起流程实例
44
+     *
45
+     * @param state      状态
46
+     * @param instanceId 流程实例ID
47
+     */
48
+    @Override
49
+    public void updateState(Integer state, String instanceId) {
50
+
51
+        // 激活
52
+        if (state == 1) {
53
+            runtimeService.activateProcessInstanceById(instanceId);
54
+        }
55
+        // 挂起
56
+        if (state == 2) {
57
+            runtimeService.suspendProcessInstanceById(instanceId);
58
+        }
59
+    }
60
+
61
+    /**
62
+     * 删除流程实例ID
63
+     *
64
+     * @param instanceId   流程实例ID
65
+     * @param deleteReason 删除原因
66
+     */
67
+    @Override
68
+    @Transactional(rollbackFor = Exception.class)
69
+    public void delete(String instanceId, String deleteReason) {
70
+
71
+        // 查询历史数据
72
+        HistoricProcessInstance historicProcessInstance = getHistoricProcessInstanceById(instanceId);
73
+        if (historicProcessInstance.getEndTime() != null) {
74
+            historyService.deleteHistoricProcessInstance(historicProcessInstance.getId());
75
+            return;
76
+        }
77
+        // 删除流程实例
78
+        runtimeService.deleteProcessInstance(instanceId, deleteReason);
79
+        // 删除历史流程实例
80
+        historyService.deleteHistoricProcessInstance(instanceId);
81
+    }
82
+
83
+    /**
84
+     * 根据实例ID查询历史实例数据
85
+     *
86
+     * @param processInstanceId
87
+     * @return
88
+     */
89
+    @Override
90
+    public HistoricProcessInstance getHistoricProcessInstanceById(String processInstanceId) {
91
+        HistoricProcessInstance historicProcessInstance =
92
+                historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
93
+        if (Objects.isNull(historicProcessInstance)) {
94
+            throw new FlowableObjectNotFoundException("流程实例不存在: " + processInstanceId);
95
+        }
96
+        return historicProcessInstance;
97
+    }
98
+
99
+    /**
100
+     * 根据流程定义ID启动流程实例
101
+     *
102
+     * @param procDefId 流程定义Id
103
+     * @param variables 流程变量
104
+     * @return
105
+     */
106
+    @Override
107
+    public AjaxResult startProcessInstanceById(String procDefId, Map<String, Object> variables) {
108
+
109
+        try {
110
+            // 设置流程发起人Id到流程中
111
+            Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
112
+//            identityService.setAuthenticatedUserId(userId.toString());
113
+            variables.put("initiator",userId);
114
+            variables.put("_FLOWABLE_SKIP_EXPRESSION_ENABLED", true);
115
+            runtimeService.startProcessInstanceById(procDefId, variables);
116
+            return AjaxResult.success("流程启动成功");
117
+        } catch (Exception e) {
118
+            e.printStackTrace();
119
+            return AjaxResult.error("流程启动错误");
120
+        }
121
+    }
122
+}

File diff suppressed because it is too large
+ 1262 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowTaskServiceImpl.java


+ 112 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/SysDeployFormServiceImpl.java

@@ -0,0 +1,112 @@
1
+package com.ruoyi.flowable.service.impl;
2
+
3
+import java.util.List;
4
+import java.util.Objects;
5
+
6
+import com.ruoyi.system.domain.SysForm;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.stereotype.Service;
9
+import com.ruoyi.system.mapper.SysDeployFormMapper;
10
+import com.ruoyi.system.domain.SysDeployForm;
11
+import com.ruoyi.flowable.service.ISysDeployFormService;
12
+
13
+/**
14
+ * 流程实例关联表单Service业务层处理
15
+ * 
16
+ * @author Tony
17
+ * @date 2021-04-03
18
+ */
19
+@Service
20
+public class SysDeployFormServiceImpl implements ISysDeployFormService 
21
+{
22
+    @Autowired
23
+    private SysDeployFormMapper sysDeployFormMapper;
24
+
25
+    /**
26
+     * 查询流程实例关联表单
27
+     * 
28
+     * @param id 流程实例关联表单ID
29
+     * @return 流程实例关联表单
30
+     */
31
+    @Override
32
+    public SysDeployForm selectSysDeployFormById(Long id)
33
+    {
34
+        return sysDeployFormMapper.selectSysDeployFormById(id);
35
+    }
36
+
37
+    /**
38
+     * 查询流程实例关联表单列表
39
+     * 
40
+     * @param sysDeployForm 流程实例关联表单
41
+     * @return 流程实例关联表单
42
+     */
43
+    @Override
44
+    public List<SysDeployForm> selectSysDeployFormList(SysDeployForm sysDeployForm)
45
+    {
46
+        return sysDeployFormMapper.selectSysDeployFormList(sysDeployForm);
47
+    }
48
+
49
+    /**
50
+     * 新增流程实例关联表单
51
+     * 
52
+     * @param sysDeployForm 流程实例关联表单
53
+     * @return 结果
54
+     */
55
+    @Override
56
+    public int insertSysDeployForm(SysDeployForm sysDeployForm)
57
+    {
58
+        SysForm sysForm = sysDeployFormMapper.selectSysDeployFormByDeployId(sysDeployForm.getDeployId());
59
+        if (Objects.isNull(sysForm)) {
60
+            return sysDeployFormMapper.insertSysDeployForm(sysDeployForm);
61
+        }else {
62
+            return 1;
63
+        }
64
+    }
65
+
66
+    /**
67
+     * 修改流程实例关联表单
68
+     * 
69
+     * @param sysDeployForm 流程实例关联表单
70
+     * @return 结果
71
+     */
72
+    @Override
73
+    public int updateSysDeployForm(SysDeployForm sysDeployForm)
74
+    {
75
+        return sysDeployFormMapper.updateSysDeployForm(sysDeployForm);
76
+    }
77
+
78
+    /**
79
+     * 批量删除流程实例关联表单
80
+     * 
81
+     * @param ids 需要删除的流程实例关联表单ID
82
+     * @return 结果
83
+     */
84
+    @Override
85
+    public int deleteSysDeployFormByIds(Long[] ids)
86
+    {
87
+        return sysDeployFormMapper.deleteSysDeployFormByIds(ids);
88
+    }
89
+
90
+    /**
91
+     * 删除流程实例关联表单信息
92
+     * 
93
+     * @param id 流程实例关联表单ID
94
+     * @return 结果
95
+     */
96
+    @Override
97
+    public int deleteSysDeployFormById(Long id)
98
+    {
99
+        return sysDeployFormMapper.deleteSysDeployFormById(id);
100
+    }
101
+
102
+    /**
103
+     * 查询流程挂着的表单
104
+     *
105
+     * @param deployId
106
+     * @return
107
+     */
108
+    @Override
109
+    public SysForm selectSysDeployFormByDeployId(String deployId) {
110
+        return sysDeployFormMapper.selectSysDeployFormByDeployId(deployId);
111
+    }
112
+}

+ 96 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/SysFormServiceImpl.java

@@ -0,0 +1,96 @@
1
+package com.ruoyi.flowable.service.impl;
2
+
3
+import java.util.List;
4
+import com.ruoyi.common.utils.DateUtils;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.stereotype.Service;
7
+import com.ruoyi.system.mapper.SysFormMapper;
8
+import com.ruoyi.system.domain.SysForm;
9
+import com.ruoyi.flowable.service.ISysFormService;
10
+
11
+/**
12
+ * 流程表单Service业务层处理
13
+ * 
14
+ * @author Tony
15
+ * @date 2021-04-03
16
+ */
17
+@Service
18
+public class SysFormServiceImpl implements ISysFormService 
19
+{
20
+    @Autowired
21
+    private SysFormMapper sysFormMapper;
22
+
23
+    /**
24
+     * 查询流程表单
25
+     * 
26
+     * @param formId 流程表单ID
27
+     * @return 流程表单
28
+     */
29
+    @Override
30
+    public SysForm selectSysFormById(Long formId)
31
+    {
32
+        return sysFormMapper.selectSysFormById(formId);
33
+    }
34
+
35
+    /**
36
+     * 查询流程表单列表
37
+     * 
38
+     * @param sysForm 流程表单
39
+     * @return 流程表单
40
+     */
41
+    @Override
42
+    public List<SysForm> selectSysFormList(SysForm sysForm)
43
+    {
44
+        return sysFormMapper.selectSysFormList(sysForm);
45
+    }
46
+
47
+    /**
48
+     * 新增流程表单
49
+     * 
50
+     * @param sysForm 流程表单
51
+     * @return 结果
52
+     */
53
+    @Override
54
+    public int insertSysForm(SysForm sysForm)
55
+    {
56
+        sysForm.setCreateTime(DateUtils.getNowDate());
57
+        return sysFormMapper.insertSysForm(sysForm);
58
+    }
59
+
60
+    /**
61
+     * 修改流程表单
62
+     * 
63
+     * @param sysForm 流程表单
64
+     * @return 结果
65
+     */
66
+    @Override
67
+    public int updateSysForm(SysForm sysForm)
68
+    {
69
+        sysForm.setUpdateTime(DateUtils.getNowDate());
70
+        return sysFormMapper.updateSysForm(sysForm);
71
+    }
72
+
73
+    /**
74
+     * 批量删除流程表单
75
+     * 
76
+     * @param formIds 需要删除的流程表单ID
77
+     * @return 结果
78
+     */
79
+    @Override
80
+    public int deleteSysFormByIds(Long[] formIds)
81
+    {
82
+        return sysFormMapper.deleteSysFormByIds(formIds);
83
+    }
84
+
85
+    /**
86
+     * 删除流程表单信息
87
+     * 
88
+     * @param formId 流程表单ID
89
+     * @return 结果
90
+     */
91
+    @Override
92
+    public int deleteSysFormById(Long formId)
93
+    {
94
+        return sysFormMapper.deleteSysFormById(formId);
95
+    }
96
+}

+ 13 - 1
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-framework/pom.xml

@@ -14,6 +14,18 @@
14 14
     <description>
15 15
         framework框架核心
16 16
     </description>
17
+    <build>
18
+        <plugins>
19
+            <plugin>
20
+                <groupId>org.apache.maven.plugins</groupId>
21
+                <artifactId>maven-compiler-plugin</artifactId>
22
+                <configuration>
23
+                    <source>8</source>
24
+                    <target>8</target>
25
+                </configuration>
26
+            </plugin>
27
+        </plugins>
28
+    </build>
17 29
 
18 30
     <dependencies>
19 31
 
@@ -61,4 +73,4 @@
61 73
 
62 74
     </dependencies>
63 75
 
64
-</project>
76
+</project>

+ 13 - 1
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-generator/pom.xml

@@ -14,6 +14,18 @@
14 14
     <description>
15 15
         generator代码生成
16 16
     </description>
17
+    <build>
18
+        <plugins>
19
+            <plugin>
20
+                <groupId>org.apache.maven.plugins</groupId>
21
+                <artifactId>maven-compiler-plugin</artifactId>
22
+                <configuration>
23
+                    <source>8</source>
24
+                    <target>8</target>
25
+                </configuration>
26
+            </plugin>
27
+        </plugins>
28
+    </build>
17 29
 
18 30
     <dependencies>
19 31
 
@@ -37,4 +49,4 @@
37 49
 
38 50
     </dependencies>
39 51
 
40
-</project>
52
+</project>

+ 13 - 1
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/pom.xml

@@ -14,6 +14,18 @@
14 14
     <description>
15 15
         system系统模块
16 16
     </description>
17
+    <build>
18
+        <plugins>
19
+            <plugin>
20
+                <groupId>org.apache.maven.plugins</groupId>
21
+                <artifactId>maven-compiler-plugin</artifactId>
22
+                <configuration>
23
+                    <source>8</source>
24
+                    <target>8</target>
25
+                </configuration>
26
+            </plugin>
27
+        </plugins>
28
+    </build>
17 29
 
18 30
     <dependencies>
19 31
 
@@ -25,4 +37,4 @@
25 37
 
26 38
     </dependencies>
27 39
 
28
-</project>
40
+</project>

+ 56 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/domain/FlowProcDefDto.java

@@ -0,0 +1,56 @@
1
+package com.ruoyi.system.domain;
2
+import com.fasterxml.jackson.annotation.JsonFormat;
3
+import io.swagger.annotations.ApiModel;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.AllArgsConstructor;
6
+import lombok.Data;
7
+import lombok.NoArgsConstructor;
8
+
9
+import java.io.Serializable;
10
+import java.util.Date;
11
+
12
+/**
13
+ * <p>流程定义<p>
14
+ *
15
+ * @author Tony
16
+ * @date 2021-04-03
17
+ */
18
+@Data
19
+@AllArgsConstructor
20
+@NoArgsConstructor
21
+@ApiModel("流程定义")
22
+public class FlowProcDefDto implements Serializable {
23
+
24
+    @ApiModelProperty("流程id")
25
+    private String id;
26
+
27
+    @ApiModelProperty("流程名称")
28
+    private String name;
29
+
30
+    @ApiModelProperty("流程key")
31
+    private String flowKey;
32
+
33
+    @ApiModelProperty("流程分类")
34
+    private String category;
35
+
36
+    @ApiModelProperty("配置表单名称")
37
+    private String formName;
38
+
39
+    @ApiModelProperty("配置表单id")
40
+    private Long formId;
41
+
42
+    @ApiModelProperty("版本")
43
+    private int version;
44
+
45
+    @ApiModelProperty("部署ID")
46
+    private String deploymentId;
47
+
48
+    @ApiModelProperty("流程定义状态: 1:激活 , 2:中止")
49
+    private int suspensionState;
50
+
51
+    @ApiModelProperty("部署时间")
52
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
53
+    private Date deploymentTime;
54
+
55
+
56
+}

+ 64 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysDeployForm.java

@@ -0,0 +1,64 @@
1
+package com.ruoyi.system.domain;
2
+
3
+import com.ruoyi.common.annotation.Excel;
4
+import com.ruoyi.common.core.domain.BaseEntity;
5
+import org.apache.commons.lang3.builder.ToStringBuilder;
6
+import org.apache.commons.lang3.builder.ToStringStyle;
7
+
8
+/**
9
+ * 流程实例关联表单对象 sys_instance_form
10
+ * 
11
+ * @author Tony
12
+ * @date 2021-03-30
13
+ */
14
+public class SysDeployForm extends BaseEntity
15
+{
16
+    private static final long serialVersionUID = 1L;
17
+
18
+    /** 主键 */
19
+    private Long id;
20
+
21
+    /** 表单主键 */
22
+    @Excel(name = "表单主键")
23
+    private Long formId;
24
+
25
+    /** 流程定义主键 */
26
+    @Excel(name = "流程定义主键")
27
+    private String deployId;
28
+
29
+    public void setId(Long id) 
30
+    {
31
+        this.id = id;
32
+    }
33
+
34
+    public Long getId() 
35
+    {
36
+        return id;
37
+    }
38
+    public void setFormId(Long formId) 
39
+    {
40
+        this.formId = formId;
41
+    }
42
+
43
+    public Long getFormId() 
44
+    {
45
+        return formId;
46
+    }
47
+
48
+    public String getDeployId() {
49
+        return deployId;
50
+    }
51
+
52
+    public void setDeployId(String deployId) {
53
+        this.deployId = deployId;
54
+    }
55
+
56
+    @Override
57
+    public String toString() {
58
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
59
+            .append("id", getId())
60
+            .append("formId", getFormId())
61
+            .append("deployId", getDeployId())
62
+            .toString();
63
+    }
64
+}

+ 95 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysExpression.java

@@ -0,0 +1,95 @@
1
+package com.ruoyi.system.domain;
2
+
3
+import com.ruoyi.common.annotation.Excel;
4
+import com.ruoyi.common.core.domain.BaseEntity;
5
+import org.apache.commons.lang3.builder.ToStringBuilder;
6
+import org.apache.commons.lang3.builder.ToStringStyle;
7
+
8
+/**
9
+ * 流程达式对象 sys_expression
10
+ *
11
+ * @author ruoyi
12
+ * @date 2022-12-12
13
+ */
14
+public class SysExpression extends BaseEntity
15
+{
16
+    private static final long serialVersionUID = 1L;
17
+
18
+    /** 表单主键 */
19
+    private Long id;
20
+
21
+    /** 表达式名称 */
22
+    @Excel(name = "表达式名称")
23
+    private String name;
24
+
25
+    /** 表达式内容 */
26
+    @Excel(name = "表达式内容")
27
+    private String expression;
28
+    /** 表达式类型 */
29
+    @Excel(name = "表达式类型")
30
+    private String dataType;
31
+
32
+    /** 状态 */
33
+    private Integer status;
34
+
35
+    public void setId(Long id)
36
+    {
37
+        this.id = id;
38
+    }
39
+
40
+    public Long getId()
41
+    {
42
+        return id;
43
+    }
44
+    public void setName(String name)
45
+    {
46
+        this.name = name;
47
+    }
48
+
49
+    public String getName()
50
+    {
51
+        return name;
52
+    }
53
+    public void setExpression(String expression)
54
+    {
55
+        this.expression = expression;
56
+    }
57
+
58
+    public String getExpression()
59
+    {
60
+        return expression;
61
+    }
62
+    public void setStatus(Integer status)
63
+    {
64
+        this.status = status;
65
+    }
66
+
67
+    public Integer getStatus()
68
+    {
69
+        return status;
70
+    }
71
+
72
+    public void setDataType(String dataType) {
73
+        this.dataType = dataType;
74
+    }
75
+    public String getDataType() {
76
+        return dataType;
77
+    }
78
+
79
+
80
+    @Override
81
+    public String toString() {
82
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
83
+            .append("id", getId())
84
+            .append("name", getName())
85
+            .append("expression", getExpression())
86
+            .append("dataType", getDataType())
87
+            .append("createTime", getCreateTime())
88
+            .append("updateTime", getUpdateTime())
89
+            .append("createBy", getCreateBy())
90
+            .append("updateBy", getUpdateBy())
91
+            .append("status", getStatus())
92
+            .append("remark", getRemark())
93
+            .toString();
94
+    }
95
+}

+ 70 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysForm.java

@@ -0,0 +1,70 @@
1
+package com.ruoyi.system.domain;
2
+
3
+import com.ruoyi.common.annotation.Excel;
4
+import com.ruoyi.common.core.domain.BaseEntity;
5
+import org.apache.commons.lang3.builder.ToStringBuilder;
6
+import org.apache.commons.lang3.builder.ToStringStyle;
7
+
8
+/**
9
+ * 流程表单对象 sys_task_form
10
+ * 
11
+ * @author Tony
12
+ * @date 2021-03-30
13
+ */
14
+public class SysForm extends BaseEntity
15
+{
16
+    private static final long serialVersionUID = 1L;
17
+
18
+    /** 表单主键 */
19
+    private Long formId;
20
+
21
+    /** 表单名称 */
22
+    @Excel(name = "表单名称")
23
+    private String formName;
24
+
25
+    /** 表单内容 */
26
+    @Excel(name = "表单内容")
27
+    private String formContent;
28
+
29
+    public void setFormId(Long formId) 
30
+    {
31
+        this.formId = formId;
32
+    }
33
+
34
+    public Long getFormId() 
35
+    {
36
+        return formId;
37
+    }
38
+    public void setFormName(String formName) 
39
+    {
40
+        this.formName = formName;
41
+    }
42
+
43
+    public String getFormName() 
44
+    {
45
+        return formName;
46
+    }
47
+    public void setFormContent(String formContent) 
48
+    {
49
+        this.formContent = formContent;
50
+    }
51
+
52
+    public String getFormContent() 
53
+    {
54
+        return formContent;
55
+    }
56
+
57
+    @Override
58
+    public String toString() {
59
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
60
+            .append("formId", getFormId())
61
+            .append("formName", getFormName())
62
+            .append("formContent", getFormContent())
63
+            .append("createTime", getCreateTime())
64
+            .append("updateTime", getUpdateTime())
65
+            .append("createBy", getCreateBy())
66
+            .append("updateBy", getUpdateBy())
67
+            .append("remark", getRemark())
68
+            .toString();
69
+    }
70
+}

+ 126 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysListener.java

@@ -0,0 +1,126 @@
1
+package com.ruoyi.system.domain;
2
+
3
+import com.ruoyi.common.annotation.Excel;
4
+import com.ruoyi.common.core.domain.BaseEntity;
5
+import org.apache.commons.lang3.builder.ToStringBuilder;
6
+import org.apache.commons.lang3.builder.ToStringStyle;
7
+
8
+/**
9
+ * 流程监听对象 sys_listener
10
+ *
11
+ * @author Tony
12
+ * @date 2022-12-25
13
+ */
14
+public class SysListener extends BaseEntity
15
+{
16
+    private static final long serialVersionUID = 1L;
17
+
18
+    /** 表单主键 */
19
+    private Long id;
20
+
21
+    /** 名称 */
22
+    @Excel(name = "名称")
23
+    private String name;
24
+
25
+    /** 监听类型 */
26
+    @Excel(name = "监听类型")
27
+    private String type;
28
+
29
+    /** 事件类型 */
30
+    @Excel(name = "事件类型")
31
+    private String eventType;
32
+
33
+    /** 值类型 */
34
+    @Excel(name = "值类型")
35
+    private String valueType;
36
+
37
+    /** 执行内容 */
38
+    @Excel(name = "执行内容")
39
+    private String value;
40
+
41
+    /** 状态 */
42
+    @Excel(name = "状态")
43
+    private Integer status;
44
+
45
+    public void setId(Long id)
46
+    {
47
+        this.id = id;
48
+    }
49
+
50
+    public Long getId()
51
+    {
52
+        return id;
53
+    }
54
+    public void setName(String name)
55
+    {
56
+        this.name = name;
57
+    }
58
+
59
+    public String getName()
60
+    {
61
+        return name;
62
+    }
63
+    public void setType(String type)
64
+    {
65
+        this.type = type;
66
+    }
67
+
68
+    public String getType()
69
+    {
70
+        return type;
71
+    }
72
+    public void setEventType(String eventType)
73
+    {
74
+        this.eventType = eventType;
75
+    }
76
+
77
+    public String getEventType()
78
+    {
79
+        return eventType;
80
+    }
81
+    public void setValueType(String valueType)
82
+    {
83
+        this.valueType = valueType;
84
+    }
85
+
86
+    public String getValueType()
87
+    {
88
+        return valueType;
89
+    }
90
+    public void setValue(String value)
91
+    {
92
+        this.value = value;
93
+    }
94
+
95
+    public String getValue()
96
+    {
97
+        return value;
98
+    }
99
+    public void setStatus(Integer status)
100
+    {
101
+        this.status = status;
102
+    }
103
+
104
+    public Integer getStatus()
105
+    {
106
+        return status;
107
+    }
108
+
109
+    @Override
110
+    public String toString() {
111
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
112
+            .append("id", getId())
113
+            .append("name", getName())
114
+            .append("type", getType())
115
+            .append("eventType", getEventType())
116
+            .append("valueType", getValueType())
117
+            .append("value", getValue())
118
+            .append("createTime", getCreateTime())
119
+            .append("updateTime", getUpdateTime())
120
+            .append("createBy", getCreateBy())
121
+            .append("updateBy", getUpdateBy())
122
+            .append("status", getStatus())
123
+            .append("remark", getRemark())
124
+            .toString();
125
+    }
126
+}

+ 22 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/mapper/FlowDeployMapper.java

@@ -0,0 +1,22 @@
1
+package com.ruoyi.system.mapper;
2
+
3
+import com.ruoyi.system.domain.FlowProcDefDto;
4
+
5
+import java.util.List;
6
+
7
+/**
8
+ * 流程定义查询
9
+ *
10
+ * @author Tony
11
+ * @email
12
+ * @date 2022/1/29 5:44 下午
13
+ **/
14
+public interface FlowDeployMapper {
15
+
16
+    /**
17
+     * 流程定义列表
18
+     * @param name
19
+     * @return
20
+     */
21
+    List<FlowProcDefDto> selectDeployList(String name);
22
+}

+ 74 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeployFormMapper.java

@@ -0,0 +1,74 @@
1
+package com.ruoyi.system.mapper;
2
+
3
+import com.ruoyi.system.domain.SysDeployForm;
4
+import com.ruoyi.system.domain.SysForm;
5
+import org.springframework.stereotype.Component;
6
+
7
+import java.util.List;
8
+
9
+/**
10
+ * 流程实例关联表单Mapper接口
11
+ *
12
+ * @author Tony
13
+ * @date 2021-03-30
14
+ */
15
+@Component
16
+public interface SysDeployFormMapper
17
+{
18
+    /**
19
+     * 查询流程实例关联表单
20
+     *
21
+     * @param id 流程实例关联表单ID
22
+     * @return 流程实例关联表单
23
+     */
24
+    public SysDeployForm selectSysDeployFormById(Long id);
25
+
26
+    /**
27
+     * 查询流程实例关联表单列表
28
+     *
29
+     * @param SysDeployForm 流程实例关联表单
30
+     * @return 流程实例关联表单集合
31
+     */
32
+    public List<SysDeployForm> selectSysDeployFormList(SysDeployForm SysDeployForm);
33
+
34
+    /**
35
+     * 新增流程实例关联表单
36
+     *
37
+     * @param SysDeployForm 流程实例关联表单
38
+     * @return 结果
39
+     */
40
+    public int insertSysDeployForm(SysDeployForm SysDeployForm);
41
+
42
+    /**
43
+     * 修改流程实例关联表单
44
+     *
45
+     * @param SysDeployForm 流程实例关联表单
46
+     * @return 结果
47
+     */
48
+    public int updateSysDeployForm(SysDeployForm SysDeployForm);
49
+
50
+    /**
51
+     * 删除流程实例关联表单
52
+     *
53
+     * @param id 流程实例关联表单ID
54
+     * @return 结果
55
+     */
56
+    public int deleteSysDeployFormById(Long id);
57
+
58
+    /**
59
+     * 批量删除流程实例关联表单
60
+     *
61
+     * @param ids 需要删除的数据ID
62
+     * @return 结果
63
+     */
64
+    public int deleteSysDeployFormByIds(Long[] ids);
65
+
66
+
67
+
68
+    /**
69
+     * 查询流程挂着的表单
70
+     * @param deployId
71
+     * @return
72
+     */
73
+    SysForm selectSysDeployFormByDeployId(String deployId);
74
+}

+ 64 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysExpressionMapper.java

@@ -0,0 +1,64 @@
1
+package com.ruoyi.system.mapper;
2
+
3
+import com.ruoyi.system.domain.SysExpression;
4
+import org.springframework.stereotype.Component;
5
+
6
+import java.util.List;
7
+
8
+/**
9
+ * 流程达式Mapper接口
10
+ *
11
+ * @author ruoyi
12
+ * @date 2022-12-12
13
+ */
14
+@Component
15
+public interface SysExpressionMapper
16
+{
17
+    /**
18
+     * 查询流程达式
19
+     *
20
+     * @param id 流程达式主键
21
+     * @return 流程达式
22
+     */
23
+    public SysExpression selectSysExpressionById(Long id);
24
+
25
+    /**
26
+     * 查询流程达式列表
27
+     *
28
+     * @param sysExpression 流程达式
29
+     * @return 流程达式集合
30
+     */
31
+    public List<SysExpression> selectSysExpressionList(SysExpression sysExpression);
32
+
33
+    /**
34
+     * 新增流程达式
35
+     *
36
+     * @param sysExpression 流程达式
37
+     * @return 结果
38
+     */
39
+    public int insertSysExpression(SysExpression sysExpression);
40
+
41
+    /**
42
+     * 修改流程达式
43
+     *
44
+     * @param sysExpression 流程达式
45
+     * @return 结果
46
+     */
47
+    public int updateSysExpression(SysExpression sysExpression);
48
+
49
+    /**
50
+     * 删除流程达式
51
+     *
52
+     * @param id 流程达式主键
53
+     * @return 结果
54
+     */
55
+    public int deleteSysExpressionById(Long id);
56
+
57
+    /**
58
+     * 批量删除流程达式
59
+     *
60
+     * @param ids 需要删除的数据主键集合
61
+     * @return 结果
62
+     */
63
+    public int deleteSysExpressionByIds(Long[] ids);
64
+}

+ 64 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysFormMapper.java

@@ -0,0 +1,64 @@
1
+package com.ruoyi.system.mapper;
2
+
3
+import com.ruoyi.system.domain.SysForm;
4
+import org.springframework.stereotype.Component;
5
+
6
+import java.util.List;
7
+
8
+/**
9
+ * 流程表单Mapper接口
10
+ *
11
+ * @author Tony
12
+ * @date 2021-03-30
13
+ */
14
+@Component
15
+public interface SysFormMapper
16
+{
17
+    /**
18
+     * 查询流程表单
19
+     *
20
+     * @param formId 流程表单ID
21
+     * @return 流程表单
22
+     */
23
+    public SysForm selectSysFormById(Long formId);
24
+
25
+    /**
26
+     * 查询流程表单列表
27
+     *
28
+     * @param sysForm 流程表单
29
+     * @return 流程表单集合
30
+     */
31
+    public List<SysForm> selectSysFormList(SysForm sysForm);
32
+
33
+    /**
34
+     * 新增流程表单
35
+     *
36
+     * @param sysForm 流程表单
37
+     * @return 结果
38
+     */
39
+    public int insertSysForm(SysForm sysForm);
40
+
41
+    /**
42
+     * 修改流程表单
43
+     *
44
+     * @param sysForm 流程表单
45
+     * @return 结果
46
+     */
47
+    public int updateSysForm(SysForm sysForm);
48
+
49
+    /**
50
+     * 删除流程表单
51
+     *
52
+     * @param formId 流程表单ID
53
+     * @return 结果
54
+     */
55
+    public int deleteSysFormById(Long formId);
56
+
57
+    /**
58
+     * 批量删除流程表单
59
+     *
60
+     * @param formIds 需要删除的数据ID
61
+     * @return 结果
62
+     */
63
+    public int deleteSysFormByIds(Long[] formIds);
64
+}

+ 64 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysListenerMapper.java

@@ -0,0 +1,64 @@
1
+package com.ruoyi.system.mapper;
2
+
3
+import com.ruoyi.system.domain.SysListener;
4
+import org.springframework.stereotype.Component;
5
+
6
+import java.util.List;
7
+
8
+/**
9
+ * 流程监听Mapper接口
10
+ *
11
+ * @author Tony
12
+ * @date 2022-12-25
13
+ */
14
+@Component
15
+public interface SysListenerMapper
16
+{
17
+    /**
18
+     * 查询流程监听
19
+     *
20
+     * @param id 流程监听主键
21
+     * @return 流程监听
22
+     */
23
+    public SysListener selectSysListenerById(Long id);
24
+
25
+    /**
26
+     * 查询流程监听列表
27
+     *
28
+     * @param sysListener 流程监听
29
+     * @return 流程监听集合
30
+     */
31
+    public List<SysListener> selectSysListenerList(SysListener sysListener);
32
+
33
+    /**
34
+     * 新增流程监听
35
+     *
36
+     * @param sysListener 流程监听
37
+     * @return 结果
38
+     */
39
+    public int insertSysListener(SysListener sysListener);
40
+
41
+    /**
42
+     * 修改流程监听
43
+     *
44
+     * @param sysListener 流程监听
45
+     * @return 结果
46
+     */
47
+    public int updateSysListener(SysListener sysListener);
48
+
49
+    /**
50
+     * 删除流程监听
51
+     *
52
+     * @param id 流程监听主键
53
+     * @return 结果
54
+     */
55
+    public int deleteSysListenerById(Long id);
56
+
57
+    /**
58
+     * 批量删除流程监听
59
+     *
60
+     * @param ids 需要删除的数据主键集合
61
+     * @return 结果
62
+     */
63
+    public int deleteSysListenerByIds(Long[] ids);
64
+}

+ 62 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysExpressionService.java

@@ -0,0 +1,62 @@
1
+package com.ruoyi.system.service;
2
+
3
+import com.ruoyi.system.domain.SysExpression;
4
+
5
+import java.util.List;
6
+
7
+/**
8
+ * 流程达式Service接口
9
+ *
10
+ * @author ruoyi
11
+ * @date 2022-12-12
12
+ */
13
+public interface ISysExpressionService
14
+{
15
+    /**
16
+     * 查询流程达式
17
+     *
18
+     * @param id 流程达式主键
19
+     * @return 流程达式
20
+     */
21
+    public SysExpression selectSysExpressionById(Long id);
22
+
23
+    /**
24
+     * 查询流程达式列表
25
+     *
26
+     * @param sysExpression 流程达式
27
+     * @return 流程达式集合
28
+     */
29
+    public List<SysExpression> selectSysExpressionList(SysExpression sysExpression);
30
+
31
+    /**
32
+     * 新增流程达式
33
+     *
34
+     * @param sysExpression 流程达式
35
+     * @return 结果
36
+     */
37
+    public int insertSysExpression(SysExpression sysExpression);
38
+
39
+    /**
40
+     * 修改流程达式
41
+     *
42
+     * @param sysExpression 流程达式
43
+     * @return 结果
44
+     */
45
+    public int updateSysExpression(SysExpression sysExpression);
46
+
47
+    /**
48
+     * 批量删除流程达式
49
+     *
50
+     * @param ids 需要删除的流程达式主键集合
51
+     * @return 结果
52
+     */
53
+    public int deleteSysExpressionByIds(Long[] ids);
54
+
55
+    /**
56
+     * 删除流程达式信息
57
+     *
58
+     * @param id 流程达式主键
59
+     * @return 结果
60
+     */
61
+    public int deleteSysExpressionById(Long id);
62
+}

+ 62 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysListenerService.java

@@ -0,0 +1,62 @@
1
+package com.ruoyi.system.service;
2
+
3
+import com.ruoyi.system.domain.SysListener;
4
+
5
+import java.util.List;
6
+
7
+/**
8
+ * 流程监听Service接口
9
+ *
10
+ * @author Tony
11
+ * @date 2022-12-25
12
+ */
13
+public interface ISysListenerService
14
+{
15
+    /**
16
+     * 查询流程监听
17
+     *
18
+     * @param id 流程监听主键
19
+     * @return 流程监听
20
+     */
21
+    public SysListener selectSysListenerById(Long id);
22
+
23
+    /**
24
+     * 查询流程监听列表
25
+     *
26
+     * @param sysListener 流程监听
27
+     * @return 流程监听集合
28
+     */
29
+    public List<SysListener> selectSysListenerList(SysListener sysListener);
30
+
31
+    /**
32
+     * 新增流程监听
33
+     *
34
+     * @param sysListener 流程监听
35
+     * @return 结果
36
+     */
37
+    public int insertSysListener(SysListener sysListener);
38
+
39
+    /**
40
+     * 修改流程监听
41
+     *
42
+     * @param sysListener 流程监听
43
+     * @return 结果
44
+     */
45
+    public int updateSysListener(SysListener sysListener);
46
+
47
+    /**
48
+     * 批量删除流程监听
49
+     *
50
+     * @param ids 需要删除的流程监听主键集合
51
+     * @return 结果
52
+     */
53
+    public int deleteSysListenerByIds(Long[] ids);
54
+
55
+    /**
56
+     * 删除流程监听信息
57
+     *
58
+     * @param id 流程监听主键
59
+     * @return 结果
60
+     */
61
+    public int deleteSysListenerById(Long id);
62
+}

+ 97 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysExpressionServiceImpl.java

@@ -0,0 +1,97 @@
1
+package com.ruoyi.system.service.impl;
2
+
3
+import com.ruoyi.common.utils.DateUtils;
4
+import com.ruoyi.system.domain.SysExpression;
5
+import com.ruoyi.system.mapper.SysExpressionMapper;
6
+import com.ruoyi.system.service.ISysExpressionService;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.stereotype.Service;
9
+
10
+import java.util.List;
11
+
12
+/**
13
+ * 流程达式Service业务层处理
14
+ *
15
+ * @author ruoyi
16
+ * @date 2022-12-12
17
+ */
18
+@Service
19
+public class SysExpressionServiceImpl implements ISysExpressionService
20
+{
21
+    @Autowired
22
+    private SysExpressionMapper sysExpressionMapper;
23
+
24
+    /**
25
+     * 查询流程达式
26
+     *
27
+     * @param id 流程达式主键
28
+     * @return 流程达式
29
+     */
30
+    @Override
31
+    public SysExpression selectSysExpressionById(Long id)
32
+    {
33
+        return sysExpressionMapper.selectSysExpressionById(id);
34
+    }
35
+
36
+    /**
37
+     * 查询流程达式列表
38
+     *
39
+     * @param sysExpression 流程达式
40
+     * @return 流程达式
41
+     */
42
+    @Override
43
+    public List<SysExpression> selectSysExpressionList(SysExpression sysExpression)
44
+    {
45
+        return sysExpressionMapper.selectSysExpressionList(sysExpression);
46
+    }
47
+
48
+    /**
49
+     * 新增流程达式
50
+     *
51
+     * @param sysExpression 流程达式
52
+     * @return 结果
53
+     */
54
+    @Override
55
+    public int insertSysExpression(SysExpression sysExpression)
56
+    {
57
+        sysExpression.setCreateTime(DateUtils.getNowDate());
58
+        return sysExpressionMapper.insertSysExpression(sysExpression);
59
+    }
60
+
61
+    /**
62
+     * 修改流程达式
63
+     *
64
+     * @param sysExpression 流程达式
65
+     * @return 结果
66
+     */
67
+    @Override
68
+    public int updateSysExpression(SysExpression sysExpression)
69
+    {
70
+        sysExpression.setUpdateTime(DateUtils.getNowDate());
71
+        return sysExpressionMapper.updateSysExpression(sysExpression);
72
+    }
73
+
74
+    /**
75
+     * 批量删除流程达式
76
+     *
77
+     * @param ids 需要删除的流程达式主键
78
+     * @return 结果
79
+     */
80
+    @Override
81
+    public int deleteSysExpressionByIds(Long[] ids)
82
+    {
83
+        return sysExpressionMapper.deleteSysExpressionByIds(ids);
84
+    }
85
+
86
+    /**
87
+     * 删除流程达式信息
88
+     *
89
+     * @param id 流程达式主键
90
+     * @return 结果
91
+     */
92
+    @Override
93
+    public int deleteSysExpressionById(Long id)
94
+    {
95
+        return sysExpressionMapper.deleteSysExpressionById(id);
96
+    }
97
+}

+ 97 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysListenerServiceImpl.java

@@ -0,0 +1,97 @@
1
+package com.ruoyi.system.service.impl;
2
+
3
+import com.ruoyi.common.utils.DateUtils;
4
+import com.ruoyi.system.domain.SysListener;
5
+import com.ruoyi.system.mapper.SysListenerMapper;
6
+import com.ruoyi.system.service.ISysListenerService;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.stereotype.Service;
9
+
10
+import java.util.List;
11
+
12
+/**
13
+ * 流程监听Service业务层处理
14
+ *
15
+ * @author Tony
16
+ * @date 2022-12-25
17
+ */
18
+@Service
19
+public class SysListenerServiceImpl implements ISysListenerService
20
+{
21
+    @Autowired
22
+    private SysListenerMapper sysListenerMapper;
23
+
24
+    /**
25
+     * 查询流程监听
26
+     *
27
+     * @param id 流程监听主键
28
+     * @return 流程监听
29
+     */
30
+    @Override
31
+    public SysListener selectSysListenerById(Long id)
32
+    {
33
+        return sysListenerMapper.selectSysListenerById(id);
34
+    }
35
+
36
+    /**
37
+     * 查询流程监听列表
38
+     *
39
+     * @param sysListener 流程监听
40
+     * @return 流程监听
41
+     */
42
+    @Override
43
+    public List<SysListener> selectSysListenerList(SysListener sysListener)
44
+    {
45
+        return sysListenerMapper.selectSysListenerList(sysListener);
46
+    }
47
+
48
+    /**
49
+     * 新增流程监听
50
+     *
51
+     * @param sysListener 流程监听
52
+     * @return 结果
53
+     */
54
+    @Override
55
+    public int insertSysListener(SysListener sysListener)
56
+    {
57
+        sysListener.setCreateTime(DateUtils.getNowDate());
58
+        return sysListenerMapper.insertSysListener(sysListener);
59
+    }
60
+
61
+    /**
62
+     * 修改流程监听
63
+     *
64
+     * @param sysListener 流程监听
65
+     * @return 结果
66
+     */
67
+    @Override
68
+    public int updateSysListener(SysListener sysListener)
69
+    {
70
+        sysListener.setUpdateTime(DateUtils.getNowDate());
71
+        return sysListenerMapper.updateSysListener(sysListener);
72
+    }
73
+
74
+    /**
75
+     * 批量删除流程监听
76
+     *
77
+     * @param ids 需要删除的流程监听主键
78
+     * @return 结果
79
+     */
80
+    @Override
81
+    public int deleteSysListenerByIds(Long[] ids)
82
+    {
83
+        return sysListenerMapper.deleteSysListenerByIds(ids);
84
+    }
85
+
86
+    /**
87
+     * 删除流程监听信息
88
+     *
89
+     * @param id 流程监听主键
90
+     * @return 结果
91
+     */
92
+    @Override
93
+    public int deleteSysListenerById(Long id)
94
+    {
95
+        return sysListenerMapper.deleteSysListenerById(id);
96
+    }
97
+}

+ 90 - 0
RuoYi-Vue-master/RuoYi-Vue-master/ruoyi-system/src/main/resources/mapper/system/SysExpressionMapper.xml

@@ -0,0 +1,90 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper
3
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5
+<mapper namespace="com.ruoyi.system.mapper.SysExpressionMapper">
6
+
7
+    <resultMap type="SysExpression" id="SysExpressionResult">
8
+        <result property="id"    column="id"    />
9
+        <result property="name"    column="name"    />
10
+        <result property="expression"    column="expression"    />
11
+        <result property="dataType" column="data_type"/>
12
+        <result property="createTime"    column="create_time"    />
13
+        <result property="updateTime"    column="update_time"    />
14
+        <result property="createBy"    column="create_by"    />
15
+        <result property="updateBy"    column="update_by"    />
16
+        <result property="status"    column="status"    />
17
+        <result property="remark"    column="remark"    />
18
+    </resultMap>
19
+
20
+    <sql id="selectSysExpressionVo">
21
+        select id, name, expression, data_type,create_time, update_time, create_by, update_by, status, remark from sys_expression
22
+    </sql>
23
+
24
+    <select id="selectSysExpressionList" parameterType="SysExpression" resultMap="SysExpressionResult">
25
+        <include refid="selectSysExpressionVo"/>
26
+        <where>
27
+            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
28
+            <if test="expression != null  and expression != ''"> and expression = #{expression}</if>
29
+            <if test="status != null "> and status = #{status}</if>
30
+        </where>
31
+    </select>
32
+
33
+    <select id="selectSysExpressionById" parameterType="Long" resultMap="SysExpressionResult">
34
+        <include refid="selectSysExpressionVo"/>
35
+        where id = #{id}
36
+    </select>
37
+
38
+    <insert id="insertSysExpression" parameterType="SysExpression" useGeneratedKeys="true" keyProperty="id">
39
+        insert into sys_expression
40
+        <trim prefix="(" suffix=")" suffixOverrides=",">
41
+            <if test="name != null">name,</if>
42
+            <if test="expression != null">expression,</if>
43
+            <if test="dataType != null">data_type,</if>
44
+            <if test="createTime != null">create_time,</if>
45
+            <if test="updateTime != null">update_time,</if>
46
+            <if test="createBy != null">create_by,</if>
47
+            <if test="updateBy != null">update_by,</if>
48
+            <if test="status != null">status,</if>
49
+            <if test="remark != null">remark,</if>
50
+         </trim>
51
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
52
+            <if test="name != null">#{name},</if>
53
+            <if test="expression != null">#{expression},</if>
54
+            <if test="dataType != null">#{dataType},</if>
55
+            <if test="createTime != null">#{createTime},</if>
56
+            <if test="updateTime != null">#{updateTime},</if>
57
+            <if test="createBy != null">#{createBy},</if>
58
+            <if test="updateBy != null">#{updateBy},</if>
59
+            <if test="status != null">#{status},</if>
60
+            <if test="remark != null">#{remark},</if>
61
+         </trim>
62
+    </insert>
63
+
64
+    <update id="updateSysExpression" parameterType="SysExpression">
65
+        update sys_expression
66
+        <trim prefix="SET" suffixOverrides=",">
67
+            <if test="name != null">name = #{name},</if>
68
+            <if test="expression != null">expression = #{expression},</if>
69
+            <if test="dataType != null">data_type = #{dataType},</if>
70
+            <if test="createTime != null">create_time = #{createTime},</if>
71
+            <if test="updateTime != null">update_time = #{updateTime},</if>
72
+            <if test="createBy != null">create_by = #{createBy},</if>
73
+            <if test="updateBy != null">update_by = #{updateBy},</if>
74
+            <if test="status != null">status = #{status},</if>
75
+            <if test="remark != null">remark = #{remark},</if>
76
+        </trim>
77
+        where id = #{id}
78
+    </update>
79
+
80
+    <delete id="deleteSysExpressionById" parameterType="Long">
81
+        delete from sys_expression where id = #{id}
82
+    </delete>
83
+
84
+    <delete id="deleteSysExpressionByIds" parameterType="String">
85
+        delete from sys_expression where id in
86
+        <foreach item="id" collection="array" open="(" separator="," close=")">
87
+            #{id}
88
+        </foreach>
89
+    </delete>
90
+</mapper>

+ 110 - 0
RuoYi-Vue-master/RuoYi-Vue-master/sql/tony-flowable.sql

@@ -0,0 +1,110 @@
1
+-- sys_deploy_form definition
2
+
3
+CREATE TABLE `sys_deploy_form`
4
+(
5
+    `id`        bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
6
+    `form_id`   bigint(20) DEFAULT NULL COMMENT '表单主键',
7
+    `deploy_id` varchar(50) DEFAULT NULL COMMENT '流程实例主键',
8
+    PRIMARY KEY (`id`) USING BTREE
9
+) ENGINE=InnoDB AUTO_INCREMENT=9623 DEFAULT CHARSET=utf8mb4 COMMENT='流程实例关联表单';
10
+
11
+-- sys_expression definition
12
+
13
+CREATE TABLE `sys_expression`
14
+(
15
+    `id`          bigint(20) NOT NULL AUTO_INCREMENT COMMENT '表单主键',
16
+    `name`        varchar(50)  DEFAULT NULL COMMENT '表达式名称',
17
+    `expression`  varchar(255) DEFAULT NULL COMMENT '表达式内容',
18
+    `data_type`   varchar(255) DEFAULT NULL COMMENT '表达式类型',
19
+    `create_time` datetime     DEFAULT NULL COMMENT '创建时间',
20
+    `update_time` datetime     DEFAULT NULL COMMENT '更新时间',
21
+    `create_by`   bigint(20) DEFAULT NULL COMMENT '创建人员',
22
+    `update_by`   bigint(20) DEFAULT NULL COMMENT '更新人员',
23
+    `status`      tinyint(2) DEFAULT '0' COMMENT '状态',
24
+    `remark`      varchar(255) DEFAULT NULL COMMENT '备注',
25
+    PRIMARY KEY (`id`) USING BTREE
26
+) ENGINE=InnoDB AUTO_INCREMENT=69 DEFAULT CHARSET=utf8mb4 COMMENT='流程表达式';
27
+
28
+
29
+-- sys_form definition
30
+
31
+CREATE TABLE `sys_form`
32
+(
33
+    `form_id`      bigint(20) NOT NULL AUTO_INCREMENT COMMENT '表单主键',
34
+    `form_name`    varchar(50)  DEFAULT NULL COMMENT '表单名称',
35
+    `form_content` longtext COMMENT '表单内容',
36
+    `create_time`  datetime     DEFAULT NULL COMMENT '创建时间',
37
+    `update_time`  datetime     DEFAULT NULL COMMENT '更新时间',
38
+    `create_by`    bigint(20) DEFAULT NULL COMMENT '创建人员',
39
+    `update_by`    bigint(20) DEFAULT NULL COMMENT '更新人员',
40
+    `remark`       varchar(255) DEFAULT NULL COMMENT '备注',
41
+    PRIMARY KEY (`form_id`) USING BTREE
42
+) ENGINE=InnoDB AUTO_INCREMENT=3936 DEFAULT CHARSET=utf8mb4 COMMENT='流程表单';
43
+
44
+
45
+-- sys_listener definition
46
+
47
+CREATE TABLE `sys_listener`
48
+(
49
+    `id`          bigint(20) NOT NULL AUTO_INCREMENT COMMENT '表单主键',
50
+    `name`        varchar(128) DEFAULT NULL COMMENT '名称',
51
+    `type`        char(2)      DEFAULT NULL COMMENT '监听类型',
52
+    `event_type`  varchar(32)  DEFAULT NULL COMMENT '事件类型',
53
+    `value_type`  varchar(32)  DEFAULT NULL COMMENT '值类型',
54
+    `value`       varchar(255) DEFAULT NULL COMMENT '执行内容',
55
+    `create_time` datetime     DEFAULT NULL COMMENT '创建时间',
56
+    `update_time` datetime     DEFAULT NULL COMMENT '更新时间',
57
+    `create_by`   bigint(20) DEFAULT NULL COMMENT '创建人员',
58
+    `update_by`   bigint(20) DEFAULT NULL COMMENT '更新人员',
59
+    `status`      tinyint(2) DEFAULT '0' COMMENT '状态',
60
+    `remark`      varchar(255) DEFAULT NULL COMMENT '备注',
61
+    PRIMARY KEY (`id`) USING BTREE
62
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='流程监听';
63
+
64
+
65
+-- 流程相关菜单
66
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3020, '流程管理', 0, 6, 'flowable', NULL, NULL, NULL, 1, 0, 'M', '0', '0', '', 'cascader', 'tony', '2021-03-25 11:35:09', 'admin', '2022-12-29 17:39:22', '');
67
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3022, '流程定义', 3020, 2, 'definition', 'flowable/definition/index', NULL, NULL, 1, 0, 'C', '0', '0', '', 'job', 'tony', '2021-03-25 13:53:55', 'admin', '2022-12-29 17:40:39', '');
68
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3023, '任务管理', 0, 7, 'task', NULL, NULL, NULL, 1, 0, 'M', '0', '0', '', 'dict', 'tony', '2021-03-26 10:53:10', 'admin', '2021-03-29 09:37:40', '');
69
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3024, '待办任务', 3023, 2, 'todo', 'flowable/task/todo/index', NULL, NULL, 1, 1, 'C', '0', '0', '', 'cascader', 'admin', '2021-03-26 10:55:52', 'admin', '2021-03-30 09:26:36', '');
70
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3025, '已办任务', 3023, 3, 'finished', 'flowable/task/finished/index', NULL, NULL, 1, 1, 'C', '0', '0', '', 'time-range', 'admin', '2021-03-26 10:57:54', 'admin', '2021-03-30 09:26:50', '');
71
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3026, '已发任务', 3023, 1, 'process', 'flowable/task/myProcess/index', NULL, NULL, 1, 1, 'C', '0', '0', '', 'guide', 'admin', '2021-03-30 09:26:23', 'admin', '2022-12-12 09:58:07', '');
72
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3027, '表单配置', 3020, 2, 'form', 'flowable/task/form/index', NULL, NULL, 1, 1, 'C', '0', '0', 'flowable:form:list', 'form', 'admin', '2021-03-30 22:55:12', 'admin', '2023-08-19 15:54:57', '');
73
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3028, '新增', 3027, 1, '', NULL, NULL, NULL, 1, 0, 'F', '0', '0', 'flowable:form:add', '#', 'admin', '2021-07-07 14:23:37', 'admin', '2023-08-16 09:17:38', '');
74
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3029, '删除', 3027, 3, '', NULL, NULL, NULL, 1, 0, 'F', '0', '0', 'flowable:form:remove', '#', 'admin', '2021-07-07 14:24:10', '', NULL, '');
75
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3030, '编辑', 3027, 2, '', NULL, NULL, NULL, 1, 0, 'F', '0', '0', 'flowable:form:edit', '#', 'admin', '2021-07-07 14:24:31', '', NULL, '');
76
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3031, '新增', 3026, 1, '', NULL, NULL, NULL, 1, 0, 'F', '0', '0', 'system:deployment:add', '#', 'admin', '2021-07-07 14:25:22', '', NULL, '');
77
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3032, '编辑', 3026, 2, '', NULL, NULL, NULL, 1, 0, 'F', '0', '0', 'system:deployment:edit', '#', 'admin', '2021-07-07 14:25:47', '', NULL, '');
78
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3033, '删除', 3026, 3, '', NULL, NULL, NULL, 1, 0, 'F', '0', '0', 'system:deployment:remove', '#', 'admin', '2021-07-07 14:26:02', '', NULL, '');
79
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3034, '查询', 3027, 4, '', NULL, NULL, NULL, 1, 0, 'F', '0', '0', 'flowable:form:query', '#', 'admin', '2021-07-08 14:05:22', '', NULL, '');
80
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3035, '修改密码', 100, 8, '', NULL, NULL, NULL, 1, 0, 'F', '0', '0', 'system:user:updatePwd', '#', 'admin', '2022-04-29 11:27:13', '', NULL, '');
81
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3036, '流程表达式', 3020, 3, 'expression', 'flowable/expression/index', NULL, NULL, 1, 1, 'C', '0', '0', 'system:expression:list', 'list', 'admin', '2022-12-12 17:12:19', 'admin', '2022-12-12 17:13:44', '流程达式菜单');
82
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3037, '流程达式查询', 3036, 1, '#', '', NULL, NULL, 1, 0, 'F', '0', '0', 'system:expression:query', '#', 'admin', '2022-12-12 17:12:19', '', NULL, '');
83
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3038, '流程达式新增', 3036, 2, '#', '', NULL, NULL, 1, 0, 'F', '0', '0', 'system:expression:add', '#', 'admin', '2022-12-12 17:12:19', '', NULL, '');
84
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3039, '流程达式修改', 3036, 3, '#', '', NULL, NULL, 1, 0, 'F', '0', '0', 'system:expression:edit', '#', 'admin', '2022-12-12 17:12:19', '', NULL, '');
85
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3040, '流程达式删除', 3036, 4, '#', '', NULL, NULL, 1, 0, 'F', '0', '0', 'system:expression:remove', '#', 'admin', '2022-12-12 17:12:19', '', NULL, '');
86
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3041, '流程达式导出', 3036, 5, '#', '', NULL, NULL, 1, 0, 'F', '0', '0', 'system:expression:export', '#', 'admin', '2022-12-12 17:12:19', '', NULL, '');
87
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3042, '流程监听', 3020, 4, 'listener', 'flowable/listener/index', NULL, NULL, 1, 0, 'C', '0', '0', 'system:listener:list', 'monitor', 'admin', '2022-12-25 11:44:16', 'admin', '2022-12-29 08:59:21', '流程监听菜单');
88
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3043, '流程监听查询', 3042, 1, '#', '', NULL, NULL, 1, 0, 'F', '0', '0', 'system:listener:query', '#', 'admin', '2022-12-25 11:44:16', '', NULL, '');
89
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3044, '流程监听新增', 3042, 2, '#', '', NULL, NULL, 1, 0, 'F', '0', '0', 'system:listener:add', '#', 'admin', '2022-12-25 11:44:16', '', NULL, '');
90
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3045, '流程监听修改', 3042, 3, '#', '', NULL, NULL, 1, 0, 'F', '0', '0', 'system:listener:edit', '#', 'admin', '2022-12-25 11:44:16', '', NULL, '');
91
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3046, '流程监听删除', 3042, 4, '#', '', NULL, NULL, 1, 0, 'F', '0', '0', 'system:listener:remove', '#', 'admin', '2022-12-25 11:44:16', '', NULL, '');
92
+INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, `path`, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES(3047, '流程监听导出', 3042, 5, '#', '', NULL, NULL, 1, 0, 'F', '0', '0', 'system:listener:export', '#', 'admin', '2022-12-25 11:44:16', '', NULL, '');
93
+
94
+-- 流程相关字段表信息
95
+INSERT INTO sys_dict_type (dict_id, dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) VALUES(200, '表达式类型', 'exp_data_type', '0', 'admin', '2024-03-12 09:03:02', '', NULL, NULL);
96
+INSERT INTO sys_dict_type (dict_id, dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) VALUES(202, '监听类型', 'sys_listener_type', '0', 'admin', '2022-12-18 22:03:07', '', NULL, NULL);
97
+INSERT INTO sys_dict_type (dict_id, dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) VALUES(203, '监听值类型', 'sys_listener_value_type', '0', 'admin', '2022-12-18 22:03:39', '', NULL, NULL);
98
+INSERT INTO sys_dict_type (dict_id, dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) VALUES(204, '监听属性', 'sys_listener_event_type', '0', 'admin', '2022-12-18 22:04:29', '', NULL, NULL);
99
+INSERT INTO sys_dict_type (dict_id, dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) VALUES(205, '流程分类', 'sys_process_category', '0', 'admin', '2024-03-12 09:08:18', '', NULL, NULL);
100
+
101
+
102
+INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES(100, 0, '系统指定', 'fixed', 'exp_data_type', NULL, 'default', 'N', '0', 'admin', '2024-03-12 09:04:46', '', NULL, NULL);
103
+INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES(101, 0, '动态选择', 'dynamic', 'exp_data_type', NULL, 'default', 'N', '0', 'admin', '2024-03-12 09:05:02', '', NULL, NULL);
104
+INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES(104, 0, '任务监听', '1', 'sys_listener_type', NULL, 'default', 'N', '0', 'admin', '2022-12-25 11:47:26', '', NULL, NULL);
105
+INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES(105, 2, '执行监听', '2', 'sys_listener_type', NULL, 'default', 'N', '0', 'admin', '2022-12-25 11:47:37', '', NULL, NULL);
106
+INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES(106, 0, 'JAVA类', 'classListener', 'sys_listener_value_type', NULL, 'default', 'N', '0', 'admin', '2022-12-25 11:48:55', 'admin', '2024-09-05 21:38:02', NULL);
107
+INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES(107, 0, '表达式', 'expressionListener', 'sys_listener_value_type', NULL, 'default', 'N', '0', 'admin', '2022-12-25 11:49:05', 'admin', '2024-09-05 21:38:10', NULL);
108
+INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES(108, 0, '代理表达式', 'delegateExpressionListener', 'sys_listener_value_type', NULL, 'default', 'N', '0', 'admin', '2022-12-25 11:49:16', 'admin', '2024-09-05 21:38:16', NULL);
109
+INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES(109, 0, '请假', 'leave', 'sys_process_category', NULL, 'default', 'N', '0', 'admin', '2024-03-12 09:08:42', '', NULL, NULL);
110
+INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES(110, 0, '报销', 'expense', 'sys_process_category', NULL, 'default', 'N', '0', 'admin', '2024-03-12 09:09:02', '', NULL, NULL);

+ 12 - 0
RuoYi-Vue-master/RuoYi-Vue-master/train/pom.xml

@@ -2,6 +2,18 @@
2 2
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3 3
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4 4
     <modelVersion>4.0.0</modelVersion>
5
+    <build>
6
+        <plugins>
7
+            <plugin>
8
+                <groupId>org.apache.maven.plugins</groupId>
9
+                <artifactId>maven-compiler-plugin</artifactId>
10
+                <configuration>
11
+                    <source>8</source>
12
+                    <target>8</target>
13
+                </configuration>
14
+            </plugin>
15
+        </plugins>
16
+    </build>
5 17
     <parent>
6 18
         <artifactId>ruoyi</artifactId>
7 19
         <groupId>com.ruoyi</groupId>

+ 8 - 0
RuoYi-Vue-master/RuoYi-Vue-master/workTecket/pom.xml

@@ -39,6 +39,14 @@
39 39
                 <groupId>org.springframework.boot</groupId>
40 40
                 <artifactId>spring-boot-maven-plugin</artifactId>
41 41
             </plugin>
42
+            <plugin>
43
+                <groupId>org.apache.maven.plugins</groupId>
44
+                <artifactId>maven-compiler-plugin</artifactId>
45
+                <configuration>
46
+                    <source>8</source>
47
+                    <target>8</target>
48
+                </configuration>
49
+            </plugin>
42 50
         </plugins>
43 51
     </build>
44 52