Compare commits
647 Commits
Author | SHA1 | Date |
---|---|---|
|
5f6a91007c | |
|
577f9fe00d | |
|
621d160304 | |
|
71cb6a0036 | |
|
d32f40f420 | |
|
eca2a2ee33 | |
|
f64bf8caa5 | |
|
93335e8adc | |
|
17d5e6b873 | |
|
5106e36ae8 | |
|
d4333ee497 | |
|
58bad800a9 | |
|
77ce71f127 | |
|
945c335c5c | |
|
f485b3a24c | |
|
507fdc77c2 | |
|
e55d2cd939 | |
|
9d3cbc5237 | |
|
907e27c6a1 | |
|
9967de95ff | |
|
bb1ccc5f75 | |
|
52b33369fe | |
|
38063da1ac | |
|
6d14455417 | |
|
7c4c765124 | |
|
d89aed535d | |
|
00b199b034 | |
|
ddf8ffb418 | |
|
cfb7c312bc | |
|
752daf1d28 | |
|
5023f645c9 | |
|
9a4f8fb373 | |
|
5546c225ea | |
|
9c1d0b36cf | |
|
4bb2097e5c | |
|
8477670166 | |
|
9a9a5ffb92 | |
|
8415cba613 | |
|
8a885b2527 | |
|
4f59ca0038 | |
|
10274861ca | |
|
217f4870f7 | |
|
144d7cb859 | |
|
498e0d7693 | |
|
d8ca3850b2 | |
|
ef50617d64 | |
|
7df6458d57 | |
|
ecf31c36e3 | |
|
40616deade | |
|
63218f6340 | |
|
99c058db90 | |
|
bad6e18413 | |
|
2cff3262c3 | |
|
15be4236d1 | |
|
4bfd46889c | |
|
d926e43f93 | |
|
0ff793ce80 | |
|
78df575406 | |
|
df2d132b1c | |
|
6fd4bb4cb0 | |
|
bb0f7c0a49 | |
|
1a292837c9 | |
|
64e3d335cf | |
|
6b593024ff | |
|
3685314a3f | |
|
436d65f7be | |
|
a453a2a9a8 | |
|
366ef273e9 | |
|
355db93705 | |
|
264b81b661 | |
|
719d5d555b | |
|
f4d4b24d63 | |
|
89e25def13 | |
|
0915a8d283 | |
|
1957fcde25 | |
|
e6da0628fa | |
|
088d06e481 | |
|
0c578efa80 | |
|
64aa70ce9c | |
|
c6cef388aa | |
|
606ceeec5e | |
|
da60e4c4cd | |
|
9f246ff401 | |
|
9dd0fa9b07 | |
|
31ce33abc5 | |
|
1e415b020c | |
|
ef013a1538 | |
|
d3c6158ef6 | |
|
8ed539f272 | |
|
f7fa9a0217 | |
|
0821f9a41b | |
|
7172e929b5 | |
|
03ee180175 | |
|
f43818ff7d | |
|
895537a762 | |
|
48041fecbb | |
|
65d90a55e6 | |
|
e97597db8e | |
|
77a813b926 | |
|
512dbc3062 | |
|
b2fd820f2c | |
|
8a517b86d1 | |
|
1b1f60fd3a | |
|
706c95a767 | |
|
e520f4dd45 | |
|
3dc0328cbe | |
|
71524f2092 | |
|
faa9c0110c | |
|
b3e68ed85b | |
|
342bed13f1 | |
|
a537cf8542 | |
|
076159a6d6 | |
|
d1d3aa20e3 | |
|
717f630524 | |
|
378d7b7e74 | |
|
609379f507 | |
|
ed4601e356 | |
|
d6262c7f4b | |
|
0e73b22ddd | |
|
ccbb9b8683 | |
|
79faece817 | |
|
19c540b97e | |
|
3c6ec3fb1d | |
|
547ddde5c5 | |
|
71bca5dfed | |
|
0703ac1fa3 | |
|
2787535ef5 | |
|
0f4d98f854 | |
|
a87456e66c | |
|
88fb45eb50 | |
|
984dbb03df | |
|
41227985d8 | |
|
398bf1f8c8 | |
|
a6735b2f79 | |
|
ec7a9dbb08 | |
|
5ae9dd8387 | |
|
95623ffc73 | |
|
a77cfd4b41 | |
|
c63d824aaf | |
|
9a3f8bfee8 | |
|
1c107346dc | |
|
f0c9416033 | |
|
b6c4b380ab | |
|
98009c0428 | |
|
e0eef9ab44 | |
|
4561bf0ece | |
|
18d7c62c62 | |
|
414794eee3 | |
|
95d0df9c64 | |
|
14ae81bc79 | |
|
937078db0e | |
|
72b976a06d | |
|
d6ce975a17 | |
|
a55c3b2796 | |
|
100e60262b | |
|
4c985bc938 | |
|
10e9122d80 | |
|
a0abfe7d63 | |
|
fec95d36d4 | |
|
4c9fdf7d79 | |
|
6eba1c3319 | |
|
08d0cc59b8 | |
|
808bd00b14 | |
|
0caa21dc18 | |
|
8c4f6c2566 | |
|
0dd90e3f7c | |
|
7be144b0da | |
|
2564638487 | |
|
9cf1d824c7 | |
|
68b30653a4 | |
|
96816e8cc4 | |
|
9a2890f78e | |
|
64a606452e | |
|
70a406f8c1 | |
|
5561d11cb3 | |
|
472477e385 | |
|
43800049e6 | |
|
50e93eb810 | |
|
4edca70f3d | |
|
57b14f135e | |
|
07ed3deb3d | |
|
57fb2aeca4 | |
|
65c562bdd8 | |
|
895c8df662 | |
|
17bd1141f2 | |
|
7df7c1eb5a | |
|
694b343fcb | |
|
7976f3018e | |
|
608eeaa964 | |
|
3d20c2d291 | |
|
11fac30ca2 | |
|
470b29b69d | |
|
cc64d105e1 | |
|
c852080ed4 | |
|
ebfd22a37b | |
|
817086dd2a | |
|
cac64f79d5 | |
|
e62220744c | |
|
7033395690 | |
|
b60ad07a83 | |
|
9cca67e0c0 | |
|
469a6e7381 | |
|
225c258af3 | |
|
364d77134e | |
|
718ff531fc | |
|
fb1bb46ca1 | |
|
d1bfb36b3b | |
|
2fa278a1a9 | |
|
1f492bc77f | |
|
ea1a05658e | |
|
ed2f1aba5f | |
|
d57b016f25 | |
|
d5008959b0 | |
|
83e7899ca5 | |
|
de015b4a24 | |
|
eecdfb9d2c | |
|
42d9d37e17 | |
|
a32336c77d | |
|
0c3bd22fea | |
|
f4ae458d92 | |
|
a9f5df0eb5 | |
|
208fe7f81f | |
|
eb5bc695d0 | |
|
ed1d3cfb75 | |
|
2c67e41fee | |
|
e7a6e0309f | |
|
b7369b07cc | |
|
675007d23b | |
|
f8833cd1fd | |
|
265a7abb1a | |
|
61cac97d84 | |
|
1d4bb33bda | |
|
eebd27dfb5 | |
|
06d152aaeb | |
|
527aa28a0b | |
|
8810677ca7 | |
|
963d86f209 | |
|
be19c476b5 | |
|
73690ae5c2 | |
|
c067dacc84 | |
|
172adad75a | |
|
26316752c1 | |
|
e9c16e7964 | |
|
d4e38dc40f | |
|
da63db6425 | |
|
f4bb8d22df | |
|
ec8cf4060c | |
|
9b3feddcfb | |
|
194d6214c6 | |
|
f8e82414ad | |
|
e21756cd24 | |
|
645944e305 | |
|
e20b36b1e7 | |
|
d525dcd0a6 | |
|
1dc7cdf4f3 | |
|
6e84af4b01 | |
|
cbec808a2e | |
|
cf74666de8 | |
|
8b751cd807 | |
|
46a9633e89 | |
|
049d84a73b | |
|
f974e753d1 | |
|
ea6ee3af97 | |
|
fb02b1a244 | |
|
3ceb360237 | |
|
f57eb151db | |
|
18285da559 | |
|
8bd551dce8 | |
|
47bc7fe61a | |
|
ff87c12d35 | |
|
6d76c84442 | |
|
10ee8994c2 | |
|
8b06d3e889 | |
|
8a49d3f250 | |
|
b21bbf095d | |
|
5531f0d1d7 | |
|
bea64274ab | |
|
8a761e00a3 | |
|
9fc9b9e3b2 | |
|
936d499927 | |
|
9c7a500916 | |
|
e2524e4bdf | |
|
8edb022406 | |
|
be10111f98 | |
|
1be2c0e05c | |
|
745f2ee510 | |
|
a88422a963 | |
|
cdcefab554 | |
|
4b9a42c288 | |
|
74b3ae5d72 | |
|
0afd1137bb | |
|
05b4938827 | |
|
77c2a74c25 | |
|
668912e91c | |
|
841a42159e | |
|
cb0cb1fce7 | |
|
41a8a5179d | |
|
0240c1a2a1 | |
|
5c90be5110 | |
|
04004b10ee | |
|
1693ba2efc | |
|
d67247be37 | |
|
2a2d4c42b4 | |
|
25aa45ba70 | |
|
b44d75bf37 | |
|
0f8e5522cd | |
|
56c53fb4ab | |
|
4627b967c0 | |
|
b5110ca8e6 | |
|
9bade2237e | |
|
ce59957910 | |
|
32b5398830 | |
|
5e6933cc3d | |
|
f5205e4dba | |
|
6c2eb7ee27 | |
|
ae8e44db92 | |
|
be9b9b3846 | |
|
007804ab37 | |
|
d5fbe11cc9 | |
|
378f6da4a3 | |
|
8427bd6235 | |
|
e5d1c14842 | |
|
5978c46fc0 | |
|
6edebbef77 | |
|
17d7b923e2 | |
|
b679930530 | |
|
ad4692ea79 | |
|
6886d5b521 | |
|
cf1bbc65a8 | |
|
391d800ea9 | |
|
346b3e1443 | |
|
978434df1f | |
|
98c5d7f979 | |
|
509eb22d28 | |
|
1b8fb5fac3 | |
|
10aa8b23a7 | |
|
e1e82f7796 | |
|
9f80befa1a | |
|
6afbc7d937 | |
|
6ed84b9dad | |
|
09de575360 | |
|
9566d0e9c6 | |
|
82c0269d22 | |
|
7b40942bcc | |
|
ca690cb5e6 | |
|
9b73add815 | |
|
aaab711287 | |
|
684c088d56 | |
|
37543aea5b | |
|
feb864da4a | |
|
c9743faf84 | |
|
90b00afa66 | |
|
3c4e606e6b | |
|
14b465cc44 | |
|
c6e886cd40 | |
|
aa9ad12c7d | |
|
e3933ca4d9 | |
|
62a7807720 | |
|
88326fad41 | |
|
e0cea68644 | |
|
017d41b96c | |
|
85b8ed616a | |
|
b6a04edec9 | |
|
de2042e0b9 | |
|
ca300ff472 | |
|
f845d6e42f | |
|
64b66015aa | |
|
136ed49630 | |
|
15fe949a59 | |
|
76014fbd94 | |
|
67b00fba13 | |
|
c7d542a769 | |
|
cc1e20f77d | |
|
7e62fc42fc | |
|
fd1ea49ae0 | |
|
c5193f0c10 | |
|
f0ddfdc118 | |
|
003921c7b3 | |
|
6135cba522 | |
|
d3a510731d | |
|
e36473eb05 | |
|
51a9d61137 | |
|
5570eb7be7 | |
|
df08d716a7 | |
|
785794a948 | |
|
c8230c6b54 | |
|
567fd3f237 | |
|
d49091a697 | |
|
287d860c8f | |
|
5dc0224f96 | |
|
de7301d3d2 | |
|
7065aa0648 | |
|
b529cf5946 | |
|
93b207a1dc | |
|
d8edf04fa7 | |
|
fa8140c80c | |
|
c94a1b5cd8 | |
|
fc09fb5097 | |
|
b09d0cecf0 | |
|
d8d8ed75d5 | |
|
d0f5ff6bba | |
|
ec8dab461b | |
|
b4e546c58f | |
|
d6a7af16d9 | |
|
b713df6815 | |
|
4ab19823f0 | |
|
b7844e3d3f | |
|
cfc468ac1f | |
|
287f532189 | |
|
e85796bf6d | |
|
7b5b18bbd3 | |
|
fb247b77df | |
|
a4683015f7 | |
|
e546f71cce | |
|
dbb809777c | |
|
8139308f82 | |
|
866062f79f | |
|
75b93ff7f0 | |
|
53bb1fbc34 | |
|
004cb4b139 | |
|
62b7a8bdd2 | |
|
e26ec84349 | |
|
423d77a86c | |
|
c470afad2a | |
|
52c2259345 | |
|
5763cd2855 | |
|
2a70bae606 | |
|
60f8ab935f | |
|
26bd6af26d | |
|
26d2d694b7 | |
|
b9fc0025b2 | |
|
31bb5ef630 | |
|
0fe04687f7 | |
|
c52ea9d74e | |
|
b1efceb675 | |
|
36a64089b8 | |
|
2a8ee698d8 | |
|
467a91a440 | |
|
8d5d3ce124 | |
|
daa7a1ee35 | |
|
10c34adf17 | |
|
190e6b8bc5 | |
|
7a4f736b2d | |
|
08a0575e4a | |
|
8af61d5b99 | |
|
cab52bcc01 | |
|
3564e8926d | |
|
995b7e88d6 | |
|
a384c08c10 | |
|
c1159de712 | |
|
624707bd1e | |
|
056dbef838 | |
|
defe0080fa | |
|
88c34f9260 | |
|
ded2d46796 | |
|
4fa4c19b62 | |
|
7abdf61454 | |
|
d7e13004b2 | |
|
334cfae105 | |
|
5fd792ded5 | |
|
0036578c0e | |
|
180ff53331 | |
|
b9e62739ea | |
|
96163b4c9e | |
|
1b0eb695d9 | |
|
672638af84 | |
|
56be8f69c9 | |
|
f2dce819a3 | |
|
b899f57109 | |
|
910b277071 | |
|
20a142626e | |
|
c281a11886 | |
|
ac05a76efe | |
|
88d671d50b | |
|
a251af1189 | |
|
09b0a22862 | |
|
5278145ffd | |
|
3ab35b0d15 | |
|
e0f32fb7df | |
|
eba10b7cb7 | |
|
02e676c6a7 | |
|
97a20c7350 | |
|
1d87ebfad3 | |
|
a9467e2ad0 | |
|
438f7f8075 | |
|
7a1613d92b | |
|
89fc3a7891 | |
|
6914d9f362 | |
|
1cb5bc95c4 | |
|
5a83cc3f54 | |
|
b70e4662d3 | |
|
a485269f95 | |
|
3532bc3f04 | |
|
bf2eeb79b0 | |
|
2241d0290d | |
|
b842ee2035 | |
|
024956fc84 | |
|
d569b2af29 | |
|
b0b3259c99 | |
|
9d617720df | |
|
3803bb90f6 | |
|
7e905fe6cc | |
|
ff9f1492bc | |
|
4bb491435b | |
|
84416591b6 | |
|
713e55768f | |
|
64f878f661 | |
|
4f74fb35f7 | |
|
7bd6985565 | |
|
750c6eec1d | |
|
71b3c744ea | |
|
a2581d63e9 | |
|
bca6a3aafd | |
|
3e026402b3 | |
|
4aa6dd07a3 | |
|
0ea4f88136 | |
|
76fcef9140 | |
|
44196a636b | |
|
e43e9e0225 | |
|
e3dc2d1153 | |
|
17f902fa9d | |
|
5ee96b1837 | |
|
cd4eae7450 | |
|
1490c32d5e | |
|
4cc7bb0b4f | |
|
c73c50feef | |
|
c8c4bd334a | |
|
5db1b3227b | |
|
c135996e8d | |
|
ff40abd034 | |
|
bb9a471566 | |
|
9b73771165 | |
|
a3c282cdd0 | |
|
f303e78e4a | |
|
342d7cc256 | |
|
0f0ab5dc80 | |
|
5e1c11b9a4 | |
|
4606c0876c | |
|
5d0eecd128 | |
|
7a8ab8829e | |
|
2cd263f9cc | |
|
86a8a6a93c | |
|
33dbca81b8 | |
|
9ceceb6f77 | |
|
340e2fdcd4 | |
|
8e0c4fa43f | |
|
2cef960a30 | |
|
e70d2f8744 | |
|
1446bc8d56 | |
|
b2faaa9aba | |
|
b1f8540003 | |
|
ae19c41891 | |
|
577d3b57ec | |
|
db245cdc98 | |
|
4e0dc26ff0 | |
|
6aa8452c2d | |
|
9409e1a253 | |
|
497054c1ec | |
|
a67ae18186 | |
|
cc54fc35c4 | |
|
df83d6f43b | |
|
d428df51fc | |
|
5b7550a72f | |
|
4f0181d7db | |
|
1323d08aa8 | |
|
6db214839c | |
|
f31d243dcf | |
|
6b505a3ca5 | |
|
24290c9970 | |
|
593f427c94 | |
|
821326d1b2 | |
|
dfd9ae0c62 | |
|
8bafba890b | |
|
530c96e094 | |
|
8f9df2d47a | |
|
acd4584add | |
|
7def0238af | |
|
e3e1c2fc2b | |
|
4648c5950a | |
|
2f13947a84 | |
|
c598059e02 | |
|
4ed6580320 | |
|
75223b9f64 | |
|
27db4819ba | |
|
9ac4cb4e03 | |
|
7600c2344a | |
|
6fc92e0414 | |
|
a2e1638296 | |
|
de74e00c22 | |
|
6f69e562b8 | |
|
5adf247503 | |
|
cf3be26cdc | |
|
03f27873fe | |
|
5457761b77 | |
|
fd2b3b66f5 | |
|
ff14675b64 | |
|
1909a4d9eb | |
|
da1f438d89 | |
|
b9613287b6 | |
|
81bbfcf91b | |
|
22d552c5f0 | |
|
c601c709e6 | |
|
5210d86ae1 | |
|
08bf19fc38 | |
|
fb0a2d81bf | |
|
10b6f70376 | |
|
8a8b1519f1 | |
|
5df7e47467 | |
|
46dc8626f3 | |
|
116cc8a419 | |
|
a8494d1bd3 | |
|
e49e3fe4ed | |
|
7353c8a0e2 | |
|
2a70b01a3f | |
|
de8a16c52a | |
|
925d808a97 | |
|
a536bf2856 | |
|
8e05388032 | |
|
7f26ccc344 | |
|
722633ea2e | |
|
f24b2e3a77 | |
|
c692101bfc | |
|
723c28b1c6 | |
|
8fff6522d9 | |
|
6a4ebb885b | |
|
2896fc4e41 | |
|
b2caeb3999 | |
|
d8460bad45 | |
|
91def538e9 | |
|
87ed3ecc23 | |
|
12ee91f333 | |
|
bc4c05de4f | |
|
58f9a98b3a | |
|
e1f524ef20 | |
|
cee46f8bfd | |
|
deef604213 | |
|
a0a16fa72d | |
|
3e85b7e7b3 | |
|
ce13a2840b | |
|
388cfb1d6a | |
|
5f51a7514e | |
|
c1030cfbdd | |
|
4d0f4ee14b | |
|
2214d298e5 | |
|
5f2fa46633 | |
|
80e80848d8 | |
|
e370203b13 |
|
@ -0,0 +1 @@
|
|||
mvn clean package -Dmaven.test.skip=true
|
|
@ -0,0 +1,14 @@
|
|||
@echo off
|
||||
echo.
|
||||
echo [信息] 运行Web工程。
|
||||
echo.
|
||||
|
||||
cd %~dp0
|
||||
cd ../ruoyi-admin/target
|
||||
|
||||
set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
||||
|
||||
java -jar %JAVA_OPTS% ruoyi-admin.jar
|
||||
|
||||
cd bin
|
||||
pause
|
13
pom.xml
13
pom.xml
|
@ -10,7 +10,7 @@
|
|||
|
||||
<name>ruoyi</name>
|
||||
<url>http://www.ruoyi.vip</url>
|
||||
<description>北跨泾河-产发工程数字管理平台</description>
|
||||
<description>长安区数字工程监管系统</description>
|
||||
|
||||
<properties>
|
||||
<ruoyi.version>3.8.6</ruoyi.version>
|
||||
|
@ -31,8 +31,9 @@
|
|||
<velocity.version>2.3</velocity.version>
|
||||
<jwt.version>0.9.1</jwt.version>
|
||||
<flowable.version>6.7.2</flowable.version>
|
||||
<hutool.version>5.8.20</hutool.version>
|
||||
</properties>
|
||||
|
||||
|
||||
<!-- 依赖声明 -->
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
@ -107,7 +108,6 @@
|
|||
<artifactId>velocity-engine-core</artifactId>
|
||||
<version>${velocity.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- collections工具类 -->
|
||||
<dependency>
|
||||
<groupId>commons-collections</groupId>
|
||||
|
@ -194,6 +194,12 @@
|
|||
<version>3.4.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
<version>1.18.30</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
@ -206,6 +212,7 @@
|
|||
<module>ruoyi-generator</module>
|
||||
<module>ruoyi-common</module>
|
||||
<module>ruoyi-flowable</module>
|
||||
<module>yanzhu-deviceApi</module>
|
||||
<module>yanzhu-bigscreen</module>
|
||||
<module>yanzhu-jh</module>
|
||||
</modules>
|
||||
|
|
|
@ -78,6 +78,12 @@
|
|||
<artifactId>ruoyi-flowable</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi;
|
||||
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import org.mybatis.spring.annotation.MapperScan;;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
@ -31,5 +32,6 @@ public class RuoYiApplication
|
|||
" | | \\ `' /| `-' / \n" +
|
||||
" | | \\ / \\ / \n" +
|
||||
" ''-' `'-' `-..-' ");
|
||||
//FileUploadUtils.minPath("/data/uploadPath/upload/");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
package com.ruoyi.api.base;
|
||||
|
||||
import com.ruoyi.common.utils.AuthRsaUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.sign.Md5Utils;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 获取系统token 请求参数
|
||||
*
|
||||
* @author: JiangYuQi
|
||||
* @date: 2024/01/13 10:17
|
||||
*/
|
||||
@Data
|
||||
@Slf4j
|
||||
public class PubTokenReqVo {
|
||||
|
||||
/**
|
||||
* AppId
|
||||
*/
|
||||
@NotBlank(message = "AppId不能为空")
|
||||
@Size(min = 1, max = 64, message = "AppId格式异常")
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* 签名
|
||||
* RSA(用户账号 + 时间戳)加密
|
||||
*/
|
||||
@NotBlank(message = "签名不能为空")
|
||||
private String sign;
|
||||
|
||||
/**
|
||||
* 时间戳
|
||||
*/
|
||||
@NotNull(message = "时间戳不能为空")
|
||||
private Long timestamp;
|
||||
|
||||
/**
|
||||
* 获取登录签名
|
||||
*
|
||||
* @author: JiangYuQi
|
||||
* @date: 2024/01/13 10:17
|
||||
*/
|
||||
public Boolean getLoginSign(String privateKey) {
|
||||
boolean signFlag = false;
|
||||
try {
|
||||
System.out.println("appId=>>>"+appId);
|
||||
System.out.println("privateKey=>>>"+privateKey);
|
||||
System.out.println("timestamp=>>>"+timestamp);
|
||||
String key = Md5Utils.hash(appId + privateKey + timestamp);
|
||||
System.out.println("key=>>>"+key);
|
||||
System.out.println("sign=>>>"+sign);
|
||||
if (StringUtils.equals(sign, key)) {
|
||||
signFlag = true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return signFlag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 效验时间签名[3分钟有效期]
|
||||
*/
|
||||
public Boolean checkTimestamp() {
|
||||
boolean timestampFlag = false;
|
||||
long timePoor = Math.abs(timestamp - System.currentTimeMillis());
|
||||
if (timePoor < 1000 * 60 * 3) {
|
||||
timestampFlag = true;
|
||||
}
|
||||
return timestampFlag;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
package com.ruoyi.api.base;
|
||||
|
||||
import com.ruoyi.common.utils.AuthRsaUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 获取系统token 请求参数
|
||||
*
|
||||
* @author: JiangYuQi
|
||||
* @date: 2024/01/13 10:17
|
||||
*/
|
||||
@Data
|
||||
@Slf4j
|
||||
public class TokenReqVo {
|
||||
|
||||
/**
|
||||
* AppId
|
||||
*/
|
||||
@NotBlank(message = "AppId不能为空")
|
||||
@Size(min = 1, max = 64, message = "AppId格式异常")
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* 签名
|
||||
* RSA(用户账号 + 时间戳)加密
|
||||
*/
|
||||
@NotBlank(message = "签名不能为空")
|
||||
private String sign;
|
||||
|
||||
/**
|
||||
* 时间戳
|
||||
*/
|
||||
@NotNull(message = "时间戳不能为空")
|
||||
private Long timestamp;
|
||||
|
||||
/**
|
||||
* 获取登录签名
|
||||
*
|
||||
* @author: JiangYuQi
|
||||
* @date: 2024/01/13 10:17
|
||||
*/
|
||||
public Boolean getLoginSign(String privateKey) {
|
||||
boolean signFlag = false;
|
||||
try {
|
||||
String decryptByPrivateKey = AuthRsaUtils.decryptByPrivateKey(privateKey,sign);
|
||||
if (StringUtils.equals(appId + timestamp, decryptByPrivateKey)) {
|
||||
signFlag = true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return signFlag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 效验时间签名[3分钟有效期]
|
||||
*/
|
||||
public Boolean checkTimestamp() {
|
||||
boolean timestampFlag = true;
|
||||
/**long timePoor = Math.abs(timestamp - System.currentTimeMillis());
|
||||
if (timePoor < 1000 * 60 * 3) {
|
||||
timestampFlag = true;
|
||||
}*/
|
||||
return timestampFlag;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,199 @@
|
|||
package com.ruoyi.api.labour.controller;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ruoyi.api.base.PubTokenReqVo;
|
||||
import com.ruoyi.api.labour.domain.AiBoxApiReqVo;
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import com.ruoyi.common.annotation.RateLimiter;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.enums.*;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.sign.Md5Utils;
|
||||
import com.ruoyi.framework.web.service.SysLoginService;
|
||||
import com.ruoyi.system.domain.SysApplyConfig;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import com.yanzhu.jh.video.domain.DevAiProjectData;
|
||||
import com.yanzhu.jh.video.service.IDevAiProjectDataService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Ai预警APIController
|
||||
*
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/aiboxs")
|
||||
public class AiBoxApiController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private SysLoginService loginService;
|
||||
|
||||
@Autowired
|
||||
private IDevAiProjectDataService devAiProjectDataService;
|
||||
|
||||
/**
|
||||
* 获取系统token
|
||||
* 限流规则[60秒内最多请求10次,限流策略IP]
|
||||
* @param req 请求信息
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
@Anonymous
|
||||
@ApiOperation(value = "获取TOKEN")
|
||||
@RateLimiter(count = 10, limitType = LimitType.IP)
|
||||
@PostMapping("/v1/getToken")
|
||||
public AjaxResult getToken(@Validated @RequestBody PubTokenReqVo req) {
|
||||
SysApplyConfig sysApplyConfig = redisCache.getCacheObject(CacheConstants.YANZHU_SYSTEM_CONFIG+req.getAppId());
|
||||
if(sysApplyConfig==null){
|
||||
throw new ServiceException(HttpStatusEnum.ERROR.getInfo(),HttpStatusEnum.ERROR.getCode());
|
||||
}
|
||||
if(StringUtils.equals(ShiFouEnum.SHI.getCode(),sysApplyConfig.getIsDel())){
|
||||
throw new ServiceException(HttpStatusEnum.DISABLE.getInfo(),HttpStatusEnum.DISABLE.getCode());
|
||||
}
|
||||
if(!Objects.equals(ApplyCfgTypeEnum.AIBOXS.getCode(),sysApplyConfig.getCfgType())){
|
||||
throw new ServiceException(HttpStatusEnum.ERROR.getInfo(),HttpStatusEnum.ERROR.getCode());
|
||||
}
|
||||
if(!req.checkTimestamp()){
|
||||
throw new ServiceException(HttpStatusEnum.SINGET_TIMEOUT.getInfo(),HttpStatusEnum.SINGET_TIMEOUT.getCode());
|
||||
}
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
String Authorization = "";
|
||||
if (req.getLoginSign(sysApplyConfig.getPublicKey())) {
|
||||
String key = "api.aiboxs.getToken:"+req.getAppId();
|
||||
String obj = redisCache.getCacheObject(key);
|
||||
if(StringUtils.isNotEmpty(obj)){
|
||||
ajax.put("Authorization", obj);
|
||||
}else{
|
||||
Authorization = this.getAppIdLoginToken(req.getAppId(),sysApplyConfig);
|
||||
ajax.put("Authorization", Authorization);
|
||||
redisCache.setCacheObject(key,Authorization,30, TimeUnit.MINUTES);
|
||||
}
|
||||
} else {
|
||||
throw new ServiceException(HttpStatusEnum.SINGET_ERROR.getInfo(),HttpStatusEnum.SINGET_ERROR.getCode());
|
||||
}
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* appId登录创建用户并模拟登录
|
||||
*
|
||||
* @param appId 用户账号
|
||||
* @return token
|
||||
*/
|
||||
private String getAppIdLoginToken(String appId,SysApplyConfig sysApplyConfig) {
|
||||
// 查询用户是否存在,不存在则保存
|
||||
SysUser sysUser = userService.selectUserByUserName(appId);
|
||||
String password = Convert.toStr(System.currentTimeMillis());
|
||||
if (sysUser == null) {
|
||||
sysUser = new SysUser();
|
||||
sysUser.setDeptId(sysApplyConfig.getDeptId());
|
||||
sysUser.setUserName(Convert.toStr(sysApplyConfig.getAppId()));
|
||||
sysUser.setNickName(Convert.toStr(sysApplyConfig.getAppId()));
|
||||
sysUser.setUserType(UserTypeEnum.APPLY.getCode());
|
||||
sysUser.setStatus("0");
|
||||
sysUser.setCreateBy("AppId登录创建用户");
|
||||
sysUser.setPassword(SecurityUtils.encryptPassword(password));
|
||||
userService.insertUser(sysUser);
|
||||
} else {
|
||||
sysUser.setPassword(SecurityUtils.encryptPassword(password));
|
||||
sysUser.setUpdateBy("AppId登录更新用户密码");
|
||||
userService.updateUser(sysUser);
|
||||
}
|
||||
return loginService.unifiedLogin(appId, password);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取视频预警信息
|
||||
* 限流规则[60秒内最多请求10次,限流策略IP]
|
||||
* @param req 请求信息
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
@ApiOperation(value = "获取视频预警信息")
|
||||
@RateLimiter(time = 10, limitType = LimitType.IP)
|
||||
@GetMapping("/v1/list")
|
||||
public TableDataInfo list(AiBoxApiReqVo req) {
|
||||
SysApplyConfig sysApplyConfig = redisCache.getCacheObject(CacheConstants.YANZHU_SYSTEM_CONFIG+super.getUsername());
|
||||
if(StringUtils.equals(ShiFouEnum.SHI.getCode(),sysApplyConfig.getIsDel())){
|
||||
throw new ServiceException(HttpStatusEnum.DISABLE.getInfo(),HttpStatusEnum.DISABLE.getCode());
|
||||
}
|
||||
if(!Objects.equals(ApplyCfgTypeEnum.AIBOXS.getCode(),sysApplyConfig.getCfgType())){
|
||||
throw new ServiceException(HttpStatusEnum.ERROR.getInfo(),HttpStatusEnum.ERROR.getCode());
|
||||
}
|
||||
DevAiProjectData query = new DevAiProjectData();
|
||||
query.setDeptId(sysApplyConfig.getDeptId());
|
||||
query.setProjectId(sysApplyConfig.getProjectId());
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
if(Objects.nonNull(req.getBeginTimestamp()) && Objects.nonNull(req.getEndTimestamp())){
|
||||
Date beginTime = new Date(req.getBeginTimestamp());
|
||||
params.put("beginTime",beginTime);
|
||||
Date endTime = new Date(req.getEndTimestamp());
|
||||
params.put("endTime",endTime);
|
||||
}else{
|
||||
if(Objects.nonNull(req.getBeginTimestamp())){
|
||||
Date beginTime = new Date(req.getBeginTimestamp());
|
||||
params.put("beginDate",beginTime);
|
||||
}
|
||||
if(Objects.nonNull(req.getEndTimestamp())){
|
||||
Date endTime = new Date(req.getEndTimestamp());
|
||||
params.put("endDate",endTime);
|
||||
}
|
||||
}
|
||||
query.setParams(params);
|
||||
startPage();
|
||||
List<DevAiProjectData> list = devAiProjectDataService.selectDevAiProjectDataList(query);
|
||||
for(DevAiProjectData item:list){
|
||||
item.setImageUrl(RuoYiConfig.getProjectUrl()+item.getImageUrl());
|
||||
item.setMinImage(item.getImageUrl()+".min.jpg");
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
private static final String baseUrl = "http://localhost:8090/jhapi";
|
||||
|
||||
public static void main(String[] args) {
|
||||
String appId = "jhcf17140956314490N6VSHsPjx008";
|
||||
String AppSecret = "xx+UsVJ9cIJ8PTWpWU5GcNx+x+chJBQIDAQAB";
|
||||
Long time = System.currentTimeMillis();
|
||||
String sign = Md5Utils.hash(appId+AppSecret+time);
|
||||
System.out.println(time);
|
||||
System.out.println(sign);
|
||||
String url = baseUrl + "/api/aiboxs/v1/getToken";
|
||||
Map<String, Object> body = new HashMap<>();
|
||||
body.put("appId",appId);
|
||||
body.put("sign",sign);
|
||||
body.put("timestamp",time);
|
||||
String result = HttpUtil.post(url, body);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
if(jsonObject.getInteger("code")==200){
|
||||
// 获取到存入redis,设置30分钟有效期
|
||||
String token = jsonObject.getString("Authorization");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,21 @@
|
|||
package com.ruoyi.api.labour.domain;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* API请求参数
|
||||
*
|
||||
* @author: JiangYuQi
|
||||
* @date: 2024/01/13 12:21
|
||||
*/
|
||||
@Data
|
||||
@Slf4j
|
||||
public class AiBoxApiReqVo extends BaseEntity {
|
||||
|
||||
private Long beginTimestamp;
|
||||
|
||||
private Long endTimestamp;
|
||||
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package com.ruoyi.api.labour.domain;
|
||||
|
||||
import com.ruoyi.common.utils.AuthRsaUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.sign.Md5Utils;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 劳务人员签名推送信息 请求参数
|
||||
*
|
||||
* @author: JiangYuQi
|
||||
* @date: 2024/01/13 12:21
|
||||
*/
|
||||
@Data
|
||||
@Slf4j
|
||||
public class LabourSignetVo {
|
||||
|
||||
/**
|
||||
* 签名
|
||||
* RSA(dataMd5 + 时间戳)加密
|
||||
*/
|
||||
@NotBlank(message = "签名不能为空")
|
||||
private String sign;
|
||||
|
||||
/**
|
||||
* 推送数据 明文参数
|
||||
*/
|
||||
@NotBlank(message = "推送数据不能为空")
|
||||
private String data;
|
||||
|
||||
/**
|
||||
* 时间戳
|
||||
*/
|
||||
@NotNull(message = "时间戳不能为空")
|
||||
private Long timestamp;
|
||||
|
||||
/**
|
||||
* 获取数据签名
|
||||
*
|
||||
* @author: JiangYuQi
|
||||
* @date: 2024/01/13 10:17
|
||||
*/
|
||||
public Boolean getDataSign(String privateKey) {
|
||||
boolean signFlag = false;
|
||||
try {
|
||||
String decryptByPrivateKey = AuthRsaUtils.decryptByPrivateKey(privateKey,sign);
|
||||
String privateDataStr = Md5Utils.hash(data) + timestamp;
|
||||
log.info("签名值...{}",privateDataStr);
|
||||
log.info("解密值...{}",decryptByPrivateKey);
|
||||
if (StringUtils.equals(privateDataStr, decryptByPrivateKey)) {
|
||||
signFlag = true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return signFlag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 效验时间签名[30分钟有效期]
|
||||
*/
|
||||
public Boolean checkTimestamp() {
|
||||
boolean timestampFlag = true;
|
||||
/**long timePoor = Math.abs(timestamp - System.currentTimeMillis());
|
||||
if (timePoor < 1000 * 60 * 30) {
|
||||
timestampFlag = true;
|
||||
}*/
|
||||
return timestampFlag;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,150 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.ApplyCfgTypeEnum;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.enums.ShiFouEnum;
|
||||
import com.ruoyi.common.utils.NoUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.SysApplyConfig;
|
||||
import com.ruoyi.system.service.ISysApplyConfigService;
|
||||
import com.yanzhu.jh.project.domain.SurProjectAttendanceCfg;
|
||||
import com.yanzhu.jh.project.service.ISurProjectAttendanceCfgService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统应用注册Controller
|
||||
*
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/applyConfig")
|
||||
public class SysApplyConfigController extends BaseController
|
||||
{
|
||||
private static final String vendorsCode = "yanzhu";
|
||||
|
||||
@Autowired
|
||||
private ISysApplyConfigService sysApplyConfigService;
|
||||
|
||||
@Autowired
|
||||
private ISurProjectAttendanceCfgService surProjectAttendanceCfgService;
|
||||
|
||||
/**
|
||||
* 查询系统应用注册列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:applyConfig:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysApplyConfig sysApplyConfig)
|
||||
{
|
||||
startPage();
|
||||
List<SysApplyConfig> list = sysApplyConfigService.selectSysApplyConfigList(sysApplyConfig);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出系统应用注册列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:applyConfig:export')")
|
||||
@Log(title = "系统应用注册", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysApplyConfig sysApplyConfig)
|
||||
{
|
||||
List<SysApplyConfig> list = sysApplyConfigService.selectSysApplyConfigList(sysApplyConfig);
|
||||
ExcelUtil<SysApplyConfig> util = new ExcelUtil<SysApplyConfig>(SysApplyConfig.class);
|
||||
util.exportExcel(response, list, "系统应用注册数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取系统应用注册详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:applyConfig:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(sysApplyConfigService.selectSysApplyConfigById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增系统应用注册
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:applyConfig:add')")
|
||||
@Log(title = "系统应用注册", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysApplyConfig sysApplyConfig)
|
||||
{
|
||||
if(ApplyCfgTypeEnum.LABOUR.getCode().equals(sysApplyConfig.getCfgType())){
|
||||
SurProjectAttendanceCfg surProjectAttendanceCfg = new SurProjectAttendanceCfg();
|
||||
surProjectAttendanceCfg.setProjectId(sysApplyConfig.getProjectId());
|
||||
surProjectAttendanceCfg.setSubDeptId(sysApplyConfig.getDeptId());
|
||||
surProjectAttendanceCfg.setVendorsCode(vendorsCode);
|
||||
surProjectAttendanceCfg.setEnabled(sysApplyConfig.getIsDel().equals(ShiFouEnum.FOU.getCode())?ShiFouEnum.SHI.getLongCode():ShiFouEnum.FOU.getLongCode());
|
||||
surProjectAttendanceCfg.setState(ShiFouEnum.FOU.getLongCode());
|
||||
int res = surProjectAttendanceCfgService.insertSurProjectAttendanceCfg(surProjectAttendanceCfg);
|
||||
if(res>0){
|
||||
// 同步将信息保存到sur_project_attendance_cfg
|
||||
sysApplyConfig.setCfgId(surProjectAttendanceCfg.getId());
|
||||
}
|
||||
}
|
||||
return toAjax(sysApplyConfigService.insertSysApplyConfig(sysApplyConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改系统应用注册
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:applyConfig:edit')")
|
||||
@Log(title = "系统应用注册", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysApplyConfig sysApplyConfig)
|
||||
{
|
||||
if(ApplyCfgTypeEnum.LABOUR.getCode().equals(sysApplyConfig.getCfgType())){
|
||||
SurProjectAttendanceCfg surProjectAttendanceCfg = new SurProjectAttendanceCfg();
|
||||
surProjectAttendanceCfg.setId(sysApplyConfig.getCfgId());
|
||||
surProjectAttendanceCfg.setEnabled(sysApplyConfig.getIsDel().equals(ShiFouEnum.FOU.getCode())?ShiFouEnum.SHI.getLongCode():ShiFouEnum.FOU.getLongCode());
|
||||
surProjectAttendanceCfgService.updateSurProjectAttendanceCfg(surProjectAttendanceCfg);
|
||||
}
|
||||
return toAjax(sysApplyConfigService.updateSysApplyConfig(sysApplyConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除系统应用注册
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:applyConfig:remove')")
|
||||
@Log(title = "系统应用注册", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
List<Long> cfgIds = new ArrayList<>();
|
||||
for(Long id:ids){
|
||||
SysApplyConfig sysApplyConfig = sysApplyConfigService.selectSysApplyConfigById(id);
|
||||
if(ApplyCfgTypeEnum.LABOUR.getCode().equals(sysApplyConfig.getCfgType())){
|
||||
cfgIds.add(sysApplyConfig.getCfgId());
|
||||
}
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(cfgIds)){
|
||||
surProjectAttendanceCfgService.deleteSurProjectAttendanceCfgByIds(cfgIds.stream().toArray(Long[]::new));
|
||||
}
|
||||
return toAjax(sysApplyConfigService.deleteSysApplyConfigByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成AppId
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:applyConfig:add')")
|
||||
@GetMapping("/createAppId")
|
||||
public AjaxResult createAppId()
|
||||
{
|
||||
return success(NoUtils.createAppId());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,11 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.system.domain.vo.AlertUserPassVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
@ -17,6 +21,8 @@ import com.ruoyi.framework.web.service.SysLoginService;
|
|||
import com.ruoyi.framework.web.service.SysPermissionService;
|
||||
import com.ruoyi.system.service.ISysMenuService;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
*
|
||||
|
@ -56,7 +62,7 @@ public class SysLoginController
|
|||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
@GetMapping("getInfo")
|
||||
@GetMapping("/getInfo")
|
||||
public AjaxResult getInfo()
|
||||
{
|
||||
SysUser user = SecurityUtils.getLoginUser().getUser();
|
||||
|
@ -65,6 +71,14 @@ public class SysLoginController
|
|||
// 权限集合
|
||||
Set<String> permissions = permissionService.getMenuPermission(user);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
List<SysRole> list= user.getRoles();
|
||||
long roleId= list.get(0).getRoleId();
|
||||
for(SysRole role :list){
|
||||
if(role.getRoleId()<roleId){
|
||||
roleId=role.getRoleId();
|
||||
}
|
||||
}
|
||||
ajax.put("roleId",roleId);
|
||||
ajax.put("user", user);
|
||||
ajax.put("roles", roles);
|
||||
ajax.put("permissions", permissions);
|
||||
|
@ -76,7 +90,7 @@ public class SysLoginController
|
|||
*
|
||||
* @return 路由信息
|
||||
*/
|
||||
@GetMapping("getRouters")
|
||||
@GetMapping("/getRouters")
|
||||
public AjaxResult getRouters()
|
||||
{
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import com.ruoyi.system.domain.vo.AlertUserPassVo;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
@ -248,4 +253,26 @@ public class SysUserController extends BaseController
|
|||
{
|
||||
return success(deptService.selectDeptTreeList(dept));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送短信验证码修改密码
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Anonymous
|
||||
@PostMapping("/v1/sendPhoneMessage")
|
||||
public AjaxResult sendPhoneMessage(@RequestBody Map<String,String> data){
|
||||
return userService.sendPhoneMessage(data.get("phoneNumber"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户修改密码&【不需要token】
|
||||
* @param alertUserPassVo
|
||||
* @return
|
||||
*/
|
||||
@Anonymous
|
||||
@PostMapping(value = "/v1/codeUpdatePwd")
|
||||
public AjaxResult codeUpdatePwd(@RequestBody @Valid AlertUserPassVo alertUserPassVo){
|
||||
return userService.updataUserPassWord(alertUserPassVo);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ public class SwaggerConfig
|
|||
// 用ApiInfoBuilder进行定制
|
||||
return new ApiInfoBuilder()
|
||||
// 设置标题
|
||||
.title("标题:北跨泾河-产发工程数字管理平台_接口文档")
|
||||
.title("标题:长安区数字工程监管系统_接口文档")
|
||||
// 描述
|
||||
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
|
||||
// 作者信息
|
||||
|
|
|
@ -1,3 +1,46 @@
|
|||
# 项目相关配置
|
||||
ruoyi:
|
||||
# 名称
|
||||
name: RuoYi
|
||||
# 版本
|
||||
version: 3.8.6
|
||||
# 版权年份
|
||||
copyrightYear: 2023
|
||||
# 实例演示开关
|
||||
demoEnabled: true
|
||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
profile: D:/data2/uploadPath
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
captchaType: math
|
||||
# 服务回调地址
|
||||
projectUrl: http://106.55.153.13:8888
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 8088
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /jhapi
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
# 连接数满后的排队数,默认为100
|
||||
accept-count: 1000
|
||||
threads:
|
||||
# tomcat最大线程数,默认为200
|
||||
max: 800
|
||||
# Tomcat启动初始化的线程数,默认值10
|
||||
min-spare: 100
|
||||
|
||||
#微信公众号配置
|
||||
wechat:
|
||||
mpAppId: wxe6fd9ad863ac09bf
|
||||
mpAppSecret: ed08e7f6f42a40fc9fa0ebbc1bc6a1db
|
||||
wxAppId: wx9997d071b4996f23
|
||||
wxAppSecret: 5bcc9ca17b31133d93a025871fc5021d
|
||||
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
|
@ -6,9 +49,9 @@ spring:
|
|||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://cd-cynosdbmysql-grp-9rqrhxsm.sql.tencentcdb.com:27981/yanzhu_jh?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://106.55.153.13:3306/yanzhu_jh?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: Sxyanzhu@cf
|
||||
password: sxyz@uqw8qmash!<76j
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
|
@ -58,4 +101,26 @@ spring:
|
|||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
multi-statement-allow: true
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 127.0.0.1
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码
|
||||
password: 123456
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
|
@ -0,0 +1,134 @@
|
|||
# 项目相关配置
|
||||
ruoyi:
|
||||
# 名称
|
||||
name: RuoYi
|
||||
# 版本
|
||||
version: 3.8.6
|
||||
# 版权年份
|
||||
copyrightYear: 2023
|
||||
# 实例演示开关
|
||||
demoEnabled: true
|
||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
profile: /data/uploadPath
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
captchaType: math
|
||||
# 服务回调地址
|
||||
projectUrl: http://106.55.153.13:8888
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 8088
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /jhapi
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
# 连接数满后的排队数,默认为100
|
||||
accept-count: 1000
|
||||
threads:
|
||||
# tomcat最大线程数,默认为200
|
||||
max: 800
|
||||
# Tomcat启动初始化的线程数,默认值10
|
||||
min-spare: 100
|
||||
|
||||
#微信公众号配置
|
||||
wechat:
|
||||
mpAppId: wxe6fd9ad863ac09bf
|
||||
mpAppSecret: ed08e7f6f42a40fc9fa0ebbc1bc6a1db
|
||||
wxAppId: wx9997d071b4996f23
|
||||
wxAppSecret: 5bcc9ca17b31133d93a025871fc5021d
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.ruoyi: info
|
||||
com.yanzhu.jh: info
|
||||
org.springframework: error
|
||||
org.flowable: error
|
||||
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://127.0.0.1:3306/yanzhu_jh?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: sxyz@uqw8qmash!<76j
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置连接超时时间
|
||||
connectTimeout: 30000
|
||||
# 配置网络超时时间
|
||||
socketTimeout: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: ruoyi
|
||||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 127.0.0.1
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 1
|
||||
# 密码
|
||||
password:
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
|
@ -0,0 +1,125 @@
|
|||
# 项目相关配置
|
||||
ruoyi:
|
||||
# 名称
|
||||
name: RuoYi
|
||||
# 版本
|
||||
version: 3.8.6
|
||||
# 版权年份
|
||||
copyrightYear: 2023
|
||||
# 实例演示开关
|
||||
demoEnabled: true
|
||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
profile: /data/uploadPath
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
captchaType: math
|
||||
# 服务回调地址
|
||||
projectUrl: http://106.55.153.13:8888
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 8088
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /jhapi
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
# 连接数满后的排队数,默认为100
|
||||
accept-count: 1000
|
||||
threads:
|
||||
# tomcat最大线程数,默认为200
|
||||
max: 800
|
||||
# Tomcat启动初始化的线程数,默认值10
|
||||
min-spare: 100
|
||||
|
||||
#微信公众号配置
|
||||
wechat:
|
||||
mpAppId: #wxe6fd9ad863ac09bf
|
||||
mpAppSecret: #ed08e7f6f42a40fc9fa0ebbc1bc6a1db
|
||||
wxAppId: #wx9997d071b4996f23
|
||||
wxAppSecret: #5bcc9ca17b31133d93a025871fc5021d
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://106.55.153.13:3306/yanzhu_jh?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: sxyz@uqw8qmash!<76j
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置连接超时时间
|
||||
connectTimeout: 30000
|
||||
# 配置网络超时时间
|
||||
socketTimeout: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: ruoyi
|
||||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 127.0.0.1
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 1
|
||||
# 密码
|
||||
password: 123456
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
|
@ -1,45 +1,10 @@
|
|||
# 项目相关配置
|
||||
ruoyi:
|
||||
# 名称
|
||||
name: RuoYi
|
||||
# 版本
|
||||
version: 3.8.6
|
||||
# 版权年份
|
||||
copyrightYear: 2023
|
||||
# 实例演示开关
|
||||
demoEnabled: true
|
||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
profile: /data/uploadPath
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
captchaType: math
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 8090
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /jhapi
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
# 连接数满后的排队数,默认为100
|
||||
accept-count: 1000
|
||||
threads:
|
||||
# tomcat最大线程数,默认为200
|
||||
max: 800
|
||||
# Tomcat启动初始化的线程数,默认值10
|
||||
min-spare: 100
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.ruoyi: debug
|
||||
com.yanzhu.jh: debug
|
||||
org.springframework: warn
|
||||
|
||||
org.flowable: debug
|
||||
# 用户配置
|
||||
user:
|
||||
password:
|
||||
|
@ -50,46 +15,28 @@ user:
|
|||
|
||||
# Spring配置
|
||||
spring:
|
||||
# 微信资源验证访问
|
||||
web:
|
||||
resources:
|
||||
static-locations: classpath:/wxstatic/
|
||||
# 资源信息
|
||||
messages:
|
||||
# 国际化资源文件路径
|
||||
basename: i18n/messages
|
||||
profiles:
|
||||
active: druid
|
||||
active: prod
|
||||
# 文件上传
|
||||
servlet:
|
||||
multipart:
|
||||
# 单个文件大小
|
||||
max-file-size: 10MB
|
||||
max-file-size: 200MB
|
||||
# 设置总上传的文件大小
|
||||
max-request-size: 20MB
|
||||
max-request-size: 500MB
|
||||
# 服务模块
|
||||
devtools:
|
||||
restart:
|
||||
# 热部署开关
|
||||
enabled: true
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 127.0.0.1
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码
|
||||
password: 123456
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
|
||||
# token配置
|
||||
token:
|
||||
|
@ -127,9 +74,9 @@ xss:
|
|||
# 过滤开关
|
||||
enabled: true
|
||||
# 排除链接(多个用逗号分隔)
|
||||
excludes: /system/notice
|
||||
excludes: /system/notice,/common/*
|
||||
# 匹配链接
|
||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||
urlPatterns: /system/*,/monitor/*,/tool/*,/api/*,/flow/*
|
||||
|
||||
# flowable相关表
|
||||
flowable:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="/Users/2y/zhj/logs" />
|
||||
<property name="log.path" value="/usr/local/xaqjgwh/log/ruoyi-admin" />
|
||||
|
||||
<!-- 彩色日志 -->
|
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
CIDdpE5WbJ0acBKs
|
|
@ -0,0 +1 @@
|
|||
29aef62cd1316f1635063c5b86a3ffee
|
|
@ -29,6 +29,11 @@
|
|||
<artifactId>spring-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- spring security 安全认证 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
@ -137,7 +142,13 @@
|
|||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-http</artifactId>
|
||||
<version>5.3.3</version>
|
||||
<version>${hutool.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-core</artifactId>
|
||||
<version>${hutool.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -146,6 +157,24 @@
|
|||
<version>7.2.12</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.13</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<artifactId>weixin-java-mp</artifactId>
|
||||
<version>2.7.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -53,6 +53,9 @@ public @interface Excel
|
|||
*/
|
||||
public int scale() default -1;
|
||||
|
||||
public boolean isLink() default false;
|
||||
|
||||
public String linkText() default "";
|
||||
/**
|
||||
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
|
||||
*/
|
||||
|
|
|
@ -48,4 +48,9 @@ public @interface Log
|
|||
* 排除指定的请求参数
|
||||
*/
|
||||
public String[] excludeParamNames() default {};
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
public String nickname() default "";
|
||||
}
|
||||
|
|
|
@ -33,6 +33,11 @@ public class RuoYiConfig
|
|||
/** 验证码类型 */
|
||||
private static String captchaType;
|
||||
|
||||
/**
|
||||
* 服务回调地址
|
||||
*/
|
||||
private static String projectUrl;
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
|
@ -101,6 +106,14 @@ public class RuoYiConfig
|
|||
RuoYiConfig.captchaType = captchaType;
|
||||
}
|
||||
|
||||
public static String getProjectUrl() {
|
||||
return projectUrl;
|
||||
}
|
||||
|
||||
public void setProjectUrl(String projectUrl) {
|
||||
RuoYiConfig.projectUrl = projectUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取导入上传路径
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
package com.ruoyi.common.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* ////////////////////////////////////////////////////////////////////
|
||||
* // _ooOoo_
|
||||
* // o8888888o
|
||||
* // 88" . "88
|
||||
* // (| ^_^ |)
|
||||
* // O\ = /O
|
||||
* // ____/`---'\____
|
||||
* // .' \\| |// `.
|
||||
* // / \\||| : |||// \
|
||||
* // / _||||| -:- |||||- \
|
||||
* // | | \\\ - /// | |
|
||||
* // | \_| ''\---/'' | |
|
||||
* // \ .-\__ `-` ___/-. /
|
||||
* // ___`. .' /--.--\ `. . ___
|
||||
* // ."" '< `.___\_<|>_/___.' >'"".
|
||||
* // | | : `- \`.;`\ _ /`;.`/ - ` : | |
|
||||
* // \ \ `-. \_ __\ /__ _/ .-` / /
|
||||
* // ========`-.____`-.___\_____/___.-`____.-'========
|
||||
* // `=---='
|
||||
* // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
* // 佛祖保佑 永无BUG 永不修改
|
||||
* ////////////////////////////////////////////////////////////////////
|
||||
*
|
||||
* @ClassName SmsConfig
|
||||
* @Description TODO
|
||||
* @Author QiangZi
|
||||
* @DateTime 2022/3/31 18:15
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Component
|
||||
@PropertySource(value = "classpath:message.properties",encoding = "UTF-8")
|
||||
@ConfigurationProperties(prefix = "sms.jiuwei")
|
||||
public class SmsConfig {
|
||||
|
||||
/**
|
||||
* 企信通平台url
|
||||
**/
|
||||
private String url;
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String username;
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
/**
|
||||
* 产品ID
|
||||
*/
|
||||
private String productid;
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getProductid() {
|
||||
return productid;
|
||||
}
|
||||
|
||||
public void setProductid(String productid) {
|
||||
this.productid = productid;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
package com.ruoyi.common.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
/**
|
||||
* Created by tao.
|
||||
* Date: 2023/3/21 15:02
|
||||
* 描述:
|
||||
*/
|
||||
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "wechat")
|
||||
public class WechatAccountConfig {
|
||||
|
||||
/**
|
||||
* 公众平台id
|
||||
*/
|
||||
private static String mpAppId;
|
||||
|
||||
/**
|
||||
* 公众平台密钥
|
||||
*/
|
||||
private static String mpAppSecret;
|
||||
|
||||
/**
|
||||
* 公众号Token
|
||||
*/
|
||||
private static String myToken;
|
||||
|
||||
/**
|
||||
* AccessToken
|
||||
*/
|
||||
private static String myAccessToken;
|
||||
|
||||
/**
|
||||
* 微信小程序AppId
|
||||
*/
|
||||
private static String wxAppId;
|
||||
|
||||
/**
|
||||
* 微信小程序Secret
|
||||
*/
|
||||
private static String wxAppSecret;
|
||||
|
||||
public static String getMpAppId() {
|
||||
return mpAppId;
|
||||
}
|
||||
|
||||
public void setMpAppId(String mpAppId) {
|
||||
WechatAccountConfig.mpAppId = mpAppId;
|
||||
}
|
||||
|
||||
public static String getMpAppSecret() {
|
||||
return mpAppSecret;
|
||||
}
|
||||
|
||||
public void setMpAppSecret(String mpAppSecret) {
|
||||
WechatAccountConfig.mpAppSecret = mpAppSecret;
|
||||
}
|
||||
|
||||
public static String getMyToken() {
|
||||
return myToken;
|
||||
}
|
||||
|
||||
public void setMyToken(String myToken) {
|
||||
WechatAccountConfig.myToken = myToken;
|
||||
}
|
||||
|
||||
public static String getMyAccessToken() {
|
||||
return myAccessToken;
|
||||
}
|
||||
|
||||
public void setMyAccessToken(String myAccessToken) {
|
||||
WechatAccountConfig.myAccessToken = myAccessToken;
|
||||
}
|
||||
|
||||
public static String getWxAppId() {
|
||||
return wxAppId;
|
||||
}
|
||||
|
||||
public void setWxAppId(String wxAppId) {
|
||||
WechatAccountConfig.wxAppId = wxAppId;
|
||||
}
|
||||
|
||||
public static String getWxAppSecret() {
|
||||
return wxAppSecret;
|
||||
}
|
||||
|
||||
public void setWxAppSecret(String wxAppSecret) {
|
||||
WechatAccountConfig.wxAppSecret = wxAppSecret;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package com.ruoyi.common.config;
|
||||
|
||||
import me.chanjar.weixin.mp.api.WxMpConfigStorage;
|
||||
import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.stereotype.Component;
|
||||
/**
|
||||
* Created by tao.
|
||||
* Date: 2023/3/21 15:00
|
||||
* 描述:
|
||||
*/
|
||||
|
||||
@Component
|
||||
public class WechatMpConfig {
|
||||
|
||||
@Autowired
|
||||
private WechatAccountConfig accountConfig;
|
||||
|
||||
/**
|
||||
* @author :tao
|
||||
* @date :Created in 2021/3/12 10:15
|
||||
* @param: :
|
||||
* @return: WxMpService 对象
|
||||
* 配置wxMpConfigStorage,返回 WxMpService 对象
|
||||
*/
|
||||
@Bean
|
||||
public WxMpService wxMpService() {
|
||||
WxMpService wxMpService = new WxMpServiceImpl();
|
||||
wxMpService.setWxMpConfigStorage(wxMpConfigStorage());
|
||||
return wxMpService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @author :tao
|
||||
* @date :Created in 2021/3/12 10:20
|
||||
* @param: :
|
||||
* @return: WxMpConfigStorage 对象
|
||||
* 配置AppId、和AppSecret,获取WxMpConfigStorage 对象
|
||||
*/
|
||||
@Bean
|
||||
public WxMpConfigStorage wxMpConfigStorage() {
|
||||
WxMpInMemoryConfigStorage wxMpConfigStorage = new WxMpInMemoryConfigStorage();
|
||||
wxMpConfigStorage.setAppId(accountConfig.getMpAppId());
|
||||
wxMpConfigStorage.setSecret(accountConfig.getMpAppSecret());
|
||||
wxMpConfigStorage.setToken(accountConfig.getMyToken());
|
||||
wxMpConfigStorage.setAccessToken(accountConfig.getMyAccessToken());
|
||||
return wxMpConfigStorage;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.ruoyi.common.constant;
|
||||
|
||||
/**
|
||||
* 接口通讯信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class ApiConstants {
|
||||
|
||||
/**
|
||||
* IOT配电箱数据获取HOST&&萨达
|
||||
*/
|
||||
public static final String IOT_SD_HOST = "https://api.e.v1.i-sada.net";
|
||||
}
|
|
@ -41,4 +41,59 @@ public class CacheConstants
|
|||
* 登录账户密码错误次数 redis key
|
||||
*/
|
||||
public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:";
|
||||
|
||||
/**
|
||||
* yanzhu系统应用注册 redis key
|
||||
*/
|
||||
public static final String YANZHU_SYSTEM_CONFIG = "yanzhu_system_config:";
|
||||
|
||||
/**
|
||||
* yanzhu设备塔吊检测 redis key
|
||||
*/
|
||||
public static final String YANZHU_DEVICE_TOWER = "device.tower_cfg:";
|
||||
|
||||
/**
|
||||
* yanzhu设备塔吊检测 redis key
|
||||
*/
|
||||
public static final String YANZHU_DEVICE_AI = "device.aibox_cfg:";
|
||||
|
||||
/**
|
||||
* 微信公众号模板消息 redis key
|
||||
*/
|
||||
public static final String WX_MPMESSAGE_KEY = "wx.mpmessage.key::";
|
||||
|
||||
/**
|
||||
* 微信消息推送openId
|
||||
*/
|
||||
public static final String WX_MPMESSAGE_OPENID = "wx.mpmessage.openId::";
|
||||
|
||||
/**
|
||||
* 微信消息推送通知人名称
|
||||
*/
|
||||
public static final String WX_MPMESSAGE_UNAME = "wx.mpmessage.uname::";
|
||||
|
||||
/**
|
||||
* 微信消息推送项目名称
|
||||
*/
|
||||
public static final String WX_MPMESSAGE_PNAME = "wx.mpmessage.pname::";
|
||||
|
||||
/**
|
||||
* 微信消息推送单位名称
|
||||
*/
|
||||
public static final String WX_MPMESSAGE_DNAME = "wx.mpmessage.dname::";
|
||||
|
||||
/**
|
||||
* 微信消息推送项目总监
|
||||
*/
|
||||
public static final String WX_MPMESSAGE_P_SUP = "wx.mpmessage.p.sup::";
|
||||
|
||||
/**
|
||||
* 微信消息推送项目甲代
|
||||
*/
|
||||
public static final String WX_MPMESSAGE_P_MAG = "wx.mpmessage.p.mag::";
|
||||
|
||||
/**
|
||||
* 微信消息推送项目经理
|
||||
*/
|
||||
public static final String WX_MPMESSAGE_P_ORG = "wx.mpmessage.p.org::";
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ public class Constants
|
|||
/**
|
||||
* 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
|
||||
*/
|
||||
public static final String[] JOB_WHITELIST_STR = { "com.ruoyi" };
|
||||
public static final String[] JOB_WHITELIST_STR = { "com.ruoyi","com.yanzhu.jh"};
|
||||
|
||||
/**
|
||||
* 定时任务违规的字符
|
||||
|
|
|
@ -21,6 +21,11 @@ import com.ruoyi.common.utils.PageUtils;
|
|||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.sql.SqlUtil;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* web层通用数据处理
|
||||
|
@ -56,6 +61,14 @@ public class BaseController
|
|||
PageUtils.startPage();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置请求分页数据
|
||||
*/
|
||||
protected void startPage(Integer pageNum, Integer pageSize)
|
||||
{
|
||||
PageUtils.startPage(pageNum,pageSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置请求排序数据
|
||||
*/
|
||||
|
@ -91,6 +104,45 @@ public class BaseController
|
|||
return rspData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从Cookie中获取B类用户的项目IDS,b.监理单位、总包单位、分包单位用户不展示项目概况菜单,二级菜单只展示自已参与的项目
|
||||
* @return
|
||||
*/
|
||||
protected List<Long> getProjectIds(){
|
||||
String ids=getCookie("__ids__");
|
||||
List<Long> list=new ArrayList<>();
|
||||
if(StringUtils.isNotEmpty(ids)){
|
||||
String[] tmps= ids.split(",");
|
||||
for(String s:tmps){
|
||||
if(s.length()>0){
|
||||
try{
|
||||
list.add(Long.parseLong(s));
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
protected HttpServletRequest getRequest(){
|
||||
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
return servletRequestAttributes.getRequest();
|
||||
}
|
||||
|
||||
protected String getCookie(String key){
|
||||
Cookie[] cookies =getRequest().getCookies();
|
||||
if(cookies!=null && cookies.length>0){
|
||||
for(Cookie cookie :cookies){
|
||||
if(cookie.getName().toLowerCase().equals(key.toLowerCase())){
|
||||
return cookie.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功
|
||||
*/
|
||||
|
|
|
@ -3,10 +3,16 @@ package com.ruoyi.common.core.domain;
|
|||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
|
||||
/**
|
||||
* Entity基类
|
||||
|
@ -17,6 +23,24 @@ public class BaseEntity implements Serializable
|
|||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public List<Long> getPrjIds() {
|
||||
return prjIds;
|
||||
}
|
||||
|
||||
public void setPrjIds(List<Long> prjIds) {
|
||||
this.prjIds = prjIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存项目ID列表,用于B类用户 b.监理单位、总包单位、分包单位用户不展示项目概况菜单,二级菜单只展示自已参与的项目
|
||||
*/
|
||||
private List<Long> prjIds;
|
||||
|
||||
/**
|
||||
* 项目类型
|
||||
*/
|
||||
private String proType;
|
||||
|
||||
/** 搜索值 */
|
||||
@JsonIgnore
|
||||
private String searchValue;
|
||||
|
@ -42,6 +66,9 @@ public class BaseEntity implements Serializable
|
|||
private String nowRole;
|
||||
private String nowDept;
|
||||
private String nowUser;
|
||||
private String nowUserName;
|
||||
private String projectDeptId;
|
||||
private String comment;
|
||||
|
||||
/** 请求参数 */
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
|
@ -139,6 +166,30 @@ public class BaseEntity implements Serializable
|
|||
this.activeName = activeName;
|
||||
}
|
||||
|
||||
public String getNowUserName() {
|
||||
return nowUserName;
|
||||
}
|
||||
|
||||
public void setNowUserName(String nowUserName) {
|
||||
this.nowUserName = nowUserName;
|
||||
}
|
||||
|
||||
public String getProjectDeptId() {
|
||||
return projectDeptId;
|
||||
}
|
||||
|
||||
public void setProjectDeptId(String projectDeptId) {
|
||||
this.projectDeptId = projectDeptId;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public Map<String, Object> getParams()
|
||||
{
|
||||
if (params == null)
|
||||
|
@ -152,4 +203,22 @@ public class BaseEntity implements Serializable
|
|||
{
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
public String getProType() {
|
||||
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
|
||||
if(servletRequestAttributes==null){
|
||||
return "";
|
||||
}
|
||||
RequestContextHolder.setRequestAttributes(servletRequestAttributes,true);
|
||||
HttpServletRequest request = servletRequestAttributes.getRequest();
|
||||
String str= request.getHeader("proType");
|
||||
if("0".equals(str)){
|
||||
str="";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
public void setProType(String proType) {
|
||||
this.proType = proType;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,9 @@ public class SysUser extends BaseEntity
|
|||
@Excel(name = "用户名称")
|
||||
private String nickName;
|
||||
|
||||
/** 用户类型 */
|
||||
private String userType;
|
||||
|
||||
/** 用户邮箱 */
|
||||
@Excel(name = "用户邮箱")
|
||||
private String email;
|
||||
|
@ -297,6 +300,14 @@ public class SysUser extends BaseEntity
|
|||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public String getUserType() {
|
||||
return userType;
|
||||
}
|
||||
|
||||
public void setUserType(String userType) {
|
||||
this.userType = userType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
|
|
@ -27,6 +27,11 @@ public class LoginBody
|
|||
*/
|
||||
private String uuid;
|
||||
|
||||
/**
|
||||
* 微信认证ID
|
||||
*/
|
||||
private String openId;
|
||||
|
||||
public String getUsername()
|
||||
{
|
||||
return username;
|
||||
|
@ -66,4 +71,12 @@ public class LoginBody
|
|||
{
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public String getOpenId() {
|
||||
return openId;
|
||||
}
|
||||
|
||||
public void setOpenId(String openId) {
|
||||
this.openId = openId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,24 +1,25 @@
|
|||
package com.ruoyi.common.enums;
|
||||
|
||||
/**
|
||||
* 用户状态
|
||||
* 应用配置类型
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public enum SysStatusEnum {
|
||||
public enum ApplyCfgTypeEnum {
|
||||
|
||||
OK(0L, "正常"), DISABLE(1L, "停用"), DELETED(2L, "删除");
|
||||
LABOUR("1", "劳务人员信息接入"),
|
||||
AIBOXS("2", "视频智能预警接入");
|
||||
|
||||
private final Long code;
|
||||
private final String code;
|
||||
private final String info;
|
||||
|
||||
SysStatusEnum(Long code, String info)
|
||||
ApplyCfgTypeEnum(String code, String info)
|
||||
{
|
||||
this.code = code;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public Long getCode()
|
||||
public String getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package com.ruoyi.common.enums;
|
||||
|
||||
public enum DeptTypeEnum {
|
||||
|
||||
JTGS("1", "泾河产业发展集团"),
|
||||
ZGS("11", "发展集团子公司"),
|
||||
JLDW("4", "监理单位"),
|
||||
ZBDW("2", "总包单位"),
|
||||
FBDW("3", "分包单位"),
|
||||
|
||||
JTGSTYPE("3", "泾河产业发展集团"),
|
||||
ZGSTYPE("4", "发展集团子公司"),
|
||||
JFDBTYPE("5", "甲方代表"),
|
||||
JLDWTYPE("6", "监理单位"),
|
||||
ZBDWTYPE("7", "总包单位"),
|
||||
FBDWTYPE("8", "分包单位"),
|
||||
|
||||
COMFLAG("1","子公司标识");
|
||||
|
||||
private final String code;
|
||||
private final String info;
|
||||
|
||||
DeptTypeEnum(String code, String info)
|
||||
{
|
||||
this.code = code;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public String getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getInfo()
|
||||
{
|
||||
return info;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.ruoyi.common.enums;
|
||||
|
||||
/**
|
||||
* 订单Http状态
|
||||
*
|
||||
* @author JiangYuQi
|
||||
*/
|
||||
public enum HttpStatusEnum {
|
||||
|
||||
ERROR(11110, "AppId不存在或已被删除"),
|
||||
DISABLE(11112, "AppId已被停用"),
|
||||
SINGET_ERROR(11113, "签名值不正确"),
|
||||
SINGET_TIMEOUT(11114, "签名数据已过期"),
|
||||
SINGET_EXCEPTION(11115, "签名数据解密异常"),
|
||||
DARA_EXCEPTION(11116, "数据解析异常");
|
||||
|
||||
private final Integer code;
|
||||
private final String info;
|
||||
|
||||
HttpStatusEnum(Integer code, String info)
|
||||
{
|
||||
this.code = code;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public Integer getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getInfo()
|
||||
{
|
||||
return info;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.ruoyi.common.enums;
|
||||
|
||||
/**
|
||||
* 模板消息枚举
|
||||
*
|
||||
* @author JiangYuQi
|
||||
*/
|
||||
public enum MessageTypeEnum {
|
||||
|
||||
AQYHZG("10", "安全隐患整改"),
|
||||
ZLYHZG("20", "质量隐患整改"),
|
||||
CSCLSP("30", "实测实量审批"),
|
||||
JPYSSP("40", "举牌验收审批"),
|
||||
CLFYSP("50", "材料封样审批"),
|
||||
QYFSSP("60", "取样复试审批"),
|
||||
GCSPCSBL("70", "办理工程审批超时提醒"),
|
||||
GCSPCSCS("80", "抄送工程审批超时提醒"),
|
||||
YHZGCSGZ("90", "隐患整改超时通知"),
|
||||
YHFJCSGZ("100", "隐患复检超时通知"),
|
||||
LZYJSP("110", "劳资预警审批"),
|
||||
LZYJCSTZ("120", "劳资预警审批超时"),
|
||||
GCGNJY("130", "工程功能检验审批");
|
||||
|
||||
//工作流审批由ProcDefKey组成
|
||||
private final String code;
|
||||
private final String name;
|
||||
|
||||
MessageTypeEnum(String code, String name)
|
||||
{
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public static String getYHPCLX(Long infoType){
|
||||
if(infoType==0){
|
||||
return MessageTypeEnum.AQYHZG.code;
|
||||
}else{
|
||||
return MessageTypeEnum.ZLYHZG.code;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package com.ruoyi.common.enums;
|
||||
|
||||
/**
|
||||
* 公共状态枚举
|
||||
*/
|
||||
public enum PublicStateEnum {
|
||||
|
||||
YES("Y", "YES"),
|
||||
NO("N", "NO"),
|
||||
OK("0", "正常"),
|
||||
DISABLE("1", "停用"),
|
||||
DELETED("2", "删除"),
|
||||
HG("1","合格"),
|
||||
BHG("2","不合格"),
|
||||
USERTYPE_JFJL("21", "甲方经理"),
|
||||
/**********************************项目验收***************************************/
|
||||
PROJECT_CHECK_TYPE_JPYS("1", "举牌验收"),
|
||||
PROJECT_CHECK_POSITION_TYPE("1", "默认工序部位类型"),
|
||||
/**********************************项目验收***************************************/
|
||||
|
||||
/**********************************审批相关***************************************/
|
||||
AUDIT_TYPE_QYFS("1", "取样复试"),
|
||||
AUDIT_TYPE_CLFY("4", "材料封样"),
|
||||
AUDIT_TYPE_JPYS("3", "举牌验收"),
|
||||
AUDIT_TYPE_SCSL("2", "实测实量"),
|
||||
AUDIT_TYPE_GCGNJY("5", "工程功能检验"),
|
||||
AUDITINFO_DSH("1", "待审核"),
|
||||
AUDITINFO_SHBH("3", "审核驳回"),
|
||||
AUDITINFO_SHTG("4", "审核通过"),
|
||||
/**********************************审批相关***************************************/
|
||||
|
||||
/**********************************视频设备***************************************/
|
||||
VIDEO_ONLINE("1", "在线"),
|
||||
VIDEO_OFFLINE("2", "离线"),
|
||||
VIDEO_UNKNOWN("3", "未知"),
|
||||
/**********************************视频设备***************************************/
|
||||
|
||||
/**********************************材料进场取样复试***************************************/
|
||||
CHECK_STATE_SJ("1", "送检中"),
|
||||
/**********************************材料进场取样复试***************************************/
|
||||
COMZGS("1","子公司状态标识");
|
||||
|
||||
private final String code;
|
||||
private final String info;
|
||||
|
||||
PublicStateEnum(String code, String info)
|
||||
{
|
||||
this.code = code;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public String getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getInfo()
|
||||
{
|
||||
return info;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.ruoyi.common.enums;
|
||||
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
|
||||
/**
|
||||
* 是否状态
|
||||
*
|
||||
* @author JiangYuQi
|
||||
*/
|
||||
public enum ShiFouEnum {
|
||||
|
||||
FOU("0", "否"), SHI("1", "是");
|
||||
|
||||
private final String code;
|
||||
private final String info;
|
||||
|
||||
ShiFouEnum(String code, String info)
|
||||
{
|
||||
this.code = code;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public String getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getInfo()
|
||||
{
|
||||
return info;
|
||||
}
|
||||
|
||||
public Long getLongCode()
|
||||
{
|
||||
return Convert.toLong(code);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
package com.ruoyi.common.enums;
|
||||
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
|
||||
public enum SysRoleEnum {
|
||||
|
||||
ADMIN("1", "admin"),
|
||||
|
@ -9,6 +11,9 @@ public enum SysRoleEnum {
|
|||
JLDW("5", "监理单位"),
|
||||
ZBDW("6", "总包单位"),
|
||||
FBDW("7", "分包单位"),
|
||||
JLDWGR("15", "监理单位"),
|
||||
ZBDWGR("16", "总包单位"),
|
||||
FBDWGR("17", "分包单位"),
|
||||
COMMON("99", "普通角色");
|
||||
|
||||
private final String code;
|
||||
|
@ -25,6 +30,11 @@ public enum SysRoleEnum {
|
|||
return code;
|
||||
}
|
||||
|
||||
public Long getLongCode()
|
||||
{
|
||||
return Convert.toLong(code);
|
||||
}
|
||||
|
||||
public String getInfo()
|
||||
{
|
||||
return info;
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package com.ruoyi.common.enums;
|
||||
|
||||
/**
|
||||
* 模板消息枚举
|
||||
*
|
||||
* @author JiangYuQi
|
||||
*/
|
||||
public enum TemplateMessageEnum {
|
||||
SERVER_ERROR("_YCnCRtgbtFNNg_78koc8nbFl2gWjeaWFHXV7WV1if8","服务异常通知"),
|
||||
TROUBLE_SUBMIT("f3saBGJCnUAjXHw1KooxEQOOiKEHlQxLIK-sPDgoL_E", "隐患整改通知"),
|
||||
TROUBLE_HANDLE("6mGOWPXS3l5a5fzXd9GIV9_IkEfZmeJ_6G2P_SQkWnU", "隐患处理完成通知"),
|
||||
ROUBLE_EXPIRED_ZG("f3saBGJCnUAjXHw1KooxESpSdHMrh5liznpsbWZV8oA", "隐患整改超时通知"),
|
||||
ROUBLE_EXPIRED_FJ("f3saBGJCnUAjXHw1KooxESpSdHMrh5liznpsbWZV8oA", "隐患复检超时通知"),
|
||||
APPLY_DEFAULT("KY7oAHgqFxUSaE3ByxFJfv_0U3LnSWfgUCwV-CZyEdo", "系统流程审批提醒"),
|
||||
APPLY_EXPIRED_MY("MUAXGjyaNE-maYn6XSNycRfZfPtdVTxubqlT8lHcYqw", "办理流程审批超时提醒"),
|
||||
APPLY_EXPIRED_COPY("MUAXGjyaNE-maYn6XSNyceRFN9h8nfIjKvyZTOLnKDE", "抄送流程审批超时提醒");
|
||||
|
||||
private final String id;
|
||||
private final String name;
|
||||
|
||||
TemplateMessageEnum(String id, String name)
|
||||
{
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.ruoyi.common.enums;
|
||||
|
||||
/**
|
||||
* 用户类型枚举
|
||||
* @author JiangYuQi
|
||||
*/
|
||||
public enum UserTypeEnum {
|
||||
|
||||
SYSTEM("00","系统用户"),
|
||||
APPLY("99","应用用户");
|
||||
|
||||
private final String code;
|
||||
private final String info;
|
||||
|
||||
UserTypeEnum(String code, String info)
|
||||
{
|
||||
this.code = code;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public String getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getInfo()
|
||||
{
|
||||
return info;
|
||||
}
|
||||
}
|
|
@ -1,18 +1,18 @@
|
|||
package com.ruoyi.common.enums;
|
||||
|
||||
/**
|
||||
* 用户状态
|
||||
*
|
||||
* 厂商编号类型枚举
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public enum UserStatus
|
||||
{
|
||||
OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除");
|
||||
public enum VendorsCodeEnum {
|
||||
|
||||
YANZHU("yanzhu", "研筑");
|
||||
|
||||
private final String code;
|
||||
private final String info;
|
||||
|
||||
UserStatus(String code, String info)
|
||||
VendorsCodeEnum(String code, String info)
|
||||
{
|
||||
this.code = code;
|
||||
this.info = info;
|
||||
|
@ -27,4 +27,5 @@ public enum UserStatus
|
|||
{
|
||||
return info;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.ruoyi.common.enums;
|
||||
|
||||
/**
|
||||
* 工作新闻枚举
|
||||
* @author ruoyi
|
||||
*/
|
||||
public enum WorkJournalismEnum {
|
||||
|
||||
DFB("1", "待发布"),
|
||||
YFB("2", "已发布"),
|
||||
YCH("3", "已撤回"),
|
||||
YZD("1", "已置顶"),
|
||||
BZD("0", "不置顶");
|
||||
|
||||
private final String code;
|
||||
private final String info;
|
||||
|
||||
WorkJournalismEnum(String code, String info)
|
||||
{
|
||||
this.code = code;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public String getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getInfo()
|
||||
{
|
||||
return info;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,206 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2021. 西安屹城兴软件服务 All rights reserved.
|
||||
*/
|
||||
package com.ruoyi.common.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ruoyi.common.utils.sign.Md5Utils;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import java.security.*;
|
||||
import java.security.interfaces.RSAPrivateKey;
|
||||
import java.security.interfaces.RSAPublicKey;
|
||||
import java.security.spec.PKCS8EncodedKeySpec;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* RSA加密解密
|
||||
**/
|
||||
public class AuthRsaUtils {
|
||||
|
||||
// Rsa 私钥
|
||||
public static String privateKey = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAMwgEvQL6w3ahkRoKxxzyBoSNe/zsX8aCaXhdyMWZZrDzFDS9/AbNjrB0bp5MwtbQVXcZJLGzaWxUmeuOQc0CeoWgwafdEdweesiUCbj4Au3xLitDVMiCrO5qy5XKRSQa6dMNjMARw5tORnvRlOiPypDBEKSyR+BtQiLDhelepLZAgMBAAECgYBO9nleft3G1inqfIFw2DkoHLNQx2x6RpBE4xs7L4bOf7+h5HqVH3Gy+Rcwk4HzerGjjUY6oT0cQ6QlB3h4GOFcQq/fN79eOKd8KwgPq+e0l/dFXDI4TAJJ61nY40zwl/KlzdRRKF4KIrM8YmA74YhjG92p6KyxBdx8QMM7NkshIQJBAP+5AXa35n/9aoENfCGr5IDoCIqOUoaOEoNGQ+DcvEW2Z443gHZ6B4QLZcMhtvn+7YQHXXjUhAw4A23dIG83ZvsCQQDMWL5lvbETU6iXhhfbF08LHqI0g83QIYckvt1ndMcTgDKR3b+T6CUJCI2VHR3kOrJ77jcIHd65nP0QRXG+ZdU7AkEAnYml4zNL5xGBaVubW0sADIHlsSYYpRglQ4YoDwEtY20Jws1icJqgwrIa0OmWRdDNFgdLiEKzzqs7QZV2g82HvQJAZLgA8Ei09J+xYy3WqEguz35D2Lp2QPWllLj2i72FOdlgE4FGofIz/uXWUv7M8ubzfh4FxdxjIP19xf1UeNHcbQJBAN53AtJB671xNU+4WBfC/hX/L45Y+kc2zkxFXDFopdbIXzoVoC2pA9urze2B8+azWWTPfqv6i620SSflHEvls2Q=";
|
||||
|
||||
// Rsa 公钥
|
||||
public static String publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDMIBL0C+sN2oZEaCscc8gaEjXv87F/Ggml4XcjFmWaw8xQ0vfwGzY6wdG6eTMLW0FV3GSSxs2lsVJnrjkHNAnqFoMGn3RHcHnrIlAm4+ALt8S4rQ1TIgqzuasuVykUkGunTDYzAEcObTkZ70ZToj8qQwRCkskfgbUIiw4XpXqS2QIDAQAB";
|
||||
|
||||
/**
|
||||
* 私钥解密
|
||||
*
|
||||
* @param text 待解密的文本
|
||||
* @return 解密后的文本
|
||||
*/
|
||||
public static String decryptByPrivateKey(String text) throws Exception {
|
||||
return decryptByPrivateKey(privateKey, text);
|
||||
}
|
||||
|
||||
/**
|
||||
* 公钥解密
|
||||
*
|
||||
* @param publicKeyString 公钥
|
||||
* @param text 待解密的信息
|
||||
* @return 解密后的文本
|
||||
*/
|
||||
public static String decryptByPublicKey(String publicKeyString, String text) throws Exception {
|
||||
X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(Base64.decodeBase64(publicKeyString));
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
PublicKey publicKey = keyFactory.generatePublic(x509EncodedKeySpec);
|
||||
Cipher cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(Cipher.DECRYPT_MODE, publicKey);
|
||||
byte[] result = cipher.doFinal(Base64.decodeBase64(text));
|
||||
return new String(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 私钥加密
|
||||
*
|
||||
* @param privateKeyString 私钥
|
||||
* @param text 待加密的信息
|
||||
* @return 加密后的文本
|
||||
*/
|
||||
public static String encryptByPrivateKey(String privateKeyString, String text) throws Exception {
|
||||
PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKeyString));
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec);
|
||||
Cipher cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, privateKey);
|
||||
byte[] result = cipher.doFinal(text.getBytes());
|
||||
return Base64.encodeBase64String(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 私钥解密
|
||||
*
|
||||
* @param privateKeyString 私钥
|
||||
* @param text 待解密的文本
|
||||
* @return 解密后的文本
|
||||
*/
|
||||
public static String decryptByPrivateKey(String privateKeyString, String text) throws Exception {
|
||||
PKCS8EncodedKeySpec pkcs8EncodedKeySpec5 = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKeyString));
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec5);
|
||||
Cipher cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(Cipher.DECRYPT_MODE, privateKey);
|
||||
byte[] result = cipher.doFinal(Base64.decodeBase64(text));
|
||||
return new String(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 公钥加密
|
||||
*
|
||||
* @param publicKeyString 公钥
|
||||
* @param text 待加密的文本
|
||||
* @return 加密后的文本
|
||||
*/
|
||||
public static String encryptByPublicKey(String publicKeyString, String text) throws Exception {
|
||||
X509EncodedKeySpec x509EncodedKeySpec2 = new X509EncodedKeySpec(Base64.decodeBase64(publicKeyString));
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
PublicKey publicKey = keyFactory.generatePublic(x509EncodedKeySpec2);
|
||||
Cipher cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
|
||||
byte[] result = cipher.doFinal(text.getBytes());
|
||||
return Base64.encodeBase64String(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建RSA密钥对
|
||||
*
|
||||
* @return 生成后的公私钥信息
|
||||
*/
|
||||
public static RsaKeyPair generateKeyPair() throws NoSuchAlgorithmException {
|
||||
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
|
||||
keyPairGenerator.initialize(1024);
|
||||
KeyPair keyPair = keyPairGenerator.generateKeyPair();
|
||||
RSAPublicKey rsaPublicKey = (RSAPublicKey) keyPair.getPublic();
|
||||
RSAPrivateKey rsaPrivateKey = (RSAPrivateKey) keyPair.getPrivate();
|
||||
String publicKeyString = Base64.encodeBase64String(rsaPublicKey.getEncoded());
|
||||
String privateKeyString = Base64.encodeBase64String(rsaPrivateKey.getEncoded());
|
||||
return new RsaKeyPair(publicKeyString, privateKeyString);
|
||||
}
|
||||
|
||||
/**
|
||||
* RSA密钥对对象
|
||||
*/
|
||||
public static class RsaKeyPair {
|
||||
private final String publicKey;
|
||||
private final String privateKey;
|
||||
|
||||
public RsaKeyPair(String publicKey, String privateKey) {
|
||||
this.publicKey = publicKey;
|
||||
this.privateKey = privateKey;
|
||||
}
|
||||
|
||||
public String getPublicKey() {
|
||||
return publicKey;
|
||||
}
|
||||
|
||||
public String getPrivateKey() {
|
||||
return privateKey;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// try {
|
||||
// RsaKeyPair rsaKeyPair = generateKeyPair();
|
||||
// System.out.println("私钥:" + rsaKeyPair.getPrivateKey());
|
||||
// System.out.println("公钥:" + rsaKeyPair.getPublicKey());
|
||||
// } catch (NoSuchAlgorithmException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
|
||||
try {
|
||||
//String timestamp = String.valueOf(System.currentTimeMillis());
|
||||
String timestamp = "1705165273935";
|
||||
//String str = "jhcf170515993052073qrDFKJmk001" + timestamp;
|
||||
|
||||
// Map<String,Object> map = new HashMap<>();
|
||||
// map.put("serverid","123");
|
||||
// map.put("companyName","测试名称");
|
||||
// String str = JSON.toJSONString(map);
|
||||
|
||||
List<Object> list = new ArrayList<>();
|
||||
Map<String,Object> map1 = new HashMap<>();
|
||||
map1.put("serverid","1231");
|
||||
map1.put("companyName","测试名称1");
|
||||
list.add(map1);
|
||||
Map<String,Object> map2 = new HashMap<>();
|
||||
map2.put("serverid","1232");
|
||||
map2.put("companyName","测试名称2");
|
||||
list.add(map2);
|
||||
Map<String,Object> map3 = new HashMap<>();
|
||||
map3.put("serverid","1233");
|
||||
map3.put("companyName","测试名称3");
|
||||
list.add(map3);
|
||||
Map<String,Object> map4 = new HashMap<>();
|
||||
map4.put("serverid","1234");
|
||||
map4.put("companyName","测试名称4");
|
||||
list.add(map4);
|
||||
String str = JSON.toJSONString(list);
|
||||
System.out.println("明文信息:" + str);
|
||||
str = Md5Utils.hash(str)+timestamp;
|
||||
// 公钥加密->私钥解密
|
||||
String encryptByPublicKeyStr = encryptByPublicKey(publicKey, str);
|
||||
System.out.println("公钥加密:" + encryptByPublicKeyStr);
|
||||
String decryptByPrivateKeyStr = decryptByPrivateKey(privateKey, encryptByPublicKeyStr);
|
||||
System.out.println("私钥解密:" + decryptByPrivateKeyStr);
|
||||
|
||||
System.out.println("***********************************");
|
||||
|
||||
// 私钥加密->公钥解密
|
||||
String encryptByPrivateKeyStr = encryptByPrivateKey(privateKey, str);
|
||||
System.out.println("私钥加密:" + encryptByPrivateKeyStr);
|
||||
String decryptByPublicKeyStr = decryptByPublicKey(publicKey, encryptByPrivateKeyStr);
|
||||
System.out.println("公钥解密:" + decryptByPublicKeyStr);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -8,7 +8,10 @@ import java.time.LocalDateTime;
|
|||
import java.time.LocalTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
|
||||
/**
|
||||
|
@ -26,6 +29,8 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
|||
|
||||
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
|
||||
|
||||
public static String YYYY_MM_DD_HH_MM = "yyyy-MM-dd HH:mm";
|
||||
|
||||
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
private static String[] parsePatterns = {
|
||||
|
@ -188,4 +193,30 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
|||
ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
|
||||
return Date.from(zdt.toInstant());
|
||||
}
|
||||
|
||||
public static Date[] getCurrentWeekDate() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeZone(TimeZone.getTimeZone("GMT+8"));
|
||||
//start of the week
|
||||
if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
|
||||
calendar.add(Calendar.DAY_OF_YEAR, -1);
|
||||
}
|
||||
calendar.add(Calendar.DAY_OF_WEEK, -(calendar.get(Calendar.DAY_OF_WEEK) - 2));
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
//String startTime = conversion(calendar.getTimeInMillis());
|
||||
Date dtStart=calendar.getTime();
|
||||
|
||||
//end of the week
|
||||
calendar.add(Calendar.DAY_OF_WEEK, 6);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 23);
|
||||
calendar.set(Calendar.MINUTE, 59);
|
||||
calendar.set(Calendar.SECOND, 59);
|
||||
calendar.set(Calendar.MILLISECOND, 999);
|
||||
//String endTime = conversion(calendar.getTimeInMillis());
|
||||
Date dtEnd=calendar.getTime();
|
||||
return new Date[]{dtStart,dtEnd};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,242 @@
|
|||
package com.ruoyi.common.utils;
|
||||
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||
|
||||
public class ExcelUtils {
|
||||
|
||||
/**
|
||||
* 创建标题样式
|
||||
* @param wb
|
||||
* @return
|
||||
*/
|
||||
public static CellStyle createTitleCellStyle(SXSSFWorkbook wb) {
|
||||
CellStyle cellStyle = wb.createCellStyle();
|
||||
cellStyle.setAlignment(HorizontalAlignment.CENTER);//水平居中
|
||||
cellStyle.setVerticalAlignment(VerticalAlignment.BOTTOM);//居于底部
|
||||
//cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||
// cellStyle.setFillForegroundColor(IndexedColors.GREY_40_PERCENT.getIndex());//背景颜色
|
||||
|
||||
Font headerFont1 = wb.createFont(); // 创建字体样式
|
||||
headerFont1.setBold(true); //字体加粗
|
||||
headerFont1.setFontName("宋体"); // 设置字体类型
|
||||
headerFont1.setFontHeightInPoints((short) 15); // 设置字体大小
|
||||
cellStyle.setFont(headerFont1); // 为标题样式设置字体样式
|
||||
|
||||
return cellStyle;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建表头样式
|
||||
* @param wb
|
||||
* @return
|
||||
*/
|
||||
public static CellStyle createHeadCellStyle(SXSSFWorkbook wb) {
|
||||
CellStyle cellStyle = wb.createCellStyle();
|
||||
cellStyle.setWrapText(true);// 设置自动换行
|
||||
// cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景颜色
|
||||
cellStyle.setAlignment(HorizontalAlignment.CENTER); //水平居中
|
||||
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); //垂直对齐
|
||||
//cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||
// cellStyle.setBottomBorderColor(IndexedColors.BLACK.index);
|
||||
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
|
||||
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
|
||||
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
|
||||
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
|
||||
|
||||
Font headerFont = wb.createFont(); // 创建字体样式
|
||||
// headerFont.setBold(true); //字体加粗
|
||||
headerFont.setFontName("宋体"); // 设置字体类型
|
||||
headerFont.setFontHeightInPoints((short) 10); // 设置字体大小
|
||||
cellStyle.setFont(headerFont); // 为标题样式设置字体样式
|
||||
|
||||
return cellStyle;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建内容样式
|
||||
* @param wb
|
||||
* @return
|
||||
*/
|
||||
public static CellStyle createContentCellStyle(SXSSFWorkbook wb) {
|
||||
CellStyle cellStyle = wb.createCellStyle();
|
||||
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
|
||||
cellStyle.setAlignment(HorizontalAlignment.CENTER);// 水平居中
|
||||
cellStyle.setWrapText(true);// 设置自动换行
|
||||
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
|
||||
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
|
||||
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
|
||||
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
|
||||
|
||||
// 生成12号字体
|
||||
Font font = wb.createFont();
|
||||
font.setColor((short)8);
|
||||
font.setFontHeightInPoints((short) 10);
|
||||
cellStyle.setFont(font);
|
||||
return cellStyle;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建内容居右样式
|
||||
* @param wb
|
||||
* @return
|
||||
*/
|
||||
public static CellStyle createContentRightCellStyle(SXSSFWorkbook wb) {
|
||||
CellStyle cellStyle = wb.createCellStyle();
|
||||
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
|
||||
cellStyle.setAlignment(HorizontalAlignment.RIGHT);// 水平居中
|
||||
cellStyle.setWrapText(true);// 设置自动换行
|
||||
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
|
||||
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
|
||||
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
|
||||
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
|
||||
|
||||
// 生成12号字体
|
||||
Font font = wb.createFont();
|
||||
font.setColor((short)8);
|
||||
font.setFontHeightInPoints((short) 10);
|
||||
cellStyle.setFont(font);
|
||||
return cellStyle;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建粗体居左内容样式
|
||||
* @param wb
|
||||
* @return
|
||||
*/
|
||||
public static CellStyle createContentWeightCellStyle(SXSSFWorkbook wb) {
|
||||
CellStyle cellStyle = wb.createCellStyle();
|
||||
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
|
||||
cellStyle.setAlignment(HorizontalAlignment.LEFT);// 水平居中
|
||||
cellStyle.setWrapText(true);// 设置自动换行
|
||||
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
|
||||
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
|
||||
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
|
||||
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
|
||||
|
||||
// 生成12号字体
|
||||
Font font = wb.createFont();
|
||||
font.setColor((short)8);
|
||||
font.setBold(true); //字体加粗
|
||||
font.setFontHeightInPoints((short) 10);
|
||||
cellStyle.setFont(font);
|
||||
return cellStyle;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建粗体居右内容样式
|
||||
* @param wb
|
||||
* @return
|
||||
*/
|
||||
public static CellStyle createContentWeightRightCellStyle(SXSSFWorkbook wb) {
|
||||
CellStyle cellStyle = wb.createCellStyle();
|
||||
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
|
||||
cellStyle.setAlignment(HorizontalAlignment.RIGHT);// 水平居中
|
||||
cellStyle.setWrapText(true);// 设置自动换行
|
||||
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
|
||||
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
|
||||
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
|
||||
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
|
||||
cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景颜色
|
||||
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||
|
||||
// 生成12号字体
|
||||
Font font = wb.createFont();
|
||||
font.setColor((short)8);
|
||||
font.setBold(true); //字体加粗
|
||||
font.setFontHeightInPoints((short) 10);
|
||||
cellStyle.setFont(font);
|
||||
return cellStyle;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建粗体居中带背景颜色内容样式
|
||||
* @param wb
|
||||
* @return
|
||||
*/
|
||||
public static CellStyle createContentWeightCenterCellStyle(SXSSFWorkbook wb) {
|
||||
CellStyle cellStyle = wb.createCellStyle();
|
||||
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
|
||||
cellStyle.setAlignment(HorizontalAlignment.CENTER);// 水平居中
|
||||
cellStyle.setWrapText(true);// 设置自动换行
|
||||
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
|
||||
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
|
||||
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
|
||||
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
|
||||
cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景颜色
|
||||
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||
|
||||
// 生成12号字体
|
||||
Font font = wb.createFont();
|
||||
font.setColor((short)8);
|
||||
font.setBold(true); //字体加粗
|
||||
font.setFontHeightInPoints((short) 10);
|
||||
cellStyle.setFont(font);
|
||||
return cellStyle;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建粗体无边框居左内容样式
|
||||
* @param wb
|
||||
* @return
|
||||
*/
|
||||
public static CellStyle createContentNoBorderCellStyle(SXSSFWorkbook wb) {
|
||||
CellStyle cellStyle = wb.createCellStyle();
|
||||
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
|
||||
cellStyle.setAlignment(HorizontalAlignment.LEFT);// 水平居中
|
||||
cellStyle.setWrapText(true);// 设置自动换行
|
||||
|
||||
// 生成12号字体
|
||||
Font font = wb.createFont();
|
||||
font.setColor((short)8);
|
||||
font.setFontHeightInPoints((short) 10);
|
||||
cellStyle.setFont(font);
|
||||
return cellStyle;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建内容样式
|
||||
* @param wb
|
||||
* @return
|
||||
*/
|
||||
public static CellStyle myCreateContentCellStyle(SXSSFWorkbook wb) {
|
||||
CellStyle cellStyle = wb.createCellStyle();
|
||||
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
|
||||
cellStyle.setAlignment(HorizontalAlignment.CENTER);// 水平居中
|
||||
cellStyle.setWrapText(true);// 设置自动换行
|
||||
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
|
||||
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
|
||||
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
|
||||
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
|
||||
cellStyle.setFillBackgroundColor(IndexedColors.YELLOW.getIndex());
|
||||
cellStyle.setFillForegroundColor(IndexedColors.YELLOW.getIndex());//背景颜色
|
||||
|
||||
// 生成12号字体
|
||||
Font font = wb.createFont();
|
||||
font.setColor((short)8);
|
||||
font.setFontHeightInPoints((short) 10);
|
||||
cellStyle.setFont(font);
|
||||
return cellStyle;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建标题样式
|
||||
* @param wb
|
||||
* @return
|
||||
*/
|
||||
public static CellStyle myCreateTitleCellStyle(SXSSFWorkbook wb) {
|
||||
CellStyle cellStyle = wb.createCellStyle();
|
||||
cellStyle.setAlignment(HorizontalAlignment.CENTER);//水平居中
|
||||
cellStyle.setVerticalAlignment(VerticalAlignment.BOTTOM);//居于底部
|
||||
cellStyle.setFillForegroundColor(IndexedColors.YELLOW.getIndex());//背景颜色
|
||||
cellStyle.setFillBackgroundColor(IndexedColors.YELLOW.getIndex());
|
||||
|
||||
Font headerFont1 = wb.createFont(); // 创建字体样式
|
||||
headerFont1.setBold(true); //字体加粗
|
||||
headerFont1.setFontName("宋体"); // 设置字体类型
|
||||
headerFont1.setFontHeightInPoints((short) 15); // 设置字体大小
|
||||
cellStyle.setFont(headerFont1); // 为标题样式设置字体样式
|
||||
|
||||
return cellStyle;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.ruoyi.common.utils;
|
||||
|
||||
/**
|
||||
* 编号工具类
|
||||
*
|
||||
* @author JiangYuQi
|
||||
* @date 2023-11-07
|
||||
*/
|
||||
public class NoUtils {
|
||||
|
||||
private static final String PREFIX = "jhcf";
|
||||
private static int COUNTER = 0;
|
||||
|
||||
/**
|
||||
* 生成appId
|
||||
*
|
||||
* @author JiangYuQi
|
||||
* @date 2023-11-07
|
||||
*/
|
||||
public static String createAppId() {
|
||||
long timestamp = System.currentTimeMillis();
|
||||
String sequencePart = String.format("%03d", getContractNextSequence());
|
||||
return PREFIX + timestamp+ StringUtils.randomString(10) + sequencePart;
|
||||
}
|
||||
|
||||
private static synchronized int getContractNextSequence() {
|
||||
if (COUNTER >= 999) {
|
||||
COUNTER = 0;
|
||||
}
|
||||
return ++COUNTER;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,12 +1,16 @@
|
|||
package com.ruoyi.common.utils;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContext;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 安全服务工具类
|
||||
*
|
||||
|
@ -21,7 +25,7 @@ public class SecurityUtils
|
|||
{
|
||||
try
|
||||
{
|
||||
return getLoginUser().getUserId();
|
||||
return getLoginUser().getUserId();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -29,6 +33,24 @@ public class SecurityUtils
|
|||
}
|
||||
}
|
||||
|
||||
public static long getRoleId(){
|
||||
try
|
||||
{
|
||||
List<SysRole> list= getLoginUser().getUser().getRoles();
|
||||
long roleId= list.get(0).getRoleId();
|
||||
for(SysRole role :list){
|
||||
if(role.getRoleId()<roleId){
|
||||
roleId=role.getRoleId();
|
||||
}
|
||||
}
|
||||
return roleId;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门ID
|
||||
**/
|
||||
|
@ -51,7 +73,8 @@ public class SecurityUtils
|
|||
{
|
||||
try
|
||||
{
|
||||
return getLoginUser().getUsername();
|
||||
LoginUser loginUser=getLoginUser();
|
||||
return loginUser!=null?loginUser.getUsername():null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -66,7 +89,11 @@ public class SecurityUtils
|
|||
{
|
||||
try
|
||||
{
|
||||
return (LoginUser) getAuthentication().getPrincipal();
|
||||
Authentication auth=getAuthentication();
|
||||
if(auth!=null) {
|
||||
return (LoginUser) auth.getPrincipal();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -79,7 +106,8 @@ public class SecurityUtils
|
|||
*/
|
||||
public static Authentication getAuthentication()
|
||||
{
|
||||
return SecurityContextHolder.getContext().getAuthentication();
|
||||
SecurityContext ctx=SecurityContextHolder.getContext();
|
||||
return ctx!=null? SecurityContextHolder.getContext().getAuthentication():null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -117,4 +145,17 @@ public class SecurityUtils
|
|||
{
|
||||
return userId != null && 1L == userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户权限最大的角色
|
||||
* @return role
|
||||
*/
|
||||
public Long getUserFirstRole(){
|
||||
return getLoginUser().getUser().getRoles().stream().mapToLong(r->r.getRoleId()).min().getAsLong();
|
||||
}
|
||||
|
||||
public static boolean isUserB() {
|
||||
long roleId=getRoleId();
|
||||
return 5==roleId || 6==roleId || 7==roleId || 99==roleId || 15==roleId || 16==roleId || 17==roleId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
package com.ruoyi.common.utils;
|
||||
|
||||
import com.ruoyi.common.config.SmsConfig;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
/**
|
||||
* ////////////////////////////////////////////////////////////////////
|
||||
* // _ooOoo_
|
||||
* // o8888888o
|
||||
* // 88" . "88
|
||||
* // (| ^_^ |)
|
||||
* // O\ = /O
|
||||
* // ____/`---'\____
|
||||
* // .' \\| |// `.
|
||||
* // / \\||| : |||// \
|
||||
* // / _||||| -:- |||||- \
|
||||
* // | | \\\ - /// | |
|
||||
* // | \_| ''\---/'' | |
|
||||
* // \ .-\__ `-` ___/-. /
|
||||
* // ___`. .' /--.--\ `. . ___
|
||||
* // ."" '< `.___\_<|>_/___.' >'"".
|
||||
* // | | : `- \`.;`\ _ /`;.`/ - ` : | |
|
||||
* // \ \ `-. \_ __\ /__ _/ .-` / /
|
||||
* // ========`-.____`-.___\_____/___.-`____.-'========
|
||||
* // `=---='
|
||||
* // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
* // 佛祖保佑 永无BUG 永不修改
|
||||
* ////////////////////////////////////////////////////////////////////
|
||||
*
|
||||
* @ClassName SMSUtils
|
||||
* @Description 短信发送工具类
|
||||
* @Author QiangZi
|
||||
* @DateTime 2022/3/10 17:51
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Component
|
||||
public class SmsUtils {
|
||||
|
||||
private static SmsConfig smsConfig;
|
||||
|
||||
/**
|
||||
* @param phoneNumber 手机号码
|
||||
* @param message 消息内容
|
||||
* @return boolean
|
||||
* @throws
|
||||
* @Author QiangZi
|
||||
* @Description 发送短信消息
|
||||
* @Date 2022/3/10 17:53
|
||||
**/
|
||||
public static boolean sendMsg(String phoneNumber, String message) {
|
||||
|
||||
boolean result = false;
|
||||
try {
|
||||
StringBuffer sb = new StringBuffer(smsConfig.getUrl());
|
||||
sb.append("?username=").append(smsConfig.getUsername());
|
||||
sb.append("&password=").append(smsConfig.getPassword());
|
||||
sb.append("&productid=").append(smsConfig.getProductid());
|
||||
sb.append("&mobile=" + phoneNumber);
|
||||
//sb.append("&dstime="+URLEncoder.encode("2015-01-01 14:41:00", "utf-8"));
|
||||
sb.append("&content=" + URLEncoder.encode(message, "utf-8"));
|
||||
URL url = new URL(sb.toString());
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setRequestMethod("POST");//or set POST
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
|
||||
String inputline = in.readLine();
|
||||
System.out.println("SEND_MSG_XSMS===" + inputline);
|
||||
String code = inputline.split(",")[0];
|
||||
result = code.equals("1");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setSmsConfig(SmsConfig smsConfig) {
|
||||
SmsUtils.smsConfig = smsConfig;
|
||||
}
|
||||
}
|
|
@ -1,11 +1,7 @@
|
|||
package com.ruoyi.common.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.text.StrFormatter;
|
||||
|
@ -144,6 +140,17 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|||
return !isNull(object);
|
||||
}
|
||||
|
||||
/**
|
||||
* * 判断一个对象是否非空
|
||||
*
|
||||
* @param object Object
|
||||
* @return true:非空 false:空
|
||||
*/
|
||||
public static boolean isNotEmpty(Object object)
|
||||
{
|
||||
return !isNull(object) && !"".equals(object);
|
||||
}
|
||||
|
||||
/**
|
||||
* * 判断一个对象是否是数组类型(Java基本型别的数组)
|
||||
*
|
||||
|
@ -163,6 +170,28 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|||
return (str == null ? "" : str.trim());
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数忽略类型比较
|
||||
*
|
||||
* @param obj1 对象1
|
||||
* @param obj2 对象2
|
||||
* @return value 返回值
|
||||
*/
|
||||
public static boolean eqObj(Object obj1, Object obj2)
|
||||
{
|
||||
if(obj1==null && obj2==null){
|
||||
return true;
|
||||
}else{
|
||||
if(obj1==null){
|
||||
return false;
|
||||
}
|
||||
if(obj2==null){
|
||||
return false;
|
||||
}
|
||||
return obj1.toString().equals(obj2.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 截取字符串
|
||||
*
|
||||
|
@ -611,4 +640,27 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static final String CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
|
||||
|
||||
/**
|
||||
* 获取随机字符串
|
||||
*
|
||||
* @param length 长度
|
||||
* @return 返回指定长度的随机字符串。
|
||||
*/
|
||||
public static String randomString(int length) {
|
||||
if (length < 1) {
|
||||
length = 1;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Random random = new Random();
|
||||
for (int i = 0; i < length; i++) {
|
||||
int randomIndex = random.nextInt(CHARACTERS.length());
|
||||
char randomChar = CHARACTERS.charAt(randomIndex);
|
||||
sb.append(randomChar);
|
||||
}
|
||||
String randomString = sb.toString();
|
||||
return randomString;
|
||||
}
|
||||
}
|
|
@ -1,9 +1,16 @@
|
|||
package com.ruoyi.common.utils.file;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import cn.hutool.core.img.ImgUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
|
@ -25,12 +32,17 @@ public class FileUploadUtils
|
|||
/**
|
||||
* 默认大小 50M
|
||||
*/
|
||||
public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024;
|
||||
public static final long DEFAULT_MAX_SIZE = 200 * 1024 * 1024;
|
||||
|
||||
/**
|
||||
* 默认大小 1M
|
||||
*/
|
||||
public static final long API_PROFILE_MAX_SIZE = 1 * 1024 * 1024;
|
||||
|
||||
/**
|
||||
* 默认的文件名最大长度 100
|
||||
*/
|
||||
public static final int DEFAULT_FILE_NAME_LENGTH = 100;
|
||||
public static final int DEFAULT_FILE_NAME_LENGTH = 200;
|
||||
|
||||
/**
|
||||
* 默认上传的地址
|
||||
|
@ -86,6 +98,30 @@ public class FileUploadUtils
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据文件路径上传
|
||||
*
|
||||
* @param baseDir 相对应用的基目录
|
||||
* @param file 上传的文件[图片]
|
||||
* @return 文件名称
|
||||
* @throws IOException
|
||||
*/
|
||||
public static final String uploadImages(String baseDir, MultipartFile file) throws IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
if (file.getSize() > API_PROFILE_MAX_SIZE)
|
||||
{
|
||||
throw new FileSizeLimitExceededException(1);
|
||||
}
|
||||
return upload(baseDir, file, MimeTypeUtils.IMAGE_EXTENSION);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new IOException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
*
|
||||
|
@ -114,16 +150,69 @@ public class FileUploadUtils
|
|||
|
||||
String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath();
|
||||
file.transferTo(Paths.get(absPath));
|
||||
makeMiniImage(absPath);
|
||||
return getPathFileName(baseDir, fileName);
|
||||
}
|
||||
|
||||
private static void makeMiniImage(String absPath) {
|
||||
try {
|
||||
String ext = FileUtils.getFileExt(absPath).toLowerCase();
|
||||
String exts = Arrays.toString(new String[]{"jpg", "jpeg", "png", "bmp"});
|
||||
if (exts.contains(ext)) {
|
||||
if (new File(absPath).exists()) {
|
||||
int w = ImgUtil.read(FileUtil.file(absPath)).getWidth();
|
||||
if(w>2000) {
|
||||
ImgUtil.scale(FileUtil.file(absPath),
|
||||
FileUtil.file(absPath), (float) (2000.0 / w));
|
||||
}
|
||||
ImgUtil.scale(FileUtil.file(absPath),
|
||||
FileUtil.file(absPath + ".1000.jpg"), (float) (1000.0 / w));
|
||||
ImgUtil.scale(FileUtil.file(absPath),
|
||||
FileUtil.file(absPath + ".min.jpg"), (float) (300.0 / w));
|
||||
}
|
||||
}
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void minPath(String path){
|
||||
List<File> list= FileUtil.loopFiles(path);
|
||||
for(File f :list){
|
||||
String p=f.getAbsolutePath().toLowerCase();
|
||||
if(p.endsWith(".min.jpg")||p.endsWith(".1000.jpg")){
|
||||
continue;
|
||||
}
|
||||
System.out.println(f.getAbsolutePath());
|
||||
makeMiniImage(f.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编码文件名
|
||||
*/
|
||||
public static final String extractFilename(MultipartFile file)
|
||||
{
|
||||
return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(),
|
||||
FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), getExtension(file));
|
||||
FilenameUtils.getBaseName(getYzFilename(file.getOriginalFilename())), Seq.getId(Seq.uploadSeqType), getExtension(file));
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤文件名中的特殊符号问题
|
||||
* @param fileName
|
||||
* @return
|
||||
*/
|
||||
public static final String getYzFilename(String fileName){
|
||||
// 定义正则表达式,匹配除了字母和数字以外的任何字符
|
||||
String regex = "[#%\\[\\]&',;=?$()]";
|
||||
// 使用指定的替换字符替换非法字符
|
||||
String replacedString = fileName.replaceAll(regex,"").replaceAll("__","");
|
||||
return replacedString;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String s = " 3#、6#楼塔吊单位及人员资质报审____________________[asd]20240621095052A847.pdf";
|
||||
System.out.println(getYzFilename(s));
|
||||
}
|
||||
|
||||
public static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException
|
||||
|
|
|
@ -104,6 +104,27 @@ public class FileUtils
|
|||
return FileUploadUtils.getPathFileName(uploadDir, pathName);
|
||||
}
|
||||
|
||||
public static String writeBytes(byte[] data, String uploadDir,String fileName) throws IOException
|
||||
{
|
||||
FileOutputStream fos = null;
|
||||
String pathName = "";
|
||||
try
|
||||
{
|
||||
String extension = getFileExtendName(data);
|
||||
pathName = DateUtils.datePath() + "/" + fileName;
|
||||
File file = FileUploadUtils.getAbsoluteFile(uploadDir, pathName);
|
||||
if(file.exists()){
|
||||
file.delete();
|
||||
}
|
||||
fos = new FileOutputStream(file);
|
||||
fos.write(data);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.close(fos);
|
||||
}
|
||||
return FileUploadUtils.getPathFileName(uploadDir, pathName);
|
||||
}
|
||||
/**
|
||||
* 删除文件
|
||||
*
|
||||
|
|
|
@ -17,7 +17,7 @@ public class MimeTypeUtils
|
|||
|
||||
public static final String IMAGE_GIF = "image/gif";
|
||||
|
||||
public static final String[] IMAGE_EXTENSION = { "bmp", "gif", "jpg", "jpeg", "png" };
|
||||
public static final String[] IMAGE_EXTENSION = { "jpg", "jpeg", "png" };
|
||||
|
||||
public static final String[] FLASH_EXTENSION = { "swf", "flv" };
|
||||
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package com.ruoyi.common.utils.file;
|
||||
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Base64;
|
||||
|
||||
/**
|
||||
* JiangYuQi
|
||||
*/
|
||||
public class MultipartFileUtils {
|
||||
|
||||
/**
|
||||
* 换为Base64为文件
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public static MultipartFile base64ToMultipartFile(String base64) throws IOException {
|
||||
String[] parts = base64.split(",");
|
||||
if(parts.length>1){
|
||||
String contentType = parts[0].split(";")[0].split(":")[1];
|
||||
byte[] bytes = Base64.getDecoder().decode(parts[1]);
|
||||
return new MockMultipartFile("file","file."+contentType.split("/")[1], contentType, bytes);
|
||||
}else{
|
||||
//默认格式为jpeg
|
||||
String contentType = "image/jpeg";
|
||||
byte[] bytes = Base64.getDecoder().decode(base64);
|
||||
return new MockMultipartFile("file", "file"+contentType.split("/")[1], contentType, bytes);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,522 @@
|
|||
package com.ruoyi.common.utils.http;
|
||||
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.Consts;
|
||||
import org.apache.http.Header;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpDelete;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.apache.http.protocol.HTTP;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* HttpClient工具类
|
||||
*
|
||||
* @author: xingxixingzhe
|
||||
* @date: 2023/9/25 14:18
|
||||
*/
|
||||
@Slf4j
|
||||
public class HttpClientUtil {
|
||||
|
||||
public static final String HTTP_CHARSET = "utf-8";
|
||||
private static final String CONTENTTYPE = "Content-Type";
|
||||
|
||||
/**
|
||||
* get请求
|
||||
*
|
||||
* @param url 请求地址
|
||||
* @param headers 请求头,可以为null
|
||||
* @return String
|
||||
*/
|
||||
public static String doGet(String url, Map<String, String> headers) {
|
||||
// 创建HttpClient对象
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
// 创建HttpResponse对象
|
||||
CloseableHttpResponse response = null;
|
||||
log.info("request param info : {}", url);
|
||||
log.info("request header info : {}", headers);
|
||||
try {
|
||||
try {
|
||||
// 创建HttpPost对象
|
||||
HttpGet get = new HttpGet(url);
|
||||
// 封装请求头
|
||||
if (null != headers) {
|
||||
headers.keySet().forEach(key -> {
|
||||
get.addHeader(key, headers.get(key));
|
||||
});
|
||||
}
|
||||
response = httpClient.execute(get);
|
||||
String result = EntityUtils.toString(response.getEntity(), Charset.forName(HTTP_CHARSET));
|
||||
log.info("response info : {}", result);
|
||||
return result;
|
||||
} catch (IOException e) {
|
||||
log.error("get链接失败:" + e.getMessage());
|
||||
} finally {
|
||||
// 释放连接
|
||||
if (response != null) {
|
||||
response.close();
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("get关闭response失败:" + e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* get请求
|
||||
*
|
||||
* @param url 请求地址
|
||||
* @param headers 请求头,可以为null
|
||||
* @param paramMap 请求参数
|
||||
* @return String
|
||||
*/
|
||||
public static String doGetQueryParams(String url, Map<String, String> headers, Map<String, Object> paramMap) {
|
||||
// 创建HttpClient对象
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
// 创建HttpResponse对象
|
||||
CloseableHttpResponse response = null;
|
||||
StringBuilder urlTemp = new StringBuilder(url);
|
||||
if (null != paramMap && paramMap.size() > 0) {
|
||||
int index = 0;
|
||||
for (Map.Entry<String, Object> entry : paramMap.entrySet()) {
|
||||
if (index == 0) {
|
||||
urlTemp.append("?").append(entry.getKey()).append("=").append(entry.getValue());
|
||||
} else {
|
||||
urlTemp.append("&").append(entry.getKey()).append("=").append(entry.getValue());
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
url = urlTemp.toString();
|
||||
log.info("request param info : {}", url);
|
||||
log.info("request header info : {}", headers);
|
||||
try {
|
||||
try {
|
||||
// 创建HttpPost对象
|
||||
HttpGet get = new HttpGet(url);
|
||||
// 封装请求头
|
||||
if (null != headers) {
|
||||
headers.keySet().forEach(key -> {
|
||||
get.addHeader(key, headers.get(key));
|
||||
});
|
||||
}
|
||||
response = httpClient.execute(get);
|
||||
String result = EntityUtils.toString(response.getEntity(), Charset.forName(HTTP_CHARSET));
|
||||
log.info("response info : {}", result);
|
||||
return result;
|
||||
} catch (IOException e) {
|
||||
log.error("get链接失败:" + e.getMessage());
|
||||
} finally {
|
||||
// 释放连接
|
||||
if (response != null) {
|
||||
response.close();
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("get关闭response失败:" + e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* get请求 下载文件保存在本地
|
||||
*
|
||||
* @param url 请求地址
|
||||
* @param headers 请求头,可以为null
|
||||
* @param downloadPath 下载地址
|
||||
* @return String
|
||||
*/
|
||||
public static String doGetDownloadSaveLocal(String url, Map<String, String> headers, String downloadPath) {
|
||||
// 创建HttpClient对象
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
// 创建HttpResponse对象
|
||||
CloseableHttpResponse response = null;
|
||||
log.info("request param info : {}", url);
|
||||
log.info("request header info : {}", headers);
|
||||
try {
|
||||
try {
|
||||
// 创建HttpPost对象
|
||||
HttpGet get = new HttpGet(url);
|
||||
// 封装请求头
|
||||
if (null != headers) {
|
||||
headers.keySet().forEach(key -> {
|
||||
get.addHeader(key, headers.get(key));
|
||||
});
|
||||
}
|
||||
response = httpClient.execute(get);
|
||||
// 获取下载文件流
|
||||
InputStream inputStream = response.getEntity().getContent();
|
||||
// 获取下载文件的文件名,此处的 File-Name 头信息,需要在服务端进行自定义
|
||||
Header header = response.getFirstHeader("Content-Disposition");
|
||||
String fileName = header.getValue();
|
||||
fileName = StringUtils.substringAfter(fileName, "=");
|
||||
fileName = System.currentTimeMillis() + fileName;
|
||||
log.info("下载的文件名称:" + fileName);
|
||||
File file = new File(downloadPath + fileName);
|
||||
file.getParentFile().mkdirs();
|
||||
FileOutputStream fileOut = new FileOutputStream(file);
|
||||
byte[] buffer = new byte[2048];
|
||||
int ch = 0;
|
||||
while ((ch = inputStream.read(buffer)) != -1) {
|
||||
fileOut.write(buffer, 0, ch);
|
||||
}
|
||||
inputStream.close();
|
||||
fileOut.flush();
|
||||
fileOut.close();
|
||||
return file.getPath();
|
||||
} catch (IOException e) {
|
||||
log.error("get链接失败:" + e.getMessage());
|
||||
} finally {
|
||||
// 释放连接
|
||||
if (response != null) {
|
||||
response.close();
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("get关闭response失败:" + e.getMessage());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* get请求 带时间配置请求
|
||||
*
|
||||
* @param url 请求地址
|
||||
* @param headers 请求头,可以为null
|
||||
* @param connectTimeout 连接超时时间
|
||||
* @param connectionRequestTimeout 建立连接超时时间,
|
||||
* @param socketTimeout 读取数据超时时间
|
||||
* @return String
|
||||
*/
|
||||
public static String doGet(String url, Map<String, String> headers,
|
||||
int connectTimeout, int connectionRequestTimeout, int socketTimeout) {
|
||||
// 创建HttpClient对象
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
// 创建HttpResponse对象
|
||||
CloseableHttpResponse response = null;
|
||||
log.info("request param info : {}", url);
|
||||
log.info("request header info : {}", headers);
|
||||
try {
|
||||
try {
|
||||
// 创建HttpPost对象
|
||||
HttpGet get = new HttpGet(url);
|
||||
get.setConfig(RequestConfig.custom()
|
||||
.setConnectTimeout(connectTimeout)
|
||||
.setConnectionRequestTimeout(connectionRequestTimeout)
|
||||
.setSocketTimeout(socketTimeout).build());
|
||||
// 封装请求头
|
||||
if (null != headers) {
|
||||
headers.keySet().forEach(key -> {
|
||||
get.addHeader(key, headers.get(key));
|
||||
});
|
||||
}
|
||||
response = httpClient.execute(get);
|
||||
String result = EntityUtils.toString(response.getEntity(), Charset.forName(HTTP_CHARSET));
|
||||
log.info("response info : {}", result);
|
||||
return result;
|
||||
} catch (IOException e) {
|
||||
log.error("get链接失败:" + e.getMessage());
|
||||
} finally {
|
||||
// 释放连接
|
||||
if (response != null) {
|
||||
response.close();
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("get关闭response失败:" + e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* post请求 body为json 带时间配置请求
|
||||
*
|
||||
* @param url 请求地址
|
||||
* @param headers 请求头,可以为null
|
||||
* @param body json请求体
|
||||
* @param connectTimeout 连接超时时间
|
||||
* @param connectionRequestTimeout 建立连接超时时间,
|
||||
* @param socketTimeout 读取数据超时时间
|
||||
* @return String
|
||||
* @author: lll
|
||||
* @date: 2022年11月21日 14:11:49
|
||||
*/
|
||||
public static String doPost(String url, Map<String, String> headers, String body,
|
||||
int connectTimeout, int connectionRequestTimeout, int socketTimeout) {
|
||||
// 创建HttpClient对象
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
// 创建HttpResponse对象
|
||||
CloseableHttpResponse response = null;
|
||||
log.info("request param info : {}", body);
|
||||
log.info("request header info : {}", headers);
|
||||
try {
|
||||
try {
|
||||
// 创建HttpPost对象
|
||||
HttpPost post = new HttpPost(url);
|
||||
post.setConfig(RequestConfig.custom()
|
||||
.setConnectTimeout(connectTimeout)
|
||||
.setConnectionRequestTimeout(connectionRequestTimeout)
|
||||
.setSocketTimeout(socketTimeout)
|
||||
.build());
|
||||
// 封装请求头
|
||||
if (null != headers) {
|
||||
headers.keySet().forEach(key -> {
|
||||
post.addHeader(key, headers.get(key));
|
||||
});
|
||||
}
|
||||
post.addHeader(HTTP.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
|
||||
// 封装请求体
|
||||
if (StringUtils.isNotBlank(body)) {
|
||||
// 请求体主要封装在HttpEntity中
|
||||
post.setEntity(new StringEntity(body, Charset.forName(HTTP_CHARSET)));
|
||||
}
|
||||
|
||||
response = httpClient.execute(post);
|
||||
// 处理响应
|
||||
String result = EntityUtils.toString(response.getEntity(), Charset.forName(HTTP_CHARSET));
|
||||
log.info("response info : {}", result);
|
||||
return result;
|
||||
} catch (IOException e) {
|
||||
log.error("post链接失败:" + e.getMessage());
|
||||
} finally {
|
||||
// 释放连接
|
||||
if (response != null) {
|
||||
response.close();
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("post关闭response失败:" + e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* post请求 body为json
|
||||
*
|
||||
* @param url 请求地址
|
||||
* @param headers 请求头,可以为null
|
||||
* @param body json请求体
|
||||
* @return String
|
||||
*/
|
||||
public static String doPost(String url, Map<String, String> headers, String body) {
|
||||
// 创建HttpClient对象
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
// 创建HttpResponse对象
|
||||
CloseableHttpResponse response = null;
|
||||
log.info("request header url : {}", url);
|
||||
log.info("request param body : {}", body);
|
||||
log.info("request header headers : {}", headers);
|
||||
try {
|
||||
try {
|
||||
// 创建HttpPost对象
|
||||
HttpPost post = new HttpPost(url);
|
||||
// 封装请求头
|
||||
if (null != headers) {
|
||||
headers.keySet().forEach(key -> {
|
||||
post.addHeader(key, headers.get(key));
|
||||
});
|
||||
}
|
||||
post.addHeader(HTTP.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
|
||||
// 封装请求体
|
||||
if (StringUtils.isNotBlank(body)) {
|
||||
// 请求体主要封装在HttpEntity中
|
||||
post.setEntity(new StringEntity(body, Charset.forName(HTTP_CHARSET)));
|
||||
}
|
||||
|
||||
response = httpClient.execute(post);
|
||||
// 处理响应
|
||||
String result = EntityUtils.toString(response.getEntity(), Charset.forName(HTTP_CHARSET));
|
||||
log.info("response result : {}", result);
|
||||
return result;
|
||||
} catch (IOException e) {
|
||||
log.error("post链接失败:" + e.getMessage());
|
||||
} finally {
|
||||
// 释放连接
|
||||
if (response != null) {
|
||||
response.close();
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("post关闭response失败:" + e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* post请求 body为form
|
||||
* <p>
|
||||
* post请求 body为json 带时间配置请求
|
||||
*
|
||||
* @param url 请求地址
|
||||
* @param headers 请求头,可以为null
|
||||
* @param body form请求体
|
||||
* @return String
|
||||
*/
|
||||
public static String doPost(String url, Map<String, String> headers, Map<String, Object> body,
|
||||
int connectTimeout, int connectionRequestTimeout, int socketTimeout) {
|
||||
// 创建HttpClient对象
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
// 创建HttpResponse对象
|
||||
CloseableHttpResponse response = null;
|
||||
log.info("request param info : {}", body);
|
||||
log.info("request header info : {}", headers);
|
||||
try {
|
||||
try {
|
||||
// 创建HttpPost对象
|
||||
HttpPost post = new HttpPost(url);
|
||||
post.setConfig(RequestConfig.custom().setConnectTimeout(connectTimeout).setConnectionRequestTimeout(connectionRequestTimeout).setSocketTimeout(socketTimeout).build());
|
||||
// 封装请求头
|
||||
if (null != headers) {
|
||||
headers.keySet().forEach(key -> {
|
||||
post.addHeader(key, headers.get(key));
|
||||
});
|
||||
}
|
||||
// 封装请求体
|
||||
List<NameValuePair> nvpList = new ArrayList<>();
|
||||
for (String name : body.keySet()) {
|
||||
String value = String.valueOf(body.get(name));
|
||||
nvpList.add(new BasicNameValuePair(name, value));
|
||||
}
|
||||
post.setEntity(new UrlEncodedFormEntity(nvpList));
|
||||
|
||||
response = httpClient.execute(post);
|
||||
// 处理响应
|
||||
String result = EntityUtils.toString(response.getEntity(), Charset.forName(HTTP_CHARSET));
|
||||
log.info("response info : {}", result);
|
||||
return result;
|
||||
} catch (IOException e) {
|
||||
log.error("post链接失败:" + e.getMessage());
|
||||
} finally {
|
||||
// 释放连接
|
||||
if (response != null) {
|
||||
response.close();
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("post关闭response失败:" + e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* post请求 body为form
|
||||
* <p>
|
||||
*
|
||||
* @param url 请求地址
|
||||
* @param headers 请求头,可以为null
|
||||
* @param body json请求体
|
||||
* @return String
|
||||
*/
|
||||
public static String doPost(String url, Map<String, String> headers, Map<String, Object> body) {
|
||||
// 创建HttpClient对象
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
// 创建HttpResponse对象
|
||||
CloseableHttpResponse response = null;
|
||||
log.info("request param info : {}", body);
|
||||
log.info("request header info : {}", headers);
|
||||
try {
|
||||
try {
|
||||
// 创建HttpPost对象
|
||||
HttpPost post = new HttpPost(url);
|
||||
// 封装请求头
|
||||
if (null != headers) {
|
||||
headers.keySet().forEach(key -> {
|
||||
post.addHeader(key, headers.get(key));
|
||||
});
|
||||
}
|
||||
// 封装请求体
|
||||
List<NameValuePair> nvpList = new ArrayList<>();
|
||||
for (String name : body.keySet()) {
|
||||
String value = String.valueOf(body.get(name));
|
||||
nvpList.add(new BasicNameValuePair(name, value));
|
||||
}
|
||||
post.setEntity(new UrlEncodedFormEntity(nvpList,HTTP_CHARSET));
|
||||
|
||||
response = httpClient.execute(post);
|
||||
// 处理响应
|
||||
String result = EntityUtils.toString(response.getEntity(), Charset.forName(HTTP_CHARSET));
|
||||
log.info("response info : {}", result);
|
||||
return result;
|
||||
} catch (IOException e) {
|
||||
log.error("post链接失败:" + e.getMessage());
|
||||
} finally {
|
||||
// 释放连接
|
||||
if (response != null) {
|
||||
response.close();
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("post关闭response失败:" + e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* delete请求
|
||||
*
|
||||
* @param url 请求地址
|
||||
* @param headers 请求头,可以为null
|
||||
* @return String
|
||||
*/
|
||||
public static String doDelete(String url, Map<String, String> headers) {
|
||||
// 创建HttpClient对象
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
// 创建HttpResponse对象
|
||||
CloseableHttpResponse response = null;
|
||||
log.info("request param info : {}", url);
|
||||
log.info("request header info : {}", headers);
|
||||
try {
|
||||
try {
|
||||
// 创建HttpPost对象
|
||||
HttpDelete delete = new HttpDelete(url);
|
||||
// 封装请求头
|
||||
if (null != headers) {
|
||||
headers.keySet().forEach(key -> {
|
||||
delete.addHeader(key, headers.get(key));
|
||||
});
|
||||
}
|
||||
response = httpClient.execute(delete);
|
||||
String result = EntityUtils.toString(response.getEntity(), Charset.forName(HTTP_CHARSET));
|
||||
log.info("response info : {}", result);
|
||||
return result;
|
||||
} catch (IOException e) {
|
||||
log.error("delete链接失败:" + e.getMessage());
|
||||
} finally {
|
||||
// 释放连接
|
||||
if (response != null) {
|
||||
response.close();
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("delete关闭response失败:" + e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -27,45 +27,15 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.RegExUtils;
|
||||
import org.apache.commons.lang3.reflect.FieldUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
|
||||
import org.apache.poi.hssf.usermodel.HSSFPicture;
|
||||
import org.apache.poi.hssf.usermodel.HSSFPictureData;
|
||||
import org.apache.poi.hssf.usermodel.HSSFShape;
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.common.usermodel.HyperlinkType;
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.ooxml.POIXMLDocumentPart;
|
||||
import org.apache.poi.ss.usermodel.BorderStyle;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.CellStyle;
|
||||
import org.apache.poi.ss.usermodel.CellType;
|
||||
import org.apache.poi.ss.usermodel.ClientAnchor;
|
||||
import org.apache.poi.ss.usermodel.DataValidation;
|
||||
import org.apache.poi.ss.usermodel.DataValidationConstraint;
|
||||
import org.apache.poi.ss.usermodel.DataValidationHelper;
|
||||
import org.apache.poi.ss.usermodel.DateUtil;
|
||||
import org.apache.poi.ss.usermodel.Drawing;
|
||||
import org.apache.poi.ss.usermodel.FillPatternType;
|
||||
import org.apache.poi.ss.usermodel.Font;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.Name;
|
||||
import org.apache.poi.ss.usermodel.PictureData;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.ss.util.CellRangeAddressList;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
|
||||
import org.apache.poi.xssf.usermodel.XSSFDataValidation;
|
||||
import org.apache.poi.xssf.usermodel.XSSFDrawing;
|
||||
import org.apache.poi.xssf.usermodel.XSSFPicture;
|
||||
import org.apache.poi.xssf.usermodel.XSSFShape;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.apache.poi.xssf.usermodel.*;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -1016,6 +986,7 @@ public class ExcelUtil<T>
|
|||
{
|
||||
// 创建cell
|
||||
cell = row.createCell(column);
|
||||
|
||||
if (isSubListValue(vo) && getListCellValue(vo).size() > 1 && attr.needMerge())
|
||||
{
|
||||
CellRangeAddress cellAddress = new CellRangeAddress(subMergedFirstRowNum, subMergedLastRowNum, column, column);
|
||||
|
@ -1059,7 +1030,20 @@ public class ExcelUtil<T>
|
|||
// 设置列类型
|
||||
setCellVo(value, attr, cell);
|
||||
}
|
||||
if(attr.isLink()){
|
||||
CreationHelper createHelper= row.getSheet().getWorkbook().getCreationHelper();
|
||||
XSSFHyperlink link = (XSSFHyperlink) createHelper.createHyperlink(HyperlinkType.URL);
|
||||
link.setAddress((String) value);
|
||||
cell.setHyperlink(link);
|
||||
if( StringUtils.isNotEmpty (attr.linkText())){
|
||||
cell.setCellValue(attr.linkText());
|
||||
}else{
|
||||
cell.setCellValue(value.toString());
|
||||
}
|
||||
|
||||
}
|
||||
addStatisticsData(column, Convert.toStr(value), attr);
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
@ -2,6 +2,10 @@ package com.ruoyi.common.utils.sign;
|
|||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -32,6 +36,23 @@ public class Md5Utils
|
|||
return null;
|
||||
}
|
||||
|
||||
private static byte[] md5(byte[] bytes)
|
||||
{
|
||||
MessageDigest algorithm;
|
||||
try
|
||||
{
|
||||
algorithm = MessageDigest.getInstance("MD5");
|
||||
algorithm.update(bytes);
|
||||
byte[] messageDigest = algorithm.digest();
|
||||
return messageDigest;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("MD5 Error...", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static final String toHex(byte hash[])
|
||||
{
|
||||
if (hash == null)
|
||||
|
@ -52,6 +73,36 @@ public class Md5Utils
|
|||
return buf.toString();
|
||||
}
|
||||
|
||||
public static String hash(byte[] uploadBytes)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new String(toHex(md5(uploadBytes)).getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("not supported charset...{}", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String hash(List<Long> objs)
|
||||
{
|
||||
if(objs==null){
|
||||
return null;
|
||||
}
|
||||
String s = objs.toString();
|
||||
try
|
||||
{
|
||||
return new String(toHex(md5(s)).getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("not supported charset...{}", e);
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
public static String hash(String s)
|
||||
{
|
||||
try
|
||||
|
@ -64,4 +115,12 @@ public class Md5Utils
|
|||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
public static String yzMd5(String s){
|
||||
String tmp="HelloYanzhu"+s+"陕西研筑";
|
||||
tmp=hash(tmp);
|
||||
tmp=tmp.substring(3,15)+"yanzhu"+tmp.substring(20)+"研筑陕西";
|
||||
tmp=hash(tmp);
|
||||
return "sxyz"+tmp.substring(21,tmp.length()-3)+tmp.substring(3,14);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,356 @@
|
|||
package com.ruoyi.common.utils.sign;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.*;
|
||||
import java.security.interfaces.RSAPrivateKey;
|
||||
import java.security.interfaces.RSAPublicKey;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
import java.security.spec.PKCS8EncodedKeySpec;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
import java.util.Base64;
|
||||
|
||||
/**
|
||||
* @description: Rsa非对称加密算法工具类
|
||||
* @author: JiangYuQi
|
||||
* @date: 2024/1/13 15:14
|
||||
*/
|
||||
public final class RSAUtil {
|
||||
|
||||
private RSAUtil() {}
|
||||
|
||||
private static final String RSA = "RSA";
|
||||
|
||||
private static final String SIGN_ALGORITHMS = "SHA1WithRSA";
|
||||
|
||||
private static final Base64.Decoder DECODER = Base64.getDecoder();
|
||||
|
||||
private static final Base64.Encoder ENCODER = Base64.getEncoder();
|
||||
|
||||
|
||||
public static void main(String[] args) throws NoSuchAlgorithmException {
|
||||
// 生成密钥对
|
||||
KeyPair keyPair = getKeyPair();
|
||||
// 公匙
|
||||
String publicKey = getPublicKeyBase64(keyPair);
|
||||
System.out.println("公匙 -> " + publicKey);
|
||||
// 私匙
|
||||
String privateKey = getPrivateKeyBase64(keyPair);
|
||||
System.out.println("私匙 -> " + privateKey);
|
||||
// 明文
|
||||
String plaintext = "hello world!";
|
||||
System.out.println("明文 -> " + plaintext);
|
||||
// 密文base64(公匙加密)
|
||||
String ciphertext = publicKeyEncrypt(plaintext, publicKey);
|
||||
System.out.println("密文base64 -> " + ciphertext);
|
||||
// 解密后明文(私匙解密)
|
||||
String decryptString = privateKeyDecrypt(ciphertext, privateKey);
|
||||
System.out.println("解密后明文 -> " + decryptString);
|
||||
// 数字签名
|
||||
// String sign = sign(ciphertext, privateKey);
|
||||
// System.out.println("数字签名 -> " + decryptString);
|
||||
// // 验证签名
|
||||
// boolean pass = verify(ciphertext, sign, publicKey);
|
||||
// System.out.println("验证签名 -> " + pass);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成秘钥对
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static KeyPair getKeyPair() throws NoSuchAlgorithmException {
|
||||
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(RSA);
|
||||
keyPairGenerator.initialize(1024);
|
||||
return keyPairGenerator.generateKeyPair();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取公钥(Base64编码)
|
||||
*
|
||||
* @param keyPair 秘钥对
|
||||
* @return
|
||||
*/
|
||||
public static String getPublicKeyBase64(KeyPair keyPair) {
|
||||
PublicKey publicKey = keyPair.getPublic();
|
||||
byte[] bytes = publicKey.getEncoded();
|
||||
// 先用base64编码,再转换为字符串
|
||||
return new String(ENCODER.encode(bytes), StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取私钥(Base64编码)
|
||||
*
|
||||
* @param keyPair 秘钥对
|
||||
* @return
|
||||
*/
|
||||
public static String getPrivateKeyBase64(KeyPair keyPair) {
|
||||
PrivateKey privateKey = keyPair.getPrivate();
|
||||
byte[] bytes = privateKey.getEncoded();
|
||||
// 先用base64编码,再转换为字符串
|
||||
return new String(ENCODER.encode(bytes), StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将Base64编码后的公钥转换成PublicKey对象
|
||||
*
|
||||
* @param publicKeyBase64 公钥base64
|
||||
* @return
|
||||
*/
|
||||
public static PublicKey getPublicKey(String publicKeyBase64) throws NoSuchAlgorithmException, InvalidKeySpecException {
|
||||
byte[] keyBytes = DECODER.decode(publicKeyBase64);
|
||||
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes);
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(RSA);
|
||||
return keyFactory.generatePublic(keySpec);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将Base64编码后的私钥转换成PrivateKey对象
|
||||
*
|
||||
* @param privateKeyBase64 私钥base64
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static PrivateKey getPrivateKey(String privateKeyBase64) throws NoSuchAlgorithmException, InvalidKeySpecException {
|
||||
byte[] keyBytes = DECODER.decode((privateKeyBase64));
|
||||
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes);
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(RSA);
|
||||
return keyFactory.generatePrivate(keySpec);
|
||||
}
|
||||
|
||||
/**
|
||||
* 公钥加密
|
||||
*
|
||||
* @param plaintext 明文
|
||||
* @param publicKeyBase64 公钥base64
|
||||
* @return 密文数组base64编码后的字符串
|
||||
*/
|
||||
public static String publicKeyEncrypt(String plaintext, String publicKeyBase64) {
|
||||
try {
|
||||
// 获取明文字节数组
|
||||
byte[] bytes = plaintext.getBytes(StandardCharsets.UTF_8);
|
||||
Cipher cipher = Cipher.getInstance(RSA);
|
||||
// 编码前设定编码方式及密钥
|
||||
PublicKey publicKey = getPublicKey(publicKeyBase64);
|
||||
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
|
||||
int keyBit = getKeySize(publicKey);
|
||||
int inputLen = bytes.length;
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
int offSet = 0;
|
||||
int step = keyBit / 8 - 11;
|
||||
for (int i = 0; inputLen - offSet > 0; offSet = i * step) {
|
||||
byte[] cache;
|
||||
if (inputLen - offSet > step) {
|
||||
cache = cipher.doFinal(bytes, offSet, step);
|
||||
} else {
|
||||
cache = cipher.doFinal(bytes, offSet, inputLen - offSet);
|
||||
}
|
||||
out.write(cache, 0, cache.length);
|
||||
++i;
|
||||
}
|
||||
// 密文字节数组
|
||||
byte[] ciphertextBytes = out.toByteArray();
|
||||
out.close();
|
||||
// 返回密文字节数组base64编码后的字符串
|
||||
return new String(ENCODER.encode(ciphertextBytes), StandardCharsets.UTF_8);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 公钥解密
|
||||
*
|
||||
* @param ciphertext 密文
|
||||
* @param publicKeyBase64 公钥base64
|
||||
* @return 明文
|
||||
*/
|
||||
public static String publicKeyDecrypt(String ciphertext, String publicKeyBase64) {
|
||||
try {
|
||||
// 密文base64解码字节数组
|
||||
byte[] bytes = DECODER.decode(ciphertext.getBytes(StandardCharsets.UTF_8));
|
||||
Cipher cipher = Cipher.getInstance(RSA);
|
||||
PublicKey publicKey = getPublicKey(publicKeyBase64);
|
||||
cipher.init(Cipher.DECRYPT_MODE, publicKey);
|
||||
int keyBit = getKeySize(publicKey);
|
||||
int inputLen = bytes.length;
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
int offSet = 0;
|
||||
int step = keyBit / 8;
|
||||
|
||||
for (int i = 0; inputLen - offSet > 0; offSet = i * step) {
|
||||
byte[] cache;
|
||||
if (inputLen - offSet > step) {
|
||||
cache = cipher.doFinal(bytes, offSet, step);
|
||||
} else {
|
||||
cache = cipher.doFinal(bytes, offSet, inputLen - offSet);
|
||||
}
|
||||
out.write(cache, 0, cache.length);
|
||||
++i;
|
||||
}
|
||||
// 明文字节数组
|
||||
byte[] plaintextBytes = out.toByteArray();
|
||||
out.close();
|
||||
return new String(plaintextBytes, StandardCharsets.UTF_8);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 私钥加密
|
||||
*
|
||||
* @param plaintext 明文
|
||||
* @param privateKeyBase64 私钥base64
|
||||
* @return
|
||||
*/
|
||||
public static String privateKeyEncrypt(String plaintext, String privateKeyBase64) {
|
||||
try {
|
||||
// 获取明文字节数组
|
||||
byte[] bytes = plaintext.getBytes(StandardCharsets.UTF_8);
|
||||
Cipher cipher = Cipher.getInstance(RSA);
|
||||
// 编码前设定编码方式及密钥
|
||||
PrivateKey privateKey = getPrivateKey(privateKeyBase64);
|
||||
cipher.init(Cipher.ENCRYPT_MODE, privateKey);
|
||||
int keyBit = getKeySize(privateKey);
|
||||
int inputLen = bytes.length;
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
int offSet = 0;
|
||||
int step = keyBit / 8 - 11;
|
||||
|
||||
for (int i = 0; inputLen - offSet > 0; offSet = i * step) {
|
||||
byte[] cache;
|
||||
if (inputLen - offSet > step) {
|
||||
cache = cipher.doFinal(bytes, offSet, step);
|
||||
} else {
|
||||
cache = cipher.doFinal(bytes, offSet, inputLen - offSet);
|
||||
}
|
||||
out.write(cache, 0, cache.length);
|
||||
++i;
|
||||
}
|
||||
// 密文字节数组
|
||||
byte[] ciphertextBytes = out.toByteArray();
|
||||
out.close();
|
||||
// 返回密文字节数组base64编码后的字符串
|
||||
return new String(ENCODER.encode(ciphertextBytes), StandardCharsets.UTF_8);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 私钥解密
|
||||
*
|
||||
* @param ciphertext 密文
|
||||
* @param privateKeyBase64 私钥base64
|
||||
* @return 明文
|
||||
*/
|
||||
public static String privateKeyDecrypt(String ciphertext, String privateKeyBase64) {
|
||||
try {
|
||||
// 密文base64解码字节数组
|
||||
byte[] bytes = DECODER.decode(ciphertext.getBytes(StandardCharsets.UTF_8));
|
||||
Cipher cipher = Cipher.getInstance(RSA);
|
||||
PrivateKey privateKey = getPrivateKey(privateKeyBase64);
|
||||
cipher.init(Cipher.DECRYPT_MODE, privateKey);
|
||||
int keyBit = getKeySize(privateKey);
|
||||
int inputLen = bytes.length;
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
int offSet = 0;
|
||||
int step = keyBit / 8;
|
||||
|
||||
for (int i = 0; inputLen - offSet > 0; offSet = i * step) {
|
||||
byte[] cache;
|
||||
if (inputLen - offSet > step) {
|
||||
cache = cipher.doFinal(bytes, offSet, step);
|
||||
} else {
|
||||
cache = cipher.doFinal(bytes, offSet, inputLen - offSet);
|
||||
}
|
||||
out.write(cache, 0, cache.length);
|
||||
++i;
|
||||
}
|
||||
// 明文字节数组
|
||||
byte[] plaintextBytes = out.toByteArray();
|
||||
out.close();
|
||||
return new String(plaintextBytes, StandardCharsets.UTF_8);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用私钥对数据进行数字签名
|
||||
*
|
||||
* @param ciphertext 密文
|
||||
* @param privateKeyBase64 私钥Base64
|
||||
* @return 加密后的base64签名
|
||||
*/
|
||||
public static String sign(String ciphertext, String privateKeyBase64) {
|
||||
try {
|
||||
// 密文字节数组
|
||||
byte[] ciphertextBytes = DECODER.decode(ciphertext.getBytes(StandardCharsets.UTF_8));
|
||||
PrivateKey privateKey = getPrivateKey(privateKeyBase64);
|
||||
Signature signature = Signature.getInstance(SIGN_ALGORITHMS);
|
||||
signature.initSign(privateKey);
|
||||
signature.update(ciphertextBytes);
|
||||
byte[] signed = signature.sign();
|
||||
return new String(ENCODER.encode(signed), StandardCharsets.UTF_8);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用公钥验证数字签名
|
||||
*
|
||||
* @param ciphertext 密文
|
||||
* @param sign 签名
|
||||
* @param publicKeyBase64 公钥base64
|
||||
* @return 是否篡改了数据
|
||||
*/
|
||||
public static boolean verify(String ciphertext, String sign, String publicKeyBase64) {
|
||||
try {
|
||||
// 密文base64解码字节数组
|
||||
byte[] ciphertextBytes = DECODER.decode(ciphertext.getBytes(StandardCharsets.UTF_8));
|
||||
// 签名base64解码字节数组
|
||||
byte[] signBytes = DECODER.decode(sign.getBytes(StandardCharsets.UTF_8));
|
||||
PublicKey publicKey = getPublicKey(publicKeyBase64);
|
||||
Signature signature = Signature.getInstance(SIGN_ALGORITHMS);
|
||||
signature.initVerify(publicKey);
|
||||
signature.update(ciphertextBytes);
|
||||
return signature.verify(signBytes);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取公钥长度
|
||||
*
|
||||
* @param publicKey 公钥
|
||||
* @return
|
||||
*/
|
||||
public static int getKeySize(PublicKey publicKey) {
|
||||
RSAPublicKey rsaPublicKey = (RSAPublicKey) publicKey;
|
||||
return rsaPublicKey.getModulus().bitLength();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取私钥长度
|
||||
*
|
||||
* @param privateKey 私钥
|
||||
* @return
|
||||
*/
|
||||
public static int getKeySize(PrivateKey privateKey) {
|
||||
RSAPrivateKey rsaPrivateKey = (RSAPrivateKey) privateKey;
|
||||
return rsaPrivateKey.getModulus().bitLength();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
# sms短信平台配置 企信通--九维
|
||||
sms.jiuwei.url=http://123.206.19.78:9001/sendXSms.do
|
||||
sms.jiuwei.username=gwzdyjc
|
||||
sms.jiuwei.password=308517
|
||||
sms.jiuwei.productid=621215
|
|
@ -84,13 +84,4 @@
|
|||
|
||||
</dependencies>
|
||||
|
||||
<!-- <build>-->
|
||||
<!-- <plugins>-->
|
||||
<!-- <plugin>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
|
||||
<!-- </plugin>-->
|
||||
<!-- </plugins>-->
|
||||
<!-- </build>-->
|
||||
|
||||
</project>
|
||||
|
|
|
@ -16,8 +16,8 @@ public enum FlowComment {
|
|||
REJECT("3", "驳回意见"),
|
||||
DELEGATE("4", "委派意见"),
|
||||
ASSIGN("5", "转办意见"),
|
||||
STOP("6", "终止流程");
|
||||
|
||||
STOP("6", "终止流程"),
|
||||
REVOKE("7", "撤回");
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package com.ruoyi.flowable.config;
|
||||
|
||||
import com.ruoyi.flowable.listener.GlobalEventListener;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.flowable.common.engine.api.delegate.event.FlowableEngineEventType;
|
||||
import org.flowable.common.engine.api.delegate.event.FlowableEventDispatcher;
|
||||
import org.flowable.spring.SpringProcessEngineConfiguration;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
|
||||
/**
|
||||
* Flowable添加全局监听器
|
||||
*
|
||||
* @author JiangYuQi
|
||||
*/
|
||||
@Configuration
|
||||
@RequiredArgsConstructor
|
||||
public class FlowableGlobalListenerConfig implements ApplicationListener<ContextRefreshedEvent> {
|
||||
|
||||
private final SpringProcessEngineConfiguration configuration;
|
||||
|
||||
private final GlobalEventListener globalEventListener;
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ContextRefreshedEvent event) {
|
||||
FlowableEventDispatcher dispatcher = configuration.getEventDispatcher();
|
||||
/**
|
||||
* 任务创建全局监听-待办消息发送
|
||||
* PROCESS_CREATED 流程创建
|
||||
* TASK_CREATED 任务创建
|
||||
* TASK_COMPLETED 任务完成
|
||||
* PROCESS_COMPLETED 流程完成
|
||||
* 流程创建、任务创建、任务完成、流程完成
|
||||
*/
|
||||
dispatcher.addEventListener(globalEventListener,FlowableEngineEventType.TASK_CREATED);
|
||||
dispatcher.addEventListener(globalEventListener,FlowableEngineEventType.PROCESS_COMPLETED);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,95 +1,95 @@
|
|||
//package com.ruoyi.flowable.config;
|
||||
//
|
||||
//import com.sun.prism.paint.Color;
|
||||
//import org.flowable.bpmn.model.AssociationDirection;
|
||||
//import org.flowable.image.impl.DefaultProcessDiagramCanvas;
|
||||
//
|
||||
//import java.awt.*;
|
||||
//import java.awt.geom.Line2D;
|
||||
//import java.awt.geom.RoundRectangle2D;
|
||||
//
|
||||
///**
|
||||
// * @author Tony
|
||||
// * @date 2021-04-03
|
||||
// */
|
||||
//public class MyDefaultProcessDiagramCanvas extends DefaultProcessDiagramCanvas {
|
||||
// //设置高亮线的颜色 这里我设置成绿色
|
||||
// protected static Color HIGHLIGHT_SEQUENCEFLOW_COLOR = Color.GREEN;
|
||||
//
|
||||
// public MyDefaultProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType, String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader) {
|
||||
// super(width, height, minX, minY, imageType, activityFontName, labelFontName, annotationFontName, customClassLoader);
|
||||
// }
|
||||
//
|
||||
// public MyDefaultProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType) {
|
||||
// super(width, height, minX, minY, imageType);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 画线颜色设置
|
||||
// */
|
||||
// @Override
|
||||
// public void drawConnection(int[] xPoints, int[] yPoints, boolean conditional, boolean isDefault, String connectionType,
|
||||
// AssociationDirection associationDirection, boolean highLighted, double scaleFactor) {
|
||||
//
|
||||
// Paint originalPaint = g.getPaint();
|
||||
// Stroke originalStroke = g.getStroke();
|
||||
//
|
||||
// g.setPaint(CONNECTION_COLOR);
|
||||
// if (connectionType.equals("association")) {
|
||||
// g.setStroke(ASSOCIATION_STROKE);
|
||||
// } else if (highLighted) {
|
||||
// //设置线的颜色
|
||||
// g.setPaint(originalPaint);
|
||||
// g.setStroke(HIGHLIGHT_FLOW_STROKE);
|
||||
// }
|
||||
//
|
||||
// for (int i = 1; i < xPoints.length; i++) {
|
||||
// Integer sourceX = xPoints[i - 1];
|
||||
// Integer sourceY = yPoints[i - 1];
|
||||
// Integer targetX = xPoints[i];
|
||||
// Integer targetY = yPoints[i];
|
||||
// Line2D.Double line = new Line2D.Double(sourceX, sourceY, targetX, targetY);
|
||||
// g.draw(line);
|
||||
// }
|
||||
//
|
||||
// if (isDefault) {
|
||||
// Line2D.Double line = new Line2D.Double(xPoints[0], yPoints[0], xPoints[1], yPoints[1]);
|
||||
// drawDefaultSequenceFlowIndicator(line, scaleFactor);
|
||||
// }
|
||||
//
|
||||
// if (conditional) {
|
||||
// Line2D.Double line = new Line2D.Double(xPoints[0], yPoints[0], xPoints[1], yPoints[1]);
|
||||
// drawConditionalSequenceFlowIndicator(line, scaleFactor);
|
||||
// }
|
||||
//
|
||||
// if (associationDirection == AssociationDirection.ONE || associationDirection == AssociationDirection.BOTH) {
|
||||
// Line2D.Double line = new Line2D.Double(xPoints[xPoints.length - 2], yPoints[xPoints.length - 2], xPoints[xPoints.length - 1], yPoints[xPoints.length - 1]);
|
||||
// drawArrowHead(line, scaleFactor);
|
||||
// }
|
||||
// if (associationDirection == AssociationDirection.BOTH) {
|
||||
// Line2D.Double line = new Line2D.Double(xPoints[1], yPoints[1], xPoints[0], yPoints[0]);
|
||||
// drawArrowHead(line, scaleFactor);
|
||||
// }
|
||||
// g.setPaint(originalPaint);
|
||||
// g.setStroke(originalStroke);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 高亮节点设置
|
||||
// */
|
||||
// @Override
|
||||
// public void drawHighLight(int x, int y, int width, int height) {
|
||||
// Paint originalPaint = g.getPaint();
|
||||
// Stroke originalStroke = g.getStroke();
|
||||
// //设置高亮节点的颜色
|
||||
// g.setPaint(HIGHLIGHT_COLOR);
|
||||
// g.setStroke(THICK_TASK_BORDER_STROKE);
|
||||
//
|
||||
// RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, 20, 20);
|
||||
// g.draw(rect);
|
||||
//
|
||||
// g.setPaint(originalPaint);
|
||||
// g.setStroke(originalStroke);
|
||||
// }
|
||||
//}
|
||||
package com.ruoyi.flowable.config;
|
||||
|
||||
import org.flowable.bpmn.model.AssociationDirection;
|
||||
import org.flowable.image.impl.DefaultProcessDiagramCanvas;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.geom.Line2D;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
|
||||
/**
|
||||
* @author Tony
|
||||
* @date 2021-04-03
|
||||
*/
|
||||
public class MyDefaultProcessDiagramCanvas extends DefaultProcessDiagramCanvas {
|
||||
|
||||
//设置高亮线的颜色 这里我设置成绿色
|
||||
protected static Color HIGHLIGHT_SEQUENCEFLOW_COLOR = Color.GREEN;
|
||||
|
||||
public MyDefaultProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType, String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader) {
|
||||
super(width, height, minX, minY, imageType, activityFontName, labelFontName, annotationFontName, customClassLoader);
|
||||
}
|
||||
|
||||
public MyDefaultProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType) {
|
||||
super(width, height, minX, minY, imageType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 画线颜色设置
|
||||
*/
|
||||
@Override
|
||||
public void drawConnection(int[] xPoints, int[] yPoints, boolean conditional, boolean isDefault, String connectionType,
|
||||
AssociationDirection associationDirection, boolean highLighted, double scaleFactor) {
|
||||
|
||||
Paint originalPaint = g.getPaint();
|
||||
Stroke originalStroke = g.getStroke();
|
||||
|
||||
g.setPaint(CONNECTION_COLOR);
|
||||
if (connectionType.equals("association")) {
|
||||
g.setStroke(ASSOCIATION_STROKE);
|
||||
} else if (highLighted) {
|
||||
//设置线的颜色
|
||||
g.setPaint(originalPaint);
|
||||
g.setStroke(HIGHLIGHT_FLOW_STROKE);
|
||||
}
|
||||
|
||||
for (int i = 1; i < xPoints.length; i++) {
|
||||
Integer sourceX = xPoints[i - 1];
|
||||
Integer sourceY = yPoints[i - 1];
|
||||
Integer targetX = xPoints[i];
|
||||
Integer targetY = yPoints[i];
|
||||
Line2D.Double line = new Line2D.Double(sourceX, sourceY, targetX, targetY);
|
||||
g.draw(line);
|
||||
}
|
||||
|
||||
if (isDefault) {
|
||||
Line2D.Double line = new Line2D.Double(xPoints[0], yPoints[0], xPoints[1], yPoints[1]);
|
||||
drawDefaultSequenceFlowIndicator(line, scaleFactor);
|
||||
}
|
||||
|
||||
if (conditional) {
|
||||
Line2D.Double line = new Line2D.Double(xPoints[0], yPoints[0], xPoints[1], yPoints[1]);
|
||||
drawConditionalSequenceFlowIndicator(line, scaleFactor);
|
||||
}
|
||||
|
||||
if (associationDirection == AssociationDirection.ONE || associationDirection == AssociationDirection.BOTH) {
|
||||
Line2D.Double line = new Line2D.Double(xPoints[xPoints.length - 2], yPoints[xPoints.length - 2], xPoints[xPoints.length - 1], yPoints[xPoints.length - 1]);
|
||||
drawArrowHead(line, scaleFactor);
|
||||
}
|
||||
if (associationDirection == AssociationDirection.BOTH) {
|
||||
Line2D.Double line = new Line2D.Double(xPoints[1], yPoints[1], xPoints[0], yPoints[0]);
|
||||
drawArrowHead(line, scaleFactor);
|
||||
}
|
||||
g.setPaint(originalPaint);
|
||||
g.setStroke(originalStroke);
|
||||
}
|
||||
|
||||
/**
|
||||
* 高亮节点设置
|
||||
*/
|
||||
@Override
|
||||
public void drawHighLight(int x, int y, int width, int height) {
|
||||
Paint originalPaint = g.getPaint();
|
||||
Stroke originalStroke = g.getStroke();
|
||||
//设置高亮节点的颜色
|
||||
g.setPaint(HIGHLIGHT_COLOR);
|
||||
g.setStroke(THICK_TASK_BORDER_STROKE);
|
||||
|
||||
RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, 20, 20);
|
||||
g.draw(rect);
|
||||
|
||||
g.setPaint(originalPaint);
|
||||
g.setStroke(originalStroke);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,126 @@
|
|||
package com.ruoyi.flowable.controller;
|
||||
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.enums.SysRoleEnum;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.flowable.service.IFlowBusinessKeyService;
|
||||
import com.ruoyi.system.domain.FlowTaskEntity;
|
||||
import com.ruoyi.system.service.ISysDeptService;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 业务工作流程自定义
|
||||
* </p>
|
||||
*
|
||||
* @author JiangYuQi
|
||||
* @date 2021-04-03
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "流程定义")
|
||||
@RestController
|
||||
@RequestMapping("/flowable/businessKey")
|
||||
public class FlowBusinessKeyController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService sysDeptService;
|
||||
|
||||
@Autowired
|
||||
private IFlowBusinessKeyService flowBusinessKeyService;
|
||||
|
||||
/**
|
||||
* 根据条件查询所有流任务
|
||||
* @param flowTaskEntity
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/allList")
|
||||
public TableDataInfo allList(FlowTaskEntity flowTaskEntity) {
|
||||
startPage();
|
||||
flowTaskEntity.setNowRole(Convert.toStr(getUserFirstRole()));
|
||||
if(SysRoleEnum.ZGS.getCode().equals(flowTaskEntity.getNowRole())){
|
||||
flowTaskEntity.setNowDept(Convert.toStr(sysDeptService.getZGSDeptId(getDeptId())));
|
||||
}else{
|
||||
flowTaskEntity.setNowDept(Convert.toStr(getDeptId()));
|
||||
}
|
||||
flowTaskEntity.setNowUser(Convert.toStr(getUserId()));
|
||||
return getDataTable(flowBusinessKeyService.selectAllFlowTaskByParams(flowTaskEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件统计所有流任务
|
||||
* @param flowTaskEntity
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryCount")
|
||||
public AjaxResult queryCount(FlowTaskEntity flowTaskEntity) {
|
||||
flowTaskEntity.setNowRole(Convert.toStr(getUserFirstRole()));
|
||||
if(SysRoleEnum.ZGS.getCode().equals(flowTaskEntity.getNowRole())){
|
||||
flowTaskEntity.setNowDept(Convert.toStr(sysDeptService.getZGSDeptId(getDeptId())));
|
||||
}else{
|
||||
flowTaskEntity.setNowDept(Convert.toStr(getDeptId()));
|
||||
}
|
||||
flowTaskEntity.setNowUser(Convert.toStr(getUserId()));
|
||||
return success(flowBusinessKeyService.quueryCount(flowTaskEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据流程Id查询操作日志
|
||||
* @param procInsId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/findCommentByProcInsId")
|
||||
public AjaxResult findCommentByProcInsId(String procInsId) {
|
||||
return success(flowBusinessKeyService.selectCommentByProcInsId(procInsId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据流程Id查询表单数据
|
||||
* @param procInsId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/findFormDatasByProcInsId")
|
||||
public AjaxResult findFormDatasByProcInsId(String procInsId) {
|
||||
return success(flowBusinessKeyService.selectFormDatasByProcInsId(procInsId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询我的代办任务
|
||||
* @param flowTaskEntity
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/myAwaitFlowTaskList")
|
||||
public TableDataInfo myAwaitFlowTaskList(FlowTaskEntity flowTaskEntity) {
|
||||
startPage();
|
||||
flowTaskEntity.setNowRole(Convert.toStr(getUserFirstRole()));
|
||||
if(SysRoleEnum.ZGS.getCode().equals(flowTaskEntity.getNowRole())){
|
||||
flowTaskEntity.setNowDept(Convert.toStr(sysDeptService.getZGSDeptId(getDeptId())));
|
||||
}else{
|
||||
flowTaskEntity.setNowDept(Convert.toStr(getDeptId()));
|
||||
}
|
||||
flowTaskEntity.setNowUser(Convert.toStr(SecurityUtils.getUserId()));
|
||||
flowTaskEntity.setRoleIds(SecurityUtils.getLoginUser().getUser().getRoles().stream().map(role -> role.getRoleId()).collect(Collectors.toList()));
|
||||
return getDataTable(flowBusinessKeyService.selectMyAwaitFlowTask(flowTaskEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询我的已办任务
|
||||
* @param flowTaskEntity
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/myFinishedFlowTaskList")
|
||||
public TableDataInfo myFinishedFlowTaskList(FlowTaskEntity flowTaskEntity) {
|
||||
startPage();
|
||||
flowTaskEntity.setNowUser(Convert.toStr(SecurityUtils.getUserId()));
|
||||
return getDataTable(flowBusinessKeyService.selectMyFinishedFlowTask(flowTaskEntity));
|
||||
}
|
||||
}
|
|
@ -1,10 +1,13 @@
|
|||
package com.ruoyi.flowable.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.flowable.domain.dto.FlowSaveXmlVo;
|
||||
import com.ruoyi.flowable.domain.vo.ProcKeyRole;
|
||||
import com.ruoyi.flowable.service.IFlowDefinitionService;
|
||||
import com.ruoyi.system.domain.FlowProcDefDto;
|
||||
import com.ruoyi.system.domain.SysExpression;
|
||||
|
@ -60,8 +63,19 @@ public class FlowDefinitionController extends BaseController {
|
|||
@ApiOperation(value = "流程定义列表", response = FlowProcDefDto.class)
|
||||
public AjaxResult list(@ApiParam(value = "当前页码", required = true) @RequestParam Integer pageNum,
|
||||
@ApiParam(value = "每页条数", required = true) @RequestParam Integer pageSize,
|
||||
@ApiParam(value = "发起角色", required = false) @RequestParam(required = false) String roleId,
|
||||
@ApiParam(value = "流程类型", required = false) @RequestParam(required = false) String category,
|
||||
@ApiParam(value = "流程名称", required = false) @RequestParam(required = false) String name) {
|
||||
return AjaxResult.success(flowDefinitionService.list(name, pageNum, pageSize));
|
||||
return AjaxResult.success(flowDefinitionService.list(roleId, category, name, pageNum, pageSize));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/myList")
|
||||
@ApiOperation(value = "流程定义列表", response = FlowProcDefDto.class)
|
||||
public AjaxResult myList(@ApiParam(value = "当前页码", required = true) @RequestParam Integer pageNum,
|
||||
@ApiParam(value = "每页条数", required = true) @RequestParam Integer pageSize,
|
||||
@ApiParam(value = "流程类型", required = false) @RequestParam(required = false) String category,
|
||||
@ApiParam(value = "流程名称", required = false) @RequestParam(required = false) String name) {
|
||||
return AjaxResult.success(flowDefinitionService.myList(getUsername(), category, name, pageNum, pageSize));
|
||||
}
|
||||
|
||||
|
||||
|
@ -129,7 +143,6 @@ public class FlowDefinitionController extends BaseController {
|
|||
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "保存流程设计器内的xml文件")
|
||||
@PostMapping("/save")
|
||||
public AjaxResult save(@RequestBody FlowSaveXmlVo vo) {
|
||||
|
@ -153,15 +166,32 @@ public class FlowDefinitionController extends BaseController {
|
|||
return AjaxResult.success("导入成功");
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "发起流程")
|
||||
@Log(title = "发起流程", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/start/{procDefId}")
|
||||
public AjaxResult start(@ApiParam(value = "流程定义id") @PathVariable(value = "procDefId") String procDefId,
|
||||
@ApiParam(value = "变量集合,json对象") @RequestBody Map<String, Object> variables) {
|
||||
return flowDefinitionService.startProcessInstanceById(procDefId, variables);
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
return flowDefinitionService.startProcessInstanceById(procDefId, sysUser.getUserId().toString(), sysUser.getNickName(), variables);
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "流程发起角色配置")
|
||||
@Log(title = "流程发起角色配置", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/updateProcKeyByRoleId")
|
||||
public AjaxResult updateProcKeyByRoleId(@RequestBody ProcKeyRole procKeyRole) {
|
||||
flowDefinitionService.updateProcKeyByRoleId(procKeyRole.getRoleId(),procKeyRole.getKeys());
|
||||
return success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "流程发起排序设置")
|
||||
@Log(title = "流程发起排序设置", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/updateProcKeyRoleSort")
|
||||
public AjaxResult updateProcKeyRoleSort(@RequestBody ProcKeyRole procKeyRole) {
|
||||
flowDefinitionService.updateProcKeyRoleSort(procKeyRole);
|
||||
return success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "激活或挂起流程定义")
|
||||
@PutMapping(value = "/updateState")
|
||||
public AjaxResult updateState(@ApiParam(value = "1:激活,2:挂起", required = true) @RequestParam Integer state,
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package com.ruoyi.flowable.controller;
|
||||
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.flowable.domain.vo.FlowTaskVo;
|
||||
import com.ruoyi.flowable.service.IFlowInstanceService;
|
||||
import io.swagger.annotations.Api;
|
||||
|
@ -36,7 +37,6 @@ public class FlowInstanceController {
|
|||
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "激活或挂起流程实例")
|
||||
@PostMapping(value = "/updateState")
|
||||
public AjaxResult updateState(@ApiParam(value = "1:激活,2:挂起", required = true) @RequestParam Integer state,
|
||||
|
@ -53,6 +53,7 @@ public class FlowInstanceController {
|
|||
}
|
||||
|
||||
@ApiOperation(value = "删除流程实例")
|
||||
@Log(title = "删除流程", businessType = BusinessType.INSERT)
|
||||
@DeleteMapping(value = "/delete/{instanceIds}")
|
||||
public AjaxResult delete(@ApiParam(value = "流程实例ID", required = true) @PathVariable String[] instanceIds,
|
||||
@ApiParam(value = "删除原因") @RequestParam(required = false) String deleteReason) {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.ruoyi.flowable.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.flowable.domain.dto.FlowTaskDto;
|
||||
import com.ruoyi.flowable.domain.vo.FlowQueryVo;
|
||||
import com.ruoyi.flowable.domain.vo.FlowTaskVo;
|
||||
|
@ -41,12 +43,14 @@ public class FlowTaskController {
|
|||
}
|
||||
|
||||
@ApiOperation(value = "取消申请", response = FlowTaskDto.class)
|
||||
@Log(title = "终止申请", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/stopProcess")
|
||||
public AjaxResult stopProcess(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
return flowTaskService.stopProcess(flowTaskVo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "撤回流程", response = FlowTaskDto.class)
|
||||
@Log(title = "撤回流程", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/revokeProcess")
|
||||
public AjaxResult revokeProcess(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
return flowTaskService.revokeProcess(flowTaskVo);
|
||||
|
@ -85,12 +89,14 @@ public class FlowTaskController {
|
|||
}
|
||||
|
||||
@ApiOperation(value = "审批任务")
|
||||
@Log(title = "审批流程", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/complete")
|
||||
public AjaxResult complete(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
return flowTaskService.complete(flowTaskVo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "驳回任务")
|
||||
@Log(title = "驳回流程", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/reject")
|
||||
public AjaxResult taskReject(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
flowTaskService.taskReject(flowTaskVo);
|
||||
|
@ -98,6 +104,7 @@ public class FlowTaskController {
|
|||
}
|
||||
|
||||
@ApiOperation(value = "退回任务")
|
||||
@Log(title = "退回流程", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/return")
|
||||
public AjaxResult taskReturn(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
flowTaskService.taskReturn(flowTaskVo);
|
||||
|
@ -111,6 +118,7 @@ public class FlowTaskController {
|
|||
}
|
||||
|
||||
@ApiOperation(value = "删除任务")
|
||||
@Log(title = "删除流程", businessType = BusinessType.UPDATE)
|
||||
@DeleteMapping(value = "/delete")
|
||||
public AjaxResult delete(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
flowTaskService.deleteTask(flowTaskVo);
|
||||
|
|
|
@ -32,6 +32,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|||
@RestController
|
||||
@RequestMapping("/flowable/form")
|
||||
public class SysFormController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISysFormService SysFormService;
|
||||
|
||||
|
@ -105,10 +106,10 @@ public class SysFormController extends BaseController {
|
|||
return toAjax(SysFormService.deleteSysFormByIds(formIds));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 挂载流程表单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('flowable:form:edit')")
|
||||
@Log(title = "流程表单", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/addDeployForm")
|
||||
public AjaxResult addDeployForm(@RequestBody SysDeployForm sysDeployForm) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.ruoyi.flowable.domain.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
|
@ -9,8 +8,6 @@ import lombok.Setter;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>工作流任务<p>
|
||||
|
@ -23,6 +20,9 @@ import java.util.Map;
|
|||
@ApiModel("工作流任务相关-返回参数")
|
||||
public class FlowTaskDto implements Serializable {
|
||||
|
||||
@ApiModelProperty("业务名称")
|
||||
private String businessKeyName;
|
||||
|
||||
@ApiModelProperty("任务编号")
|
||||
private String taskId;
|
||||
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package com.ruoyi.flowable.domain.enums;
|
||||
|
||||
/**
|
||||
* 流程意见类型
|
||||
*
|
||||
* @author Xuan xuan
|
||||
* @date 2021/4/19
|
||||
*/
|
||||
public enum FlowComment {
|
||||
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
NORMAL("1", "正常"),
|
||||
REBACK("2", "退回"),
|
||||
REJECT("3", "驳回"),
|
||||
DELEGATE("4", "委派"),
|
||||
TRANSFER("5", "转办"),
|
||||
STOP("6", "终止"),
|
||||
REVOKE("7", "撤回");
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final String type;
|
||||
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
private final String remark;
|
||||
|
||||
FlowComment(String type, String remark) {
|
||||
this.type = type;
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.ruoyi.flowable.domain.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author KonBAI
|
||||
* @createTime 2022/6/28 9:51
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum FormType {
|
||||
|
||||
/**
|
||||
* 流程表单
|
||||
*/
|
||||
PROCESS(0),
|
||||
|
||||
/**
|
||||
* 外置表单
|
||||
*/
|
||||
EXTERNAL(1),
|
||||
|
||||
/**
|
||||
* 节点独立表单
|
||||
*/
|
||||
INDEPENDENT(2);
|
||||
|
||||
/**
|
||||
* 表单类型
|
||||
*/
|
||||
private final Integer type;
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.ruoyi.flowable.domain.enums;
|
||||
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author konbai
|
||||
* @since 2023/3/9 00:45
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ProcessStatus {
|
||||
|
||||
/**
|
||||
* 进行中(审批中)
|
||||
*/
|
||||
RUNNING("running"),
|
||||
/**
|
||||
* 已终止
|
||||
*/
|
||||
TERMINATED("terminated"),
|
||||
/**
|
||||
* 已完成
|
||||
*/
|
||||
COMPLETED("completed"),
|
||||
/**
|
||||
* 已取消
|
||||
*/
|
||||
CANCELED("canceled");
|
||||
|
||||
private final String status;
|
||||
|
||||
public static ProcessStatus getProcessStatus(String str) {
|
||||
if (StringUtils.isNotBlank(str)) {
|
||||
for (ProcessStatus value : values()) {
|
||||
if (StringUtils.equalsIgnoreCase(str, value.getStatus())) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -20,6 +20,9 @@ public class FlowQueryVo {
|
|||
@ApiModelProperty("流程名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("流程类别")
|
||||
private String category;
|
||||
|
||||
@ApiModelProperty("开始时间")
|
||||
private String startTime;
|
||||
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
package com.ruoyi.flowable.domain.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class ProcKeyRole implements Serializable
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String roleId;
|
||||
|
||||
private String key;
|
||||
|
||||
private String sort;
|
||||
|
||||
private List<String> keys;
|
||||
|
||||
public String getRoleId() {
|
||||
return roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(String roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public List<String> getKeys() {
|
||||
return keys;
|
||||
}
|
||||
|
||||
public void setKeys(List<String> keys) {
|
||||
this.keys = keys;
|
||||
}
|
||||
|
||||
public String getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public void setSort(String sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package com.ruoyi.flowable.domain.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 流程实例启动
|
||||
*
|
||||
* @author JiangYuQi
|
||||
* @date 2020-07-07
|
||||
*/
|
||||
public class StartTaskVO implements Serializable
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
//流程实例ID
|
||||
private String procDefId;
|
||||
private String userId;
|
||||
private String userName;
|
||||
private String nickName;
|
||||
private Map<String, Object> variables;
|
||||
|
||||
public String getProcDefId() {
|
||||
return procDefId;
|
||||
}
|
||||
|
||||
public void setProcDefId(String procDefId) {
|
||||
this.procDefId = procDefId;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getNickName() {
|
||||
return nickName;
|
||||
}
|
||||
|
||||
public void setNickName(String nickName) {
|
||||
this.nickName = nickName;
|
||||
}
|
||||
|
||||
public Map<String, Object> getVariables() {
|
||||
return variables;
|
||||
}
|
||||
|
||||
public void setVariables(Map<String, Object> variables) {
|
||||
this.variables = variables;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,373 @@
|
|||
package com.ruoyi.flowable.flow;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.flowable.bpmn.converter.BpmnXMLConverter;
|
||||
import org.flowable.bpmn.model.Process;
|
||||
import org.flowable.bpmn.model.*;
|
||||
import org.flowable.common.engine.impl.util.io.StringStreamSource;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author KonBAI
|
||||
* @createTime 2022/3/26 19:04
|
||||
*/
|
||||
public class ModelUtils {
|
||||
|
||||
private static final BpmnXMLConverter bpmnXMLConverter = new BpmnXMLConverter();
|
||||
|
||||
/**
|
||||
* xml转bpmnModel对象
|
||||
*
|
||||
* @param xml xml
|
||||
* @return bpmnModel对象
|
||||
*/
|
||||
public static BpmnModel getBpmnModel(String xml) {
|
||||
return bpmnXMLConverter.convertToBpmnModel(new StringStreamSource(xml), false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* bpmnModel转xml字符串
|
||||
*
|
||||
* @deprecated 存在会丢失 bpmn 连线问题
|
||||
* @param bpmnModel bpmnModel对象
|
||||
* @return xml字符串
|
||||
*/
|
||||
@Deprecated
|
||||
public static String getBpmnXmlStr(BpmnModel bpmnModel) {
|
||||
return StrUtil.utf8Str(getBpmnXml(bpmnModel));
|
||||
}
|
||||
|
||||
/**
|
||||
* bpmnModel转xml对象
|
||||
*
|
||||
* @deprecated 存在丢失 bpmn 连线问题
|
||||
* @param bpmnModel bpmnModel对象
|
||||
* @return xml
|
||||
*/
|
||||
@Deprecated
|
||||
public static byte[] getBpmnXml(BpmnModel bpmnModel) {
|
||||
return bpmnXMLConverter.convertToXML(bpmnModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据节点,获取入口连线
|
||||
*
|
||||
* @param source 起始节点
|
||||
* @return 入口连线列表
|
||||
*/
|
||||
public static List<SequenceFlow> getElementIncomingFlows(FlowElement source) {
|
||||
List<SequenceFlow> sequenceFlows = new ArrayList<>();
|
||||
if (source instanceof FlowNode) {
|
||||
sequenceFlows = ((FlowNode) source).getIncomingFlows();
|
||||
}
|
||||
return sequenceFlows;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据节点,获取出口连线
|
||||
*
|
||||
* @param source 起始节点
|
||||
* @return 出口连线列表
|
||||
*/
|
||||
public static List<SequenceFlow> getElementOutgoingFlows(FlowElement source) {
|
||||
List<SequenceFlow> sequenceFlows = new ArrayList<>();
|
||||
if (source instanceof FlowNode) {
|
||||
sequenceFlows = ((FlowNode) source).getOutgoingFlows();
|
||||
}
|
||||
return sequenceFlows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取开始节点
|
||||
*
|
||||
* @param model bpmnModel对象
|
||||
* @return 开始节点(未找到开始节点,返回null)
|
||||
*/
|
||||
public static StartEvent getStartEvent(BpmnModel model) {
|
||||
Process process = model.getMainProcess();
|
||||
FlowElement startElement = process.getInitialFlowElement();
|
||||
if (startElement instanceof StartEvent) {
|
||||
return (StartEvent) startElement;
|
||||
}
|
||||
return getStartEvent(process.getFlowElements());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取开始节点
|
||||
*
|
||||
* @param flowElements 流程元素集合
|
||||
* @return 开始节点(未找到开始节点,返回null)
|
||||
*/
|
||||
public static StartEvent getStartEvent(Collection<FlowElement> flowElements) {
|
||||
for (FlowElement flowElement : flowElements) {
|
||||
if (flowElement instanceof StartEvent) {
|
||||
return (StartEvent) flowElement;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取结束节点
|
||||
*
|
||||
* @param model bpmnModel对象
|
||||
* @return 结束节点(未找到开始节点,返回null)
|
||||
*/
|
||||
public static EndEvent getEndEvent(BpmnModel model) {
|
||||
Process process = model.getMainProcess();
|
||||
return getEndEvent(process.getFlowElements());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取结束节点
|
||||
*
|
||||
* @param flowElements 流程元素集合
|
||||
* @return 结束节点(未找到开始节点,返回null)
|
||||
*/
|
||||
public static EndEvent getEndEvent(Collection<FlowElement> flowElements) {
|
||||
for (FlowElement flowElement : flowElements) {
|
||||
if (flowElement instanceof EndEvent) {
|
||||
return (EndEvent) flowElement;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static UserTask getUserTaskByKey(BpmnModel model, String taskKey) {
|
||||
Process process = model.getMainProcess();
|
||||
FlowElement flowElement = process.getFlowElement(taskKey);
|
||||
if (flowElement instanceof UserTask) {
|
||||
return (UserTask) flowElement;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流程元素信息
|
||||
*
|
||||
* @param model bpmnModel对象
|
||||
* @param flowElementId 元素ID
|
||||
* @return 元素信息
|
||||
*/
|
||||
public static FlowElement getFlowElementById(BpmnModel model, String flowElementId) {
|
||||
Process process = model.getMainProcess();
|
||||
return process.getFlowElement(flowElementId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取元素表单Key(限开始节点和用户节点可用)
|
||||
*
|
||||
* @param flowElement 元素
|
||||
* @return 表单Key
|
||||
*/
|
||||
public static String getFormKey(FlowElement flowElement) {
|
||||
if (flowElement != null) {
|
||||
if (flowElement instanceof StartEvent) {
|
||||
return ((StartEvent) flowElement).getFormKey();
|
||||
} else if (flowElement instanceof UserTask) {
|
||||
return ((UserTask) flowElement).getFormKey();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取开始节点属性值
|
||||
* @param model bpmnModel对象
|
||||
* @param name 属性名
|
||||
* @return 属性值
|
||||
*/
|
||||
public static String getStartEventAttributeValue(BpmnModel model, String name) {
|
||||
StartEvent startEvent = getStartEvent(model);
|
||||
return getElementAttributeValue(startEvent, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取结束节点属性值
|
||||
* @param model bpmnModel对象
|
||||
* @param name 属性名
|
||||
* @return 属性值
|
||||
*/
|
||||
public static String getEndEventAttributeValue(BpmnModel model, String name) {
|
||||
EndEvent endEvent = getEndEvent(model);
|
||||
return getElementAttributeValue(endEvent, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户任务节点属性值
|
||||
* @param model bpmnModel对象
|
||||
* @param taskKey 任务Key
|
||||
* @param name 属性名
|
||||
* @return 属性值
|
||||
*/
|
||||
public static String getUserTaskAttributeValue(BpmnModel model, String taskKey, String name) {
|
||||
UserTask userTask = getUserTaskByKey(model, taskKey);
|
||||
return getElementAttributeValue(userTask, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取元素属性值
|
||||
* @param baseElement 流程元素
|
||||
* @param name 属性名
|
||||
* @return 属性值
|
||||
*/
|
||||
public static String getElementAttributeValue(BaseElement baseElement, String name) {
|
||||
if (baseElement != null) {
|
||||
List<ExtensionAttribute> attributes = baseElement.getAttributes().get(name);
|
||||
if (attributes != null && !attributes.isEmpty()) {
|
||||
attributes.iterator().next().getValue();
|
||||
Iterator<ExtensionAttribute> attrIterator = attributes.iterator();
|
||||
if(attrIterator.hasNext()) {
|
||||
ExtensionAttribute attribute = attrIterator.next();
|
||||
return attribute.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isMultiInstance(BpmnModel model, String taskKey) {
|
||||
UserTask userTask = getUserTaskByKey(model, taskKey);
|
||||
if (ObjectUtil.isNotNull(userTask)) {
|
||||
return userTask.hasMultiInstanceLoopCharacteristics();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有用户任务节点
|
||||
*
|
||||
* @param model bpmnModel对象
|
||||
* @return 用户任务节点列表
|
||||
*/
|
||||
public static Collection<UserTask> getAllUserTaskEvent(BpmnModel model) {
|
||||
Process process = model.getMainProcess();
|
||||
Collection<FlowElement> flowElements = process.getFlowElements();
|
||||
return getAllUserTaskEvent(flowElements, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有用户任务节点
|
||||
* @param flowElements 流程元素集合
|
||||
* @param allElements 所有流程元素集合
|
||||
* @return 用户任务节点列表
|
||||
*/
|
||||
public static Collection<UserTask> getAllUserTaskEvent(Collection<FlowElement> flowElements, Collection<UserTask> allElements) {
|
||||
allElements = allElements == null ? new ArrayList<>() : allElements;
|
||||
for (FlowElement flowElement : flowElements) {
|
||||
if (flowElement instanceof UserTask) {
|
||||
allElements.add((UserTask) flowElement);
|
||||
}
|
||||
if (flowElement instanceof SubProcess) {
|
||||
// 继续深入子流程,进一步获取子流程
|
||||
allElements = getAllUserTaskEvent(((SubProcess) flowElement).getFlowElements(), allElements);
|
||||
}
|
||||
}
|
||||
return allElements;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找起始节点下一个用户任务列表列表
|
||||
* @param source 起始节点
|
||||
* @return 结果
|
||||
*/
|
||||
public static List<UserTask> findNextUserTasks(FlowElement source) {
|
||||
return findNextUserTasks(source, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找起始节点下一个用户任务列表列表
|
||||
* @param source 起始节点
|
||||
* @param hasSequenceFlow 已经经过的连线的 ID,用于判断线路是否重复
|
||||
* @param userTaskList 用户任务列表
|
||||
* @return 结果
|
||||
*/
|
||||
public static List<UserTask> findNextUserTasks(FlowElement source, Set<String> hasSequenceFlow, List<UserTask> userTaskList) {
|
||||
hasSequenceFlow = Optional.ofNullable(hasSequenceFlow).orElse(new HashSet<>());
|
||||
userTaskList = Optional.ofNullable(userTaskList).orElse(new ArrayList<>());
|
||||
// 获取出口连线
|
||||
List<SequenceFlow> sequenceFlows = getElementOutgoingFlows(source);
|
||||
if (!sequenceFlows.isEmpty()) {
|
||||
for (SequenceFlow sequenceFlow : sequenceFlows) {
|
||||
// 如果发现连线重复,说明循环了,跳过这个循环
|
||||
if (hasSequenceFlow.contains(sequenceFlow.getId())) {
|
||||
continue;
|
||||
}
|
||||
// 添加已经走过的连线
|
||||
hasSequenceFlow.add(sequenceFlow.getId());
|
||||
FlowElement targetFlowElement = sequenceFlow.getTargetFlowElement();
|
||||
if (targetFlowElement instanceof UserTask) {
|
||||
// 若节点为用户任务,加入到结果列表中
|
||||
userTaskList.add((UserTask) targetFlowElement);
|
||||
} else {
|
||||
// 若节点非用户任务,继续递归查找下一个节点
|
||||
findNextUserTasks(targetFlowElement, hasSequenceFlow, userTaskList);
|
||||
}
|
||||
}
|
||||
}
|
||||
return userTaskList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 迭代从后向前扫描,判断目标节点相对于当前节点是否是串行
|
||||
* 不存在直接回退到子流程中的情况,但存在从子流程出去到父流程情况
|
||||
* @param source 起始节点
|
||||
* @param target 目标节点
|
||||
* @param visitedElements 已经经过的连线的 ID,用于判断线路是否重复
|
||||
* @return 结果
|
||||
*/
|
||||
public static boolean isSequentialReachable(FlowElement source, FlowElement target, Set<String> visitedElements) {
|
||||
visitedElements = visitedElements == null ? new HashSet<>() : visitedElements;
|
||||
if (source instanceof StartEvent && isInEventSubprocess(source)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 根据类型,获取入口连线
|
||||
List<SequenceFlow> sequenceFlows = getElementIncomingFlows(source);
|
||||
if (sequenceFlows != null && sequenceFlows.size() > 0) {
|
||||
// 循环找到目标元素
|
||||
for (SequenceFlow sequenceFlow: sequenceFlows) {
|
||||
// 如果发现连线重复,说明循环了,跳过这个循环
|
||||
if (visitedElements.contains(sequenceFlow.getId())) {
|
||||
continue;
|
||||
}
|
||||
// 添加已经走过的连线
|
||||
visitedElements.add(sequenceFlow.getId());
|
||||
FlowElement sourceFlowElement = sequenceFlow.getSourceFlowElement();
|
||||
// 这条线路存在目标节点,这条线路完成,进入下个线路
|
||||
if (target.getId().equals(sourceFlowElement.getId())) {
|
||||
continue;
|
||||
}
|
||||
// 如果目标节点为并行网关,则不继续
|
||||
if (sourceFlowElement instanceof ParallelGateway) {
|
||||
return false;
|
||||
}
|
||||
// 否则就继续迭代
|
||||
boolean isSequential = isSequentialReachable(sourceFlowElement, target, visitedElements);
|
||||
if (!isSequential) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected static boolean isInEventSubprocess(FlowElement flowElement) {
|
||||
FlowElementsContainer flowElementsContainer = flowElement.getParentContainer();
|
||||
while (flowElementsContainer != null) {
|
||||
if (flowElementsContainer instanceof EventSubProcess) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (flowElementsContainer instanceof FlowElement) {
|
||||
flowElementsContainer = ((FlowElement) flowElementsContainer).getParentContainer();
|
||||
} else {
|
||||
flowElementsContainer = null;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -22,11 +22,7 @@ public class FlowTaskListener implements TaskListener{
|
|||
|
||||
@Override
|
||||
public void notify(DelegateTask delegateTask) {
|
||||
|
||||
log.info("任务监听器:{}", delegateTask);
|
||||
// TODO 获取事件类型 delegateTask.getEventName(),可以通过监听器给任务执行人发送相应的通知消息
|
||||
|
||||
|
||||
log.info("任务监听器:{}", delegateTask.getEventName(),delegateTask.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,317 @@
|
|||
package com.ruoyi.flowable.listener;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ruoyi.common.config.WechatAccountConfig;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.enums.TemplateMessageEnum;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.flowable.flow.FindNextNodeUtil;
|
||||
import com.ruoyi.flowable.service.IFlowBusinessKeyService;
|
||||
import com.ruoyi.system.domain.SysUserOpenid;
|
||||
import com.ruoyi.system.mapper.SysDeptMapper;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import com.ruoyi.system.mapper.SysUserOpenidMapper;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
|
||||
import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.flowable.bpmn.model.UserTask;
|
||||
import org.flowable.common.engine.api.delegate.event.FlowableEngineEntityEvent;
|
||||
import org.flowable.engine.RepositoryService;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.TaskService;
|
||||
import org.flowable.engine.delegate.event.AbstractFlowableEngineEventListener;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.flowable.identitylink.api.IdentityLink;
|
||||
import org.flowable.task.api.Task;
|
||||
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Flowable全局监听器
|
||||
*
|
||||
* @author JiangYuQi
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class GlobalEventListener extends AbstractFlowableEngineEventListener {
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
|
||||
@Autowired
|
||||
private WxMpService wxMpService;
|
||||
|
||||
@Autowired
|
||||
private SysDeptMapper sysDeptMapper;
|
||||
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
@Autowired
|
||||
private RuntimeService runtimeService;
|
||||
|
||||
@Autowired
|
||||
private RepositoryService repositoryService;
|
||||
|
||||
@Autowired
|
||||
private SysUserOpenidMapper sysUserOpenidMapper;
|
||||
|
||||
@Autowired
|
||||
private IFlowBusinessKeyService flowBusinessKeyService;
|
||||
|
||||
@Override
|
||||
protected void processCompleted(FlowableEngineEntityEvent event) {
|
||||
log.info("任务流程审批完成...{}",event.getProcessInstanceId());
|
||||
super.processCompleted(event);
|
||||
List<WxMpTemplateMessage> list = new ArrayList<>();
|
||||
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(event.getProcessInstanceId()).singleResult();
|
||||
String startUserId = processInstance.getStartUserId();
|
||||
SysUser sysUser = sysUserMapper.selectUserById(Convert.toLong(startUserId));
|
||||
Map<String, Object> map = flowBusinessKeyService.selectLastCommentByProcInsId(processInstance.getId());
|
||||
String nodeName = "工程审批";
|
||||
if(map!=null){
|
||||
nodeName += Convert.toStr(map.get("commentResult"),"");
|
||||
}
|
||||
//模板数据
|
||||
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
|
||||
.toUser(this.getMsgId(sysUser.getPhonenumber()))
|
||||
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
|
||||
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(Convert.toLong(processInstance.getBusinessKey()))));
|
||||
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", processInstance.getProcessDefinitionName()));
|
||||
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", nodeName));
|
||||
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,processInstance.getStartTime())));
|
||||
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", sysUser.getNickName()+"["+this.getMsgDepName(sysUser.getDeptId())+"]"));
|
||||
list.add(templateMessage);
|
||||
this.send(list,processInstance.getProcessDefinitionKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void taskCreated(FlowableEngineEntityEvent event) {
|
||||
log.info("创建任务节点...{}",event.getProcessInstanceId());
|
||||
super.taskCreated(event);
|
||||
List<WxMpTemplateMessage> list = new ArrayList<>();
|
||||
TaskEntity taskEntity = (TaskEntity)event.getEntity();
|
||||
List<IdentityLink> idList = taskService.getIdentityLinksForTask(taskEntity.getId());
|
||||
if (CollectionUtils.isNotEmpty(idList)) {
|
||||
List<String> candidateUsers = new ArrayList<>();
|
||||
List<String> candidateGroups = new ArrayList<>();
|
||||
idList.forEach(identityLink -> {
|
||||
if (StringUtils.isNotBlank(identityLink.getUserId())) {
|
||||
candidateUsers.add(identityLink.getUserId());
|
||||
}
|
||||
if (StringUtils.isNotBlank(identityLink.getGroupId())) {
|
||||
candidateGroups.add(identityLink.getGroupId());
|
||||
}
|
||||
});
|
||||
log.info("查询任务节点...{}",String.join(",",candidateUsers),String.join(",",candidateGroups));
|
||||
if(StringUtils.isNotEmpty(candidateUsers) || StringUtils.isNotEmpty(candidateGroups)){
|
||||
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(taskEntity.getProcessInstanceId()).singleResult();
|
||||
List<SysUser> sysUserList = flowBusinessKeyService.findFlowTaskUsers(processInstance.getBusinessKey(),candidateUsers,candidateGroups);
|
||||
Map<String, Object> map = flowBusinessKeyService.selectLastCommentByProcInsId(processInstance.getId());
|
||||
String nodeName = "待"+taskEntity.getName();
|
||||
if(map!=null && "驳回".equals(map.get("commentResult"))){
|
||||
nodeName += "工程审批驳回,请重新提交或审批";
|
||||
}
|
||||
if(StringUtils.isNotEmpty(sysUserList)){
|
||||
String startUserId = processInstance.getStartUserId();
|
||||
SysUser sysUser = sysUserMapper.selectUserById(Convert.toLong(startUserId));
|
||||
for(SysUser taskUser:sysUserList){
|
||||
//模板数据
|
||||
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
|
||||
.toUser(this.getMsgId(taskUser.getPhonenumber()))
|
||||
.miniProgram(new WxMpTemplateMessage.MiniProgram(WechatAccountConfig.getWxAppId(), "/pages/project_flowable/await/index?category="+taskEntity.getCategory()+"&barProId="+processInstance.getBusinessKey()))
|
||||
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
|
||||
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(Convert.toLong(processInstance.getBusinessKey()))));
|
||||
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", processInstance.getProcessDefinitionName()));
|
||||
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", nodeName));
|
||||
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,processInstance.getStartTime())));
|
||||
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", sysUser.getNickName()+"["+this.getMsgDepName(sysUser.getDeptId())+"]"));
|
||||
list.add(templateMessage);
|
||||
}
|
||||
this.send(list,processInstance.getProcessDefinitionKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务完成时监听器[暂未使用...统一使用任务创建]
|
||||
* @param event
|
||||
*/
|
||||
@Override
|
||||
protected void taskCompleted(FlowableEngineEntityEvent event) {
|
||||
log.info("任务节点审批通过...{}",event.getProcessInstanceId());
|
||||
super.taskCompleted(event);
|
||||
List<WxMpTemplateMessage> list = new ArrayList<>();
|
||||
TaskEntity taskEntity = (TaskEntity)event.getEntity();
|
||||
Task task = taskService.createTaskQuery().taskId(taskEntity.getId()).singleResult();
|
||||
// 查询任务...
|
||||
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(taskEntity.getProcessInstanceId()).singleResult();
|
||||
String startUserId = processInstance.getStartUserId();
|
||||
SysUser sysUser = sysUserMapper.selectUserById(Convert.toLong(startUserId));
|
||||
if (Objects.nonNull(task)) {
|
||||
// Step 2. 获取当前流程所有流程变量(网关节点时需要校验表达式)
|
||||
Map<String, Object> variables = taskEntity.getVariables();
|
||||
UserTask nextUserTask = FindNextNodeUtil.getNextUserTasks(repositoryService, task, variables).get(0);
|
||||
List<SysUser> sysUserList = flowBusinessKeyService.findFlowTaskUsers(processInstance.getBusinessKey(),nextUserTask.getCandidateUsers(),nextUserTask.getCandidateGroups());
|
||||
if(StringUtils.isNotEmpty(sysUserList)){
|
||||
for(SysUser taskUser:sysUserList){
|
||||
//模板数据
|
||||
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
|
||||
.toUser(this.getMsgId(taskUser.getPhonenumber()))
|
||||
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
|
||||
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(Convert.toLong(processInstance.getBusinessKey()))));
|
||||
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", processInstance.getProcessDefinitionName()));
|
||||
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", "待"+nextUserTask.getName()));
|
||||
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,processInstance.getStartTime())));
|
||||
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", sysUser.getNickName()+"["+this.getMsgDepName(sysUser.getDeptId())+"]"));
|
||||
list.add(templateMessage);
|
||||
}
|
||||
this.send(list,processInstance.getProcessDefinitionKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询单位名称
|
||||
* @param depId
|
||||
* @return
|
||||
*/
|
||||
private String getMsgDepName(Long depId){
|
||||
String name = Convert.toStr(redisCache.getCacheObject(CacheConstants.WX_MPMESSAGE_DNAME +depId));
|
||||
if(StringUtils.isNotEmpty(name)){
|
||||
return name;
|
||||
}else{
|
||||
SysDept sysDept = sysDeptMapper.selectDeptById(depId);
|
||||
//项目名称截取&&超过20字符微信限制并抛出异常
|
||||
String depName = sysDept.getDeptName();
|
||||
if(depName.length()>13){
|
||||
depName = sysDept.getDeptName().substring(0,13);
|
||||
}
|
||||
//设置30分钟有效期
|
||||
redisCache.setCacheObject(CacheConstants.WX_MPMESSAGE_DNAME +depId,depName,30, TimeUnit.MINUTES);
|
||||
return depName;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询项目名称
|
||||
* @param proId
|
||||
* @return
|
||||
*/
|
||||
private String getMsgProName(Long proId){
|
||||
String name = Convert.toStr(redisCache.getCacheObject(CacheConstants.WX_MPMESSAGE_PNAME +proId));
|
||||
if(StringUtils.isNotEmpty(name)){
|
||||
return name;
|
||||
}else{
|
||||
Map<String, Object> proMap = flowBusinessKeyService.selectSurProjectById(proId);
|
||||
//项目名称截取&&超过20字符微信限制并抛出异常
|
||||
String proName = Convert.toStr(proMap.get("projectName"));
|
||||
if(proName.length()>20){
|
||||
proName = proName.substring(0,20);
|
||||
}
|
||||
//设置30分钟有效期
|
||||
redisCache.setCacheObject(CacheConstants.WX_MPMESSAGE_PNAME +proId,proName,30, TimeUnit.MINUTES);
|
||||
return proName;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询微信用户列表
|
||||
* @param userName
|
||||
* @return
|
||||
*/
|
||||
private String getMsgId(String userName){
|
||||
String openIds = Convert.toStr(redisCache.getCacheObject(CacheConstants.WX_MPMESSAGE_OPENID +userName));
|
||||
if(StringUtils.isNotEmpty(openIds)){
|
||||
return openIds;
|
||||
}else{
|
||||
List<SysUserOpenid> list = sysUserOpenidMapper.findSysUserOpenidsByUser(userName);
|
||||
if(StringUtils.isNotEmpty(list)){
|
||||
List<SysUserOpenid> ids = list.stream().filter(u -> StringUtils.isNotBlank(u.getMsgOpenId())).collect(Collectors.toList());
|
||||
if(StringUtils.isNotEmpty(ids)){
|
||||
List<String> strs = ids.stream().map(SysUserOpenid :: getMsgOpenId).collect(Collectors.toList());
|
||||
openIds = String.join(",",strs);
|
||||
}
|
||||
}
|
||||
//设置30分钟有效期
|
||||
redisCache.setCacheObject(CacheConstants.WX_MPMESSAGE_OPENID +userName,openIds,30, TimeUnit.MINUTES);
|
||||
return openIds;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板消息开关
|
||||
*/
|
||||
private boolean wxSwitch = false;
|
||||
|
||||
/**
|
||||
* 推送模板消息
|
||||
* @param lsit
|
||||
*/
|
||||
private void send(List<WxMpTemplateMessage> lsit, String messageType){
|
||||
try {
|
||||
wxSwitch = Convert.toBool(configService.selectConfigByKey("sys.wx.message"),false);
|
||||
if(wxSwitch && StringUtils.isNotEmpty(lsit)){
|
||||
for(WxMpTemplateMessage message:lsit){
|
||||
if(StringUtils.isNotEmpty(message.getToUser())){
|
||||
String[] toUsers = message.getToUser().split(",");
|
||||
for(String toUser:toUsers){
|
||||
//判断短时间内是否已发送相同类型的消息
|
||||
String key = CacheConstants.WX_MPMESSAGE_KEY +toUser+"-"+messageType;
|
||||
if(Convert.toBool(redisCache.getCacheObject(key),true)){
|
||||
//多个登录账号时批量发送
|
||||
message.setToUser(toUser);
|
||||
wxMpService.getTemplateMsgService().sendTemplateMsg(message);
|
||||
//5分钟内不推送相同类型的消息
|
||||
redisCache.setCacheObject(key,false,5, TimeUnit.MINUTES);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.info("出错了...{}",e.getMessage());
|
||||
try {
|
||||
JSONObject jsonObject = JSONObject.parseObject(e.getMessage());
|
||||
if(Objects.equals(jsonObject.getString("errcode"),"40164")){
|
||||
String ip = jsonObject.getString("errmsg").split("ipv6")[0].split(" ")[2];
|
||||
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
|
||||
.toUser("oM5rN6Wb8UyBLuTAFNGjnZCeQs1U")
|
||||
.templateId(TemplateMessageEnum.SERVER_ERROR.getId())
|
||||
.build();
|
||||
templateMessage.addWxMpTemplateData(new WxMpTemplateData("character_string7", "IP>"+ip));
|
||||
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time6", DateUtils.dateTimeNow()));
|
||||
wxMpService.getTemplateMsgService().sendTemplateMsg(templateMessage);
|
||||
}
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
package com.ruoyi.flowable.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.system.domain.FlowTaskEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author JiangYuQi
|
||||
* @date 2021-04-03 14:41
|
||||
*/
|
||||
public interface IFlowBusinessKeyService {
|
||||
|
||||
/**
|
||||
* 根据条件查询所有流程任务
|
||||
* @param flowTaskEntity
|
||||
* @return
|
||||
*/
|
||||
public List<FlowTaskEntity> selectAllFlowTaskByParams(FlowTaskEntity flowTaskEntity);
|
||||
|
||||
/**
|
||||
* 根据条件查询流程任务
|
||||
* @param procInsId
|
||||
* @return
|
||||
*/
|
||||
public FlowTaskEntity findFlowTaskByProcInsId(String procInsId);
|
||||
|
||||
/**
|
||||
* 查询项目信息
|
||||
* @param proId
|
||||
* @return
|
||||
*/
|
||||
public Map<String,Object> selectSurProjectById(Long proId);
|
||||
|
||||
/**
|
||||
* 根据条件统计所有流任务
|
||||
* @param flowTaskEntity
|
||||
* @return
|
||||
*/
|
||||
public Map<String,Object> quueryCount(FlowTaskEntity flowTaskEntity);
|
||||
|
||||
/**
|
||||
* 根据条件流程Id查询操作日志
|
||||
* @param procInsId
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> selectCommentByProcInsId(String procInsId);
|
||||
|
||||
/**
|
||||
* 根据条件流程Id查询操作日志
|
||||
* @param procInsId
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> selectLastCommentByProcInsId(String procInsId);
|
||||
|
||||
/**
|
||||
* 根据流程Id查询表单数据
|
||||
* @param procInsId
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> selectFormDatasByProcInsId(String procInsId);
|
||||
|
||||
/**
|
||||
* 查询我的代办任务
|
||||
* @param flowTaskEntity
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> selectMyAwaitFlowTask(FlowTaskEntity flowTaskEntity);
|
||||
|
||||
|
||||
/**
|
||||
* 根据条件查询我的代办分组数量统计
|
||||
* @param flowTaskEntity
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> findAwaitCountGroupByCategory(FlowTaskEntity flowTaskEntity);
|
||||
|
||||
/**
|
||||
* 查询我的已办任务
|
||||
* @param flowTaskEntity
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> selectMyFinishedFlowTask(FlowTaskEntity flowTaskEntity);
|
||||
|
||||
public List<FlowTaskEntity> groupByCategory(FlowTaskEntity where);
|
||||
|
||||
public List<FlowTaskEntity> groupByUnit(FlowTaskEntity where);
|
||||
|
||||
public List<FlowTaskEntity> listByUnit(FlowTaskEntity where);
|
||||
|
||||
public List<FlowTaskEntity> listByState(FlowTaskEntity where);
|
||||
|
||||
public List<FlowTaskEntity> groupByUnitTotal(FlowTaskEntity where);
|
||||
|
||||
public List<FlowTaskEntity> groupByUnitFinish(FlowTaskEntity where);
|
||||
|
||||
public List<FlowTaskEntity> groupByProject(long deptId,String proType);
|
||||
|
||||
/**
|
||||
* 根据条件查询安全类作业工作流列表
|
||||
* @param flowTaskEntity
|
||||
* @return
|
||||
*/
|
||||
public List<FlowTaskEntity> findSafetyWorkList(FlowTaskEntity flowTaskEntity);
|
||||
|
||||
public List<FlowTaskEntity> listByCategory(FlowTaskEntity where);
|
||||
|
||||
/**
|
||||
* 根据条件查询流程用户
|
||||
* @param businessKey 流程归属表单
|
||||
* @param candidateUsers 办理用户列表
|
||||
* @param candidateGroups 办理角色列表
|
||||
* @return
|
||||
*/
|
||||
public List<SysUser> findFlowTaskUsers(String businessKey, List<String> candidateUsers, List<String> candidateGroups);
|
||||
|
||||
/**
|
||||
* 工程管理-分包单位占比
|
||||
* @param where
|
||||
* @return
|
||||
*/
|
||||
public List<FlowTaskEntity> groupFlowBySubDeptType(FlowTaskEntity where);
|
||||
/**
|
||||
* 工程管理-分包单位资质审批明细
|
||||
* @param where
|
||||
* @return
|
||||
*/
|
||||
public List<FlowTaskEntity> listFlowBySubDeptType(FlowTaskEntity where);
|
||||
}
|
|
@ -2,10 +2,14 @@ package com.ruoyi.flowable.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.flowable.domain.vo.ProcKeyRole;
|
||||
import com.ruoyi.system.domain.FlowProcDefDto;
|
||||
import org.flowable.bpmn.model.FlowElement;
|
||||
import org.flowable.bpmn.model.UserTask;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -16,15 +20,29 @@ public interface IFlowDefinitionService {
|
|||
|
||||
boolean exist(String processDefinitionKey);
|
||||
|
||||
|
||||
/**
|
||||
* 流程定义列表
|
||||
*
|
||||
* @param roleId 发起角色
|
||||
* @param category 流程类别
|
||||
* @param name 流程名称
|
||||
* @param pageNum 当前页码
|
||||
* @param pageSize 每页条数
|
||||
* @return 流程定义分页列表数据
|
||||
*/
|
||||
Page<FlowProcDefDto> list(String name,Integer pageNum, Integer pageSize);
|
||||
Page<FlowProcDefDto> list(String roleId, String category, String name, Integer pageNum, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 流程定义列表
|
||||
*
|
||||
* @param username 用户名称
|
||||
* @param category 流程类别
|
||||
* @param name 流程名称
|
||||
* @param pageNum 当前页码
|
||||
* @param pageSize 每页条数
|
||||
* @return 流程定义分页列表数据
|
||||
*/
|
||||
Page<FlowProcDefDto> myList(String username, String category,String name,Integer pageNum, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 导入流程文件
|
||||
|
@ -51,8 +69,7 @@ public interface IFlowDefinitionService {
|
|||
* @return
|
||||
*/
|
||||
|
||||
AjaxResult startProcessInstanceById(String procDefId, Map<String, Object> variables);
|
||||
|
||||
AjaxResult startProcessInstanceById(String procDefId, String userId, String nickName, Map<String, Object> variables);
|
||||
|
||||
/**
|
||||
* 激活或挂起流程定义
|
||||
|
@ -77,4 +94,33 @@ public interface IFlowDefinitionService {
|
|||
* @return
|
||||
*/
|
||||
InputStream readImage(String deployId);
|
||||
|
||||
/**
|
||||
* 读取流程节点
|
||||
* @param deployId
|
||||
* @return
|
||||
*/
|
||||
public List<FlowElement> readNodes(String deployId);
|
||||
|
||||
/**
|
||||
* 流程发起角色设置
|
||||
* @param roleId 角色主键
|
||||
* @param keys 流程定义
|
||||
* @return
|
||||
*/
|
||||
public void updateProcKeyByRoleId(String roleId,List<String> keys);
|
||||
|
||||
/**
|
||||
* 流程发起排序设置
|
||||
* @param procKeyRole 流程
|
||||
* @return
|
||||
*/
|
||||
public void updateProcKeyRoleSort(ProcKeyRole procKeyRole);
|
||||
|
||||
/**
|
||||
* 读取流程节点
|
||||
* @param deployId
|
||||
* @return
|
||||
*/
|
||||
public List<UserTask> findFlowNodes(String deployId);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,225 @@
|
|||
package com.ruoyi.flowable.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.flowable.service.IFlowBusinessKeyService;
|
||||
import com.ruoyi.system.domain.FlowTaskEntity;
|
||||
import com.ruoyi.system.mapper.FlowBusinessKeyMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 业务工作流程自定义
|
||||
*
|
||||
* @author Tony
|
||||
* @date 2021-04-03
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class FlowBusinessKeyServiceImpl implements IFlowBusinessKeyService {
|
||||
|
||||
@Resource
|
||||
private FlowBusinessKeyMapper flowBusinessKeyMapper;
|
||||
/**
|
||||
* 根据条件查询所有流任务
|
||||
* @param flowTaskEntity
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<FlowTaskEntity> selectAllFlowTaskByParams(FlowTaskEntity flowTaskEntity) {
|
||||
return flowBusinessKeyMapper.selectAllFlowTaskByParams(flowTaskEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询流程任务
|
||||
* @param procInsId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public FlowTaskEntity findFlowTaskByProcInsId(String procInsId) {
|
||||
return flowBusinessKeyMapper.findFlowTaskByProcInsId(procInsId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询项目信息
|
||||
* @param proId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String,Object> selectSurProjectById(Long proId) {
|
||||
return flowBusinessKeyMapper.selectSurProjectById(proId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件统计所有流任务
|
||||
* @param flowTaskEntity
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String,Object> quueryCount(FlowTaskEntity flowTaskEntity) {
|
||||
flowTaskEntity.setActiveName("await");
|
||||
int awaitSize = flowBusinessKeyMapper.selectAllFlowTaskByParams(flowTaskEntity).size();
|
||||
flowTaskEntity.setActiveName("finished");
|
||||
int finishedSize = flowBusinessKeyMapper.selectAllFlowTaskByParams(flowTaskEntity).size();
|
||||
Map<String, Object> dataMap = new HashMap<>();
|
||||
dataMap.put("await",awaitSize);
|
||||
dataMap.put("finished",finishedSize);
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件流程Id查询操作日志
|
||||
* @param procInsId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> selectCommentByProcInsId(String procInsId) {
|
||||
return flowBusinessKeyMapper.selectCommentByProcInsId(procInsId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件流程Id查询操作日志
|
||||
* @param procInsId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> selectLastCommentByProcInsId(String procInsId){
|
||||
return flowBusinessKeyMapper.selectLastCommentByProcInsId(procInsId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据流程Id查询表单数据
|
||||
* @param procInsId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> selectFormDatasByProcInsId(String procInsId) {
|
||||
Map<String, Object> dataMap = new HashMap<>();
|
||||
List<Map<String, Object>> list = flowBusinessKeyMapper.selectFormDatasByProcInsId(procInsId);
|
||||
Iterator<Map<String, Object>> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
Map<String, Object> map = it.next();
|
||||
dataMap.put(Convert.toStr(map.get("name")), map.get("text"));
|
||||
}
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询我的代办任务
|
||||
* @param flowTaskEntity
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> selectMyAwaitFlowTask(FlowTaskEntity flowTaskEntity){
|
||||
return flowBusinessKeyMapper.selectMyAwaitFlowTask(flowTaskEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询我的代办分组数量统计
|
||||
* @param flowTaskEntity
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> findAwaitCountGroupByCategory(FlowTaskEntity flowTaskEntity){
|
||||
return flowBusinessKeyMapper.findAwaitCountGroupByCategory(flowTaskEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询我的已办任务
|
||||
* @param flowTaskEntity
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> selectMyFinishedFlowTask(FlowTaskEntity flowTaskEntity) {
|
||||
return flowBusinessKeyMapper.selectMyFinishedFlowTask(flowTaskEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskEntity> groupByCategory(FlowTaskEntity where) {
|
||||
return flowBusinessKeyMapper.groupByCategory(where);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskEntity> groupByUnit(FlowTaskEntity where) {
|
||||
return flowBusinessKeyMapper.groupByUnit(where);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskEntity> listByUnit(FlowTaskEntity where) {
|
||||
return flowBusinessKeyMapper.listByUnit(where);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskEntity> listByState(FlowTaskEntity where) {
|
||||
return flowBusinessKeyMapper.listByState(where);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskEntity> groupByUnitTotal(FlowTaskEntity where) {
|
||||
return flowBusinessKeyMapper.groupByUnitTotal(where);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskEntity> groupByUnitFinish(FlowTaskEntity where) {
|
||||
return flowBusinessKeyMapper.groupByUnitFinish(where);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskEntity> groupByProject(long deptId,String proType) {
|
||||
return flowBusinessKeyMapper.groupByProject(deptId,proType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询安全类作业工作流列表
|
||||
* @param flowTaskEntity
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<FlowTaskEntity> findSafetyWorkList(FlowTaskEntity flowTaskEntity) {
|
||||
return flowBusinessKeyMapper.findSafetyWorkList(flowTaskEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskEntity> listByCategory(FlowTaskEntity where) {
|
||||
return flowBusinessKeyMapper.listByCategory(where);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询流程用户
|
||||
* @param businessKey 流程归属表单
|
||||
* @param candidateUsers 办理用户列表
|
||||
* @param candidateGroups 办理角色列表
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> findFlowTaskUsers(String businessKey, List<String> candidateUsers, List<String> candidateGroups){
|
||||
if(StringUtils.isNotEmpty(candidateGroups) && candidateGroups.contains("47")){
|
||||
return flowBusinessKeyMapper.findFlowTaskDeptUsers(businessKey,candidateUsers,candidateGroups);
|
||||
}else{
|
||||
return flowBusinessKeyMapper.findFlowTaskUsers(businessKey,candidateUsers,candidateGroups);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 工程管理-分包单位占比
|
||||
* @param where
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<FlowTaskEntity> groupFlowBySubDeptType(FlowTaskEntity where) {
|
||||
return flowBusinessKeyMapper.groupFlowBySubDeptType(where);
|
||||
}
|
||||
/**
|
||||
* 工程管理-分包单位资质审批明细
|
||||
* @param where
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<FlowTaskEntity> listFlowBySubDeptType(FlowTaskEntity where) {
|
||||
return flowBusinessKeyMapper.listFlowBySubDeptType(where);
|
||||
}
|
||||
|
||||
}
|
|
@ -3,32 +3,39 @@ package com.ruoyi.flowable.service.impl;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.flowable.common.constant.ProcessConstants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.flowable.common.enums.FlowComment;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.flowable.domain.vo.ProcKeyRole;
|
||||
import com.ruoyi.flowable.service.IFlowBusinessKeyService;
|
||||
import com.ruoyi.system.domain.FlowProcDefDto;
|
||||
import com.ruoyi.flowable.factory.FlowServiceFactory;
|
||||
import com.ruoyi.flowable.service.IFlowDefinitionService;
|
||||
import com.ruoyi.flowable.service.ISysDeployFormService;
|
||||
import com.ruoyi.system.domain.FlowTaskEntity;
|
||||
import com.ruoyi.system.domain.SysForm;
|
||||
import com.ruoyi.system.mapper.FlowBusinessKeyMapper;
|
||||
import com.ruoyi.system.mapper.FlowDeployMapper;
|
||||
import com.ruoyi.system.service.ISysDeptService;
|
||||
import com.ruoyi.system.service.ISysPostService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.flowable.bpmn.model.BpmnModel;
|
||||
import org.flowable.bpmn.model.FlowElement;
|
||||
import org.flowable.bpmn.model.UserTask;
|
||||
import org.flowable.engine.repository.Deployment;
|
||||
import org.flowable.engine.repository.ProcessDefinition;
|
||||
import org.flowable.engine.repository.ProcessDefinitionQuery;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.flowable.image.impl.DefaultProcessDiagramGenerator;
|
||||
import org.flowable.task.api.Task;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
|
@ -61,6 +68,9 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
|
|||
@Resource
|
||||
private FlowDeployMapper flowDeployMapper;
|
||||
|
||||
@Autowired
|
||||
private FlowBusinessKeyMapper flowBusinessKeyMapper;
|
||||
|
||||
private static final String BPMN_FILE_SUFFIX = ".bpmn";
|
||||
|
||||
@Override
|
||||
|
@ -75,52 +85,57 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
|
|||
/**
|
||||
* 流程定义列表
|
||||
*
|
||||
* @param roleId 发起角色
|
||||
* @param category 流程类别
|
||||
* @param name 流程名称
|
||||
* @param pageNum 当前页码
|
||||
* @param pageSize 每页条数
|
||||
* @return 流程定义分页列表数据
|
||||
*/
|
||||
@Override
|
||||
public Page<FlowProcDefDto> list(String name, Integer pageNum, Integer pageSize) {
|
||||
public Page<FlowProcDefDto> list(String roleId, String category, String name, Integer pageNum, Integer pageSize) {
|
||||
Page<FlowProcDefDto> page = new Page<>();
|
||||
// // 流程定义列表数据查询
|
||||
// final ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
|
||||
// if (StringUtils.isNotEmpty(name)) {
|
||||
// processDefinitionQuery.processDefinitionNameLike(name);
|
||||
// }
|
||||
//// processDefinitionQuery.orderByProcessDefinitionKey().asc();
|
||||
// page.setTotal(processDefinitionQuery.count());
|
||||
// List<ProcessDefinition> processDefinitionList = processDefinitionQuery.listPage(pageSize * (pageNum - 1), pageSize);
|
||||
//
|
||||
// List<FlowProcDefDto> dataList = new ArrayList<>();
|
||||
// for (ProcessDefinition processDefinition : processDefinitionList) {
|
||||
// String deploymentId = processDefinition.getDeploymentId();
|
||||
// Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
|
||||
// FlowProcDefDto reProcDef = new FlowProcDefDto();
|
||||
// BeanUtils.copyProperties(processDefinition, reProcDef);
|
||||
// SysForm sysForm = sysDeployFormService.selectSysDeployFormByDeployId(deploymentId);
|
||||
// if (Objects.nonNull(sysForm)) {
|
||||
// reProcDef.setFormName(sysForm.getFormName());
|
||||
// reProcDef.setFormId(sysForm.getFormId());
|
||||
// }
|
||||
// // 流程定义时间
|
||||
// reProcDef.setDeploymentTime(deployment.getDeploymentTime());
|
||||
// dataList.add(reProcDef);
|
||||
// }
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
final List<FlowProcDefDto> dataList = flowDeployMapper.selectDeployList(name);
|
||||
final List<FlowProcDefDto> dataList = flowDeployMapper.selectDeployList(roleId,category,name);
|
||||
// 加载挂表单
|
||||
for (FlowProcDefDto procDef : dataList) {
|
||||
SysForm sysForm = sysDeployFormService.selectSysDeployFormByDeployId(procDef.getDeploymentId());
|
||||
if (Objects.nonNull(sysForm)) {
|
||||
procDef.setFormName(sysForm.getFormName());
|
||||
procDef.setFormId(sysForm.getFormId());
|
||||
}
|
||||
}
|
||||
//for (FlowProcDefDto procDef : dataList) {
|
||||
// SysForm sysForm = sysDeployFormService.selectSysDeployFormByDeployId(procDef.getDeploymentId());
|
||||
// if (Objects.nonNull(sysForm)) {
|
||||
// procDef.setFormName(sysForm.getFormName());
|
||||
// procDef.setFormId(sysForm.getFormId());
|
||||
// }
|
||||
//}
|
||||
page.setTotal(new PageInfo(dataList).getTotal());
|
||||
page.setRecords(dataList);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程定义列表
|
||||
*
|
||||
* @param category 流程类别
|
||||
* @param name 流程名称
|
||||
* @param pageNum 当前页码
|
||||
* @param pageSize 每页条数
|
||||
* @return 流程定义分页列表数据
|
||||
*/
|
||||
@Override
|
||||
public Page<FlowProcDefDto> myList(String username, String category, String name, Integer pageNum, Integer pageSize) {
|
||||
Page<FlowProcDefDto> page = new Page<>();
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
final List<FlowProcDefDto> dataList = flowDeployMapper.selectMyDeployList(username, category ,name);
|
||||
// 加载挂表单
|
||||
//for (FlowProcDefDto procDef : dataList) {
|
||||
// SysForm sysForm = sysDeployFormService.selectSysDeployFormByDeployId(procDef.getDeploymentId());
|
||||
// if (Objects.nonNull(sysForm)) {
|
||||
// procDef.setFormName(sysForm.getFormName());
|
||||
// procDef.setFormId(sysForm.getFormId());
|
||||
// }
|
||||
//}
|
||||
page.setTotal(new PageInfo(dataList).getTotal());
|
||||
page.setRecords(dataList);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入流程文件
|
||||
|
@ -180,6 +195,42 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取流程节点
|
||||
* @param deployId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<FlowElement> readNodes(String deployId) {
|
||||
List<FlowElement> list = new ArrayList<>();
|
||||
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deployId).singleResult();
|
||||
//获得图片流
|
||||
DefaultProcessDiagramGenerator diagramGenerator = new DefaultProcessDiagramGenerator();
|
||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId());
|
||||
Collection<FlowElement> flowElements = bpmnModel.getProcesses().get(0).getFlowElements();
|
||||
if(flowElements.size()>0){
|
||||
for(FlowElement fe:flowElements){
|
||||
list.add(fe);
|
||||
}
|
||||
}
|
||||
//输出为节点描述
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取流程节点
|
||||
* @param deployId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<UserTask> findFlowNodes(String deployId){
|
||||
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deployId).singleResult();
|
||||
//获得图片流
|
||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId());
|
||||
List<UserTask> list = bpmnModel.getProcesses().get(0).findFlowElementsOfType(UserTask.class);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据流程定义ID启动流程实例
|
||||
*
|
||||
|
@ -188,30 +239,45 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult startProcessInstanceById(String procDefId, Map<String, Object> variables) {
|
||||
@Transactional
|
||||
public AjaxResult startProcessInstanceById(String procDefId, String userId, String nickName, Map<String, Object> variables) {
|
||||
try {
|
||||
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(procDefId)
|
||||
.latestVersion().singleResult();
|
||||
if (Objects.nonNull(processDefinition) && processDefinition.isSuspended()) {
|
||||
return AjaxResult.error("流程已被挂起,请先激活流程");
|
||||
return AjaxResult.error("流程已被挂起,请联系管理员先激活流程");
|
||||
}
|
||||
/*try {
|
||||
//分包单位资质审批需要验证是否已经提交过相关审批
|
||||
if(Objects.equals("9",processDefinition.getCategory())){
|
||||
FlowTaskEntity flowTaskEntity = new FlowTaskEntity();
|
||||
flowTaskEntity.setBusinessKey(Convert.toStr(variables.get("businessKey")));
|
||||
flowTaskEntity.setProcDefKey(processDefinition.getKey());
|
||||
flowTaskEntity.setStartDeptName(SecurityUtils.getLoginUser().getUser().getDept().getDeptName());
|
||||
List<FlowTaskEntity> list = flowBusinessKeyMapper.selectAllFlowTaskByParams(flowTaskEntity);
|
||||
if(StringUtils.isNotEmpty(list)){
|
||||
return AjaxResult.error("当前单位已提交过分包单位资质审批,请勿重复提交");
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}*/
|
||||
// 设置流程发起人Id到流程中
|
||||
SysUser sysUser = SecurityUtils.getLoginUser().getUser();
|
||||
identityService.setAuthenticatedUserId(sysUser.getUserId().toString());
|
||||
variables.put(ProcessConstants.PROCESS_INITIATOR, sysUser.getUserId());
|
||||
runtimeService.startProcessInstanceById(procDefId, variables);
|
||||
// 流程发起时 跳过发起人节点
|
||||
// SysUser sysUser = SecurityUtils.getLoginUser().getUser();
|
||||
// identityService.setAuthenticatedUserId(sysUser.getUserId().toString());
|
||||
// variables.put(ProcessConstants.PROCESS_INITIATOR, "");
|
||||
// ProcessInstance processInstance = runtimeService.startProcessInstanceById(procDefId, variables);
|
||||
// // 给第一步申请人节点设置任务执行人和意见
|
||||
// Task task = taskService.createTaskQuery().processInstanceId(processInstance.getProcessInstanceId()).singleResult();
|
||||
// if (Objects.nonNull(task)) {
|
||||
// taskService.addComment(task.getId(), processInstance.getProcessInstanceId(), FlowComment.NORMAL.getType(), sysUser.getNickName() + "发起流程申请");
|
||||
//// taskService.setAssignee(task.getId(), sysUser.getUserId().toString());
|
||||
// taskService.complete(task.getId(), variables);
|
||||
// }
|
||||
identityService.setAuthenticatedUserId(userId);
|
||||
variables.put(ProcessConstants.PROCESS_INITIATOR, userId);
|
||||
ProcessInstance processInstance;
|
||||
if(variables.get("businessKey")!=null){
|
||||
processInstance = runtimeService.startProcessInstanceById(procDefId, Convert.toStr(variables.get("businessKey")),variables);
|
||||
}else{
|
||||
processInstance = runtimeService.startProcessInstanceById(procDefId, variables);
|
||||
}
|
||||
// 给第一步申请人节点设置任务执行人和意见
|
||||
Task task = taskService.createTaskQuery().processInstanceId(processInstance.getProcessInstanceId()).singleResult();
|
||||
if (Objects.nonNull(task)) {
|
||||
taskService.addComment(task.getId(), processInstance.getProcessInstanceId(), FlowComment.NORMAL.getType(), nickName + "发起流程申请");
|
||||
taskService.setAssignee(task.getId(), Convert.toStr(userId));
|
||||
taskService.complete(task.getId(), variables);
|
||||
}
|
||||
return AjaxResult.success("流程启动成功");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -251,5 +317,35 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
|
|||
repositoryService.deleteDeployment(deployId, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程发起角色设置
|
||||
* @param roleId 角色主键
|
||||
* @param keys 流程定义
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void updateProcKeyByRoleId(String roleId,List<String> keys) {
|
||||
//根据角色删除原有流程定义
|
||||
flowDeployMapper.deleteDeployByRoleId(roleId);
|
||||
if(keys.size()>0){
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for(int i=0;i<keys.size();i++){
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("key",keys.get(i));
|
||||
map.put("roleId",roleId);
|
||||
list.add(map);
|
||||
}
|
||||
flowDeployMapper.batchDeployRoleRole(list);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程发起排序设置
|
||||
* @param procKeyRole
|
||||
* @return
|
||||
*/
|
||||
public void updateProcKeyRoleSort(ProcKeyRole procKeyRole) {
|
||||
flowDeployMapper.updateProcKeyRoleSort(procKeyRole.getRoleId(),procKeyRole.getKey(),procKeyRole.getSort());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,12 +9,9 @@ import com.ruoyi.flowable.service.IFlowInstanceService;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.common.engine.api.FlowableObjectNotFoundException;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
import org.flowable.task.api.Task;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package com.ruoyi.flowable.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.fastjson2.TypeReference;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.flowable.common.constant.ProcessConstants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
|
@ -24,10 +24,12 @@ import com.ruoyi.flowable.factory.FlowServiceFactory;
|
|||
import com.ruoyi.flowable.flow.CustomProcessDiagramGenerator;
|
||||
import com.ruoyi.flowable.flow.FindNextNodeUtil;
|
||||
import com.ruoyi.flowable.flow.FlowableUtils;
|
||||
import com.ruoyi.flowable.flow.ModelUtils;
|
||||
import com.ruoyi.flowable.service.IFlowTaskService;
|
||||
import com.ruoyi.flowable.service.ISysDeployFormService;
|
||||
import com.ruoyi.flowable.service.ISysFormService;
|
||||
import com.ruoyi.system.domain.SysForm;
|
||||
import com.ruoyi.system.mapper.FlowBusinessKeyMapper;
|
||||
import com.ruoyi.system.service.ISysRoleService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -44,7 +46,6 @@ import org.flowable.engine.history.HistoricActivityInstance;
|
|||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
import org.flowable.engine.history.HistoricProcessInstanceQuery;
|
||||
import org.flowable.engine.repository.ProcessDefinition;
|
||||
import org.flowable.engine.runtime.ActivityInstance;
|
||||
import org.flowable.engine.runtime.Execution;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.flowable.engine.task.Comment;
|
||||
|
@ -86,6 +87,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|||
private ISysDeployFormService sysInstanceFormService;
|
||||
@Resource
|
||||
private ISysFormService sysFormService;
|
||||
@Resource
|
||||
private FlowBusinessKeyMapper flowBusinessKeyMapper;
|
||||
|
||||
/**
|
||||
* 完成任务
|
||||
|
@ -103,9 +106,12 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|||
taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.DELEGATE.getType(), taskVo.getComment());
|
||||
taskService.resolveTask(taskVo.getTaskId(), taskVo.getVariables());
|
||||
} else {
|
||||
taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getType(), taskVo.getComment());
|
||||
Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
|
||||
taskService.setAssignee(taskVo.getTaskId(), userId.toString());
|
||||
if(StringUtils.isNotEmpty(taskVo.getComment())){
|
||||
taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getType(), taskVo.getComment());
|
||||
}else{
|
||||
taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getType(), taskVo.getAssignee()+"重新提交流程申请!!");
|
||||
}
|
||||
taskService.setAssignee(taskVo.getTaskId(), taskVo.getUserId());
|
||||
taskService.complete(taskVo.getTaskId(), taskVo.getVariables());
|
||||
}
|
||||
return AjaxResult.success();
|
||||
|
@ -182,7 +188,6 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// 目的获取所有需要被跳转的节点 currentIds
|
||||
// 取其中一个父级任务,因为后续要么存在公共网关,要么就是串行公共线路
|
||||
UserTask oneUserTask = parentUserTaskList.get(0);
|
||||
|
@ -210,8 +215,9 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|||
}
|
||||
}));
|
||||
// 设置驳回意见
|
||||
currentTaskIds.forEach(item -> taskService.addComment(item, task.getProcessInstanceId(), FlowComment.REJECT.getType(), flowTaskVo.getComment()));
|
||||
|
||||
currentTaskIds.forEach(item ->
|
||||
taskService.addComment(item, task.getProcessInstanceId(), FlowComment.REJECT.getType(), flowTaskVo.getComment()));
|
||||
taskService.setAssignee(flowTaskVo.getTaskId(), flowTaskVo.getUserId());
|
||||
try {
|
||||
// 如果父级任务多于 1 个,说明当前节点不是并行节点,原因为不考虑多对多情况
|
||||
if (targetIds.size() > 1) {
|
||||
|
@ -299,6 +305,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|||
}));
|
||||
// 设置回退意见
|
||||
currentTaskIds.forEach(currentTaskId -> taskService.addComment(currentTaskId, task.getProcessInstanceId(), FlowComment.REBACK.getType(), flowTaskVo.getComment()));
|
||||
taskService.setAssignee(flowTaskVo.getTaskId(), flowTaskVo.getUserId());
|
||||
|
||||
try {
|
||||
// 1 对 1 或 多 对 1 情况,currentIds 当前要跳转的节点列表(1或多),targetKey 跳转到的节点(1)
|
||||
|
@ -521,58 +528,59 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|||
List<HistoricProcessInstance> historicProcessInstances = historicProcessInstanceQuery.listPage(queryVo.getPageSize() * (queryVo.getPageNum() - 1), queryVo.getPageSize());
|
||||
page.setTotal(historicProcessInstanceQuery.count());
|
||||
List<FlowTaskDto> flowList = new ArrayList<>();
|
||||
for (HistoricProcessInstance hisIns : historicProcessInstances) {
|
||||
FlowTaskDto flowTask = new FlowTaskDto();
|
||||
flowTask.setCreateTime(hisIns.getStartTime());
|
||||
flowTask.setFinishTime(hisIns.getEndTime());
|
||||
flowTask.setProcInsId(hisIns.getId());
|
||||
|
||||
// 计算耗时
|
||||
if (Objects.nonNull(hisIns.getEndTime())) {
|
||||
long time = hisIns.getEndTime().getTime() - hisIns.getStartTime().getTime();
|
||||
flowTask.setDuration(getDate(time));
|
||||
} else {
|
||||
long time = System.currentTimeMillis() - hisIns.getStartTime().getTime();
|
||||
flowTask.setDuration(getDate(time));
|
||||
}
|
||||
// 流程定义信息
|
||||
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery()
|
||||
.processDefinitionId(hisIns.getProcessDefinitionId())
|
||||
.singleResult();
|
||||
flowTask.setDeployId(pd.getDeploymentId());
|
||||
flowTask.setProcDefName(pd.getName());
|
||||
flowTask.setProcDefVersion(pd.getVersion());
|
||||
flowTask.setCategory(pd.getCategory());
|
||||
flowTask.setProcDefVersion(pd.getVersion());
|
||||
// 当前所处流程
|
||||
List<Task> taskList = taskService.createTaskQuery().processInstanceId(hisIns.getId()).list();
|
||||
if (CollectionUtils.isNotEmpty(taskList)) {
|
||||
flowTask.setTaskId(taskList.get(0).getId());
|
||||
flowTask.setTaskName(taskList.get(0).getName());
|
||||
if (StringUtils.isNotBlank(taskList.get(0).getAssignee())) {
|
||||
// 当前任务节点办理人信息
|
||||
SysUser sysUser = sysUserService.selectUserById(Long.parseLong(taskList.get(0).getAssignee()));
|
||||
if (Objects.nonNull(sysUser)) {
|
||||
flowTask.setAssigneeId(sysUser.getUserId());
|
||||
flowTask.setAssigneeName(sysUser.getNickName());
|
||||
flowTask.setAssigneeDeptName(Objects.nonNull(sysUser.getDept()) ? sysUser.getDept().getDeptName() : "");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<HistoricTaskInstance> historicTaskInstance = historyService.createHistoricTaskInstanceQuery().processInstanceId(hisIns.getId()).orderByHistoricTaskInstanceEndTime().desc().list();
|
||||
flowTask.setTaskId(historicTaskInstance.get(0).getId());
|
||||
flowTask.setTaskName(historicTaskInstance.get(0).getName());
|
||||
if (StringUtils.isNotBlank(historicTaskInstance.get(0).getAssignee())) {
|
||||
// 当前任务节点办理人信息
|
||||
SysUser sysUser = sysUserService.selectUserById(Long.parseLong(historicTaskInstance.get(0).getAssignee()));
|
||||
if (Objects.nonNull(sysUser)) {
|
||||
flowTask.setAssigneeId(sysUser.getUserId());
|
||||
flowTask.setAssigneeName(sysUser.getNickName());
|
||||
flowTask.setAssigneeDeptName(Objects.nonNull(sysUser.getDept()) ? sysUser.getDept().getDeptName() : "");
|
||||
if(CollectionUtils.isNotEmpty(historicProcessInstances)){
|
||||
for (HistoricProcessInstance hisIns : historicProcessInstances) {
|
||||
FlowTaskDto flowTask = new FlowTaskDto();
|
||||
flowTask.setCreateTime(hisIns.getStartTime());
|
||||
flowTask.setFinishTime(hisIns.getEndTime());
|
||||
flowTask.setProcInsId(hisIns.getId());
|
||||
// 计算耗时
|
||||
if (Objects.nonNull(hisIns.getEndTime())) {
|
||||
long time = hisIns.getEndTime().getTime() - hisIns.getStartTime().getTime();
|
||||
flowTask.setDuration(getDate(time));
|
||||
} else {
|
||||
long time = System.currentTimeMillis() - hisIns.getStartTime().getTime();
|
||||
flowTask.setDuration(getDate(time));
|
||||
}
|
||||
// 流程定义信息
|
||||
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery()
|
||||
.processDefinitionId(hisIns.getProcessDefinitionId())
|
||||
.singleResult();
|
||||
flowTask.setDeployId(pd.getDeploymentId());
|
||||
flowTask.setProcDefName(pd.getName());
|
||||
flowTask.setProcDefVersion(pd.getVersion());
|
||||
flowTask.setCategory(pd.getCategory());
|
||||
flowTask.setProcDefVersion(pd.getVersion());
|
||||
// 当前所处流程
|
||||
List<Task> taskList = taskService.createTaskQuery().processInstanceId(hisIns.getId()).list();
|
||||
if (CollectionUtils.isNotEmpty(taskList)) {
|
||||
flowTask.setTaskId(taskList.get(0).getId());
|
||||
flowTask.setTaskName(taskList.get(0).getName());
|
||||
if (StringUtils.isNotBlank(taskList.get(0).getAssignee())) {
|
||||
// 当前任务节点办理人信息
|
||||
SysUser sysUser = sysUserService.selectUserById(Long.parseLong(taskList.get(0).getAssignee()));
|
||||
if (Objects.nonNull(sysUser)) {
|
||||
flowTask.setAssigneeId(sysUser.getUserId());
|
||||
flowTask.setAssigneeName(sysUser.getNickName());
|
||||
flowTask.setAssigneeDeptName(Objects.nonNull(sysUser.getDept()) ? sysUser.getDept().getDeptName() : "");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<HistoricTaskInstance> historicTaskInstance = historyService.createHistoricTaskInstanceQuery().processInstanceId(hisIns.getId()).orderByHistoricTaskInstanceEndTime().desc().list();
|
||||
flowTask.setTaskId(historicTaskInstance.get(0).getId());
|
||||
flowTask.setTaskName(historicTaskInstance.get(0).getName());
|
||||
if (StringUtils.isNotBlank(historicTaskInstance.get(0).getAssignee())) {
|
||||
// 当前任务节点办理人信息
|
||||
SysUser sysUser = sysUserService.selectUserById(Long.parseLong(historicTaskInstance.get(0).getAssignee()));
|
||||
if (Objects.nonNull(sysUser)) {
|
||||
flowTask.setAssigneeId(sysUser.getUserId());
|
||||
flowTask.setAssigneeName(sysUser.getNickName());
|
||||
flowTask.setAssigneeDeptName(Objects.nonNull(sysUser.getDept()) ? sysUser.getDept().getDeptName() : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
flowList.add(flowTask);
|
||||
}
|
||||
flowList.add(flowTask);
|
||||
}
|
||||
page.setRecords(flowList);
|
||||
return AjaxResult.success(page);
|
||||
|
@ -601,11 +609,10 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|||
List<EndEvent> endNodes = process.findFlowElementsOfType(EndEvent.class, false);
|
||||
if (CollectionUtils.isNotEmpty(endNodes)) {
|
||||
// TODO 取消流程为什么要设置流程发起人?
|
||||
// SysUser loginUser = SecurityUtils.getLoginUser().getUser();
|
||||
// Authentication.setAuthenticatedUserId(loginUser.getUserId().toString());
|
||||
|
||||
// taskService.addComment(task.getId(), processInstance.getProcessInstanceId(), FlowComment.STOP.getType(),
|
||||
// StringUtils.isBlank(flowTaskVo.getComment()) ? "取消申请" : flowTaskVo.getComment());
|
||||
Authentication.setAuthenticatedUserId(flowTaskVo.getUserId());
|
||||
taskService.addComment(task.get(0).getId(), processInstance.getProcessInstanceId(), FlowComment.STOP.getType(),
|
||||
StringUtils.isBlank(flowTaskVo.getComment()) ? "取消申请" : flowTaskVo.getComment());
|
||||
taskService.setAssignee(task.get(0).getId(), flowTaskVo.getUserId());
|
||||
// 获取当前流程最后一个节点
|
||||
String endId = endNodes.get(0).getId();
|
||||
List<Execution> executions = runtimeService.createExecutionQuery()
|
||||
|
@ -617,66 +624,75 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|||
.moveExecutionsToSingleActivityId(executionIds, endId).changeState();
|
||||
}
|
||||
}
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 撤回流程 目前存在错误
|
||||
* 撤回流程
|
||||
*
|
||||
* @param flowTaskVo
|
||||
* @return
|
||||
* @param flowTaskVo 请求实体参数
|
||||
*/
|
||||
@Override
|
||||
@Transactional()
|
||||
public AjaxResult revokeProcess(FlowTaskVo flowTaskVo) {
|
||||
Task task = taskService.createTaskQuery().processInstanceId(flowTaskVo.getInstanceId()).singleResult();
|
||||
if (task == null) {
|
||||
throw new CustomException("流程未启动或已执行完成,无法撤回");
|
||||
String procInsId = flowTaskVo.getInstanceId();
|
||||
String taskId = flowTaskVo.getTaskId();
|
||||
// 校验流程是否结束
|
||||
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
|
||||
.processInstanceId(procInsId)
|
||||
.active()
|
||||
.singleResult();
|
||||
if(ObjectUtil.isNull(processInstance)) {
|
||||
throw new RuntimeException("流程已结束或已挂起,无法执行撤回操作");
|
||||
}
|
||||
// 获取待撤回任务实例
|
||||
HistoricTaskInstance currTaskIns = historyService.createHistoricTaskInstanceQuery()
|
||||
.taskId(taskId)
|
||||
.taskAssignee(flowTaskVo.getUserId())
|
||||
.singleResult();
|
||||
if (ObjectUtil.isNull(currTaskIns)) {
|
||||
throw new RuntimeException("当前任务无法执行撤回操作或不存在。");
|
||||
}
|
||||
// 获取 bpmn 模型
|
||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(currTaskIns.getProcessDefinitionId());
|
||||
UserTask currUserTask = ModelUtils.getUserTaskByKey(bpmnModel, currTaskIns.getTaskDefinitionKey());
|
||||
// 查找下一级用户任务列表
|
||||
List<UserTask> nextUserTaskList = ModelUtils.findNextUserTasks(currUserTask);
|
||||
List<String> nextUserTaskKeys = nextUserTaskList.stream().map(UserTask::getId).collect(Collectors.toList());
|
||||
|
||||
SysUser loginUser = SecurityUtils.getLoginUser().getUser();
|
||||
List<HistoricTaskInstance> htiList = historyService.createHistoricTaskInstanceQuery()
|
||||
.processInstanceId(task.getProcessInstanceId())
|
||||
.orderByTaskCreateTime()
|
||||
.asc()
|
||||
// 获取当前节点之后已完成的流程历史节点
|
||||
List<HistoricTaskInstance> finishedTaskInsList = historyService.createHistoricTaskInstanceQuery()
|
||||
.processInstanceId(procInsId)
|
||||
.taskCreatedAfter(currTaskIns.getEndTime())
|
||||
.finished()
|
||||
.list();
|
||||
String myTaskId = null;
|
||||
HistoricTaskInstance myTask = null;
|
||||
for (HistoricTaskInstance hti : htiList) {
|
||||
if (loginUser.getUserId().toString().equals(hti.getAssignee())) {
|
||||
myTaskId = hti.getId();
|
||||
myTask = hti;
|
||||
break;
|
||||
for (HistoricTaskInstance finishedTaskInstance : finishedTaskInsList) {
|
||||
// 检查已完成流程历史节点是否存在下一级中
|
||||
if (CollUtil.contains(nextUserTaskKeys, finishedTaskInstance.getTaskDefinitionKey())) {
|
||||
throw new RuntimeException("下一流程已处理,无法执行撤回操作");
|
||||
}
|
||||
}
|
||||
if (null == myTaskId) {
|
||||
throw new CustomException("该任务非当前用户提交,无法撤回");
|
||||
}
|
||||
|
||||
String processDefinitionId = myTask.getProcessDefinitionId();
|
||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
|
||||
|
||||
//变量
|
||||
// Map<String, VariableInstance> variables = runtimeService.getVariableInstances(currentTask.getExecutionId());
|
||||
String myActivityId = null;
|
||||
List<HistoricActivityInstance> haiList = historyService.createHistoricActivityInstanceQuery()
|
||||
.executionId(myTask.getExecutionId()).finished().list();
|
||||
for (HistoricActivityInstance hai : haiList) {
|
||||
if (myTaskId.equals(hai.getTaskId())) {
|
||||
myActivityId = hai.getActivityId();
|
||||
break;
|
||||
// 获取所有激活的任务节点,找到需要撤回的任务
|
||||
List<Task> activateTaskList = taskService.createTaskQuery().processInstanceId(procInsId).list();
|
||||
List<String> revokeExecutionIds = new ArrayList<>();
|
||||
for (Task task : activateTaskList) {
|
||||
// 检查激活的任务节点是否存在下一级中,如果存在,则加入到需要撤回的节点
|
||||
if (CollUtil.contains(nextUserTaskKeys, task.getTaskDefinitionKey())) {
|
||||
// 添加撤回审批信息
|
||||
taskService.setAssignee(task.getId(), flowTaskVo.getUserId());
|
||||
taskService.addComment(task.getId(), task.getProcessInstanceId(), FlowComment.REVOKE.getType(), flowTaskVo.getAssignee() + "撤回流程审批");
|
||||
revokeExecutionIds.add(task.getExecutionId());
|
||||
}
|
||||
}
|
||||
FlowNode myFlowNode = (FlowNode) bpmnModel.getMainProcess().getFlowElement(myActivityId);
|
||||
|
||||
Execution execution = runtimeService.createExecutionQuery().executionId(task.getExecutionId()).singleResult();
|
||||
String activityId = execution.getActivityId();
|
||||
FlowNode flowNode = (FlowNode) bpmnModel.getMainProcess().getFlowElement(activityId);
|
||||
|
||||
//记录原活动方向
|
||||
List<SequenceFlow> oriSequenceFlows = new ArrayList<>(flowNode.getOutgoingFlows());
|
||||
|
||||
|
||||
try {
|
||||
runtimeService.createChangeActivityStateBuilder()
|
||||
.processInstanceId(procInsId)
|
||||
.moveExecutionsToSingleActivityId(revokeExecutionIds, currTaskIns.getTaskDefinitionKey()).changeState();
|
||||
} catch (FlowableObjectNotFoundException e) {
|
||||
throw new RuntimeException("未找到流程实例,流程可能已发生变化");
|
||||
} catch (FlowableException e) {
|
||||
throw new RuntimeException("执行撤回操作失败");
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
@ -879,13 +895,13 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|||
map.put("flowList", hisFlowList);
|
||||
}
|
||||
// 第一次申请获取初始化表单
|
||||
if (StringUtils.isNotBlank(deployId)) {
|
||||
SysForm sysForm = sysInstanceFormService.selectSysDeployFormByDeployId(deployId);
|
||||
if (Objects.isNull(sysForm)) {
|
||||
return AjaxResult.error("请先配置流程表单");
|
||||
}
|
||||
map.put("formData", JSONObject.parseObject(sysForm.getFormContent()));
|
||||
}
|
||||
// if (StringUtils.isNotBlank(deployId)) {
|
||||
// SysForm sysForm = sysInstanceFormService.selectSysDeployFormByDeployId(deployId);
|
||||
// if (Objects.isNull(sysForm)) {
|
||||
// return AjaxResult.error("请先配置流程表单");
|
||||
// }
|
||||
// map.put("formData", JSONObject.parseObject(sysForm.getFormContent()));
|
||||
// }
|
||||
return AjaxResult.success(map);
|
||||
}
|
||||
|
||||
|
@ -1119,36 +1135,39 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|||
public AjaxResult flowXmlAndNode(String procInsId, String deployId) {
|
||||
try {
|
||||
List<FlowViewerDto> flowViewerList = new ArrayList<>();
|
||||
// 获取已经完成的节点
|
||||
List<HistoricActivityInstance> listFinished = historyService.createHistoricActivityInstanceQuery()
|
||||
.processInstanceId(procInsId)
|
||||
.finished()
|
||||
.list();
|
||||
if(StringUtils.isNotEmpty(procInsId)){
|
||||
// 获取已经完成的节点
|
||||
List<HistoricActivityInstance> listFinished = historyService.createHistoricActivityInstanceQuery()
|
||||
.processInstanceId(procInsId)
|
||||
.finished()
|
||||
.list();
|
||||
|
||||
// 保存已经完成的流程节点编号
|
||||
listFinished.forEach(s -> {
|
||||
FlowViewerDto flowViewerDto = new FlowViewerDto();
|
||||
flowViewerDto.setKey(s.getActivityId());
|
||||
flowViewerDto.setCompleted(true);
|
||||
flowViewerList.add(flowViewerDto);
|
||||
});
|
||||
// 保存已经完成的流程节点编号
|
||||
listFinished.forEach(s -> {
|
||||
FlowViewerDto flowViewerDto = new FlowViewerDto();
|
||||
flowViewerDto.setKey(s.getActivityId());
|
||||
flowViewerDto.setCompleted(true);
|
||||
flowViewerList.add(flowViewerDto);
|
||||
});
|
||||
|
||||
// 获取代办节点
|
||||
List<HistoricActivityInstance> listUnFinished = historyService.createHistoricActivityInstanceQuery()
|
||||
.processInstanceId(procInsId)
|
||||
.unfinished()
|
||||
.list();
|
||||
// 获取代办节点
|
||||
List<HistoricActivityInstance> listUnFinished = historyService.createHistoricActivityInstanceQuery()
|
||||
.processInstanceId(procInsId)
|
||||
.unfinished()
|
||||
.list();
|
||||
|
||||
// 保存需要代办的节点编号
|
||||
listUnFinished.forEach(s -> {
|
||||
FlowViewerDto flowViewerDto = new FlowViewerDto();
|
||||
flowViewerDto.setKey(s.getActivityId());
|
||||
flowViewerDto.setCompleted(false);
|
||||
flowViewerList.add(flowViewerDto);
|
||||
});
|
||||
// 保存需要代办的节点编号
|
||||
listUnFinished.forEach(s -> {
|
||||
FlowViewerDto flowViewerDto = new FlowViewerDto();
|
||||
flowViewerDto.setKey(s.getActivityId());
|
||||
flowViewerDto.setCompleted(false);
|
||||
flowViewerList.add(flowViewerDto);
|
||||
});
|
||||
}
|
||||
Map<String, Object> result = new HashMap();
|
||||
// xmlData 数据
|
||||
ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().deploymentId(deployId).singleResult();
|
||||
|
||||
InputStream inputStream = repositoryService.getResourceAsStream(definition.getDeploymentId(), definition.getResourceName());
|
||||
String xmlData = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
|
||||
result.put("nodeData", flowViewerList);
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.ruoyi.framework.aspectj;
|
|||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
@ -84,7 +85,11 @@ public class LogAspect
|
|||
try
|
||||
{
|
||||
// 获取当前的用户
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
LoginUser loginUser = null;
|
||||
|
||||
if(!SecurityUtils.getAuthentication().getPrincipal().equals("anonymousUser")) {
|
||||
loginUser = SecurityUtils.getLoginUser();
|
||||
}
|
||||
|
||||
// *========数据库日志=========*//
|
||||
SysOperLog operLog = new SysOperLog();
|
||||
|
@ -96,6 +101,9 @@ public class LogAspect
|
|||
if (loginUser != null)
|
||||
{
|
||||
operLog.setOperName(loginUser.getUsername());
|
||||
/*********************getAuthentication未获取用户信息时,从RequestURI中获取操作人信息***************************/
|
||||
}else if(ServletUtils.getRequest().getHeader("Username")!=null){
|
||||
operLog.setOperName(ServletUtils.getRequest().getHeader("Username"));
|
||||
}
|
||||
|
||||
if (e != null)
|
||||
|
|
|
@ -111,7 +111,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
|
|||
// 过滤请求
|
||||
.authorizeRequests()
|
||||
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
|
||||
.antMatchers("/login", "/register", "/captchaImage", "/weixin/**","/bgscreen/**","/publics/**").permitAll()
|
||||
.antMatchers("/login","/wechat/**", "/common/**", "/register", "/captchaImage","/bgscreen/**","/publics/**","/system/dict/data/**").permitAll()
|
||||
// 静态资源,可匿名访问
|
||||
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/**/img/**", "/profile/**").permitAll()
|
||||
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
package com.ruoyi.framework.web.service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.authentication.BadCredentialsException;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
|
@ -37,6 +42,8 @@ import com.ruoyi.system.service.ISysUserService;
|
|||
@Component
|
||||
public class SysLoginService
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(SysLoginService.class);
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
|
@ -100,6 +107,107 @@ public class SysLoginService
|
|||
return tokenService.createToken(loginUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param password 密码
|
||||
* @param code 验证码
|
||||
* @param uuid 唯一标识
|
||||
* @return 结果
|
||||
*/
|
||||
public String wxLogin(String username, String password, String code, String uuid, String openId)
|
||||
{
|
||||
// 验证码校验
|
||||
validateCaptcha(username, code, uuid);
|
||||
// 登录前置校验
|
||||
loginPreCheck(username, password);
|
||||
// 用户验证
|
||||
Authentication authentication = null;
|
||||
try
|
||||
{
|
||||
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password);
|
||||
AuthenticationContextHolder.setContext(authenticationToken);
|
||||
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
|
||||
authentication = authenticationManager.authenticate(authenticationToken);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (e instanceof BadCredentialsException)
|
||||
{
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
|
||||
throw new UserPasswordNotMatchException();
|
||||
}
|
||||
else
|
||||
{
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage()));
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
AuthenticationContextHolder.clearContext();
|
||||
}
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
|
||||
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
|
||||
recordLoginInfo(loginUser.getUserId());
|
||||
// 生成token
|
||||
return tokenService.createWxToken(loginUser,openId);
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
private SysPermissionService permissionService;
|
||||
|
||||
/**
|
||||
* 小程序免密登录
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param openId 微信openId
|
||||
* @return 结果
|
||||
*/
|
||||
public String wxLogin(String username,String openId)
|
||||
{
|
||||
log.info("【"+username+"】免密登录...openId==>{}",openId);
|
||||
SysUser user = userService.selectUserByUserName(username);
|
||||
LoginUser loginUser = new LoginUser(user.getUserId(), user.getDeptId(), user, permissionService.getMenuPermission(user));
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
|
||||
recordLoginInfo(loginUser.getUserId());
|
||||
// 生成token
|
||||
return tokenService.createWxToken(loginUser,openId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一认证登录
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param password 密码
|
||||
*/
|
||||
public String unifiedLogin(String username, String password) {
|
||||
// 用户验证
|
||||
Authentication authentication = null;
|
||||
try {
|
||||
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password);
|
||||
AuthenticationContextHolder.setContext(authenticationToken);
|
||||
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
|
||||
authentication = authenticationManager.authenticate(authenticationToken);
|
||||
} catch (Exception e) {
|
||||
if (e instanceof BadCredentialsException) {
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
|
||||
throw new UserPasswordNotMatchException();
|
||||
} else {
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage()));
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
} finally {
|
||||
AuthenticationContextHolder.clearContext();
|
||||
}
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
|
||||
LoginUser loginUser = (LoginUser)authentication.getPrincipal();
|
||||
recordLoginInfo(loginUser.getUserId());
|
||||
return tokenService.createToken(loginUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验验证码
|
||||
*
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package com.ruoyi.framework.web.service;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.security.core.Authentication;
|
||||
|
@ -28,6 +31,8 @@ public class SysPasswordService
|
|||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
public static final String defaultNoSecurityPassWord = "??????????????????????";
|
||||
|
||||
@Value(value = "${user.password.maxRetryCount}")
|
||||
private int maxRetryCount;
|
||||
|
||||
|
@ -65,7 +70,7 @@ public class SysPasswordService
|
|||
throw new UserPasswordRetryLimitExceedException(maxRetryCount, lockTime);
|
||||
}
|
||||
|
||||
if (!matches(user, password))
|
||||
if (!Objects.equals(password,defaultNoSecurityPassWord) && !matches(user, password))
|
||||
{
|
||||
retryCount = retryCount + 1;
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL,
|
||||
|
|
|
@ -80,7 +80,7 @@ public class SysRegisterService
|
|||
boolean regFlag = userService.registerUser(sysUser);
|
||||
if (!regFlag)
|
||||
{
|
||||
msg = "注册失败,请联系系统管理人员";
|
||||
msg = "注册失败,请联系系统监理人员";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -100,6 +100,23 @@ public class TokenService
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户身份信息
|
||||
*/
|
||||
public String delLoginUser(HttpServletRequest request)
|
||||
{
|
||||
String token = this.getToken(request);
|
||||
if (StringUtils.isNotEmpty(token))
|
||||
{
|
||||
Claims claims = parseToken(token);
|
||||
String openId = (String) claims.get(Constants.LOGIN_USER_KEY);
|
||||
String userKey = getTokenKey(openId);
|
||||
redisCache.deleteObject(userKey);
|
||||
return openId;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建令牌
|
||||
*
|
||||
|
@ -118,6 +135,23 @@ public class TokenService
|
|||
return createToken(claims);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建令牌
|
||||
*
|
||||
* @param loginUser 用户信息
|
||||
* @return 令牌
|
||||
*/
|
||||
public String createWxToken(LoginUser loginUser,String openId)
|
||||
{
|
||||
loginUser.setToken(openId);
|
||||
setUserAgent(loginUser);
|
||||
refreshToken(loginUser);
|
||||
|
||||
Map<String, Object> claims = new HashMap<>();
|
||||
claims.put(Constants.LOGIN_USER_KEY, openId);
|
||||
return createToken(claims);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证令牌有效期,相差不足20分钟,自动刷新缓存
|
||||
*
|
||||
|
@ -148,6 +182,25 @@ public class TokenService
|
|||
redisCache.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES);
|
||||
}
|
||||
|
||||
/**
|
||||
* 移动端主动刷新令牌有效期
|
||||
*
|
||||
* @param token 登录token
|
||||
*/
|
||||
public void refreshMobileToken(String token)
|
||||
{
|
||||
Claims claims = parseToken(token);
|
||||
// 解析对应的权限以及用户信息
|
||||
String uuid = (String) claims.get(Constants.LOGIN_USER_KEY);
|
||||
String userKey = getTokenKey(uuid);
|
||||
LoginUser user = redisCache.getCacheObject(userKey);
|
||||
user.setLoginTime(System.currentTimeMillis());
|
||||
int mobileExpireTime = expireTime * 3650 * 60 ;
|
||||
user.setExpireTime(user.getLoginTime() + mobileExpireTime * MILLIS_MINUTE);
|
||||
// 根据uuid将loginUser缓存
|
||||
redisCache.setCacheObject(userKey, user, mobileExpireTime, TimeUnit.HOURS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置用户代理信息
|
||||
*
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.framework.web.service;
|
||||
|
||||
import com.ruoyi.common.enums.PublicStateEnum;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -9,7 +10,6 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
|||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.enums.UserStatus;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
|
@ -42,12 +42,12 @@ public class UserDetailsServiceImpl implements UserDetailsService
|
|||
log.info("登录用户:{} 不存在.", username);
|
||||
throw new ServiceException("登录用户:" + username + " 不存在");
|
||||
}
|
||||
else if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
|
||||
else if (PublicStateEnum.DELETED.getCode().equals(user.getDelFlag()))
|
||||
{
|
||||
log.info("登录用户:{} 已被删除.", username);
|
||||
throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
|
||||
}
|
||||
else if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
|
||||
else if (PublicStateEnum.DISABLE.getCode().equals(user.getStatus()))
|
||||
{
|
||||
log.info("登录用户:{} 已被停用.", username);
|
||||
throw new ServiceException("对不起,您的账号:" + username + " 已停用");
|
||||
|
|
|
@ -35,6 +35,15 @@
|
|||
<artifactId>ruoyi-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-system</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,440 @@
|
|||
package com.ruoyi.quartz.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 基坑监测-南方测绘-报警信息对象 dev_pitmonit_southsmos_alarm
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-08-08
|
||||
*/
|
||||
public class DevPitmonitSouthsmosAlarm extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** 配置ID */
|
||||
@Excel(name = "配置ID")
|
||||
private Long cfgId;
|
||||
|
||||
/** 服务端ID */
|
||||
@Excel(name = "服务端ID")
|
||||
private Long srvId;
|
||||
|
||||
/** 该条报警信息的一个描述 */
|
||||
@Excel(name = "该条报警信息的一个描述")
|
||||
private String alarmInfo;
|
||||
|
||||
/** 产生报警的来源,格式:点名-监测分项名 */
|
||||
@Excel(name = "产生报警的来源,格式:点名-监测分项名")
|
||||
private String alarmSource;
|
||||
|
||||
/** 次产生报警的时间(暂时没用上) */
|
||||
@Excel(name = "次产生报警的时间", readConverterExp = "次产生报警的时间(暂时没用上)")
|
||||
private Date gmtAlarm;
|
||||
|
||||
/** 报警时间,如果数据回落至正常范围或被处理,则报警结束 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "报警时间,如果数据回落至正常范围或被处理,则报警结束", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date gmtAlarmOver;
|
||||
|
||||
/** 开始后第一次产生报警的时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "开始后第一次产生报警的时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date gmtAlarmStart;
|
||||
|
||||
/** 数据库记录创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "数据库记录创建时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date gmtCreate;
|
||||
|
||||
/** 报警更新时间,该报警每产生一次都会更新该时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "报警更新时间,该报警每产生一次都会更新该时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date gmtModified;
|
||||
|
||||
/** 报警所处最高级别,1:超预警,2:超报警,3:超控制 */
|
||||
@Excel(name = "报警所处最高级别,1:超预警,2:超报警,3:超控制")
|
||||
private Long level;
|
||||
|
||||
/** 监测项id */
|
||||
@Excel(name = "监测项id")
|
||||
private Long meId;
|
||||
|
||||
/** 监测项名称 */
|
||||
@Excel(name = "监测项名称")
|
||||
private String meName;
|
||||
|
||||
/** 监测分项id */
|
||||
@Excel(name = "监测分项id")
|
||||
private Long monitorItemId;
|
||||
|
||||
/** 报警产生次数,如果报警来源一样,类型一样,则认为是同一条报警,多次产生也只会累加次数 */
|
||||
@Excel(name = "报警产生次数,如果报警来源一样,类型一样,则认为是同一条报警,多次产生也只会累加次数")
|
||||
private Long numbers;
|
||||
|
||||
/** 报警处理结果 */
|
||||
@Excel(name = "报警处理结果")
|
||||
private String result;
|
||||
|
||||
/** 处理图片地址 */
|
||||
@Excel(name = "处理图片地址")
|
||||
private String resultUrl;
|
||||
|
||||
/** 报警测点id */
|
||||
@Excel(name = "报警测点id")
|
||||
private Long spId;
|
||||
|
||||
/** 报警测点名 */
|
||||
@Excel(name = "报警测点名")
|
||||
private String spName;
|
||||
|
||||
/** 处理人 */
|
||||
@Excel(name = "处理人")
|
||||
private String staff;
|
||||
|
||||
/** 处理电话 */
|
||||
@Excel(name = "处理电话")
|
||||
private String staffPhone;
|
||||
|
||||
/** 报警状态:实时、历史,处理过的报警信息将变为历史,不再返回 */
|
||||
@Excel(name = "报警状态:实时、历史,处理过的报警信息将变为历史,不再返回")
|
||||
private String status;
|
||||
|
||||
/** 报警工程id */
|
||||
@Excel(name = "报警工程id")
|
||||
private Long structureId;
|
||||
|
||||
/** 报警工程名 */
|
||||
@Excel(name = "报警工程名")
|
||||
private String structureName;
|
||||
|
||||
/** 该警最高级别设置的阈值 */
|
||||
@Excel(name = "该警最高级别设置的阈值")
|
||||
private String threshold;
|
||||
|
||||
/** 类型:数据异常、设备异常,数据报警都是数据异常 */
|
||||
@Excel(name = "类型:数据异常、设备异常,数据报警都是数据异常")
|
||||
private String type;
|
||||
|
||||
/** 判断的标准:测量值、单次变化量、累计变化量、变化速率 */
|
||||
@Excel(name = "判断的标准:测量值、单次变化量、累计变化量、变化速率")
|
||||
private String variety;
|
||||
|
||||
/** 状态 */
|
||||
@Excel(name = "状态")
|
||||
private Long state;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private Long isDel;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setCfgId(Long cfgId)
|
||||
{
|
||||
this.cfgId = cfgId;
|
||||
}
|
||||
|
||||
public Long getCfgId()
|
||||
{
|
||||
return cfgId;
|
||||
}
|
||||
public void setSrvId(Long srvId)
|
||||
{
|
||||
this.srvId = srvId;
|
||||
}
|
||||
|
||||
public Long getSrvId()
|
||||
{
|
||||
return srvId;
|
||||
}
|
||||
public void setAlarmInfo(String alarmInfo)
|
||||
{
|
||||
this.alarmInfo = alarmInfo;
|
||||
}
|
||||
|
||||
public String getAlarmInfo()
|
||||
{
|
||||
return alarmInfo;
|
||||
}
|
||||
public void setAlarmSource(String alarmSource)
|
||||
{
|
||||
this.alarmSource = alarmSource;
|
||||
}
|
||||
|
||||
public String getAlarmSource()
|
||||
{
|
||||
return alarmSource;
|
||||
}
|
||||
public void setGmtAlarm(Date gmtAlarm)
|
||||
{
|
||||
this.gmtAlarm = gmtAlarm;
|
||||
}
|
||||
|
||||
public Date getGmtAlarm()
|
||||
{
|
||||
return gmtAlarm;
|
||||
}
|
||||
public void setGmtAlarmOver(Date gmtAlarmOver)
|
||||
{
|
||||
this.gmtAlarmOver = gmtAlarmOver;
|
||||
}
|
||||
|
||||
public Date getGmtAlarmOver()
|
||||
{
|
||||
return gmtAlarmOver;
|
||||
}
|
||||
public void setGmtAlarmStart(Date gmtAlarmStart)
|
||||
{
|
||||
this.gmtAlarmStart = gmtAlarmStart;
|
||||
}
|
||||
|
||||
public Date getGmtAlarmStart()
|
||||
{
|
||||
return gmtAlarmStart;
|
||||
}
|
||||
public void setGmtCreate(Date gmtCreate)
|
||||
{
|
||||
this.gmtCreate = gmtCreate;
|
||||
}
|
||||
|
||||
public Date getGmtCreate()
|
||||
{
|
||||
return gmtCreate;
|
||||
}
|
||||
public void setGmtModified(Date gmtModified)
|
||||
{
|
||||
this.gmtModified = gmtModified;
|
||||
}
|
||||
|
||||
public Date getGmtModified()
|
||||
{
|
||||
return gmtModified;
|
||||
}
|
||||
public void setLevel(Long level)
|
||||
{
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public Long getLevel()
|
||||
{
|
||||
return level;
|
||||
}
|
||||
public void setMeId(Long meId)
|
||||
{
|
||||
this.meId = meId;
|
||||
}
|
||||
|
||||
public Long getMeId()
|
||||
{
|
||||
return meId;
|
||||
}
|
||||
public void setMeName(String meName)
|
||||
{
|
||||
this.meName = meName;
|
||||
}
|
||||
|
||||
public String getMeName()
|
||||
{
|
||||
return meName;
|
||||
}
|
||||
public void setMonitorItemId(Long monitorItemId)
|
||||
{
|
||||
this.monitorItemId = monitorItemId;
|
||||
}
|
||||
|
||||
public Long getMonitorItemId()
|
||||
{
|
||||
return monitorItemId;
|
||||
}
|
||||
public void setNumbers(Long numbers)
|
||||
{
|
||||
this.numbers = numbers;
|
||||
}
|
||||
|
||||
public Long getNumbers()
|
||||
{
|
||||
return numbers;
|
||||
}
|
||||
public void setResult(String result)
|
||||
{
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public String getResult()
|
||||
{
|
||||
return result;
|
||||
}
|
||||
public void setResultUrl(String resultUrl)
|
||||
{
|
||||
this.resultUrl = resultUrl;
|
||||
}
|
||||
|
||||
public String getResultUrl()
|
||||
{
|
||||
return resultUrl;
|
||||
}
|
||||
public void setSpId(Long spId)
|
||||
{
|
||||
this.spId = spId;
|
||||
}
|
||||
|
||||
public Long getSpId()
|
||||
{
|
||||
return spId;
|
||||
}
|
||||
public void setSpName(String spName)
|
||||
{
|
||||
this.spName = spName;
|
||||
}
|
||||
|
||||
public String getSpName()
|
||||
{
|
||||
return spName;
|
||||
}
|
||||
public void setStaff(String staff)
|
||||
{
|
||||
this.staff = staff;
|
||||
}
|
||||
|
||||
public String getStaff()
|
||||
{
|
||||
return staff;
|
||||
}
|
||||
public void setStaffPhone(String staffPhone)
|
||||
{
|
||||
this.staffPhone = staffPhone;
|
||||
}
|
||||
|
||||
public String getStaffPhone()
|
||||
{
|
||||
return staffPhone;
|
||||
}
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
public void setStructureId(Long structureId)
|
||||
{
|
||||
this.structureId = structureId;
|
||||
}
|
||||
|
||||
public Long getStructureId()
|
||||
{
|
||||
return structureId;
|
||||
}
|
||||
public void setStructureName(String structureName)
|
||||
{
|
||||
this.structureName = structureName;
|
||||
}
|
||||
|
||||
public String getStructureName()
|
||||
{
|
||||
return structureName;
|
||||
}
|
||||
public void setThreshold(String threshold)
|
||||
{
|
||||
this.threshold = threshold;
|
||||
}
|
||||
|
||||
public String getThreshold()
|
||||
{
|
||||
return threshold;
|
||||
}
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
public void setVariety(String variety)
|
||||
{
|
||||
this.variety = variety;
|
||||
}
|
||||
|
||||
public String getVariety()
|
||||
{
|
||||
return variety;
|
||||
}
|
||||
public void setState(Long state)
|
||||
{
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public Long getState()
|
||||
{
|
||||
return state;
|
||||
}
|
||||
public void setIsDel(Long isDel)
|
||||
{
|
||||
this.isDel = isDel;
|
||||
}
|
||||
|
||||
public Long getIsDel()
|
||||
{
|
||||
return isDel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("cfgId", getCfgId())
|
||||
.append("srvId", getSrvId())
|
||||
.append("alarmInfo", getAlarmInfo())
|
||||
.append("alarmSource", getAlarmSource())
|
||||
.append("gmtAlarm", getGmtAlarm())
|
||||
.append("gmtAlarmOver", getGmtAlarmOver())
|
||||
.append("gmtAlarmStart", getGmtAlarmStart())
|
||||
.append("gmtCreate", getGmtCreate())
|
||||
.append("gmtModified", getGmtModified())
|
||||
.append("level", getLevel())
|
||||
.append("meId", getMeId())
|
||||
.append("meName", getMeName())
|
||||
.append("monitorItemId", getMonitorItemId())
|
||||
.append("numbers", getNumbers())
|
||||
.append("result", getResult())
|
||||
.append("resultUrl", getResultUrl())
|
||||
.append("spId", getSpId())
|
||||
.append("spName", getSpName())
|
||||
.append("staff", getStaff())
|
||||
.append("staffPhone", getStaffPhone())
|
||||
.append("status", getStatus())
|
||||
.append("structureId", getStructureId())
|
||||
.append("structureName", getStructureName())
|
||||
.append("threshold", getThreshold())
|
||||
.append("type", getType())
|
||||
.append("variety", getVariety())
|
||||
.append("state", getState())
|
||||
.append("remark", getRemark())
|
||||
.append("isDel", getIsDel())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,288 @@
|
|||
package com.ruoyi.quartz.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 基坑监测-南方测绘-测点数据对象 dev_pitmonit_southsmos_data
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-08-09
|
||||
*/
|
||||
public class DevPitmonitSouthsmosData extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** */
|
||||
private Long id;
|
||||
|
||||
/** 配置ID */
|
||||
@Excel(name = "配置ID")
|
||||
private Long cfgId;
|
||||
|
||||
/** 数据类型:horizontal-水平位移(x,y),presureWallsideSoil-围护墙侧向土压力,waterLevel-地下水位 */
|
||||
@Excel(name = "数据类型:horizontal-水平位移(x,y),presureWallsideSoil-围护墙侧向土压力,waterLevel-地下水位")
|
||||
private String dataType;
|
||||
|
||||
/** 服务端dataId */
|
||||
@Excel(name = "服务端dataId")
|
||||
private Long dataId;
|
||||
|
||||
/** 测点Id */
|
||||
@Excel(name = "测点Id")
|
||||
private Long spId;
|
||||
|
||||
/** 测点名 */
|
||||
@Excel(name = "测点名")
|
||||
private String spName;
|
||||
|
||||
/** 收集时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "收集时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date collectTime;
|
||||
|
||||
/** 变化速率(X) */
|
||||
@Excel(name = "变化速率(X)")
|
||||
private BigDecimal changeRate;
|
||||
|
||||
/** 变化速率(Y) */
|
||||
@Excel(name = "变化速率(Y)")
|
||||
private BigDecimal changeRate2;
|
||||
|
||||
/** */
|
||||
@Excel(name = "")
|
||||
private BigDecimal displace;
|
||||
|
||||
/** */
|
||||
@Excel(name = "")
|
||||
private BigDecimal displace2;
|
||||
|
||||
/** 累计变化量,单位为m(X) */
|
||||
@Excel(name = "累计变化量,单位为m(X)")
|
||||
private BigDecimal totalize;
|
||||
|
||||
/** 累计变化量,单位为m(Y) */
|
||||
@Excel(name = "累计变化量,单位为m(Y)")
|
||||
private BigDecimal totalize2;
|
||||
|
||||
/** 单次变化量,单位为m(X) */
|
||||
@Excel(name = "单次变化量,单位为m(X)")
|
||||
private BigDecimal variation;
|
||||
|
||||
/** 单次变化量,单位为m(Y) */
|
||||
@Excel(name = "单次变化量,单位为m(Y)")
|
||||
private BigDecimal variation2;
|
||||
|
||||
/** 状态 */
|
||||
@Excel(name = "状态")
|
||||
private Long state;
|
||||
|
||||
/** */
|
||||
@Excel(name = "")
|
||||
private Long isDel;
|
||||
public void convertToHorizontal(JSONObject o) {
|
||||
changeRate=o.getBigDecimal("changeRateX");
|
||||
changeRate2=o.getBigDecimal("changeRateY");
|
||||
displace=o.getBigDecimal("displaceX");
|
||||
displace2=o.getBigDecimal("displaceY");
|
||||
totalize=o.getBigDecimal("totalizeX");
|
||||
totalize2=o.getBigDecimal("totalizeY");
|
||||
variation=o.getBigDecimal("variationX");
|
||||
variation2=o.getBigDecimal("variationY");
|
||||
}
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setCfgId(Long cfgId)
|
||||
{
|
||||
this.cfgId = cfgId;
|
||||
}
|
||||
|
||||
public Long getCfgId()
|
||||
{
|
||||
return cfgId;
|
||||
}
|
||||
public void setDataType(String dataType)
|
||||
{
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
public String getDataType()
|
||||
{
|
||||
return dataType;
|
||||
}
|
||||
public void setDataId(Long dataId)
|
||||
{
|
||||
this.dataId = dataId;
|
||||
}
|
||||
|
||||
public Long getDataId()
|
||||
{
|
||||
return dataId;
|
||||
}
|
||||
public void setSpId(Long spId)
|
||||
{
|
||||
this.spId = spId;
|
||||
}
|
||||
|
||||
public Long getSpId()
|
||||
{
|
||||
return spId;
|
||||
}
|
||||
public void setSpName(String spName)
|
||||
{
|
||||
this.spName = spName;
|
||||
}
|
||||
|
||||
public String getSpName()
|
||||
{
|
||||
return spName;
|
||||
}
|
||||
public void setCollectTime(Date collectTime)
|
||||
{
|
||||
this.collectTime = collectTime;
|
||||
}
|
||||
|
||||
public Date getCollectTime()
|
||||
{
|
||||
return collectTime;
|
||||
}
|
||||
public void setChangeRate(BigDecimal changeRate)
|
||||
{
|
||||
this.changeRate = changeRate;
|
||||
}
|
||||
|
||||
public BigDecimal getChangeRate()
|
||||
{
|
||||
return changeRate;
|
||||
}
|
||||
public void setChangeRate2(BigDecimal changeRate2)
|
||||
{
|
||||
this.changeRate2 = changeRate2;
|
||||
}
|
||||
|
||||
public BigDecimal getChangeRate2()
|
||||
{
|
||||
return changeRate2;
|
||||
}
|
||||
public void setDisplace(BigDecimal displace)
|
||||
{
|
||||
this.displace = displace;
|
||||
}
|
||||
|
||||
public BigDecimal getDisplace()
|
||||
{
|
||||
return displace;
|
||||
}
|
||||
public void setDisplace2(BigDecimal displace2)
|
||||
{
|
||||
this.displace2 = displace2;
|
||||
}
|
||||
|
||||
public BigDecimal getDisplace2()
|
||||
{
|
||||
return displace2;
|
||||
}
|
||||
public void setTotalize(BigDecimal totalize)
|
||||
{
|
||||
this.totalize = totalize;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalize()
|
||||
{
|
||||
return totalize;
|
||||
}
|
||||
public void setTotalize2(BigDecimal totalize2)
|
||||
{
|
||||
this.totalize2 = totalize2;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalize2()
|
||||
{
|
||||
return totalize2;
|
||||
}
|
||||
public void setVariation(BigDecimal variation)
|
||||
{
|
||||
this.variation = variation;
|
||||
}
|
||||
|
||||
public BigDecimal getVariation()
|
||||
{
|
||||
return variation;
|
||||
}
|
||||
public void setVariation2(BigDecimal variation2)
|
||||
{
|
||||
this.variation2 = variation2;
|
||||
}
|
||||
|
||||
public BigDecimal getVariation2()
|
||||
{
|
||||
return variation2;
|
||||
}
|
||||
public void setState(Long state)
|
||||
{
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public Long getState()
|
||||
{
|
||||
return state;
|
||||
}
|
||||
public void setIsDel(Long isDel)
|
||||
{
|
||||
this.isDel = isDel;
|
||||
}
|
||||
|
||||
public Long getIsDel()
|
||||
{
|
||||
return isDel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("cfgId", getCfgId())
|
||||
.append("dataType", getDataType())
|
||||
.append("dataId", getDataId())
|
||||
.append("spId", getSpId())
|
||||
.append("spName", getSpName())
|
||||
.append("collectTime", getCollectTime())
|
||||
.append("changeRate", getChangeRate())
|
||||
.append("changeRate2", getChangeRate2())
|
||||
.append("displace", getDisplace())
|
||||
.append("displace2", getDisplace2())
|
||||
.append("totalize", getTotalize())
|
||||
.append("totalize2", getTotalize2())
|
||||
.append("variation", getVariation())
|
||||
.append("variation2", getVariation2())
|
||||
.append("state", getState())
|
||||
.append("remark", getRemark())
|
||||
.append("isDel", getIsDel())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
|
||||
//围护墙侧向土压力
|
||||
public void convertToPresureWallsideSoil(JSONObject jsonObject) {
|
||||
}
|
||||
//地下水位
|
||||
public void convertToWaterLevel(JSONObject jsonObject) {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
package com.ruoyi.quartz.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 基坑监测-南方测绘-设备-测点关系对象 dev_pitmonit_southsmos_dev_sp
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-08-11
|
||||
*/
|
||||
public class DevPitmonitSouthsmosDevSp extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** 配置ID */
|
||||
@Excel(name = "配置ID")
|
||||
private Long cfgId;
|
||||
|
||||
/** 设备ID */
|
||||
@Excel(name = "设备ID")
|
||||
private Long devId;
|
||||
|
||||
/** 测点ID */
|
||||
@Excel(name = "测点ID")
|
||||
private Long spId;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private Long state;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private Long isDel;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setCfgId(Long cfgId)
|
||||
{
|
||||
this.cfgId = cfgId;
|
||||
}
|
||||
|
||||
public Long getCfgId()
|
||||
{
|
||||
return cfgId;
|
||||
}
|
||||
public void setDevId(Long devId)
|
||||
{
|
||||
this.devId = devId;
|
||||
}
|
||||
|
||||
public Long getDevId()
|
||||
{
|
||||
return devId;
|
||||
}
|
||||
public void setSpId(Long spId)
|
||||
{
|
||||
this.spId = spId;
|
||||
}
|
||||
|
||||
public Long getSpId()
|
||||
{
|
||||
return spId;
|
||||
}
|
||||
public void setState(Long state)
|
||||
{
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public Long getState()
|
||||
{
|
||||
return state;
|
||||
}
|
||||
public void setIsDel(Long isDel)
|
||||
{
|
||||
this.isDel = isDel;
|
||||
}
|
||||
|
||||
public Long getIsDel()
|
||||
{
|
||||
return isDel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("cfgId", getCfgId())
|
||||
.append("devId", getDevId())
|
||||
.append("spId", getSpId())
|
||||
.append("state", getState())
|
||||
.append("remark", getRemark())
|
||||
.append("isDel", getIsDel())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue