Browse Source

[init]初始化仓库

JieZ 3 years ago
parent
commit
f3cea73f5c
100 changed files with 6462 additions and 0 deletions
  1. 225 0
      base-pom/pom.xml
  2. 52 0
      bpm-client-base/pom.xml
  3. 17 0
      bpm-client-base/src/main/java/com/srm/bpm/config/RestTemplateConfig.java
  4. 52 0
      bpm-client-base/src/main/java/com/srm/bpm/config/SeataFilter.java
  5. 56 0
      bpm-client-base/src/main/java/com/srm/bpm/config/SeataRestTemplateAutoConfiguration.java
  6. 60 0
      bpm-client-base/src/main/java/com/srm/bpm/config/SeataRestTemplateInterceptor.java
  7. 39 0
      bpm-client-base/src/main/java/com/srm/bpm/facde/dto/BaseProcessDTO.java
  8. 101 0
      bpm-client-base/src/main/java/com/srm/bpm/facde/dto/BillItemDTO.java
  9. 22 0
      bpm-client-base/src/main/java/com/srm/bpm/facde/dto/BillTaskDTO.java
  10. 69 0
      bpm-client-base/src/main/java/com/srm/bpm/facde/dto/DatasourceDTO.java
  11. 26 0
      bpm-client-base/src/main/java/com/srm/bpm/facde/dto/ProcessDTO.java
  12. 53 0
      bpm-client-base/src/main/java/com/srm/bpm/facde/dto/ProcessGridDTO.java
  13. 25 0
      bpm-client-base/src/main/java/com/srm/bpm/facde/dto/ProcessTypeDTO.java
  14. 46 0
      bpm-client-base/src/main/java/com/srm/bpm/facde/util/FormDataUtil.java
  15. 29 0
      bpm-client-base/src/main/java/com/srm/bpm/logic/BillPrintLogic.java
  16. 27 0
      bpm-client-base/src/main/java/com/srm/bpm/logic/BillReceiveLogic.java
  17. 94 0
      bpm-client-base/src/main/java/com/srm/bpm/logic/constant/BillOutStatus.java
  18. 30 0
      bpm-client-http/pom.xml
  19. 21 0
      bpm-client-http/src/main/java/com/srm/bpm/facde/BaseHttpClient.java
  20. 95 0
      bpm-client-http/src/main/java/com/srm/bpm/facde/BillHttpClient.java
  21. 38 0
      bpm-client-http/src/main/java/com/srm/bpm/facde/DatesourceHttpClient.java
  22. 273 0
      bpm-client-http/src/main/java/com/srm/bpm/facde/OkHttpUtil.java
  23. 158 0
      bpm-client-http/src/main/java/com/srm/bpm/facde/ProcessFLowHttpClient.java
  24. 123 0
      bpm-client-http/src/main/java/com/srm/bpm/facde/RestTemplateUtil.java
  25. 45 0
      bpm-client/pom.xml
  26. 40 0
      bpm-client/src/main/java/com/srm/bpm/facade/feign/BillFeignClient.java
  27. 49 0
      bpm-client/src/main/java/com/srm/bpm/facade/feign/fallback/BillFeignClientFallback.java
  28. 133 0
      bpm-core/pom.xml
  29. 262 0
      bpm-core/src/main/java/com/srm/bpm/facade/feign/BillListFeignController.java
  30. 226 0
      bpm-core/src/main/java/com/srm/bpm/facade/feign/BillProcessFeignController.java
  31. 45 0
      bpm-core/src/main/java/com/srm/bpm/facade/feign/DatasourceFeignController.java
  32. 75 0
      bpm-core/src/main/java/com/srm/bpm/facade/page/ProcessBillPageController.java
  33. 157 0
      bpm-core/src/main/java/com/srm/bpm/facade/page/ProcessDesingerPageController.java
  34. 86 0
      bpm-core/src/main/java/com/srm/bpm/facade/rest/BillFileController.java
  35. 331 0
      bpm-core/src/main/java/com/srm/bpm/facade/rest/BillFlowRestController.java
  36. 219 0
      bpm-core/src/main/java/com/srm/bpm/facade/rest/BillListRestController.java
  37. 142 0
      bpm-core/src/main/java/com/srm/bpm/facade/rest/BillProcessRestController.java
  38. 81 0
      bpm-core/src/main/java/com/srm/bpm/facade/rest/BillReplyRestController.java
  39. 294 0
      bpm-core/src/main/java/com/srm/bpm/facade/rest/DataSourceRestController.java
  40. 49 0
      bpm-core/src/main/java/com/srm/bpm/facade/rest/FormThirdItemRestController.java
  41. 58 0
      bpm-core/src/main/java/com/srm/bpm/facade/rest/LinkqueryController.java
  42. 202 0
      bpm-core/src/main/java/com/srm/bpm/facade/rest/ProcessContentRestController.java
  43. 242 0
      bpm-core/src/main/java/com/srm/bpm/facade/rest/ProcessFlowRestController.java
  44. 51 0
      bpm-core/src/main/java/com/srm/bpm/facade/rest/ProcessFormRestController.java
  45. 55 0
      bpm-core/src/main/java/com/srm/bpm/facade/rest/ProcessTreeRestController.java
  46. 86 0
      bpm-core/src/main/java/com/srm/bpm/facade/rest/ProcessTypeRestController.java
  47. 88 0
      bpm-core/src/main/java/com/srm/bpm/facade/rest/RelyController.java
  48. 67 0
      bpm-core/src/main/java/com/srm/bpm/facade/rest/ThirdPartBillController.java
  49. 63 0
      bpm-core/src/main/java/com/srm/bpm/facade/rest/UserCenterController.java
  50. 18 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/BillBizDataDao.java
  51. 18 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/BillCcPersonDao.java
  52. 18 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/BillDataJsonDao.java
  53. 18 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/BillLikeDao.java
  54. 18 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/BillReadRecordDao.java
  55. 18 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/BillReplyAttachmentDao.java
  56. 18 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/BillReplyDao.java
  57. 18 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/BillStatDao.java
  58. 18 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/BillTallyDao.java
  59. 71 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/BillTaskDao.java
  60. 18 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/CodeFormatDao.java
  61. 18 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/DatasourceComboDao.java
  62. 18 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/DatasourceConditionsDao.java
  63. 18 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/DatasourceFiledDao.java
  64. 18 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/DatasourcePopoverDao.java
  65. 25 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/FormDesingerDao.java
  66. 18 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/FormDetailSettingDao.java
  67. 29 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/FormExpressionDao.java
  68. 18 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/FormExtensionsDao.java
  69. 32 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/FormFieldDao.java
  70. 21 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/FormSettingDao.java
  71. 101 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/FormTableDao.java
  72. 21 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/FormThirdDao.java
  73. 25 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/FormThirdItemDao.java
  74. 22 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/FormValidationDao.java
  75. 20 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/ProcessBillTitleDao.java
  76. 18 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/ProcessDesingerDao.java
  77. 25 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/ProcessNodeApproverDao.java
  78. 24 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/ProcessNodeCcDao.java
  79. 18 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/ProcessNodeConnectionDao.java
  80. 34 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/ProcessNodeExtendDao.java
  81. 17 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/ProcessNodeFormFieldDao.java
  82. 18 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/ProcessSettingDao.java
  83. 18 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/ProcessTypeDao.java
  84. 18 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/ProcessVisualRangeDao.java
  85. 18 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/SysCodeFormatDao.java
  86. 83 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/ToaBillDao.java
  87. 18 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/ToaDatasourceDao.java
  88. 26 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/ToaFormDao.java
  89. 55 0
      bpm-core/src/main/java/com/srm/bpm/infra/dao/ToaProcessDao.java
  90. 37 0
      bpm-core/src/main/java/com/srm/bpm/infra/entity/BillBizDataEntity.java
  91. 48 0
      bpm-core/src/main/java/com/srm/bpm/infra/entity/BillCcPersonEntity.java
  92. 36 0
      bpm-core/src/main/java/com/srm/bpm/infra/entity/BillDataJsonEntity.java
  93. 43 0
      bpm-core/src/main/java/com/srm/bpm/infra/entity/BillLikeEntity.java
  94. 42 0
      bpm-core/src/main/java/com/srm/bpm/infra/entity/BillReadRecordEntity.java
  95. 43 0
      bpm-core/src/main/java/com/srm/bpm/infra/entity/BillReplyAttachmentEntity.java
  96. 52 0
      bpm-core/src/main/java/com/srm/bpm/infra/entity/BillReplyEntity.java
  97. 56 0
      bpm-core/src/main/java/com/srm/bpm/infra/entity/BillStatEntity.java
  98. 85 0
      bpm-core/src/main/java/com/srm/bpm/infra/entity/BillTallyEntity.java
  99. 98 0
      bpm-core/src/main/java/com/srm/bpm/infra/entity/BillTaskEntity.java
  100. 0 0
      bpm-core/src/main/java/com/srm/bpm/infra/entity/CodeFormatEntity.java

+ 225 - 0
base-pom/pom.xml

@@ -0,0 +1,225 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+
3
+
4
+<project xmlns="http://maven.apache.org/POM/4.0.0"
5
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
7
+    <modelVersion>4.0.0</modelVersion>
8
+    <groupId>com.srm.bpm</groupId>
9
+    <artifactId>base-pom</artifactId>
10
+    <version>0.0.1-SNAPSHOT</version>
11
+    <packaging>pom</packaging>
12
+
13
+    <properties>
14
+        <base.version>0.0.1-SNAPSHOT</base.version>
15
+        <java.version>1.8</java.version>
16
+        <maven.compiler.source>1.8</maven.compiler.source>
17
+        <maven.compiler.target>1.8</maven.compiler.target>
18
+
19
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
20
+        <encoding>UTF-8</encoding>
21
+
22
+        <spring-boot.version>2.3.8.RELEASE</spring-boot.version>
23
+        <spring-cloud.version>Hoxton.SR8</spring-cloud.version>
24
+        <spring.cloud.alibaba.version>2.2.5.RELEASE</spring.cloud.alibaba.version>
25
+
26
+        <mybatis-plus.version>3.4.1</mybatis-plus.version>
27
+
28
+        <mariadb.version>2.6.2</mariadb.version>
29
+
30
+        <aviator.version>5.2.1</aviator.version>
31
+        <wxchat.version>3.9.0</wxchat.version>
32
+
33
+        <guava.version>29.0-jre</guava.version>
34
+        <hutool.version>5.5.4</hutool.version>
35
+        <commons-io.version>2.5</commons-io.version>
36
+
37
+        <okhttp3.version>4.9.0</okhttp3.version>
38
+        <lombok.version>1.18.16</lombok.version>
39
+        <slf4j.version>1.7.30</slf4j.version>
40
+        <logback.version>1.2.3</logback.version>
41
+        <jackson-bom.version>2.11.3</jackson-bom.version>
42
+        <protobuf.version>3.11.4</protobuf.version>
43
+
44
+
45
+        <seata.version>1.4.1</seata.version>
46
+        <knife4j.version>2.0.1</knife4j.version>
47
+        <org.mapstruct.version>1.4.2.Final</org.mapstruct.version>
48
+        <xxljob.version>2.3.0</xxljob.version>
49
+        <seata.version>1.4.0</seata.version>
50
+    </properties>
51
+    <dependencyManagement>
52
+        <dependencies>
53
+            <dependency>
54
+                <groupId>com.alibaba.cloud</groupId>
55
+                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
56
+                <version>${spring.cloud.alibaba.version}</version>
57
+                <type>pom</type>
58
+                <scope>import</scope>
59
+            </dependency>
60
+            <dependency>
61
+                <groupId>org.springframework.cloud</groupId>
62
+                <artifactId>spring-cloud-dependencies</artifactId>
63
+                <version>${spring-cloud.version}</version>
64
+                <type>pom</type>
65
+                <scope>import</scope>
66
+            </dependency>
67
+            <!-- spring boot 依赖 -->
68
+            <dependency>
69
+                <groupId>org.springframework.boot</groupId>
70
+                <artifactId>spring-boot-dependencies</artifactId>
71
+                <version>${spring-boot.version}</version>
72
+                <type>pom</type>
73
+                <scope>import</scope>
74
+            </dependency>
75
+
76
+            <dependency>
77
+                <groupId>commons-io</groupId>
78
+                <artifactId>commons-io</artifactId>
79
+                <version>${commons-io.version}</version>
80
+            </dependency>
81
+            <dependency>
82
+                <groupId>com.google.protobuf</groupId>
83
+                <artifactId>protobuf-java</artifactId>
84
+                <version>${protobuf.version}</version>
85
+            </dependency>
86
+            <dependency>
87
+                <groupId>org.slf4j</groupId>
88
+                <artifactId>slf4j-api</artifactId>
89
+                <version>${slf4j.version}</version>
90
+            </dependency>
91
+            <dependency>
92
+                <groupId>org.slf4j</groupId>
93
+                <artifactId>log4j-over-slf4j</artifactId>
94
+                <version>${slf4j.version}</version>
95
+            </dependency>
96
+            <dependency>
97
+                <groupId>ch.qos.logback</groupId>
98
+                <artifactId>logback-core</artifactId>
99
+                <version>${logback.version}</version>
100
+            </dependency>
101
+            <dependency>
102
+                <groupId>ch.qos.logback</groupId>
103
+                <artifactId>logback-classic</artifactId>
104
+                <version>${logback.version}</version>
105
+            </dependency>
106
+
107
+            <dependency>
108
+                <groupId>cn.hutool</groupId>
109
+                <artifactId>hutool-core</artifactId>
110
+                <version>${hutool.version}</version>
111
+            </dependency>
112
+            <dependency>
113
+                <groupId>cn.hutool</groupId>
114
+                <artifactId>hutool-crypto</artifactId>
115
+                <version>${hutool.version}</version>
116
+            </dependency>
117
+
118
+            <dependency>
119
+                <groupId>com.google.guava</groupId>
120
+                <artifactId>guava</artifactId>
121
+                <version>${guava.version}</version>
122
+            </dependency>
123
+
124
+            <dependency>
125
+                <groupId>com.googlecode.aviator</groupId>
126
+                <artifactId>aviator</artifactId>
127
+                <version>${aviator.version}</version>
128
+                <exclusions>
129
+                    <exclusion>
130
+                        <groupId>commons-logging</groupId>
131
+                        <artifactId>commons-logging</artifactId>
132
+                    </exclusion>
133
+                    <exclusion>
134
+                        <groupId>commons-collections</groupId>
135
+                        <artifactId>commons-collections</artifactId>
136
+                    </exclusion>
137
+                </exclusions>
138
+            </dependency>
139
+
140
+            <dependency>
141
+                <groupId>com.github.binarywang</groupId>
142
+                <artifactId>weixin-java-mp</artifactId>
143
+                <version>${wxchat.version}</version>
144
+            </dependency>
145
+            <dependency>
146
+                <groupId>com.github.binarywang</groupId>
147
+                <artifactId>weixin-java-miniapp</artifactId>
148
+                <version>${wxchat.version}</version>
149
+            </dependency>
150
+            <dependency>
151
+                <groupId>com.squareup.okhttp3</groupId>
152
+                <artifactId>okhttp</artifactId>
153
+                <version>${okhttp3.version}</version>
154
+            </dependency>
155
+
156
+            <!-- Mybatis Plus 插件 -->
157
+            <dependency>
158
+                <groupId>com.baomidou</groupId>
159
+                <artifactId>mybatis-plus</artifactId>
160
+                <version>${mybatis-plus.version}</version>
161
+            </dependency>
162
+            <dependency>
163
+                <groupId>com.baomidou</groupId>
164
+                <artifactId>mybatis-plus-core</artifactId>
165
+                <version>${mybatis-plus.version}</version>
166
+            </dependency>
167
+            <dependency>
168
+                <groupId>com.baomidou</groupId>
169
+                <artifactId>mybatis-plus-extension</artifactId>
170
+                <version>${mybatis-plus.version}</version>
171
+            </dependency>
172
+            <dependency>
173
+                <groupId>com.baomidou</groupId>
174
+                <artifactId>mybatis-plus-boot-starter</artifactId>
175
+                <version>${mybatis-plus.version}</version>
176
+            </dependency>
177
+            <dependency>
178
+                <groupId>com.baomidou</groupId>
179
+                <artifactId>mybatis-plus-generator</artifactId>
180
+                <version>${mybatis-plus.version}</version>
181
+            </dependency>
182
+            <dependency>
183
+                <groupId>org.mapstruct</groupId>
184
+                <artifactId>mapstruct</artifactId>
185
+                <version>${org.mapstruct.version}</version>
186
+            </dependency>
187
+            <dependency>
188
+                <groupId>p6spy</groupId>
189
+                <artifactId>p6spy</artifactId>
190
+                <version>3.9.0</version>
191
+            </dependency>
192
+            <!--mysql驱动-->
193
+            <dependency>
194
+                <groupId>mysql</groupId>
195
+                <artifactId>mysql-connector-java</artifactId>
196
+                <version>5.1.48</version>
197
+            </dependency>
198
+            <!-- xxl-job-core -->
199
+
200
+            <dependency>
201
+                <groupId>com.xuxueli</groupId>
202
+                <artifactId>xxl-job-core</artifactId>
203
+                <version>${xxljob.version}</version>
204
+            </dependency>
205
+            <dependency>
206
+                <groupId>com.alibaba.cloud</groupId>
207
+                <artifactId>spring-cloud-alibaba-seata</artifactId>
208
+                <exclusions>
209
+                    <exclusion>
210
+                        <artifactId>seata-all</artifactId>
211
+                        <groupId>io.seata</groupId>
212
+                    </exclusion>
213
+                </exclusions>
214
+                <version>2.1.1.RELEASE</version>
215
+            </dependency>
216
+            <dependency>
217
+                <groupId>io.seata</groupId>
218
+                <artifactId>seata-all</artifactId>
219
+                <version>${seata.version}</version>
220
+            </dependency>
221
+        </dependencies>
222
+    </dependencyManagement>
223
+
224
+
225
+</project>

+ 52 - 0
bpm-client-base/pom.xml

@@ -0,0 +1,52 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+
3
+
4
+<project xmlns="http://maven.apache.org/POM/4.0.0"
5
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
7
+    <modelVersion>4.0.0</modelVersion>
8
+
9
+    <parent>
10
+        <groupId>com.srm.bpm</groupId>
11
+       <artifactId>bpm-pom</artifactId>
12
+          <version>0.0.1-SNAPSHOT</version>
13
+    </parent>
14
+
15
+    <artifactId>bpm-client-base</artifactId>
16
+    <version>${parent.version}</version>
17
+    <dependencies>
18
+        <dependency>
19
+            <groupId>com.srm.bpm</groupId>
20
+            <artifactId>data</artifactId>
21
+            <version>0.0.1-SNAPSHOT</version>
22
+        </dependency>
23
+        <dependency>
24
+            <groupId>hu.blackbelt.bundles.poi</groupId>
25
+            <artifactId>org.apache.poi</artifactId>
26
+            <version>4.0.1_1</version>
27
+            <scope>compile</scope>
28
+        </dependency>
29
+        <dependency>
30
+            <groupId>org.mapstruct</groupId>
31
+            <artifactId>mapstruct</artifactId>
32
+            <version>${mapstruct.version}</version>
33
+        </dependency>
34
+        <dependency>
35
+            <groupId>org.springframework</groupId>
36
+            <artifactId>spring-web</artifactId>
37
+        </dependency>
38
+        <dependency>
39
+            <groupId>io.seata</groupId>
40
+            <artifactId>seata-spring-boot-starter</artifactId>
41
+            <version>1.4.2</version>
42
+            <scope>compile</scope>
43
+        </dependency>
44
+        <dependency>
45
+            <groupId>org.apache.tomcat.embed</groupId>
46
+            <artifactId>tomcat-embed-core</artifactId>
47
+            <scope>compile</scope>
48
+        </dependency>
49
+    </dependencies>
50
+
51
+
52
+</project>

+ 17 - 0
bpm-client-base/src/main/java/com/srm/bpm/config/RestTemplateConfig.java

@@ -0,0 +1,17 @@
1
+
2
+
3
+package com.srm.bpm.config;
4
+
5
+import org.springframework.context.annotation.Bean;
6
+import org.springframework.context.annotation.Configuration;
7
+import org.springframework.web.client.RestTemplate;
8
+
9
+@Configuration
10
+public class RestTemplateConfig {
11
+
12
+    @Bean
13
+    public RestTemplate restTemplate() {
14
+        RestTemplate restTemplate = new RestTemplate();
15
+        return restTemplate;
16
+    }
17
+}

+ 52 - 0
bpm-client-base/src/main/java/com/srm/bpm/config/SeataFilter.java

@@ -0,0 +1,52 @@
1
+
2
+
3
+package com.srm.bpm.config;
4
+
5
+import org.apache.commons.lang3.StringUtils;
6
+import org.springframework.stereotype.Component;
7
+
8
+import java.io.IOException;
9
+
10
+import javax.servlet.Filter;
11
+import javax.servlet.FilterConfig;
12
+import javax.servlet.ServletException;
13
+import javax.servlet.ServletRequest;
14
+import javax.servlet.ServletResponse;
15
+import javax.servlet.http.HttpServletRequest;
16
+
17
+import io.seata.core.context.RootContext;
18
+
19
+/**
20
+ * <p> </p>
21
+ *
22
+ * @author BOGON
23
+ * @version 1.0
24
+ * @since JDK 1.8
25
+ */
26
+@Component
27
+public class SeataFilter implements Filter {
28
+    @Override
29
+    public void init(FilterConfig filterConfig) throws ServletException {
30
+    }
31
+    @Override
32
+    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, javax.servlet.FilterChain filterChain) throws IOException, ServletException {
33
+        HttpServletRequest req = (HttpServletRequest) servletRequest;
34
+        String xid = req.getHeader(RootContext.KEY_XID.toLowerCase());
35
+        boolean isBind = false;
36
+        if (StringUtils.isNotBlank(xid)) {
37
+            RootContext.bind(xid);
38
+            isBind = true;
39
+        }
40
+        try {
41
+            filterChain.doFilter(servletRequest, servletResponse);
42
+        } finally {
43
+            if (isBind) {
44
+                RootContext.unbind();
45
+            }
46
+        }
47
+    }
48
+
49
+    @Override
50
+    public void destroy() {
51
+    }
52
+}

+ 56 - 0
bpm-client-base/src/main/java/com/srm/bpm/config/SeataRestTemplateAutoConfiguration.java

@@ -0,0 +1,56 @@
1
+ 
2
+
3
+package com.srm.bpm.config;
4
+
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.context.annotation.Bean;
7
+import org.springframework.context.annotation.Configuration;
8
+import org.springframework.http.client.ClientHttpRequestInterceptor;
9
+import org.springframework.web.client.RestTemplate;
10
+
11
+import java.util.ArrayList;
12
+import java.util.Collection;
13
+import java.util.Iterator;
14
+import java.util.List;
15
+
16
+import javax.annotation.PostConstruct;
17
+
18
+/**
19
+ * <p> </p>
20
+ *
21
+ * @author BOGON
22
+ * @version 1.0
23
+ * @since JDK 1.8
24
+ */
25
+@Configuration
26
+public class SeataRestTemplateAutoConfiguration {
27
+    @Autowired(
28
+            required = false
29
+    )
30
+    private Collection<RestTemplate> restTemplates;
31
+    @Autowired
32
+    private SeataRestTemplateInterceptor seataRestTemplateInterceptor;
33
+
34
+    public SeataRestTemplateAutoConfiguration() {
35
+    }
36
+
37
+    @Bean
38
+    public SeataRestTemplateInterceptor seataRestTemplateInterceptor() {
39
+        return new SeataRestTemplateInterceptor();
40
+    }
41
+
42
+    @PostConstruct
43
+    public void init() {
44
+        if (this.restTemplates != null) {
45
+            Iterator var1 = this.restTemplates.iterator();
46
+
47
+            while (var1.hasNext()) {
48
+                RestTemplate restTemplate = (RestTemplate) var1.next();
49
+                List<ClientHttpRequestInterceptor> interceptors = new ArrayList(restTemplate.getInterceptors());
50
+                interceptors.add(this.seataRestTemplateInterceptor);
51
+                restTemplate.setInterceptors(interceptors);
52
+            }
53
+        }
54
+
55
+    }
56
+}

+ 60 - 0
bpm-client-base/src/main/java/com/srm/bpm/config/SeataRestTemplateInterceptor.java

@@ -0,0 +1,60 @@
1
+
2
+
3
+package com.srm.bpm.config;
4
+
5
+import org.apache.commons.lang3.StringUtils;
6
+import org.springframework.http.HttpRequest;
7
+import org.springframework.http.client.ClientHttpRequestExecution;
8
+import org.springframework.http.client.ClientHttpRequestInterceptor;
9
+import org.springframework.http.client.ClientHttpResponse;
10
+import org.springframework.http.client.support.HttpRequestWrapper;
11
+
12
+import java.io.IOException;
13
+
14
+import io.seata.core.context.RootContext;
15
+
16
+/**
17
+ * <p> </p>
18
+ *
19
+ * @author BOGON
20
+ * @version 1.0
21
+ * @since JDK 1.8
22
+ */
23
+public class SeataRestTemplateInterceptor implements ClientHttpRequestInterceptor {
24
+    /**
25
+     * Intercept the given request, and return a response. The given {@link
26
+     * ClientHttpRequestExecution} allows the interceptor to pass on the request and response to the
27
+     * next entity in the chain.
28
+     * <p>A typical implementation of this method would follow the following pattern:
29
+     * <ol>
30
+     * <li>Examine the {@linkplain HttpRequest request} and body</li>
31
+     * <li>Optionally {@linkplain HttpRequestWrapper
32
+     * wrap} the request to filter HTTP attributes.</li>
33
+     * <li>Optionally modify the body of the request.</li>
34
+     * <li><strong>Either</strong>
35
+     * <ul>
36
+     * <li>execute the request using
37
+     * {@link ClientHttpRequestExecution#execute(HttpRequest, byte[])},</li>
38
+     * <strong>or</strong>
39
+     * <li>do not execute the request to block the execution altogether.</li>
40
+     * </ul>
41
+     * <li>Optionally wrap the response to filter HTTP attributes.</li>
42
+     * </ol>
43
+     *
44
+     * @param request   the request, containing method, URI, and headers
45
+     * @param body      the body of the request
46
+     * @param execution the request execution
47
+     * @return the response
48
+     * @throws IOException in case of I/O errors
49
+     */
50
+    @Override
51
+    public ClientHttpResponse intercept(HttpRequest httpRequest, byte[] bytes, ClientHttpRequestExecution clientHttpRequestExecution) throws IOException {
52
+        HttpRequestWrapper requestWrapper = new HttpRequestWrapper(httpRequest);
53
+        String xid = RootContext.getXID();
54
+        if (StringUtils.isNotEmpty(xid)) {
55
+            requestWrapper.getHeaders().add(RootContext.KEY_XID, xid);
56
+        }
57
+
58
+        return clientHttpRequestExecution.execute(requestWrapper, bytes);
59
+    }
60
+}

+ 39 - 0
bpm-client-base/src/main/java/com/srm/bpm/facde/dto/BaseProcessDTO.java

@@ -0,0 +1,39 @@
1
+
2
+
3
+package com.srm.bpm.facde.dto;
4
+
5
+import java.io.Serializable;
6
+
7
+import io.swagger.annotations.ApiModel;
8
+import io.swagger.annotations.ApiModelProperty;
9
+import lombok.Data;
10
+
11
+/**
12
+ * <p> </p>
13
+ *
14
+ * @author BOGON
15
+ * @version 1.0
16
+ * @since JDK 1.8
17
+ */
18
+@Data
19
+@ApiModel("流程基本信息")
20
+public class BaseProcessDTO implements Serializable {
21
+
22
+    private static final long serialVersionUID = 4484034382767902747L;
23
+    @ApiModelProperty("物理主键")
24
+    private Long id;
25
+    @ApiModelProperty("流程名称")
26
+    private String name;
27
+    @ApiModelProperty("流程编码")
28
+    private String code;
29
+    @ApiModelProperty("流程类型")
30
+    private Long typeId;
31
+    @ApiModelProperty("编号规则")
32
+    private Long codeId;
33
+    @ApiModelProperty("显示名称")
34
+    private String displayName;
35
+    @ApiModelProperty("显示排序")
36
+    private Integer sort;
37
+    @ApiModelProperty("流程附件id")
38
+    private Long iconId;
39
+}

+ 101 - 0
bpm-client-base/src/main/java/com/srm/bpm/facde/dto/BillItemDTO.java

@@ -0,0 +1,101 @@
1
+
2
+
3
+package com.srm.bpm.facde.dto;
4
+
5
+import lombok.Data;
6
+
7
+/**
8
+ * <p> </p>
9
+ *
10
+ * @author BOGON
11
+ * @version 1.0
12
+ * @since JDK 1.8
13
+ */
14
+@Data
15
+public class BillItemDTO {
16
+    /**
17
+     * 审批单主键
18
+     */
19
+    private long id;
20
+    /**
21
+     * 审批单编号
22
+     */
23
+    private String code;
24
+    /**
25
+     * 审批标题
26
+     */
27
+    private String title;
28
+    private String btns;
29
+
30
+    private Integer printSize;
31
+    /**
32
+     * 创建时间
33
+     */
34
+    private Integer createTime;
35
+
36
+    /**
37
+     * 开始时间
38
+     */
39
+    private Integer startTime;
40
+    /**
41
+     * 完成时间
42
+     */
43
+    private Integer completionTime;
44
+
45
+    /**
46
+     * 优先级
47
+     */
48
+    private int priority;
49
+    /**
50
+     * 节点的操作
51
+     */
52
+    private String action;
53
+    /**
54
+     * 是否已读
55
+     */
56
+    private boolean readFlag;
57
+
58
+    /**
59
+     * 审批类型
60
+     */
61
+    private long processId;
62
+    /**
63
+     * 审批类型名称
64
+     */
65
+    private String processName;
66
+
67
+    /**
68
+     * 审批状态
69
+     */
70
+    private int status;
71
+
72
+    /**
73
+     * 任务名称=节点名称
74
+     */
75
+    private String nodeName;
76
+
77
+
78
+    /**
79
+     * 审批操作
80
+     */
81
+    private int nodeStatus;
82
+    /**
83
+     * 审批时间
84
+     */
85
+    private Integer dateline;
86
+
87
+
88
+    private String sender;
89
+
90
+    private String senderName;
91
+
92
+    private String customerName;
93
+
94
+    /**
95
+     *  申请发起外部表单地址
96
+     */
97
+    private String formLink;
98
+    private String approveLink;
99
+
100
+    private Integer assistant;
101
+}

+ 22 - 0
bpm-client-base/src/main/java/com/srm/bpm/facde/dto/BillTaskDTO.java

@@ -0,0 +1,22 @@
1
+
2
+
3
+package com.srm.bpm.facde.dto;
4
+
5
+import java.io.Serializable;
6
+
7
+import lombok.Data;
8
+
9
+/**
10
+ * <p> </p>
11
+ *
12
+ * @author BOGON
13
+ * @version 1.0
14
+ * @since JDK 1.8
15
+ */
16
+@Data
17
+public class BillTaskDTO implements Serializable {
18
+    private static final long serialVersionUID = -1531474624480564826L;
19
+    private Long id;
20
+    private String nodeName;
21
+    private Integer selectApproval;
22
+}

+ 69 - 0
bpm-client-base/src/main/java/com/srm/bpm/facde/dto/DatasourceDTO.java

@@ -0,0 +1,69 @@
1
+
2
+
3
+package com.srm.bpm.facde.dto;
4
+
5
+import io.swagger.annotations.ApiModel;
6
+import io.swagger.annotations.ApiModelProperty;
7
+import lombok.Data;
8
+
9
+/**
10
+ * <p> </p>
11
+ *
12
+ * @author BOGON
13
+ * @version 1.0
14
+ * @since JDK 1.8
15
+ */
16
+@Data
17
+@ApiModel("数据源")
18
+public class DatasourceDTO {
19
+    @ApiModelProperty("主键")
20
+    private Long id;
21
+
22
+    @ApiModelProperty("编号")
23
+    private String code;
24
+
25
+    @ApiModelProperty("名称")
26
+    private String name;
27
+
28
+    @ApiModelProperty("英文名")
29
+    private String enName;
30
+
31
+    /**
32
+     * 数据源类型;1-平台数据源;2-动态SQL语句;3-Java实现接口;4-WebService接口;5-http接口;6-Excel文件;7-脚本
33
+     */
34
+    @ApiModelProperty("数据源类型;1-平台数据源;2-动态SQL语句;")
35
+    private Integer dsType;
36
+
37
+    @ApiModelProperty("表名")
38
+    private String tableName;
39
+
40
+    /**
41
+     * 显示排序
42
+     */
43
+    @ApiModelProperty("显示排序")
44
+    private Integer sort;
45
+
46
+    @ApiModelProperty("连接url")
47
+    private String linkUrl;
48
+
49
+    @ApiModelProperty("sql语句")
50
+    private String sqlScript;
51
+
52
+    /**
53
+     * sql分页标记
54
+     */
55
+    @ApiModelProperty("sql分页标记")
56
+    private Integer pageFlag;
57
+
58
+    @ApiModelProperty("java脚本")
59
+    private String javaScript;
60
+
61
+    @ApiModelProperty("脚本")
62
+    private String script;
63
+
64
+    /**
65
+     * 系统默认
66
+     */
67
+    @ApiModelProperty("系统默认")
68
+    private Integer defaultFlag;
69
+}

+ 26 - 0
bpm-client-base/src/main/java/com/srm/bpm/facde/dto/ProcessDTO.java

@@ -0,0 +1,26 @@
1
+
2
+
3
+package com.srm.bpm.facde.dto;
4
+
5
+import java.io.Serializable;
6
+
7
+import lombok.Data;
8
+
9
+/**
10
+ * <p> </p>
11
+ *
12
+ * @author BOGON
13
+ * @version 1.0
14
+ * @since JDK 1.8
15
+ */
16
+@Data
17
+public class ProcessDTO implements Serializable {
18
+    private static final long serialVersionUID = -8861384418515695246L;
19
+    private String code;
20
+    private long id;
21
+    private String name;
22
+    private Long iconId;
23
+    private String formLink;
24
+    private String approveLink;
25
+    private Integer manualStartFlag;
26
+}

+ 53 - 0
bpm-client-base/src/main/java/com/srm/bpm/facde/dto/ProcessGridDTO.java

@@ -0,0 +1,53 @@
1
+
2
+
3
+package com.srm.bpm.facde.dto;
4
+
5
+import java.io.Serializable;
6
+
7
+import io.swagger.annotations.ApiModel;
8
+import io.swagger.annotations.ApiModelProperty;
9
+import lombok.Data;
10
+
11
+/**
12
+ * <p> </p>
13
+ *
14
+ * @author sog
15
+ * @version 1.0
16
+ * @since JDK 1.7
17
+ */
18
+@Data
19
+@ApiModel
20
+public class ProcessGridDTO implements Serializable {
21
+    private static final long serialVersionUID = -2797504921584609139L;
22
+    @ApiModelProperty("主键")
23
+    private long id;
24
+    @ApiModelProperty("名称")
25
+    private String name;
26
+    @ApiModelProperty("编码")
27
+    private String code;
28
+    @ApiModelProperty("显示名称")
29
+    private String displayName;
30
+    @ApiModelProperty("类型主键")
31
+    private long typeId;
32
+    @ApiModelProperty("类型名称")
33
+    private String typeName;
34
+    @ApiModelProperty("排序")
35
+    private int sort;
36
+    @ApiModelProperty("创建时间")
37
+    private Long createTime;
38
+    @ApiModelProperty("流程主键")
39
+    private String flowId;
40
+    @ApiModelProperty("状态")
41
+    private int status;
42
+    @ApiModelProperty("图标附件id")
43
+    private Long iconId;
44
+    @ApiModelProperty("模板下载url")
45
+    private String url;
46
+    @ApiModelProperty("外部表单url")
47
+    private String formLink;
48
+    @ApiModelProperty("外部表单审批url")
49
+    private String approveLink;
50
+    @ApiModelProperty("是否允许手动启动")
51
+    private Integer manualStartFlag;
52
+
53
+}

+ 25 - 0
bpm-client-base/src/main/java/com/srm/bpm/facde/dto/ProcessTypeDTO.java

@@ -0,0 +1,25 @@
1
+
2
+
3
+package com.srm.bpm.facde.dto;
4
+
5
+import java.io.Serializable;
6
+import java.util.List;
7
+
8
+import lombok.Data;
9
+
10
+/**
11
+ * <p> </p>
12
+ *
13
+ * @author BOGON
14
+ * @version 1.0
15
+ * @since JDK 1.8
16
+ */
17
+@Data
18
+public class ProcessTypeDTO implements Serializable {
19
+    private long id;
20
+    private String name;
21
+    private String code;
22
+    private List<ProcessDTO> flows;
23
+}
24
+
25
+

+ 46 - 0
bpm-client-base/src/main/java/com/srm/bpm/facde/util/FormDataUtil.java

@@ -0,0 +1,46 @@
1
+
2
+
3
+package com.srm.bpm.facde.util;
4
+
5
+import com.google.common.collect.Sets;
6
+
7
+import java.util.Collection;
8
+import java.util.Iterator;
9
+import java.util.Set;
10
+
11
+import cn.hutool.core.util.NumberUtil;
12
+import cn.hutool.core.util.StrUtil;
13
+
14
+/**
15
+ * <p> </p>
16
+ *
17
+ * @author BOGON
18
+ * @version 1.0
19
+ * @since JDK 1.8
20
+ */
21
+public class FormDataUtil {
22
+    /**
23
+     * 处理流程条件中的数字属于和不属于增加增加单引号
24
+     */
25
+    public static String includeStrHanlder(String... args) {
26
+        Set<String> result = Sets.newHashSet();
27
+        for (String arg : args) {
28
+            if (NumberUtil.isNumber(arg)) {
29
+                arg = "'" + arg + "'";
30
+            }
31
+            result.add(arg);
32
+        }
33
+        return StrUtil.join(",", result);
34
+    }
35
+
36
+    public static String includeStrHanlder(Collection<String> args) {
37
+        final Iterator<String> iterator = args.iterator();
38
+        String[] tmp = new String[args.size()];
39
+        int i = 0;
40
+        while (iterator.hasNext()) {
41
+            tmp[i] = iterator.next();
42
+            i++;
43
+        }
44
+        return includeStrHanlder(tmp);
45
+    }
46
+}

+ 29 - 0
bpm-client-base/src/main/java/com/srm/bpm/logic/BillPrintLogic.java

@@ -0,0 +1,29 @@
1
+
2
+
3
+package com.srm.bpm.logic;
4
+
5
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
6
+
7
+/**
8
+ * <p> </p>
9
+ *
10
+ * @author BOGON
11
+ * @version 1.0
12
+ * @since JDK 1.8
13
+ */
14
+public interface BillPrintLogic {
15
+    /**
16
+     * 执行回调方法
17
+     *
18
+     * @param processId 审批流程id
19
+     * @param billId    审批单id
20
+     * @param printTemplatePath    文件打印模版
21
+     */
22
+    XSSFWorkbook execute(Long processId, Long billId,String printTemplatePath);
23
+
24
+    /**
25
+     * 流程的id,使用逗号隔开表示多个
26
+     * @return 服务的id
27
+     */
28
+    String getServiceId();
29
+}

+ 27 - 0
bpm-client-base/src/main/java/com/srm/bpm/logic/BillReceiveLogic.java

@@ -0,0 +1,27 @@
1
+
2
+
3
+package com.srm.bpm.logic;
4
+
5
+/**
6
+ * <p> </p>
7
+ *
8
+ * @author BOGON
9
+ * @version 1.0
10
+ * @since JDK 1.8
11
+ */
12
+public interface BillReceiveLogic {
13
+    /**
14
+     * 执行回调方法
15
+     *
16
+     * @param processId 审批流程id
17
+     * @param billId    审批单id
18
+     * @param status    状态
19
+     */
20
+    void execute(Long processId, Long billId, Integer status);
21
+
22
+    /**
23
+     * 流程的id,使用逗号隔开表示多个
24
+     * @return 服务的id
25
+     */
26
+    String getServiceId();
27
+}

+ 94 - 0
bpm-client-base/src/main/java/com/srm/bpm/logic/constant/BillOutStatus.java

@@ -0,0 +1,94 @@
1
+
2
+
3
+package com.srm.bpm.logic.constant;
4
+
5
+import java.util.Objects;
6
+
7
+/**
8
+ * <p>
9
+ * <p>
10
+ * 审批单状态
11
+ * <p>
12
+ * 1. 当审批单填写完成后,保存到草稿中, 状态为 待提交 也就是草稿状态;
13
+ * <p>
14
+ * 2. 当审批单填写完成并点击提交到流程中,流程正在审批中,单子状态为审批中;
15
+ * <p>
16
+ * 3. 当审批单 审批流程结束并通过之后,审批单的状态为 已完成;
17
+ * <p>
18
+ * 4. 当审批单 审批流程结束并被拒绝之后,审批单的状态为 审批拒绝;
19
+ * <p>
20
+ * 5. 当审核单 发起后,然后发起人撤回或者撤销流程后,状态为 已撤销;
21
+ * <p>
22
+ * 6. 当审核单 发起后,流程开始走向归档节点后,状态为 待归档;
23
+ * <p>
24
+ * 7. 当审核单 发起后,流程走到归档节点后,归档人进行归档后, 状态为 已完成;
25
+ * <p>
26
+ * 8. 当审批单被 A审批人打回,审批单据为打回状态,发起人重新填写任何直接到  A审批人审批中;
27
+ *
28
+ * </p>
29
+ *
30
+ * @author sog
31
+ * @version 1.0
32
+ * @since JDK 1.7
33
+ */
34
+public enum BillOutStatus {
35
+    /**
36
+     * 未知状态,如果出现这个状态,表示出现数据或者逻辑业务代码问题
37
+     */
38
+    NONE(-100),
39
+    /**
40
+     * 待提交,草稿状态
41
+     */
42
+    DRAFTS(0),
43
+    /**
44
+     * 审批中
45
+     */
46
+    APPROVAL(1),
47
+    /**
48
+     * 已撤销
49
+     */
50
+    CANCEL(2),
51
+    /**
52
+     * 审批拒绝
53
+     */
54
+    REFUSE(3),
55
+    /**
56
+     * 归档中
57
+     */
58
+    ARCHIVE(4),
59
+    /**
60
+     * 已完成
61
+     */
62
+    COMPLETE(8),
63
+    /**
64
+     * 已删除
65
+     */
66
+    DELETE(9),
67
+    /**
68
+     * 打回
69
+     */
70
+    REPULSE(10);
71
+
72
+    private final int status;
73
+
74
+
75
+    BillOutStatus(int status) {
76
+        this.status = status;
77
+    }
78
+
79
+    public static BillOutStatus valueTo(Integer status) {
80
+        if (Objects.isNull(status)) {
81
+            return NONE;
82
+        }
83
+        for (BillOutStatus billStatus : values()) {
84
+            if (billStatus.getStatus() == status) {
85
+                return billStatus;
86
+            }
87
+        }
88
+        return NONE;
89
+    }
90
+
91
+    public int getStatus() {
92
+        return status;
93
+    }
94
+}

+ 30 - 0
bpm-client-http/pom.xml

@@ -0,0 +1,30 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+
3
+
4
+<project xmlns="http://maven.apache.org/POM/4.0.0"
5
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
7
+    <modelVersion>4.0.0</modelVersion>
8
+
9
+    <parent>
10
+        <groupId>com.srm.bpm</groupId>
11
+        <artifactId>bpm-pom</artifactId>
12
+        <version>0.0.1-SNAPSHOT</version>
13
+        <relativePath/>
14
+    </parent>
15
+
16
+    <artifactId>bpm-client-http</artifactId>
17
+    <version>${parent.version}</version>
18
+    <dependencies>
19
+        <dependency>
20
+            <groupId>com.srm.bpm</groupId>
21
+            <artifactId>bpm-client-base</artifactId>
22
+            <version>${parent.version}</version>
23
+        </dependency>
24
+        <dependency>
25
+            <groupId>com.alibaba</groupId>
26
+            <artifactId>fastjson</artifactId>
27
+            <version>1.2.76</version>
28
+        </dependency>
29
+    </dependencies>
30
+</project>

+ 21 - 0
bpm-client-http/src/main/java/com/srm/bpm/facde/BaseHttpClient.java

@@ -0,0 +1,21 @@
1
+ 
2
+
3
+package com.srm.bpm.facde;
4
+
5
+import lombok.extern.slf4j.Slf4j;
6
+
7
+/**
8
+ * <p> </p>
9
+ *
10
+ * @author BOGON
11
+ * @version 1.0
12
+ * @since JDK 1.8
13
+ */
14
+@Slf4j
15
+public class BaseHttpClient {
16
+    static String ListUrl="/bill/list/feign";
17
+    static String processUrl="/bill/process/feign";
18
+    static String datasourceUrl="/process/datasource/feign";
19
+    static String thirdPartUrl="/third/part/bill";
20
+    String host;
21
+}

+ 95 - 0
bpm-client-http/src/main/java/com/srm/bpm/facde/BillHttpClient.java

@@ -0,0 +1,95 @@
1
+
2
+
3
+package com.srm.bpm.facde;
4
+
5
+import com.google.common.collect.Maps;
6
+
7
+import com.alibaba.fastjson.JSONObject;
8
+import com.srm.bpm.facde.dto.BillItemDTO;
9
+import com.srm.bpm.facde.dto.BillTaskDTO;
10
+import com.srm.bpm.facde.dto.ProcessTypeDTO;
11
+import com.srm.common.data.rest.R;
12
+
13
+import java.util.List;
14
+import java.util.Map;
15
+
16
+import cn.hutool.core.util.StrUtil;
17
+import lombok.extern.slf4j.Slf4j;
18
+
19
+/**
20
+ * <p> </p>
21
+ *
22
+ * @author BOGON
23
+ * @version 1.0
24
+ * @since JDK 1.8
25
+ */
26
+@Slf4j
27
+public class BillHttpClient extends BaseHttpClient {
28
+    private final RestTemplateUtil restTemplateUtil;
29
+
30
+    public BillHttpClient(RestTemplateUtil restTemplateUtil, String host) {
31
+        this.restTemplateUtil = restTemplateUtil;
32
+        if (host.endsWith(StrUtil.C_SLASH + "")) {
33
+            host = host.substring(0, host.length() - 1);
34
+        }
35
+        this.host = host;
36
+    }
37
+
38
+    public R<List<BillItemDTO>> minecreate(Map<String, Object> params, String user) {
39
+        final R<List<BillItemDTO>> objectR = restTemplateUtil.getList(this.host + ListUrl + "/minecreate", params, user,BillItemDTO.class);
40
+        return objectR;
41
+    }
42
+
43
+    public R<List<BillItemDTO>> approved(Map<String, Object> params, String user) {
44
+        final R<List<BillItemDTO>> objectR = restTemplateUtil.getList(this.host + ListUrl + "/approved", params, user,BillItemDTO.class);
45
+        return objectR;
46
+    }
47
+
48
+    public R<List<BillItemDTO>> todo(Map<String, Object> params, String user) {
49
+        final R<List<BillItemDTO>> objectR = restTemplateUtil.getList(this.host + ListUrl + "/todo", params, user,BillItemDTO.class);
50
+        return objectR;
51
+    }
52
+
53
+    public R<List<ProcessTypeDTO>> todoCateSize(String user) {
54
+        Map<String, Object> params = Maps.newHashMap();
55
+        R<List<ProcessTypeDTO>> a = restTemplateUtil.getList(this.host + ListUrl + "/todo/cate/size", params, user,ProcessTypeDTO.class);
56
+        return a;
57
+    }
58
+
59
+    public R<String> todoSize(String user) {
60
+        Map<String, Object> params = Maps.newHashMap();
61
+        final R<String> objectR = restTemplateUtil.getOne(this.host + ListUrl + "/todo/size", params, user,String.class);
62
+        return objectR;
63
+    }
64
+
65
+    public R<List<BillItemDTO>> drafts(Map<String, Object> params, String user) {
66
+        final R<List<BillItemDTO>> objectR = restTemplateUtil.getList(this.host + ListUrl + "/drafts", params, user,BillItemDTO.class);
67
+        return objectR;
68
+    }
69
+
70
+    public R<List<BillItemDTO>> cc(Map<String, Object> params, String user) {
71
+        final R<List<BillItemDTO>> objectR = restTemplateUtil.getList(this.host + ListUrl + "/cc", params, user,BillItemDTO.class);
72
+        return objectR;
73
+    }
74
+
75
+    public R<List<BillItemDTO>> findAll(Map<String, Object> params, String user) {
76
+        final R<List<BillItemDTO>> objectR = restTemplateUtil.getList(this.host + ListUrl + "/all/bill", params, user,BillItemDTO.class);
77
+        return objectR;
78
+    }
79
+
80
+    public R<BillItemDTO> submit(JSONObject data, String user) {
81
+        return restTemplateUtil.postReturnOne(this.host + thirdPartUrl + "/submit", data, user,BillItemDTO.class);
82
+    }
83
+
84
+    public R<BillItemDTO> saveDrafts(JSONObject data, String user) {
85
+        return restTemplateUtil.postReturnOne(this.host + thirdPartUrl + "/save", data, user,BillItemDTO.class);
86
+    }
87
+
88
+    public R<List<BillTaskDTO>> getHistoryTasks(String billId, String user) {
89
+        Map<String, Object> params = Maps.newHashMap();
90
+        params.put("billId", billId);
91
+        final R<List<BillTaskDTO>> result = restTemplateUtil.getList(this.host + ListUrl + "/history/tasks", params, user,BillItemDTO.class);
92
+        return result;
93
+    }
94
+
95
+}

+ 38 - 0
bpm-client-http/src/main/java/com/srm/bpm/facde/DatesourceHttpClient.java

@@ -0,0 +1,38 @@
1
+
2
+
3
+package com.srm.bpm.facde;
4
+
5
+import com.srm.bpm.facde.dto.DatasourceDTO;
6
+import com.srm.common.data.rest.R;
7
+
8
+import java.util.List;
9
+import java.util.Map;
10
+
11
+import cn.hutool.core.util.StrUtil;
12
+import lombok.extern.slf4j.Slf4j;
13
+
14
+/**
15
+ * <p> </p>
16
+ *
17
+ * @author BOGON
18
+ * @version 1.0
19
+ * @since JDK 1.8
20
+ */
21
+@Slf4j
22
+public class DatesourceHttpClient extends BaseHttpClient {
23
+    private final RestTemplateUtil restTemplateUtil;
24
+
25
+    public DatesourceHttpClient(RestTemplateUtil restTemplate, String host) {
26
+        this.restTemplateUtil = restTemplate;
27
+        if (host.endsWith(StrUtil.C_SLASH + "")) {
28
+            host = host.substring(0, host.length() - 1);
29
+        }
30
+        this.host = host;
31
+    }
32
+
33
+    public R<List<DatasourceDTO>> list(Map<String, Object> params, String user) {
34
+        final String url = this.host + datasourceUrl + "/list";
35
+        final R<List<DatasourceDTO>> r = restTemplateUtil.getList(url, params, user, DatasourceDTO.class);
36
+        return r;
37
+    }
38
+}

+ 273 - 0
bpm-client-http/src/main/java/com/srm/bpm/facde/OkHttpUtil.java

@@ -0,0 +1,273 @@
1
+
2
+//
3
+//package com.jingtong.bpm.facde;
4
+//
5
+//import com.google.common.base.Strings;
6
+//
7
+//import com.alibaba.fastjson.JSON;
8
+//import com.alibaba.fastjson.TypeReference;
9
+//import com.jingtong.data.rest.R;
10
+//
11
+//import org.springframework.stereotype.Service;
12
+//
13
+//import java.io.IOException;
14
+//import java.io.UnsupportedEncodingException;
15
+//import java.net.URLEncoder;
16
+//import java.security.KeyManagementException;
17
+//import java.security.NoSuchAlgorithmException;
18
+//import java.security.SecureRandom;
19
+//import java.security.cert.CertificateException;
20
+//import java.security.cert.X509Certificate;
21
+//import java.util.Collections;
22
+//import java.util.List;
23
+//import java.util.Map;
24
+//import java.util.Objects;
25
+//import java.util.concurrent.TimeUnit;
26
+//
27
+//import javax.net.ssl.SSLContext;
28
+//import javax.net.ssl.SSLSocketFactory;
29
+//import javax.net.ssl.TrustManager;
30
+//import javax.net.ssl.X509TrustManager;
31
+//
32
+//import lombok.RequiredArgsConstructor;
33
+//import lombok.extern.slf4j.Slf4j;
34
+//import okhttp3.ConnectionPool;
35
+//import okhttp3.HttpUrl;
36
+//import okhttp3.Interceptor;
37
+//import okhttp3.MediaType;
38
+//import okhttp3.OkHttpClient;
39
+//import okhttp3.Request;
40
+//import okhttp3.RequestBody;
41
+//import okhttp3.Response;
42
+//import okhttp3.internal.Util;
43
+//
44
+///**
45
+// * <p> </p>
46
+// *
47
+// * @author BOGON
48
+// * @version 1.0
49
+// * @since JDK 1.8
50
+// */
51
+//@RequiredArgsConstructor
52
+//@Service
53
+//@Slf4j
54
+//public class OkHttpUtil {
55
+//    private static OkHttpClient okHttpClient;
56
+//
57
+//    static final MediaType JSON_TYPE = MediaType.parse("application/json; charset=utf-8");
58
+//
59
+//    public X509TrustManager x509TrustManager() {
60
+//        return new X509TrustManager() {
61
+//            @Override
62
+//            public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
63
+//            }
64
+//
65
+//            @Override
66
+//            public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
67
+//            }
68
+//
69
+//            @Override
70
+//            public X509Certificate[] getAcceptedIssuers() {
71
+//                return new X509Certificate[0];
72
+//            }
73
+//        };
74
+//    }
75
+//
76
+//    public SSLSocketFactory sslSocketFactory() {
77
+//        try {
78
+//            //信任任何链接
79
+//            SSLContext sslContext = SSLContext.getInstance("TLS");
80
+//            sslContext.init(null, new TrustManager[]{x509TrustManager()}, new SecureRandom());
81
+//            return sslContext.getSocketFactory();
82
+//        } catch (NoSuchAlgorithmException e) {
83
+//            e.printStackTrace();
84
+//        } catch (KeyManagementException e) {
85
+//            e.printStackTrace();
86
+//        }
87
+//        return null;
88
+//    }
89
+//
90
+//    /**
91
+//     * Create a new connection pool with tuning parameters appropriate for a single-user
92
+//     * application. The tuning parameters in this pool are subject to change in future OkHttp
93
+//     * releases. Currently
94
+//     */
95
+//    public ConnectionPool pool() {
96
+//        return new ConnectionPool(200, 5, TimeUnit.MINUTES);
97
+//    }
98
+//
99
+//    public OkHttpClient getHttpClient() {
100
+//        if (null == okHttpClient) {
101
+//            okHttpClient = new OkHttpClient.Builder()
102
+//                    .sslSocketFactory(sslSocketFactory(), x509TrustManager())
103
+//                    .addNetworkInterceptor(new OkHttpNetInterceptor())
104
+//                    .retryOnConnectionFailure(false)//是否开启缓存
105
+//                    .connectionPool(pool())//连接池
106
+//                    .connectTimeout(10L, TimeUnit.SECONDS)
107
+//                    .readTimeout(10L, TimeUnit.SECONDS)
108
+//                    .build();
109
+//            return okHttpClient;
110
+//        }
111
+//        return okHttpClient;
112
+//    }
113
+//
114
+//    public R put(String url, String user) {
115
+//        Request request = new Request.Builder()
116
+//                .url(url)
117
+//                .addHeader("Authorization", user)
118
+//                .put(Util.EMPTY_REQUEST)
119
+//                .build();
120
+//        Response response = null;
121
+//        try {
122
+//            response = getHttpClient().newCall(request).execute();
123
+//            if (response.isSuccessful()) {
124
+//                return R.ok();
125
+//            } else {
126
+//                return R.state(false);
127
+//            }
128
+//        } catch (IOException e) {
129
+//            e.printStackTrace();
130
+//        } finally {
131
+//            if (response != null) {
132
+//                response.close();
133
+//            }
134
+//        }
135
+//        return R.state(false);
136
+//    }
137
+//
138
+//    public R delete(String url, String user) {
139
+//        Request request = new Request.Builder()
140
+//                .url(url)
141
+//                .addHeader("Authorization", user)
142
+//                .delete()
143
+//                .build();
144
+//        Response response = null;
145
+//        try {
146
+//            response = getHttpClient().newCall(request).execute();
147
+//            if (response.isSuccessful()) {
148
+//                return R.ok();
149
+//            } else {
150
+//                return R.state(false);
151
+//            }
152
+//        } catch (IOException e) {
153
+//            e.printStackTrace();
154
+//        } finally {
155
+//            if (response != null) {
156
+//                response.close();
157
+//            }
158
+//        }
159
+//        return R.state(false);
160
+//    }
161
+//
162
+//    public <E> R<List<E>> post(String url, Object requestBody, String user) {
163
+//        RequestBody body = RequestBody.create(JSON_TYPE, JSON.toJSONString(requestBody));
164
+//        Request request = new Request.Builder()
165
+//                .url(url)
166
+//                .addHeader("Authorization", user)
167
+//                .post(body)
168
+//                .build();
169
+//        Response response = null;
170
+//        try {
171
+//            response = getHttpClient().newCall(request).execute();
172
+//            if (response.isSuccessful()) {
173
+//                String result = response.body().string();
174
+//                R<List<E>> r = (R<List<E>>) JSON.parseObject(result, R.class);
175
+//                return r;
176
+//            }
177
+//        } catch (IOException e) {
178
+//            e.printStackTrace();
179
+//        } finally {
180
+//            if (response != null) {
181
+//                response.close();
182
+//            }
183
+//        }
184
+//        return R.state(false);
185
+//    }
186
+//
187
+//    public <E> R<E> postReturnOne(String url, Object requestBody, String user) {
188
+//        RequestBody body = RequestBody.create(JSON_TYPE, JSON.toJSONString(requestBody));
189
+//        Request request = new Request.Builder()
190
+//                .url(url)
191
+//                .addHeader("Authorization", user)
192
+//                .post(body)
193
+//                .build();
194
+//        Response response = null;
195
+//        try {
196
+//            response = getHttpClient().newCall(request).execute();
197
+//            if (response.isSuccessful()) {
198
+//                String result = response.body().string();
199
+//                R<E> r = (R<E>) JSON.parseObject(result, R.class);
200
+//                return r;
201
+//            }
202
+//        } catch (IOException e) {
203
+//            e.printStackTrace();
204
+//        } finally {
205
+//            if (response != null) {
206
+//                response.close();
207
+//            }
208
+//        }
209
+//        return R.state(false);
210
+//    }
211
+//
212
+//    public <T> R<List<T>> getList(String url, Map<String, Object> params, String user) {
213
+//
214
+//        final String reposeStr = get(url, params, user);
215
+//        if (Strings.isNullOrEmpty(reposeStr)) {
216
+//            return R.ok(Collections.emptyList());
217
+//        }
218
+//        R<List<T>> r = (R<List<T>>) JSON.parseObject(reposeStr, R.class);
219
+//        return r;
220
+//    }
221
+//
222
+//    public String get(String url, Map<String, Object> params, String user) {
223
+//        Request.Builder reqBuild = new Request.Builder();
224
+//        HttpUrl.Builder urlBuilder = HttpUrl.parse(url)
225
+//                .newBuilder();
226
+//        for (String s : params.keySet()) {
227
+//            if (!Objects.isNull(params.get(s))) {
228
+//                try {
229
+//                    urlBuilder.addQueryParameter(s, URLEncoder.encode(params.get(s).toString(), "UTF-8"));
230
+//                } catch (UnsupportedEncodingException e) {
231
+//                    e.printStackTrace();
232
+//                }
233
+//            }
234
+//        }
235
+//        reqBuild.url(urlBuilder.build());
236
+//        reqBuild.addHeader("Authorization", user);
237
+//        Request request = reqBuild.build();
238
+//        Response response = null;
239
+//        try {
240
+//            response = getHttpClient().newCall(request).execute();
241
+//            if (response.isSuccessful()) {
242
+//                String result = response.body().string();
243
+//                return result;
244
+//            }
245
+//        } catch (Exception e) {
246
+//            e.printStackTrace();
247
+//        } finally {
248
+//            if (response != null) {
249
+//                response.close();
250
+//            }
251
+//        }
252
+//        return "";
253
+//    }
254
+//
255
+//
256
+//    public <T> R<T> getOne(String url, Map<String, Object> params, String user) {
257
+//        final String resposeStr = get(url, params, user);
258
+//        if (Strings.isNullOrEmpty(resposeStr)) {
259
+//            return R.ok();
260
+//        }
261
+//        R<T> r = JSON.parseObject(resposeStr,new TypeReference<R<T>>() {});
262
+//        return r;
263
+//    }
264
+//
265
+//    class OkHttpNetInterceptor implements Interceptor {
266
+//        @Override
267
+//        public Response intercept(Chain chain) throws IOException {
268
+//            Request request = chain.request().newBuilder()
269
+//                    .addHeader("Connection", "close").build();
270
+//            return chain.proceed(request);
271
+//        }
272
+//    }
273
+//}

+ 158 - 0
bpm-client-http/src/main/java/com/srm/bpm/facde/ProcessFLowHttpClient.java

@@ -0,0 +1,158 @@
1
+
2
+
3
+package com.srm.bpm.facde;
4
+
5
+import com.google.common.collect.Maps;
6
+
7
+import com.alibaba.fastjson.JSON;
8
+import com.srm.bpm.facde.dto.BaseProcessDTO;
9
+import com.srm.bpm.facde.dto.ProcessGridDTO;
10
+import com.srm.bpm.facde.dto.ProcessTypeDTO;
11
+import com.srm.common.data.rest.R;
12
+
13
+import java.util.List;
14
+import java.util.Map;
15
+
16
+import cn.hutool.core.util.StrUtil;
17
+import lombok.extern.slf4j.Slf4j;
18
+
19
+/**
20
+ * <p> </p>
21
+ *
22
+ * @author BOGON
23
+ * @version 1.0
24
+ * @since JDK 1.8
25
+ */
26
+@Slf4j
27
+public class ProcessFLowHttpClient extends BaseHttpClient {
28
+    private final RestTemplateUtil restTemplateUtil;
29
+
30
+    public ProcessFLowHttpClient(RestTemplateUtil restTemplateUtil, String host) {
31
+        this.restTemplateUtil = restTemplateUtil;
32
+        if (host.endsWith(StrUtil.C_SLASH + "")) {
33
+            host = host.substring(0, host.length() - 1);
34
+        }
35
+        this.host = host;
36
+    }
37
+
38
+    public R<List<ProcessTypeDTO>> types(String user) {
39
+        Map<String, Object> params = Maps.newHashMap();
40
+        final R<List<ProcessTypeDTO>> objectR = restTemplateUtil.getList(this.host + processUrl + "/type", params, user, ProcessTypeDTO.class);
41
+        return objectR;
42
+    }
43
+
44
+    public R<List<ProcessTypeDTO>> processTypes(String name, String user) {
45
+        Map<String, Object> params = Maps.newHashMap();
46
+        params.put("name", name);
47
+        final R<List<ProcessTypeDTO>> objectR = restTemplateUtil.getList(this.host + processUrl + "/list/type", params, user, ProcessTypeDTO.class);
48
+        return objectR;
49
+    }
50
+
51
+    public R<List<ProcessGridDTO>> grid(
52
+            Map<String, Object> params, String user
53
+    ) {
54
+        final R<List<ProcessGridDTO>> listR = restTemplateUtil.getList(this.host + processUrl + "/list", params, user, ProcessGridDTO.class);
55
+        return listR;
56
+    }
57
+
58
+    public R save(BaseProcessDTO process, String user) {
59
+        final String s = JSON.toJSONString(process);
60
+        return restTemplateUtil.postNoReturn(this.host + processUrl + "/save", JSON.parseObject(s), user);
61
+    }
62
+
63
+    /**
64
+     * 删除流程
65
+     *
66
+     * @param processId 流程
67
+     * @return 删除结果
68
+     */
69
+    public R remove(long processId, String user) {
70
+        final R listR = restTemplateUtil.delete(this.host + processUrl + "/" + processId, user);
71
+        return listR;
72
+    }
73
+
74
+    /**
75
+     * 撤回流程
76
+     *
77
+     * @param processId 流程
78
+     * @return 撤回结果
79
+     */
80
+    public R cancel(long processId, String user) {
81
+        final R listR = restTemplateUtil.put(this.host + processUrl + "/cancel/" + processId, user);
82
+        return listR;
83
+    }
84
+
85
+    /**
86
+     * 启用流程
87
+     *
88
+     * @param processId 流程
89
+     * @return 启动结果
90
+     */
91
+    public R enable(long processId, String user) {
92
+        final R listR = restTemplateUtil.put(this.host + processUrl + "/enable/" + processId, user);
93
+        return listR;
94
+    }
95
+
96
+    /**
97
+     * 禁用流程
98
+     *
99
+     * @param processId 流程
100
+     * @return 禁用结果
101
+     */
102
+    public R disable(long processId, String user) {
103
+        final R listR = restTemplateUtil.put(this.host + processUrl + "/disable/" + processId, user);
104
+        return listR;
105
+    }
106
+
107
+    /**
108
+     * 发布流程
109
+     *
110
+     * @param processId 流程ID
111
+     * @return 发布是否成功
112
+     */
113
+    public R release(
114
+            long processId, String user
115
+    ) {
116
+        final R listR = restTemplateUtil.put(this.host + processUrl + "/release/" + processId, user);
117
+        return listR;
118
+    }
119
+
120
+
121
+    /**
122
+     * 开始使用流程
123
+     *
124
+     * @param processId 流程主键
125
+     * @return 操作响应
126
+     */
127
+    public R open(
128
+            long processId, String user
129
+    ) {
130
+        final R listR = restTemplateUtil.put(this.host + processUrl + "/open/" + processId, user);
131
+        return listR;
132
+    }
133
+
134
+    /**
135
+     * 关闭流程
136
+     *
137
+     * @param processId 流程主键
138
+     * @return 操作响应
139
+     */
140
+    public R closed(long processId, String user) {
141
+        final R listR = restTemplateUtil.put(this.host + processUrl + "/closed/" + processId, user);
142
+        return listR;
143
+    }
144
+
145
+    public R<BaseProcessDTO> info(long processId, String user) {
146
+        Map<String, Object> params = Maps.newConcurrentMap();
147
+        params.put("id", processId);
148
+        final R<BaseProcessDTO> oneR = restTemplateUtil.getOne(this.host + processUrl + "/info", params, user, BaseProcessDTO.class);
149
+        return oneR;
150
+    }
151
+
152
+    public R<String> printTmp(long processId, String user) {
153
+        Map<String, Object> params = Maps.newConcurrentMap();
154
+        params.put("id", processId);
155
+        final R<String> oneR = restTemplateUtil.getOne(this.host + processUrl + "/print/tmp", params, user, String.class);
156
+        return oneR;
157
+    }
158
+}

+ 123 - 0
bpm-client-http/src/main/java/com/srm/bpm/facde/RestTemplateUtil.java

@@ -0,0 +1,123 @@
1
+ 
2
+
3
+package com.srm.bpm.facde;
4
+
5
+import com.alibaba.fastjson.JSON;
6
+import com.alibaba.fastjson.JSONObject;
7
+import com.srm.common.data.rest.R;
8
+
9
+import org.springframework.http.HttpEntity;
10
+import org.springframework.http.HttpHeaders;
11
+import org.springframework.http.HttpMethod;
12
+import org.springframework.http.MediaType;
13
+import org.springframework.http.ResponseEntity;
14
+import org.springframework.stereotype.Service;
15
+import org.springframework.web.client.RestTemplate;
16
+import org.springframework.web.util.UriComponentsBuilder;
17
+
18
+import java.io.UnsupportedEncodingException;
19
+import java.net.URLEncoder;
20
+import java.util.List;
21
+import java.util.Map;
22
+import java.util.Objects;
23
+
24
+import lombok.RequiredArgsConstructor;
25
+import lombok.extern.slf4j.Slf4j;
26
+
27
+/**
28
+ * <p> </p>
29
+ *
30
+ * @author BOGON
31
+ * @version 1.0
32
+ * @since JDK 1.8
33
+ */
34
+@RequiredArgsConstructor
35
+@Service
36
+@Slf4j
37
+public class RestTemplateUtil {
38
+    private final RestTemplate restTemplate;
39
+
40
+    public <T> R getList(String url, Map<String, Object> params, String user, Class<T> clazz) {
41
+        final ResponseEntity<R> exchange = get(url, params, user);
42
+        final String s = JSON.toJSONString(exchange.getBody().getData());
43
+        final List<T> datasourceDTOS = JSON.parseArray(s, clazz);
44
+        if (!Objects.isNull(exchange.getBody()) && !Objects.isNull(exchange.getBody().getTotal())) {
45
+            return R.ok(datasourceDTOS, exchange.getBody().getTotal());
46
+        } else {
47
+            return R.ok(datasourceDTOS);
48
+        }
49
+    }
50
+
51
+    public <T> R<T> getOne(String url, Map<String, Object> params, String user, Class<T> clazz) {
52
+
53
+        final ResponseEntity<R> exchange = get(url, params, user);
54
+        final String s = JSON.toJSONString(exchange.getBody().getData());
55
+        final T datasourceDTOS = JSON.parseObject(s, clazz);
56
+        return R.ok(datasourceDTOS);
57
+    }
58
+
59
+    private ResponseEntity<R> get(String url, Map<String, Object> params, String user) {
60
+        HttpEntity<String> a = new HttpEntity(getAuthHeader(user));
61
+        UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url);
62
+        for (String s : params.keySet()) {
63
+            if (Objects.isNull(params.get(s))) {
64
+                builder.queryParam(s, "");
65
+                continue;
66
+            }
67
+            try {
68
+                builder.queryParam(s, URLEncoder.encode(params.get(s).toString(), "UTF-8"));
69
+            } catch (UnsupportedEncodingException e) {
70
+                e.printStackTrace();
71
+            }
72
+        }
73
+        String realUrl = builder.build().toString();
74
+        final ResponseEntity<R> exchange = restTemplate.exchange(realUrl, HttpMethod.GET, a, R.class);
75
+        return exchange;
76
+    }
77
+
78
+    public <E> R<E> postReturnOne(String url, JSONObject data, String user, Class<E> clazz) {
79
+        final ResponseEntity<R> exchange = post(url, data, user);
80
+        final String s = JSON.toJSONString(exchange.getBody().getData());
81
+        final E datasourceDTOS = JSON.parseObject(s, clazz);
82
+        return R.ok(datasourceDTOS);
83
+    }
84
+
85
+    public R postNoReturn(String url, JSONObject data, String user) {
86
+        final ResponseEntity<R> exchange = post(url, data, user);
87
+        return R.ok();
88
+    }
89
+
90
+    public <E> R<List<E>> postReturnList(String url, JSONObject data, String user, Class<E> clazz) {
91
+        final ResponseEntity<R> exchange = post(url, data, user);
92
+        final String s = JSON.toJSONString(exchange.getBody().getData());
93
+        final List<E> datasourceDTOS = JSON.parseArray(s, clazz);
94
+        return R.ok(datasourceDTOS);
95
+    }
96
+
97
+    public ResponseEntity<R> post(String url, JSONObject data, String user) {
98
+        final HttpHeaders authHeader = getAuthHeader(user);
99
+        authHeader.setContentType(MediaType.APPLICATION_JSON);
100
+        HttpEntity<String> a = new HttpEntity(data, authHeader);
101
+        final ResponseEntity<R> exchange = restTemplate.exchange(url, HttpMethod.POST, a, R.class);
102
+        return exchange;
103
+    }
104
+
105
+    public R delete(String url, String user) {
106
+        HttpEntity<String> a = new HttpEntity(getAuthHeader(user));
107
+        final ResponseEntity<R> exchange = restTemplate.exchange(url, HttpMethod.DELETE, a, R.class);
108
+        return R.state((Boolean) exchange.getBody().getData());
109
+    }
110
+
111
+    public R put(String url, String user) {
112
+        HttpEntity<String> a = new HttpEntity(getAuthHeader(user));
113
+        final ResponseEntity<R> exchange = restTemplate.exchange(url, HttpMethod.PUT, a, R.class);
114
+        return R.state((Boolean) exchange.getBody().getData());
115
+    }
116
+
117
+    private HttpHeaders getAuthHeader(String user) {
118
+        HttpHeaders header = new HttpHeaders();
119
+        header.add("Authorization", user);
120
+        return header;
121
+    }
122
+}
123
+

+ 45 - 0
bpm-client/pom.xml

@@ -0,0 +1,45 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+
3
+
4
+<project xmlns="http://maven.apache.org/POM/4.0.0"
5
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
7
+    <modelVersion>4.0.0</modelVersion>
8
+
9
+    <parent>
10
+        <groupId>com.srm.bpm</groupId>
11
+       <artifactId>bpm-pom</artifactId>
12
+          <version>0.0.1-SNAPSHOT</version>
13
+    </parent>
14
+
15
+    <artifactId>bpm-client</artifactId>
16
+    <version>${parent.version}</version>
17
+    <dependencies>
18
+        <dependency>
19
+            <groupId>com.srm.bpm</groupId>
20
+            <artifactId>common-base</artifactId>
21
+            <version>0.0.1-SNAPSHOT</version>
22
+        </dependency>
23
+        <dependency>
24
+            <groupId>com.alibaba.cloud</groupId>
25
+            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
26
+            <version>2.2.5.RELEASE</version>
27
+        </dependency>
28
+        <dependency>
29
+            <groupId>org.springframework.cloud</groupId>
30
+            <artifactId>spring-cloud-starter-openfeign</artifactId>
31
+            <version>2.2.5.RELEASE</version>
32
+        </dependency>
33
+        <dependency>
34
+            <groupId>io.github.openfeign</groupId>
35
+            <artifactId>feign-httpclient</artifactId>
36
+            <version>10.10.1</version>
37
+        </dependency>
38
+        <dependency>
39
+            <groupId>com.srm.bpm</groupId>
40
+            <artifactId>bpm-client-base</artifactId>
41
+            <version>${parent.version}</version>
42
+        </dependency>
43
+    </dependencies>
44
+
45
+</project>

+ 40 - 0
bpm-client/src/main/java/com/srm/bpm/facade/feign/BillFeignClient.java

@@ -0,0 +1,40 @@
1
+
2
+
3
+package com.srm.bpm.facade.feign;
4
+
5
+import com.srm.bpm.facade.feign.fallback.BillFeignClientFallback;
6
+import com.srm.bpm.facde.dto.BillItemDTO;
7
+import com.srm.common.data.rest.R;
8
+
9
+import org.springframework.cloud.openfeign.FeignClient;
10
+import org.springframework.web.bind.annotation.GetMapping;
11
+import org.springframework.web.bind.annotation.RequestParam;
12
+
13
+import java.util.Map;
14
+
15
+/**
16
+ * <p> </p>
17
+ *
18
+ * @author BOGON
19
+ * @version 1.0
20
+ * @since JDK 1.8
21
+ */
22
+@FeignClient(name = "bpm-server", fallback = BillFeignClientFallback.class)
23
+public interface BillFeignClient {
24
+    String BaseURL="/bill/list/feign";
25
+
26
+    @GetMapping(BaseURL+"/approved")
27
+    R<BillItemDTO> approved(@RequestParam Map<String, Object> params);
28
+
29
+    @GetMapping(BaseURL+"/todo")
30
+    R<BillItemDTO> todo(@RequestParam Map<String, Object> params);
31
+
32
+    @GetMapping(BaseURL+"/minecreate")
33
+    R<BillItemDTO> minecreate(@RequestParam Map<String, Object> params);
34
+
35
+    @GetMapping(BaseURL+"/drafts")
36
+    R<BillItemDTO> drafts(@RequestParam Map<String, Object> params);
37
+
38
+    @GetMapping(BaseURL+"/cc")
39
+    R<BillItemDTO> cc(@RequestParam Map<String, Object> params);
40
+}

+ 49 - 0
bpm-client/src/main/java/com/srm/bpm/facade/feign/fallback/BillFeignClientFallback.java

@@ -0,0 +1,49 @@
1
+
2
+
3
+package com.srm.bpm.facade.feign.fallback;
4
+
5
+import com.srm.bpm.facade.feign.BillFeignClient;
6
+import com.srm.bpm.facde.dto.BillItemDTO;
7
+import com.srm.common.data.rest.R;
8
+
9
+import org.springframework.stereotype.Component;
10
+
11
+import java.util.Map;
12
+
13
+import lombok.extern.slf4j.Slf4j;
14
+
15
+/**
16
+ * <p> </p>
17
+ *
18
+ * @author BOGON
19
+ * @version 1.0
20
+ * @since JDK 1.8
21
+ */
22
+@Component
23
+@Slf4j
24
+public class BillFeignClientFallback implements BillFeignClient {
25
+    @Override
26
+    public R<BillItemDTO> approved(Map<String, Object> params) {
27
+        return null;
28
+    }
29
+
30
+    @Override
31
+    public R<BillItemDTO> todo(Map<String, Object> params) {
32
+        return null;
33
+    }
34
+
35
+    @Override
36
+    public R<BillItemDTO> minecreate(Map<String, Object> params) {
37
+        return null;
38
+    }
39
+
40
+    @Override
41
+    public R<BillItemDTO> drafts(Map<String, Object> params) {
42
+        return null;
43
+    }
44
+
45
+    @Override
46
+    public R<BillItemDTO> cc(Map<String, Object> params) {
47
+        return null;
48
+    }
49
+}

+ 133 - 0
bpm-core/pom.xml

@@ -0,0 +1,133 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+
3
+
4
+<project xmlns="http://maven.apache.org/POM/4.0.0"
5
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
7
+    <modelVersion>4.0.0</modelVersion>
8
+
9
+    <parent>
10
+        <groupId>com.srm.bpm</groupId>
11
+        <artifactId>bpm-pom</artifactId>
12
+        <version>0.0.1-SNAPSHOT</version>
13
+    </parent>
14
+
15
+    <artifactId>bpm-core</artifactId>
16
+    <version>${parent.version}</version>
17
+    <packaging>jar</packaging>
18
+
19
+    <dependencies>
20
+        <dependency>
21
+            <groupId>com.srm.bpm</groupId>
22
+            <artifactId>data</artifactId>
23
+            <version>0.0.1-SNAPSHOT</version>
24
+        </dependency>
25
+        <dependency>
26
+            <groupId>com.srm.bpm</groupId>
27
+            <artifactId>common-base</artifactId>
28
+            <version>0.0.1-SNAPSHOT</version>
29
+        </dependency>
30
+        <dependency>
31
+            <groupId>org.springframework.boot</groupId>
32
+            <artifactId>spring-boot-starter-actuator</artifactId>
33
+        </dependency>
34
+        <dependency>
35
+            <groupId>org.springframework.boot</groupId>
36
+            <artifactId>spring-boot-starter-jdbc</artifactId>
37
+        </dependency>
38
+
39
+        <dependency>
40
+            <groupId>com.baomidou</groupId>
41
+            <artifactId>mybatis-plus</artifactId>
42
+        </dependency>
43
+        <dependency>
44
+            <groupId>com.baomidou</groupId>
45
+            <artifactId>mybatis-plus-boot-starter</artifactId>
46
+        </dependency>
47
+        <dependency>
48
+            <groupId>com.alibaba</groupId>
49
+            <artifactId>druid-spring-boot-starter</artifactId>
50
+            <version>1.1.23</version>
51
+        </dependency>
52
+        <dependency>
53
+            <groupId>org.hibernate.validator</groupId>
54
+            <artifactId>hibernate-validator</artifactId>
55
+        </dependency>
56
+        <dependency>
57
+            <groupId>org.springframework.boot</groupId>
58
+            <artifactId>spring-boot-starter-web</artifactId>
59
+        </dependency>
60
+        <dependency>
61
+            <groupId>org.apache.commons</groupId>
62
+            <artifactId>commons-lang3</artifactId>
63
+        </dependency>
64
+        <dependency>
65
+            <groupId>org.springframework.boot</groupId>
66
+            <artifactId>spring-boot-starter-freemarker</artifactId>
67
+        </dependency>
68
+        <dependency>
69
+            <groupId>org.activiti</groupId>
70
+            <artifactId>activiti-spring-boot-starter-basic</artifactId>
71
+            <version>6.0.0</version>
72
+        </dependency>
73
+        <dependency>
74
+            <groupId>dom4j</groupId>
75
+            <artifactId>dom4j</artifactId>
76
+            <version>1.6.1</version>
77
+        </dependency>
78
+        <dependency>
79
+            <groupId>jaxen</groupId>
80
+            <artifactId>jaxen</artifactId>
81
+        </dependency>
82
+        <dependency>
83
+            <groupId>mysql</groupId>
84
+            <artifactId>mysql-connector-java</artifactId>
85
+        </dependency>
86
+        <dependency>
87
+            <groupId>com.alibaba</groupId>
88
+            <artifactId>fastjson</artifactId>
89
+            <version>1.2.73</version>
90
+            <scope>compile</scope>
91
+        </dependency>
92
+        <dependency>
93
+            <groupId>com.github.xiaoymin</groupId>
94
+            <artifactId>knife4j-spring-boot-starter</artifactId>
95
+            <version>2.0.1</version>
96
+        </dependency>
97
+        <dependency>
98
+            <groupId>de.codecentric</groupId>
99
+            <artifactId>spring-boot-admin-starter-client</artifactId>
100
+            <version>2.3.1</version>
101
+        </dependency>
102
+        <dependency>
103
+            <groupId>org.springframework.boot</groupId>
104
+            <artifactId>spring-boot-starter-security</artifactId>
105
+            <version>2.3.8.RELEASE</version>
106
+        </dependency>
107
+        <dependency>
108
+            <groupId>org.jolokia</groupId>
109
+            <artifactId>jolokia-core</artifactId>
110
+            <version>1.6.2</version>
111
+        </dependency>
112
+        <dependency>
113
+            <groupId>com.srm.bpm</groupId>
114
+            <artifactId>bpm-client-http</artifactId>
115
+            <version>${parent.version}</version>
116
+        </dependency>
117
+        <dependency>
118
+            <groupId>cn.afterturn</groupId>
119
+            <artifactId>easypoi-spring-boot-starter</artifactId>
120
+            <version>4.3.0</version>
121
+        </dependency>
122
+        <dependency>
123
+            <groupId>com.srm.bpm</groupId>
124
+            <artifactId>bpm-client-base</artifactId>
125
+            <version>${parent.version}</version>
126
+        </dependency>
127
+        <dependency>
128
+            <groupId>io.seata</groupId>
129
+            <artifactId>seata-spring-boot-starter</artifactId>
130
+            <version>1.4.2</version>
131
+        </dependency>
132
+    </dependencies>
133
+</project>

+ 262 - 0
bpm-core/src/main/java/com/srm/bpm/facade/feign/BillListFeignController.java

@@ -0,0 +1,262 @@
1
+
2
+
3
+package com.srm.bpm.facade.feign;
4
+
5
+import com.google.common.base.Strings;
6
+
7
+import com.alibaba.fastjson.JSON;
8
+import com.srm.bpm.facde.dto.BillItemDTO;
9
+import com.srm.bpm.facde.dto.BillTaskDTO;
10
+import com.srm.bpm.facde.dto.ProcessTypeDTO;
11
+import com.srm.bpm.logic.converts.BillBasicConvert;
12
+import com.srm.bpm.logic.converts.ProcessBasicConvert;
13
+import com.srm.bpm.logic.query.list.ApprovedBillQuery;
14
+import com.srm.bpm.logic.query.list.CcBillQuery;
15
+import com.srm.bpm.logic.query.list.DraftBillQuery;
16
+import com.srm.bpm.logic.query.list.MeCreateBillQuery;
17
+import com.srm.bpm.logic.query.list.TodoBillQuery;
18
+import com.srm.bpm.logic.service.BillLogic;
19
+import com.srm.bpm.logic.service.BillTaskLogic;
20
+import com.srm.bpm.logic.vo.BillItemVO;
21
+import com.srm.bpm.logic.vo.BillTaskVO;
22
+import com.srm.bpm.logic.vo.ProcessTypeVO;
23
+import com.srm.common.data.rest.R;
24
+
25
+import org.apache.commons.lang3.tuple.Pair;
26
+import org.springframework.web.bind.annotation.GetMapping;
27
+import org.springframework.web.bind.annotation.RequestMapping;
28
+import org.springframework.web.bind.annotation.RequestParam;
29
+import org.springframework.web.bind.annotation.RestController;
30
+
31
+import java.io.UnsupportedEncodingException;
32
+import java.net.URLDecoder;
33
+import java.util.List;
34
+import java.util.Map;
35
+
36
+import io.swagger.annotations.Api;
37
+import io.swagger.annotations.ApiImplicitParam;
38
+import io.swagger.annotations.ApiImplicitParams;
39
+import io.swagger.annotations.ApiOperation;
40
+import lombok.RequiredArgsConstructor;
41
+import springfox.documentation.annotations.ApiIgnore;
42
+
43
+/**
44
+ * <p> </p>
45
+ *
46
+ * @author BOGON
47
+ * @version 1.0
48
+ * @since JDK 1.8
49
+ */
50
+@RequestMapping("/bill/list/feign")
51
+@RestController
52
+@RequiredArgsConstructor
53
+@Api(tags = "审批单列表")
54
+public class BillListFeignController {
55
+    private final BillLogic billLogic;
56
+    private final BillTaskLogic billTaskLogic;
57
+    private final BillBasicConvert billBasicConvert;
58
+    private final ProcessBasicConvert processBasicConvert;
59
+
60
+    /**
61
+     * 获取我已审批的审批单
62
+     *
63
+     * @return 待我审批列表
64
+     */
65
+    @ApiOperation(value = "分页查询我已审批的审批单", httpMethod = "GET")
66
+    @ApiImplicitParams(
67
+            {
68
+                    @ApiImplicitParam(name = "page", defaultValue = "1"),
69
+                    @ApiImplicitParam(name = "limit", defaultValue = "10"),
70
+                    @ApiImplicitParam(name = "q", value = "查询参数", defaultValue = "")
71
+            })
72
+    @GetMapping("approved")
73
+    public R<List<BillItemDTO>> approved(
74
+            @ApiIgnore @RequestParam Map<String, Object> params
75
+    ) {
76
+        final Integer pageNo = Integer.valueOf((String) params.get("page"));
77
+        final Integer pageSize = Integer.valueOf((String) params.get("limit"));
78
+        final String q = (String) params.get("q");
79
+        String filterText = decode(q);
80
+        final ApprovedBillQuery query;
81
+        if (!Strings.isNullOrEmpty(filterText)) {
82
+            query = JSON.parseObject(filterText, ApprovedBillQuery.class);
83
+        } else {
84
+            query = new ApprovedBillQuery();
85
+        }
86
+        Pair<List<BillItemVO>, Long> result = billLogic.findApproved(pageNo, pageSize, query);
87
+        final List<BillItemVO> key = result.getKey();
88
+        return R.ok(billBasicConvert.billItemsVOToDTO(key), result.getValue());
89
+    }
90
+
91
+
92
+    /**
93
+     * 获取待我审批的审批单
94
+     *
95
+     * @return 获取待我审批的列表
96
+     */
97
+    @ApiOperation(value = "分页查询待我审批的审批单", httpMethod = "GET")
98
+    @ApiImplicitParams(
99
+            {
100
+                    @ApiImplicitParam(name = "page", defaultValue = "1"),
101
+                    @ApiImplicitParam(name = "limit", defaultValue = "10"),
102
+                    @ApiImplicitParam(name = "q", value = "查询参数", defaultValue = "")
103
+            })
104
+    @GetMapping("/todo")
105
+    public R<List<BillItemDTO>> todo(
106
+            @ApiIgnore @RequestParam Map<String, Object> params) {
107
+
108
+        final Integer pageNo = Integer.valueOf((String) params.get("page"));
109
+        final Integer pageSize = Integer.valueOf((String) params.get("limit"));
110
+        final String q = (String) params.get("q");
111
+        String filterText = decode(q);
112
+        TodoBillQuery query = null;
113
+        if (!Strings.isNullOrEmpty(filterText)) {
114
+            query = JSON.parseObject(filterText, TodoBillQuery.class);
115
+        }
116
+        Pair<List<BillItemVO>, Long> result = billLogic.findTodo(pageNo, pageSize, query);
117
+        final List<BillItemVO> key = result.getKey();
118
+        return R.ok(billBasicConvert.billItemsVOToDTO(key), result.getValue());
119
+    }
120
+
121
+    /**
122
+     * 获取我发起的审批
123
+     *
124
+     * @return 我发起的列表
125
+     */
126
+    @ApiOperation(value = "分页查询我发起的审批", httpMethod = "GET")
127
+    @ApiImplicitParams(
128
+            {
129
+                    @ApiImplicitParam(name = "page", defaultValue = "1"),
130
+                    @ApiImplicitParam(name = "limit", defaultValue = "10"),
131
+                    @ApiImplicitParam(name = "q", value = "查询参数", defaultValue = "")
132
+            })
133
+    @GetMapping("/minecreate")
134
+    public R<List<BillItemDTO>> sended(
135
+            @ApiIgnore @RequestParam Map<String, Object> params) {
136
+        final Integer pageNo = Integer.valueOf((String) params.get("page"));
137
+        final Integer pageSize = Integer.valueOf((String) params.get("limit"));
138
+        final String q = (String) params.get("q");
139
+        String filterText = decode(q);
140
+        MeCreateBillQuery billQuery = null;
141
+        if (!Strings.isNullOrEmpty(filterText)) {
142
+            billQuery = JSON.parseObject(filterText, MeCreateBillQuery.class);
143
+        }
144
+        Pair<List<BillItemVO>, Long> result = billLogic.findMeCreate(pageNo, pageSize, billQuery);
145
+        final List<BillItemVO> key = result.getKey();
146
+        return R.ok(billBasicConvert.billItemsVOToDTO(key), result.getValue());
147
+    }
148
+
149
+
150
+    /**
151
+     * 获取我的草稿
152
+     *
153
+     * @return 我的草稿
154
+     */
155
+    @GetMapping("/drafts")
156
+    @ApiOperation(value = "分页查询我的草稿审批", httpMethod = "GET")
157
+    @ApiImplicitParams(
158
+            {
159
+                    @ApiImplicitParam(name = "page", defaultValue = "1"),
160
+                    @ApiImplicitParam(name = "limit", defaultValue = "10"),
161
+                    @ApiImplicitParam(name = "q", value = "查询参数", defaultValue = "")
162
+            })
163
+    public R<List<BillItemDTO>> drafts(@ApiIgnore @RequestParam Map<String, Object> params) {
164
+
165
+        final Integer pageNo = Integer.valueOf((String) params.get("page"));
166
+        final Integer pageSize = Integer.valueOf((String) params.get("limit"));
167
+        final String q = (String) params.get("q");
168
+        String filterText = decode(q);
169
+        DraftBillQuery query = null;
170
+        if (!Strings.isNullOrEmpty(filterText)) {
171
+            query = JSON.parseObject(filterText, DraftBillQuery.class);
172
+        }
173
+        final Pair<List<BillItemVO>, Long> result = billLogic.findDraft(pageNo, pageSize, query);
174
+        final List<BillItemVO> key = result.getKey();
175
+        return R.ok(billBasicConvert.billItemsVOToDTO(key), result.getValue());
176
+    }
177
+
178
+
179
+    /**
180
+     * 抄送我的
181
+     *
182
+     * @return 我的草稿
183
+     */
184
+    @ApiOperation(value = "分页查询抄送我的审批", httpMethod = "GET")
185
+    @ApiImplicitParams(
186
+            {
187
+                    @ApiImplicitParam(name = "page", defaultValue = "1"),
188
+                    @ApiImplicitParam(name = "limit", defaultValue = "10"),
189
+                    @ApiImplicitParam(name = "q", value = "查询参数", defaultValue = "")
190
+            })
191
+    @GetMapping("/cc")
192
+    public R<List<BillItemDTO>> cc(@ApiIgnore @RequestParam Map<String, Object> params) {
193
+        final Integer pageNo = Integer.valueOf((String) params.get("page"));
194
+        final Integer pageSize = Integer.valueOf((String) params.get("limit"));
195
+        final String q = (String) params.get("q");
196
+        String filterText = decode(q);
197
+        CcBillQuery query = null;
198
+        if (!Strings.isNullOrEmpty(filterText)) {
199
+            query = JSON.parseObject(filterText, CcBillQuery.class);
200
+        }
201
+        final Pair<List<BillItemVO>, Long> result = billLogic.findCc(pageNo, pageSize, query);
202
+        final List<BillItemVO> key = result.getKey();
203
+        return R.ok(billBasicConvert.billItemsVOToDTO(key), result.getValue());
204
+    }
205
+
206
+    private String decode(String q) {
207
+        String filterText = "";
208
+        try {
209
+            filterText = URLDecoder.decode(Strings.isNullOrEmpty(q) ? "" : q, "UTF-8");
210
+        } catch (UnsupportedEncodingException e) {
211
+            e.printStackTrace();
212
+        }
213
+        return filterText;
214
+    }
215
+
216
+    @GetMapping("/todo/size")
217
+    public R<String> todoSize() {
218
+        String todoSize = billLogic.findTodoSize();
219
+        return R.ok(todoSize);
220
+    }
221
+
222
+    @ApiOperation(value = "待我审批的各类审批数量", httpMethod = "GET")
223
+    @GetMapping("/todo/cate/size")
224
+    public R<List<ProcessTypeDTO>> todoCateSize() {
225
+        List<ProcessTypeVO> result = billLogic.findTodoCateSize();
226
+        final List<ProcessTypeDTO> processTypeDTOS = processBasicConvert.processTypeVOToDTOs(result);
227
+        return R.ok(processTypeDTOS);
228
+    }
229
+
230
+    @GetMapping("/history/tasks")
231
+    public R<List<BillTaskDTO>> getHistoryTasks(Long billId) {
232
+        List<BillTaskVO> billTaskVOS = billTaskLogic.getHistoryTasks(billId);
233
+        return R.ok(billBasicConvert.billTaskVOToDTO(billTaskVOS));
234
+    }
235
+
236
+    /**
237
+     * 抄送我的
238
+     *
239
+     * @return 我的草稿
240
+     */
241
+    @ApiOperation(value = "分页查询审批单", httpMethod = "GET")
242
+    @ApiImplicitParams(
243
+            {
244
+                    @ApiImplicitParam(name = "page", defaultValue = "1"),
245
+                    @ApiImplicitParam(name = "limit", defaultValue = "10"),
246
+                    @ApiImplicitParam(name = "q", value = "查询参数", defaultValue = "")
247
+            })
248
+    @GetMapping("/all/bill")
249
+    public R<List<BillItemDTO>> forSelect(@ApiIgnore @RequestParam Map<String, Object> params) {
250
+        final Integer pageNo = Integer.valueOf((String) params.get("page"));
251
+        final Integer pageSize = Integer.valueOf((String) params.get("limit"));
252
+        final String q = (String) params.get("q");
253
+        String filterText = decode(q);
254
+        DraftBillQuery query = null;
255
+        if (!Strings.isNullOrEmpty(filterText)) {
256
+            query = JSON.parseObject(filterText, DraftBillQuery.class);
257
+        }
258
+        final Pair<List<BillItemVO>, Long> result = billLogic.findAllByQuery(pageNo, pageSize, query);
259
+        final List<BillItemVO> key = result.getKey();
260
+        return R.ok(billBasicConvert.billItemsVOToDTO(key), result.getValue());
261
+    }
262
+}

+ 226 - 0
bpm-core/src/main/java/com/srm/bpm/facade/feign/BillProcessFeignController.java

@@ -0,0 +1,226 @@
1
+
2
+
3
+package com.srm.bpm.facade.feign;
4
+
5
+import com.google.common.base.Strings;
6
+import com.google.common.collect.Lists;
7
+
8
+import com.srm.bpm.facde.dto.BaseProcessDTO;
9
+import com.srm.bpm.facde.dto.ProcessDTO;
10
+import com.srm.bpm.facde.dto.ProcessGridDTO;
11
+import com.srm.bpm.facde.dto.ProcessTypeDTO;
12
+import com.srm.bpm.logic.converts.ProcessBasicConvert;
13
+import com.srm.bpm.logic.service.LoginUserHolder;
14
+import com.srm.bpm.logic.service.ProcessFlowLogic;
15
+import com.srm.bpm.logic.service.ProcessTypeLogic;
16
+import com.srm.bpm.logic.vo.ProcessTypeVO;
17
+import com.srm.bpm.logic.vo.ProcessVO;
18
+import com.srm.common.data.rest.R;
19
+
20
+import org.springframework.web.bind.annotation.DeleteMapping;
21
+import org.springframework.web.bind.annotation.GetMapping;
22
+import org.springframework.web.bind.annotation.PathVariable;
23
+import org.springframework.web.bind.annotation.PostMapping;
24
+import org.springframework.web.bind.annotation.PutMapping;
25
+import org.springframework.web.bind.annotation.RequestBody;
26
+import org.springframework.web.bind.annotation.RequestMapping;
27
+import org.springframework.web.bind.annotation.RequestParam;
28
+import org.springframework.web.bind.annotation.RestController;
29
+
30
+import java.util.List;
31
+import java.util.Map;
32
+import java.util.Set;
33
+
34
+import cn.hutool.core.lang.Pair;
35
+import io.swagger.annotations.Api;
36
+import io.swagger.annotations.ApiImplicitParam;
37
+import io.swagger.annotations.ApiImplicitParams;
38
+import io.swagger.annotations.ApiOperation;
39
+import lombok.RequiredArgsConstructor;
40
+import springfox.documentation.annotations.ApiIgnore;
41
+
42
+/**
43
+ * <p> </p>
44
+ *
45
+ * @author BOGON
46
+ * @version 1.0
47
+ * @since JDK 1.8
48
+ */
49
+@RequestMapping("/bill/process/feign")
50
+@RestController
51
+@RequiredArgsConstructor
52
+@Api(tags = "流程列表")
53
+public class BillProcessFeignController {
54
+    private final ProcessTypeLogic processTypeLogic;
55
+    private final LoginUserHolder loginUserHolder;
56
+    private final ProcessFlowLogic processFlowLogic;
57
+    private final ProcessBasicConvert processBasicConvert;
58
+
59
+    /**
60
+     * 获取系统已经开启的业务流程列表接口,连同业务流程类型一起将数据放回
61
+     *
62
+     * @return 业务流程列表
63
+     */
64
+    @ApiOperation(value = "查询可以发起的流程列表", httpMethod = "GET")
65
+    @GetMapping("list/type")
66
+    public R<List<ProcessTypeDTO>> listType(String name) {
67
+        final String userCode = loginUserHolder.getUserCode();
68
+        final Set<String> userOrgs = loginUserHolder.getUserOrgs();
69
+        final String bloc = loginUserHolder.getBloc();
70
+        final List<ProcessTypeVO> processTypes = this.processTypeLogic.selectAllWithTypeGroup(userCode, userOrgs, bloc, Strings.isNullOrEmpty(name) ? "" : name);
71
+        List<ProcessTypeDTO> result = Lists.newArrayList();
72
+        for (ProcessTypeVO processType : processTypes) {
73
+            final List<ProcessVO> flows = processType.getFlows();
74
+            List<ProcessDTO> a = processBasicConvert.processVOtoDTO(flows);
75
+            final ProcessTypeDTO processTypeDTO = processBasicConvert.processTypeVOToDTO(processType);
76
+            processTypeDTO.setFlows(a);
77
+            result.add(processTypeDTO);
78
+        }
79
+        return R.ok(result);
80
+    }
81
+
82
+    /**
83
+     * 获取系统的流程分类
84
+     *
85
+     * @return 流程分类
86
+     */
87
+    @ApiOperation(value = "查询流程分类列表", httpMethod = "GET")
88
+    @GetMapping("/type")
89
+    public R<List<ProcessTypeDTO>> allType() {
90
+        List<ProcessTypeDTO> result = processTypeLogic.getAllType();
91
+        return R.ok(result);
92
+    }
93
+
94
+    @ApiOperation(value = "分页查询流程", httpMethod = "GET")
95
+    @ApiImplicitParams(
96
+            {
97
+                    @ApiImplicitParam(name = "page", defaultValue = "1"),
98
+                    @ApiImplicitParam(name = "limit", defaultValue = "10")
99
+            })
100
+    @GetMapping("/list")
101
+    public R<List<ProcessGridDTO>> grid(
102
+            @ApiIgnore @RequestParam Map<String, Object> params
103
+    ) {
104
+        final Integer pageNo = Integer.valueOf((String) params.get("page"));
105
+        final Integer pageSize = Integer.valueOf((String) params.get("limit"));
106
+        final String bloc = loginUserHolder.getBloc();
107
+        Pair<List<ProcessGridDTO>, Long> pair = processFlowLogic.getProcessFlowByPage(pageNo, pageSize, params, bloc);
108
+        return R.ok(pair.getKey(), pair.getValue());
109
+    }
110
+
111
+    @ApiOperation(value = "获取流程基础信息", httpMethod = "GET")
112
+    @GetMapping("info")
113
+    public R<BaseProcessDTO> detail(
114
+            Long id
115
+    ) {
116
+        BaseProcessDTO result = processFlowLogic.getBaseInfo(id);
117
+        return R.ok(result);
118
+    }
119
+
120
+
121
+    @ApiOperation(value = "保存流程基本信息", httpMethod = "POST")
122
+    @PostMapping("save")
123
+    public R save(@RequestBody BaseProcessDTO process) {
124
+        final String bloc = loginUserHolder.getBloc();
125
+        return R.state(this.processFlowLogic.saveProcess(process, bloc));
126
+    }
127
+
128
+    /**
129
+     * 删除流程
130
+     *
131
+     * @param processId 流程
132
+     * @return 删除结果
133
+     */
134
+    @ApiOperation(value = "删除流程", httpMethod = "DELETE")
135
+    @ApiImplicitParam(name = "id", value = "流程id", required = true, paramType = "path", dataType = "Long")
136
+    @DeleteMapping("/{id}")
137
+    public R remove(@ApiIgnore @PathVariable(value = "id", required = false) long processId) {
138
+        return R.state(processFlowLogic.removeProcess(processId));
139
+    }
140
+
141
+    /**
142
+     * 撤回流程
143
+     *
144
+     * @param processId 流程
145
+     * @return 撤回结果
146
+     */
147
+    @ApiOperation(value = "撤回流程", httpMethod = "PUT")
148
+    @ApiImplicitParam(name = "id", value = "流程id", required = true, paramType = "path", dataType = "Long")
149
+    @PutMapping("/cancel/{id}")
150
+    public R cancel(@ApiIgnore @PathVariable(value = "id", required = false) long processId) {
151
+        return R.state(processFlowLogic.cancelProcess(processId));
152
+    }
153
+
154
+    /**
155
+     * 启用流程
156
+     *
157
+     * @param processId 流程
158
+     * @return 启动结果
159
+     */
160
+    @ApiOperation(value = "启用流程", httpMethod = "PUT")
161
+    @ApiImplicitParam(name = "id", value = "流程id", required = true, paramType = "path", dataType = "Long")
162
+    @PutMapping("/enable/{id}")
163
+    public R enable(@ApiIgnore @PathVariable(value = "id", required = false) long processId) {
164
+        return R.state(processFlowLogic.enableProcess(processId));
165
+    }
166
+
167
+    /**
168
+     * 禁用流程
169
+     *
170
+     * @param processId 流程
171
+     * @return 禁用结果
172
+     */
173
+    @ApiOperation(value = "禁用流程", httpMethod = "PUT")
174
+    @ApiImplicitParam(name = "id", value = "流程id", required = true, paramType = "path", dataType = "Long")
175
+    @PutMapping("/disable/{id}")
176
+    public R disable(@ApiIgnore @PathVariable(value = "id", required = false) long processId) {
177
+        return R.state(processFlowLogic.disableProcess(processId));
178
+    }
179
+
180
+    /**
181
+     * 发布流程
182
+     *
183
+     * @param processId 流程ID
184
+     * @return 发布是否成功
185
+     */
186
+    @ApiOperation(value = "发布流程", httpMethod = "PUT")
187
+    @ApiImplicitParam(name = "id", value = "流程id", required = true, paramType = "path", dataType = "Long")
188
+    @PutMapping("release/{id}")
189
+    public R release(
190
+            @PathVariable(value = "id") long processId
191
+    ) {
192
+        return R.state(this.processFlowLogic.releaseProcess(processId));
193
+    }
194
+
195
+
196
+    /**
197
+     * 开始使用流程
198
+     *
199
+     * @param processId 流程主键
200
+     * @return 操作响应
201
+     */
202
+    @PutMapping("/open/{id}")
203
+    public R open(
204
+            @PathVariable(value = "id") long processId
205
+    ) {
206
+        final boolean openState = this.processFlowLogic.openProcess(processId);
207
+        return R.state(openState);
208
+    }
209
+
210
+    /**
211
+     * 关闭流程
212
+     *
213
+     * @param processId 流程主键
214
+     * @return 操作响应
215
+     */
216
+    @PutMapping("/closed/{id}")
217
+    public R closed(@PathVariable(value = "id") long processId) {
218
+        final boolean openState = this.processFlowLogic.closeProcess(processId);
219
+        return R.state(openState);
220
+    }
221
+
222
+    @GetMapping("/print/tmp")
223
+    public R printTmp(Long id) {
224
+        return R.ok(this.processFlowLogic.getPrintTmp(id));
225
+    }
226
+}

+ 45 - 0
bpm-core/src/main/java/com/srm/bpm/facade/feign/DatasourceFeignController.java

@@ -0,0 +1,45 @@
1
+
2
+
3
+package com.srm.bpm.facade.feign;
4
+
5
+import com.srm.bpm.facde.dto.DatasourceDTO;
6
+import com.srm.bpm.logic.service.DataSourceLogic;
7
+import com.srm.common.data.rest.R;
8
+
9
+import org.springframework.web.bind.annotation.GetMapping;
10
+import org.springframework.web.bind.annotation.RequestMapping;
11
+import org.springframework.web.bind.annotation.RequestParam;
12
+import org.springframework.web.bind.annotation.RestController;
13
+
14
+import java.util.List;
15
+import java.util.Map;
16
+
17
+import cn.hutool.core.lang.Pair;
18
+import io.swagger.annotations.Api;
19
+import lombok.RequiredArgsConstructor;
20
+import springfox.documentation.annotations.ApiIgnore;
21
+
22
+/**
23
+ * <p> </p>
24
+ *
25
+ * @author BOGON
26
+ * @version 1.0
27
+ * @since JDK 1.8
28
+ */
29
+
30
+@RequestMapping("/process/datasource/feign")
31
+@RestController
32
+@RequiredArgsConstructor
33
+@Api(tags = "数据源列表")
34
+public class DatasourceFeignController {
35
+    private final DataSourceLogic dataSourceLogic;
36
+    @GetMapping("/list")
37
+    public R<List<DatasourceDTO>> grid(
38
+            @ApiIgnore @RequestParam Map<String, Object> params
39
+    ) {
40
+        final Integer pageNo = Integer.valueOf((String) params.get("page"));
41
+        final Integer pageSize = Integer.valueOf((String) params.get("limit"));
42
+        Pair<List<DatasourceDTO>, Long> pair = dataSourceLogic.getDatasourceByPage(pageNo, pageSize);
43
+        return R.ok(pair.getKey(), pair.getValue());
44
+    }
45
+}

+ 75 - 0
bpm-core/src/main/java/com/srm/bpm/facade/page/ProcessBillPageController.java

@@ -0,0 +1,75 @@
1
+ 
2
+
3
+package com.srm.bpm.facade.page;
4
+
5
+import com.google.common.base.Strings;
6
+
7
+import com.srm.bpm.logic.service.UserCenterlogic;
8
+import com.srm.config.BpmConfig;
9
+
10
+import org.springframework.stereotype.Controller;
11
+import org.springframework.ui.Model;
12
+import org.springframework.web.bind.annotation.GetMapping;
13
+import org.springframework.web.bind.annotation.RequestMapping;
14
+
15
+import java.util.Objects;
16
+
17
+import javax.servlet.http.Cookie;
18
+import javax.servlet.http.HttpServletRequest;
19
+import javax.servlet.http.HttpServletResponse;
20
+
21
+import lombok.RequiredArgsConstructor;
22
+import lombok.extern.slf4j.Slf4j;
23
+
24
+/**
25
+ * <p> </p>
26
+ *
27
+ * @author BOGON
28
+ * @version 1.0
29
+ * @since JDK 1.8
30
+ */
31
+@Controller
32
+@RequestMapping("/process/bill/page")
33
+@RequiredArgsConstructor
34
+@Slf4j
35
+public class ProcessBillPageController {
36
+    private final UserCenterlogic userFeignClient;
37
+    private final BpmConfig bpmConfig;
38
+
39
+    @GetMapping("/create")
40
+    public String createBill(Long processId,
41
+                             String key,
42
+                             String mode,
43
+                             HttpServletRequest request,
44
+                             Model model,
45
+                             Long billId, HttpServletResponse response) {
46
+        boolean hasToken = isHasToken(request);
47
+        if (!hasToken) {
48
+            final String tokenByKey = userFeignClient.getTokenByKey(key);
49
+            if (Strings.isNullOrEmpty(tokenByKey)) {
50
+                return "404";
51
+            }
52
+            Cookie cookie = new Cookie("token", tokenByKey.replace("bearer ", ""));
53
+            cookie.setPath("/");
54
+            cookie.setHttpOnly(false);
55
+            cookie.setMaxAge(-1);
56
+            response.addCookie(cookie);
57
+            model.addAttribute("targetUrl",bpmConfig.getTargetUrl());
58
+        }
59
+        return "bill/create";
60
+    }
61
+
62
+    public static boolean isHasToken(HttpServletRequest request) {
63
+        final Cookie[] cookies = request.getCookies();
64
+        boolean hasToken = false;
65
+        if (!Objects.isNull(cookies)) {
66
+            for (Cookie cookie : cookies) {
67
+                final String name = cookie.getName();
68
+                if (name.equals("token")) {
69
+                    hasToken = true;
70
+                }
71
+            }
72
+        }
73
+        return false;
74
+    }
75
+}

+ 157 - 0
bpm-core/src/main/java/com/srm/bpm/facade/page/ProcessDesingerPageController.java

@@ -0,0 +1,157 @@
1
+
2
+
3
+package com.srm.bpm.facade.page;
4
+
5
+import com.google.common.base.Strings;
6
+import com.google.common.collect.Maps;
7
+
8
+import com.srm.bpm.logic.constant.BpmnConst;
9
+import com.srm.bpm.logic.dto.FormDesingerDTO;
10
+import com.srm.bpm.logic.dto.ProcessDesingerDTO;
11
+import com.srm.bpm.logic.dto.ProcessDetailDTO;
12
+import com.srm.bpm.logic.service.DataSourceLogic;
13
+import com.srm.bpm.logic.service.ProcessDesingerLogic;
14
+import com.srm.bpm.logic.service.UserCenterlogic;
15
+import com.srm.bpm.logic.vo.DatasourceVO;
16
+import com.srm.config.BpmConfig;
17
+import com.srm.common.util.serialize.JsonMapper;
18
+
19
+import org.springframework.stereotype.Controller;
20
+import org.springframework.ui.Model;
21
+import org.springframework.web.bind.annotation.GetMapping;
22
+import org.springframework.web.bind.annotation.RequestMapping;
23
+import org.springframework.web.bind.annotation.RequestParam;
24
+
25
+import java.util.List;
26
+import java.util.Map;
27
+
28
+import javax.servlet.http.Cookie;
29
+import javax.servlet.http.HttpServletRequest;
30
+import javax.servlet.http.HttpServletResponse;
31
+
32
+import cn.hutool.core.util.StrUtil;
33
+import lombok.RequiredArgsConstructor;
34
+
35
+/**
36
+ * <p> 流程设计器 </p>
37
+ *
38
+ * @author sog
39
+ * @version 1.0
40
+ * @since JDK 1.7
41
+ */
42
+@Controller
43
+@RequestMapping("/process/flow")
44
+@RequiredArgsConstructor
45
+public class ProcessDesingerPageController {
46
+    private final UserCenterlogic userFeignClient;
47
+    private static final String PROTYPE_JSON = "protype_json";
48
+    private final ProcessDesingerLogic processLogic;
49
+    private final DataSourceLogic dataSourceLogic;
50
+    private final BpmConfig bpmConfig;
51
+    /**
52
+     * 流程设计器
53
+     *
54
+     * @param processId 流程ID
55
+     * @param model     视图参数
56
+     * @return 设计界面
57
+     */
58
+    @GetMapping("designer")
59
+    public String index(
60
+            @RequestParam(value = "id", defaultValue = "0") long processId,
61
+            String key,
62
+            HttpServletResponse response,
63
+            HttpServletRequest request,
64
+            Model model
65
+    ) {
66
+        boolean hasToken = ProcessBillPageController.isHasToken(request);
67
+        if (!hasToken) {
68
+            final String tokenByKey = userFeignClient.getTokenByKey(key);
69
+            if (Strings.isNullOrEmpty(tokenByKey)) {
70
+                return "404";
71
+            }
72
+            Cookie cookie = new Cookie("token", tokenByKey.replace("bearer ",""));
73
+            cookie.setPath("/");
74
+            cookie.setHttpOnly(false);
75
+            cookie.setMaxAge(-1);
76
+            response.addCookie(cookie);
77
+            model.addAttribute("type",bpmConfig.getType());
78
+            model.addAttribute("targetUrl",bpmConfig.getTargetUrl());
79
+        }
80
+        if (processId < 0) {
81
+            model.addAttribute("error", "流程id为空");
82
+
83
+        } else {
84
+            ProcessDetailDTO process = processLogic.getByProecessId(processId);
85
+            if (process == null) {
86
+                model.addAttribute("error", "无法找到流程");
87
+            } else {
88
+                model.addAttribute("process", process);
89
+
90
+                final FormDesingerDTO formDesinger = processLogic.getDesingerJSON(processId);
91
+
92
+                final List<DatasourceVO> datasourceVOList = dataSourceLogic.getAllWithForm();
93
+
94
+                String formJSON = "";
95
+                if (formDesinger != null) {
96
+                    final String desingerJson = formDesinger.getDesingerJson();
97
+                    if (!Strings.isNullOrEmpty(desingerJson)) {
98
+                        formJSON = desingerJson;
99
+                    }
100
+                }
101
+                if (Strings.isNullOrEmpty(formJSON)) {
102
+                    Map<String, String> vars = Maps.newHashMapWithExpectedSize(1);
103
+                    vars.put("name", process.getName());
104
+                    formJSON = StrUtil.format(BpmnConst.FORMJSON, vars);
105
+                }
106
+
107
+                final ProcessDesingerDTO desinger = processLogic.getDesingerById(processId);
108
+                final String workflow;
109
+                if (desinger == null) {
110
+                    Map<String, Object> vars = Maps.newHashMapWithExpectedSize(1);
111
+                    vars.put("id", process.getId());
112
+                    vars.put("name", process.getName());
113
+                    vars.put("enable", process.getCloseFlag());
114
+                    workflow = StrUtil.format(BpmnConst.WORKFLOWJSON, vars);
115
+                } else {
116
+                    workflow = desinger.getDesingerJson();
117
+                }
118
+                model.addAttribute("formJSON", formJSON);
119
+                model.addAttribute("datasources", JsonMapper.toJson(datasourceVOList));
120
+                model.addAttribute("positsions", "[]");
121
+                model.addAttribute("icons", "[]");
122
+                model.addAttribute("workflow", workflow);
123
+            }
124
+        }
125
+
126
+
127
+        return "process/designer";
128
+    }
129
+
130
+
131
+    @GetMapping("line")
132
+    public String line(Model model) {
133
+        String jsonProjectTypes = getProjectCategorys();
134
+        model.addAttribute(PROTYPE_JSON, jsonProjectTypes);
135
+        return "process/line";
136
+    }
137
+
138
+    @GetMapping("cc")
139
+    public String cc(Model model) {
140
+
141
+        String jsonProjectTypes = getProjectCategorys();
142
+        model.addAttribute(PROTYPE_JSON, jsonProjectTypes);
143
+        return "process/cc";
144
+    }
145
+
146
+    @GetMapping("approver")
147
+    public String approver(Model model) {
148
+        String jsonProjectTypes = getProjectCategorys();
149
+        model.addAttribute(PROTYPE_JSON, jsonProjectTypes);
150
+        return "process/approver";
151
+    }
152
+
153
+    private String getProjectCategorys() {
154
+        String jsonProjectTypes = "[]";
155
+        return jsonProjectTypes;
156
+    }
157
+}

+ 86 - 0
bpm-core/src/main/java/com/srm/bpm/facade/rest/BillFileController.java

@@ -0,0 +1,86 @@
1
+
2
+
3
+package com.srm.bpm.facade.rest;
4
+
5
+import com.google.common.collect.Maps;
6
+
7
+import com.srm.bpm.logic.dto.AttachmentDTO;
8
+import com.srm.bpm.logic.service.FileUploadLogic;
9
+import com.srm.common.data.rest.R;
10
+
11
+import org.springframework.web.bind.annotation.GetMapping;
12
+import org.springframework.web.bind.annotation.PathVariable;
13
+import org.springframework.web.bind.annotation.PostMapping;
14
+import org.springframework.web.bind.annotation.RequestMapping;
15
+import org.springframework.web.bind.annotation.RequestParam;
16
+import org.springframework.web.bind.annotation.RestController;
17
+import org.springframework.web.multipart.MultipartFile;
18
+
19
+import java.io.IOException;
20
+import java.io.InputStream;
21
+import java.util.Map;
22
+import java.util.Objects;
23
+
24
+import javax.servlet.ServletOutputStream;
25
+import javax.servlet.http.HttpServletResponse;
26
+
27
+import lombok.RequiredArgsConstructor;
28
+
29
+/**
30
+ * <p> </p>
31
+ *
32
+ * @author BOGON
33
+ * @version 1.0
34
+ * @since JDK 1.8
35
+ */
36
+@RestController
37
+@RequestMapping("/bill/file/rest")
38
+@RequiredArgsConstructor
39
+public class BillFileController {
40
+    private final FileUploadLogic fileUploadLogic;
41
+
42
+    @PostMapping("/upload")
43
+    public R upload(@RequestParam("file") MultipartFile var1) {
44
+        final AttachmentDTO data = fileUploadLogic.upload(var1);
45
+        if (!Objects.isNull(data)) {
46
+            Map<String, Object> result = Maps.newHashMap();
47
+            result.put("fileName", data.getName());
48
+            result.put("filePath", data.getUrl());
49
+            result.put("fileSize", data.getSize());
50
+            result.put("id", data.getId());
51
+            result.put("fileType", data.getType());
52
+            result.put("url", data.getId());
53
+            return R.ok(result);
54
+        }
55
+        return R.empty();
56
+    }
57
+
58
+    @GetMapping("/download/{id}")
59
+    public void download(@PathVariable(value = "id") Long id, HttpServletResponse resp) {
60
+        InputStream inputStream = fileUploadLogic.download(id);
61
+        String fileName = "未知名称";
62
+        try {
63
+            final AttachmentDTO fileInfo = fileUploadLogic.getFileInfo(id);
64
+            if (!Objects.isNull(fileInfo)) {
65
+                fileName = fileInfo.getName();
66
+            }
67
+        } catch (Exception e) {
68
+            e.printStackTrace();
69
+        }
70
+        try {
71
+            String filename = new String(fileName.getBytes("UTF-8"), "iso-8859-1");
72
+            resp.setHeader("Content-Disposition", "attachment;filename=" + filename);
73
+            ServletOutputStream servletOutputStream = resp.getOutputStream();
74
+            int len;
75
+            byte[] buffer = new byte[1024];
76
+            while ((len = inputStream.read(buffer)) > 0) {
77
+                servletOutputStream.write(buffer, 0, len);
78
+            }
79
+            servletOutputStream.flush();
80
+            inputStream.close();
81
+            servletOutputStream.close();
82
+        } catch (IOException e) {
83
+            e.printStackTrace();
84
+        }
85
+    }
86
+}

+ 331 - 0
bpm-core/src/main/java/com/srm/bpm/facade/rest/BillFlowRestController.java

@@ -0,0 +1,331 @@
1
+
2
+
3
+package com.srm.bpm.facade.rest;
4
+
5
+import com.google.common.base.Strings;
6
+import com.google.common.collect.Maps;
7
+
8
+import com.srm.bpm.logic.dto.BillActionParamDTO;
9
+import com.srm.bpm.logic.dto.ValidationResultDTO;
10
+import com.srm.bpm.logic.service.BillLogic;
11
+import com.srm.bpm.logic.service.BillNextNodeLogic;
12
+import com.srm.bpm.logic.service.BillPrintLogic;
13
+import com.srm.bpm.logic.service.LoginUserHolder;
14
+import com.srm.bpm.logic.vo.BillApprovalHistoryVO;
15
+import com.srm.bpm.logic.vo.BillItemVO;
16
+import com.srm.common.data.exception.RbException;
17
+import com.srm.common.data.rest.R;
18
+
19
+import org.apache.commons.lang3.tuple.Pair;
20
+import org.springframework.web.bind.annotation.GetMapping;
21
+import org.springframework.web.bind.annotation.PostMapping;
22
+import org.springframework.web.bind.annotation.RequestMapping;
23
+import org.springframework.web.bind.annotation.RequestParam;
24
+import org.springframework.web.bind.annotation.RestController;
25
+
26
+import java.util.List;
27
+import java.util.Map;
28
+
29
+import javax.servlet.http.HttpServletRequest;
30
+import javax.servlet.http.HttpServletResponse;
31
+
32
+import cn.hutool.core.util.StrUtil;
33
+import lombok.RequiredArgsConstructor;
34
+
35
+import static com.srm.bpm.logic.error.BillCode.ENDORSE_CANNOT_SELF;
36
+
37
+/**
38
+ * <p> </p>
39
+ *
40
+ * @author BOGON
41
+ * @version 1.0
42
+ * @since JDK 1.8
43
+ */
44
+@RestController
45
+@RequestMapping("/bill/flow/rest")
46
+@RequiredArgsConstructor
47
+public class BillFlowRestController {
48
+    private final BillLogic billLogic;
49
+    private final LoginUserHolder loginUserHolder;
50
+    private final BillNextNodeLogic billNextNodeLogic;
51
+    private final BillPrintLogic billPrintLogic;
52
+
53
+    /**
54
+     * 审批操作-保存草稿
55
+     *
56
+     * @param processId 业务流程ID
57
+     * @param formData  业务流程数据
58
+     * @return 响应信息
59
+     */
60
+    @PostMapping("drafts")
61
+    public R drafts(
62
+            @RequestParam("processId") long processId,
63
+            @RequestParam(value = "id", required = false, defaultValue = "0") long billId,
64
+            @RequestParam("formData") String formData
65
+    ) {
66
+        final BillItemVO billItem = this.billLogic.saveDrafts(processId, billId, formData);
67
+        return R.ok(billItem);
68
+    }
69
+
70
+    /**
71
+     * 审批操作-提交申请
72
+     *
73
+     * @param processId 业务流程ID
74
+     * @param formData  业务流程数据
75
+     * @return 响应信息
76
+     */
77
+    @PostMapping("submit")
78
+    public R submit(
79
+            @RequestParam("processId") long processId,
80
+            @RequestParam(value = "billId", required = false, defaultValue = "0") long billId,
81
+            @RequestParam("formData") String formData,
82
+            @RequestParam(value = "nextApprover", required = false) String nextApprover
83
+    ) {
84
+        final BillItemVO billItem = billLogic.startFlow(processId, billId, formData, nextApprover,StrUtil.EMPTY);
85
+        return R.ok(billItem);
86
+    }
87
+
88
+    /**
89
+     * 从草稿箱直接发送流程
90
+     *
91
+     * @param processId 业务流程id
92
+     * @param billId    审批单id
93
+     * @return 响应信息
94
+     */
95
+    @PostMapping("send")
96
+    public R<BillItemVO> send(
97
+            @RequestParam("processId") long processId,
98
+            @RequestParam(value = "nextApprover", required = false) String nextApprover,
99
+            @RequestParam("billId") long billId
100
+    ) {
101
+        final BillItemVO billItem = this.billLogic.sendProcess(billId, processId, nextApprover);
102
+        return R.ok(billItem);
103
+    }
104
+
105
+    /**
106
+     * 审批同意接口
107
+     *
108
+     * @param billId   审批单主键
109
+     * @param taskId   任务主键
110
+     * @param opinion  审批意见
111
+     * @param formData 审批表单信息(可编辑的部分)
112
+     * @return 操作结果
113
+     */
114
+    @PostMapping("agree")
115
+    public R agree(
116
+            @RequestParam(value = "billId") long billId,
117
+            @RequestParam(value = "taskId", defaultValue = "0") String taskId,
118
+            @RequestParam(value = "content") String opinion,
119
+            @RequestParam(value = "nextApprover", required = false) String nextApproverStr,
120
+            @RequestParam(value = "formData", required = false) String formData
121
+    ) {
122
+        if (Strings.isNullOrEmpty(nextApproverStr) || StrUtil.equals(nextApproverStr, "undefined")) {
123
+            nextApproverStr = "0";
124
+        }
125
+        final String userCode = loginUserHolder.getUserCode();
126
+        final BillActionParamDTO actionParam = BillActionParamDTO.builder()
127
+                .billId(billId).userCode(userCode)
128
+                .taskId(taskId).opinion(opinion).formData(formData)
129
+                .nextApprover(nextApproverStr)
130
+                .build();
131
+        this.billLogic.agreeFlow(actionParam);
132
+        return R.empty();
133
+    }
134
+
135
+    @PostMapping("turn")
136
+    public R turn(@RequestParam(value = "billId") long billId,
137
+                  @RequestParam(value = "taskId", defaultValue = "0") String taskId,
138
+                  @RequestParam(value = "content", required = false, defaultValue = "") String opinion,
139
+                  @RequestParam(value = "turnUser") String turnUser
140
+    ) {
141
+        final String userCode = loginUserHolder.getUserCode();
142
+        this.billLogic.turnUser(billId, taskId, turnUser, userCode, opinion);
143
+        return R.empty();
144
+    }
145
+
146
+    /**
147
+     * 加签处理
148
+     *
149
+     * @param billId             审批单主键
150
+     * @param taskId             任务主键
151
+     * @param opinion            审批意见
152
+     * @param formData           审批表单信息(可编辑的部分)
153
+     * @param endorseApproverStr 加签审批人
154
+     * @return 操作结果
155
+     */
156
+    @PostMapping("endorse")
157
+    public R endorse(
158
+            @RequestParam(value = "billId") long billId,
159
+            @RequestParam(value = "taskId", defaultValue = "0") String taskId,
160
+            @RequestParam(value = "content") String opinion,
161
+            @RequestParam(value = "nextApprover") String endorseApproverStr,
162
+            @RequestParam(value = "formData", required = false) String formData
163
+    ) {
164
+        final String userCode = loginUserHolder.getUserCode();
165
+        if (userCode.equals(endorseApproverStr)) {
166
+            throw new RbException(ENDORSE_CANNOT_SELF);
167
+        }
168
+        final BillActionParamDTO actionParam = BillActionParamDTO.builder()
169
+                .billId(billId).userCode(userCode)
170
+                .taskId(taskId).opinion(opinion).formData(formData)
171
+                .endorseApprover(endorseApproverStr)
172
+                .build();
173
+        this.billLogic.endorse(actionParam);
174
+        return R.empty();
175
+    }
176
+
177
+
178
+    /**
179
+     * 审批拒绝接口
180
+     *
181
+     * @param billId   审批单主键
182
+     * @param taskId   任务主键
183
+     * @param opinion  审批意见
184
+     * @param formData 审批表单信息(可编辑的部分)
185
+     * @return 操作接口
186
+     */
187
+    @PostMapping("refuse")
188
+    public R refuse(
189
+            @RequestParam(value = "billId") long billId,
190
+            @RequestParam(value = "content") String opinion,
191
+            @RequestParam(value = "taskId", defaultValue = "0") String taskId,
192
+            @RequestParam(value = "formData", required = false) String formData
193
+    ) {
194
+        final String userCode = loginUserHolder.getUserCode();
195
+        final BillActionParamDTO actionParam = BillActionParamDTO.builder()
196
+                .billId(billId).userCode(userCode)
197
+                .taskId(taskId).opinion(opinion).formData(formData)
198
+                .build();
199
+        this.billLogic.refuseFlow(actionParam);
200
+        return R.empty();
201
+    }
202
+
203
+
204
+    /**
205
+     * 审批打回接口
206
+     *
207
+     * @param billId   审批单主键
208
+     * @param taskId   任务主键
209
+     * @param opinion  审批意见
210
+     * @param formData 审批表单信息(可编辑的部分)
211
+     * @return 操作接口
212
+     */
213
+    @PostMapping("repulse")
214
+    public R repulse(
215
+            @RequestParam(value = "billId") long billId,
216
+            @RequestParam(value = "content") String opinion,
217
+            @RequestParam(value = "taskId", defaultValue = "0") String taskId,
218
+            @RequestParam(value = "targetTaskId", defaultValue = "0") String targetTaskId,
219
+            @RequestParam(value = "nextApprover",defaultValue = "0",required = false) String nextApprover,
220
+            @RequestParam(value = "formData", required = false) String formData
221
+    ) {
222
+        final String userCode = loginUserHolder.getUserCode();
223
+        final BillActionParamDTO actionParam = BillActionParamDTO.builder()
224
+                .billId(billId).userCode(userCode)
225
+                .nextApprover(nextApprover)
226
+                .taskId(taskId).opinion(opinion).formData(formData)
227
+                .targetTaskId(targetTaskId)
228
+                .build();
229
+        this.billLogic.repulseFlow(actionParam);
230
+        return R.empty();
231
+    }
232
+
233
+    /**
234
+     * 审批撤回接口
235
+     *
236
+     * @param billId  审批单主键
237
+     * @param taskId  任务主键
238
+     * @param opinion 审批意见
239
+     * @return 操作接口
240
+     */
241
+    @PostMapping("cancel")
242
+    public R cancel(
243
+            @RequestParam(value = "billId") long billId,
244
+            @RequestParam(value = "content") String opinion,
245
+            @RequestParam(value = "taskId", defaultValue = "0") String taskId
246
+    ) {
247
+        final String userCode = loginUserHolder.getUserCode();
248
+        final BillActionParamDTO actionParam = BillActionParamDTO.builder()
249
+                .billId(billId).userCode(userCode)
250
+                .taskId(taskId).opinion(opinion)
251
+                .build();
252
+        this.billLogic.recallFlow(actionParam);
253
+        return R.empty();
254
+    }
255
+
256
+    /**
257
+     * 查看某个审批单的审批记录
258
+     *
259
+     * @param billId 审批单
260
+     * @return 审批记录
261
+     */
262
+    @GetMapping("approval/history")
263
+    public R<List<BillApprovalHistoryVO>> approvalHistory(
264
+            @RequestParam(value = "billId") long billId
265
+    ) {
266
+        List<BillApprovalHistoryVO> approvalHistorys = this.billLogic.findBillApprovalHistory(billId);
267
+        return R.ok(approvalHistorys);
268
+    }
269
+
270
+    @PostMapping("manual/flag")
271
+    public R manualFlag(@RequestParam(value = "billId") long billId,
272
+                        @RequestParam(value = "taskId", defaultValue = "0") String taskId,
273
+                        @RequestParam(value = "formData", required = false) String formData) {
274
+        final Pair<Integer, String> manualFlag = billNextNodeLogic.approvalNextManualFlag(taskId, billId, formData);
275
+        Map<String, Object> result = Maps.newHashMap();
276
+        result.put("manualFlag", manualFlag.getKey());
277
+        result.put("nodeName", manualFlag.getValue());
278
+        return R.ok(result);
279
+    }
280
+
281
+    @PostMapping("manual/flag/submit")
282
+    public R manualSubmitFlag(@RequestParam(value = "processId", defaultValue = "0") Long processId,
283
+                              @RequestParam(value = "formData", required = false) String formData) {
284
+        final String userId = loginUserHolder.getUserCode();
285
+        final Pair<Integer, String> manualFlag = billNextNodeLogic.submitNextManualFlag(processId, userId, formData);
286
+        Map<String, Object> result = Maps.newHashMap();
287
+        result.put("manualFlag", manualFlag.getKey());
288
+        result.put("nodeName", manualFlag.getValue());
289
+        return R.ok(result);
290
+    }
291
+
292
+
293
+    @GetMapping("/download")
294
+    public void download(@RequestParam("billId") Long billId, HttpServletResponse resp, HttpServletRequest request) {
295
+        billPrintLogic.download(billId, resp, request);
296
+    }
297
+
298
+    @GetMapping("/print")
299
+    public R print(@RequestParam("billId") Long billId) {
300
+        return R.ok(billPrintLogic.print(billId));
301
+    }
302
+
303
+
304
+    /**
305
+     * 验证表单
306
+     *
307
+     * @param processId 业务流程主键
308
+     * @param billId    审批ID
309
+     * @param formData  表单数据
310
+     * @return 响应信息
311
+     */
312
+    @PostMapping("validation")
313
+    public R<ValidationResultDTO> validation(
314
+            @RequestParam("processId") long processId,
315
+            @RequestParam(value = "billId", required = false, defaultValue = "0") long billId,
316
+            @RequestParam("formData") String formData
317
+    ) {
318
+        ValidationResultDTO validationResultDto;
319
+        validationResultDto = billLogic.validation(processId, billId, formData, loginUserHolder.getUserCode());
320
+        return R.ok(validationResultDto);
321
+    }
322
+
323
+    @GetMapping("/node/condition")
324
+    public R<List<String>> getNodeCondition(@RequestParam("processId") long processId,
325
+                                            @RequestParam(value = "billId", required = false, defaultValue = "0") long billId,
326
+                                            @RequestParam(value = "taskId", required = true, defaultValue = "0") String taskId) {
327
+
328
+        List<String> result = billLogic.getNodeCondition(processId, billId, taskId);
329
+        return R.ok(result);
330
+    }
331
+}

+ 219 - 0
bpm-core/src/main/java/com/srm/bpm/facade/rest/BillListRestController.java

@@ -0,0 +1,219 @@
1
+ 
2
+
3
+package com.srm.bpm.facade.rest;
4
+
5
+import com.google.common.base.Strings;
6
+
7
+import com.alibaba.fastjson.JSON;
8
+import com.srm.bpm.facde.dto.BillTaskDTO;
9
+import com.srm.bpm.logic.converts.BillBasicConvert;
10
+import com.srm.bpm.logic.query.list.ApprovedBillQuery;
11
+import com.srm.bpm.logic.query.list.CcBillQuery;
12
+import com.srm.bpm.logic.query.list.DraftBillQuery;
13
+import com.srm.bpm.logic.query.list.MeCreateBillQuery;
14
+import com.srm.bpm.logic.query.list.TodoBillQuery;
15
+import com.srm.bpm.logic.service.BillLogic;
16
+import com.srm.bpm.logic.service.BillTaskLogic;
17
+import com.srm.bpm.logic.vo.BillItemVO;
18
+import com.srm.bpm.logic.vo.BillTaskVO;
19
+import com.srm.common.data.rest.R;
20
+
21
+import org.apache.commons.lang3.tuple.Pair;
22
+import org.springframework.web.bind.annotation.GetMapping;
23
+import org.springframework.web.bind.annotation.RequestMapping;
24
+import org.springframework.web.bind.annotation.RequestParam;
25
+import org.springframework.web.bind.annotation.RestController;
26
+
27
+import java.util.List;
28
+import java.util.Map;
29
+
30
+import io.swagger.annotations.Api;
31
+import io.swagger.annotations.ApiImplicitParam;
32
+import io.swagger.annotations.ApiImplicitParams;
33
+import io.swagger.annotations.ApiOperation;
34
+import lombok.RequiredArgsConstructor;
35
+import springfox.documentation.annotations.ApiIgnore;
36
+
37
+/**
38
+ * <p> </p>
39
+ *
40
+ * @author BOGON
41
+ * @version 1.0
42
+ * @since JDK 1.8
43
+ */
44
+@RequestMapping("/bill/list/rest")
45
+@RestController
46
+@RequiredArgsConstructor
47
+@Api(tags = "审批单列表")
48
+public class BillListRestController {
49
+    private final BillLogic billLogic;
50
+    private final BillTaskLogic billTaskLogic;
51
+    private final BillBasicConvert billBasicConvert;
52
+
53
+    /**
54
+     * 获取我已审批的审批单
55
+     *
56
+     * @return 待我审批列表
57
+     */
58
+    @ApiOperation(value = "分页查询我已审批的审批单", httpMethod = "GET")
59
+    @ApiImplicitParams(
60
+            {
61
+                    @ApiImplicitParam(name = "page", defaultValue = "1"),
62
+                    @ApiImplicitParam(name = "limit", defaultValue = "10"),
63
+                    @ApiImplicitParam(name = "q", value = "查询参数", defaultValue = "")
64
+            })
65
+    @GetMapping("approved")
66
+    public R<List<BillItemVO>> approved(
67
+            @ApiIgnore @RequestParam Map<String, Object> params
68
+    ) {
69
+        final Integer pageNo = Integer.valueOf((String) params.get("page"));
70
+        final Integer pageSize = Integer.valueOf((String) params.get("limit"));
71
+        final String filterText = (String) params.get("q");
72
+        final ApprovedBillQuery query;
73
+        if (!Strings.isNullOrEmpty(filterText)) {
74
+            query = JSON.parseObject(filterText, ApprovedBillQuery.class);
75
+        } else {
76
+            query = new ApprovedBillQuery();
77
+        }
78
+        Pair<List<BillItemVO>, Long> result = billLogic.findApproved(pageNo, pageSize, query);
79
+        return R.ok(result.getKey(), result.getValue());
80
+    }
81
+
82
+
83
+    /**
84
+     * 获取待我审批的审批单
85
+     *
86
+     * @return 获取待我审批的列表
87
+     */
88
+    @ApiOperation(value = "分页查询待我审批的审批单", httpMethod = "GET")
89
+    @ApiImplicitParams(
90
+            {
91
+                    @ApiImplicitParam(name = "page", defaultValue = "1"),
92
+                    @ApiImplicitParam(name = "limit", defaultValue = "10"),
93
+                    @ApiImplicitParam(name = "q", value = "查询参数", defaultValue = "")
94
+            })
95
+    @GetMapping("/todo")
96
+    public R<List<BillItemVO>> todo(
97
+            @ApiIgnore @RequestParam Map<String, Object> params) {
98
+
99
+        final Integer pageNo = Integer.valueOf((String) params.get("page"));
100
+        final Integer pageSize = Integer.valueOf((String) params.get("limit"));
101
+        final String filterText = (String) params.get("q");
102
+        TodoBillQuery query = null;
103
+        if (!Strings.isNullOrEmpty(filterText)) {
104
+            query = JSON.parseObject(filterText, TodoBillQuery.class);
105
+        }
106
+        Pair<List<BillItemVO>, Long> result = billLogic.findTodo(pageNo, pageSize, query);
107
+        return R.ok(result.getKey(), result.getValue());
108
+    }
109
+
110
+    /**
111
+     * 获取我发起的审批
112
+     *
113
+     * @return 我发起的列表
114
+     */
115
+    @ApiOperation(value = "分页查询我发起的审批", httpMethod = "GET")
116
+    @ApiImplicitParams(
117
+            {
118
+                    @ApiImplicitParam(name = "page", defaultValue = "1"),
119
+                    @ApiImplicitParam(name = "limit", defaultValue = "10"),
120
+                    @ApiImplicitParam(name = "q", value = "查询参数", defaultValue = "")
121
+            })
122
+    @GetMapping("/minecreate")
123
+    public R<List<BillItemVO>> sended(
124
+            @ApiIgnore @RequestParam Map<String, Object> params) {
125
+        final Integer pageNo = Integer.valueOf((String) params.get("page"));
126
+        final Integer pageSize = Integer.valueOf((String) params.get("limit"));
127
+        final String filterText = (String) params.get("q");
128
+
129
+        MeCreateBillQuery billQuery = null;
130
+        if (!Strings.isNullOrEmpty(filterText)) {
131
+            billQuery = JSON.parseObject(filterText, MeCreateBillQuery.class);
132
+        }
133
+        Pair<List<BillItemVO>, Long> result = billLogic.findMeCreate(pageNo, pageSize, billQuery);
134
+        return R.ok(result.getKey(), result.getValue());
135
+    }
136
+
137
+
138
+    /**
139
+     * 获取我的草稿
140
+     *
141
+     * @return 我的草稿
142
+     */
143
+    @GetMapping("/drafts")
144
+    @ApiOperation(value = "分页查询我的草稿审批", httpMethod = "GET")
145
+    @ApiImplicitParams(
146
+            {
147
+                    @ApiImplicitParam(name = "page", defaultValue = "1"),
148
+                    @ApiImplicitParam(name = "limit", defaultValue = "10"),
149
+                    @ApiImplicitParam(name = "q", value = "查询参数", defaultValue = "")
150
+            })
151
+    public R<List<BillItemVO>> drafts(@ApiIgnore @RequestParam Map<String, Object> params) {
152
+
153
+        final Integer pageNo = Integer.valueOf((String) params.get("page"));
154
+        final Integer pageSize = Integer.valueOf((String) params.get("limit"));
155
+        final String filterText = (String) params.get("q");
156
+        DraftBillQuery query = null;
157
+        if (!Strings.isNullOrEmpty(filterText)) {
158
+            query = JSON.parseObject(filterText, DraftBillQuery.class);
159
+        }
160
+        final Pair<List<BillItemVO>, Long> result = billLogic.findDraft(pageNo, pageSize, query);
161
+        return R.ok(result.getKey(), result.getValue());
162
+    }
163
+
164
+
165
+    /**
166
+     * 抄送我的
167
+     *
168
+     * @return 我的草稿
169
+     */
170
+    @ApiOperation(value = "分页查询抄送我的审批", httpMethod = "GET")
171
+    @ApiImplicitParams(
172
+            {
173
+                    @ApiImplicitParam(name = "page", defaultValue = "1"),
174
+                    @ApiImplicitParam(name = "limit", defaultValue = "10"),
175
+                    @ApiImplicitParam(name = "q", value = "查询参数", defaultValue = "")
176
+            })
177
+    @GetMapping("/cc")
178
+    public R<List<BillItemVO>> cc(@ApiIgnore @RequestParam Map<String, Object> params) {
179
+        final Integer pageNo = Integer.valueOf((String) params.get("page"));
180
+        final Integer pageSize = Integer.valueOf((String) params.get("limit"));
181
+        final String filterText = (String) params.get("q");
182
+        CcBillQuery query = null;
183
+        if (!Strings.isNullOrEmpty(filterText)) {
184
+            query = JSON.parseObject(filterText, CcBillQuery.class);
185
+        }
186
+        final Pair<List<BillItemVO>, Long> result = billLogic.findCc(pageNo, pageSize, query);
187
+        return R.ok(result.getKey(), result.getValue());
188
+    }
189
+
190
+    @GetMapping("/history/tasks")
191
+    public R<List<BillTaskDTO>> getHistoryTasks(Long billId) {
192
+        List<BillTaskVO> billTaskVOS = billTaskLogic.getHistoryTasks(billId);
193
+        return R.ok(billBasicConvert.billTaskVOToDTO(billTaskVOS));
194
+    }
195
+    /**
196
+     * 根据查询条件查询审批单信息
197
+     *
198
+     * @return 审批单列表
199
+     */
200
+    @ApiOperation(value = "分页查询审批单", httpMethod = "GET")
201
+    @ApiImplicitParams(
202
+            {
203
+                    @ApiImplicitParam(name = "page", defaultValue = "1"),
204
+                    @ApiImplicitParam(name = "limit", defaultValue = "10"),
205
+                    @ApiImplicitParam(name = "q", value = "查询参数", defaultValue = "")
206
+            })
207
+    @GetMapping("/all/bill")
208
+    public R<List<BillItemVO>> forSelect(@ApiIgnore @RequestParam Map<String, Object> params){
209
+        final Integer pageNo = Integer.valueOf((String) params.get("page"));
210
+        final Integer pageSize = Integer.valueOf((String) params.get("limit"));
211
+        final String filterText = (String) params.get("q");
212
+        DraftBillQuery query = null;
213
+        if (!Strings.isNullOrEmpty(filterText)) {
214
+            query = JSON.parseObject(filterText, DraftBillQuery.class);
215
+        }
216
+        final Pair<List<BillItemVO>, Long> result = billLogic.findAllByQuery(pageNo, pageSize, query);
217
+        return R.ok(result.getKey(), result.getValue());
218
+    }
219
+}

+ 142 - 0
bpm-core/src/main/java/com/srm/bpm/facade/rest/BillProcessRestController.java

@@ -0,0 +1,142 @@
1
+
2
+
3
+package com.srm.bpm.facade.rest;
4
+
5
+import com.google.common.base.Strings;
6
+
7
+import com.srm.bpm.logic.service.BillLogic;
8
+import com.srm.bpm.logic.service.LoginUserHolder;
9
+import com.srm.bpm.logic.service.ProcessTypeLogic;
10
+import com.srm.bpm.logic.vo.BillApprovalHistoryVO;
11
+import com.srm.bpm.logic.vo.BillDetailVO;
12
+import com.srm.bpm.logic.vo.ProcessTypeVO;
13
+import com.srm.common.data.rest.R;
14
+
15
+import org.springframework.web.bind.annotation.GetMapping;
16
+import org.springframework.web.bind.annotation.PathVariable;
17
+import org.springframework.web.bind.annotation.RequestMapping;
18
+import org.springframework.web.bind.annotation.RequestParam;
19
+import org.springframework.web.bind.annotation.RestController;
20
+
21
+import java.util.List;
22
+import java.util.Set;
23
+
24
+import io.swagger.annotations.Api;
25
+import io.swagger.annotations.ApiOperation;
26
+import lombok.RequiredArgsConstructor;
27
+
28
+/**
29
+ * <p> </p>
30
+ *
31
+ * @author BOGON
32
+ * @version 1.0
33
+ * @since JDK 1.8
34
+ */
35
+@RestController
36
+@RequiredArgsConstructor
37
+@RequestMapping("/bill/process/rest")
38
+@Api(tags = "发起审批")
39
+public class BillProcessRestController {
40
+    private final ProcessTypeLogic processTypeLogic;
41
+    private final BillLogic billLogic;
42
+    private final LoginUserHolder loginUserHolder;
43
+
44
+    /**
45
+     * 获取系统已经开启的业务流程列表接口,连同业务流程类型一起将数据放回
46
+     *
47
+     * @return 业务流程列表
48
+     */
49
+    @ApiOperation(value = "查询可以发起的流程列表", httpMethod = "GET")
50
+    @GetMapping("list/type")
51
+    public R<List<ProcessTypeVO>> listType(String name) {
52
+        final String userCode = loginUserHolder.getUserCode();
53
+        final Set<String> userOrgs = loginUserHolder.getUserOrgs();
54
+        final String bloc = loginUserHolder.getBloc();
55
+        final List<ProcessTypeVO> processTypes = this.processTypeLogic.selectAllWithTypeGroup(userCode, userOrgs,bloc, Strings.isNullOrEmpty(name)?"":name);
56
+        return R.ok(processTypes);
57
+    }
58
+
59
+    /**
60
+     * 新建审批单详情
61
+     *
62
+     * @param processId 业务流程主键
63
+     * @return 审批信息
64
+     */
65
+    @GetMapping("create/{processId}")
66
+    public R create(
67
+            @PathVariable("processId") long processId,
68
+            @RequestParam(value ="app",required = false,defaultValue = "0") Integer app
69
+    ) {
70
+        if(app==1){
71
+            final BillDetailVO billDetailVO = billLogic.createByApp(processId);
72
+            return R.ok(billDetailVO);
73
+        }else{
74
+            final BillDetailVO billDetailVO = billLogic.create(processId);
75
+            return R.ok(billDetailVO);
76
+        }
77
+
78
+    }
79
+
80
+    /**
81
+     * 审批单详情 编辑模式
82
+     * <p>
83
+     * 在 草稿箱和我发起的审批列表中 中 调用这个接口来查看审批单
84
+     *
85
+     * @param billId 业务流程主键
86
+     * @return 审批信息
87
+     */
88
+    @GetMapping("edit/{billId}")
89
+    public R edit(
90
+            @PathVariable("billId") long billId,
91
+            @RequestParam(value = "page", required = false,defaultValue = "edit") String page
92
+    ) {
93
+        final BillDetailVO billDetailVO;
94
+        billDetailVO = billLogic.findBillDetail(billId, page);
95
+        if (null == billDetailVO) {
96
+            return R.empty();
97
+        }
98
+
99
+        List<BillApprovalHistoryVO> approvalHistorys = this.billLogic.findBillApprovalHistory(billId);
100
+        billDetailVO.setTrack(approvalHistorys);
101
+        return R.ok(billDetailVO);
102
+    }
103
+
104
+    /**
105
+     * 审批表单详情,用于审批操作
106
+     * <p>
107
+     * 在 待我审批和我已审批中 调用这个接口来查看审批单
108
+     *
109
+     * @param billId 业务流程主键
110
+     * @param page   来源界面 比如 草稿箱等
111
+     * @return 审批信息
112
+     */
113
+    @GetMapping("view/{billId}")
114
+    public R view(
115
+            @PathVariable("billId") long billId,
116
+            @RequestParam(value = "page", required = false,defaultValue = "view") String page
117
+    ) {
118
+        final BillDetailVO billDetailVO;
119
+        billDetailVO = billLogic.findBillDetailModeView(billId, page);
120
+        if (null == billDetailVO) {
121
+            return R.empty();
122
+        }
123
+        List<BillApprovalHistoryVO> approvalHistorys = this.billLogic.findBillApprovalHistory(billId);
124
+        billDetailVO.setTrack(approvalHistorys);
125
+        return R.ok(billDetailVO);
126
+    }
127
+
128
+
129
+    /**
130
+     * 读取某个审批单
131
+     *
132
+     * @param billId 审批单ID
133
+     * @return 是否成功
134
+     */
135
+    @GetMapping("read/{billId}")
136
+    public R read(
137
+            @PathVariable("billId") long billId
138
+    ) {
139
+        boolean readState = billLogic.readBill(billId);
140
+        return R.state(readState);
141
+    }
142
+}

+ 81 - 0
bpm-core/src/main/java/com/srm/bpm/facade/rest/BillReplyRestController.java

@@ -0,0 +1,81 @@
1
+ 
2
+
3
+package com.srm.bpm.facade.rest;
4
+
5
+import com.google.common.base.Strings;
6
+import com.google.common.collect.Maps;
7
+
8
+import com.srm.bpm.logic.dto.BillReplyDTO;
9
+import com.srm.bpm.logic.service.BillReplyLogic;
10
+import com.srm.common.data.rest.R;
11
+
12
+import org.springframework.web.bind.annotation.GetMapping;
13
+import org.springframework.web.bind.annotation.PostMapping;
14
+import org.springframework.web.bind.annotation.RequestMapping;
15
+import org.springframework.web.bind.annotation.RequestParam;
16
+import org.springframework.web.bind.annotation.RestController;
17
+
18
+import java.util.List;
19
+import java.util.Map;
20
+
21
+import cn.hutool.core.lang.Pair;
22
+import lombok.RequiredArgsConstructor;
23
+
24
+/**
25
+ * <p> </p>
26
+ *
27
+ * @author BOGON
28
+ * @version 1.0
29
+ * @since JDK 1.8
30
+ */
31
+@RestController
32
+@RequestMapping("/bill/reply/rest")
33
+@RequiredArgsConstructor
34
+public class BillReplyRestController {
35
+    private final BillReplyLogic billReplyLogic;
36
+
37
+    @GetMapping("/list")
38
+    public R<Map<String, Object>> list(
39
+            @RequestParam(value = "page", defaultValue = "1") Integer page,
40
+            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
41
+            @RequestParam(value = "billId") Long billId
42
+    ) {
43
+        final Pair<List<BillReplyDTO>, Long> billReplies = billReplyLogic.findByBillId(page, pageSize, billId);
44
+        Map<String, Object> result = Maps.newHashMap();
45
+        result.put("recordsTotal", billReplies.getValue());
46
+        result.put("recordsFiltered", billReplies.getValue());
47
+        result.put("data", billReplies.getKey());
48
+        return R.ok(result);
49
+    }
50
+
51
+    @PostMapping("/delete")
52
+    public R delete(
53
+            @RequestParam(value = "replyId") long replyId,
54
+            @RequestParam(value = "billId") long billId
55
+    ) {
56
+        final boolean billReplies = billReplyLogic.deleteByBillId(billId, replyId);
57
+        return R.state(billReplies);
58
+    }
59
+
60
+    /**
61
+     * 审批单回复提交
62
+     *
63
+     * @param billId  审批单ID
64
+     * @param content 回复内容
65
+     * @return 响应信息
66
+     */
67
+    @PostMapping("/submit")
68
+    public R<BillReplyDTO> submit(
69
+            @RequestParam(value = "billId") Long billId,
70
+            @RequestParam(value = "content") String content
71
+    ) {
72
+        final BillReplyDTO replyDto = billReplyLogic.submit(billId, content);
73
+        if (Strings.isNullOrEmpty(content)) {
74
+            return R.empty();
75
+        }
76
+        if (replyDto == null) {
77
+            return R.empty();
78
+        }
79
+        return R.ok(replyDto);
80
+    }
81
+}

+ 294 - 0
bpm-core/src/main/java/com/srm/bpm/facade/rest/DataSourceRestController.java

@@ -0,0 +1,294 @@
1
+
2
+
3
+package com.srm.bpm.facade.rest;
4
+
5
+import com.google.common.base.MoreObjects;
6
+import com.google.common.base.Strings;
7
+
8
+import com.alibaba.fastjson.JSONObject;
9
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
10
+import com.srm.bpm.logic.constant.ProcessCode;
11
+import com.srm.bpm.logic.constant.StringPool;
12
+import com.srm.bpm.logic.dto.DataSourceFormDTO;
13
+import com.srm.bpm.logic.dto.DataTablesInputDTO;
14
+import com.srm.bpm.logic.dto.DataTablesOutputDTO;
15
+import com.srm.bpm.logic.dto.DatasourceComboDTO;
16
+import com.srm.bpm.logic.dto.DatasourceConditionDTO;
17
+import com.srm.bpm.facde.dto.DatasourceDTO;
18
+import com.srm.bpm.logic.dto.DatasourcePopoverDTO;
19
+import com.srm.bpm.logic.dto.ZZTableField;
20
+import com.srm.bpm.logic.service.DataSourceLogic;
21
+import com.srm.bpm.logic.service.LoginUserHolder;
22
+import com.srm.bpm.logic.vo.DatasourceVO;
23
+import com.srm.common.data.exception.RbException;
24
+import com.srm.common.data.rest.R;
25
+
26
+import org.springframework.web.bind.annotation.DeleteMapping;
27
+import org.springframework.web.bind.annotation.GetMapping;
28
+import org.springframework.web.bind.annotation.PathVariable;
29
+import org.springframework.web.bind.annotation.PostMapping;
30
+import org.springframework.web.bind.annotation.RequestBody;
31
+import org.springframework.web.bind.annotation.RequestMapping;
32
+import org.springframework.web.bind.annotation.RequestParam;
33
+import org.springframework.web.bind.annotation.RestController;
34
+
35
+import java.util.Arrays;
36
+import java.util.List;
37
+import java.util.Map;
38
+import java.util.Objects;
39
+
40
+import javax.validation.Valid;
41
+
42
+import cn.hutool.core.lang.Pair;
43
+import io.swagger.annotations.Api;
44
+import io.swagger.annotations.ApiImplicitParam;
45
+import io.swagger.annotations.ApiImplicitParams;
46
+import io.swagger.annotations.ApiOperation;
47
+import lombok.RequiredArgsConstructor;
48
+import springfox.documentation.annotations.ApiIgnore;
49
+
50
+import static com.srm.bpm.logic.constant.DatasourceConst.MASK_WHERE_SQL;
51
+import static com.srm.bpm.logic.constant.StringPool.ZERO;
52
+
53
+/**
54
+ * <p> </p>
55
+ *
56
+ * @author BOGON
57
+ * @version 1.0
58
+ * @since JDK 1.8
59
+ */
60
+@RestController
61
+@RequestMapping("/datasource/rest")
62
+@RequiredArgsConstructor
63
+@Api(tags = "数据源")
64
+public class DataSourceRestController {
65
+    private final DataSourceLogic dataSourceLogic;
66
+    private final LoginUserHolder loginUserHolder;
67
+
68
+    /**
69
+     * 通过数据源id获取 下拉框信息
70
+     *
71
+     * @param id 数据源id
72
+     */
73
+    @ApiOperation(value = "数据源id获取下拉框信息", httpMethod = "GET")
74
+    @ApiImplicitParams({
75
+            @ApiImplicitParam(name = "id", value = "据源id", required = true, paramType = "path", dataType = "Long")
76
+    })
77
+    @GetMapping("/combo/{id}")
78
+    public R<DatasourceComboDTO> getCombo(@ApiIgnore @PathVariable(value = "id", required = false) long id) {
79
+        if (id <= 0) {
80
+            return R.empty();
81
+        }
82
+        final DatasourceComboDTO datasourceCombo = dataSourceLogic.getComboByDatasourceId(id);
83
+        return R.ok(datasourceCombo);
84
+    }
85
+
86
+    /**
87
+     * 通过数据源id获取 条件值
88
+     *
89
+     * @param id 数据源id
90
+     */
91
+    @ApiOperation(value = "通过数据源id获取条件值", httpMethod = "GET")
92
+    @ApiImplicitParams({
93
+            @ApiImplicitParam(name = "id", value = "据源id", required = true, paramType = "path", dataType = "Long")
94
+    })
95
+    @GetMapping("/condition/{id}")
96
+    public R<List<DatasourceConditionDTO>> getCondition(@ApiIgnore @PathVariable(value = "id", required = false) long id) {
97
+        if (id <= 0) {
98
+
99
+            return R.empty();
100
+        }
101
+        final List<DatasourceConditionDTO> datasourceConditionss = dataSourceLogic.getConditionByDataSourceId(id);
102
+        return R.ok(datasourceConditionss);
103
+    }
104
+
105
+    /**
106
+     * 通过数据源id获取 弹出框信息
107
+     *
108
+     * @param id 数据源id
109
+     */
110
+    @ApiOperation(value = "通过数据源id获取弹出框信息", httpMethod = "GET")
111
+    @ApiImplicitParams({
112
+            @ApiImplicitParam(name = "id", value = "据源id", required = true, paramType = "path", dataType = "Long")
113
+    })
114
+    @GetMapping("/popover/{id}")
115
+    public R<DatasourcePopoverDTO> get(@ApiIgnore @PathVariable(value = "id", required = false) long id) {
116
+        if (id <= 0) {
117
+            R.empty();
118
+        }
119
+
120
+        final DatasourcePopoverDTO datasourcePopover = dataSourceLogic.getPopoverByDataSourceId(id);
121
+        return R.ok(datasourcePopover);
122
+    }
123
+
124
+    /**
125
+     * 获取sql查询列
126
+     */
127
+    @ApiOperation(value = "获取sql查询列")
128
+    @PostMapping("/sqlfields")
129
+    public R<List<ZZTableField>> sqlfields(
130
+            @RequestBody Map<String, Object> data
131
+    ) {
132
+        String sqlscript = (String) data.get("sqlscript");
133
+        Long dataSourceId = 0L;
134
+        if (!Objects.isNull(data.get("id"))) {
135
+            dataSourceId = Long.valueOf(data.get("id").toString());
136
+        }
137
+        if (Strings.isNullOrEmpty(sqlscript)) {
138
+            return R.empty();
139
+        }
140
+        try {
141
+            sqlscript = sqlscript.replace(MASK_WHERE_SQL,"");
142
+            dataSourceLogic.executeSql(sqlscript, StringPool.EMPTY, null);
143
+        } catch (Exception e) {
144
+            e.printStackTrace();
145
+            return R.error(ProcessCode.DELETE_DS_ERROR, "数据库执行错误,请检查sql脚本");
146
+        }
147
+        final List<ZZTableField> tableFields;
148
+        tableFields = dataSourceLogic.getSqlSelectColumns(sqlscript, dataSourceId);
149
+        return R.ok(tableFields);
150
+    }
151
+
152
+
153
+    /**
154
+     * 获取某个表的字段信息以及对应设置的信息
155
+     *
156
+     * @param tableName 数据库表名
157
+     * @return 信息
158
+     */
159
+    @GetMapping("/table/filed")
160
+    @ApiOperation(value = "获取某个表的字段信息", httpMethod = "GET")
161
+    @ApiImplicitParams({
162
+            @ApiImplicitParam(name = "table_name", value = "表名", required = true, paramType = "query", dataType = "String"),
163
+            @ApiImplicitParam(name = "id", value = "据源id", required = true, paramType = "query", dataType = "Long"),
164
+    })
165
+    public R<List<ZZTableField>> fields(
166
+            @RequestParam(value = "table_name") String tableName,
167
+            @RequestParam(value = "id", required = false, defaultValue = ZERO) long dataSourceId
168
+    ) {
169
+        final List<ZZTableField> tableFields = dataSourceLogic.ganerateTableFields(tableName, dataSourceId);
170
+        return R.ok(tableFields);
171
+    }
172
+
173
+
174
+    @ApiOperation(value = "分页查询数据源", httpMethod = "GET")
175
+    @ApiImplicitParams(
176
+            {
177
+                    @ApiImplicitParam(name = "page", defaultValue = "1"),
178
+                    @ApiImplicitParam(name = "limit", defaultValue = "10")
179
+            })
180
+    @GetMapping("/list")
181
+    public R<List<DatasourceDTO>> grid(
182
+            @ApiIgnore @RequestParam Map<String, Object> params
183
+    ) {
184
+        final Integer pageNo = Integer.valueOf((String) params.get("page"));
185
+        final Integer pageSize = Integer.valueOf((String) params.get("limit"));
186
+        Pair<List<DatasourceDTO>, Long> pair = dataSourceLogic.getDatasourceByPage(pageNo, pageSize);
187
+        return R.ok(pair.getKey(), pair.getValue());
188
+    }
189
+
190
+    /**
191
+     * 保存数据源
192
+     *
193
+     * @param dataSourceFormDTO 数据源输入参数
194
+     * @return 响应信息
195
+     */
196
+    @ApiOperation(value = "保存数据源", httpMethod = "POST")
197
+    @PostMapping("/save")
198
+    public R save(@Valid @RequestBody DataSourceFormDTO dataSourceFormDTO) {
199
+
200
+        final String userCode = loginUserHolder.getUserCode();
201
+        try {
202
+            boolean isOk = this.dataSourceLogic.saveDataSource(dataSourceFormDTO, userCode);
203
+            return R.state(isOk);
204
+        } catch (RbException e) {
205
+            e.printStackTrace();
206
+            return R.error(ProcessCode.DS_SAVE_ERROR, "数据源保存错误");
207
+        }
208
+    }
209
+
210
+    @ApiOperation(value = "获取数据详情", httpMethod = "GET")
211
+    @ApiImplicitParam(name = "id", value = "id", required = true, paramType = "path", dataType = "String")
212
+    @GetMapping("/{id}")
213
+    public R<DataSourceFormDTO> detail(@ApiIgnore @PathVariable Long id) {
214
+        if (id > 0) {
215
+            DataSourceFormDTO dataSourceFormDTO = this.dataSourceLogic.getDetailById(id);
216
+            return R.ok(dataSourceFormDTO);
217
+        } else {
218
+            return R.empty();
219
+        }
220
+    }
221
+
222
+    /**
223
+     * 批量删除数据源
224
+     *
225
+     * @param ids 数据源ID数组
226
+     * @return 响应结果
227
+     */
228
+    @ApiOperation(value = "删除数据源")
229
+    @ApiImplicitParam(name = "ids", value = "多个id逗号隔开", required = true, paramType = "path", dataType = "String")
230
+    @DeleteMapping("/delete/{ids}")
231
+    public R delete(@PathVariable String ids) {
232
+        final List<String> list = Arrays.asList(ids.split(","));
233
+        return R.state(dataSourceLogic.batchDeleteDatasource(list));
234
+    }
235
+
236
+    /**
237
+     * 获取平台数据库列表
238
+     *
239
+     * @return 数据库列表
240
+     */
241
+    @ApiOperation(value = "获取平台表名", httpMethod = "GET")
242
+    @GetMapping("/tables")
243
+    public R getTables() {
244
+        List<String> tables = dataSourceLogic.mysqlQueryTables();
245
+        return R.ok(tables);
246
+    }
247
+
248
+    /**
249
+     * 数据源下拉选择接口
250
+     *
251
+     * @return 数据源信息
252
+     */
253
+    @PostMapping("/triggerselect")
254
+    public DataTablesOutputDTO<Map<String, Object>> triggerselect(
255
+            @RequestBody DataTablesInputDTO dataTablesInput
256
+    ) {
257
+
258
+        final JSONObject params = dataTablesInput.getParams();
259
+        if (params == null) {
260
+            throw new RbException(ProcessCode.CODE_EMPTY);
261
+        }
262
+        if (dataTablesInput.getLength() == -1) {
263
+            dataTablesInput.setStart(0);
264
+            dataTablesInput.setLength(Integer.MAX_VALUE);
265
+        }
266
+        final int start = MoreObjects.firstNonNull(dataTablesInput.getStart(), 0);
267
+        int current = start / dataTablesInput.getLength();
268
+
269
+        final Page<Map<String, Object>> requestPage = new Page<>(
270
+                current,
271
+                dataTablesInput.getLength()
272
+        );
273
+
274
+        String table = params.getString("table");
275
+        Map<String, Object> queryMap;
276
+        try {
277
+            queryMap = (Map<String, Object>) params.get("query");
278
+        } catch (Exception e) {
279
+            throw new RbException(StringPool.EMPTY, ProcessCode.QUERY_JSON_ERROR);
280
+        }
281
+        this.dataSourceLogic.execWithSelect(table, queryMap, requestPage, loginUserHolder.getUserCode());
282
+        DataTablesOutputDTO<Map<String, Object>> dataTablesOutput = new DataTablesOutputDTO<>();
283
+        dataTablesOutput.setData(requestPage.getRecords());
284
+        dataTablesOutput.setDraw(dataTablesInput.getDraw());
285
+        dataTablesOutput.setRecordsTotal(requestPage.getTotal());
286
+        dataTablesOutput.setRecordsFiltered(requestPage.getTotal());
287
+        return dataTablesOutput;
288
+    }
289
+    @GetMapping("/datasources")
290
+    public R<List<DatasourceVO>> datasource(){
291
+        final List<DatasourceVO> datasourceVOList = dataSourceLogic.getAllWithForm();
292
+        return R.ok(datasourceVOList);
293
+    }
294
+}

+ 49 - 0
bpm-core/src/main/java/com/srm/bpm/facade/rest/FormThirdItemRestController.java

@@ -0,0 +1,49 @@
1
+
2
+
3
+package com.srm.bpm.facade.rest;
4
+
5
+import com.srm.bpm.infra.service.FormThirdItemLogic;
6
+import com.srm.bpm.logic.dto.FormThirdDTO;
7
+import com.srm.bpm.logic.dto.FormThirdItemDTO;
8
+import com.srm.common.data.rest.R;
9
+
10
+import org.springframework.web.bind.annotation.GetMapping;
11
+import org.springframework.web.bind.annotation.PostMapping;
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
+
16
+import java.util.List;
17
+
18
+import io.swagger.annotations.Api;
19
+import io.swagger.annotations.ApiOperation;
20
+import lombok.RequiredArgsConstructor;
21
+
22
+/**
23
+ * <p> </p>
24
+ *
25
+ * @author BOGON
26
+ * @version 1.0
27
+ * @since JDK 1.8
28
+ */
29
+@RestController
30
+@RequestMapping("/form/third/item/rest")
31
+@RequiredArgsConstructor
32
+@Api(tags = "表单第三方配置")
33
+public class FormThirdItemRestController {
34
+    private final FormThirdItemLogic formThirdItemLogic;
35
+
36
+    @GetMapping("/list")
37
+    @ApiOperation(value = "查询表单字段列表", httpMethod = "GET")
38
+    public R<List<FormThirdItemDTO>> list(Long processId) {
39
+        List<FormThirdItemDTO> list = formThirdItemLogic.findByProcessId(processId);
40
+        return R.ok(list);
41
+    }
42
+
43
+    @PostMapping("/save")
44
+    @ApiOperation(value = "保存配置", httpMethod = "GET")
45
+    public R save(@RequestBody FormThirdDTO formThirdDTO) {
46
+        formThirdItemLogic.save(formThirdDTO);
47
+        return R.ok();
48
+    }
49
+}

+ 58 - 0
bpm-core/src/main/java/com/srm/bpm/facade/rest/LinkqueryController.java

@@ -0,0 +1,58 @@
1
+
2
+
3
+package com.srm.bpm.facade.rest;
4
+
5
+import com.alibaba.fastjson.JSON;
6
+import com.alibaba.fastjson.JSONArray;
7
+import com.alibaba.fastjson.JSONObject;
8
+import com.srm.bpm.logic.define.FormXtype;
9
+import com.srm.bpm.logic.service.LinkqueryLogic;
10
+import com.srm.bpm.logic.service.LoginUserHolder;
11
+import com.srm.config.SpringContextHolder;
12
+
13
+import org.apache.commons.lang3.StringUtils;
14
+import org.springframework.http.ResponseEntity;
15
+import org.springframework.web.bind.annotation.PostMapping;
16
+import org.springframework.web.bind.annotation.RequestMapping;
17
+import org.springframework.web.bind.annotation.RequestParam;
18
+import org.springframework.web.bind.annotation.RestController;
19
+
20
+import lombok.RequiredArgsConstructor;
21
+
22
+/**
23
+ * <p> </p>
24
+ *
25
+ * @author Administrator
26
+ * @version 1.0
27
+ * @since JDK 1.7
28
+ */
29
+@RestController
30
+@RequestMapping("/api/form")
31
+@RequiredArgsConstructor
32
+public class LinkqueryController {
33
+    private final LoginUserHolder loginUserHolder;
34
+
35
+    @PostMapping("/linkquery")
36
+    public ResponseEntity index(
37
+            @RequestParam("query") String json,
38
+            @RequestParam("processId") long processId) {
39
+        JSONObject linkqueryParamDto = JSON.parseObject(json);
40
+        String xtype = linkqueryParamDto.getString("xtype");
41
+        String block = linkqueryParamDto.getString("block");
42
+        if (StringUtils.equals(xtype, FormXtype.detailgroup
43
+                .name())) {
44
+            LinkqueryLogic<JSONArray> iLinkqueryService = SpringContextHolder.getBean(block);
45
+            JSONArray jsonArray = iLinkqueryService.excute(json, loginUserHolder.getUserCode(), processId);
46
+            return ResponseEntity.ok(jsonArray);
47
+        } else if (StringUtils.equals(xtype, FormXtype.text.name())
48
+                || StringUtils.equals(xtype, FormXtype.money.name())
49
+                || StringUtils.equals(xtype, FormXtype.number.name())
50
+                ) {
51
+            LinkqueryLogic<JSONObject> iLinkqueryService = SpringContextHolder.getBean(block);
52
+            JSONObject result = iLinkqueryService.excute(json, loginUserHolder.getUserCode(), processId);
53
+            return ResponseEntity.ok(result);
54
+        } else {
55
+            return ResponseEntity.badRequest().build();
56
+        }
57
+    }
58
+}

+ 202 - 0
bpm-core/src/main/java/com/srm/bpm/facade/rest/ProcessContentRestController.java

@@ -0,0 +1,202 @@
1
+
2
+
3
+package com.srm.bpm.facade.rest;
4
+
5
+import com.google.common.collect.Lists;
6
+
7
+import com.srm.bpm.infra.entity.ToaBillEntity;
8
+import com.srm.bpm.infra.service.ToaBillService;
9
+
10
+import org.activiti.bpmn.model.BpmnModel;
11
+import org.activiti.bpmn.model.FlowNode;
12
+import org.activiti.bpmn.model.SequenceFlow;
13
+import org.activiti.engine.HistoryService;
14
+import org.activiti.engine.ProcessEngine;
15
+import org.activiti.engine.RepositoryService;
16
+import org.activiti.engine.history.HistoricActivityInstance;
17
+import org.activiti.engine.history.HistoricProcessInstance;
18
+import org.apache.commons.io.IOUtils;
19
+import org.apache.commons.lang3.StringUtils;
20
+import org.springframework.web.bind.annotation.GetMapping;
21
+import org.springframework.web.bind.annotation.PathVariable;
22
+import org.springframework.web.bind.annotation.RequestMapping;
23
+import org.springframework.web.bind.annotation.RestController;
24
+
25
+import java.io.IOException;
26
+import java.io.InputStream;
27
+import java.util.Date;
28
+import java.util.List;
29
+
30
+import javax.servlet.http.HttpServletResponse;
31
+
32
+import cn.hutool.core.date.DateUtil;
33
+import lombok.RequiredArgsConstructor;
34
+import lombok.extern.slf4j.Slf4j;
35
+
36
+/**
37
+ * <p> </p>
38
+ *
39
+ * @author BOGON
40
+ * @version 1.0
41
+ * @since JDK 1.8
42
+ */
43
+@RequiredArgsConstructor
44
+@RestController
45
+@Slf4j
46
+@RequestMapping("/bill/diagram/rest")
47
+public class ProcessContentRestController {
48
+    private final HistoryService historyService;
49
+    private final RepositoryService repositoryService;
50
+    private final ProcessEngine processEngine;
51
+    private final ToaBillService billService;
52
+
53
+    /**
54
+     * 运行流程图接口
55
+     *
56
+     * @param billId   审批单
57
+     * @param response 响应信息
58
+     */
59
+    @GetMapping("/run/{billId}")
60
+    public void diagramRun(
61
+            @PathVariable("billId") long billId,
62
+            HttpServletResponse response
63
+    ) {
64
+
65
+        if (billId <= 0) {
66
+            return;
67
+        }
68
+        final ToaBillEntity bill = billService.getById(billId);
69
+        if (bill == null) {
70
+            return;
71
+        }
72
+        final String processInstanceId = bill.getProcessInstanceId();
73
+
74
+        if (!StringUtils.isEmpty(processInstanceId)) {
75
+            final InputStream activitiProccessImage = getActivitiProccessImage(processInstanceId);
76
+            if (activitiProccessImage != null) {
77
+                try {
78
+                    IOUtils.copy(activitiProccessImage, response.getOutputStream());
79
+                } catch (IOException e) {
80
+                    log.error("the resopne stream has error!", e);
81
+                }
82
+            }
83
+        }
84
+    }
85
+
86
+    /**
87
+     * 获取流程图像,已执行节点和流程线高亮显示
88
+     */
89
+    private InputStream getActivitiProccessImage(String pProcessInstanceId) {
90
+        //logger.info("[开始]-获取流程图图像");
91
+        try {
92
+            //  获取历史流程实例
93
+            HistoricProcessInstance historicProcessInstance = historyService
94
+                    .createHistoricProcessInstanceQuery()
95
+                    .processInstanceId(pProcessInstanceId).singleResult();
96
+
97
+            if (historicProcessInstance != null) {
98
+                // 获取流程定义
99
+
100
+                // 获取流程历史中已执行节点,并按照节点在流程中执行先后顺序排序
101
+                List<HistoricActivityInstance> historicActivityInstanceList = historyService
102
+                        .createHistoricActivityInstanceQuery()
103
+                        .processInstanceId(pProcessInstanceId)
104
+                        .orderByHistoricActivityInstanceId().asc().list();
105
+
106
+                // 已执行的节点ID集合
107
+                List<String> executedActivityIdList = Lists.newArrayList();
108
+//                int index = 1;
109
+                //logger.info("获取已经执行的节点ID");
110
+                for (HistoricActivityInstance activityInstance : historicActivityInstanceList) {
111
+                    executedActivityIdList.add(activityInstance.getActivityId());
112
+                }
113
+                final String processDefinitionId = historicProcessInstance.getProcessDefinitionId();
114
+
115
+                BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
116
+
117
+                // 已执行的线集合
118
+                // 获取流程走过的线 (getHighLightedFlows是下面的方法)
119
+                List<String> flowIds = getHighLightedFlows(bpmnModel, historicActivityInstanceList);
120
+
121
+
122
+                //配置字体
123
+                return processEngine.getProcessEngineConfiguration()
124
+                        .getProcessDiagramGenerator().generateDiagram(bpmnModel, "jpg",
125
+                        executedActivityIdList, flowIds,
126
+                        "宋体", "宋体", "宋体", null, 2.0);
127
+            }
128
+        } catch (Exception e) {
129
+            log.error("【异常】-获取流程图失败!" + e.getMessage(), e);
130
+        }
131
+        return null;
132
+    }
133
+
134
+    private List<String> getHighLightedFlows(BpmnModel bpmnModel, List<HistoricActivityInstance> historicActivityInstances) {
135
+        List<String> highFlows = Lists.newArrayList();// 用以保存高亮的线flowId
136
+        final int historicActivityInstanceSize = historicActivityInstances.size();
137
+        for (int i = 0; i < historicActivityInstanceSize - 1; i++) {
138
+            // 对历史流程节点进行遍历
139
+            HistoricActivityInstance historicActivity = historicActivityInstances.get(i);// 第一个节点
140
+            // 得到节点定义的详细信息
141
+            final String activityId1 = historicActivity.getActivityId();
142
+            FlowNode activityImpl = (FlowNode) bpmnModel.getMainProcess().getFlowElement(activityId1);
143
+
144
+            // 用以保存后续开始时间相同的节点
145
+            List<FlowNode> sameStartTimeNodes = Lists.newArrayList();
146
+            FlowNode sameActivityImpl1 = null;
147
+
148
+            HistoricActivityInstance activityImp2_;
149
+            for (int k = i + 1; k <= historicActivityInstanceSize - 1; k++) {
150
+                activityImp2_ = historicActivityInstances.get(k);// 后续第1个节点
151
+
152
+                final Date startTime = historicActivity.getEndTime();
153
+                final Date startTime2 = activityImp2_.getStartTime();
154
+                final String activityType = historicActivity.getActivityType();
155
+                final String activityType2 = activityImp2_.getActivityType();
156
+                if (!StringUtils.equals(activityType, "userTask")
157
+                        || !StringUtils.equals("userTask", activityType2)
158
+                        || StringUtils.equals(DateUtil.formatDateTime(startTime), DateUtil.formatDateTime(startTime2))
159
+                ) {
160
+                    //都是usertask,且主节点与后续节点的开始时间相同,说明不是真实的后继节点
161
+                    final String activityId = historicActivityInstances.get(k).getActivityId();
162
+                    sameActivityImpl1 = (FlowNode) bpmnModel.getMainProcess()
163
+                            .getFlowElement(activityId);//找到紧跟在后面的一个节点
164
+                    break;
165
+                }
166
+            }
167
+            // 将后面第一个节点放在时间相同节点的集合里
168
+            sameStartTimeNodes.add(sameActivityImpl1);
169
+            for (int j = i + 1; j < historicActivityInstanceSize - 1; j++) {
170
+                // 后续第一个节点
171
+                HistoricActivityInstance activityImpl1 = historicActivityInstances.get(j);
172
+                // 后续第二个节点
173
+                HistoricActivityInstance activityImpl2 = historicActivityInstances.get(j + 1);
174
+
175
+                final Date startTime = activityImpl1.getStartTime();
176
+                final Date startTime2 = activityImpl2.getStartTime();
177
+                if (StringUtils.equals(DateUtil.formatDateTime(startTime), DateUtil.formatDateTime(startTime2))) {
178
+                    // 如果第一个节点和第二个节点开始时间相同保存
179
+                    FlowNode sameActivityImpl2 = (FlowNode) bpmnModel.getMainProcess()
180
+                            .getFlowElement(activityImpl2.getActivityId());
181
+                    sameStartTimeNodes.add(sameActivityImpl2);
182
+                } else {// 有不相同跳出循环
183
+                    break;
184
+                }
185
+            }
186
+            // 取出节点的所有出去的线
187
+            List<SequenceFlow> sequenceFlows = activityImpl.getOutgoingFlows();
188
+            // 对所有的线进行遍历
189
+            for (SequenceFlow sequenceFlow : sequenceFlows) {
190
+                // 如果取出的线的目标节点存在时间相同的节点里,保存该线的id,进行高亮显示
191
+                FlowNode pvmActivityImpl = (FlowNode) bpmnModel.getMainProcess()
192
+                        .getFlowElement(sequenceFlow.getTargetRef());
193
+                if (sameStartTimeNodes.contains(pvmActivityImpl)) {
194
+                    highFlows.add(sequenceFlow.getId());
195
+                }
196
+            }
197
+
198
+        }
199
+        return highFlows;
200
+
201
+    }
202
+}

+ 242 - 0
bpm-core/src/main/java/com/srm/bpm/facade/rest/ProcessFlowRestController.java

@@ -0,0 +1,242 @@
1
+
2
+
3
+package com.srm.bpm.facade.rest;
4
+
5
+import com.srm.bpm.facde.dto.BaseProcessDTO;
6
+import com.srm.bpm.facde.dto.ProcessGridDTO;
7
+import com.srm.bpm.logic.service.FormSettingLogic;
8
+import com.srm.bpm.logic.service.LoginUserHolder;
9
+import com.srm.bpm.logic.service.ProcessDesingerLogic;
10
+import com.srm.bpm.logic.service.ProcessFlowLogic;
11
+import com.srm.config.BpmConfig;
12
+import com.srm.common.data.rest.R;
13
+
14
+import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
15
+import org.springframework.web.bind.annotation.DeleteMapping;
16
+import org.springframework.web.bind.annotation.GetMapping;
17
+import org.springframework.web.bind.annotation.PathVariable;
18
+import org.springframework.web.bind.annotation.PostMapping;
19
+import org.springframework.web.bind.annotation.PutMapping;
20
+import org.springframework.web.bind.annotation.RequestBody;
21
+import org.springframework.web.bind.annotation.RequestMapping;
22
+import org.springframework.web.bind.annotation.RequestParam;
23
+import org.springframework.web.bind.annotation.RestController;
24
+import org.springframework.web.multipart.MultipartFile;
25
+
26
+import java.io.File;
27
+import java.io.FileInputStream;
28
+import java.io.FileNotFoundException;
29
+import java.io.IOException;
30
+import java.io.InputStream;
31
+import java.io.UnsupportedEncodingException;
32
+import java.util.List;
33
+import java.util.Map;
34
+
35
+import javax.servlet.ServletOutputStream;
36
+import javax.servlet.http.HttpServletResponse;
37
+
38
+import cn.hutool.core.io.FileUtil;
39
+import cn.hutool.core.lang.Pair;
40
+import io.swagger.annotations.Api;
41
+import io.swagger.annotations.ApiImplicitParam;
42
+import io.swagger.annotations.ApiImplicitParams;
43
+import io.swagger.annotations.ApiOperation;
44
+import lombok.RequiredArgsConstructor;
45
+import springfox.documentation.annotations.ApiIgnore;
46
+
47
+/**
48
+ * <p> </p>
49
+ *
50
+ * @author BOGON
51
+ * @version 1.0
52
+ * @since JDK 1.8
53
+ */
54
+@RestController
55
+@RequiredArgsConstructor
56
+@RequestMapping("/flow/process/rest")
57
+@Api(tags = "流程管理")
58
+public class ProcessFlowRestController {
59
+    private final DataSourceProperties dataSourceProperties;
60
+    private final ProcessFlowLogic processFlowLogic;
61
+    private final ProcessDesingerLogic processDesingerLogic;
62
+    private final LoginUserHolder loginUserHolder;
63
+    private final FormSettingLogic formSettingLogic;
64
+    private final BpmConfig bpmConfig;
65
+
66
+    @ApiOperation(value = "分页查询流程", httpMethod = "GET")
67
+    @ApiImplicitParams(
68
+            {
69
+                    @ApiImplicitParam(name = "page", defaultValue = "1"),
70
+                    @ApiImplicitParam(name = "limit", defaultValue = "10")
71
+            })
72
+    @GetMapping("/list")
73
+    public R<List<ProcessGridDTO>> grid(
74
+            @ApiIgnore @RequestParam Map<String, Object> params
75
+    ) {
76
+        final Integer pageNo = Integer.valueOf((String) params.get("page"));
77
+        final Integer pageSize = Integer.valueOf((String) params.get("limit"));
78
+        final String bloc = loginUserHolder.getBloc();
79
+        Pair<List<ProcessGridDTO>, Long> pair = processFlowLogic.getProcessFlowByPage(pageNo, pageSize, params, bloc);
80
+        return R.ok(pair.getKey(), pair.getValue());
81
+    }
82
+
83
+    @ApiOperation(value = "保存流程基本信息", httpMethod = "POST")
84
+    @PostMapping("save")
85
+    public R save(@RequestBody BaseProcessDTO process) {
86
+        final String bloc = loginUserHolder.getBloc();
87
+        return R.state(this.processFlowLogic.saveProcess(process, bloc));
88
+    }
89
+
90
+    /**
91
+     * 删除流程
92
+     *
93
+     * @param processId 流程
94
+     * @return 删除结果
95
+     */
96
+    @ApiOperation(value = "删除流程", httpMethod = "DELETE")
97
+    @ApiImplicitParam(name = "id", value = "流程id", required = true, paramType = "path", dataType = "Long")
98
+    @DeleteMapping("/{id}")
99
+    public R remove(@ApiIgnore @PathVariable(value = "id", required = false) long processId) {
100
+        return R.state(processFlowLogic.removeProcess(processId));
101
+    }
102
+
103
+    /**
104
+     * 撤回流程
105
+     *
106
+     * @param processId 流程
107
+     * @return 撤回结果
108
+     */
109
+    @ApiOperation(value = "撤回流程", httpMethod = "PUT")
110
+    @ApiImplicitParam(name = "id", value = "流程id", required = true, paramType = "path", dataType = "Long")
111
+    @PutMapping("/cancel/{id}")
112
+    public R cancel(@ApiIgnore @PathVariable(value = "id", required = false) long processId) {
113
+        return R.state(processFlowLogic.cancelProcess(processId));
114
+    }
115
+
116
+    /**
117
+     * 启用流程
118
+     *
119
+     * @param processId 流程
120
+     * @return 启动结果
121
+     */
122
+    @ApiOperation(value = "启用流程", httpMethod = "PUT")
123
+    @ApiImplicitParam(name = "id", value = "流程id", required = true, paramType = "path", dataType = "Long")
124
+    @PutMapping("/enable/{id}")
125
+    public R enable(@ApiIgnore @PathVariable(value = "id", required = false) long processId) {
126
+        System.out.printf("a:" + dataSourceProperties.getUrl());
127
+        return R.state(processFlowLogic.enableProcess(processId));
128
+    }
129
+
130
+    /**
131
+     * 禁用流程
132
+     *
133
+     * @param processId 流程
134
+     * @return 禁用结果
135
+     */
136
+    @ApiOperation(value = "禁用流程", httpMethod = "PUT")
137
+    @ApiImplicitParam(name = "id", value = "流程id", required = true, paramType = "path", dataType = "Long")
138
+    @PutMapping("/disable/{id}")
139
+    public R disable(@ApiIgnore @PathVariable(value = "id", required = false) long processId) {
140
+        return R.state(processFlowLogic.disableProcess(processId));
141
+    }
142
+
143
+    /**
144
+     * 发布流程
145
+     *
146
+     * @param processId 流程ID
147
+     * @return 发布是否成功
148
+     */
149
+    @ApiOperation(value = "发布流程", httpMethod = "PUT")
150
+    @ApiImplicitParam(name = "id", value = "流程id", required = true, paramType = "path", dataType = "Long")
151
+    @PutMapping("release/{id}")
152
+    public R release(
153
+            @PathVariable(value = "id") long processId
154
+    ) {
155
+        return R.state(this.processFlowLogic.releaseProcess(processId));
156
+    }
157
+
158
+    /**
159
+     * 保存流程
160
+     *
161
+     * @param processDesingerData 流程设计信息
162
+     * @return 流程处理结果
163
+     */
164
+    @PostMapping("process/save")
165
+    public R save(
166
+            @RequestParam("data") String processDesingerData,
167
+            @RequestParam("id") long processId
168
+    ) {
169
+        this.processDesingerLogic.saveProcessAndSetting(processDesingerData, processId);
170
+        return R.empty();
171
+    }
172
+
173
+    /**
174
+     * 开始使用流程
175
+     *
176
+     * @param processId 流程主键
177
+     * @return 操作响应
178
+     */
179
+    @PostMapping("/open")
180
+    public R open(
181
+            @RequestParam("id") long processId
182
+    ) {
183
+
184
+        final boolean openState = this.processFlowLogic.openProcess(processId);
185
+        return R.state(openState);
186
+    }
187
+
188
+    /**
189
+     * 关闭流程
190
+     *
191
+     * @param processId 流程主键
192
+     * @return 操作响应
193
+     */
194
+    @PostMapping("/closed")
195
+    public R closed(@RequestParam("id") long processId) {
196
+        final boolean openState = this.processFlowLogic.closeProcess(processId);
197
+        return R.state(openState);
198
+    }
199
+
200
+    @PostMapping("/temp/save/{id}")
201
+    public R savePrintTemp(@PathVariable(value = "id") long processId, @RequestParam("file") MultipartFile var1) {
202
+        final boolean b = this.formSettingLogic.updatePrintTemp(processId, var1);
203
+        return R.state(b);
204
+    }
205
+
206
+    @GetMapping("/temp/down")
207
+    public void tempDown(String path, HttpServletResponse resp) {
208
+        final String filePath = bpmConfig.getFilePath();
209
+        try {
210
+            InputStream inputStream = new FileInputStream(filePath + File.separator + path);
211
+            String fileName = FileUtil.getName(path);
212
+            String filename = new String(fileName.getBytes("UTF-8"), "iso-8859-1");
213
+            resp.setHeader("Content-Disposition", "attachment;filename=" + filename);
214
+            ServletOutputStream servletOutputStream = resp.getOutputStream();
215
+            int len;
216
+            byte[] buffer = new byte[1024];
217
+            while ((len = inputStream.read(buffer)) > 0) {
218
+                servletOutputStream.write(buffer, 0, len);
219
+            }
220
+            servletOutputStream.flush();
221
+            inputStream.close();
222
+            servletOutputStream.close();
223
+
224
+        } catch (FileNotFoundException e) {
225
+            e.printStackTrace();
226
+        } catch (UnsupportedEncodingException e) {
227
+            e.printStackTrace();
228
+        } catch (IOException e) {
229
+            e.printStackTrace();
230
+        }
231
+    }
232
+
233
+    @PostMapping("/formlink/save")
234
+    public R formLinkSave(
235
+            @RequestParam(value = "formLink",required = false,defaultValue = "") String formLink,
236
+            @RequestParam(value = "approveLink",required = false,defaultValue = "") String approveLink,
237
+            @RequestParam(value = "manualStartFlag",required = false,defaultValue = "1") Integer manualStartFlag,
238
+            @RequestParam("id") long processId) {
239
+        final boolean b = this.formSettingLogic.updateFormLink(processId, formLink,approveLink,manualStartFlag);
240
+        return R.state(b);
241
+    }
242
+}

+ 51 - 0
bpm-core/src/main/java/com/srm/bpm/facade/rest/ProcessFormRestController.java

@@ -0,0 +1,51 @@
1
+
2
+
3
+package com.srm.bpm.facade.rest;
4
+
5
+import com.srm.bpm.logic.service.ProcessFormLogic;
6
+import com.srm.common.data.rest.R;
7
+
8
+import org.springframework.web.bind.annotation.PostMapping;
9
+import org.springframework.web.bind.annotation.RequestMapping;
10
+import org.springframework.web.bind.annotation.RequestParam;
11
+import org.springframework.web.bind.annotation.RestController;
12
+
13
+import io.swagger.annotations.Api;
14
+import io.swagger.annotations.ApiOperation;
15
+import lombok.RequiredArgsConstructor;
16
+
17
+/**
18
+ * <p> </p>
19
+ *
20
+ * @author BOGON
21
+ * @version 1.0
22
+ * @since JDK 1.8
23
+ */
24
+@RestController
25
+@RequiredArgsConstructor
26
+@RequestMapping("/process/form/rest")
27
+@Api(tags = "流程表单设计")
28
+public class ProcessFormRestController {
29
+    private final ProcessFormLogic processFormLogic;
30
+
31
+    /**
32
+     * 保存表单元素
33
+     * <p>
34
+     * 1. 解析出表单的字段信息
35
+     * <p>
36
+     * 2. 解析出表单所使用的表达式信息
37
+     * <p>
38
+     * 3. 存储表单信息
39
+     *
40
+     * @param data 表单信息
41
+     * @return 表单信息
42
+     */
43
+    @ApiOperation("保存表单元素")
44
+    @PostMapping("save")
45
+    public R save(
46
+            @RequestParam("data") String data
47
+    ) {
48
+        return R.state(processFormLogic.saveForm(data));
49
+    }
50
+
51
+}

+ 55 - 0
bpm-core/src/main/java/com/srm/bpm/facade/rest/ProcessTreeRestController.java

@@ -0,0 +1,55 @@
1
+
2
+
3
+package com.srm.bpm.facade.rest;
4
+
5
+import com.google.common.base.Strings;
6
+
7
+import com.srm.bpm.logic.dto.ZTreeDTO;
8
+import com.srm.bpm.logic.service.UserCenterlogic;
9
+import com.srm.common.data.rest.R;
10
+
11
+import org.springframework.web.bind.annotation.GetMapping;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RequestParam;
14
+import org.springframework.web.bind.annotation.RestController;
15
+
16
+import java.util.List;
17
+
18
+import lombok.RequiredArgsConstructor;
19
+
20
+/**
21
+ * <p> </p>
22
+ *
23
+ * @author BOGON
24
+ * @version 1.0
25
+ * @since JDK 1.8
26
+ */
27
+@RestController
28
+@RequiredArgsConstructor
29
+@RequestMapping("/process/tree/rest")
30
+public class ProcessTreeRestController {
31
+    private final UserCenterlogic  userCenterlogic;
32
+
33
+    @GetMapping("/organization")
34
+    public R organization(String q) {
35
+        final List<ZTreeDTO> organization = userCenterlogic.organization("",Strings.isNullOrEmpty(q) ? "" : q);
36
+        return R.ok(organization);
37
+    }
38
+
39
+    @GetMapping("/organization/user")
40
+    public R organizationUser(String q,
41
+                              @RequestParam(value = "onlyChoiceUser", required = false) boolean onlyChoiceUser) {
42
+        return R.ok(userCenterlogic.organizationUser("",q, onlyChoiceUser));
43
+    }
44
+
45
+
46
+    @GetMapping("/position/user")
47
+    public R positionUser() {
48
+        return R.ok(userCenterlogic.positionUser(""));
49
+    }
50
+
51
+    @GetMapping("/position")
52
+    public R position(String q) {
53
+        return R.ok(userCenterlogic.position("",Strings.isNullOrEmpty(q) ? "" : q));
54
+    }
55
+}

+ 86 - 0
bpm-core/src/main/java/com/srm/bpm/facade/rest/ProcessTypeRestController.java

@@ -0,0 +1,86 @@
1
+ 
2
+
3
+package com.srm.bpm.facade.rest;
4
+
5
+import com.srm.bpm.logic.dto.ProcessTypeDTO;
6
+import com.srm.bpm.logic.service.ProcessTypeLogic;
7
+import com.srm.common.data.rest.R;
8
+
9
+import org.springframework.web.bind.annotation.DeleteMapping;
10
+import org.springframework.web.bind.annotation.GetMapping;
11
+import org.springframework.web.bind.annotation.PathVariable;
12
+import org.springframework.web.bind.annotation.PostMapping;
13
+import org.springframework.web.bind.annotation.RequestBody;
14
+import org.springframework.web.bind.annotation.RequestMapping;
15
+import org.springframework.web.bind.annotation.RequestParam;
16
+import org.springframework.web.bind.annotation.RestController;
17
+
18
+import java.util.Arrays;
19
+import java.util.List;
20
+import java.util.Map;
21
+
22
+import javax.validation.Valid;
23
+
24
+import cn.hutool.core.lang.Pair;
25
+import io.swagger.annotations.Api;
26
+import io.swagger.annotations.ApiImplicitParam;
27
+import io.swagger.annotations.ApiImplicitParams;
28
+import io.swagger.annotations.ApiOperation;
29
+import lombok.RequiredArgsConstructor;
30
+import springfox.documentation.annotations.ApiIgnore;
31
+
32
+/**
33
+ * <p> </p>
34
+ *
35
+ * @author BOGON
36
+ * @version 1.0
37
+ * @since JDK 1.8
38
+ */
39
+@RestController
40
+@RequiredArgsConstructor
41
+@RequestMapping("/process/type")
42
+@Api(tags = "流程分类")
43
+public class ProcessTypeRestController {
44
+
45
+    private final ProcessTypeLogic processTypeLogic;
46
+
47
+    @ApiOperation(value = "分页查询流程分类", httpMethod = "GET")
48
+    @ApiImplicitParams(
49
+            {
50
+                    @ApiImplicitParam(name = "page", defaultValue = "1"),
51
+                    @ApiImplicitParam(name = "limit", defaultValue = "10")
52
+            })
53
+    @GetMapping("/list")
54
+    public R<List<ProcessTypeDTO>> grid(
55
+            @ApiIgnore @RequestParam Map<String, Object> params
56
+    ) {
57
+        final Integer pageNo = Integer.valueOf((String) params.get("page"));
58
+        final Integer pageSize = Integer.valueOf((String) params.get("limit"));
59
+        Pair<List<ProcessTypeDTO>, Long> pair = processTypeLogic.getProcessTypeByPage(pageNo, pageSize);
60
+        return R.ok(pair.getKey(), pair.getValue());
61
+    }
62
+
63
+    @ApiOperation(value = "获取流程分类详情", httpMethod = "GET")
64
+    @ApiImplicitParam(name = "id", value = "id", required = true, paramType = "path", dataType = "String")
65
+    @GetMapping("/{id}")
66
+    public R<ProcessTypeDTO> detail(@ApiIgnore @PathVariable Long id) {
67
+        ProcessTypeDTO processTypeDTO = processTypeLogic.getDetail(id);
68
+        return R.ok(processTypeDTO);
69
+    }
70
+
71
+    @ApiOperation(value = "删除流程分类", httpMethod = "DELETE")
72
+    @ApiImplicitParam(name = "ids", value = "多个id逗号隔开", required = true, paramType = "path", dataType = "String")
73
+    @DeleteMapping("/{ids}")
74
+    public R delete(@ApiIgnore @PathVariable String ids) {
75
+        final List<String> idList = Arrays.asList(ids.split(","));
76
+        return R.state(processTypeLogic.batchDeleteByIds(idList));
77
+    }
78
+
79
+    @ApiOperation(value = "保存流程分类", httpMethod = "POST")
80
+    @PostMapping()
81
+    public R save(
82
+            @Valid @RequestBody ProcessTypeDTO processType
83
+    ) {
84
+        return R.state(processTypeLogic.save(processType));
85
+    }
86
+}

+ 88 - 0
bpm-core/src/main/java/com/srm/bpm/facade/rest/RelyController.java

@@ -0,0 +1,88 @@
1
+ 
2
+
3
+package com.srm.bpm.facade.rest;
4
+
5
+import com.google.common.base.Strings;
6
+
7
+import com.srm.bpm.infra.po.FormFieldPO;
8
+import com.srm.bpm.infra.service.FormFieldService;
9
+import com.srm.bpm.logic.dto.DatasourceLinkqueryDto;
10
+import com.srm.bpm.logic.service.BillItemAssembleLogic;
11
+import com.srm.bpm.logic.service.BillItemResolveLogic;
12
+import com.srm.bpm.logic.service.DataSourceLogic;
13
+import com.srm.bpm.logic.service.LoginUserHolder;
14
+import com.srm.common.data.rest.R;
15
+
16
+import org.springframework.web.bind.annotation.PostMapping;
17
+import org.springframework.web.bind.annotation.RequestMapping;
18
+import org.springframework.web.bind.annotation.RestController;
19
+
20
+import java.util.Map;
21
+
22
+import cn.hutool.core.util.StrUtil;
23
+import lombok.RequiredArgsConstructor;
24
+
25
+/**
26
+ * <p> </p>
27
+ *
28
+ * @author BOGON
29
+ * @version 1.0
30
+ * @since JDK 1.8
31
+ */
32
+@RequiredArgsConstructor
33
+@RestController
34
+@RequestMapping("/form/rest")
35
+public class RelyController {
36
+    private final FormFieldService formFieldService;
37
+    private final BillItemAssembleLogic billItemAssembleService;
38
+    private final BillItemResolveLogic billItemResolveService;
39
+    private final LoginUserHolder loginUserHolder;
40
+    private final DataSourceLogic dataSourceLogic;
41
+
42
+    @PostMapping("rely")
43
+    public R index(
44
+            String fieldValue,
45
+            String table,
46
+            String equalField,
47
+            String correspondField,
48
+            String xtype,
49
+            String field) {
50
+        DatasourceLinkqueryDto datasourceLinkqueryDto = new DatasourceLinkqueryDto();
51
+        datasourceLinkqueryDto.setCorrespondField(correspondField);
52
+        datasourceLinkqueryDto.setFieldValue(fieldValue);
53
+        datasourceLinkqueryDto.setTable(table);
54
+        datasourceLinkqueryDto.setEqualField(equalField);
55
+        datasourceLinkqueryDto.setXtype(xtype);
56
+        datasourceLinkqueryDto.setField(field);
57
+        String widgetName = datasourceLinkqueryDto.getField();
58
+        FormFieldPO formField = formFieldService.findByWidgetName(widgetName);
59
+        if (Strings.isNullOrEmpty(fieldValue)) {
60
+            Object o = billItemAssembleService.firstValue(xtype, StrUtil.EMPTY);
61
+            return R.ok(o);
62
+        }
63
+        if (null == formField) {
64
+            return R.state(false);
65
+        }
66
+        String rxtype = formField.getType();
67
+        String props = formField.getProps();
68
+        String queryValue = datasourceLinkqueryDto.getFieldValue();
69
+        String value = billItemResolveService.firstVale(rxtype, props, queryValue);
70
+        final String quetyTable = datasourceLinkqueryDto.getTable();
71
+        final String dsEqualField = datasourceLinkqueryDto.getEqualField();
72
+        Map<String, Object> result;
73
+        result = dataSourceLogic.execLinkquery(quetyTable, dsEqualField, value, loginUserHolder.getUserCode());
74
+        final String dsCorrespondField = datasourceLinkqueryDto.getCorrespondField();
75
+        String cloumn = String.valueOf(result.get(dsCorrespondField));
76
+        if (!Strings.isNullOrEmpty(cloumn)) {
77
+            final String formType = datasourceLinkqueryDto.getXtype();
78
+            Object o = billItemAssembleService.firstValue(formType, cloumn);
79
+            return R.ok(o);
80
+        } else {
81
+            final String formType = datasourceLinkqueryDto.getXtype();
82
+            Object o = billItemAssembleService.firstValue(formType, cloumn);
83
+            return R.ok(o);
84
+        }
85
+    }
86
+
87
+
88
+}

+ 67 - 0
bpm-core/src/main/java/com/srm/bpm/facade/rest/ThirdPartBillController.java

@@ -0,0 +1,67 @@
1
+
2
+
3
+package com.srm.bpm.facade.rest;
4
+
5
+import com.google.common.base.Strings;
6
+
7
+import com.alibaba.fastjson.JSONObject;
8
+import com.srm.bpm.facde.dto.BillItemDTO;
9
+import com.srm.bpm.infra.service.FormThirdItemLogic;
10
+import com.srm.bpm.logic.converts.BillBasicConvert;
11
+import com.srm.bpm.logic.service.BillLogic;
12
+import com.srm.bpm.logic.util.StringUtil;
13
+import com.srm.bpm.logic.vo.BillItemVO;
14
+import com.srm.common.data.rest.R;
15
+
16
+import org.springframework.web.bind.annotation.PostMapping;
17
+import org.springframework.web.bind.annotation.RequestBody;
18
+import org.springframework.web.bind.annotation.RequestMapping;
19
+import org.springframework.web.bind.annotation.RestController;
20
+
21
+import lombok.RequiredArgsConstructor;
22
+
23
+/**
24
+ * <p> </p>
25
+ *
26
+ * @author BOGON
27
+ * @version 1.0
28
+ * @since JDK 1.8
29
+ */
30
+@RestController
31
+@RequestMapping("/third/part/bill")
32
+@RequiredArgsConstructor
33
+public class ThirdPartBillController {
34
+    private final FormThirdItemLogic formThirdItemLogic;
35
+    private final BillLogic billLogic;
36
+    private final BillBasicConvert billBasicConvert;
37
+
38
+    @PostMapping("/submit")
39
+    public R<BillItemDTO> submitFormData(@RequestBody JSONObject jsonObject) {
40
+        final Long processId = Long.valueOf(StringUtil.ob2str(jsonObject.get("processId")));
41
+        final Long billId = Long.valueOf(StringUtil.ob2str(jsonObject.get("billId")));
42
+        String nextApprover = StringUtil.ob2str(jsonObject.get("nextApprover"));
43
+        String billCode = StringUtil.ob2str(jsonObject.get("billCode"));
44
+        if (Strings.isNullOrEmpty(nextApprover)) {
45
+            nextApprover = "0";
46
+        }
47
+        final String toForm = formThirdItemLogic.analysisToForm(jsonObject.getString("data"), processId);
48
+        final BillItemVO billItem = billLogic.startFlow(processId, billId, toForm, nextApprover,billCode);
49
+        return R.ok(billBasicConvert.billItemVOToDTO(billItem));
50
+    }
51
+
52
+    @PostMapping("/save")
53
+    public R<BillItemDTO> saveFormData(@RequestBody JSONObject jsonObject) {
54
+        final Long processId = Long.valueOf(StringUtil.ob2str(jsonObject.get("processId")));
55
+        final Long billId = Long.valueOf(StringUtil.ob2str(jsonObject.get("billId")));
56
+        final String toForm = formThirdItemLogic.analysisToForm(jsonObject.getString("data"), processId);
57
+        final BillItemVO billItem = billLogic.saveDrafts(processId, billId, toForm);
58
+        return R.ok(billBasicConvert.billItemVOToDTO(billItem));
59
+    }
60
+
61
+    @PostMapping("/convert")
62
+    public R convert(String data, Long processId) {
63
+        final String toForm = formThirdItemLogic.analysisToForm(data, processId);
64
+        return R.ok(toForm);
65
+    }
66
+
67
+}

+ 63 - 0
bpm-core/src/main/java/com/srm/bpm/facade/rest/UserCenterController.java

@@ -0,0 +1,63 @@
1
+
2
+
3
+package com.srm.bpm.facade.rest;
4
+
5
+import com.google.common.base.MoreObjects;
6
+
7
+import com.srm.bpm.logic.dto.DataTablesInputDTO;
8
+import com.srm.bpm.logic.dto.DataTablesOutputDTO;
9
+import com.srm.bpm.logic.dto.UserChooseDTO;
10
+import com.srm.bpm.logic.query.UserChooseQuery;
11
+import com.srm.bpm.logic.service.UserCenterlogic;
12
+
13
+import org.springframework.web.bind.annotation.PostMapping;
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
+
18
+import java.util.List;
19
+
20
+import javax.validation.Valid;
21
+
22
+import cn.hutool.core.lang.Pair;
23
+import lombok.RequiredArgsConstructor;
24
+
25
+/**
26
+ * <p> </p>
27
+ *
28
+ * @author BOGON
29
+ * @version 1.0
30
+ * @since JDK 1.8
31
+ */
32
+@RestController
33
+@RequiredArgsConstructor
34
+@RequestMapping("/user/center")
35
+public class UserCenterController {
36
+    private final UserCenterlogic userCenterlogic;
37
+
38
+    /**
39
+     * 使用datatable做员工选择
40
+     *
41
+     * @param dataTablesInput 表格参数
42
+     * @return 查询集合
43
+     */
44
+    @PostMapping("/datagrids")
45
+    public DataTablesOutputDTO<UserChooseDTO> datatables(
46
+            @Valid @RequestBody DataTablesInputDTO dataTablesInput
47
+    ) {
48
+        if (dataTablesInput.getLength() == -1) {
49
+            dataTablesInput.setStart(0);
50
+            dataTablesInput.setLength(Integer.MAX_VALUE);
51
+        }
52
+        UserChooseQuery query = dataTablesInput.getParams()
53
+                .toJavaObject(UserChooseQuery.class);
54
+        final int start = MoreObjects.firstNonNull(dataTablesInput.getStart(), 0);
55
+        int current = start / dataTablesInput.getLength();
56
+        Pair<List<UserChooseDTO>, Long> result = userCenterlogic.getChooseUsers(current, dataTablesInput.getLength(),query);
57
+        DataTablesOutputDTO<UserChooseDTO> dataTablesOutput = new DataTablesOutputDTO<>();
58
+        dataTablesOutput.setRecordsTotal(result.getValue());
59
+        dataTablesOutput.setRecordsFiltered(result.getValue());
60
+        dataTablesOutput.setData(result.getKey());
61
+        return dataTablesOutput;
62
+    }
63
+}

+ 18 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/BillBizDataDao.java

@@ -0,0 +1,18 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.BillBizDataEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+/**
9
+ * <p>
10
+ * 审批业务数据 Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author JT
14
+ * @since 2021-03-23
15
+ */
16
+public interface BillBizDataDao extends BaseDao<BillBizDataEntity> {
17
+
18
+}

+ 18 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/BillCcPersonDao.java

@@ -0,0 +1,18 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.BillCcPersonEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+/**
9
+ * <p>
10
+ * 审批单抄送人信息 Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author JT
14
+ * @since 2021-03-23
15
+ */
16
+public interface BillCcPersonDao extends BaseDao<BillCcPersonEntity> {
17
+
18
+}

+ 18 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/BillDataJsonDao.java

@@ -0,0 +1,18 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.BillDataJsonEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+/**
9
+ * <p>
10
+ * 审核表单数据JSON Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author JT
14
+ * @since 2021-03-23
15
+ */
16
+public interface BillDataJsonDao extends BaseDao<BillDataJsonEntity> {
17
+
18
+}

+ 18 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/BillLikeDao.java

@@ -0,0 +1,18 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.BillLikeEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+/**
9
+ * <p>
10
+ * 审批单-赞 Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author JT
14
+ * @since 2021-03-23
15
+ */
16
+public interface BillLikeDao extends BaseDao<BillLikeEntity> {
17
+
18
+}

+ 18 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/BillReadRecordDao.java

@@ -0,0 +1,18 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.BillReadRecordEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+/**
9
+ * <p>
10
+ * 审批单阅读表 Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author JT
14
+ * @since 2021-03-23
15
+ */
16
+public interface BillReadRecordDao extends BaseDao<BillReadRecordEntity> {
17
+
18
+}

+ 18 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/BillReplyAttachmentDao.java

@@ -0,0 +1,18 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.BillReplyAttachmentEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+/**
9
+ * <p>
10
+ * 审批意见附件 Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author JT
14
+ * @since 2021-03-23
15
+ */
16
+public interface BillReplyAttachmentDao extends BaseDao<BillReplyAttachmentEntity> {
17
+
18
+}

+ 18 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/BillReplyDao.java

@@ -0,0 +1,18 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.BillReplyEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+/**
9
+ * <p>
10
+ * 审批单-回复 Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author JT
14
+ * @since 2021-03-23
15
+ */
16
+public interface BillReplyDao extends BaseDao<BillReplyEntity> {
17
+
18
+}

+ 18 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/BillStatDao.java

@@ -0,0 +1,18 @@
1
+ 
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.BillStatEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+/**
9
+ * <p>
10
+ * 审批统计数据 Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author JT
14
+ * @since 2021-03-23
15
+ */
16
+public interface BillStatDao extends BaseDao<BillStatEntity> {
17
+
18
+}

+ 18 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/BillTallyDao.java

@@ -0,0 +1,18 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.BillTallyEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+/**
9
+ * <p>
10
+ * 记账单 Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author JT
14
+ * @since 2021-03-23
15
+ */
16
+public interface BillTallyDao extends BaseDao<BillTallyEntity> {
17
+
18
+}

+ 71 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/BillTaskDao.java

@@ -0,0 +1,71 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.BillTaskEntity;
6
+import com.srm.bpm.infra.po.BillApprovalHistoryPO;
7
+import com.srm.bpm.logic.dto.BillTaskDTO;
8
+import com.srm.common.base.infra.dao.BaseDao;
9
+
10
+import org.apache.ibatis.annotations.Param;
11
+
12
+import java.util.List;
13
+
14
+/**
15
+ * <p>
16
+ * 审批单审批人信息 Mapper 接口
17
+ * </p>
18
+ *
19
+ * @author JT
20
+ * @since 2021-03-23
21
+ */
22
+public interface BillTaskDao extends BaseDao<BillTaskEntity> {
23
+
24
+
25
+    void updateByRefullIn(@Param("billId") long billId,
26
+                          @Param("userCode") String userCode,
27
+                          @Param("dateline") int unixTime);
28
+
29
+    int selectActiveExcludeSelf(@Param("billId") Long billId,
30
+                                @Param("taskId") String taskId,
31
+                                @Param("id") Long id,@Param("status")Integer status);
32
+
33
+    /**
34
+     * 查询节点全部审批任务数量
35
+     *
36
+     * @param billId 审批单id
37
+     * @param taskId 任务id
38
+     * @return 数量
39
+     */
40
+    int selectTotalCount(@Param("billId") Long billId,
41
+                         @Param("taskId") String taskId,
42
+                         @Param("type")int type);
43
+
44
+    /**
45
+     * 获取某个审批单的审批历史(排除已撤销的)
46
+     *
47
+     * @param billId 审批单主键
48
+     * @return 审批任务
49
+     */
50
+    List<BillApprovalHistoryPO> selectHistoryByBillId(@Param("billId") long billId);
51
+
52
+
53
+    List<BillTaskEntity> selectTaskByBillAndUserCode(@Param("billId")long billId, @Param("userCode") String userCode);
54
+
55
+    /**
56
+     * 查询当前表单最新的创建任务
57
+     *
58
+     * @param billId 表单id
59
+     * @return 创建节点任务
60
+     */
61
+    BillTaskEntity selectCreateTaskByBill(@Param("billId")long billId,@Param("nodeType") String nodeType);
62
+
63
+    /**
64
+     * 查询审批单已经审批的节点
65
+     *
66
+     * @param billid 审批单id
67
+     * @return 审批节点
68
+     */
69
+    List<BillTaskDTO> selectHistoryTasks(@Param("billId")Long billid);
70
+
71
+}

+ 18 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/CodeFormatDao.java

@@ -0,0 +1,18 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.CodeFormatEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+/**
9
+ * <p>
10
+ * 编号规则表 Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author JT
14
+ * @since 2021-07-15
15
+ */
16
+public interface CodeFormatDao extends BaseDao<CodeFormatEntity> {
17
+
18
+}

+ 18 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/DatasourceComboDao.java

@@ -0,0 +1,18 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.DatasourceComboEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+/**
9
+ * <p>
10
+ * 数据源下拉框属性 Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author JT
14
+ * @since 2021-03-23
15
+ */
16
+public interface DatasourceComboDao extends BaseDao<DatasourceComboEntity> {
17
+
18
+}

+ 18 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/DatasourceConditionsDao.java

@@ -0,0 +1,18 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.DatasourceConditionsEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+/**
9
+ * <p>
10
+ * 数据源条件 Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author JT
14
+ * @since 2021-03-23
15
+ */
16
+public interface DatasourceConditionsDao extends BaseDao<DatasourceConditionsEntity> {
17
+
18
+}

+ 18 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/DatasourceFiledDao.java

@@ -0,0 +1,18 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.DatasourceFiledEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+/**
9
+ * <p>
10
+ * 数据源字段 Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author JT
14
+ * @since 2021-03-23
15
+ */
16
+public interface DatasourceFiledDao extends BaseDao<DatasourceFiledEntity> {
17
+
18
+}

+ 18 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/DatasourcePopoverDao.java

@@ -0,0 +1,18 @@
1
+ 
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.DatasourcePopoverEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+/**
9
+ * <p>
10
+ * 数据源弹出框属性 Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author JT
14
+ * @since 2021-03-23
15
+ */
16
+public interface DatasourcePopoverDao extends BaseDao<DatasourcePopoverEntity> {
17
+
18
+}

+ 25 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/FormDesingerDao.java

@@ -0,0 +1,25 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
6
+
7
+import org.apache.ibatis.annotations.Param;
8
+
9
+import com.srm.common.base.infra.dao.BaseDao;
10
+import com.srm.bpm.infra.entity.FormDesingerEntity;
11
+
12
+/**
13
+ * <p>
14
+ * 表单设计信息 Mapper 接口
15
+ * </p>
16
+ *
17
+ * @author JT
18
+ * @since 2021-03-23
19
+ */
20
+public interface FormDesingerDao extends BaseDao<FormDesingerEntity> {
21
+
22
+    @InterceptorIgnore(tenantLine = "true")
23
+    FormDesingerEntity selectByProcessId(@Param("processId") long processId);
24
+
25
+}

+ 18 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/FormDetailSettingDao.java

@@ -0,0 +1,18 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.FormDetailSettingEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+/**
9
+ * <p>
10
+ * 表单明细配置 Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author JT
14
+ * @since 2021-03-23
15
+ */
16
+public interface FormDetailSettingDao extends BaseDao<FormDetailSettingEntity> {
17
+
18
+}

+ 29 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/FormExpressionDao.java

@@ -0,0 +1,29 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+
9
+import com.srm.bpm.infra.entity.FormExpressionEntity;
10
+import com.srm.common.base.infra.dao.BaseDao;
11
+import com.srm.bpm.infra.entity.FormExtensionsEntity;
12
+
13
+/**
14
+ * <p>
15
+ * 表单表达式 Mapper 接口
16
+ * </p>
17
+ *
18
+ * @author JT
19
+ * @since 2021-03-23
20
+ */
21
+public interface FormExpressionDao extends BaseDao<FormExpressionEntity> {
22
+
23
+    /**
24
+     * 根据业务流程ID获取扩展功能接口
25
+     * @param processId 业务流程id
26
+     * @return 扩展功能集合
27
+     */
28
+    List<FormExtensionsEntity> selectByProcessId(@Param("processId") long processId);
29
+}

+ 18 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/FormExtensionsDao.java

@@ -0,0 +1,18 @@
1
+ 
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.FormExtensionsEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+/**
9
+ * <p>
10
+ * 表单扩展功能 Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author JT
14
+ * @since 2021-03-23
15
+ */
16
+public interface FormExtensionsDao extends BaseDao<FormExtensionsEntity> {
17
+
18
+}

+ 32 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/FormFieldDao.java

@@ -0,0 +1,32 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+
9
+import com.srm.bpm.infra.entity.FormFieldEntity;
10
+import com.srm.common.base.infra.dao.BaseDao;
11
+
12
+/**
13
+ * <p>
14
+ * 表单字段 Mapper 接口
15
+ * </p>
16
+ *
17
+ * @author JT
18
+ * @since 2021-03-23
19
+ */
20
+public interface FormFieldDao extends BaseDao<FormFieldEntity> {
21
+
22
+    List<FormFieldEntity> selectByProcessIdAndXtype( @Param("processId") long processId,
23
+                                                     @Param("xtype") String xtype);
24
+
25
+    /**
26
+     * 根据业务流程主键获取表单字段配置
27
+     *
28
+     * @param processId 业务流程主键
29
+     * @return 表单字段配置
30
+     */
31
+    List<FormFieldEntity> selectByProcessId(@Param("processId") long processId);
32
+}

+ 21 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/FormSettingDao.java

@@ -0,0 +1,21 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.FormSettingEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+import org.apache.ibatis.annotations.Param;
9
+
10
+/**
11
+ * <p>
12
+ * 表单设置 Mapper 接口
13
+ * </p>
14
+ *
15
+ * @author JT
16
+ * @since 2021-03-23
17
+ */
18
+public interface FormSettingDao extends BaseDao<FormSettingEntity> {
19
+
20
+    FormSettingEntity selectByProcess(@Param("processId") long processId);
21
+}

+ 101 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/FormTableDao.java

@@ -0,0 +1,101 @@
1
+ 
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
6
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7
+import com.srm.bpm.infra.po.TableFieldPO;
8
+import com.srm.bpm.logic.dto.FormTableDto;
9
+import com.srm.bpm.logic.dto.FormTableFieldDto;
10
+
11
+import org.apache.ibatis.annotations.Param;
12
+
13
+import java.util.List;
14
+import java.util.Map;
15
+
16
+/**
17
+ * <p> </p>
18
+ *
19
+ * @author BOGON
20
+ * @version 1.0
21
+ * @since JDK 1.8
22
+ */
23
+public interface FormTableDao {
24
+
25
+    @InterceptorIgnore(tenantLine = "true")
26
+    List<Map<String, Object>> executeSelectSql(@Param("sql")Map<String, Object> param);
27
+
28
+    /**
29
+     * 查询系统数据库名称
30
+     *
31
+     * @return 数据库名称集合
32
+     */
33
+    @InterceptorIgnore(tenantLine = "true")
34
+    List<String> mysqlQueryTables();
35
+
36
+    /**
37
+     * 取得某个表字段的信息
38
+     *
39
+     * @param tableName 表明
40
+     * @return 字段信息
41
+     */
42
+    @InterceptorIgnore(tenantLine = "true")
43
+    List<TableFieldPO> findColumnByTableName(@Param("tableName") String tableName);
44
+
45
+    /**
46
+     * 从指定数据库中,查询符合表明的表的数量
47
+     *
48
+     * @param tableName 表名称
49
+     * @return 存在的表名
50
+     */
51
+    @InterceptorIgnore(tenantLine = "true")
52
+    int selectTableSize(@Param("tableName") String tableName);
53
+
54
+    /**
55
+     * 从指定数据库中,查询是否存在某张表
56
+     *
57
+     * @param tableName 表名称
58
+     * @return 存在的表名
59
+     */
60
+    @InterceptorIgnore(tenantLine = "true")
61
+    String isTargetTableExistInDB(@Param("tableName") String tableName);
62
+
63
+    /**
64
+     * 创建一个数据表
65
+     *
66
+     * @param table  表的相关信息
67
+     * @param fields 字段信息
68
+     * @return 操作行数
69
+     */
70
+    @InterceptorIgnore(tenantLine = "true")
71
+    int createMainTable(@Param("table") FormTableDto table, @Param("fields") List<FormTableFieldDto> fields);
72
+
73
+    /**
74
+     * 创建一个表单的明细数据物理表
75
+     *
76
+     * @param table  表的相关信息
77
+     * @param fields 字段信息
78
+     * @return 操作行数
79
+     */
80
+    @InterceptorIgnore(tenantLine = "true")
81
+    int createDetailTable(@Param("table") FormTableDto table, @Param("fields") List<FormTableFieldDto> fields);
82
+
83
+    @InterceptorIgnore(tenantLine = "true")
84
+    List<String> selectColumnNameByTableName(@Param("tableName") String tableName);
85
+
86
+    /**
87
+     * 向某个表添加字段
88
+     *
89
+     * @param tableName 添加对应表
90
+     * @param fields    要添加的字段
91
+     * @return 影响的行数
92
+     */
93
+    @InterceptorIgnore(tenantLine = "true")
94
+    int addColumn(@Param("tableName") String tableName, @Param("field") FormTableFieldDto fields);
95
+
96
+    @InterceptorIgnore(tenantLine = "true")
97
+    int executeUpdateSql(Map<String, Object> param);
98
+
99
+    @InterceptorIgnore(tenantLine = "true")
100
+    List<Map<String, Object>> executePagingSql(@Param("sql") Map<String, Object> param, Page page);
101
+}

+ 21 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/FormThirdDao.java

@@ -0,0 +1,21 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.FormThirdEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+import org.apache.ibatis.annotations.Param;
9
+
10
+/**
11
+ * <p>
12
+ *  Mapper 接口
13
+ * </p>
14
+ *
15
+ * @author JT
16
+ * @since 2021-07-15
17
+ */
18
+public interface FormThirdDao extends BaseDao<FormThirdEntity> {
19
+
20
+    void physicalDeleteById(@Param("id") Long id);
21
+}

+ 25 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/FormThirdItemDao.java

@@ -0,0 +1,25 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.FormThirdItemEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+import org.apache.ibatis.annotations.Param;
9
+
10
+import java.util.List;
11
+
12
+/**
13
+ * <p>
14
+ *  Mapper 接口
15
+ * </p>
16
+ *
17
+ * @author JT
18
+ * @since 2021-07-15
19
+ */
20
+public interface FormThirdItemDao extends BaseDao<FormThirdItemEntity> {
21
+
22
+    List<FormThirdItemEntity> selectItemByProcessId(@Param("processId") Long processId);
23
+
24
+    void physicalDeleteByThirdId(@Param("thirdId") Long id);
25
+}

+ 22 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/FormValidationDao.java

@@ -0,0 +1,22 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.FormValidationEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+import org.apache.ibatis.annotations.Param;
9
+
10
+/**
11
+ * <p>
12
+ *  Mapper 接口
13
+ * </p>
14
+ *
15
+ * @author JT
16
+ * @since 2021-07-26
17
+ */
18
+public interface FormValidationDao extends BaseDao<FormValidationEntity> {
19
+
20
+    FormValidationEntity selectByProcessId(@Param("processId") long processId);
21
+
22
+}

+ 20 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/ProcessBillTitleDao.java

@@ -0,0 +1,20 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.ProcessBillTitleEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+import com.srm.bpm.infra.po.BillTitlePO;
8
+
9
+/**
10
+ * <p>
11
+ * 流程标题规则 Mapper 接口
12
+ * </p>
13
+ *
14
+ * @author JT
15
+ * @since 2021-03-23
16
+ */
17
+public interface ProcessBillTitleDao extends BaseDao<ProcessBillTitleEntity> {
18
+
19
+    BillTitlePO selectByProcessId(long processId);
20
+}

+ 18 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/ProcessDesingerDao.java

@@ -0,0 +1,18 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.ProcessDesingerEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+/**
9
+ * <p>
10
+ * 流程设计信息 Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author JT
14
+ * @since 2021-03-23
15
+ */
16
+public interface ProcessDesingerDao extends BaseDao<ProcessDesingerEntity> {
17
+
18
+}

+ 25 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/ProcessNodeApproverDao.java

@@ -0,0 +1,25 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.common.base.infra.dao.BaseDao;
6
+import com.srm.bpm.infra.entity.ProcessNodeApproverEntity;
7
+
8
+import org.apache.ibatis.annotations.Param;
9
+
10
+import java.util.List;
11
+
12
+/**
13
+ * <p>
14
+ * 节点审批人 Mapper 接口
15
+ * </p>
16
+ *
17
+ * @author JT
18
+ * @since 2021-03-23
19
+ */
20
+public interface ProcessNodeApproverDao extends BaseDao<ProcessNodeApproverEntity> {
21
+
22
+    List<ProcessNodeApproverEntity> selectByFlowIdAndNodeId(@Param("flowId")String processFlowId, @Param
23
+            ("nodeId")String nodeId);
24
+    ProcessNodeApproverEntity getByIdExludDel(@Param("id") Long approverId);
25
+}

+ 24 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/ProcessNodeCcDao.java

@@ -0,0 +1,24 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+
9
+import com.srm.bpm.infra.entity.ProcessNodeCcEntity;
10
+import com.srm.common.base.infra.dao.BaseDao;
11
+
12
+/**
13
+ * <p>
14
+ *  Mapper 接口
15
+ * </p>
16
+ *
17
+ * @author JT
18
+ * @since 2021-03-23
19
+ */
20
+public interface ProcessNodeCcDao extends BaseDao<ProcessNodeCcEntity> {
21
+
22
+    List<ProcessNodeCcEntity> selectListByProcessIdAndNodeId(@Param("processId") String processId,
23
+                                                             @Param("nodeId") String nodeId);
24
+}

+ 18 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/ProcessNodeConnectionDao.java

@@ -0,0 +1,18 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.ProcessNodeConnectionEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+/**
9
+ * <p>
10
+ * 节点连线信息 Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author JT
14
+ * @since 2021-03-23
15
+ */
16
+public interface ProcessNodeConnectionDao extends BaseDao<ProcessNodeConnectionEntity> {
17
+
18
+}

+ 34 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/ProcessNodeExtendDao.java

@@ -0,0 +1,34 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+
9
+import com.srm.bpm.infra.entity.ProcessNodeExtendEntity;
10
+import com.srm.common.base.infra.dao.BaseDao;
11
+
12
+/**
13
+ * <p>
14
+ * 业务流程节点 Mapper 接口
15
+ * </p>
16
+ *
17
+ * @author JT
18
+ * @since 2021-03-23
19
+ */
20
+public interface ProcessNodeExtendDao extends BaseDao<ProcessNodeExtendEntity> {
21
+
22
+    List<ProcessNodeExtendEntity> selectByProcessAndNodeType(@Param("processId") long processId,
23
+                                                             @Param("nodeType") String nodeType);
24
+
25
+    ProcessNodeExtendEntity selectByTaskId(@Param("taskId") String taskId);
26
+
27
+    ProcessNodeExtendEntity selectByNodeIdAndFlowId(@Param("nodeId") String nodeId,
28
+                                                    @Param("flowId") String flowId);
29
+
30
+    ProcessNodeExtendEntity selectByProcessAndNodeId(@Param("processId") long processId, @Param("nodeId") String nodeId);
31
+
32
+    ProcessNodeExtendEntity selectByProcessAndLinkType( @Param("processId") long processId,
33
+                                                        @Param("linkType") String linkType);
34
+}

+ 17 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/ProcessNodeFormFieldDao.java

@@ -0,0 +1,17 @@
1
+ 
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.common.base.infra.dao.BaseDao;
6
+import com.srm.bpm.infra.entity.ProcessNodeFormFieldEntity;
7
+
8
+/**
9
+ * <p>
10
+ * 流程节点表单字段控制表 Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author JT
14
+ * @since 2021-03-23
15
+ */
16
+public interface ProcessNodeFormFieldDao extends BaseDao<ProcessNodeFormFieldEntity> {
17
+}

+ 18 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/ProcessSettingDao.java

@@ -0,0 +1,18 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.ProcessSettingEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+/**
9
+ * <p>
10
+ * 流程配置 Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author JT
14
+ * @since 2021-03-23
15
+ */
16
+public interface ProcessSettingDao extends BaseDao<ProcessSettingEntity> {
17
+
18
+}

+ 18 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/ProcessTypeDao.java

@@ -0,0 +1,18 @@
1
+ 
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.ProcessTypeEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+/**
9
+ * <p>
10
+ * 流程类型 Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author JT
14
+ * @since 2021-03-23
15
+ */
16
+public interface ProcessTypeDao extends BaseDao<ProcessTypeEntity> {
17
+
18
+}

+ 18 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/ProcessVisualRangeDao.java

@@ -0,0 +1,18 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.ProcessVisualRangeEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+/**
9
+ * <p>
10
+ * 业务流程可见范围 Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author JT
14
+ * @since 2021-03-23
15
+ */
16
+public interface ProcessVisualRangeDao extends BaseDao<ProcessVisualRangeEntity> {
17
+
18
+}

+ 18 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/SysCodeFormatDao.java

@@ -0,0 +1,18 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.SysCodeFormatEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+/**
9
+ * <p>
10
+ * 编号规则表 Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author JT
14
+ * @since 2021-03-23
15
+ */
16
+public interface SysCodeFormatDao extends BaseDao<SysCodeFormatEntity> {
17
+
18
+}

+ 83 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/ToaBillDao.java

@@ -0,0 +1,83 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.srm.bpm.infra.entity.ToaBillEntity;
7
+import com.srm.bpm.logic.query.list.ApprovedBillQuery;
8
+import com.srm.bpm.logic.query.list.CcBillQuery;
9
+import com.srm.bpm.logic.query.list.DraftBillQuery;
10
+import com.srm.bpm.logic.query.list.MeCreateBillQuery;
11
+import com.srm.bpm.logic.query.list.TodoBillQuery;
12
+import com.srm.common.base.infra.dao.BaseDao;
13
+import com.srm.bpm.infra.po.BillItemPO;
14
+import com.srm.bpm.infra.po.ProcessGridPO;
15
+
16
+import org.apache.ibatis.annotations.Param;
17
+
18
+import java.util.List;
19
+
20
+/**
21
+ * <p>
22
+ * 审批单数据 Mapper 接口
23
+ * </p>
24
+ *
25
+ * @author JT
26
+ * @since 2021-03-23
27
+ */
28
+public interface ToaBillDao extends BaseDao<ToaBillEntity> {
29
+
30
+    List<BillItemPO> selectApproverByUserCode(Page page,
31
+                                              @Param("userCode") String userCode,
32
+                                              @Param("query") ApprovedBillQuery query);
33
+
34
+    /**
35
+     * 查询某个员工的待办列表
36
+     *
37
+     * @param page     分页参数
38
+     * @param userCode 用户编号
39
+     * @param query    查询条件
40
+     * @param status   待办状态
41
+     * @return 待办列表
42
+     */
43
+    List<BillItemPO> selectTodoByStatus(Page page,
44
+                                        @Param("approver") String userCode,
45
+                                        @Param("query") TodoBillQuery query,
46
+                                        @Param("statusList") List<Integer> status);
47
+
48
+    /**
49
+     * 获取我发起的审批
50
+     *
51
+     * @param page     分页参数
52
+     * @param userCode 用户编号
53
+     * @param query    查询条件
54
+     */
55
+    List<BillItemPO> selectCreateByEmployee(Page page,
56
+                                            @Param("userCode") String userCode,
57
+                                            @Param("query") MeCreateBillQuery query);
58
+
59
+    /**
60
+     *
61
+     */
62
+    List<BillItemPO> selectDraftsBySender(Page page,
63
+                                          @Param("sender") String userCode,
64
+                                          @Param("query") DraftBillQuery query);
65
+
66
+    /**
67
+     * 查询抄送我的
68
+     */
69
+    List<BillItemPO> selectCc(Page page,
70
+                              @Param("userCode") String userCode,
71
+                              @Param("query") CcBillQuery query);
72
+
73
+    /**
74
+     * 获取待我审批数量
75
+     *
76
+     * @return 待我审批数量
77
+     */
78
+    String selectTodoSizeByStatus(@Param("approver") String userCode, @Param("statusList") List<Integer> statusList);
79
+
80
+    List<BillItemPO> selectAllByQuery( Page page,@Param("query")DraftBillQuery query);
81
+
82
+    List<ProcessGridPO> selectTodoCateSiez(@Param("approver") String var1, @Param("statusList") List<Integer> var2);
83
+}

+ 18 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/ToaDatasourceDao.java

@@ -0,0 +1,18 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.srm.bpm.infra.entity.ToaDatasourceEntity;
6
+import com.srm.common.base.infra.dao.BaseDao;
7
+
8
+/**
9
+ * <p>
10
+ * 数据源 Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author JT
14
+ * @since 2021-03-23
15
+ */
16
+public interface ToaDatasourceDao extends BaseDao<ToaDatasourceEntity> {
17
+
18
+}

+ 26 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/ToaFormDao.java

@@ -0,0 +1,26 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import com.srm.bpm.infra.entity.ToaFormEntity;
8
+import com.srm.common.base.infra.dao.BaseDao;
9
+
10
+/**
11
+ * <p>
12
+ * 流程表单 Mapper 接口
13
+ * </p>
14
+ *
15
+ * @author JT
16
+ * @since 2021-03-23
17
+ */
18
+public interface ToaFormDao extends BaseDao<ToaFormEntity> {
19
+
20
+    /**
21
+     * 通过审批单主键关联来获取表单信息
22
+     * @param billId 审批单主键
23
+     * @return 表单信息
24
+     */
25
+    ToaFormEntity selectByBillId(@Param("billId") long billId);
26
+}

+ 55 - 0
bpm-core/src/main/java/com/srm/bpm/infra/dao/ToaProcessDao.java

@@ -0,0 +1,55 @@
1
+
2
+
3
+package com.srm.bpm.infra.dao;
4
+
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.srm.bpm.infra.entity.ToaProcessEntity;
7
+import com.srm.common.base.infra.dao.BaseDao;
8
+import com.srm.bpm.infra.po.ProcessDetailPO;
9
+import com.srm.bpm.infra.po.ProcessGridPO;
10
+
11
+import org.apache.ibatis.annotations.Param;
12
+
13
+import java.util.List;
14
+import java.util.Map;
15
+import java.util.Set;
16
+
17
+/**
18
+ * <p>
19
+ * 业务流程 Mapper 接口
20
+ * </p>
21
+ *
22
+ * @author JT
23
+ * @since 2021-03-23
24
+ */
25
+public interface ToaProcessDao extends BaseDao<ToaProcessEntity> {
26
+
27
+    /**
28
+     * 分页查询流程信息
29
+     *
30
+     * @param page 分页参数
31
+     * @return 数据
32
+     */
33
+    List<ProcessGridPO> selectByPaging(Page page, @Param("param") Map<String, Object> params, @Param("bloc") String bloc,@Param("tenantFlag") boolean tenantFlag);
34
+
35
+    /**
36
+     * 查询用户可以发起的流程数据
37
+     *
38
+     * @param userCode 用户编码
39
+     * @return 流程数据
40
+     */
41
+    List<ProcessGridPO> selectAllByUserCode(@Param("userCode") String userCode,
42
+                                            @Param("orgs") Set<String> orgs,
43
+                                            @Param("bloc") String bloc,
44
+                                            @Param("name") String name,
45
+                                            @Param("bool") Boolean tenant
46
+    );
47
+
48
+    /**
49
+     * 获取业务流程明细信息
50
+     *
51
+     * @param processId 业务流程主键
52
+     * @return 业务流程信息
53
+     */
54
+    ProcessDetailPO selectDetailById(@Param("processId") long processId);
55
+}

+ 37 - 0
bpm-core/src/main/java/com/srm/bpm/infra/entity/BillBizDataEntity.java

@@ -0,0 +1,37 @@
1
+
2
+
3
+package com.srm.bpm.infra.entity;
4
+
5
+import com.baomidou.mybatisplus.annotation.TableName;
6
+import com.srm.common.base.infra.entity.BaseEntity;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+
10
+/**
11
+ * <p>
12
+ * 审批业务数据
13
+ * </p>
14
+ *
15
+ * @author JT
16
+ * @since 2021-03-23
17
+ */
18
+@Data
19
+@EqualsAndHashCode(callSuper = true)
20
+@TableName("bill_biz_data")
21
+public class BillBizDataEntity extends BaseEntity {
22
+
23
+    private static final long serialVersionUID = 1L;
24
+
25
+    /**
26
+     * 审批主键
27
+     */
28
+    private Long billId;
29
+
30
+    private String bizValue;
31
+
32
+    private String bizType;
33
+
34
+    private String bizRecord;
35
+
36
+
37
+}

+ 48 - 0
bpm-core/src/main/java/com/srm/bpm/infra/entity/BillCcPersonEntity.java

@@ -0,0 +1,48 @@
1
+
2
+
3
+package com.srm.bpm.infra.entity;
4
+
5
+import com.baomidou.mybatisplus.annotation.TableName;
6
+import com.srm.common.base.infra.entity.BaseEntity;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+
10
+/**
11
+ * <p>
12
+ * 审批单抄送人信息
13
+ * </p>
14
+ *
15
+ * @author JT
16
+ * @since 2021-03-23
17
+ */
18
+@Data
19
+@EqualsAndHashCode(callSuper = true)
20
+@TableName("bill_cc_person")
21
+public class BillCcPersonEntity extends BaseEntity {
22
+
23
+    private static final long serialVersionUID = 1L;
24
+
25
+    /**
26
+     * 审批单主键
27
+     */
28
+    private Long billId;
29
+
30
+    /**
31
+     * 用户编号
32
+     */
33
+    private String userCode;
34
+
35
+    /**
36
+     * 业务流程主键
37
+     */
38
+    private Long processId;
39
+
40
+    private String nodeName;
41
+
42
+    /**
43
+     * 审批时间
44
+     */
45
+    private Integer dateline;
46
+
47
+
48
+}

+ 36 - 0
bpm-core/src/main/java/com/srm/bpm/infra/entity/BillDataJsonEntity.java

@@ -0,0 +1,36 @@
1
+
2
+
3
+package com.srm.bpm.infra.entity;
4
+
5
+import com.baomidou.mybatisplus.annotation.TableName;
6
+import com.srm.common.base.infra.entity.BaseEntity;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+
10
+/**
11
+ * <p>
12
+ * 审核表单数据JSON
13
+ * </p>
14
+ *
15
+ * @author JT
16
+ * @since 2021-03-23
17
+ */
18
+@Data
19
+@EqualsAndHashCode(callSuper = true)
20
+@TableName("bill_data_json")
21
+public class BillDataJsonEntity extends BaseEntity {
22
+
23
+    private static final long serialVersionUID = 1L;
24
+
25
+    private Long billId;
26
+
27
+    private String formData;
28
+
29
+    private String formSchema;
30
+
31
+    private String associated;
32
+
33
+    private String outline;
34
+
35
+
36
+}

+ 43 - 0
bpm-core/src/main/java/com/srm/bpm/infra/entity/BillLikeEntity.java

@@ -0,0 +1,43 @@
1
+
2
+
3
+package com.srm.bpm.infra.entity;
4
+
5
+import com.baomidou.mybatisplus.annotation.TableName;
6
+import com.srm.common.base.infra.entity.BaseEntity;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+
10
+/**
11
+ * <p>
12
+ * 审批单-赞
13
+ * </p>
14
+ *
15
+ * @author JT
16
+ * @since 2021-03-23
17
+ */
18
+@Data
19
+@EqualsAndHashCode(callSuper = true)
20
+@TableName("bill_like")
21
+public class BillLikeEntity extends BaseEntity {
22
+
23
+    private static final long serialVersionUID = 1L;
24
+
25
+    /**
26
+     * 审批单主键
27
+     */
28
+    private Long billId;
29
+
30
+    /**
31
+     * 赞时间
32
+     */
33
+    private Integer dateline;
34
+
35
+    /**
36
+     * 赞用户
37
+     */
38
+    private String userCode;
39
+
40
+    private String userName;
41
+
42
+
43
+}

+ 42 - 0
bpm-core/src/main/java/com/srm/bpm/infra/entity/BillReadRecordEntity.java

@@ -0,0 +1,42 @@
1
+
2
+
3
+package com.srm.bpm.infra.entity;
4
+
5
+import com.baomidou.mybatisplus.annotation.TableName;
6
+
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+import com.srm.common.base.infra.entity.BaseEntity;
10
+
11
+/**
12
+ * <p>
13
+ * 审批单阅读表
14
+ * </p>
15
+ *
16
+ * @author JT
17
+ * @since 2021-03-23
18
+ */
19
+@Data
20
+@EqualsAndHashCode(callSuper = true)
21
+@TableName("bill_read_record")
22
+public class BillReadRecordEntity extends BaseEntity {
23
+
24
+    private static final long serialVersionUID = 1L;
25
+
26
+    /**
27
+     * 审批单主键
28
+     */
29
+    private Long billId;
30
+
31
+    /**
32
+     * 读取时间
33
+     */
34
+    private Integer readTime;
35
+
36
+    /**
37
+     * 读取用户编码
38
+     */
39
+    private String userCode;
40
+
41
+
42
+}

+ 43 - 0
bpm-core/src/main/java/com/srm/bpm/infra/entity/BillReplyAttachmentEntity.java

@@ -0,0 +1,43 @@
1
+ 
2
+
3
+package com.srm.bpm.infra.entity;
4
+
5
+import com.baomidou.mybatisplus.annotation.TableName;
6
+import com.srm.common.base.infra.entity.BaseEntity;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+
10
+/**
11
+ * <p>
12
+ * 审批意见附件
13
+ * </p>
14
+ *
15
+ * @author JT
16
+ * @since 2021-03-23
17
+ */
18
+@Data
19
+@EqualsAndHashCode(callSuper = true)
20
+@TableName("bill_reply_attachment")
21
+public class BillReplyAttachmentEntity extends BaseEntity {
22
+
23
+    private static final long serialVersionUID = 1L;
24
+
25
+    /**
26
+     * 回复主键
27
+     */
28
+    private Long replyId;
29
+
30
+    /**
31
+     * 图片标记
32
+     */
33
+    private Integer imageFlag;
34
+
35
+    private String url;
36
+
37
+    /**
38
+     * 附件主键
39
+     */
40
+    private Long attachmentId;
41
+
42
+
43
+}

+ 52 - 0
bpm-core/src/main/java/com/srm/bpm/infra/entity/BillReplyEntity.java

@@ -0,0 +1,52 @@
1
+ 
2
+
3
+package com.srm.bpm.infra.entity;
4
+
5
+import com.baomidou.mybatisplus.annotation.TableName;
6
+import com.srm.common.base.infra.entity.BaseEntity;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+
10
+/**
11
+ * <p>
12
+ * 审批单-回复
13
+ * </p>
14
+ *
15
+ * @author JT
16
+ * @since 2021-03-23
17
+ */
18
+@Data
19
+@EqualsAndHashCode(callSuper = true)
20
+@TableName("bill_reply")
21
+public class BillReplyEntity extends BaseEntity {
22
+
23
+    private static final long serialVersionUID = 1L;
24
+
25
+    /**
26
+     * 审批单主键
27
+     */
28
+    private Long billId;
29
+
30
+    /**
31
+     * 回复用户
32
+     */
33
+    private String userCode;
34
+
35
+    private String content;
36
+
37
+    /**
38
+     * 审批用户主键
39
+     */
40
+    private String approverId;
41
+
42
+    private String signatureBase64;
43
+
44
+    private String signature;
45
+
46
+    /**
47
+     * 回复时间
48
+     */
49
+    private Integer dateline;
50
+
51
+
52
+}

+ 56 - 0
bpm-core/src/main/java/com/srm/bpm/infra/entity/BillStatEntity.java

@@ -0,0 +1,56 @@
1
+
2
+
3
+package com.srm.bpm.infra.entity;
4
+
5
+import com.baomidou.mybatisplus.annotation.TableName;
6
+import com.srm.common.base.infra.entity.BaseEntity;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+
10
+/**
11
+ * <p>
12
+ * 审批统计数据
13
+ * </p>
14
+ *
15
+ * @author JT
16
+ * @since 2021-03-23
17
+ */
18
+@Data
19
+@EqualsAndHashCode(callSuper = true)
20
+@TableName("bill_stat")
21
+public class BillStatEntity extends BaseEntity {
22
+
23
+    private static final long serialVersionUID = 1L;
24
+
25
+    /**
26
+     * 用户编码
27
+     */
28
+    private String userCode;
29
+
30
+    /**
31
+     * 待我审批数量
32
+     */
33
+    private Integer todoSize;
34
+
35
+    /**
36
+     * 我已审批数量
37
+     */
38
+    private Integer completeSize;
39
+
40
+    /**
41
+     * 抄送审批数量
42
+     */
43
+    private Integer ccSize;
44
+
45
+    /**
46
+     * 草稿箱数量
47
+     */
48
+    private Integer draftsSize;
49
+
50
+    /**
51
+     * 我发起的数量
52
+     */
53
+    private Integer mecreateSize;
54
+
55
+
56
+}

+ 85 - 0
bpm-core/src/main/java/com/srm/bpm/infra/entity/BillTallyEntity.java

@@ -0,0 +1,85 @@
1
+
2
+
3
+package com.srm.bpm.infra.entity;
4
+
5
+import com.baomidou.mybatisplus.annotation.TableName;
6
+import com.srm.common.base.infra.entity.BaseEntity;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+
10
+/**
11
+ * <p>
12
+ * 记账单
13
+ * </p>
14
+ *
15
+ * @author JT
16
+ * @since 2021-03-23
17
+ */
18
+@Data
19
+@EqualsAndHashCode(callSuper = true)
20
+@TableName("bill_tally")
21
+public class BillTallyEntity extends BaseEntity {
22
+
23
+    private static final long serialVersionUID = 1L;
24
+
25
+    /**
26
+     * 员工主键
27
+     */
28
+    private Long employeeId;
29
+
30
+    /**
31
+     * 记账日期
32
+     */
33
+    private Integer dateline;
34
+
35
+    /**
36
+     * 记账类别
37
+     */
38
+    private Long type;
39
+
40
+    private String icon;
41
+
42
+    /**
43
+     * 记账金额
44
+     */
45
+    private Float amount;
46
+
47
+    private String remark;
48
+
49
+    /**
50
+     * 创建时间
51
+     */
52
+    private Integer createTime;
53
+
54
+    /**
55
+     * 创建人
56
+     */
57
+    private Long creater;
58
+
59
+    /**
60
+     * 修改人
61
+     */
62
+    private Long updater;
63
+
64
+    /**
65
+     * 删除标记;0-未删除;1-已删除
66
+     */
67
+    private Integer deleteFlag;
68
+
69
+    /**
70
+     * 费用方式-实施、售前
71
+     */
72
+    private Long model;
73
+
74
+    /**
75
+     * 客户主键
76
+     */
77
+    private Long customerId;
78
+
79
+    /**
80
+     * 项目主键
81
+     */
82
+    private Long projectId;
83
+
84
+
85
+}

+ 98 - 0
bpm-core/src/main/java/com/srm/bpm/infra/entity/BillTaskEntity.java

@@ -0,0 +1,98 @@
1
+ 
2
+
3
+package com.srm.bpm.infra.entity;
4
+
5
+import com.baomidou.mybatisplus.annotation.TableName;
6
+import com.srm.common.base.infra.entity.BaseEntity;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+
10
+/**
11
+ * <p>
12
+ * 审批单审批人信息
13
+ * </p>
14
+ *
15
+ * @author JT
16
+ * @since 2021-03-23
17
+ */
18
+@Data
19
+@EqualsAndHashCode(callSuper = true)
20
+@TableName("bill_task")
21
+public class BillTaskEntity extends BaseEntity {
22
+
23
+    private static final long serialVersionUID = 1L;
24
+
25
+    /**
26
+     * 审批单主键
27
+     */
28
+    private Long billId;
29
+
30
+    /**
31
+     * 用户编码或者用户id如果系统没有用户编号直接用id
32
+     */
33
+    private String userCode;
34
+
35
+    /**
36
+     * 来源用户编号或者主键,记录移交和专办的来源用户
37
+     */
38
+    private String sourceUserCode;
39
+
40
+    /**
41
+     * 来源任务主键,记录移交和专办的来源任务
42
+     */
43
+    private Long sourceTaskId;
44
+
45
+    /**
46
+     * 转办设置id
47
+     */
48
+    private Long transferId;
49
+    /**
50
+     * 任务类型(1:默认任务,2:加签任务;3:转办任务;4:移交任务)
51
+     */
52
+    private Integer taskType;
53
+    /**
54
+     * 业务流程主键
55
+     */
56
+    private Long processId;
57
+
58
+    /**
59
+     * 节点审批人设置id
60
+     */
61
+    private Long nodeApproverId;
62
+
63
+    private String nodeName;
64
+
65
+    /**
66
+     * 节点状态;1-待审批;2-已同意;3-已拒绝;4-已撤销;5-他人已审批
67
+     */
68
+    private Integer nodeStatus;
69
+
70
+    /**
71
+     * 审批时间
72
+     */
73
+    private Integer dateline;
74
+
75
+    private String opinion;
76
+
77
+    /**
78
+     * 操作
79
+     */
80
+    private String action;
81
+
82
+    private String taskId;
83
+    /**
84
+     * 上一个节点任务id
85
+     */
86
+    private String lastTaskId;
87
+
88
+    /**
89
+     * 排序次序
90
+     */
91
+    private Long sort;
92
+
93
+    private String taskNodeKey;
94
+
95
+    private String lastNodeKey;
96
+
97
+
98
+}

+ 0 - 0
bpm-core/src/main/java/com/srm/bpm/infra/entity/CodeFormatEntity.java


Some files were not shown because too many files changed in this diff