Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
33b4ba3972 | ||
|
|
7c0f59f731 | ||
|
|
dc70ecbce7 | ||
|
|
f6ac03bca3 | ||
|
|
cde1d5eb81 | ||
|
|
5abeaf5224 | ||
|
|
9e8724c525 | ||
|
|
8e8b402ced | ||
|
|
a08092eb37 | ||
|
|
32846984c0 | ||
|
|
5a264e2ef0 | ||
|
|
9b8b004edf | ||
|
|
ea354f0967 | ||
|
|
3f55cee7e3 | ||
|
|
521f1e24b9 | ||
|
|
0bf88192cf | ||
|
|
b6d27fa7e1 | ||
|
|
b75a892a50 | ||
|
|
f1a5037af3 | ||
|
|
8f9f16254a | ||
|
|
6acf5e3bcc | ||
|
|
e35ffedea5 | ||
|
|
fbe9359595 | ||
|
|
1110c97ef6 | ||
|
|
44b50777fb | ||
|
|
c84ba68599 | ||
|
|
3ec845fc46 | ||
|
|
7fb8b20955 | ||
|
|
8b490936aa | ||
|
|
2299906c55 | ||
|
|
95a91b4189 | ||
|
|
09c3555645 | ||
|
|
bda663a740 | ||
|
|
3637a7d65d | ||
|
|
cc4d7139dc | ||
|
|
0fb56c95db | ||
|
|
809e457480 | ||
|
|
e2c5fbf77d | ||
|
|
29d7cd37bf | ||
|
|
a73b5ca3b4 | ||
|
|
8718bece10 | ||
|
|
f6471058a3 | ||
|
|
b03cf6428b | ||
|
|
f8a9cc83fe | ||
|
|
e646b00333 | ||
|
|
7d6976224d | ||
|
|
918c1a8bad | ||
|
|
5e544e6d4e | ||
|
|
07dd08f824 | ||
|
|
f76a2e9850 | ||
|
|
504d1e371b | ||
|
|
7c3044811e | ||
|
|
a5e3b61d4f | ||
|
|
a03a23f2c1 | ||
|
|
58a5f083fe | ||
|
|
0367602fe3 | ||
|
|
6da9516d82 | ||
|
|
f94be91bb3 | ||
|
|
e5c8ebfb31 | ||
|
|
75da02d795 | ||
|
|
376e86cc28 | ||
|
|
b0aa7d09c4 | ||
|
|
a32386e726 | ||
|
|
333c162ab0 | ||
|
|
915b60f43b | ||
|
|
a6195fc255 | ||
|
|
a24635c429 | ||
|
|
b56288cc8c | ||
|
|
a851d66423 | ||
|
|
02ba078238 | ||
|
|
6559304793 | ||
|
|
dfddc6a9f4 | ||
|
|
4daceeb105 | ||
|
|
6314a583b9 | ||
|
|
36b5925786 | ||
|
|
17c9b2659e | ||
|
|
37ad9a3112 | ||
|
|
666090fbe3 | ||
|
|
9537faea90 | ||
|
|
72026ee6f4 | ||
|
|
08f4aca27c | ||
|
|
c48d18b13f | ||
|
|
b0f71c6e3a | ||
|
|
653f814372 | ||
|
|
7fef478c00 | ||
|
|
a7f1f00cf9 | ||
|
|
c54981e584 | ||
|
|
cf42c93c6d | ||
|
|
c596c5654f | ||
|
|
bf343b7e5a | ||
|
|
de0d26882e | ||
|
|
7977c89ab4 | ||
|
|
35f0663fb3 | ||
|
|
1256a9dd50 | ||
|
|
249b11ee61 | ||
|
|
a64aa29a4e | ||
|
|
4502b8128f | ||
|
|
9f52637abd | ||
|
|
8a7cf059fd | ||
|
|
21e86a4c47 | ||
|
|
a9bf9379ba | ||
|
|
983edd6dd9 | ||
|
|
fb36d28f56 | ||
|
|
3e00799963 | ||
|
|
dd776e6fab | ||
|
|
4875ac4b70 | ||
|
|
1cece4a0d1 | ||
|
|
b22b49763c | ||
|
|
3c1eb3ba55 | ||
|
|
abeca57c83 | ||
|
|
0fc6595fb3 | ||
|
|
d7d48a3ff3 | ||
|
|
b4e54bd501 | ||
|
|
92c619f123 | ||
|
|
6ce906e04c | ||
|
|
2b5765d935 | ||
|
|
619734469d | ||
|
|
9f94b61bfb | ||
|
|
13422f5c2d | ||
|
|
6f8879c5d1 | ||
|
|
609e0470fb | ||
|
|
40666adb10 | ||
|
|
df108c15eb | ||
|
|
658ce02b8f | ||
|
|
8e235b6135 | ||
|
|
4b615599b4 | ||
|
|
c042d9e611 | ||
|
|
6be935061c | ||
|
|
327aa07c21 | ||
|
|
bf0a834577 | ||
|
|
2afcbb6f73 | ||
|
|
2696ac1156 | ||
|
|
80fd24e1c3 | ||
|
|
ac0278a1c5 | ||
|
|
c927559270 | ||
|
|
9c36ade13f | ||
|
|
07a1bad4a1 | ||
|
|
dc95793394 | ||
|
|
134c5b880a | ||
|
|
b3398e9828 | ||
|
|
988e763abd | ||
|
|
e02dc53776 | ||
|
|
dc0826ddad | ||
|
|
c97c5965f9 | ||
|
|
1a3848e339 | ||
|
|
beb7989c5e | ||
|
|
49c99ecb5e | ||
|
|
f87943e9f5 | ||
|
|
0579a94658 | ||
|
|
4a2155f7eb | ||
|
|
badbdf8c13 | ||
|
|
694a7667f4 | ||
|
|
1ddfff3e51 | ||
|
|
02575e8bfc | ||
|
|
ba28986510 | ||
|
|
e2bf519221 | ||
|
|
ef5f37d83a | ||
|
|
dc990ef8bb | ||
|
|
ce307a7912 | ||
|
|
86b8305dc2 | ||
|
|
da4a49956c | ||
|
|
7ad9bdd869 | ||
|
|
766f9e9fb7 | ||
|
|
d8cb453153 | ||
|
|
9fe2684b33 | ||
|
|
5ad63c8905 | ||
|
|
ea727fc760 | ||
|
|
657e748cb3 | ||
|
|
d69913799c | ||
|
|
e00d61949b | ||
|
|
ba20a9d807 | ||
|
|
48aa6625f4 | ||
|
|
1c90f35d47 | ||
|
|
dc26290e28 | ||
|
|
8d61792ec6 | ||
|
|
66131d6b1a | ||
|
|
4a7194c9ea | ||
|
|
0d246d5917 | ||
|
|
657df6d9a5 | ||
|
|
aa8522293f | ||
|
|
5e4fe7df97 | ||
|
|
6ae4f4bec7 | ||
|
|
7377980330 | ||
|
|
854f98c560 | ||
|
|
8e54eba40a | ||
|
|
f595820ec4 | ||
|
|
5c0439f1f0 | ||
|
|
1fc66789aa | ||
|
|
398d4a80d0 | ||
|
|
0fe491cf84 | ||
|
|
158e6ee9fd | ||
|
|
32db41e641 | ||
|
|
e67d6d2d3f | ||
|
|
e6160f71d4 | ||
|
|
a98413baba | ||
|
|
8309678cb4 | ||
|
|
0b96d4351d | ||
|
|
b8ad0dfc8c | ||
|
|
6ee2fd571a | ||
|
|
483128ca87 | ||
|
|
af4922ce3c | ||
|
|
5f6b9495b1 | ||
|
|
7b7ee0ab63 | ||
|
|
fb76ba3a21 | ||
|
|
d014a5e76b | ||
|
|
962e28c0d8 | ||
|
|
39c7bb43bd | ||
|
|
784f7c0675 | ||
|
|
54dea94f6a | ||
|
|
164642ae58 | ||
|
|
f4520c3f53 | ||
|
|
4aea39ed02 | ||
|
|
039064749e | ||
|
|
584ddbe43d | ||
|
|
11d33b80af | ||
|
|
3add880d2f | ||
|
|
c36a3792f0 | ||
|
|
021305888c | ||
|
|
8426b05fc3 | ||
|
|
5e0fad4711 | ||
|
|
d6c742ec21 | ||
|
|
6765fe12ef | ||
|
|
13fdb68e40 | ||
|
|
7fe8e9c1e4 | ||
|
|
ed036ebecc | ||
|
|
d73e891c3c | ||
|
|
c7149351bc | ||
|
|
1d8ff2d2d0 | ||
|
|
d5efaf7c8e | ||
|
|
2891c27927 | ||
|
|
26117e8de4 | ||
|
|
9073d753e6 | ||
|
|
4389bd785e | ||
|
|
96dc5eeec2 | ||
|
|
d3bea626ca | ||
|
|
6f43e2ff79 | ||
|
|
abf30481b1 | ||
|
|
deae0d42f8 | ||
|
|
073f12811a | ||
|
|
10cd6acbbc | ||
|
|
bae9acd9ad | ||
|
|
80f072efd3 | ||
|
|
a32e42dfea | ||
|
|
13a6443eab | ||
|
|
a74a9ca675 | ||
|
|
b7b279295f | ||
|
|
9b9e52d13d | ||
|
|
fe51b4f655 | ||
|
|
8b1da3b4d9 | ||
|
|
949d8833d0 | ||
|
|
b6de7d9111 | ||
|
|
0f3da093b3 | ||
|
|
422b37fa69 | ||
|
|
90bf9b5295 | ||
|
|
56f0ec43bd | ||
|
|
f75b8d96ac | ||
|
|
a4bfa3dea8 | ||
|
|
2396a98b2d | ||
|
|
731cbc3c6a | ||
|
|
6567166ea3 | ||
|
|
8ae21c43f8 | ||
|
|
de5becc963 | ||
|
|
0c4b3df7f8 | ||
|
|
9a8fbe0ef3 | ||
|
|
9fe19ae74c | ||
|
|
d88a440264 | ||
|
|
d8c8d1861d | ||
|
|
fb349f1983 | ||
|
|
695405ac03 | ||
|
|
c53dffddfd | ||
|
|
94d6500b92 | ||
|
|
e4fe52ad70 | ||
|
|
c5cdf7c1d5 | ||
|
|
6550e31112 | ||
|
|
6b60f6594f | ||
|
|
3dc0454e31 | ||
|
|
a4d43d039a | ||
|
|
e3f19921fe | ||
|
|
972990fb60 | ||
|
|
244c3f0618 | ||
|
|
5df411488e | ||
|
|
1522adb6ef | ||
|
|
768b1d4d61 | ||
|
|
46bbed2972 | ||
|
|
76b6757dcf | ||
|
|
0975a28364 | ||
|
|
8926642a28 | ||
|
|
6e8d8125bb | ||
|
|
e4537963e8 | ||
|
|
f5a48475af | ||
|
|
3d04ad5377 | ||
|
|
74766cd4ee | ||
|
|
986127f7ca | ||
|
|
e93a04fac3 | ||
|
|
6ab2d3199d | ||
|
|
ed8b4d5ae9 | ||
|
|
0de23614af | ||
|
|
8902ddd3b3 | ||
|
|
e2f956beac | ||
|
|
4ad79ff910 | ||
|
|
4fb50c0fb3 | ||
|
|
a2eb664a33 | ||
|
|
bde135f621 | ||
|
|
a55563bfe6 | ||
|
|
7600bf17c1 | ||
|
|
04bbca97ae | ||
|
|
f2f47a6aa8 | ||
|
|
79afb35549 | ||
|
|
31b6e6a4be | ||
|
|
4076086a75 | ||
|
|
61da3d4b80 | ||
|
|
1023662211 | ||
|
|
ad8e702365 | ||
|
|
f3f89065a5 | ||
|
|
1c03bd01c2 | ||
|
|
8260767ef2 | ||
|
|
9ad31bcdd5 | ||
|
|
bc58e807bc | ||
|
|
2d112e7270 | ||
|
|
3ac12bc2b0 | ||
|
|
4339a48155 | ||
|
|
fd8db54417 | ||
|
|
dcad0d8634 | ||
|
|
d4121b08ae | ||
|
|
fd4a2e4c23 | ||
|
|
3164ff90a4 | ||
|
|
9af4469d16 | ||
|
|
2ee809a7ca | ||
|
|
fd75fc2fe9 | ||
|
|
a4dcb115bd | ||
|
|
5d71fb537d | ||
|
|
a30ad9ffe8 | ||
|
|
e3c10e6b57 | ||
|
|
268dc46ace | ||
|
|
6f131cba29 | ||
|
|
cf15a693c5 | ||
|
|
68664aaa88 | ||
|
|
0e352e87ac | ||
|
|
3773b276e8 | ||
|
|
08296f00f8 | ||
|
|
77ce1eb1d5 | ||
|
|
b7b9e39b37 | ||
|
|
1230de11ec | ||
|
|
7938e98f0d | ||
|
|
7bcec78774 | ||
|
|
8800948317 | ||
|
|
4a4262f390 | ||
|
|
b9a928732b | ||
|
|
a2a72acd9b | ||
|
|
45b2b7c272 | ||
|
|
6248473cd7 | ||
|
|
1554139f18 | ||
|
|
71c75909b8 | ||
|
|
7f31884b08 | ||
|
|
b8a424465c | ||
|
|
164612c08a | ||
|
|
c0ac1d92e9 | ||
|
|
6daba6ac21 | ||
|
|
6d0e403381 | ||
|
|
801714c888 | ||
|
|
af565db9d6 | ||
|
|
4796b52963 | ||
|
|
9d7be2c16b | ||
|
|
d067ad144b | ||
|
|
aacf4b21e0 | ||
|
|
929c1bb4c0 | ||
|
|
2646561037 | ||
|
|
4282dcb2de | ||
|
|
62183896ab | ||
|
|
913c31ca88 | ||
|
|
6610927255 | ||
|
|
9e3830ae2f | ||
|
|
01c8b63b7c | ||
|
|
03256b046f | ||
|
|
bb33b9b71c | ||
|
|
527a1d8a64 | ||
|
|
37a72958f1 | ||
|
|
464eb8b824 | ||
|
|
f59b1eea7c | ||
|
|
8a9cdd09fc | ||
|
|
2e3c6764c3 | ||
|
|
d0c94dc287 | ||
|
|
fee63623ad | ||
|
|
04b4df2964 |
+47
@@ -0,0 +1,47 @@
|
|||||||
|
######################################################################
|
||||||
|
# Build Tools
|
||||||
|
|
||||||
|
.gradle
|
||||||
|
/build/
|
||||||
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# IDE
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### JRebel ###
|
||||||
|
rebel.xml
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
nbproject/private/
|
||||||
|
build/*
|
||||||
|
nbbuild/
|
||||||
|
dist/
|
||||||
|
nbdist/
|
||||||
|
.nb-gradle/
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# Others
|
||||||
|
*.log
|
||||||
|
*.xml.versionsBackup
|
||||||
|
*.swp
|
||||||
|
|
||||||
|
!*/build/*.java
|
||||||
|
!*/build/*.html
|
||||||
|
!*/build/*.xml
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2018 RuoYi
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
+59
@@ -0,0 +1,59 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>ruoyi</artifactId>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<version>3.8.6</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>pay</artifactId>
|
||||||
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||||
|
<version>2.7.10</version>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.22</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>fastjson</artifactId>
|
||||||
|
<version>1.2.72</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>5.7.12</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.wechatpay-apiv3</groupId>
|
||||||
|
<artifactId>wechatpay-apache-httpclient</artifactId>
|
||||||
|
<version>0.4.7</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alipay.sdk</groupId>
|
||||||
|
<artifactId>alipay-sdk-java</artifactId>
|
||||||
|
<version>4.34.8.ALL</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.ruoyi;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务回调处理接口
|
||||||
|
*/
|
||||||
|
public interface CallBackService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成功支付--处理业务逻辑
|
||||||
|
* @param orderSn 订单号
|
||||||
|
*/
|
||||||
|
void successPay(String orderSn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失败支付-处理业务逻辑
|
||||||
|
* @param orderSn 订单号
|
||||||
|
*/
|
||||||
|
void failPay(String orderSn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款成功-处理业务逻辑
|
||||||
|
* @param orderSn 订单号
|
||||||
|
*/
|
||||||
|
void successRefund(String orderSn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款失败-处理业务逻辑
|
||||||
|
* @param orderSn 订单号
|
||||||
|
*/
|
||||||
|
void failRefund(String orderSn);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package com.ruoyi;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ruoyi.dto.*;
|
||||||
|
import com.ruoyi.exceptions.TradeException;
|
||||||
|
|
||||||
|
public interface ElegentPay {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统一下单接口
|
||||||
|
* @param payRequest 支付请求
|
||||||
|
* @param tradeType 交易类型
|
||||||
|
* @param platform 平台
|
||||||
|
* @return 支付响应
|
||||||
|
* @throws TradeException
|
||||||
|
*/
|
||||||
|
PayResponse requestPay(PayRequest payRequest, String tradeType, String platform) throws TradeException;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭订单
|
||||||
|
* @param orderSn 订单号
|
||||||
|
* @param platform 平台
|
||||||
|
* @return 是否成功关闭订单
|
||||||
|
* @throws TradeException
|
||||||
|
*/
|
||||||
|
Boolean closePay(String orderSn, String platform) throws TradeException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款
|
||||||
|
* @param refundRequest 退款请求封装对象
|
||||||
|
* @param platform 平台
|
||||||
|
* @return 是否成功退款
|
||||||
|
* @throws TradeException
|
||||||
|
*/
|
||||||
|
Boolean refund(RefundRequest refundRequest, String platform) throws TradeException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据订单号查询订单
|
||||||
|
* @param orderSn 订单号
|
||||||
|
* @param platform 平台
|
||||||
|
* @return 查询响应对象
|
||||||
|
* @throws TradeException
|
||||||
|
*/
|
||||||
|
QueryResponse queryTradingOrderNo(String orderSn , String platform) throws TradeException;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询单笔退款API
|
||||||
|
* @param orderSn 订单号
|
||||||
|
* @param platform 平台
|
||||||
|
* @return 查询退款响应对象
|
||||||
|
* @throws TradeException
|
||||||
|
*/
|
||||||
|
QueryRefundResponse queryRefundTrading(String orderSn , String platform) throws TradeException;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得openID
|
||||||
|
* @param code
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getOpenid(String code, String platform);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.ruoyi.ali;
|
||||||
|
|
||||||
|
import com.ruoyi.key.KeyManager;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付宝权限对接类
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@ConfigurationProperties("elegent.pay.alipay")
|
||||||
|
@Data
|
||||||
|
public class AlipayConfig {
|
||||||
|
/**
|
||||||
|
* 应用识别码
|
||||||
|
*/
|
||||||
|
private String appId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 密钥加密方式 RSA2
|
||||||
|
*/
|
||||||
|
@Value("${elegent.pay.alipay.charset:RSA2}")
|
||||||
|
private String signType;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private KeyManager keyManager;
|
||||||
|
|
||||||
|
public String getPrivateKey(){
|
||||||
|
return keyManager.getKey("alipay_private.key");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPublicKey(){
|
||||||
|
return keyManager.getKey("alipay_public.key");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.ruoyi.ali;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ZFBConstant
|
||||||
|
* @description 支付宝相关的常量
|
||||||
|
*/
|
||||||
|
public class AlipayConstant {
|
||||||
|
|
||||||
|
public static final String SUCCESS = "SUCCESS";
|
||||||
|
|
||||||
|
public static final String FAIL = "FAIL";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交易状态(用于转换)
|
||||||
|
*/
|
||||||
|
public static final Map<String,String> TRADE_STATE = new HashMap<String,String>(){
|
||||||
|
{
|
||||||
|
put("TRADE_SUCCESS", "SUCCESS");
|
||||||
|
put("WAIT_BUYER_PAY", "NOTPAY");
|
||||||
|
put("TRADE_CLOSED", "CLOSED");
|
||||||
|
put("TRADE_FINISHED", "FINISHED");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public static final String domain="https://openapi.alipay.com/gateway.do";
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,461 @@
|
|||||||
|
package com.ruoyi.ali;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.alipay.api.AlipayApiException;
|
||||||
|
import com.alipay.api.AlipayClient;
|
||||||
|
import com.alipay.api.DefaultAlipayClient;
|
||||||
|
import com.alipay.api.request.*;
|
||||||
|
import com.alipay.api.response.*;
|
||||||
|
import com.ruoyi.CallBackService;
|
||||||
|
import com.ruoyi.annotation.TradePlatform;
|
||||||
|
import com.ruoyi.config.CallbackConfig;
|
||||||
|
import com.ruoyi.constant.PayConstant;
|
||||||
|
import com.ruoyi.constant.Platform;
|
||||||
|
import com.ruoyi.constant.TradeType;
|
||||||
|
import com.ruoyi.core.ElegentTrade;
|
||||||
|
import com.ruoyi.dto.*;
|
||||||
|
import com.ruoyi.exceptions.TradeException;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付宝支付的策略类
|
||||||
|
* @author wgl
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@TradePlatform(Platform.ALI)
|
||||||
|
@Slf4j
|
||||||
|
public class AlipayElegentTrade implements ElegentTrade {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AlipayConfig alipayConfig;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CallbackConfig callbackConfig;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CallBackService callBackService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取回调地址
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String getPayNotifyUrl(){
|
||||||
|
return callbackConfig.getDomain()+ PayConstant.CALLBACK_PATH+ PayConstant.NOTIFY +"/"+ Platform.ALI;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取退款回调
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String getRefundNotifyUrl(){
|
||||||
|
return callbackConfig.getDomain()+ PayConstant.CALLBACK_PATH+ PayConstant.REFUND_NOTIFY +"/"+ Platform.ALI;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建支付订单
|
||||||
|
* @param payRequest
|
||||||
|
* @return
|
||||||
|
* @throws TradeException
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PayResponse requestPay(PayRequest payRequest, String tradeType) throws TradeException {
|
||||||
|
if(TradeType.NATIVE.equals( tradeType )){
|
||||||
|
return createNativeOrder(payRequest);
|
||||||
|
}
|
||||||
|
if(TradeType.JSAPI.equals( tradeType )){
|
||||||
|
return createJsApiOrder(payRequest);
|
||||||
|
}
|
||||||
|
if(TradeType.H5.equals( tradeType )){
|
||||||
|
return createH5Order(payRequest);
|
||||||
|
}
|
||||||
|
if(TradeType.APP.equals( tradeType )){
|
||||||
|
return createAPPOrder(payRequest);
|
||||||
|
}
|
||||||
|
return createNativeOrder(payRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 本地支付(扫码)
|
||||||
|
* https://opendocs.alipay.com/open/194/106078?ref=api#预下单
|
||||||
|
* @param payRequest
|
||||||
|
* @return
|
||||||
|
* @throws TradeException
|
||||||
|
*/
|
||||||
|
private PayResponse createNativeOrder(PayRequest payRequest) throws TradeException {
|
||||||
|
try {
|
||||||
|
AlipayClient alipayClient = getAliHttpClient();
|
||||||
|
AlipayTradePrecreateRequest request = new AlipayTradePrecreateRequest();
|
||||||
|
|
||||||
|
request.setNotifyUrl(getPayNotifyUrl());
|
||||||
|
|
||||||
|
JSONObject bizContent = new JSONObject();
|
||||||
|
bizContent.put("out_trade_no", payRequest.getOrderSn());
|
||||||
|
//转换
|
||||||
|
//String totalFee= BigDecimal.valueOf(payRequest.getTotalFee()).divide(new BigDecimal(100) ).toString();
|
||||||
|
bizContent.put("total_amount", fenToYuan(payRequest.getTotalFee()));
|
||||||
|
bizContent.put("subject", payRequest.getBody());
|
||||||
|
request.setBizContent(bizContent.toString());
|
||||||
|
AlipayTradePrecreateResponse response = alipayClient.execute(request);
|
||||||
|
|
||||||
|
if (response.isSuccess()) {
|
||||||
|
PayResponse payResponse =new PayResponse();
|
||||||
|
payResponse.setSuccess(true);
|
||||||
|
payResponse.setCode_url(response.getQrCode()); //本地支付二维码
|
||||||
|
payResponse.setOrder_sn(payRequest.getOrderSn());
|
||||||
|
return payResponse;
|
||||||
|
} else {
|
||||||
|
log.error("调用失败");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new TradeException("订单创建失败,订单号:"+ payRequest.getOrderSn());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序
|
||||||
|
* https://opendocs.alipay.com/mini/03l5wn
|
||||||
|
* @param payRequest
|
||||||
|
* @return
|
||||||
|
* @throws TradeException
|
||||||
|
*/
|
||||||
|
private PayResponse createJsApiOrder(PayRequest payRequest) throws TradeException {
|
||||||
|
AlipayClient alipayClient = getAliHttpClient();
|
||||||
|
try {
|
||||||
|
AlipayTradeCreateRequest request = new AlipayTradeCreateRequest();
|
||||||
|
request.setNotifyUrl(getPayNotifyUrl());
|
||||||
|
JSONObject bizContent = new JSONObject();
|
||||||
|
bizContent.put("out_trade_no", payRequest.getOrderSn());
|
||||||
|
bizContent.put("total_amount", fenToYuan( payRequest.getTotalFee() ));
|
||||||
|
bizContent.put("subject", payRequest.getBody());
|
||||||
|
bizContent.put("buyer_id", payRequest.getOpenid());
|
||||||
|
bizContent.put("timeout_express", "10m");
|
||||||
|
request.setBizContent(bizContent.toString());
|
||||||
|
AlipayTradeCreateResponse response = alipayClient.sdkExecute(request);
|
||||||
|
if (response.isSuccess()) {
|
||||||
|
PayResponse payResponse =new PayResponse();
|
||||||
|
payResponse.setSuccess(true);
|
||||||
|
payResponse.setPrepay_id(response.getTradeNo());
|
||||||
|
payResponse.setOrder_sn(response.getOutTradeNo());
|
||||||
|
return payResponse;
|
||||||
|
} else {
|
||||||
|
log.error("调用失败");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
throw new TradeException("订单创建失败,订单号:"+ payRequest.getOrderSn());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* H5
|
||||||
|
* https://opendocs.alipay.com/mini/03l5wn
|
||||||
|
* @param payRequest
|
||||||
|
* @return
|
||||||
|
* @throws TradeException
|
||||||
|
*/
|
||||||
|
private PayResponse createH5Order(PayRequest payRequest) throws TradeException {
|
||||||
|
AlipayClient alipayClient = getAliHttpClient();
|
||||||
|
try {
|
||||||
|
AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest();
|
||||||
|
request.setNotifyUrl(getPayNotifyUrl());
|
||||||
|
request.setReturnUrl("");
|
||||||
|
JSONObject bizContent = new JSONObject();
|
||||||
|
bizContent.put("out_trade_no", payRequest.getOrderSn());
|
||||||
|
bizContent.put("total_amount", fenToYuan( payRequest.getTotalFee() ));
|
||||||
|
bizContent.put("subject", payRequest.getBody());
|
||||||
|
bizContent.put("product_code", "QUICK_WAP_WAY");
|
||||||
|
|
||||||
|
request.setBizContent(bizContent.toString());
|
||||||
|
AlipayTradeWapPayResponse response = alipayClient.pageExecute(request);
|
||||||
|
if (response.isSuccess()) {
|
||||||
|
PayResponse payResponse =new PayResponse();
|
||||||
|
payResponse.setSuccess(true);
|
||||||
|
payResponse.setPrepay_id(response.getTradeNo());
|
||||||
|
payResponse.setOrder_sn(response.getOutTradeNo());
|
||||||
|
return payResponse;
|
||||||
|
} else {
|
||||||
|
log.error("调用失败");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
throw new TradeException("订单创建失败,订单号:"+ payRequest.getOrderSn());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP
|
||||||
|
* https://opendocs.alipay.com/open/02e7gq?ref=api&scene=20
|
||||||
|
* @param payRequest
|
||||||
|
* @return
|
||||||
|
* @throws TradeException
|
||||||
|
*/
|
||||||
|
private PayResponse createAPPOrder(PayRequest payRequest) throws TradeException {
|
||||||
|
AlipayClient alipayClient = getAliHttpClient();
|
||||||
|
try {
|
||||||
|
AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
|
||||||
|
request.setNotifyUrl(getPayNotifyUrl());
|
||||||
|
JSONObject bizContent = new JSONObject();
|
||||||
|
bizContent.put("out_trade_no", payRequest.getOrderSn());
|
||||||
|
bizContent.put("total_amount", fenToYuan( payRequest.getTotalFee() ));
|
||||||
|
bizContent.put("subject", payRequest.getBody());
|
||||||
|
bizContent.put("product_code", "QUICK_MSECURITY_PAY");
|
||||||
|
|
||||||
|
request.setBizContent(bizContent.toString());
|
||||||
|
AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request);
|
||||||
|
if (response.isSuccess()) {
|
||||||
|
PayResponse payResponse =new PayResponse();
|
||||||
|
payResponse.setSuccess(true);
|
||||||
|
payResponse.setPrepay_id(response.getTradeNo());
|
||||||
|
payResponse.setOrder_sn(response.getOutTradeNo());
|
||||||
|
return payResponse;
|
||||||
|
} else {
|
||||||
|
log.error("调用失败");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
throw new TradeException("订单创建失败,订单号:"+ payRequest.getOrderSn());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭订单
|
||||||
|
* @param orderSn
|
||||||
|
* @return
|
||||||
|
* @throws TradeException
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean closePay(String orderSn) throws TradeException {
|
||||||
|
try {
|
||||||
|
AlipayClient alipayClient = getAliHttpClient();
|
||||||
|
AlipayTradeCloseRequest request = new AlipayTradeCloseRequest();
|
||||||
|
JSONObject bizContent = new JSONObject();
|
||||||
|
bizContent.put("trade_no", orderSn);
|
||||||
|
request.setBizContent(bizContent.toString());
|
||||||
|
AlipayTradeCloseResponse response = alipayClient.execute(request);
|
||||||
|
if (response.isSuccess()) {
|
||||||
|
log.info("调用成功");
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
log.error("调用失败");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
throw new TradeException("订单关闭失败,订单号:"+orderSn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款接口
|
||||||
|
* alipay.trade.refund(统一收单交易退款接口)
|
||||||
|
* https://opendocs.alipay.com/open/02ekfk
|
||||||
|
* @param refundRequest
|
||||||
|
* @return
|
||||||
|
* @throws TradeException
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean refund(RefundRequest refundRequest) throws TradeException {
|
||||||
|
try {
|
||||||
|
AlipayClient alipayClient = getAliHttpClient();
|
||||||
|
AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();
|
||||||
|
request.setNotifyUrl(getRefundNotifyUrl()); //退款回调
|
||||||
|
JSONObject bizContent = new JSONObject();
|
||||||
|
bizContent.put("refund_amount", fenToYuan(refundRequest.getRefundAmount() ));
|
||||||
|
bizContent.put("out_trade_no", refundRequest.getOrderSn());
|
||||||
|
//退款请求号,做幂等性校验
|
||||||
|
if(refundRequest.getRequestNo()!=null){
|
||||||
|
bizContent.put("out_request_no", refundRequest.getRequestNo());
|
||||||
|
}else{
|
||||||
|
bizContent.put("out_request_no", refundRequest.getOrderSn());
|
||||||
|
}
|
||||||
|
request.setBizContent(bizContent.toString());
|
||||||
|
AlipayTradeRefundResponse response = alipayClient.execute(request);
|
||||||
|
if (response.isSuccess()) {
|
||||||
|
if("Y".equals(response.getFundChange())) {
|
||||||
|
log.info("退款成功{}",refundRequest.getOrderSn());
|
||||||
|
callBackService.successRefund(refundRequest.getOrderSn());
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
//退款失败
|
||||||
|
log.error("退款失败{}",refundRequest.getOrderSn());
|
||||||
|
callBackService.failRefund(refundRequest.getOrderSn());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.error("退款调用失败{}",refundRequest.getOrderSn());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new TradeException("订单退款失败,订单号:"+ refundRequest.getOrderSn());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询单笔交易订单
|
||||||
|
* 参考官网: https://opendocs.alipay.com/open/02e7gm?ref=api#请求示例
|
||||||
|
*
|
||||||
|
* @param orderSn
|
||||||
|
* @return
|
||||||
|
* @throws TradeException
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public QueryResponse queryTradingOrderNo(String orderSn) throws TradeException {
|
||||||
|
AlipayClient alipayClient = getAliHttpClient();
|
||||||
|
try {
|
||||||
|
AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();
|
||||||
|
JSONObject bizContent = new JSONObject();
|
||||||
|
bizContent.put("out_trade_no", orderSn);
|
||||||
|
request.setBizContent(bizContent.toString());
|
||||||
|
AlipayTradeQueryResponse response = alipayClient.execute(request);
|
||||||
|
QueryResponse queryResponse=new QueryResponse();
|
||||||
|
queryResponse.setOrder_sn(orderSn );
|
||||||
|
if (response.isSuccess()) {
|
||||||
|
queryResponse.setTransaction_id( response.getTradeNo() );
|
||||||
|
queryResponse.setTrade_state(AlipayConstant.TRADE_STATE.get( response.getTradeStatus()) );//交易状态
|
||||||
|
|
||||||
|
//int total = BigDecimal.valueOf(Double.valueOf(response.getTotalAmount())).multiply(new BigDecimal(100)).intValue();
|
||||||
|
queryResponse.setTotal( yuanToFen(response.getTotalAmount()) ); //总金额
|
||||||
|
|
||||||
|
//int buyer_pay_amount = BigDecimal.valueOf(Double.valueOf(response.getBuyerPayAmount())).multiply(new BigDecimal(100)).intValue();
|
||||||
|
//queryResponse.setPayer_total( yuanToFen(response.getBuyerPayAmount()) );//支付金额
|
||||||
|
|
||||||
|
queryResponse.setOpenid( response.getBuyerUserId());
|
||||||
|
Map map = JSON.parseObject(response.getBody(), Map.class ) ;
|
||||||
|
queryResponse.setExpand(map);//全部数据
|
||||||
|
return queryResponse;
|
||||||
|
} else {
|
||||||
|
queryResponse.setTrade_state("NOTPAY");
|
||||||
|
return queryResponse;
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
//throw new TradeException("订单查询失败,订单号:"+orderSn);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询退款订单
|
||||||
|
* @param orderSn
|
||||||
|
* @return
|
||||||
|
* @throws TradeException
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public QueryRefundResponse queryRefundTrading(String orderSn) throws TradeException {
|
||||||
|
try {
|
||||||
|
AlipayClient alipayClient = getAliHttpClient();
|
||||||
|
AlipayTradeFastpayRefundQueryRequest request = new AlipayTradeFastpayRefundQueryRequest();
|
||||||
|
JSONObject bizContent = new JSONObject();
|
||||||
|
bizContent.put("out_request_no", orderSn);
|
||||||
|
request.setBizContent(bizContent.toString());
|
||||||
|
AlipayTradeFastpayRefundQueryResponse response = alipayClient.execute(request);
|
||||||
|
if (response.isSuccess()) {
|
||||||
|
log.info("调用成功");
|
||||||
|
Map map = JSON.parseObject(response.getBody(), Map.class );
|
||||||
|
|
||||||
|
QueryRefundResponse queryRefundResponse=new QueryRefundResponse();
|
||||||
|
|
||||||
|
queryRefundResponse.setOrder_sn( (String) map.get("out_trade_no") );
|
||||||
|
queryRefundResponse.setTransaction_id( (String) map.get("trade_no") );
|
||||||
|
queryRefundResponse.setTotal( (Integer) map.get("total_amount") ); //总金额
|
||||||
|
//queryRefundResponse.setPayer_total( (Integer) map.get("total_amount") );//支付金额
|
||||||
|
queryRefundResponse.setRefund((Integer) map.get("refund_amount") ); //退款金额
|
||||||
|
queryRefundResponse.setRefund_id((String) map.get("trade_no") ); //退款单号
|
||||||
|
queryRefundResponse.setOut_refund_no( (String) map.get("out_request_no") );//退款订单号
|
||||||
|
//queryRefundResponse.setChannel( (String) map.get("channel") ); //通道
|
||||||
|
//queryRefundResponse.setUser_received_account( (String) map.get("user_received_account") ); //账号
|
||||||
|
queryRefundResponse.setStatus( (String) map.get("refund_status") ); //状态
|
||||||
|
queryRefundResponse.setSuccess_time( (String) map.get("gmt_refund_pay") );
|
||||||
|
//queryRefundResponse.setCreate_time( (String) map.get("gmt_refund_pay") );
|
||||||
|
|
||||||
|
queryRefundResponse.setExpand(map);
|
||||||
|
return queryRefundResponse;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
log.error("调用失败");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
//throw new TradeException("退款订单查询失败,订单号:"+ orderSn);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOpenid(String code) {
|
||||||
|
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do",
|
||||||
|
alipayConfig.getAppId(), alipayConfig.getPrivateKey(), "json", "utf-8", alipayConfig.getPublicKey(), alipayConfig.getSignType());
|
||||||
|
AlipaySystemOauthTokenRequest request = new AlipaySystemOauthTokenRequest();
|
||||||
|
request.setCode(code);
|
||||||
|
request.setGrantType("authorization_code");
|
||||||
|
try {
|
||||||
|
AlipaySystemOauthTokenResponse oauthTokenResponse = alipayClient.execute(request);
|
||||||
|
return oauthTokenResponse.getUserId();
|
||||||
|
} catch (AlipayApiException e) {
|
||||||
|
//处理异常
|
||||||
|
e.printStackTrace();
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取支付宝连接
|
||||||
|
* 参考官网:https://opendocs.alipay.com/open/01csp3?ref=api#公钥模式加签
|
||||||
|
* 公钥模式加签
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private AlipayClient getAliHttpClient(){
|
||||||
|
try {
|
||||||
|
com.alipay.api.AlipayConfig alipayConfig = new com.alipay.api.AlipayConfig();
|
||||||
|
alipayConfig.setServerUrl(AlipayConstant.domain);
|
||||||
|
alipayConfig.setAppId(this.alipayConfig.getAppId());
|
||||||
|
alipayConfig.setPrivateKey(this.alipayConfig.getPrivateKey());
|
||||||
|
alipayConfig.setFormat("json");
|
||||||
|
alipayConfig.setCharset("utf-8");
|
||||||
|
alipayConfig.setAlipayPublicKey(this.alipayConfig.getPublicKey());
|
||||||
|
alipayConfig.setSignType(this.alipayConfig.getSignType());
|
||||||
|
//构造client
|
||||||
|
AlipayClient alipayClient = new DefaultAlipayClient(alipayConfig);
|
||||||
|
return alipayClient;
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new TradeException("支付宝支付--初始化,校验系统参数失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分转换为元
|
||||||
|
* @param fen
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String fenToYuan(int fen){
|
||||||
|
//转换为元
|
||||||
|
return BigDecimal.valueOf(fen).divide(new BigDecimal(100) ).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private int yuanToFen(String yuan){
|
||||||
|
return BigDecimal.valueOf(Double.valueOf(yuan)).multiply(new BigDecimal(100)).intValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
package com.ruoyi.ali;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alipay.api.internal.util.AlipaySignature;
|
||||||
|
import com.ruoyi.annotation.TradePlatform;
|
||||||
|
import com.ruoyi.constant.Platform;
|
||||||
|
import com.ruoyi.core.ElegentValid;
|
||||||
|
import com.ruoyi.dto.ValidResponse;
|
||||||
|
import com.ruoyi.exceptions.TradeException;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpEntity;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@TradePlatform(Platform.ALI)
|
||||||
|
@Slf4j
|
||||||
|
public class AlipayElegentValid implements ElegentValid {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AlipayConfig alipayConfig;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单回调结果通知验签
|
||||||
|
* 参考代码: https://opendocs.alipay.com/open/194/103296?ref=api 异步返回结果的验签
|
||||||
|
* @param httpEntity
|
||||||
|
* @param httpRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ValidResponse validPay(HttpEntity<String> httpEntity, HttpServletRequest httpRequest) throws TradeException {
|
||||||
|
ValidResponse validResponse=new ValidResponse();
|
||||||
|
try {
|
||||||
|
Map<String, String> params = getParams(httpRequest);
|
||||||
|
//获取支付宝POST过来反馈信息,将异步通知中收到的待验证所有参数都存放到map中
|
||||||
|
//String body = httpEntity.getBody();
|
||||||
|
//调用SDK验证签名
|
||||||
|
//公钥验签示例代码
|
||||||
|
boolean signVerified = AlipaySignature.rsaCheckV1(params, alipayConfig.getPublicKey(), "utf-8", alipayConfig.getSignType());
|
||||||
|
if (signVerified) {
|
||||||
|
validResponse.setValid(true);
|
||||||
|
validResponse.setOrderSn((String) params.get("out_trade_no"));
|
||||||
|
return validResponse;
|
||||||
|
} else {
|
||||||
|
validResponse.setValid(false);
|
||||||
|
validResponse.setOrderSn( (String) params.get("out_trade_no") );
|
||||||
|
return validResponse;
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new TradeException("验签异常");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款结果通知验签
|
||||||
|
* 参考官网 https://opendocs.alipay.com/support/01ravh
|
||||||
|
* @param httpEntity
|
||||||
|
* @param httpRequest
|
||||||
|
* @return
|
||||||
|
* @throws TradeException
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ValidResponse validRefund(HttpEntity<String> httpEntity, HttpServletRequest httpRequest) throws TradeException {
|
||||||
|
ValidResponse validResponse=new ValidResponse();
|
||||||
|
|
||||||
|
try {
|
||||||
|
//获取支付宝POST过来反馈信息,将异步通知中收到的待验证所有参数都存放到map中
|
||||||
|
Map<String, String> params = getParams(httpRequest);
|
||||||
|
//调用SDK验证签名
|
||||||
|
//公钥验签示例代码
|
||||||
|
boolean signVerified = AlipaySignature.rsaCheckV1(params, alipayConfig.getPublicKey(), "utf-8", alipayConfig.getSignType());
|
||||||
|
if (signVerified) {
|
||||||
|
validResponse.setValid(true);
|
||||||
|
validResponse.setOrderSn( (String) params.get("out_trade_no") );
|
||||||
|
return validResponse;
|
||||||
|
} else {
|
||||||
|
validResponse.setValid(false);
|
||||||
|
validResponse.setOrderSn( (String) params.get("out_trade_no") );
|
||||||
|
return validResponse;
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
validResponse.setValid(false);
|
||||||
|
return validResponse;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String,String> getParams(HttpServletRequest httpServletRequest){
|
||||||
|
Map<String,String> params = new HashMap< String , String >();
|
||||||
|
Map requestParams = httpServletRequest.getParameterMap();
|
||||||
|
|
||||||
|
for(Iterator iter = requestParams.keySet().iterator(); iter.hasNext();){
|
||||||
|
String name = (String)iter.next();
|
||||||
|
String[] values = (String [])requestParams.get(name);
|
||||||
|
String valueStr = "";
|
||||||
|
for(int i = 0;i < values.length;i ++ ){
|
||||||
|
valueStr = (i==values.length-1)?valueStr + values [i]:valueStr + values[i] + ",";
|
||||||
|
}
|
||||||
|
//乱码解决,这段代码在出现乱码时使用。
|
||||||
|
//valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8");
|
||||||
|
params.put (name,valueStr);
|
||||||
|
}
|
||||||
|
log.info("params:{}",params);
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String successResult() {
|
||||||
|
return AlipayConstant.SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String failResult() {
|
||||||
|
return AlipayConstant.FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.ruoyi.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create by: wgl
|
||||||
|
* desc: 自定义支付平台注解,支付平台 微信:wx 支付宝:zfb
|
||||||
|
*/
|
||||||
|
@Documented
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target({ElementType.TYPE})
|
||||||
|
public @interface TradePlatform {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台的id
|
||||||
|
* Platform.WX
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String value();
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.ruoyi.config;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信权限对接类
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@ConfigurationProperties("elegent.pay.callback")
|
||||||
|
@Data
|
||||||
|
public class CallbackConfig {
|
||||||
|
|
||||||
|
private String domain; //回调域名
|
||||||
|
|
||||||
|
@Value("${elegent.pay.callback.watch:false}")
|
||||||
|
private boolean watch; //是否开启监听
|
||||||
|
|
||||||
|
@Value("${elegent.pay.callback.cycle:10}")
|
||||||
|
private int cycle;//检查周期
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.ruoyi.constant;
|
||||||
|
|
||||||
|
public class PayConstant {
|
||||||
|
|
||||||
|
public final static String CALLBACK_PATH = "/payCallBack";
|
||||||
|
|
||||||
|
public final static String NOTIFY = "/notify";
|
||||||
|
|
||||||
|
public final static String REFUND_NOTIFY = "/refund_notify";
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.ruoyi.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Platform
|
||||||
|
* 支付方式
|
||||||
|
*/
|
||||||
|
public class Platform {
|
||||||
|
/**
|
||||||
|
* 微信
|
||||||
|
*/
|
||||||
|
public final static String WX = "wxpay";
|
||||||
|
/**
|
||||||
|
* 支付宝
|
||||||
|
*/
|
||||||
|
public final static String ALI = "alipay";
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.ruoyi.constant;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交易类型
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class TradeType {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* native(扫码)
|
||||||
|
*/
|
||||||
|
public final static String NATIVE = "native";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* jsapi(小程序)
|
||||||
|
*/
|
||||||
|
public final static String JSAPI = "jsapi";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* app
|
||||||
|
*/
|
||||||
|
public final static String APP = "app";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* h5
|
||||||
|
*/
|
||||||
|
public final static String H5 = "h5";
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.ruoyi.core;
|
||||||
|
|
||||||
|
import com.ruoyi.CallBackService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回调类
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class CallBackServiceImpl implements CallBackService {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void successPay(String orderSn) {
|
||||||
|
log.info("支付成功回调!"+orderSn);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void failPay(String orderSn) {
|
||||||
|
log.info("支付失败回调!"+orderSn);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void successRefund(String orderSn) {
|
||||||
|
log.info("退款成功回调!"+orderSn);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void failRefund(String orderSn) {
|
||||||
|
log.info("退款失败回调!"+orderSn);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package com.ruoyi.core;
|
||||||
|
|
||||||
|
import com.ruoyi.CallBackService;
|
||||||
|
import com.ruoyi.constant.PayConstant;
|
||||||
|
import com.ruoyi.dto.ValidResponse;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpEntity;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CallbackController
|
||||||
|
* @description 系统默认提供的微信回调的Controller
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@Slf4j
|
||||||
|
@RequestMapping(PayConstant.CALLBACK_PATH)
|
||||||
|
public class CallbackController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CallBackService callBackService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统提供的默认的微信回调的接口(支付回调)
|
||||||
|
* @param httpEntity
|
||||||
|
* @param response
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping( PayConstant.NOTIFY + "/{platform}")
|
||||||
|
public String notify(HttpEntity<String> httpEntity, HttpServletRequest request, HttpServletResponse response, @PathVariable("platform") String platform){
|
||||||
|
|
||||||
|
ElegentValid elegentValid = ElegentLoader.getElegentValid(platform); //获取验证器
|
||||||
|
try {
|
||||||
|
ValidResponse validResponse = elegentValid.validPay(httpEntity, request);//验证支付通知
|
||||||
|
String orderSn =validResponse.getOrderSn(); //订单号
|
||||||
|
if(validResponse.isValid()){ //返回码成功
|
||||||
|
callBackService.successPay(orderSn);
|
||||||
|
//返回成功消费
|
||||||
|
return elegentValid.successResult();
|
||||||
|
}else{
|
||||||
|
callBackService.failPay(orderSn);
|
||||||
|
return elegentValid.failResult();
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("支付回调处理失败",e);
|
||||||
|
//微信返回的状态非正常
|
||||||
|
return elegentValid.failResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统提供的默认的微信回调的接口(退款通知)
|
||||||
|
*
|
||||||
|
* @param httpEntity
|
||||||
|
* @param response
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping( PayConstant.REFUND_NOTIFY + "/{platform}")
|
||||||
|
public String refundNotify(HttpEntity<String> httpEntity, HttpServletRequest request, HttpServletResponse response,@PathVariable("platform") String platform) {
|
||||||
|
|
||||||
|
ElegentValid elegentValid = ElegentLoader.getElegentValid(platform); //获取验证器
|
||||||
|
|
||||||
|
try {
|
||||||
|
ValidResponse validResponse = elegentValid.validRefund(httpEntity, request);
|
||||||
|
String orderSn = validResponse.getOrderSn();
|
||||||
|
//订单号
|
||||||
|
if (validResponse.isValid()) { //返回码成功
|
||||||
|
callBackService.successRefund(orderSn);
|
||||||
|
//返回成功消费
|
||||||
|
return elegentValid.successResult();
|
||||||
|
} else {
|
||||||
|
callBackService.failRefund(orderSn);
|
||||||
|
return elegentValid.failResult();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("退款回调处理失败", e);
|
||||||
|
//微信返回的状态非正常
|
||||||
|
return elegentValid.failResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package com.ruoyi.core;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.ruoyi.CallBackService;
|
||||||
|
import com.ruoyi.ElegentPay;
|
||||||
|
import com.ruoyi.config.CallbackConfig;
|
||||||
|
import com.ruoyi.dto.QueryRefundResponse;
|
||||||
|
import com.ruoyi.dto.QueryResponse;
|
||||||
|
import com.ruoyi.dto.WatchDTO;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@ConditionalOnProperty(prefix = "elegent.pay.callback",name = "watch",havingValue = "true")
|
||||||
|
@Slf4j
|
||||||
|
public class CallbackWatch {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CallBackService callBackService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CallbackConfig callbackConfig;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ElegentPay elegentPay;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void queryWatch(){
|
||||||
|
if(callbackConfig.getCycle()<=0){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//log.info("开启支付结果定期巡检");
|
||||||
|
Timer timer = new Timer();
|
||||||
|
// 2、创建 TimerTask 任务线程
|
||||||
|
TimerTask task=new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try{
|
||||||
|
//查询支付状态
|
||||||
|
//log.info("支付状态定期巡检,{}",WatchList.payList);
|
||||||
|
for( WatchDTO watchDTO: WatchList.payList ){
|
||||||
|
//查询订单是否支付成功
|
||||||
|
QueryResponse queryResponse = elegentPay.queryTradingOrderNo(watchDTO.getOrderSn(),watchDTO.getPlatform());
|
||||||
|
if("SUCCESS".equals(queryResponse.getTrade_state())){
|
||||||
|
callBackService.successPay(queryResponse.getOrder_sn());
|
||||||
|
WatchList.payList.remove(watchDTO );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//log.info("退款状态定期巡检,{}",WatchList.refundList);
|
||||||
|
//查询退款状态
|
||||||
|
for( WatchDTO watchDTO: WatchList.refundList ){
|
||||||
|
//查询退款中订单
|
||||||
|
QueryRefundResponse queryResponse = elegentPay.queryRefundTrading( watchDTO.getOrderSn(),watchDTO.getPlatform());
|
||||||
|
if("SUCCESS".equals(queryResponse.getStatus())){
|
||||||
|
callBackService.successRefund(queryResponse.getOrder_sn());
|
||||||
|
WatchList.refundList.remove(watchDTO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch (Exception ex){
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// 4、启动定时任务
|
||||||
|
timer.schedule(task, callbackConfig.getCycle()*1000, callbackConfig.getCycle()*1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.ruoyi.core;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ruoyi.CallBackService;
|
||||||
|
import com.ruoyi.key.KeyManager;
|
||||||
|
import com.ruoyi.key.impl.DefaultKeyManager;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class ElegentConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean
|
||||||
|
public CallBackService callBackService(){
|
||||||
|
return new CallBackServiceImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean
|
||||||
|
public KeyManager keyManager(){
|
||||||
|
return new DefaultKeyManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
package com.ruoyi.core;
|
||||||
|
|
||||||
|
import com.ruoyi.annotation.TradePlatform;
|
||||||
|
import com.ruoyi.exceptions.TradeException;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.BeansException;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.ApplicationContextAware;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PlatformLoader
|
||||||
|
* @description 第三方支付平台类加载器
|
||||||
|
* 服务启动的时候自动加载第三方支付组件
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class ElegentLoader implements ApplicationContextAware {
|
||||||
|
|
||||||
|
private static Map<String, ElegentTrade> elegentTradeMap = new HashMap<>();
|
||||||
|
|
||||||
|
private static Map<String, ElegentValid> elegentValidMap = new HashMap<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||||
|
|
||||||
|
//加载所有的交易实现类
|
||||||
|
Collection<ElegentTrade> elegentTrades = applicationContext.getBeansOfType(ElegentTrade.class).values();
|
||||||
|
elegentTrades.stream().forEach(e->{
|
||||||
|
//通过反射拿到类上的平台注解
|
||||||
|
TradePlatform annotation = e.getClass().getAnnotation(TradePlatform.class);
|
||||||
|
if (annotation != null) {
|
||||||
|
elegentTradeMap.put(annotation.value(), e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//加载所有的验证实现类
|
||||||
|
Collection<ElegentValid> elegentValids = applicationContext.getBeansOfType(ElegentValid.class).values();
|
||||||
|
elegentValids.stream().forEach(e->{
|
||||||
|
//通过反射拿到类上的平台注解
|
||||||
|
TradePlatform annotation = e.getClass().getAnnotation(TradePlatform.class);
|
||||||
|
if (annotation != null) {
|
||||||
|
elegentValidMap.put(annotation.value(), e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据平台id获取具体的第三方平台
|
||||||
|
* @param platform 平台id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static ElegentTrade getElegentTrade(String platform){
|
||||||
|
ElegentTrade elegentPayTemplate = elegentTradeMap.get(platform);
|
||||||
|
if(elegentPayTemplate!=null){
|
||||||
|
return elegentPayTemplate;
|
||||||
|
}else{
|
||||||
|
throw new TradeException("未找到适配的交易类型,交易平台id:"+platform);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据平台id获取具体的验证类
|
||||||
|
* @param platform 平台id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static ElegentValid getElegentValid(String platform){
|
||||||
|
ElegentValid elegentValidTemplate = elegentValidMap.get(platform);
|
||||||
|
if(elegentValidTemplate!=null){
|
||||||
|
return elegentValidTemplate;
|
||||||
|
}else{
|
||||||
|
throw new TradeException("未找到适配的交易类型,交易平台id:"+platform);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
package com.ruoyi.core;
|
||||||
|
import com.ruoyi.ElegentPay;
|
||||||
|
import com.ruoyi.config.CallbackConfig;
|
||||||
|
import com.ruoyi.dto.*;
|
||||||
|
import com.ruoyi.exceptions.TradeException;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ElegentPayTemplate
|
||||||
|
* @description 统一模板 在模板层进行第三方平台的选择
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class ElegentPayImpl implements ElegentPay {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CallbackConfig callbackConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统一下单接口
|
||||||
|
* @param payRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PayResponse requestPay(PayRequest payRequest, String tradeType, String platform) throws TradeException {
|
||||||
|
//获取交易策略
|
||||||
|
PayResponse payResponse = getPlatFormService(platform).requestPay(payRequest, tradeType);
|
||||||
|
|
||||||
|
//加入监听列表
|
||||||
|
if(callbackConfig.isWatch()){
|
||||||
|
WatchDTO watchDTO=new WatchDTO();
|
||||||
|
watchDTO.setOrderSn(payRequest.getOrderSn());
|
||||||
|
watchDTO.setPlatform(platform);
|
||||||
|
WatchList.payList.add( watchDTO );
|
||||||
|
}
|
||||||
|
return payResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭订单
|
||||||
|
* @param orderSn
|
||||||
|
* @param platform
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean closePay(String orderSn, String platform) throws TradeException {
|
||||||
|
//调用对应第三方的创建订单接口
|
||||||
|
Boolean aBoolean = getPlatFormService(platform).closePay(orderSn);
|
||||||
|
//加入监听列表
|
||||||
|
if(callbackConfig.isWatch()){
|
||||||
|
WatchDTO watchDTO=new WatchDTO();
|
||||||
|
watchDTO.setOrderSn(orderSn);
|
||||||
|
watchDTO.setPlatform(platform);
|
||||||
|
WatchList.payList.remove( watchDTO );
|
||||||
|
}
|
||||||
|
|
||||||
|
return aBoolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款方法
|
||||||
|
* @param refundRequest
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean refund(RefundRequest refundRequest, String platform) throws TradeException {
|
||||||
|
Boolean refund = getPlatFormService(platform).refund(refundRequest);
|
||||||
|
//加入监听列表
|
||||||
|
if(callbackConfig.isWatch() && refund){
|
||||||
|
WatchDTO watchDTO=new WatchDTO();
|
||||||
|
watchDTO.setOrderSn(refundRequest.getRequestNo());
|
||||||
|
watchDTO.setPlatform(platform);
|
||||||
|
WatchList.refundList.add( watchDTO );
|
||||||
|
}
|
||||||
|
return refund;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手动查询订单的方法
|
||||||
|
* 商户订单号查询 根据订单号查询订单
|
||||||
|
* 该接口基于生成的订单号来进行订单的查询
|
||||||
|
* 可以基于查询的结果判断用户订单是否支付成功
|
||||||
|
* @param orderSn
|
||||||
|
* @param Platform
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public QueryResponse queryTradingOrderNo(String orderSn , String Platform) throws TradeException {
|
||||||
|
//调用具体第三方的退款接口
|
||||||
|
return getPlatFormService(Platform).queryTradingOrderNo(orderSn);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询退款单号
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public QueryRefundResponse queryRefundTrading(String orderSn , String platform) throws TradeException {
|
||||||
|
//获取请求参数
|
||||||
|
return getPlatFormService(platform).queryRefundTrading(orderSn);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得openId
|
||||||
|
* @param code
|
||||||
|
* @param platform
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getOpenid(String code, String platform) {
|
||||||
|
return getPlatFormService(platform).getOpenid(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ====================================提供的模板类需要使用的方法=====================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跟进具体内容获取实现类的方法
|
||||||
|
* @param platForm
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private ElegentTrade getPlatFormService(String platForm) {
|
||||||
|
return ElegentLoader.getElegentTrade(platForm);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package com.ruoyi.core;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ruoyi.dto.*;
|
||||||
|
import com.ruoyi.exceptions.TradeException;
|
||||||
|
|
||||||
|
public interface ElegentTrade {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单独的创建本地支付订单接口
|
||||||
|
* 该接口基于设计模式实现,对接了微信V3版支付代码和支付宝支付sdk
|
||||||
|
* 业务编写人员仅仅只需要准备好请求参数调用该方法即可完成下单请求
|
||||||
|
* @return 交易数据对象 包含有native支付的二维码+jsApi支付的支付组件
|
||||||
|
*/
|
||||||
|
PayResponse requestPay(PayRequest payRequest, String tradeType) throws TradeException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭订单
|
||||||
|
* 该结构基于设计模式实现,对接了微信V3版支付代码和支付宝支付sdk
|
||||||
|
* 业务编写人员在处理超时订单的时候需要 通知微信 由于是超时订单需要进行远程关闭
|
||||||
|
*/
|
||||||
|
Boolean closePay(String orderSn) throws TradeException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款s申请
|
||||||
|
* 该接口基于设计模式实现,对接了微信V3版支付代码和支付宝支付sdk
|
||||||
|
* 业务编写人员在处理业务执行失败时需要进行退款
|
||||||
|
*/
|
||||||
|
Boolean refund(RefundRequest refundRequest) throws TradeException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户订单号查询 根据订单号查询订单
|
||||||
|
* 该接口基于生成的订单号来进行订单的查询
|
||||||
|
* 可以基于查询的结果判断用户订单是否支付成功
|
||||||
|
*/
|
||||||
|
QueryResponse queryTradingOrderNo(String orderSn) throws TradeException;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询单笔退款API
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
QueryRefundResponse queryRefundTrading(String orderSn) throws TradeException;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得openId
|
||||||
|
* @param code
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getOpenid(String code);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.ruoyi.core;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ruoyi.dto.ValidResponse;
|
||||||
|
import com.ruoyi.exceptions.TradeException;
|
||||||
|
import org.springframework.http.HttpEntity;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证器接口
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface ElegentValid {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付结果通知校验
|
||||||
|
* 该接口基于设计模式实现,对接了微信V3版支付代码和支付宝支付sdk
|
||||||
|
* 业务编写人员在接收到微信或支付宝回调的时候可以使用该方法验证回调是否成功,是否是伪回调
|
||||||
|
* @return 交易数据对象
|
||||||
|
*/
|
||||||
|
ValidResponse validPay(HttpEntity<String> httpEntity, HttpServletRequest request) throws TradeException;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款结果通知校验
|
||||||
|
* 该接口基于设计模式实现,对接了微信V3版支付代码和支付宝支付sdk
|
||||||
|
* 业务编写人员在接收到微信或支付宝回调的时候可以使用该方法验证回调是否成功,是否是伪回调
|
||||||
|
*/
|
||||||
|
ValidResponse validRefund(HttpEntity<String> httpEntity, HttpServletRequest request) throws TradeException;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成功返回结构
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String successResult();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失败返回内容
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String failResult();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.ruoyi.core;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.ruoyi.dto.WatchDTO;
|
||||||
|
|
||||||
|
import java.util.concurrent.CopyOnWriteArraySet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监听列表
|
||||||
|
*/
|
||||||
|
public class WatchList {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static CopyOnWriteArraySet<WatchDTO> payList=new CopyOnWriteArraySet<>(); //支付中列表
|
||||||
|
|
||||||
|
public static CopyOnWriteArraySet<WatchDTO> refundList=new CopyOnWriteArraySet<>(); //退款中列表
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.ruoyi.dto;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PayRequest
|
||||||
|
* 支付请求外观类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PayRequest {
|
||||||
|
|
||||||
|
private String body;//商品描述
|
||||||
|
|
||||||
|
private String orderSn; //订单号
|
||||||
|
|
||||||
|
private int totalFee; //订单金额
|
||||||
|
|
||||||
|
private String openid;//openId
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.ruoyi.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结果统一封装类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PayResponse {
|
||||||
|
|
||||||
|
private boolean success; //是否成功
|
||||||
|
|
||||||
|
private String message;//信息
|
||||||
|
|
||||||
|
private String order_sn;//订单编号
|
||||||
|
|
||||||
|
private Map<String,String> expand;//扩展属性
|
||||||
|
|
||||||
|
private String code_url;//二维码连接(native返回)
|
||||||
|
|
||||||
|
private String prepay_id;//预支付Id(小程序返回)
|
||||||
|
|
||||||
|
private String h5_url;//支付跳转链接
|
||||||
|
|
||||||
|
private Map<String,String> jsapiData;//小程序返回
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.ruoyi.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class QueryRefundResponse extends QueryResponse{
|
||||||
|
|
||||||
|
|
||||||
|
private String refund_id; //微信支付退款单号
|
||||||
|
|
||||||
|
private String out_refund_no;//商户退款单号
|
||||||
|
|
||||||
|
private String channel;//退款渠道
|
||||||
|
|
||||||
|
private String user_received_account;//退款账号
|
||||||
|
|
||||||
|
private String success_time;//退款成功时间
|
||||||
|
|
||||||
|
private String status;//退款状态
|
||||||
|
|
||||||
|
private int refund;//退款金额
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.ruoyi.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询响应对象
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class QueryResponse {
|
||||||
|
|
||||||
|
private String openid;//用户id
|
||||||
|
|
||||||
|
private String trade_state;//交易状态
|
||||||
|
|
||||||
|
private String order_sn;//订单号
|
||||||
|
|
||||||
|
private String transaction_id;//交易单号
|
||||||
|
|
||||||
|
private int total;//金额
|
||||||
|
|
||||||
|
private Map expand;//扩展(全部的返回数据)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.ruoyi.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class RefundRequest {
|
||||||
|
|
||||||
|
private int totalFee; //订单金额
|
||||||
|
|
||||||
|
private int refundAmount; //退款金额
|
||||||
|
|
||||||
|
private String orderSn; //订单号
|
||||||
|
|
||||||
|
private String requestNo; //退款请求号,做退款幂等性校验,当部分退款时必须给出
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.ruoyi.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证签名
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ValidResponse {
|
||||||
|
|
||||||
|
private boolean isValid;// 是否通过验签
|
||||||
|
|
||||||
|
private String orderSn;// 订单号
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.ruoyi.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class WatchDTO {
|
||||||
|
|
||||||
|
private String orderSn; //订单号
|
||||||
|
|
||||||
|
private String platform;//平台
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.ruoyi.exceptions;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交易SDK提供的总的异常
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class TradeException extends RuntimeException{
|
||||||
|
private String code;
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
public TradeException(String code, String msg) {
|
||||||
|
super(msg);
|
||||||
|
this.code = code;
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TradeException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.ruoyi.key;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 密钥管理器接口
|
||||||
|
*/
|
||||||
|
public interface KeyManager {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据名字获取key字符串
|
||||||
|
* @param name
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getKey(String name);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.ruoyi.key.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ruoyi.key.KeyManager;
|
||||||
|
import com.ruoyi.util.FileUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认的key管理器-文件管理器
|
||||||
|
*/
|
||||||
|
public class DefaultKeyManager implements KeyManager {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey(String name) {
|
||||||
|
return FileUtil.readToStr(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.ruoyi.util;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件读取类
|
||||||
|
*/
|
||||||
|
public class FileUtil {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取文件内容
|
||||||
|
* @param fileName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String readToStr(String fileName){
|
||||||
|
InputStream is = FileUtil.class.getClassLoader().getResourceAsStream(fileName);
|
||||||
|
ByteArrayOutputStream os = new ByteArrayOutputStream(2048);
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
|
||||||
|
String str;
|
||||||
|
try {
|
||||||
|
int length;
|
||||||
|
while((length = is.read(buffer)) != -1) {
|
||||||
|
os.write(buffer, 0, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
str = os.toString("UTF-8");
|
||||||
|
} catch (IOException var5) {
|
||||||
|
throw new IllegalArgumentException("无效的密钥", var5);
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,459 @@
|
|||||||
|
package com.ruoyi.wx;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.util.CharsetUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.ruoyi.annotation.TradePlatform;
|
||||||
|
import com.ruoyi.config.CallbackConfig;
|
||||||
|
import com.ruoyi.constant.PayConstant;
|
||||||
|
import com.ruoyi.constant.Platform;
|
||||||
|
import com.ruoyi.core.ElegentTrade;
|
||||||
|
import com.ruoyi.dto.*;
|
||||||
|
import com.ruoyi.exceptions.TradeException;
|
||||||
|
import com.ruoyi.util.FileUtil;
|
||||||
|
import com.wechat.pay.contrib.apache.httpclient.WechatPayHttpClientBuilder;
|
||||||
|
import com.wechat.pay.contrib.apache.httpclient.auth.PrivateKeySigner;
|
||||||
|
import com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Credentials;
|
||||||
|
import com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Validator;
|
||||||
|
import com.wechat.pay.contrib.apache.httpclient.cert.CertificatesManager;
|
||||||
|
import com.wechat.pay.contrib.apache.httpclient.util.PemUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||||
|
import org.apache.http.client.methods.HttpGet;
|
||||||
|
import org.apache.http.client.methods.HttpPost;
|
||||||
|
import org.apache.http.client.utils.URIBuilder;
|
||||||
|
import org.apache.http.entity.StringEntity;
|
||||||
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
|
import org.apache.http.util.EntityUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.security.PrivateKey;
|
||||||
|
import java.security.Signature;
|
||||||
|
import java.util.Base64;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
@TradePlatform(Platform.WX)
|
||||||
|
public class WxPayElegentTrade implements ElegentTrade {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WxpayConfig wxpayConfig;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CallbackConfig callbackConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建微信支付订单方法
|
||||||
|
* 这里参考官网代码:
|
||||||
|
* https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_4_1.shtml Native下单
|
||||||
|
* https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_1.shtml JSAPI 下单
|
||||||
|
* https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_3_1.shtml H5下单
|
||||||
|
* https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_2_1.shtml APP下单
|
||||||
|
* @param payRequest 支付请求
|
||||||
|
* @return 支付响应
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PayResponse requestPay(PayRequest payRequest, String tradeType)throws TradeException {
|
||||||
|
PayResponse payResponse = new PayResponse(); //返回结果
|
||||||
|
try {
|
||||||
|
// 请求body参数构建
|
||||||
|
Map<String, Object> params = new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("mchid", wxpayConfig.getMchId());
|
||||||
|
put("appid", wxpayConfig.getAppId());
|
||||||
|
put("notify_url", callbackConfig.getDomain()+ PayConstant.CALLBACK_PATH + PayConstant.NOTIFY +"/"+ Platform.WX );
|
||||||
|
put("out_trade_no", payRequest.getOrderSn());
|
||||||
|
put("amount", new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("total", payRequest.getTotalFee());//金额,单位:分
|
||||||
|
put("currency", "CNY");//人民币
|
||||||
|
}
|
||||||
|
});
|
||||||
|
put("description", payRequest.getBody());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if("h5".equals(tradeType)){ //h5
|
||||||
|
params.put("scene_info", new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("payer_client_ip", "127.0.0.1");
|
||||||
|
put("h5_info", new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("type", "Wap");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if ("jsapi".equals(tradeType)) { //如果是小程序支付
|
||||||
|
params.put("payer", new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("openid", payRequest.getOpenid());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
String url = WxpayConstant.createOrder + tradeType; //创建订单
|
||||||
|
log.info("elegent-pay 请求参数{}",params);
|
||||||
|
Map<String, String> map = postApiTemplate(url, params);
|
||||||
|
|
||||||
|
if("SUCCESS".equals( map.get("code") )){
|
||||||
|
payResponse.setOrder_sn(payRequest.getOrderSn());
|
||||||
|
payResponse.setSuccess(true);
|
||||||
|
payResponse.setCode_url(map.get("code_url"));
|
||||||
|
payResponse.setMessage(map.get("message"));
|
||||||
|
|
||||||
|
payResponse.setPrepay_id(map.get("prepay_id"));
|
||||||
|
payResponse.setH5_url( map.get("h5_url") );
|
||||||
|
|
||||||
|
payResponse.setExpand(map); //全部数据
|
||||||
|
|
||||||
|
if("jsapi".equals(tradeType)){//如果是小程序,需要封装到Expand
|
||||||
|
Map<String, String> data=new HashMap<>();
|
||||||
|
String timeStamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||||
|
String nonceStr = IdUtil.simpleUUID();
|
||||||
|
String packages = "prepay_id=" + payResponse.getPrepay_id();
|
||||||
|
String privateKey = FileUtil.readToStr("wxpay_private.key");
|
||||||
|
String paySign = this.createPaySign(wxpayConfig.getAppId(), timeStamp, nonceStr, packages, privateKey);
|
||||||
|
data.put("appId", wxpayConfig.getAppId());// appid
|
||||||
|
data.put("timeStamp", timeStamp);// 时间戳
|
||||||
|
data.put("nonceStr", nonceStr);// 随机字符串
|
||||||
|
data.put("package","prepay_id="+payResponse.getPrepay_id());
|
||||||
|
data.put("signType", "RSA");// 签名类型,默认为RSA,仅支持RSA
|
||||||
|
data.put("paySign", paySign);// 签名
|
||||||
|
data.put("orderNo",payRequest.getOrderSn());
|
||||||
|
payResponse.setJsapiData(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
log.info("createOrder: {}", payResponse);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
payResponse.setSuccess(false);
|
||||||
|
payResponse.setMessage( map.get("message") );
|
||||||
|
}
|
||||||
|
return payResponse;
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
payResponse.setSuccess(false);
|
||||||
|
}
|
||||||
|
return payResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭订单
|
||||||
|
* 参考官网代码
|
||||||
|
* https://pay.weixin.qq.com/wiki/doc/apiv3/open/pay/chapter2_7_2.shtml 3.2.5. 【服务端】关闭订单
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean closePay(String orderSn) throws TradeException {
|
||||||
|
// 请求body参数构建
|
||||||
|
Map<String, Object> params = new HashMap<String, Object>();
|
||||||
|
params.put("mchid", wxpayConfig.getMchId());
|
||||||
|
String url = WxpayConstant.closeOrder.replaceAll("\\{out_trade_no\\}",orderSn);
|
||||||
|
Map map = postApiTemplate(url, params);
|
||||||
|
if("SUCCESS".equals( map.get("code"))){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款
|
||||||
|
* 参考官网代码 https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_3_9.shtml
|
||||||
|
* @param refundRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean refund(RefundRequest refundRequest) {
|
||||||
|
// 请求body参数构建
|
||||||
|
// 请求body参数构建
|
||||||
|
Map<String, Object> params = new HashMap<String, Object>();
|
||||||
|
params.put("notify_url", callbackConfig.getDomain()+ PayConstant.CALLBACK_PATH +PayConstant.REFUND_NOTIFY +"/"+ Platform.WX ); //回调地址
|
||||||
|
params.put("out_trade_no", refundRequest.getOrderSn());//订单编号
|
||||||
|
//out_refund_no
|
||||||
|
params.put("out_refund_no", refundRequest.getRequestNo());//退款申请单编号 (多次退款需要不一样才行)
|
||||||
|
params.put("amount", new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("refund",refundRequest.getRefundAmount());//退款金额
|
||||||
|
put("total", refundRequest.getTotalFee());//原金额,单位:分
|
||||||
|
put("currency", "CNY");//人民币
|
||||||
|
}
|
||||||
|
});
|
||||||
|
String url = WxpayConstant.refund; //创建订单
|
||||||
|
Map map = postApiTemplate(url, params);
|
||||||
|
if("SUCCESS".equals( map.get("code"))){
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手动查询订单
|
||||||
|
* 参考官网代码: https://pay.weixin.qq.com/wiki/doc/apiv3/open/pay/chapter2_6_2.shtml 3.2.4. 【服务端】查询订单
|
||||||
|
* @param orderSn
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public QueryResponse queryTradingOrderNo(String orderSn) throws TradeException {
|
||||||
|
// 请求body参数构建
|
||||||
|
Map<String, String> params = new HashMap<String, String>();
|
||||||
|
params.put("mchid", wxpayConfig.getMchId());
|
||||||
|
String url = WxpayConstant.queryOrderNo+orderSn;;
|
||||||
|
try {
|
||||||
|
Map map = getApiTemplate(url, params);
|
||||||
|
QueryResponse queryResponse=new QueryResponse();
|
||||||
|
queryResponse.setOrder_sn((String)map.get("out_trade_no") ); //订单号
|
||||||
|
queryResponse.setTransaction_id((String)map.get("transaction_id") ); //交易单类型
|
||||||
|
queryResponse.setTrade_state( (String) map.get("trade_state") );//交易状态
|
||||||
|
Map amount = (Map)map.get("amount");
|
||||||
|
if(amount!=null){
|
||||||
|
queryResponse.setTotal( (Integer) amount.get("total") ); //总金额
|
||||||
|
}
|
||||||
|
Map payer= (Map)map.get("payer");
|
||||||
|
if(payer!=null){
|
||||||
|
queryResponse.setOpenid( (String)payer.get("openid") );
|
||||||
|
}
|
||||||
|
queryResponse.setExpand(map);//全部数据
|
||||||
|
return queryResponse;
|
||||||
|
|
||||||
|
} catch (URISyntaxException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询退款订单
|
||||||
|
* https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_4_10.shtml
|
||||||
|
* @param out_refund_no
|
||||||
|
* @return
|
||||||
|
* @throws TradeException
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public QueryRefundResponse queryRefundTrading(String out_refund_no) throws TradeException {
|
||||||
|
|
||||||
|
// 请求body参数构建
|
||||||
|
Map<String, String> params = new HashMap<String, String>();
|
||||||
|
String url = WxpayConstant.queryRufundOrderNo + out_refund_no;
|
||||||
|
try {
|
||||||
|
Map map = getApiTemplate(url, params);
|
||||||
|
QueryRefundResponse queryRefundResponse=new QueryRefundResponse();
|
||||||
|
queryRefundResponse.setOrder_sn( (String) map.get("out_trade_no") );
|
||||||
|
queryRefundResponse.setTransaction_id( (String) map.get("transaction_id") );
|
||||||
|
Map amount = (Map)map.get("amount");
|
||||||
|
queryRefundResponse.setTotal( (Integer) amount.get("total") ); //总金额
|
||||||
|
queryRefundResponse.setRefund((Integer) amount.get("payer_refund") ); //退款金额
|
||||||
|
queryRefundResponse.setRefund_id((String) map.get("refund_id") ); //退款单号
|
||||||
|
queryRefundResponse.setOut_refund_no( (String) map.get("out_refund_no") );//退款订单号
|
||||||
|
|
||||||
|
queryRefundResponse.setChannel( (String) map.get("channel") ); //通道
|
||||||
|
queryRefundResponse.setUser_received_account( (String) map.get("user_received_account") ); //账号
|
||||||
|
queryRefundResponse.setStatus( (String) map.get("status") ); //状态
|
||||||
|
queryRefundResponse.setSuccess_time( (String) map.get("success_time") );
|
||||||
|
queryRefundResponse.setExpand(map);
|
||||||
|
return queryRefundResponse;
|
||||||
|
} catch (URISyntaxException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOpenid(String code) {
|
||||||
|
String getOpenIdUrl = "https://api.weixin.qq.com/sns/jscode2session?" +
|
||||||
|
"appid="+wxpayConfig.getAppId()
|
||||||
|
+"&secret="+wxpayConfig.getAppSecret()
|
||||||
|
+"&js_code="+code+"&grant_type=authorization_code";
|
||||||
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
|
String respResult = restTemplate.getForObject(getOpenIdUrl,String.class);
|
||||||
|
log.info("获取openid的url:{},respResult:{}",getOpenIdUrl,respResult);
|
||||||
|
if( respResult==null || "".equals(respResult) ) return "";
|
||||||
|
try{
|
||||||
|
|
||||||
|
Map<String,String> map = JSON.parseObject(respResult, Map.class);
|
||||||
|
String errorCode = map.get("errcode") ;
|
||||||
|
if(errorCode!=null && !"".equals(errorCode)){
|
||||||
|
int errorCodeInt = Integer.valueOf(errorCode).intValue();
|
||||||
|
|
||||||
|
log.info("获取openid的errorCode,{}",errorCodeInt);
|
||||||
|
if(errorCodeInt != 0) return "";
|
||||||
|
}
|
||||||
|
return map.get("openid");
|
||||||
|
}catch (Exception ex){
|
||||||
|
ex.printStackTrace();
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Map getApiTemplate(String url, Map<String, String> params) throws URISyntaxException, IOException {
|
||||||
|
URIBuilder uriBuilder = new URIBuilder(url);
|
||||||
|
//添加参数
|
||||||
|
for (String key : params.keySet()) {
|
||||||
|
uriBuilder.addParameter(key, params.get(key));
|
||||||
|
}
|
||||||
|
//完成签名并执行请求
|
||||||
|
HttpGet httpGet = new HttpGet(uriBuilder.build());
|
||||||
|
httpGet.addHeader("Accept", "application/json");
|
||||||
|
CloseableHttpClient httpClient = getWxHttpClient();
|
||||||
|
CloseableHttpResponse response = httpClient.execute(httpGet);
|
||||||
|
return responseTemplate(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Map responseTemplate(CloseableHttpResponse response) {
|
||||||
|
Map result = null;
|
||||||
|
try {
|
||||||
|
int statusCode = response.getStatusLine().getStatusCode();
|
||||||
|
if (statusCode == 200) { //处理成功
|
||||||
|
// log.info("success,return body = " + EntityUtils.toString(response.getEntity()));
|
||||||
|
result = JSON.parseObject(EntityUtils.toString(response.getEntity()), Map.class);
|
||||||
|
result.put("code", "SUCCESS");
|
||||||
|
} else if (statusCode == 204) { //处理成功,无返回Body
|
||||||
|
log.info("success");
|
||||||
|
result = new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("code", "SUCCESS");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
String returnBody = EntityUtils.toString(response.getEntity());
|
||||||
|
log.error("failed,resp code = " + statusCode + ",return body = " + returnBody);
|
||||||
|
//throw new TradeException("创建本地支付订单失败!"+payDTO.getOrderSn());
|
||||||
|
Map<String, String> map = JSON.parseObject(returnBody, Map.class);
|
||||||
|
result = new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("code", "FAIL");
|
||||||
|
put("message", map.get("message"));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
result = new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("code", "FAIL");
|
||||||
|
put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} finally {
|
||||||
|
closeConnect(response);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map postApiTemplate(String url, Map<String, Object> params) {
|
||||||
|
try {
|
||||||
|
HttpPost httpPost = new HttpPost(url);
|
||||||
|
StringEntity entity = new StringEntity(JSON.toJSONString(params));
|
||||||
|
entity.setContentType("application/json");
|
||||||
|
httpPost.setEntity(entity);
|
||||||
|
httpPost.setHeader("Accept", "application/json");
|
||||||
|
//完成签名并执行请求
|
||||||
|
CloseableHttpClient httpClient = getWxHttpClient();
|
||||||
|
CloseableHttpResponse response = httpClient.execute(httpPost);
|
||||||
|
return responseTemplate( response );
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取微信HTTP连接
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private CloseableHttpClient getWxHttpClient() {
|
||||||
|
try {
|
||||||
|
//这里对秘钥进行加密使用的完全是官网上的代码
|
||||||
|
// 参考官网代码 https://pay.weixin.qq.com/wiki/doc/apiv3/open/pay/chapter2_6_2.shtml
|
||||||
|
// 加载商户私钥(privateKey:私钥字符串)
|
||||||
|
String key = FileUtil.readToStr("wxpay_private.key");
|
||||||
|
|
||||||
|
PrivateKey merchantPrivateKey = PemUtil
|
||||||
|
.loadPrivateKey(new ByteArrayInputStream(key.getBytes("utf-8")));
|
||||||
|
// 加载平台证书(mchId:商户号,mchSerialNo:商户证书序列号,apiV3Key:V3密钥)
|
||||||
|
//PrivateKey merchantPrivateKey = keyManager.getPrivateKey("wxpay_private.key");//读取私钥
|
||||||
|
PrivateKeySigner privateKeySigner = new PrivateKeySigner(wxpayConfig.getMchSerialNo(), merchantPrivateKey);
|
||||||
|
WechatPay2Credentials wechatPay2Credentials = new WechatPay2Credentials(
|
||||||
|
wxpayConfig.getMchId(), privateKeySigner);
|
||||||
|
// 向证书管理器增加需要自动更新平台证书的商户信息
|
||||||
|
CertificatesManager certificatesManager = CertificatesManager.getInstance();
|
||||||
|
certificatesManager.putMerchant(wxpayConfig.getMchId(), wechatPay2Credentials, wxpayConfig.getApiV3Key().getBytes("utf-8"));
|
||||||
|
// 初始化httpClient
|
||||||
|
return WechatPayHttpClientBuilder.create()
|
||||||
|
.withMerchant(wxpayConfig.getMchId(), wxpayConfig.getMchSerialNo(), merchantPrivateKey)
|
||||||
|
.withValidator(new WechatPay2Validator(certificatesManager.getVerifier(wxpayConfig.getMchId()))).build();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new RuntimeException("微信支付--初始化,校验系统参数失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭资源
|
||||||
|
*/
|
||||||
|
private void closeConnect(CloseableHttpResponse response) {
|
||||||
|
try {
|
||||||
|
response.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new RuntimeException("资源回收出错");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建支付签名
|
||||||
|
* @param appid
|
||||||
|
* @param timeStamp
|
||||||
|
* @param nonceStr
|
||||||
|
* @param packages
|
||||||
|
* @param privateKey
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private String createPaySign(String appid, String timeStamp, String nonceStr, String packages,String privateKey) throws Exception {
|
||||||
|
Signature sign = Signature.getInstance("SHA256withRSA");
|
||||||
|
// 加载商户私钥
|
||||||
|
PrivateKey key = PemUtil
|
||||||
|
.loadPrivateKey(new ByteArrayInputStream(privateKey.getBytes(CharsetUtil.CHARSET_UTF_8)));
|
||||||
|
sign.initSign(key);
|
||||||
|
String message = StrUtil.format("{}\n{}\n{}\n{}\n",
|
||||||
|
appid,
|
||||||
|
timeStamp,
|
||||||
|
nonceStr,
|
||||||
|
packages);
|
||||||
|
sign.update(message.getBytes());
|
||||||
|
return Base64.getEncoder().encodeToString(sign.sign());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,153 @@
|
|||||||
|
package com.ruoyi.wx;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.ruoyi.annotation.TradePlatform;
|
||||||
|
import com.ruoyi.constant.Platform;
|
||||||
|
import com.ruoyi.core.ElegentValid;
|
||||||
|
import com.ruoyi.dto.ValidResponse;
|
||||||
|
import com.ruoyi.exceptions.TradeException;
|
||||||
|
import com.wechat.pay.contrib.apache.httpclient.auth.Verifier;
|
||||||
|
import com.wechat.pay.contrib.apache.httpclient.cert.CertificatesManager;
|
||||||
|
import com.wechat.pay.contrib.apache.httpclient.notification.Notification;
|
||||||
|
import com.wechat.pay.contrib.apache.httpclient.notification.NotificationHandler;
|
||||||
|
import com.wechat.pay.contrib.apache.httpclient.notification.NotificationRequest;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpEntity;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
@TradePlatform(Platform.WX)
|
||||||
|
public class WxPayElegentValid implements ElegentValid {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WxpayConfig wxpayConfig;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ValidResponse validPay(HttpEntity<String> httpEntity, HttpServletRequest httpServletRequest) throws TradeException {
|
||||||
|
ValidResponse validResponse=new ValidResponse();
|
||||||
|
|
||||||
|
try {
|
||||||
|
//获取请求头
|
||||||
|
HttpHeaders headers = httpEntity.getHeaders();
|
||||||
|
//构建微信请求数据对象
|
||||||
|
NotificationRequest request = new NotificationRequest.Builder()
|
||||||
|
.withSerialNumber(headers.getFirst("Wechatpay-Serial")) //证书序列号(微信平台)
|
||||||
|
.withNonce(headers.getFirst("Wechatpay-Nonce")) //随机串
|
||||||
|
.withTimestamp(headers.getFirst("Wechatpay-Timestamp")) //时间戳
|
||||||
|
.withSignature(headers.getFirst("Wechatpay-Signature")) //签名字符串
|
||||||
|
.withBody(httpEntity.getBody())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
|
||||||
|
//微信通知的业务处理
|
||||||
|
//验证签名,确保请求来自微信
|
||||||
|
Map jsonData = null;
|
||||||
|
try {
|
||||||
|
//确保在管理器中存在自动更新的商户证书
|
||||||
|
CertificatesManager certificatesManager = CertificatesManager.getInstance();
|
||||||
|
Verifier verifier = certificatesManager.getVerifier(wxpayConfig.getMchId());
|
||||||
|
|
||||||
|
//验签和解析请求数据
|
||||||
|
NotificationHandler notificationHandler = new NotificationHandler(verifier, wxpayConfig.getApiV3Key().getBytes(StandardCharsets.UTF_8));
|
||||||
|
Notification notification = notificationHandler.parse(request);
|
||||||
|
|
||||||
|
if (!"TRANSACTION.SUCCESS".equals(notification.getEventType())) {
|
||||||
|
validResponse.setValid(false);
|
||||||
|
return validResponse;
|
||||||
|
}
|
||||||
|
//获取解密后的数据
|
||||||
|
jsonData = JSON.parseObject(notification.getDecryptData(),Map.class );
|
||||||
|
log.info("解密后的数据为:"+jsonData);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new TradeException("验签失败");
|
||||||
|
}
|
||||||
|
if (!"SUCCESS".equals(jsonData.get("trade_state"))) {
|
||||||
|
validResponse.setValid(false);
|
||||||
|
return validResponse;
|
||||||
|
}
|
||||||
|
validResponse.setValid(true);
|
||||||
|
validResponse.setOrderSn( (String) jsonData.get("out_trade_no") ); //订单号
|
||||||
|
return validResponse;
|
||||||
|
} catch (Exception e) {
|
||||||
|
validResponse.setValid(false);
|
||||||
|
return validResponse;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ValidResponse validRefund(HttpEntity<String> httpEntity, HttpServletRequest httpServletRequest) throws TradeException {
|
||||||
|
|
||||||
|
ValidResponse validResponse=new ValidResponse();
|
||||||
|
try {
|
||||||
|
//获取请求头
|
||||||
|
HttpHeaders headers = httpEntity.getHeaders();
|
||||||
|
|
||||||
|
//构建微信请求数据对象
|
||||||
|
NotificationRequest request = new NotificationRequest.Builder()
|
||||||
|
.withSerialNumber(headers.getFirst("Wechatpay-Serial")) //证书序列号(微信平台)
|
||||||
|
.withNonce(headers.getFirst("Wechatpay-Nonce")) //随机串
|
||||||
|
.withTimestamp(headers.getFirst("Wechatpay-Timestamp")) //时间戳
|
||||||
|
.withSignature(headers.getFirst("Wechatpay-Signature")) //签名字符串
|
||||||
|
.withBody(httpEntity.getBody())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
//微信通知的业务处理
|
||||||
|
Map jsonData = null;
|
||||||
|
//验证签名,确保请求来自微信
|
||||||
|
try {
|
||||||
|
//确保在管理器中存在自动更新的商户证书
|
||||||
|
CertificatesManager certificatesManager = CertificatesManager.getInstance();
|
||||||
|
Verifier verifier = certificatesManager.getVerifier(wxpayConfig.getMchId());
|
||||||
|
|
||||||
|
//验签和解析请求数据
|
||||||
|
NotificationHandler notificationHandler = new NotificationHandler(verifier, wxpayConfig.getApiV3Key().getBytes(StandardCharsets.UTF_8));
|
||||||
|
Notification notification = notificationHandler.parse(request);
|
||||||
|
|
||||||
|
if (!"REFUND.SUCCESS".equals(notification.getEventType())) {
|
||||||
|
//非成功请求直接返回,理论上都是成功的请求
|
||||||
|
validResponse.setValid(false);
|
||||||
|
return validResponse;
|
||||||
|
}
|
||||||
|
//获取解密后的数据
|
||||||
|
jsonData = JSON.parseObject( notification.getDecryptData(),Map.class );
|
||||||
|
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new TradeException("验签失败");
|
||||||
|
}
|
||||||
|
if (!"SUCCESS".equals(jsonData.get("refund_status"))) {
|
||||||
|
//非成功请求直接返回,理论上都是成功的请求
|
||||||
|
validResponse.setValid(false);
|
||||||
|
return validResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
//交易单号
|
||||||
|
validResponse.setValid(true);
|
||||||
|
validResponse.setOrderSn( (String) jsonData.get("out_trade_no") ); //订单号
|
||||||
|
return validResponse;
|
||||||
|
} catch (Exception e) {
|
||||||
|
//非成功请求直接返回,理论上都是成功的请求
|
||||||
|
validResponse.setValid(false);
|
||||||
|
return validResponse;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String successResult() {
|
||||||
|
return JSON.toJSONString(WxpayConstant.SUCCESS ) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String failResult() {
|
||||||
|
return JSON.toJSONString( WxpayConstant.FAIL);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.ruoyi.wx;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信权限对接类
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@ConfigurationProperties("elegent.pay.wxpay")
|
||||||
|
@Data
|
||||||
|
public class WxpayConfig {
|
||||||
|
|
||||||
|
private String mchId; //商户号
|
||||||
|
private String appId; //APPID
|
||||||
|
private String appSecret;//app密钥
|
||||||
|
private String mchSerialNo; //商户证书序列号
|
||||||
|
private String apiV3Key; //V3密钥
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.ruoyi.wx;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class WxpayConstant {
|
||||||
|
|
||||||
|
public static final Map SUCCESS = new HashMap<String,Object>(){
|
||||||
|
{
|
||||||
|
put("code", "SUCCESS");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public static final Map FAIL = new HashMap<String,Object>(){
|
||||||
|
{
|
||||||
|
put("code", "FAIL");
|
||||||
|
put("message","微信回调错误结果");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
public final static String domain ="https://api.mch.weixin.qq.com/v3";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建订单
|
||||||
|
*/
|
||||||
|
public final static String createOrder = domain +"/pay/transactions/";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭订单
|
||||||
|
*/
|
||||||
|
public final static String closeOrder = domain+"/pay/transactions/out-trade-no/{out_trade_no}/close";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询订单编号
|
||||||
|
*/
|
||||||
|
public static String queryOrderNo = domain+"/pay/transactions/out-trade-no/";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询退款订单
|
||||||
|
*/
|
||||||
|
public static String queryRufundOrderNo =domain+ "/refund/domestic/refunds/";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款接口
|
||||||
|
*/
|
||||||
|
public static String refund = domain+"/refund/domestic/refunds";
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||||
|
com.ruoyi.config.CallbackConfig,\
|
||||||
|
com.ruoyi.core.CallbackWatch,\
|
||||||
|
com.ruoyi.core.ElegentPayImpl,\
|
||||||
|
com.ruoyi.core.ElegentLoader,\
|
||||||
|
com.ruoyi.core.ElegentConfig,\
|
||||||
|
com.ruoyi.key.impl.DefaultKeyManager,\
|
||||||
|
com.ruoyi.core.CallbackController,\
|
||||||
|
com.ruoyi.wx.WxpayConfig,\
|
||||||
|
com.ruoyi.wx.WxPayElegentTrade,\
|
||||||
|
com.ruoyi.wx.WxPayElegentValid,\
|
||||||
|
com.ruoyi.ali.AlipayConfig,\
|
||||||
|
com.ruoyi.ali.AlipayElegentTrade,\
|
||||||
|
com.ruoyi.ali.AlipayElegentValid
|
||||||
@@ -0,0 +1,231 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi</artifactId>
|
||||||
|
<version>3.8.6</version>
|
||||||
|
|
||||||
|
<name>ruoyi</name>
|
||||||
|
<url>http://www.ruoyi.vip</url>
|
||||||
|
<description>若依管理系统</description>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<ruoyi.version>3.8.6</ruoyi.version>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
||||||
|
<druid.version>1.2.16</druid.version>
|
||||||
|
<bitwalker.version>1.21</bitwalker.version>
|
||||||
|
<swagger.version>3.0.0</swagger.version>
|
||||||
|
<kaptcha.version>2.3.3</kaptcha.version>
|
||||||
|
<pagehelper.boot.version>1.4.6</pagehelper.boot.version>
|
||||||
|
<fastjson.version>2.0.39</fastjson.version>
|
||||||
|
<oshi.version>6.4.4</oshi.version>
|
||||||
|
<commons.io.version>2.13.0</commons.io.version>
|
||||||
|
<commons.collections.version>3.2.2</commons.collections.version>
|
||||||
|
<poi.version>4.1.2</poi.version>
|
||||||
|
<velocity.version>2.3</velocity.version>
|
||||||
|
<jwt.version>0.9.1</jwt.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<!-- 依赖声明 -->
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- SpringBoot的依赖配置-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>2.5.15</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 阿里数据库连接池 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
|
<version>${druid.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 解析客户端操作系统、浏览器等 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>eu.bitwalker</groupId>
|
||||||
|
<artifactId>UserAgentUtils</artifactId>
|
||||||
|
<version>${bitwalker.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- pagehelper 分页插件 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
|
<version>${pagehelper.boot.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 获取系统信息 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.oshi</groupId>
|
||||||
|
<artifactId>oshi-core</artifactId>
|
||||||
|
<version>${oshi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Swagger3依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-boot-starter</artifactId>
|
||||||
|
<version>${swagger.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-models</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- io常用工具类 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
<version>${commons.io.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- excel工具 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
<version>${poi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- velocity代码生成使用模板 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.velocity</groupId>
|
||||||
|
<artifactId>velocity-engine-core</artifactId>
|
||||||
|
<version>${velocity.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- collections工具类 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-collections</groupId>
|
||||||
|
<artifactId>commons-collections</artifactId>
|
||||||
|
<version>${commons.collections.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 阿里JSON解析器 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.fastjson2</groupId>
|
||||||
|
<artifactId>fastjson2</artifactId>
|
||||||
|
<version>${fastjson.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Token生成与解析-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
<artifactId>jjwt</artifactId>
|
||||||
|
<version>${jwt.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 验证码 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>pro.fessional</groupId>
|
||||||
|
<artifactId>kaptcha</artifactId>
|
||||||
|
<version>${kaptcha.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 定时任务-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-quartz</artifactId>
|
||||||
|
<version>${ruoyi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 代码生成-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-generator</artifactId>
|
||||||
|
<version>${ruoyi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 核心模块-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-framework</artifactId>
|
||||||
|
<version>${ruoyi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 系统模块-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-system</artifactId>
|
||||||
|
<version>${ruoyi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 通用工具-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-common</artifactId>
|
||||||
|
<version>${ruoyi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>ruoyi-admin</module>
|
||||||
|
<module>ruoyi-framework</module>
|
||||||
|
<module>ruoyi-system</module>
|
||||||
|
<module>ruoyi-quartz</module>
|
||||||
|
<module>ruoyi-generator</module>
|
||||||
|
<module>ruoyi-common</module>
|
||||||
|
<module>pay</module>
|
||||||
|
</modules>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>${java.version}</source>
|
||||||
|
<target>${java.version}</target>
|
||||||
|
<encoding>${project.build.sourceEncoding}</encoding>
|
||||||
|
<excludes>
|
||||||
|
<exclude>ruoyi-system/**</exclude>
|
||||||
|
<exclude>ruoyi-common/**</exclude>
|
||||||
|
</excludes>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>public</id>
|
||||||
|
<name>aliyun nexus</name>
|
||||||
|
<url>https://maven.aliyun.com/repository/public</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<pluginRepositories>
|
||||||
|
<pluginRepository>
|
||||||
|
<id>public</id>
|
||||||
|
<name>aliyun nexus</name>
|
||||||
|
<url>https://maven.aliyun.com/repository/public</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</pluginRepository>
|
||||||
|
</pluginRepositories>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>ruoyi</artifactId>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<version>3.8.6</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<artifactId>mediation</artifactId>
|
||||||
|
<version>1.1.0</version>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
web服务入口
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- spring-boot-devtools -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
|
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- swagger3-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-models</artifactId>
|
||||||
|
<version>1.6.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Mysql驱动包 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 核心模块-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-framework</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 定时任务-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-quartz</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>pay</artifactId>
|
||||||
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>2.5.15</version>
|
||||||
|
<configuration>
|
||||||
|
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
<configuration>
|
||||||
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
|
<warName>${project.artifactId}</warName>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!--跳过单测-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>2.22.2</version>
|
||||||
|
<configuration>
|
||||||
|
<skipTests>true</skipTests>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
<finalName>${project.artifactId}-${project.version}</finalName>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package com.ruoyi;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.ruoyi.common.constant.CacheConstants;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.common.core.redis.RedisCache;
|
||||||
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
|
import com.ruoyi.system.mapper.SysRoleMapper;
|
||||||
|
import com.ruoyi.system.mapper.SysUserMapper;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启动程序
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||||
|
@EnableScheduling
|
||||||
|
@EnableSwagger2
|
||||||
|
public class RuoYiApplication
|
||||||
|
{
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||||
|
SpringApplication.run(RuoYiApplication.class, args);
|
||||||
|
System.out.println("(♥◠‿◠)ノ゙ 启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||||
|
" _ _ _ _ \n" +
|
||||||
|
" | |_(_) __ _ ___ (_|_) ___ \n" +
|
||||||
|
" | __| |/ _` |/ _ \\ | | |/ _ \\\n" +
|
||||||
|
" | |_| | (_| | (_) | | | | __/\n" +
|
||||||
|
" \\__|_|\\__,_|\\___/ _/ |_|\\___|\n" +
|
||||||
|
" |__/ ");
|
||||||
|
// 启动成功后,查询用户表,将用户信息存到redis
|
||||||
|
RedisCache redisCache = SpringUtils.getBean(RedisCache.class);
|
||||||
|
SysUserMapper userMapper = SpringUtils.getBean(SysUserMapper.class);
|
||||||
|
List<SysUser> sysUsers = userMapper.selectUserListByIds(null);
|
||||||
|
if(CollectionUtil.isNotEmpty(sysUsers)){
|
||||||
|
for (SysUser sysUser : sysUsers) {
|
||||||
|
redisCache.setCacheObject(CacheConstants.USER_KEY+sysUser.getUserId(),sysUser);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 初始化角色redis
|
||||||
|
SysRoleMapper roleMapper = SpringUtils.getBean(SysRoleMapper.class);
|
||||||
|
List<SysRole> roles = roleMapper.selectRoleList(new SysRole());
|
||||||
|
if(CollectionUtil.isNotEmpty(roles)){
|
||||||
|
for (SysRole role : roles) {
|
||||||
|
redisCache.setCacheObject(CacheConstants.ROLE_KEY+role.getRoleName(),role.getRoleId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.ruoyi;
|
||||||
|
|
||||||
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web容器中进行部署
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public class RuoYiServletInitializer extends SpringBootServletInitializer
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
|
||||||
|
{
|
||||||
|
return application.sources(RuoYiApplication.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
package com.ruoyi.web.controller.bestsign;
|
||||||
|
|
||||||
|
import com.ruoyi.bestsign.domain.ArbitrSignatuVO;
|
||||||
|
import com.ruoyi.bestsign.domain.PersonRegisterVO;
|
||||||
|
import com.ruoyi.bestsign.service.ArbitrSignatuService;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/arbitrSignatu")
|
||||||
|
public class ArbitrSignatuController {
|
||||||
|
@Autowired
|
||||||
|
ArbitrSignatuService arbitrSignatuService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 申请状态查询
|
||||||
|
*
|
||||||
|
* @param arbitrSignatuVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/selectApplyStatus")
|
||||||
|
public AjaxResult selectApplyStatus (@Validated @RequestBody ArbitrSignatuVO arbitrSignatuVO) {
|
||||||
|
return arbitrSignatuService.selectApplyStatus(arbitrSignatuVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.ruoyi.web.controller.bestsign;
|
||||||
|
|
||||||
|
import com.ruoyi.bestsign.domain.PersonRegisterVO;
|
||||||
|
import com.ruoyi.bestsign.service.SignRegisterService;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/register")
|
||||||
|
public class RegisterController {
|
||||||
|
@Autowired
|
||||||
|
SignRegisterService signRegisterService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册上上签个人用户
|
||||||
|
*
|
||||||
|
* @param personRegisterVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/registerPerson")
|
||||||
|
public AjaxResult createDocument(@Validated @RequestBody PersonRegisterVO personRegisterVO) {
|
||||||
|
return signRegisterService.registerPerson(personRegisterVO);
|
||||||
|
}
|
||||||
|
// @PostMapping("/registerEnterprise")
|
||||||
|
// public AjaxResult
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
package com.ruoyi.web.controller.common;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.util.FastByteArrayOutputStream;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.google.code.kaptcha.Producer;
|
||||||
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
|
import com.ruoyi.common.constant.CacheConstants;
|
||||||
|
import com.ruoyi.common.constant.Constants;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.redis.RedisCache;
|
||||||
|
import com.ruoyi.common.utils.sign.Base64;
|
||||||
|
import com.ruoyi.common.utils.uuid.IdUtils;
|
||||||
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证码操作处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
public class CaptchaController
|
||||||
|
{
|
||||||
|
@Resource(name = "captchaProducer")
|
||||||
|
private Producer captchaProducer;
|
||||||
|
|
||||||
|
@Resource(name = "captchaProducerMath")
|
||||||
|
private Producer captchaProducerMath;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisCache redisCache;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysConfigService configService;
|
||||||
|
/**
|
||||||
|
* 生成验证码
|
||||||
|
*/
|
||||||
|
@GetMapping("/captchaImage")
|
||||||
|
public AjaxResult getCode(HttpServletResponse response) throws IOException
|
||||||
|
{
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
boolean captchaEnabled = configService.selectCaptchaEnabled();
|
||||||
|
ajax.put("captchaEnabled", captchaEnabled);
|
||||||
|
if (!captchaEnabled)
|
||||||
|
{
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存验证码信息
|
||||||
|
String uuid = IdUtils.simpleUUID();
|
||||||
|
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
|
||||||
|
|
||||||
|
String capStr = null, code = null;
|
||||||
|
BufferedImage image = null;
|
||||||
|
|
||||||
|
// 生成验证码
|
||||||
|
String captchaType = RuoYiConfig.getCaptchaType();
|
||||||
|
if ("math".equals(captchaType))
|
||||||
|
{
|
||||||
|
String capText = captchaProducerMath.createText();
|
||||||
|
capStr = capText.substring(0, capText.lastIndexOf("@"));
|
||||||
|
code = capText.substring(capText.lastIndexOf("@") + 1);
|
||||||
|
image = captchaProducerMath.createImage(capStr);
|
||||||
|
}
|
||||||
|
else if ("char".equals(captchaType))
|
||||||
|
{
|
||||||
|
capStr = code = captchaProducer.createText();
|
||||||
|
image = captchaProducer.createImage(capStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
|
||||||
|
// 转换流信息写出
|
||||||
|
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ImageIO.write(image, "jpg", os);
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
return AjaxResult.error(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
ajax.put("uuid", uuid);
|
||||||
|
ajax.put("img", Base64.encode(os.toByteArray()));
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,215 @@
|
|||||||
|
package com.ruoyi.web.controller.common;
|
||||||
|
|
||||||
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
|
import com.ruoyi.common.constant.Constants;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||||
|
import com.ruoyi.common.utils.file.FileUtils;
|
||||||
|
import com.ruoyi.framework.config.ServerConfig;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
|
||||||
|
import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAttachMapper;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.google.common.io.Files.getFileExtension;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用请求处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/common")
|
||||||
|
public class CommonController
|
||||||
|
{
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ServerConfig serverConfig;
|
||||||
|
@Autowired
|
||||||
|
private MsCaseAttachMapper msCaseAttachMapper;
|
||||||
|
|
||||||
|
private static final String FILE_DELIMETER = ",";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用下载请求
|
||||||
|
*
|
||||||
|
* @param fileName 文件名称
|
||||||
|
* @param delete 是否删除
|
||||||
|
*/
|
||||||
|
@GetMapping("/download")
|
||||||
|
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!FileUtils.checkAllowDownload(fileName))
|
||||||
|
{
|
||||||
|
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
|
||||||
|
}
|
||||||
|
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
||||||
|
String filePath = RuoYiConfig.getDownloadPath() + fileName;
|
||||||
|
|
||||||
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||||
|
FileUtils.setAttachmentResponseHeader(response, realFileName);
|
||||||
|
FileUtils.writeBytes(filePath, response.getOutputStream());
|
||||||
|
if (delete)
|
||||||
|
{
|
||||||
|
FileUtils.deleteFile(filePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.error("下载文件失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用上传请求(单个)
|
||||||
|
*/
|
||||||
|
@PostMapping("/upload")
|
||||||
|
public AjaxResult uploadFile(@RequestParam("file") MultipartFile file, @RequestParam("annexType") Integer annexType) throws Exception
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 上传文件路径
|
||||||
|
String filePath = RuoYiConfig.getUploadPath();
|
||||||
|
// 上传并返回新文件名称
|
||||||
|
String fileName = FileUploadUtils.upload(filePath, file);
|
||||||
|
String url = serverConfig.getUrl() + fileName;
|
||||||
|
Long annexId = saveCaseAttach(annexType, fileName, file.getOriginalFilename());
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("annexId", annexId);
|
||||||
|
ajax.put("annexType", annexType);
|
||||||
|
ajax.put("url", url);
|
||||||
|
ajax.put("fileName", fileName);
|
||||||
|
ajax.put("newFileName", FileUtils.getName(fileName));
|
||||||
|
ajax.put("originalFilename", file.getOriginalFilename());
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return AjaxResult.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存到案件附件表
|
||||||
|
* @param
|
||||||
|
* @param annexType
|
||||||
|
* @param path
|
||||||
|
* @param originalFilename
|
||||||
|
*/
|
||||||
|
private Long saveCaseAttach(Integer annexType, String path, String originalFilename) {
|
||||||
|
MsCaseAttach caseAttach = MsCaseAttach.builder()
|
||||||
|
.annexName(originalFilename)
|
||||||
|
.annexPath(path)
|
||||||
|
.annexType(annexType)
|
||||||
|
.useId(SecurityUtils.getUserId())
|
||||||
|
.useAccount(SecurityUtils.getUsername())
|
||||||
|
.suffix(getFileExtension(path))
|
||||||
|
.build();
|
||||||
|
msCaseAttachMapper.save(caseAttach);
|
||||||
|
return caseAttach.getAnnexId();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据案件id获取附件
|
||||||
|
* @param caseAppliId
|
||||||
|
* @param annexTypeList
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/fileList")
|
||||||
|
public AjaxResult fileList(@RequestParam("caseAppliId")Long caseAppliId, @RequestParam(value = "annexTypeList",required = false) List<Integer> annexTypeList){
|
||||||
|
if(caseAppliId==null){
|
||||||
|
return AjaxResult.error("案件id不能为空");
|
||||||
|
}
|
||||||
|
MsCaseApplicationVO msCaseApplicationVO = new MsCaseApplicationVO();
|
||||||
|
msCaseApplicationVO.setId(caseAppliId);
|
||||||
|
msCaseApplicationVO.setAnnexTypeList(annexTypeList);
|
||||||
|
List<MsCaseAttach> caseAttachList = msCaseAttachMapper.queryCaseAttachList(msCaseApplicationVO);
|
||||||
|
return AjaxResult.success(caseAttachList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用上传请求(多个)
|
||||||
|
*/
|
||||||
|
@PostMapping("/uploads")
|
||||||
|
public AjaxResult uploadFiles(@RequestParam("files") MultipartFile[] files, @RequestParam("annexType")Integer annexType ) throws Exception
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 上传文件路径
|
||||||
|
String filePath = RuoYiConfig.getUploadPath();
|
||||||
|
List<String> urls = new ArrayList<String>();
|
||||||
|
List<String> fileNames = new ArrayList<String>();
|
||||||
|
List<String> newFileNames = new ArrayList<String>();
|
||||||
|
List<String> originalFilenames = new ArrayList<String>();
|
||||||
|
List<Long> annexIds = new ArrayList<>();
|
||||||
|
for (MultipartFile file : files)
|
||||||
|
{
|
||||||
|
// 上传并返回新文件名称
|
||||||
|
String fileName = FileUploadUtils.upload(filePath, file);
|
||||||
|
String url = serverConfig.getUrl() + fileName;
|
||||||
|
urls.add(url);
|
||||||
|
fileNames.add(fileName);
|
||||||
|
newFileNames.add(FileUtils.getName(fileName));
|
||||||
|
originalFilenames.add(file.getOriginalFilename());
|
||||||
|
Long annexId = saveCaseAttach(annexType, fileName, file.getOriginalFilename());
|
||||||
|
annexIds.add(annexId);
|
||||||
|
}
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("annexIds", annexIds);
|
||||||
|
ajax.put("annexType", annexType);
|
||||||
|
ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
|
||||||
|
ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
|
||||||
|
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
|
||||||
|
ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return AjaxResult.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 本地资源通用下载
|
||||||
|
*/
|
||||||
|
@GetMapping("/download/resource")
|
||||||
|
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!FileUtils.checkAllowDownload(resource))
|
||||||
|
{
|
||||||
|
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
|
||||||
|
}
|
||||||
|
// 本地资源路径
|
||||||
|
String localPath = RuoYiConfig.getProfile();
|
||||||
|
// 数据库资源地址
|
||||||
|
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
|
||||||
|
// 下载名称
|
||||||
|
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
|
||||||
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||||
|
FileUtils.setAttachmentResponseHeader(response, downloadName);
|
||||||
|
FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.error("下载文件失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package com.ruoyi.web.controller.flow;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.system.domain.vo.flow.MsCaseFlowSearchVO;
|
||||||
|
import com.ruoyi.system.domain.vo.flow.MsCaseFlowVO;
|
||||||
|
import com.ruoyi.system.service.flow.CaseFlowService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import static com.ruoyi.common.core.domain.AjaxResult.success;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 案件流程管理
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/case/flow")
|
||||||
|
public class CaseFlowController {
|
||||||
|
@Autowired
|
||||||
|
CaseFlowService caseFlowService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询案件流程节点信息
|
||||||
|
*/
|
||||||
|
@PostMapping("/queryCaseFlowInfo")
|
||||||
|
public Object queryCaseFlowInfo(@RequestBody MsCaseFlowSearchVO caseFlowSearchVO) {
|
||||||
|
return caseFlowService.queryCaseFlowInfo(caseFlowSearchVO);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查询案件流程信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/selectCaseFlow")
|
||||||
|
public AjaxResult selectCaseFlow() {
|
||||||
|
return caseFlowService.selectCaseFlow();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增或编辑案件流程节点信息
|
||||||
|
*/
|
||||||
|
@PostMapping("/saveCaseFlow")
|
||||||
|
public AjaxResult saveCaseFlow(@RequestBody MsCaseFlowVO caseFlowVO) {
|
||||||
|
Boolean result = caseFlowService.saveCaseFlow(caseFlowVO);
|
||||||
|
return success(result);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除案件流程节点信息
|
||||||
|
*/
|
||||||
|
@PostMapping("/deleteCaseFlow")
|
||||||
|
public AjaxResult deleteCaseFlow(@RequestBody MsCaseFlowVO caseFlowVO) throws Exception {
|
||||||
|
Boolean result = caseFlowService.deleteCaseFlow(caseFlowVO);
|
||||||
|
return success(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序案件流程节点
|
||||||
|
*/
|
||||||
|
@PostMapping("/sortCaseFlow")
|
||||||
|
public AjaxResult sortCaseFlow(@RequestBody MsCaseFlowSearchVO caseFlowSearchVO) throws Exception {
|
||||||
|
Boolean result = caseFlowService.sortCaseFlow(caseFlowSearchVO);
|
||||||
|
return success(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.Set;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisCallback;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.constant.CacheConstants;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.system.domain.SysCache;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存监控
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/monitor/cache")
|
||||||
|
public class CacheController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate<String, String> redisTemplate;
|
||||||
|
|
||||||
|
private final static List<SysCache> caches = new ArrayList<SysCache>();
|
||||||
|
{
|
||||||
|
caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息"));
|
||||||
|
caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息"));
|
||||||
|
caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "数据字典"));
|
||||||
|
caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码"));
|
||||||
|
caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交"));
|
||||||
|
caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理"));
|
||||||
|
caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||||
|
@GetMapping()
|
||||||
|
public AjaxResult getInfo() throws Exception
|
||||||
|
{
|
||||||
|
Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
|
||||||
|
Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
|
||||||
|
Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
|
||||||
|
|
||||||
|
Map<String, Object> result = new HashMap<>(3);
|
||||||
|
result.put("info", info);
|
||||||
|
result.put("dbSize", dbSize);
|
||||||
|
|
||||||
|
List<Map<String, String>> pieList = new ArrayList<>();
|
||||||
|
commandStats.stringPropertyNames().forEach(key -> {
|
||||||
|
Map<String, String> data = new HashMap<>(2);
|
||||||
|
String property = commandStats.getProperty(key);
|
||||||
|
data.put("name", StringUtils.removeStart(key, "cmdstat_"));
|
||||||
|
data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
|
||||||
|
pieList.add(data);
|
||||||
|
});
|
||||||
|
result.put("commandStats", pieList);
|
||||||
|
return AjaxResult.success(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||||
|
@GetMapping("/getNames")
|
||||||
|
public AjaxResult cache()
|
||||||
|
{
|
||||||
|
return AjaxResult.success(caches);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||||
|
@GetMapping("/getKeys/{cacheName}")
|
||||||
|
public AjaxResult getCacheKeys(@PathVariable String cacheName)
|
||||||
|
{
|
||||||
|
Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
|
||||||
|
return AjaxResult.success(cacheKeys);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||||
|
@GetMapping("/getValue/{cacheName}/{cacheKey}")
|
||||||
|
public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
|
||||||
|
{
|
||||||
|
String cacheValue = redisTemplate.opsForValue().get(cacheKey);
|
||||||
|
SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
|
||||||
|
return AjaxResult.success(sysCache);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||||
|
@DeleteMapping("/clearCacheName/{cacheName}")
|
||||||
|
public AjaxResult clearCacheName(@PathVariable String cacheName)
|
||||||
|
{
|
||||||
|
Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
|
||||||
|
redisTemplate.delete(cacheKeys);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||||
|
@DeleteMapping("/clearCacheKey/{cacheKey}")
|
||||||
|
public AjaxResult clearCacheKey(@PathVariable String cacheKey)
|
||||||
|
{
|
||||||
|
redisTemplate.delete(cacheKey);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||||
|
@DeleteMapping("/clearCacheAll")
|
||||||
|
public AjaxResult clearCacheAll()
|
||||||
|
{
|
||||||
|
Collection<String> cacheKeys = redisTemplate.keys("*");
|
||||||
|
redisTemplate.delete(cacheKeys);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.framework.web.domain.Server;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务器监控
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/monitor/server")
|
||||||
|
public class ServerController
|
||||||
|
{
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:server:list')")
|
||||||
|
@GetMapping()
|
||||||
|
public AjaxResult getInfo() throws Exception
|
||||||
|
{
|
||||||
|
Server server = new Server();
|
||||||
|
server.copyTo();
|
||||||
|
return AjaxResult.success(server);
|
||||||
|
}
|
||||||
|
}
|
||||||
+82
@@ -0,0 +1,82 @@
|
|||||||
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
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.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.framework.web.service.SysPasswordService;
|
||||||
|
import com.ruoyi.system.domain.SysLogininfor;
|
||||||
|
import com.ruoyi.system.service.ISysLogininforService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统访问记录
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/monitor/logininfor")
|
||||||
|
public class SysLogininforController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ISysLogininforService logininforService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysPasswordService passwordService;
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysLogininfor logininfor)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysLogininfor logininfor)
|
||||||
|
{
|
||||||
|
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||||
|
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
||||||
|
util.exportExcel(response, list, "登录日志");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||||
|
@Log(title = "登录日志", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{infoIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] infoIds)
|
||||||
|
{
|
||||||
|
return toAjax(logininforService.deleteLogininforByIds(infoIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||||
|
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
|
||||||
|
@DeleteMapping("/clean")
|
||||||
|
public AjaxResult clean()
|
||||||
|
{
|
||||||
|
logininforService.cleanLogininfor();
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')")
|
||||||
|
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
|
||||||
|
@GetMapping("/unlock/{userName}")
|
||||||
|
public AjaxResult unlock(@PathVariable("userName") String userName)
|
||||||
|
{
|
||||||
|
passwordService.clearLoginRecordCache(userName);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
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.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.system.domain.SysOperLog;
|
||||||
|
import com.ruoyi.system.service.ISysOperLogService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作日志记录
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/monitor/operlog")
|
||||||
|
public class SysOperlogController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ISysOperLogService operLogService;
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysOperLog operLog)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysOperLog operLog)
|
||||||
|
{
|
||||||
|
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||||
|
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
|
||||||
|
util.exportExcel(response, list, "操作日志");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "操作日志", businessType = BusinessType.DELETE)
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||||
|
@DeleteMapping("/{operIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] operIds)
|
||||||
|
{
|
||||||
|
return toAjax(operLogService.deleteOperLogByIds(operIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||||
|
@DeleteMapping("/clean")
|
||||||
|
public AjaxResult clean()
|
||||||
|
{
|
||||||
|
operLogService.cleanOperLog();
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
||||||
+83
@@ -0,0 +1,83 @@
|
|||||||
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
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.model.LoginUser;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.core.redis.RedisCache;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.system.domain.SysUserOnline;
|
||||||
|
import com.ruoyi.system.service.ISysUserOnlineService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在线用户监控
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/monitor/online")
|
||||||
|
public class SysUserOnlineController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ISysUserOnlineService userOnlineService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisCache redisCache;
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:online:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(String ipaddr, String userName)
|
||||||
|
{
|
||||||
|
Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
|
||||||
|
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
|
||||||
|
for (String key : keys)
|
||||||
|
{
|
||||||
|
LoginUser user = redisCache.getCacheObject(key);
|
||||||
|
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
|
||||||
|
{
|
||||||
|
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
|
||||||
|
}
|
||||||
|
else if (StringUtils.isNotEmpty(ipaddr))
|
||||||
|
{
|
||||||
|
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
|
||||||
|
}
|
||||||
|
else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
|
||||||
|
{
|
||||||
|
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Collections.reverse(userOnlineList);
|
||||||
|
userOnlineList.removeAll(Collections.singleton(null));
|
||||||
|
return getDataTable(userOnlineList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 强退用户
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
|
||||||
|
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||||
|
@DeleteMapping("/{tokenId}")
|
||||||
|
public AjaxResult forceLogout(@PathVariable String tokenId)
|
||||||
|
{
|
||||||
|
redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
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.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.system.domain.SysConfig;
|
||||||
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数配置 信息操作处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/config")
|
||||||
|
public class SysConfigController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ISysConfigService configService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取参数配置列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:config:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysConfig config)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysConfig> list = configService.selectConfigList(config);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:config:export')")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysConfig config)
|
||||||
|
{
|
||||||
|
List<SysConfig> list = configService.selectConfigList(config);
|
||||||
|
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
|
||||||
|
util.exportExcel(response, list, "参数数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据参数编号获取详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:config:query')")
|
||||||
|
@GetMapping(value = "/{configId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long configId)
|
||||||
|
{
|
||||||
|
return success(configService.selectConfigById(configId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据参数键名查询参数值
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/configKey/{configKey}")
|
||||||
|
public AjaxResult getConfigKey(@PathVariable String configKey)
|
||||||
|
{
|
||||||
|
return success(configService.selectConfigByKey(configKey));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增参数配置
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:config:add')")
|
||||||
|
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody SysConfig config)
|
||||||
|
{
|
||||||
|
if (!configService.checkConfigKeyUnique(config))
|
||||||
|
{
|
||||||
|
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||||
|
}
|
||||||
|
config.setCreateBy(getUsername());
|
||||||
|
return toAjax(configService.insertConfig(config));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改参数配置
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:config:edit')")
|
||||||
|
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody SysConfig config)
|
||||||
|
{
|
||||||
|
if (!configService.checkConfigKeyUnique(config))
|
||||||
|
{
|
||||||
|
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||||
|
}
|
||||||
|
config.setUpdateBy(getUsername());
|
||||||
|
return toAjax(configService.updateConfig(config));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除参数配置
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
||||||
|
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{configIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] configIds)
|
||||||
|
{
|
||||||
|
configService.deleteConfigByIds(configIds);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新参数缓存
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
||||||
|
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
||||||
|
@DeleteMapping("/refreshCache")
|
||||||
|
public AjaxResult refreshCache()
|
||||||
|
{
|
||||||
|
configService.resetConfigCache();
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.system.service.ISysDeptService;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门信息
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/dept")
|
||||||
|
public class SysDeptController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ISysDeptService deptService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取部门列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dept:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public AjaxResult list(SysDept dept)
|
||||||
|
{
|
||||||
|
List<SysDept> depts = deptService.selectDeptList(dept);
|
||||||
|
return success(depts);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取部门列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/selectList")
|
||||||
|
public AjaxResult selectList(SysDept dept)
|
||||||
|
{
|
||||||
|
List<SysDept> depts = deptService.selectDeptList(dept);
|
||||||
|
return success(depts);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部门列表(排除节点)
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dept:list')")
|
||||||
|
@GetMapping("/list/exclude/{deptId}")
|
||||||
|
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
|
||||||
|
{
|
||||||
|
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
||||||
|
depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
|
||||||
|
return success(depts);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据部门编号获取详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dept:query')")
|
||||||
|
@GetMapping(value = "/{deptId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long deptId)
|
||||||
|
{
|
||||||
|
deptService.checkDeptDataScope(deptId);
|
||||||
|
return success(deptService.selectDeptById(deptId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增部门
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dept:add')")
|
||||||
|
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody SysDept dept)
|
||||||
|
{
|
||||||
|
if (!deptService.checkDeptNameUnique(dept))
|
||||||
|
{
|
||||||
|
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||||
|
}
|
||||||
|
dept.setCreateBy(getUsername());
|
||||||
|
return toAjax(deptService.insertDept(dept));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改部门
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dept:edit')")
|
||||||
|
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody SysDept dept)
|
||||||
|
{
|
||||||
|
Long deptId = dept.getDeptId();
|
||||||
|
deptService.checkDeptDataScope(deptId);
|
||||||
|
if (!deptService.checkDeptNameUnique(dept))
|
||||||
|
{
|
||||||
|
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||||
|
}
|
||||||
|
else if (dept.getParentId().equals(deptId))
|
||||||
|
{
|
||||||
|
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
||||||
|
}
|
||||||
|
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
|
||||||
|
{
|
||||||
|
return error("该部门包含未停用的子部门!");
|
||||||
|
}
|
||||||
|
dept.setUpdateBy(getUsername());
|
||||||
|
return toAjax(deptService.updateDept(dept));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除部门
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dept:remove')")
|
||||||
|
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{deptId}")
|
||||||
|
public AjaxResult remove(@PathVariable Long deptId)
|
||||||
|
{
|
||||||
|
if (deptService.hasChildByDeptId(deptId))
|
||||||
|
{
|
||||||
|
return warn("存在下级部门,不允许删除");
|
||||||
|
}
|
||||||
|
if (deptService.checkDeptExistUser(deptId))
|
||||||
|
{
|
||||||
|
return warn("部门存在用户,不允许删除");
|
||||||
|
}
|
||||||
|
deptService.checkDeptDataScope(deptId);
|
||||||
|
return toAjax(deptService.deleteDeptById(deptId));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
|
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.SysDictData;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.system.service.ISysDictDataService;
|
||||||
|
import com.ruoyi.system.service.ISysDictTypeService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据字典信息
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/dict/data")
|
||||||
|
public class SysDictDataController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ISysDictDataService dictDataService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysDictTypeService dictTypeService;
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysDictData dictData)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysDictData dictData)
|
||||||
|
{
|
||||||
|
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||||
|
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
|
||||||
|
util.exportExcel(response, list, "字典数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询字典数据详细
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||||
|
@GetMapping(value = "/{dictCode}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long dictCode)
|
||||||
|
{
|
||||||
|
return success(dictDataService.selectDictDataById(dictCode));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型查询字典数据信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/type/{dictType}")
|
||||||
|
public AjaxResult dictType(@PathVariable String dictType)
|
||||||
|
{
|
||||||
|
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
|
||||||
|
if (StringUtils.isNull(data))
|
||||||
|
{
|
||||||
|
data = new ArrayList<SysDictData>();
|
||||||
|
}
|
||||||
|
return success(data);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据字典类型查询字典数据信息,跳过token
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@GetMapping(value = "/type/skipToken/{dictType}")
|
||||||
|
public AjaxResult skipToken(@PathVariable String dictType)
|
||||||
|
{
|
||||||
|
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
|
||||||
|
if (StringUtils.isNull(data))
|
||||||
|
{
|
||||||
|
data = new ArrayList<SysDictData>();
|
||||||
|
}
|
||||||
|
return success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增字典类型
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||||
|
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody SysDictData dict)
|
||||||
|
{
|
||||||
|
dict.setCreateBy(getUsername());
|
||||||
|
return toAjax(dictDataService.insertDictData(dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存字典类型
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||||
|
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody SysDictData dict)
|
||||||
|
{
|
||||||
|
dict.setUpdateBy(getUsername());
|
||||||
|
return toAjax(dictDataService.updateDictData(dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除字典类型
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{dictCodes}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] dictCodes)
|
||||||
|
{
|
||||||
|
dictDataService.deleteDictDataByIds(dictCodes);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,131 @@
|
|||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
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.SysDictType;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.system.service.ISysDictTypeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据字典信息
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/dict/type")
|
||||||
|
public class SysDictTypeController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ISysDictTypeService dictTypeService;
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysDictType dictType)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysDictType dictType)
|
||||||
|
{
|
||||||
|
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||||
|
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
||||||
|
util.exportExcel(response, list, "字典类型");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询字典类型详细
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||||
|
@GetMapping(value = "/{dictId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long dictId)
|
||||||
|
{
|
||||||
|
return success(dictTypeService.selectDictTypeById(dictId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增字典类型
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody SysDictType dict)
|
||||||
|
{
|
||||||
|
if (!dictTypeService.checkDictTypeUnique(dict))
|
||||||
|
{
|
||||||
|
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||||
|
}
|
||||||
|
dict.setCreateBy(getUsername());
|
||||||
|
return toAjax(dictTypeService.insertDictType(dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改字典类型
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody SysDictType dict)
|
||||||
|
{
|
||||||
|
if (!dictTypeService.checkDictTypeUnique(dict))
|
||||||
|
{
|
||||||
|
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||||
|
}
|
||||||
|
dict.setUpdateBy(getUsername());
|
||||||
|
return toAjax(dictTypeService.updateDictType(dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除字典类型
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{dictIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] dictIds)
|
||||||
|
{
|
||||||
|
dictTypeService.deleteDictTypeByIds(dictIds);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新字典缓存
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
||||||
|
@DeleteMapping("/refreshCache")
|
||||||
|
public AjaxResult refreshCache()
|
||||||
|
{
|
||||||
|
dictTypeService.resetDictCache();
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字典选择框列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/optionselect")
|
||||||
|
public AjaxResult optionselect()
|
||||||
|
{
|
||||||
|
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
|
||||||
|
return success(dictTypes);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
public class SysIndexController
|
||||||
|
{
|
||||||
|
/** 系统基础配置 */
|
||||||
|
@Autowired
|
||||||
|
private RuoYiConfig ruoyiConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 访问首页,提示语
|
||||||
|
*/
|
||||||
|
@RequestMapping("/")
|
||||||
|
public String index()
|
||||||
|
{
|
||||||
|
return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,149 @@
|
|||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.crypto.digest.MD5;
|
||||||
|
import com.ruoyi.common.constant.Constants;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysMenu;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.common.core.domain.model.LoginBody;
|
||||||
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.framework.web.service.SysLoginService;
|
||||||
|
import com.ruoyi.framework.web.service.SysPermissionService;
|
||||||
|
import com.ruoyi.framework.web.service.TokenService;
|
||||||
|
import com.ruoyi.system.service.ISysMenuService;
|
||||||
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
import com.ruoyi.system.service.flow.CaseFlowService;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.dto.miniprogress.IdentityAuthentication;
|
||||||
|
import com.ruoyi.wisdomarbitrate.service.miniprogress.IdentityAuthenticationService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录验证
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
public class SysLoginController {
|
||||||
|
@Autowired
|
||||||
|
private SysLoginService loginService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysMenuService menuService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysPermissionService permissionService;
|
||||||
|
@Autowired
|
||||||
|
IdentityAuthenticationService identityAuthenticationService;
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService sysUserService;
|
||||||
|
@Autowired
|
||||||
|
private CaseFlowService caseFlowService;
|
||||||
|
@Autowired
|
||||||
|
private TokenService tokenService;
|
||||||
|
/**
|
||||||
|
* 登录方法
|
||||||
|
*
|
||||||
|
* @param loginBody 登录信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/login")
|
||||||
|
public AjaxResult login(@RequestBody LoginBody loginBody) {
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
// 生成令牌
|
||||||
|
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
|
||||||
|
loginBody.getUuid());
|
||||||
|
ajax.put(Constants.TOKEN, token);
|
||||||
|
//判断该用户是否已经实名认证(certificationStatus1已认证0未认证)
|
||||||
|
IdentityAuthentication identityAuthentication=new IdentityAuthentication();
|
||||||
|
identityAuthentication.setUserName(loginBody.getUsername());
|
||||||
|
String status = identityAuthenticationService.checkIsAuthentication(identityAuthentication);
|
||||||
|
|
||||||
|
ajax.put("certificationStatus", status);
|
||||||
|
// 获取用户信息
|
||||||
|
SysUser sysUser = sysUserService.selectUserByUserName(loginBody.getUsername());
|
||||||
|
ajax.put("userId", sysUser!=null?sysUser.getUserId():"");
|
||||||
|
ajax.put("userName", sysUser!=null?sysUser.getUserName():"");
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户信息
|
||||||
|
*
|
||||||
|
* @return 用户信息
|
||||||
|
*/
|
||||||
|
@GetMapping("getInfo")
|
||||||
|
public AjaxResult getInfo() {
|
||||||
|
SysUser user = SecurityUtils.getLoginUser().getUser();
|
||||||
|
// 角色集合
|
||||||
|
List<SysRole> roles = permissionService.getRolePermission(user);
|
||||||
|
Set<String> permsSet = new HashSet<>();
|
||||||
|
for (SysRole perm : roles)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotNull(perm))
|
||||||
|
{
|
||||||
|
permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(",")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
user.setRoles(roles);
|
||||||
|
// 权限集合
|
||||||
|
Set<String> permissions = permissionService.getMenuPermission(user);
|
||||||
|
//查询用户角色关联的案件状态
|
||||||
|
Set<Integer> caseStatus = caseFlowService.getCaseStatusIdByRoleKey(permsSet);
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("user", user);
|
||||||
|
ajax.put("roles", roles);
|
||||||
|
ajax.put("permissions", permissions);
|
||||||
|
ajax.put("caseStatus", caseStatus);
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取路由信息
|
||||||
|
*
|
||||||
|
* @return 路由信息
|
||||||
|
*/
|
||||||
|
@GetMapping("getRouters")
|
||||||
|
public AjaxResult getRouters() {
|
||||||
|
Long userId = SecurityUtils.getUserId();
|
||||||
|
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
|
||||||
|
return AjaxResult.success(menuService.buildMenus(menus));
|
||||||
|
}
|
||||||
|
/**sso登录接口*/
|
||||||
|
@PostMapping("login/sso")
|
||||||
|
public AjaxResult loginSSO( @RequestBody LoginBody loginBody){
|
||||||
|
if(StrUtil.isEmpty(loginBody.getUsername()) || StrUtil.isEmpty(loginBody.getTicket())
|
||||||
|
|| StrUtil.isEmpty(loginBody.getRoleName()) ){
|
||||||
|
return AjaxResult.error("参数错误");
|
||||||
|
}
|
||||||
|
return loginService.loginSSO(loginBody);
|
||||||
|
|
||||||
|
}
|
||||||
|
/**对接BM,根据用户名查询token*/
|
||||||
|
@GetMapping("selectTokenByUserName")
|
||||||
|
public AjaxResult selectTokenByUserName( LoginBody loginBody){
|
||||||
|
if(StrUtil.isEmpty(loginBody.getUsername()) || StrUtil.isEmpty(loginBody.getTicket())
|
||||||
|
){
|
||||||
|
return AjaxResult.error("参数错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
return loginService.selectTokenByUserName(loginBody);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println( MD5.create().digestHex("BM456" ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysMenu;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.system.service.ISysMenuService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单信息
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/menu")
|
||||||
|
public class SysMenuController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ISysMenuService menuService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取菜单列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:menu:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public AjaxResult list(SysMenu menu)
|
||||||
|
{
|
||||||
|
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
||||||
|
return success(menus);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据菜单编号获取详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:menu:query')")
|
||||||
|
@GetMapping(value = "/{menuId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long menuId)
|
||||||
|
{
|
||||||
|
return success(menuService.selectMenuById(menuId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取菜单下拉树列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/treeselect")
|
||||||
|
public AjaxResult treeselect(SysMenu menu)
|
||||||
|
{
|
||||||
|
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
||||||
|
return success(menuService.buildMenuTreeSelect(menus));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载对应角色菜单列表树
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
|
||||||
|
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
|
||||||
|
{
|
||||||
|
List<SysMenu> menus = menuService.selectMenuList(getUserId());
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
|
||||||
|
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增菜单
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:menu:add')")
|
||||||
|
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody SysMenu menu)
|
||||||
|
{
|
||||||
|
if (!menuService.checkMenuNameUnique(menu))
|
||||||
|
{
|
||||||
|
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||||
|
}
|
||||||
|
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
|
||||||
|
{
|
||||||
|
return error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||||
|
}
|
||||||
|
menu.setCreateBy(getUsername());
|
||||||
|
return toAjax(menuService.insertMenu(menu));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改菜单
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:menu:edit')")
|
||||||
|
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody SysMenu menu)
|
||||||
|
{
|
||||||
|
if (!menuService.checkMenuNameUnique(menu))
|
||||||
|
{
|
||||||
|
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||||
|
}
|
||||||
|
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
|
||||||
|
{
|
||||||
|
return error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||||
|
}
|
||||||
|
else if (menu.getMenuId().equals(menu.getParentId()))
|
||||||
|
{
|
||||||
|
return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
|
||||||
|
}
|
||||||
|
menu.setUpdateBy(getUsername());
|
||||||
|
return toAjax(menuService.updateMenu(menu));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除菜单
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:menu:remove')")
|
||||||
|
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{menuId}")
|
||||||
|
public AjaxResult remove(@PathVariable("menuId") Long menuId)
|
||||||
|
{
|
||||||
|
if (menuService.hasChildByMenuId(menuId))
|
||||||
|
{
|
||||||
|
return warn("存在子菜单,不允许删除");
|
||||||
|
}
|
||||||
|
if (menuService.checkMenuExistRole(menuId))
|
||||||
|
{
|
||||||
|
return warn("菜单已分配,不允许删除");
|
||||||
|
}
|
||||||
|
return toAjax(menuService.deleteMenuById(menuId));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据用户查询菜单权限字符
|
||||||
|
*/
|
||||||
|
@GetMapping("/getMenuPermsByUser")
|
||||||
|
public AjaxResult getMenuPermsByUser()
|
||||||
|
{
|
||||||
|
|
||||||
|
return menuService.getMenuPermsByUser();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
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.BusinessType;
|
||||||
|
import com.ruoyi.system.domain.SysNotice;
|
||||||
|
import com.ruoyi.system.service.ISysNoticeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告 信息操作处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/notice")
|
||||||
|
public class SysNoticeController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ISysNoticeService noticeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取通知公告列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:notice:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysNotice notice)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据通知公告编号获取详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:notice:query')")
|
||||||
|
@GetMapping(value = "/{noticeId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long noticeId)
|
||||||
|
{
|
||||||
|
return success(noticeService.selectNoticeById(noticeId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增通知公告
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:notice:add')")
|
||||||
|
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody SysNotice notice)
|
||||||
|
{
|
||||||
|
notice.setCreateBy(getUsername());
|
||||||
|
return toAjax(noticeService.insertNotice(notice));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改通知公告
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:notice:edit')")
|
||||||
|
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody SysNotice notice)
|
||||||
|
{
|
||||||
|
notice.setUpdateBy(getUsername());
|
||||||
|
return toAjax(noticeService.updateNotice(notice));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除通知公告
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:notice:remove')")
|
||||||
|
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{noticeIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] noticeIds)
|
||||||
|
{
|
||||||
|
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
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.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.system.domain.SysPost;
|
||||||
|
import com.ruoyi.system.service.ISysPostService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 岗位信息操作处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/post")
|
||||||
|
public class SysPostController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ISysPostService postService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取岗位列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:post:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysPost post)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysPost> list = postService.selectPostList(post);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:post:export')")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysPost post)
|
||||||
|
{
|
||||||
|
List<SysPost> list = postService.selectPostList(post);
|
||||||
|
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
|
||||||
|
util.exportExcel(response, list, "岗位数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据岗位编号获取详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:post:query')")
|
||||||
|
@GetMapping(value = "/{postId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long postId)
|
||||||
|
{
|
||||||
|
return success(postService.selectPostById(postId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增岗位
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:post:add')")
|
||||||
|
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody SysPost post)
|
||||||
|
{
|
||||||
|
if (!postService.checkPostNameUnique(post))
|
||||||
|
{
|
||||||
|
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||||
|
}
|
||||||
|
else if (!postService.checkPostCodeUnique(post))
|
||||||
|
{
|
||||||
|
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||||
|
}
|
||||||
|
post.setCreateBy(getUsername());
|
||||||
|
return toAjax(postService.insertPost(post));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改岗位
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:post:edit')")
|
||||||
|
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody SysPost post)
|
||||||
|
{
|
||||||
|
if (!postService.checkPostNameUnique(post))
|
||||||
|
{
|
||||||
|
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||||
|
}
|
||||||
|
else if (!postService.checkPostCodeUnique(post))
|
||||||
|
{
|
||||||
|
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||||
|
}
|
||||||
|
post.setUpdateBy(getUsername());
|
||||||
|
return toAjax(postService.updatePost(post));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除岗位
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:post:remove')")
|
||||||
|
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{postIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] postIds)
|
||||||
|
{
|
||||||
|
return toAjax(postService.deletePostByIds(postIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取岗位选择框列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/optionselect")
|
||||||
|
public AjaxResult optionselect()
|
||||||
|
{
|
||||||
|
List<SysPost> posts = postService.selectPostAll();
|
||||||
|
return success(posts);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
|
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.domain.model.LoginUser;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||||
|
import com.ruoyi.common.utils.file.MimeTypeUtils;
|
||||||
|
import com.ruoyi.framework.web.service.TokenService;
|
||||||
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 个人信息 业务处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/user/profile")
|
||||||
|
public class SysProfileController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService userService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TokenService tokenService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 个人信息
|
||||||
|
*/
|
||||||
|
@GetMapping
|
||||||
|
public AjaxResult profile()
|
||||||
|
{
|
||||||
|
LoginUser loginUser = getLoginUser();
|
||||||
|
SysUser user = loginUser.getUser();
|
||||||
|
AjaxResult ajax = AjaxResult.success(user);
|
||||||
|
ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
|
||||||
|
ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户
|
||||||
|
*/
|
||||||
|
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult updateProfile(@RequestBody SysUser user)
|
||||||
|
{
|
||||||
|
LoginUser loginUser = getLoginUser();
|
||||||
|
SysUser currentUser = loginUser.getUser();
|
||||||
|
currentUser.setNickName(user.getNickName());
|
||||||
|
currentUser.setEmail(user.getEmail());
|
||||||
|
currentUser.setPhonenumber(user.getPhonenumber());
|
||||||
|
currentUser.setSex(user.getSex());
|
||||||
|
if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser))
|
||||||
|
{
|
||||||
|
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser))
|
||||||
|
{
|
||||||
|
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||||
|
}
|
||||||
|
if (userService.updateUserProfile(currentUser) > 0)
|
||||||
|
{
|
||||||
|
// 更新缓存用户信息
|
||||||
|
tokenService.setLoginUser(loginUser);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
return error("修改个人信息异常,请联系管理员");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置密码
|
||||||
|
*/
|
||||||
|
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/updatePwd")
|
||||||
|
public AjaxResult updatePwd(String oldPassword, String newPassword)
|
||||||
|
{
|
||||||
|
LoginUser loginUser = getLoginUser();
|
||||||
|
String userName = loginUser.getUsername();
|
||||||
|
String password = loginUser.getPassword();
|
||||||
|
if (!SecurityUtils.matchesPassword(oldPassword, password))
|
||||||
|
{
|
||||||
|
return error("修改密码失败,旧密码错误");
|
||||||
|
}
|
||||||
|
if (SecurityUtils.matchesPassword(newPassword, password))
|
||||||
|
{
|
||||||
|
return error("新密码不能与旧密码相同");
|
||||||
|
}
|
||||||
|
if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0)
|
||||||
|
{
|
||||||
|
// 更新缓存用户密码
|
||||||
|
loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
|
||||||
|
tokenService.setLoginUser(loginUser);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
return error("修改密码异常,请联系管理员");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像上传
|
||||||
|
*/
|
||||||
|
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/avatar")
|
||||||
|
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception
|
||||||
|
{
|
||||||
|
if (!file.isEmpty())
|
||||||
|
{
|
||||||
|
LoginUser loginUser = getLoginUser();
|
||||||
|
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
|
||||||
|
if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
|
||||||
|
{
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("imgUrl", avatar);
|
||||||
|
// 更新缓存用户头像
|
||||||
|
loginUser.getUser().setAvatar(avatar);
|
||||||
|
tokenService.setLoginUser(loginUser);
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return error("上传图片异常,请联系管理员");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.model.RegisterBody;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.framework.web.service.SysRegisterService;
|
||||||
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册验证
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
public class SysRegisterController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private SysRegisterService registerService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysConfigService configService;
|
||||||
|
|
||||||
|
@PostMapping("/register")
|
||||||
|
public AjaxResult register(@RequestBody RegisterBody user)
|
||||||
|
{
|
||||||
|
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
|
||||||
|
{
|
||||||
|
return error("当前系统没有开启注册功能!");
|
||||||
|
}
|
||||||
|
String msg = registerService.register(user);
|
||||||
|
return StringUtils.isEmpty(msg) ? success() : error(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,262 @@
|
|||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
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.SysDept;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.framework.web.service.SysPermissionService;
|
||||||
|
import com.ruoyi.framework.web.service.TokenService;
|
||||||
|
import com.ruoyi.system.domain.SysUserRole;
|
||||||
|
import com.ruoyi.system.service.ISysDeptService;
|
||||||
|
import com.ruoyi.system.service.ISysRoleService;
|
||||||
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色信息
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/role")
|
||||||
|
public class SysRoleController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ISysRoleService roleService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TokenService tokenService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysPermissionService permissionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService userService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysDeptService deptService;
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysRole role)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysRole> list = roleService.selectRoleList(role);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:export')")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysRole role)
|
||||||
|
{
|
||||||
|
List<SysRole> list = roleService.selectRoleList(role);
|
||||||
|
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
|
||||||
|
util.exportExcel(response, list, "角色数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据角色编号获取详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||||
|
@GetMapping(value = "/{roleId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long roleId)
|
||||||
|
{
|
||||||
|
roleService.checkRoleDataScope(roleId);
|
||||||
|
return success(roleService.selectRoleById(roleId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增角色
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:add')")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody SysRole role)
|
||||||
|
{
|
||||||
|
if (!roleService.checkRoleNameUnique(role))
|
||||||
|
{
|
||||||
|
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||||
|
}
|
||||||
|
else if (!roleService.checkRoleKeyUnique(role))
|
||||||
|
{
|
||||||
|
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||||
|
}
|
||||||
|
role.setCreateBy(getUsername());
|
||||||
|
return toAjax(roleService.insertRole(role));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存角色
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody SysRole role)
|
||||||
|
{
|
||||||
|
roleService.checkRoleAllowed(role);
|
||||||
|
roleService.checkRoleDataScope(role.getRoleId());
|
||||||
|
if (!roleService.checkRoleNameUnique(role))
|
||||||
|
{
|
||||||
|
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||||
|
}
|
||||||
|
else if (!roleService.checkRoleKeyUnique(role))
|
||||||
|
{
|
||||||
|
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||||
|
}
|
||||||
|
role.setUpdateBy(getUsername());
|
||||||
|
|
||||||
|
if (roleService.updateRole(role) > 0)
|
||||||
|
{
|
||||||
|
// 更新缓存用户权限
|
||||||
|
LoginUser loginUser = getLoginUser();
|
||||||
|
if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
|
||||||
|
{
|
||||||
|
loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
|
||||||
|
loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
|
||||||
|
tokenService.setLoginUser(loginUser);
|
||||||
|
}
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
return error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存数据权限
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/dataScope")
|
||||||
|
public AjaxResult dataScope(@RequestBody SysRole role)
|
||||||
|
{
|
||||||
|
roleService.checkRoleAllowed(role);
|
||||||
|
roleService.checkRoleDataScope(role.getRoleId());
|
||||||
|
return toAjax(roleService.authDataScope(role));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态修改
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/changeStatus")
|
||||||
|
public AjaxResult changeStatus(@RequestBody SysRole role)
|
||||||
|
{
|
||||||
|
roleService.checkRoleAllowed(role);
|
||||||
|
roleService.checkRoleDataScope(role.getRoleId());
|
||||||
|
role.setUpdateBy(getUsername());
|
||||||
|
return toAjax(roleService.updateRoleStatus(role));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除角色
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:remove')")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{roleIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] roleIds)
|
||||||
|
{
|
||||||
|
return toAjax(roleService.deleteRoleByIds(roleIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取角色选择框列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||||
|
@GetMapping("/optionselect")
|
||||||
|
public AjaxResult optionselect()
|
||||||
|
{
|
||||||
|
return success(roleService.selectRoleAll());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询已分配用户角色列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||||
|
@GetMapping("/authUser/allocatedList")
|
||||||
|
public TableDataInfo allocatedList(SysUser user)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysUser> list = userService.selectAllocatedList(user);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询未分配用户角色列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||||
|
@GetMapping("/authUser/unallocatedList")
|
||||||
|
public TableDataInfo unallocatedList(SysUser user)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysUser> list = userService.selectUnallocatedList(user);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消授权用户
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
|
@PutMapping("/authUser/cancel")
|
||||||
|
public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
|
||||||
|
{
|
||||||
|
return toAjax(roleService.deleteAuthUser(userRole));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量取消授权用户
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
|
@PutMapping("/authUser/cancelAll")
|
||||||
|
public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
|
||||||
|
{
|
||||||
|
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量选择用户授权
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
|
@PutMapping("/authUser/selectAll")
|
||||||
|
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
|
||||||
|
{
|
||||||
|
roleService.checkRoleDataScope(roleId);
|
||||||
|
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取对应角色部门树列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||||
|
@GetMapping(value = "/deptTree/{roleId}")
|
||||||
|
public AjaxResult deptTree(@PathVariable("roleId") Long roleId)
|
||||||
|
{
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
|
||||||
|
ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,271 @@
|
|||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
|
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.SysDept;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.system.mapper.SysDeptMapper;
|
||||||
|
import com.ruoyi.system.service.ISysDeptService;
|
||||||
|
import com.ruoyi.system.service.ISysPostService;
|
||||||
|
import com.ruoyi.system.service.ISysRoleService;
|
||||||
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户信息
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Api("用户信息管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/user")
|
||||||
|
public class SysUserController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService userService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysRoleService roleService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysDeptService deptService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysPostService postService;
|
||||||
|
@Autowired
|
||||||
|
private SysDeptMapper deptMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户列表
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "获取用户列表",notes = "分页获取用户列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysUser user)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysUser> list = userService.selectUserList(user);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:export')")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysUser user)
|
||||||
|
{
|
||||||
|
List<SysUser> list = userService.selectUserList(user);
|
||||||
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||||
|
util.exportExcel(response, list, "用户数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:import')")
|
||||||
|
@PostMapping("/importData")
|
||||||
|
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
||||||
|
{
|
||||||
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||||
|
List<SysUser> userList = util.importExcel(file.getInputStream());
|
||||||
|
String operName = getUsername();
|
||||||
|
String message = userService.importUser(userList, updateSupport, operName);
|
||||||
|
return success(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/importTemplate")
|
||||||
|
public void importTemplate(HttpServletResponse response)
|
||||||
|
{
|
||||||
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||||
|
util.importTemplateExcel(response, "用户数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户编号获取详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
||||||
|
@GetMapping(value = { "/", "/{userId}" })
|
||||||
|
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
|
||||||
|
{
|
||||||
|
userService.checkUserDataScope(userId);
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
List<SysRole> roles = roleService.selectRoleAll();
|
||||||
|
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||||
|
ajax.put("posts", postService.selectPostAll());
|
||||||
|
|
||||||
|
if (StringUtils.isNotNull(userId))
|
||||||
|
{
|
||||||
|
SysUser sysUser = userService.selectUserById(userId);
|
||||||
|
ajax.put(AjaxResult.DATA_TAG, sysUser);
|
||||||
|
ajax.put("postIds", postService.selectPostListByUserId(userId));
|
||||||
|
ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
|
||||||
|
List<SysDept> sysUserDepts = deptMapper.selectDeptByUserId(userId);
|
||||||
|
if(CollectionUtil.isNotEmpty(sysUserDepts)) {
|
||||||
|
ajax.put("deptId", sysUserDepts.stream().map(SysDept::getDeptId).collect(Collectors.toList()));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:add')")
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody SysUser user)
|
||||||
|
{
|
||||||
|
if (!userService.checkUserNameUnique(user))
|
||||||
|
{
|
||||||
|
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||||
|
}
|
||||||
|
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
||||||
|
{
|
||||||
|
return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||||
|
}
|
||||||
|
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
||||||
|
{
|
||||||
|
return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||||
|
}
|
||||||
|
user.setCreateBy(getUsername());
|
||||||
|
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||||
|
return userService.insertUser(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody SysUser user)
|
||||||
|
{
|
||||||
|
userService.checkUserAllowed(user);
|
||||||
|
userService.checkUserDataScope(user.getUserId());
|
||||||
|
if (!userService.checkUserNameUnique(user))
|
||||||
|
{
|
||||||
|
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||||
|
}
|
||||||
|
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
||||||
|
{
|
||||||
|
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||||
|
}
|
||||||
|
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
||||||
|
{
|
||||||
|
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||||
|
}
|
||||||
|
user.setUpdateBy(getUsername());
|
||||||
|
return userService.updateUser(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:remove')")
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{userIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] userIds)
|
||||||
|
{
|
||||||
|
if (ArrayUtils.contains(userIds, getUserId()))
|
||||||
|
{
|
||||||
|
return error("当前用户不能删除");
|
||||||
|
}
|
||||||
|
return toAjax(userService.deleteUserByIds(userIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置密码
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/resetPwd")
|
||||||
|
public AjaxResult resetPwd(@RequestBody SysUser user)
|
||||||
|
{
|
||||||
|
userService.checkUserAllowed(user);
|
||||||
|
userService.checkUserDataScope(user.getUserId());
|
||||||
|
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||||
|
user.setUpdateBy(getUsername());
|
||||||
|
return toAjax(userService.resetPwd(user));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态修改
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/changeStatus")
|
||||||
|
public AjaxResult changeStatus(@RequestBody SysUser user)
|
||||||
|
{
|
||||||
|
userService.checkUserAllowed(user);
|
||||||
|
userService.checkUserDataScope(user.getUserId());
|
||||||
|
user.setUpdateBy(getUsername());
|
||||||
|
return toAjax(userService.updateUserStatus(user));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户编号获取授权角色
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
||||||
|
@GetMapping("/authRole/{userId}")
|
||||||
|
public AjaxResult authRole(@PathVariable("userId") Long userId)
|
||||||
|
{
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
SysUser user = userService.selectUserById(userId);
|
||||||
|
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
||||||
|
ajax.put("user", user);
|
||||||
|
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户授权角色
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
||||||
|
@PutMapping("/authRole")
|
||||||
|
public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
|
||||||
|
{
|
||||||
|
userService.checkUserDataScope(userId);
|
||||||
|
userService.insertUserAuth(userId, roleIds);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取部门树列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:list')")
|
||||||
|
@GetMapping("/deptTree")
|
||||||
|
public AjaxResult deptTree(SysDept dept)
|
||||||
|
{
|
||||||
|
return success(deptService.selectDeptTreeList(dept));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据userId获取用户信息
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@GetMapping("/selectUserById")
|
||||||
|
public AjaxResult selectUserById(@RequestParam(required = true) Long userId){
|
||||||
|
return AjaxResult.success(userService.selectUserById(userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package com.ruoyi.web.controller.tool;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.enums.AttachmentOperateTypeEnum;
|
||||||
|
import com.ruoyi.common.enums.DocumentTypeEnum;
|
||||||
|
import com.ruoyi.common.enums.PushCaseStatusEnum;
|
||||||
|
import com.ruoyi.system.service.impl.BeiMingInterfaceService;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseFileInfo;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseStatusInfo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import static com.ruoyi.common.utils.EncryptUtils.sm4Decrypt;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/beiming/api")
|
||||||
|
public class TestApiController {
|
||||||
|
@Autowired
|
||||||
|
BeiMingInterfaceService beiMingInterfaceService;
|
||||||
|
@Value("${beimingprivatekey}")
|
||||||
|
public String privateKey;
|
||||||
|
|
||||||
|
@GetMapping("/test")
|
||||||
|
@Anonymous
|
||||||
|
public AjaxResult selectCaseFlow() {
|
||||||
|
String token = beiMingInterfaceService.getApiToken("BWT_MEDIATION", "86251b190e3a40f3942v215d1762c663", System.currentTimeMillis());
|
||||||
|
// token = "f910e1441fc56e49d3f31396e8d9aa04228045815ee986a9587d7a5cb7312f9d11c7f80041745f38ec686ea1f819c8b8227f9c03196c6dd004f89215c4805c24355be4b57abeddb7b9d2cbda45fae74c49f4a83fb6496d84302ca8c07245786d682ecb68aed966fcbda3188b9c4d4376089471bb5aee371a62073b0ce15d72dccd6fbc8fd13957e2fb7aa018cb5937938bfc9773e570ac06ac633617cea8405759cf609c832074aaa03f972c0a6a93cde531da0d91d07770c037fdea1368ee5772941ba2a55ef155979d1ed8222faad92ed342530ef04f3746aa96499dee6ea4869ce46bd0dcfe7a69e7db49eb2aec388c47824c201b49825f24ffe82dde41b5";
|
||||||
|
System.out.println("toke:" + token);
|
||||||
|
//解密
|
||||||
|
if (token != null && !token.isEmpty()) {
|
||||||
|
JSONObject jsonObject = JSON.parseObject(token);
|
||||||
|
String tokenString = jsonObject.getString("data");
|
||||||
|
System.out.println("data信息:" + tokenString);
|
||||||
|
String tokenstr = sm4Decrypt(tokenString, privateKey);
|
||||||
|
System.out.println("解密后的字符串:" + tokenstr);
|
||||||
|
if (tokenstr != null && !tokenstr.isEmpty()) {
|
||||||
|
JSONObject tokenObject = JSON.parseObject(tokenstr);
|
||||||
|
String resultToken = tokenObject.getString("token");
|
||||||
|
MsCaseStatusInfo info = MsCaseStatusInfo.builder().caseNo("zc2024032700012").statusCode(PushCaseStatusEnum.MEDIATE.getCode()).caseClosureExplanation(PushCaseStatusEnum.MEDIATE.getName()).build();
|
||||||
|
JSONObject result = beiMingInterfaceService.submitCaseStatusInfo(resultToken, "zc2024032700012", "BWT_MEDIATION", info);
|
||||||
|
System.out.println("jieguo:" + result.toString());
|
||||||
|
if (result != null) {
|
||||||
|
String data = result.getString("data");
|
||||||
|
String datastr = sm4Decrypt(data, privateKey);
|
||||||
|
System.out.println("最终解密后的字符串:" + datastr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/testfile")
|
||||||
|
@Anonymous
|
||||||
|
public AjaxResult testfile() {
|
||||||
|
// File file = new File("D:/WorkDoc/TJ/File/证据1.png");
|
||||||
|
File file = new File("D:/WorkDoc/TJ/File/证据3.png");
|
||||||
|
MsCaseFileInfo jsonObject1 = beiMingInterfaceService.pushAttachmentInfo("BWT_MEDIATION", "86251b190e3a40f3942v215d1762c663", file, "BWT_MEDIATION", "zc2024032700012", AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT);
|
||||||
|
System.out.println("fanhui:" + jsonObject1.toString());
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,183 @@
|
|||||||
|
package com.ruoyi.web.controller.tool;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* swagger 用户测试方法
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Api("用户信息管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/test/user")
|
||||||
|
public class TestController extends BaseController
|
||||||
|
{
|
||||||
|
private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
|
||||||
|
{
|
||||||
|
users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
|
||||||
|
users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("获取用户列表")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public R<List<UserEntity>> userList()
|
||||||
|
{
|
||||||
|
List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
|
||||||
|
return R.ok(userList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("获取用户详细")
|
||||||
|
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
|
||||||
|
@GetMapping("/{userId}")
|
||||||
|
public R<UserEntity> getUser(@PathVariable Integer userId)
|
||||||
|
{
|
||||||
|
if (!users.isEmpty() && users.containsKey(userId))
|
||||||
|
{
|
||||||
|
return R.ok(users.get(userId));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return R.fail("用户不存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("新增用户")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class),
|
||||||
|
@ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class),
|
||||||
|
@ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class),
|
||||||
|
@ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class)
|
||||||
|
})
|
||||||
|
@PostMapping("/save")
|
||||||
|
public R<String> save(UserEntity user)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
||||||
|
{
|
||||||
|
return R.fail("用户ID不能为空");
|
||||||
|
}
|
||||||
|
users.put(user.getUserId(), user);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("更新用户")
|
||||||
|
@PutMapping("/update")
|
||||||
|
public R<String> update(@RequestBody UserEntity user)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
||||||
|
{
|
||||||
|
return R.fail("用户ID不能为空");
|
||||||
|
}
|
||||||
|
if (users.isEmpty() || !users.containsKey(user.getUserId()))
|
||||||
|
{
|
||||||
|
return R.fail("用户不存在");
|
||||||
|
}
|
||||||
|
users.remove(user.getUserId());
|
||||||
|
users.put(user.getUserId(), user);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除用户信息")
|
||||||
|
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
|
||||||
|
@DeleteMapping("/{userId}")
|
||||||
|
public R<String> delete(@PathVariable Integer userId)
|
||||||
|
{
|
||||||
|
if (!users.isEmpty() && users.containsKey(userId))
|
||||||
|
{
|
||||||
|
users.remove(userId);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return R.fail("用户不存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiModel(value = "UserEntity", description = "用户实体")
|
||||||
|
class UserEntity
|
||||||
|
{
|
||||||
|
@ApiModelProperty("用户ID")
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户名称")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户密码")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户手机")
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
public UserEntity()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserEntity(Integer userId, String username, String password, String mobile)
|
||||||
|
{
|
||||||
|
this.userId = userId;
|
||||||
|
this.username = username;
|
||||||
|
this.password = password;
|
||||||
|
this.mobile = mobile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getUserId()
|
||||||
|
{
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(Integer userId)
|
||||||
|
{
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 getMobile()
|
||||||
|
{
|
||||||
|
return mobile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMobile(String mobile)
|
||||||
|
{
|
||||||
|
this.mobile = mobile;
|
||||||
|
}
|
||||||
|
}
|
||||||
+73
@@ -0,0 +1,73 @@
|
|||||||
|
package com.ruoyi.web.controller.wisdomarbitrate.casenumrule;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.dto.casenumrule.CaseNumRule;
|
||||||
|
import com.ruoyi.wisdomarbitrate.service.casenumrule.ICaseNumRuleService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/caseNumRule")
|
||||||
|
public class CaseNumRuleController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private ICaseNumRuleService caseNumRuleService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增案件编号规则
|
||||||
|
* @param caseNumRule
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/insertCaseNumRule")
|
||||||
|
public AjaxResult insertCaseNumRule(@RequestBody CaseNumRule caseNumRule){
|
||||||
|
caseNumRule.setCreateBy(getUsername());
|
||||||
|
return caseNumRuleService.insertCaseNumRule(caseNumRule);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改案件编号规则
|
||||||
|
* @param caseNumRule
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/updateCaseNumRule")
|
||||||
|
public AjaxResult updateCaseNumRule(@RequestBody CaseNumRule caseNumRule){
|
||||||
|
return caseNumRuleService.updateCaseNumRule(caseNumRule);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除案件编号规则
|
||||||
|
* @param caseNumRule
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/deleteCaseNumRule")
|
||||||
|
public AjaxResult deleteCaseNumRule(@RequestBody CaseNumRule caseNumRule){
|
||||||
|
return caseNumRuleService.deleteCaseNumRule(caseNumRule);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询案件编号规则
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(CaseNumRule caseNumRule) {
|
||||||
|
startPage();
|
||||||
|
List<CaseNumRule> list = caseNumRuleService.selectCaseNumRule(caseNumRule);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+259
@@ -0,0 +1,259 @@
|
|||||||
|
package com.ruoyi.web.controller.wisdomarbitrate.dept;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
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.exception.EsignDemoException;
|
||||||
|
import com.ruoyi.framework.config.ServerConfig;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.dto.template.FatchRule;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage;
|
||||||
|
import com.ruoyi.wisdomarbitrate.service.dept.IDeptIdentifyService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/deptIdentify")
|
||||||
|
public class DeptIdentifyController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private IDeptIdentifyService deptIdentifyService;
|
||||||
|
@Autowired
|
||||||
|
private ServerConfig serverConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增机构
|
||||||
|
* @param deptIdentify
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/insert")
|
||||||
|
public AjaxResult insertDeptIdentify(@RequestBody DeptIdentify deptIdentify){
|
||||||
|
return deptIdentifyService.insertDeptIdentify(deptIdentify);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除机构
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
public AjaxResult deleteDeptIdentify(Long id){
|
||||||
|
return deptIdentifyService.deleteDeptIdentify(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改机构信息
|
||||||
|
* @param deptIdentify
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PutMapping("/update")
|
||||||
|
public AjaxResult updateDeptIdentify(@RequestBody DeptIdentify deptIdentify){
|
||||||
|
return deptIdentifyService.updateDeptIdentify(deptIdentify);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询机构信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(DeptIdentify deptIdentify) {
|
||||||
|
startPage();
|
||||||
|
List<DeptIdentify> list = deptIdentifyService.selectDeptIdentify(deptIdentify);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询机构认证链接
|
||||||
|
*/
|
||||||
|
@PostMapping("/selectDeptIndefiUrl")
|
||||||
|
public AjaxResult selectDeptIndefiUrl(@Validated @RequestBody DeptIdentify deptIdentify) throws EsignDemoException {
|
||||||
|
DeptIdentify deptIdentifyselect = deptIdentifyService.selectDeptIndefiUrl(deptIdentify);
|
||||||
|
return success(deptIdentifyselect);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机构启用/禁用
|
||||||
|
*/
|
||||||
|
@PostMapping("/enableDept")
|
||||||
|
public AjaxResult enableDept(@Validated @RequestBody DeptIdentify deptIdentify) {
|
||||||
|
return deptIdentifyService.enableDept(deptIdentify);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传自定义公章
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @param file
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/sealUpload")
|
||||||
|
public AjaxResult sealUpload(Long id, String sealName , @RequestParam("file") MultipartFile file) {
|
||||||
|
return deptIdentifyService.sealUpload(id, sealName ,file);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接收E签宝回调通知
|
||||||
|
* @param body
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/notify")
|
||||||
|
public AjaxResult receiveNotify(String body) {
|
||||||
|
return deptIdentifyService.receiveNotify(body);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公章列表查询
|
||||||
|
* @param deptIdentify
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/sealList")
|
||||||
|
public TableDataInfo getSealList( DeptIdentify deptIdentify ){
|
||||||
|
startPage();
|
||||||
|
List<SealManage> sealList = deptIdentifyService.getSealList(deptIdentify);
|
||||||
|
return getDataTable(sealList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 印章启用或者禁用
|
||||||
|
* @param sealManage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/updateSealLockStatus")
|
||||||
|
public AjaxResult updateSealLockStatus(@Validated @RequestBody SealManage sealManage){
|
||||||
|
if(sealManage.getId()==null ||sealManage.getIsUse()==null){
|
||||||
|
return error("参数校验失败");
|
||||||
|
}
|
||||||
|
return deptIdentifyService.updateSealLockStatus(sealManage);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增模板
|
||||||
|
* @param templateManage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/insertTemplate")
|
||||||
|
public AjaxResult insertTemplate( @RequestBody TemplateManage templateManage){
|
||||||
|
if(CollectionUtil.isEmpty(templateManage.getAnnexIds())||templateManage.getIdentifyId() == null ) {
|
||||||
|
return error("参数校验失败");
|
||||||
|
}
|
||||||
|
return deptIdentifyService.insertTemplate(templateManage);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 通用上传请求(单个)
|
||||||
|
*/
|
||||||
|
@PostMapping("/upload")
|
||||||
|
public AjaxResult uploadFile(@RequestParam("file") MultipartFile file, @RequestParam("annexType") Integer annexType) throws Exception
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
AjaxResult result = deptIdentifyService.uploadFile(file, annexType);
|
||||||
|
if(result.get("url")!=null){
|
||||||
|
result.put("url",serverConfig.getUrl()+result.get("url"));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return AjaxResult.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 修改模板
|
||||||
|
* @param templateManage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/updateTemplate")
|
||||||
|
public AjaxResult updateTemplate(@RequestBody TemplateManage templateManage){
|
||||||
|
if(templateManage.getId()==null || CollectionUtil.isEmpty(templateManage.getAnnexIds())||templateManage.getIdentifyId() == null ) {
|
||||||
|
return error("参数校验失败");
|
||||||
|
}
|
||||||
|
return deptIdentifyService.updateTemplate(templateManage);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除模板
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/deleteTemplate")
|
||||||
|
public AjaxResult deleteTemplate(Long id){
|
||||||
|
return deptIdentifyService.deleteTemplate(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据机构id查询模板
|
||||||
|
* @param deptIdentify
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/getTemplate")
|
||||||
|
public TableDataInfo getTemplateList( DeptIdentify deptIdentify){
|
||||||
|
startPage();
|
||||||
|
List<TemplateManage> sealList = deptIdentifyService.getTemplateList(deptIdentify);
|
||||||
|
return getDataTable(sealList);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据模板id查询详情
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/getTemplateDetail")
|
||||||
|
public AjaxResult getTemplateDetail( @RequestParam("id") Long id){
|
||||||
|
return deptIdentifyService.getTemplateDetail(id);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据部门id查询岗位用户信息
|
||||||
|
*/
|
||||||
|
@GetMapping("selectPostUserByDeptId")
|
||||||
|
public AjaxResult selectPostUserByDeptId(DeptIdentify deptIdentify){
|
||||||
|
return AjaxResult.success(deptIdentifyService.selectPostUserByDeptId(deptIdentify));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 给机构绑定经办人
|
||||||
|
*/
|
||||||
|
@GetMapping("bindHandler")
|
||||||
|
public AjaxResult bindHandler(DeptIdentify deptIdentify){
|
||||||
|
return deptIdentifyService.bindHandler(deptIdentify);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据模板id查询抓取规则
|
||||||
|
* @param templateManage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/getFatchRuleByTemplateid")
|
||||||
|
public AjaxResult getFatchRuleByTemplateid(@RequestBody TemplateManage templateManage){
|
||||||
|
List<FatchRule> fatchRuleList = deptIdentifyService.getFatchRuleByTemplateid(templateManage);
|
||||||
|
return AjaxResult.success(fatchRuleList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存抓取规则
|
||||||
|
* @param templateManage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/saveFatchRules")
|
||||||
|
public AjaxResult saveFatchRules(@RequestBody TemplateManage templateManage){
|
||||||
|
return deptIdentifyService.saveFatchRules(templateManage);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据模板id查询模板字段列表
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/getTemplateInfoById")
|
||||||
|
public AjaxResult getTemplateInfoById(@RequestParam("id") Long id){
|
||||||
|
TemplateManage templateManage = new TemplateManage();
|
||||||
|
templateManage.setId(id);
|
||||||
|
List<FatchRule> fatchRuleList = deptIdentifyService.getTemplateInfoById(templateManage);
|
||||||
|
return AjaxResult.success(fatchRuleList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+61
@@ -0,0 +1,61 @@
|
|||||||
|
package com.ruoyi.web.controller.wisdomarbitrate.miniprogress;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.dto.miniprogress.IdentityAuthentication;
|
||||||
|
import com.ruoyi.wisdomarbitrate.service.miniprogress.IdentityAuthenticationService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/identityAuthentication")
|
||||||
|
public class IdentityAuthenticationController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private IdentityAuthenticationService identityAuthenticationService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取EIDtoken
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@PostMapping("/selectIdentityAuthenticaEIDtoken")
|
||||||
|
public AjaxResult selectIdentityAuthenticaEIDtoken() {
|
||||||
|
JSONObject tokenResult = identityAuthenticationService.selectIdentityAuthEIDToken(false);
|
||||||
|
return success(tokenResult);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取PC端EIDtoken
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@PostMapping("/selectPCIdentityAuthenticaEIDtoken")
|
||||||
|
public AjaxResult selectPCIdentityAuthenticaEIDtoken() {
|
||||||
|
JSONObject tokenResult = identityAuthenticationService.selectIdentityAuthEIDToken(true);
|
||||||
|
return success(tokenResult);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* H5轮询获取E证通Token状态
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@GetMapping("/selectPCEIDtokenStatus")
|
||||||
|
public AjaxResult selectPCEIDtokenStatus(@RequestParam String eidToken) {
|
||||||
|
return identityAuthenticationService.selectPCEIDtokenStatus(eidToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序人脸核身后查询身份认证结果
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@PostMapping("/selectIdentityAuthenticaRespon")
|
||||||
|
public AjaxResult selectIdentityAuthenticaRespon(@Validated @RequestBody IdentityAuthentication ientityAuthentication) {
|
||||||
|
if(StrUtil.isEmpty(ientityAuthentication.getEidToken())){
|
||||||
|
return error("EIDtoken不能为空");
|
||||||
|
}
|
||||||
|
AjaxResult checkResult = identityAuthenticationService.selectIdentityAuthenticaRespon(ientityAuthentication);
|
||||||
|
return checkResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+97
@@ -0,0 +1,97 @@
|
|||||||
|
package com.ruoyi.web.controller.wisdomarbitrate.miniprogress;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
|
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.system.mapper.SysRoleMapper;
|
||||||
|
import com.ruoyi.system.mapper.SysUserMapper;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.dto.miniprogress.IdentityAuthentication;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.vo.miniprogress.WeChatUserVO;
|
||||||
|
import com.ruoyi.wisdomarbitrate.service.miniprogress.WeChatUserService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wangqiong
|
||||||
|
* @description 微信小程序用户注册登录
|
||||||
|
* @date 2023-10-16 11:25
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/weChatUser")
|
||||||
|
public class WeChatUserController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private WeChatUserService weChatUserService;
|
||||||
|
@Autowired
|
||||||
|
private SysRoleMapper roleMapper;
|
||||||
|
@Autowired
|
||||||
|
private SysUserMapper userMapper;
|
||||||
|
/**
|
||||||
|
* 小程序端获取手机验证码
|
||||||
|
* @param userVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@GetMapping("/sendCode")
|
||||||
|
public AjaxResult sendCode( WeChatUserVO userVO)
|
||||||
|
{
|
||||||
|
if(StrUtil.isEmpty(userVO.getPhone())){
|
||||||
|
return warn("手机号不能为空");
|
||||||
|
}
|
||||||
|
return weChatUserService.sendCode(userVO);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取邮箱验证码
|
||||||
|
* @param email
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@GetMapping("/sendEmailCode")
|
||||||
|
public AjaxResult sendEmailCode( @RequestParam("email") String email)
|
||||||
|
{
|
||||||
|
return weChatUserService.sendEmailCode(email);
|
||||||
|
}
|
||||||
|
@Anonymous
|
||||||
|
@GetMapping("/roles")
|
||||||
|
public AjaxResult roles()
|
||||||
|
{
|
||||||
|
List<SysRole> list = roleMapper.selectRoleAll();
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 小程序注册
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@PostMapping("/registerUser")
|
||||||
|
public AjaxResult registerUser( @RequestBody IdentityAuthentication ientityAuthentication) {
|
||||||
|
if(
|
||||||
|
// ientityAuthentication.getId()==null ||
|
||||||
|
StrUtil.isEmpty(ientityAuthentication.getName())
|
||||||
|
|| StrUtil.isEmpty(ientityAuthentication.getIdentityNo())
|
||||||
|
|| StrUtil.isEmpty(ientityAuthentication.getPhone())
|
||||||
|
|| StrUtil.isEmpty(ientityAuthentication.getUserName())
|
||||||
|
|| StrUtil.isEmpty(ientityAuthentication.getEmail())
|
||||||
|
|| StrUtil.isEmpty(ientityAuthentication.getVerifyCode())
|
||||||
|
){
|
||||||
|
return warn("参数校验失败");
|
||||||
|
}
|
||||||
|
logger.info("调用小程序注册==="+ientityAuthentication.toString());
|
||||||
|
return weChatUserService.registerUser(ientityAuthentication);
|
||||||
|
}
|
||||||
|
@Anonymous
|
||||||
|
@GetMapping("/verifyUserName")
|
||||||
|
public AjaxResult verifyUserName(@RequestParam("userName") String userName)
|
||||||
|
{
|
||||||
|
SysUser sysUser = userMapper.checkUserNameUnique(userName);
|
||||||
|
if(sysUser==null){
|
||||||
|
return AjaxResult.success();
|
||||||
|
}else {
|
||||||
|
return AjaxResult.error("用户名已存在!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+405
@@ -0,0 +1,405 @@
|
|||||||
|
package com.ruoyi.web.controller.wisdomarbitrate.mscase;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.util.IdcardUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
|
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.exception.EsignDemoException;
|
||||||
|
import com.ruoyi.common.utils.IdCardUtils;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.*;
|
||||||
|
import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService;
|
||||||
|
import com.ruoyi.wisdomarbitrate.service.mscase.VideoConferenceService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 案件列表控制层
|
||||||
|
* @Author wangqiong
|
||||||
|
* @Date 2024/01/8
|
||||||
|
* @Version V1.0
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/caseApplication")
|
||||||
|
public class MsCaseApplicationController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private MsCaseApplicationService caseApplicationService;
|
||||||
|
@Autowired
|
||||||
|
private VideoConferenceService videoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询案件列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo page(MsCaseApplicationReq req)
|
||||||
|
{
|
||||||
|
List<MsCaseApplicationVO> list = caseApplicationService.list(req);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 首页待办数量
|
||||||
|
*/
|
||||||
|
@GetMapping("/todoCount")
|
||||||
|
public AjaxResult todoCount()
|
||||||
|
{
|
||||||
|
CaseToDoCountVO vo= caseApplicationService.todoCount();
|
||||||
|
return success(vo);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据登录人返回用户信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/getUserInfo")
|
||||||
|
public AjaxResult getUserInfo()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
return success(caseApplicationService.getUserInfo());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增案件
|
||||||
|
*/
|
||||||
|
@PostMapping("/insert")
|
||||||
|
public AjaxResult insert(@RequestBody MsCaseApplicationVO caseApplication )
|
||||||
|
{
|
||||||
|
if( caseApplication.getAffiliate()==null){
|
||||||
|
error("参数校验失败");
|
||||||
|
}
|
||||||
|
AjaxResult ajaxResult = AjaxResult.success();
|
||||||
|
ajaxResult.put("caseNum",caseApplicationService.insert(caseApplication));
|
||||||
|
return ajaxResult;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 批量新增案件
|
||||||
|
*/
|
||||||
|
@PostMapping("/batchInsert")
|
||||||
|
public AjaxResult batchInsert(@RequestBody MsCaseBatchInsertVO list )
|
||||||
|
{
|
||||||
|
|
||||||
|
return caseApplicationService.batchInsert(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据身份证号获取性别和出生日期
|
||||||
|
*/
|
||||||
|
@GetMapping("/getInfoByIdCard")
|
||||||
|
public AjaxResult getInfoByIdCard(@RequestParam(value = "idCard" ,required = false) String idCard)
|
||||||
|
{
|
||||||
|
if(StrUtil.isEmpty(idCard)){
|
||||||
|
return error("身份证号不能为空");
|
||||||
|
}
|
||||||
|
if(!IdcardUtil.isValidCard(idCard)){
|
||||||
|
return error("身份证不合法,请输入正确的身份证号");
|
||||||
|
}
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
Map<String, String> identityNumMap = IdCardUtils.getBirAgeSex(idCard);
|
||||||
|
String birthday = identityNumMap.get("birthday");
|
||||||
|
if (StrUtil.isNotEmpty(birthday)) {
|
||||||
|
SimpleDateFormat yyyymmddFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
|
||||||
|
Date birthdayDate = null;
|
||||||
|
try {
|
||||||
|
birthdayDate = yyyymmddFormat.parse(birthday);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
ajax.put("respondentBirth",birthdayDate);
|
||||||
|
}
|
||||||
|
//从身份证抓取性别
|
||||||
|
ajax.put("respondentSex",identityNumMap.get("sexCode"));
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改案件
|
||||||
|
*/
|
||||||
|
@PostMapping("/update")
|
||||||
|
public AjaxResult update(@RequestBody MsCaseApplicationVO caseApplication )
|
||||||
|
{
|
||||||
|
if(caseApplication.getId()==null){
|
||||||
|
error("id不能为空");
|
||||||
|
}
|
||||||
|
return success(caseApplicationService.update(caseApplication));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 删除案件
|
||||||
|
*/
|
||||||
|
@PostMapping("/delete")
|
||||||
|
public AjaxResult delete(@RequestBody MsCaseApplication req ) {
|
||||||
|
if (req.getCaseFlowId() == null
|
||||||
|
|| (req.getId() == null && StrUtil.isEmpty(req.getBatchNumber()))) {
|
||||||
|
return error("参数校验失败");
|
||||||
|
}
|
||||||
|
return caseApplicationService.delete(req);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据id查询案件
|
||||||
|
*/
|
||||||
|
@GetMapping("/selectById")
|
||||||
|
public AjaxResult selectById(@RequestParam(required = false) Long id ,@RequestParam(required = false) String caseNum )
|
||||||
|
{
|
||||||
|
if(id==null && caseNum==null ){
|
||||||
|
error("参数校验失败");
|
||||||
|
}
|
||||||
|
return success(caseApplicationService.selectById(id,caseNum));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 案件压缩包导入
|
||||||
|
* @param file
|
||||||
|
* @return
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
|
||||||
|
@PostMapping("/uploadCaseZipFile")
|
||||||
|
public AjaxResult uploadCaseZipFile(@RequestParam("file") MultipartFile file, @RequestParam("templateId") Long templateId) throws IOException {
|
||||||
|
if(file.isEmpty()||templateId==null){
|
||||||
|
return error("参数不能为空");
|
||||||
|
}
|
||||||
|
return caseApplicationService.uploadCaseZipFile(file,templateId);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 用户信息压缩包导入
|
||||||
|
* @param file
|
||||||
|
* @return
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@PostMapping("/userIdentify")
|
||||||
|
public AjaxResult userIdentify(@RequestParam("file") MultipartFile file) throws IOException {
|
||||||
|
if(file.isEmpty()){
|
||||||
|
return error("参数不能为空");
|
||||||
|
}
|
||||||
|
return caseApplicationService.userIdentify(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成调解申请书
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
@PostMapping("/generateApplication")
|
||||||
|
public AjaxResult generateApplication(@RequestBody MsCaseApplicationReq req) {
|
||||||
|
if (req.getTemplateId() == null||req.getCaseFlowId() == null || (req.getId() == null && StrUtil.isEmpty(req.getBatchNumber()))) {
|
||||||
|
return error("参数校验失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
return caseApplicationService.generateApplication(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 证据上传
|
||||||
|
* @param file
|
||||||
|
* @param annexType
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/batchUpload")
|
||||||
|
public AjaxResult batchUpload(@RequestParam("file") MultipartFile[] file, @RequestParam("annexType")Integer annexType, @RequestParam("id")Long id) {
|
||||||
|
if(file==null){
|
||||||
|
return error("请选择要上传的文件");
|
||||||
|
}
|
||||||
|
return caseApplicationService.batchUpload(file, annexType, id);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 案件受理
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/accept")
|
||||||
|
public AjaxResult accept(@RequestBody MsCaseApplicationVO req ) {
|
||||||
|
if (StrUtil.isEmpty(req.getMediationMethod() )
|
||||||
|
|| req.getAgreeFlag()==null
|
||||||
|
|| req.getPaperFlag() == null
|
||||||
|
|| req.getCaseFlowId() == null
|
||||||
|
|| req.getArbitrateConfirm() == null
|
||||||
|
|| (req.getId() == null && StrUtil.isEmpty(req.getBatchNumber()))) {
|
||||||
|
return error("参数校验失败");
|
||||||
|
}
|
||||||
|
return caseApplicationService.accept(req);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 案件提交
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/submit")
|
||||||
|
public AjaxResult submit(@RequestBody MsCaseApplication req ) {
|
||||||
|
if (req.getCaseFlowId() == null
|
||||||
|
|| (req.getId() == null && StrUtil.isEmpty(req.getBatchNumber()))) {
|
||||||
|
return error("参数校验失败");
|
||||||
|
}
|
||||||
|
return caseApplicationService.submit(req);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查询调解员
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/listMediator")
|
||||||
|
public AjaxResult listMediator( @RequestParam(value = "caseAppliId",required = true) Long caseAppliId) {
|
||||||
|
return caseApplicationService.listMediator(caseAppliId);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 保存预约
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/updateBooking")
|
||||||
|
public AjaxResult updateBooking(@RequestBody BookingVO vo ) {
|
||||||
|
if(vo.getId()==null || CollectionUtil.isEmpty(vo.getMediatorList())){
|
||||||
|
return error("参数校验失败");
|
||||||
|
}
|
||||||
|
return caseApplicationService.updateBooking(vo);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 核实调解员
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/verifyMediator")
|
||||||
|
public AjaxResult verifyMediator(@RequestBody BookingVO vo ) {
|
||||||
|
if((vo.getId() == null && StrUtil.isEmpty(vo.getBatchNumber()))
|
||||||
|
|| vo.getCaseFlowId()==null
|
||||||
|
|| vo.getMediatorId()==null
|
||||||
|
|| StrUtil.isEmpty(vo.getMediatorName())){
|
||||||
|
return error("参数校验失败");
|
||||||
|
}
|
||||||
|
return caseApplicationService.verifyMediator(vo);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 确认调解时间
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/confirmDate")
|
||||||
|
public AjaxResult confirmDate(@RequestBody BookingVO vo ) {
|
||||||
|
if((vo.getId() == null && StrUtil.isEmpty(vo.getBatchNumber()))
|
||||||
|
|| vo.getCaseFlowId()==null
|
||||||
|
|| CollectionUtil.isEmpty(vo.getHerDates())){
|
||||||
|
return error("参数校验失败");
|
||||||
|
}
|
||||||
|
return caseApplicationService.verifyMediator(vo);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查询预约信息
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/selectReservation")
|
||||||
|
public AjaxResult selectReservation(@RequestParam("id") Long id ) {
|
||||||
|
return caseApplicationService.selectReservation(id);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 调解
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/mediation")
|
||||||
|
public AjaxResult mediation(@RequestBody MsCaseApplicationReq req) throws EsignDemoException, InterruptedException {
|
||||||
|
if (req.getCaseFlowId() == null || req.getId() == null ) {
|
||||||
|
return error("参数校验失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
return caseApplicationService.mediation(req);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 确定会议结果
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/confirmMeetingResult")
|
||||||
|
public AjaxResult confirmMeetingResult(@RequestBody MsCaseApplicationReq req) {
|
||||||
|
if (req.getCaseFlowId() == null || req.getId() == null || req.getMediaResult()==null) {
|
||||||
|
return error("参数校验失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
return caseApplicationService.confirmMeetingResult(req);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 修改庭审笔录
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/updateTrialPen")
|
||||||
|
public AjaxResult updateTrialPen(@RequestBody MsCaseAttach attach) {
|
||||||
|
if (attach.getCaseAppliId()==null || attach.getAnnexId()==null ) {
|
||||||
|
return error("参数校验失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
return caseApplicationService.updateTrialPen(attach);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取userSign
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@GetMapping("/generateUserSign")
|
||||||
|
public AjaxResult generateUserSign(@RequestParam(required = true) String userId){
|
||||||
|
if(StrUtil.isEmpty(userId)){
|
||||||
|
error("参数校验失败");
|
||||||
|
}
|
||||||
|
return AjaxResult.success(videoService.generateUserSign(userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成房间号
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@GetMapping("/createRoomId")
|
||||||
|
public AjaxResult createRoomId(@RequestParam("caseId") Long caseId) {
|
||||||
|
|
||||||
|
return success(videoService.createRoomId(caseId));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 预约会议
|
||||||
|
* @param reservedConferenceVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/reservedConference")
|
||||||
|
public AjaxResult reservedConference(@Validated @RequestBody MsReservedConferenceVO reservedConferenceVO) throws Exception {
|
||||||
|
|
||||||
|
return videoService.reservedConference(reservedConferenceVO);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据案件id查询已预约的会议
|
||||||
|
* @param caseId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@GetMapping("/reserveConferenceList")
|
||||||
|
public AjaxResult reserveConferenceList( @RequestParam("caseId") Long caseId) {
|
||||||
|
|
||||||
|
return success(videoService.reserveConferenceList(caseId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存onlyOffice在线编辑的文件
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/saveOnlyOfficeFile")
|
||||||
|
public AjaxResult saveOnlyOfficeFile( @RequestBody MsCaseAttach caseAttach) {
|
||||||
|
if(caseAttach.getCaseAppliId()==null||StrUtil.isEmpty(caseAttach.getOnlyOfficeFileId())||StrUtil.isEmpty(caseAttach.getAnnexPath())){
|
||||||
|
return error("参数校验失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
return caseApplicationService.saveOnlyOfficeFile(caseAttach);
|
||||||
|
}
|
||||||
|
}
|
||||||
+108
@@ -0,0 +1,108 @@
|
|||||||
|
package com.ruoyi.web.controller.wisdomarbitrate.mscase;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseConfirmPayDTO;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CasePayDTO;
|
||||||
|
import com.ruoyi.wisdomarbitrate.service.mscase.MsCasePaymentService;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 案件缴费控制层
|
||||||
|
* @Author wangqiong
|
||||||
|
* @Date 2024/01/8
|
||||||
|
* @Version V1.0
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/pay")
|
||||||
|
public class MsCaseApplicationPayController extends BaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MsCasePaymentService casePaymentService;
|
||||||
|
/**
|
||||||
|
* 根据案件id或者批次号查询申请人及应缴费用
|
||||||
|
* @param dto 缴费传入参数
|
||||||
|
* @return 统一响应结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/selectTotalFee")
|
||||||
|
public AjaxResult selectTotalFee(@RequestBody CasePayDTO dto) {
|
||||||
|
if ((dto.getCaseId() == null && StrUtil.isEmpty(dto.getBatchNumber()))
|
||||||
|
) {
|
||||||
|
return error("参数校验失败");
|
||||||
|
}
|
||||||
|
return casePaymentService.selectTotalFee(dto);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据案件id查询缴费单
|
||||||
|
* @param id
|
||||||
|
* @return 统一响应结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/selectPaymentDetail")
|
||||||
|
public AjaxResult selectPaymentDetail(@RequestParam(value = "id",required = true) Long id) {
|
||||||
|
return AjaxResult.success(casePaymentService.selectPaymentDetail(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 案件缴费,线上缴费,支持批量(batchNumber不为空,则为批量缴费)
|
||||||
|
* @param dto 缴费传入参数
|
||||||
|
* @return 统一响应结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/casePay")
|
||||||
|
public AjaxResult casePay(@Validated @RequestBody CasePayDTO dto) {
|
||||||
|
if ((dto.getCaseId() == null && StrUtil.isEmpty(dto.getBatchNumber()))
|
||||||
|
|| StrUtil.isEmpty(dto.getPlatform()) ||StrUtil.isEmpty(dto.getTradeType())
|
||||||
|
) {
|
||||||
|
return error("参数校验失败");
|
||||||
|
}
|
||||||
|
return casePaymentService.casePay(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 申请人/被申请人确认缴费,支持批量(batchNumber不为空,则为批量)
|
||||||
|
* @param dto 缴费传入参数
|
||||||
|
* @return 统一响应结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/confirmPayment")
|
||||||
|
public AjaxResult confirmPayment(@RequestBody CaseConfirmPayDTO dto) {
|
||||||
|
if ((dto.getCaseId() == null && StrUtil.isEmpty(dto.getBatchNumber()))
|
||||||
|
|| StrUtil.isEmpty(dto.getPayType()) || CollectionUtil.isEmpty(dto.getPayOrderList())
|
||||||
|
|| dto.getCaseFlowId() == null) {
|
||||||
|
return error("参数校验失败");
|
||||||
|
}
|
||||||
|
return casePaymentService.confirmPayment(dto);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 财务确认已缴费,支持批量(batchNumber不为空,则为批量)
|
||||||
|
* @param dto 缴费传入参数
|
||||||
|
* @return 统一响应结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/confirmPaid")
|
||||||
|
public AjaxResult confirmPaid(@RequestBody CaseConfirmPayDTO dto) {
|
||||||
|
if ((dto.getCaseId() == null && StrUtil.isEmpty(dto.getBatchNumber()))
|
||||||
|
|| dto.getCaseFlowId() == null) {
|
||||||
|
return error("参数校验失败");
|
||||||
|
}
|
||||||
|
return casePaymentService.confirmPaid(dto);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 财务确认被申请人已缴费,支持批量(batchNumber不为空,则为批量)
|
||||||
|
* @param dto 缴费传入参数
|
||||||
|
* @return 统一响应结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/resConfirmPaid")
|
||||||
|
public AjaxResult resConfirmPaid(@RequestBody CaseConfirmPayDTO dto) {
|
||||||
|
if ((dto.getCaseId() == null && StrUtil.isEmpty(dto.getBatchNumber()))
|
||||||
|
|| dto.getCaseFlowId() == null) {
|
||||||
|
return error("参数校验失败");
|
||||||
|
}
|
||||||
|
dto.setApplicantConfirm(false);
|
||||||
|
return casePaymentService.confirmPaid(dto);
|
||||||
|
}
|
||||||
|
}
|
||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
package com.ruoyi.web.controller.wisdomarbitrate.mscase;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseLogRecord;
|
||||||
|
import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseLogRecordService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
/**
|
||||||
|
* 案件日志控制层
|
||||||
|
* @Author wangqiong
|
||||||
|
* @Date 2024/01/8
|
||||||
|
* @Version V1.0
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/caseLogRecord")
|
||||||
|
public class MsCaseLogRecordController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private MsCaseLogRecordService caseLogRecordService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询案件日志列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('caseLog:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public AjaxResult list(MsCaseLogRecord caseLogRecord)
|
||||||
|
{
|
||||||
|
List<MsCaseLogRecord> list = caseLogRecordService.selectCaseLogRecordList(caseLogRecord);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+143
@@ -0,0 +1,143 @@
|
|||||||
|
package com.ruoyi.web.controller.wisdomarbitrate.mscase;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.exception.EsignDemoException;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.MsSignSealDTO;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseLogRecordVO;
|
||||||
|
import com.ruoyi.wisdomarbitrate.service.mscase.MsSignSealService;
|
||||||
|
import com.ruoyi.wisdomarbitrate.utils.SignVerifyUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mssignSeal")
|
||||||
|
public class MsSignSealController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private MsSignSealService msSignSealService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用印申请
|
||||||
|
*/
|
||||||
|
@PostMapping("/sealApply")
|
||||||
|
public AjaxResult sealApply(@RequestBody MsSignSealDTO dto ) {
|
||||||
|
if ((dto.getCaseId() == null && StrUtil.isEmpty(dto.getBatchNumber()))
|
||||||
|
|| dto.getCaseFlowId() == null) {
|
||||||
|
return error("参数校验失败");
|
||||||
|
}
|
||||||
|
return msSignSealService.sealApply(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用印链接
|
||||||
|
*/
|
||||||
|
@PostMapping("/selectSealUrl")
|
||||||
|
public AjaxResult selectSealUrl(@Validated @RequestBody MsSignSealDTO dto) throws EsignDemoException {
|
||||||
|
SealSignRecord sealUrlRecordselect = msSignSealService.selectSealUrl(dto);
|
||||||
|
return success(sealUrlRecordselect);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 签名用印回调
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@PostMapping("/signSeaalCaseApplicaCallback")
|
||||||
|
public AjaxResult signSeaalCaseApplicaCallback() throws Exception {
|
||||||
|
boolean checkResult= SignVerifyUtils.checkSignuter();
|
||||||
|
if(checkResult){
|
||||||
|
String reqbodystr =SignVerifyUtils.getRequestBody();
|
||||||
|
return msSignSealService.signSeaalCaseApplicaCallback(reqbodystr);
|
||||||
|
}else {
|
||||||
|
return AjaxResult.error("error");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 印章审核回调
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@PostMapping("/sealCheckCallback")
|
||||||
|
public AjaxResult sealCheckCallback() throws Exception {
|
||||||
|
boolean checkResult= SignVerifyUtils.checkSignuter();
|
||||||
|
if(checkResult){
|
||||||
|
String reqbodystr =SignVerifyUtils.getRequestBody();
|
||||||
|
return msSignSealService.sealCheckCallback(reqbodystr);
|
||||||
|
}else {
|
||||||
|
return AjaxResult.error("error");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询案件进度
|
||||||
|
*/
|
||||||
|
@PostMapping("/selectCaseProgress")
|
||||||
|
public AjaxResult selectCaseProgress(@Validated @RequestBody MsSignSealDTO dto) {
|
||||||
|
AjaxResult caseApplicationselect = msSignSealService.selectCaseProgress(dto);
|
||||||
|
return success(caseApplicationselect);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询案件日志
|
||||||
|
*/
|
||||||
|
@PostMapping("/listCaseLogRecord")
|
||||||
|
public AjaxResult list(@Validated @RequestBody MsSignSealDTO dto)
|
||||||
|
{
|
||||||
|
List<MsCaseLogRecordVO> list = msSignSealService.selectCaseLogRecordList(dto);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 归档
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/msCaseFile")
|
||||||
|
public AjaxResult msCaseFile(@RequestBody MsSignSealDTO dto){
|
||||||
|
if(CollectionUtil.isEmpty(dto.getIds())){
|
||||||
|
return error("参数校验失败");
|
||||||
|
}
|
||||||
|
return msSignSealService.msCaseFile(dto.getIds());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 签收
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/msCaseSign")
|
||||||
|
public AjaxResult msCaseSign(@RequestBody MsSignSealDTO dto){
|
||||||
|
if (dto.getCaseId() == null) {
|
||||||
|
return error("参数校验失败");
|
||||||
|
}
|
||||||
|
return msSignSealService.msCaseSign(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PC端申请人签名
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/msCaseSignUrlApplyPC")
|
||||||
|
public AjaxResult msCaseSignUrlApplyPC(@RequestBody MsSignSealDTO dto) throws EsignDemoException {
|
||||||
|
if (dto.getCaseId() == null) {
|
||||||
|
return error("参数校验失败");
|
||||||
|
}
|
||||||
|
return msSignSealService.msCaseSignUrlApplyPC(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+280
@@ -0,0 +1,280 @@
|
|||||||
|
package com.ruoyi.web.controller.wisdomarbitrate.mscase;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.enums.AnnexTypeEnum;
|
||||||
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||||
|
import com.ruoyi.common.utils.file.FileUtils;
|
||||||
|
import com.ruoyi.framework.config.ServerConfig;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsReservedConferenceVO;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.SendRoomNoMessageVO;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.VideoCallBackVO;
|
||||||
|
import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAttachMapper;
|
||||||
|
import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService;
|
||||||
|
import com.ruoyi.wisdomarbitrate.service.mscase.VideoConferenceService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static com.google.common.io.Files.getFileExtension;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视频会议控制层
|
||||||
|
* @Author wangqiong
|
||||||
|
* @Date 2024/01/8
|
||||||
|
* @Version V1.0
|
||||||
|
*/
|
||||||
|
@CrossOrigin(origins = "*")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/video")
|
||||||
|
public class MsVideoConferenceController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private VideoConferenceService videoService;
|
||||||
|
@Autowired
|
||||||
|
private ServerConfig serverConfig;
|
||||||
|
@Autowired
|
||||||
|
private MsCaseAttachMapper msCaseAttachMapper;
|
||||||
|
@Autowired
|
||||||
|
private MsCaseApplicationService caseApplicationService;
|
||||||
|
/**
|
||||||
|
* 根据案件ID查询视频
|
||||||
|
* @param caseId 案件id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/videoList")
|
||||||
|
public AjaxResult videoList(@RequestParam("caseId") Long caseId) {
|
||||||
|
|
||||||
|
return videoService.videoList(caseId);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 通用上传请求(单个)
|
||||||
|
* param officeFlag: 是否上传到onlyoffice,0-否,1-是
|
||||||
|
* param isMediaBook: 是否上调解书,1-是,其余为否
|
||||||
|
*/
|
||||||
|
@PostMapping("/upload")
|
||||||
|
public AjaxResult uploadFile(@RequestParam("file") MultipartFile file, @RequestParam(value = "isMediaBook",required = false) Integer isMediaBook, @RequestParam("annexType") Integer annexType, @RequestParam(value = "officeFlag", required = false) Integer officeFlag,@RequestParam(value = "caseId",required = false) Long caseId) throws Exception
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
// 上传文件路径
|
||||||
|
String filePath = RuoYiConfig.getUploadPath();
|
||||||
|
// 上传并返回新文件名称
|
||||||
|
|
||||||
|
String fileName = FileUploadUtils.upload(filePath, file);
|
||||||
|
String suffix = getFileExtension(fileName);
|
||||||
|
if(StrUtil.isNotEmpty(suffix)&& suffix.contains("doc")){
|
||||||
|
// 上传到onlyoffice
|
||||||
|
officeFlag=1;
|
||||||
|
}
|
||||||
|
String url = serverConfig.getUrl() + fileName;
|
||||||
|
if(officeFlag != null && officeFlag == 1){
|
||||||
|
// officeFlag,fileName为annexPath
|
||||||
|
JSONArray jsonArray = caseApplicationService.uploadOnlyOffice(fileName,caseId);
|
||||||
|
if(jsonArray!=null && jsonArray.size() > 0) {
|
||||||
|
// 先删除之前的附件
|
||||||
|
if(Objects.equals(annexType, AnnexTypeEnum.MEDIATE_BOOK.getCode()) && caseId!=null) {
|
||||||
|
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseId, annexType);
|
||||||
|
}
|
||||||
|
MsCaseAttach caseAttach=null;
|
||||||
|
for (Object obj : jsonArray) {
|
||||||
|
JSONObject jsonObject = (JSONObject) obj;
|
||||||
|
caseAttach = MsCaseAttach.builder()
|
||||||
|
.caseAppliId(caseId)
|
||||||
|
.annexName(jsonObject.get("fileName")!=null?jsonObject.getString("fileName"):"")
|
||||||
|
.annexType(annexType)
|
||||||
|
.onlyOfficeFileId(jsonObject.getString("fileId"))
|
||||||
|
.build();
|
||||||
|
if(jsonObject.get("filePath")!=null){
|
||||||
|
String officePath = jsonObject.getString("filePath");
|
||||||
|
String replace = officePath.replace("/home/ruoyi/uploadPath/", "/profile/");
|
||||||
|
caseAttach.setAnnexPath(replace);
|
||||||
|
|
||||||
|
}
|
||||||
|
caseAttach.setSuffix( (getFileExtension(caseAttach.getAnnexPath())));
|
||||||
|
msCaseAttachMapper.save(caseAttach);
|
||||||
|
}
|
||||||
|
if(caseAttach==null){
|
||||||
|
return AjaxResult.error("上传失败");
|
||||||
|
}
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("annexId", caseAttach.getAnnexId());
|
||||||
|
ajax.put("annexType", annexType);
|
||||||
|
ajax.put("onlyOfficeFileId", caseAttach.getOnlyOfficeFileId());
|
||||||
|
ajax.put("fileName", fileName);
|
||||||
|
ajax.put("newFileName", FileUtils.getName(fileName));
|
||||||
|
ajax.put("originalFilename", file.getOriginalFilename());
|
||||||
|
return ajax;
|
||||||
|
}else {
|
||||||
|
return AjaxResult.error("上传失败");
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
// 如果是调解书并且是pdf,则删除之前的在新增
|
||||||
|
if(isMediaBook != null && isMediaBook == 1 ){
|
||||||
|
if(StrUtil.isNotEmpty(suffix)&&!suffix.equals("pdf")){
|
||||||
|
return AjaxResult.error("请上传pdf格式文件");
|
||||||
|
}
|
||||||
|
annexType=AnnexTypeEnum.MEDIATE_BOOK_PDF.getCode();
|
||||||
|
// 先删除之前的附件
|
||||||
|
if(caseId!=null) {
|
||||||
|
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseId, annexType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Long annexId = saveCaseAttach(annexType, fileName, file.getOriginalFilename(), caseId);
|
||||||
|
// 是否上传到onlyoffice
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("annexId", annexId);
|
||||||
|
ajax.put("annexType", annexType);
|
||||||
|
ajax.put("url", url);
|
||||||
|
ajax.put("fileName", fileName);
|
||||||
|
ajax.put("newFileName", FileUtils.getName(fileName));
|
||||||
|
ajax.put("originalFilename", file.getOriginalFilename());
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return AjaxResult.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private Long saveCaseAttach(Integer annexType, String path, String originalFilename,Long caseId) {
|
||||||
|
MsCaseAttach caseAttach = MsCaseAttach.builder()
|
||||||
|
.annexName(originalFilename)
|
||||||
|
.caseAppliId(caseId)
|
||||||
|
.annexPath(path)
|
||||||
|
.annexType(annexType)
|
||||||
|
.useId(SecurityUtils.getUserId())
|
||||||
|
.useAccount(SecurityUtils.getUsername())
|
||||||
|
.suffix(getFileExtension(path))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
msCaseAttachMapper.save(caseAttach);
|
||||||
|
return caseAttach.getAnnexId();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 从腾讯云下载文件到本地
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@PostMapping("/videoRollBack")
|
||||||
|
public AjaxResult videoRollBack( @RequestBody VideoCallBackVO vo) {
|
||||||
|
if(StrUtil.isNotEmpty(vo.getFileId()) && StrUtil.isNotEmpty(vo.getVideoUrl()) && StrUtil.isNotEmpty(vo.getRoomId())) {
|
||||||
|
videoService.videoRollBack(vo.getFileId(), vo.getVideoUrl(), vo.getRoomId());
|
||||||
|
}
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 腾讯云短信回调
|
||||||
|
* @param body
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@PostMapping("/smsRollBack")
|
||||||
|
public AjaxResult smsRollBack( @RequestBody String body, HttpServletRequest request) {
|
||||||
|
logger.info("短信回调======"+body);
|
||||||
|
videoService.smsRollBack(body,request);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据房间号绑定案件ID
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@PostMapping("/bindCaseId")
|
||||||
|
public AjaxResult bindCaseId(@Valid @RequestBody SendRoomNoMessageVO vo) {
|
||||||
|
|
||||||
|
return videoService.bindCaseId(vo.getId(),vo.getRoomNo());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开启腾讯云录制
|
||||||
|
* @param vo
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@PostMapping("/openCloudRecording")
|
||||||
|
private AjaxResult openCloudRecording( @RequestBody MsReservedConferenceVO vo) {
|
||||||
|
if(vo.getCaseId()==null || vo.getRoomId()==null){
|
||||||
|
return AjaxResult.error("参数错误");
|
||||||
|
}
|
||||||
|
return videoService.openCloudRecording(vo.getCaseId(),vo.getRoomId());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 关闭腾讯云录制
|
||||||
|
* @param taskId 任务ID
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@PostMapping("/closeDeleteCloudRecording")
|
||||||
|
public AjaxResult closeDeleteCloudRecording(@RequestParam("taskId") String taskId){
|
||||||
|
return videoService.closeDeleteCloudRecording(taskId);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 解散房间
|
||||||
|
* @param reservedConferenceVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@PostMapping("/dissolveRoom")
|
||||||
|
public AjaxResult dissolveRoom( @RequestBody MsReservedConferenceVO reservedConferenceVO) {
|
||||||
|
if( reservedConferenceVO.getRoomId()==null){
|
||||||
|
return error("参数校验失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
return videoService.dissolveRoom(reservedConferenceVO.getRoomId());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据userId查询该用户是否是秘书
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@GetMapping("secretaryRoleByUserId")
|
||||||
|
public AjaxResult secretaryRoleByUserId( @RequestParam(value = "userId",required = true) Long userId,@RequestParam(value = "caseId",required = true) Long caseId) {
|
||||||
|
|
||||||
|
return videoService.secretaryRoleByUserId(userId,caseId);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据案件id查询申请人/被申请人会议上传附件按钮权限
|
||||||
|
* @param caseId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@GetMapping("selectRoleMenuByCaseId")
|
||||||
|
public AjaxResult selectRoleMenuByCaseId( @RequestParam(value = "caseId",required = true) Long caseId) {
|
||||||
|
|
||||||
|
return videoService.selectRoleMenuByCaseId(caseId);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据html字符串转pdf并和案件关联
|
||||||
|
* @param reservedConferenceVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@PostMapping("htmlToPDF")
|
||||||
|
public AjaxResult secretaryRoleByUserId( @RequestBody MsReservedConferenceVO reservedConferenceVO) {
|
||||||
|
if( reservedConferenceVO.getCaseId()==null || StrUtil.isEmpty(reservedConferenceVO.getHtmlContent())){
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
return videoService.htmlToPDF(reservedConferenceVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+49
@@ -0,0 +1,49 @@
|
|||||||
|
package com.ruoyi.web.controller.wisdomarbitrate.sendrecord;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SendMailRecord;
|
||||||
|
import com.ruoyi.wisdomarbitrate.service.sendrecord.ISendMailRecordService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/sendMailRecord")
|
||||||
|
public class SendMailRecordController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private ISendMailRecordService sendMailRecordService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询发送邮件记录列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SendMailRecord sendMailRecord) {
|
||||||
|
startPage();
|
||||||
|
List<SendMailRecord> list = sendMailRecordService.selectSendMailRecordList(sendMailRecord);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑邮件记录
|
||||||
|
*/
|
||||||
|
@PostMapping("/update")
|
||||||
|
public AjaxResult update(@RequestBody SendMailRecord sendMailRecord) {
|
||||||
|
return sendMailRecordService.updateSendMailRecord(sendMailRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重新发送邮件记录
|
||||||
|
*/
|
||||||
|
@PostMapping("/reSendMailRecord")
|
||||||
|
public AjaxResult reSendMailRecord(@RequestBody SendMailRecord sendMailRecord) {
|
||||||
|
Boolean aBoolean = sendMailRecordService.reSendMailRecord(sendMailRecord);
|
||||||
|
if (aBoolean) {
|
||||||
|
return AjaxResult.success("发送成功");
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("发送失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+127
@@ -0,0 +1,127 @@
|
|||||||
|
package com.ruoyi.web.controller.wisdomarbitrate.sendrecord;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
|
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.domain.model.LoginUser;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.framework.web.service.TokenService;
|
||||||
|
import com.ruoyi.system.domain.entity.shortmessage.MeetingInfo;
|
||||||
|
import com.ruoyi.system.domain.entity.sms.MsSmsSendRecordParam;
|
||||||
|
import com.ruoyi.system.domain.entity.sms.MsSmsTemplateParam;
|
||||||
|
import com.ruoyi.system.mapper.SysUserMapper;
|
||||||
|
import com.ruoyi.system.mapper.shortmessage.MeetingInfoMapper;
|
||||||
|
import com.ruoyi.system.mapper.sms.MsSmsSendHistoryRecordParamMapper;
|
||||||
|
import com.ruoyi.system.mapper.sms.MsSmsSendRecordParamMapper;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.MeetingInfoVO;
|
||||||
|
import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.ReSendMessageVO;
|
||||||
|
import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SmsRecordMapper;
|
||||||
|
import com.ruoyi.wisdomarbitrate.service.shortmessage.ShortMessageService;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import tk.mybatis.mapper.entity.Example;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/shortMessage")
|
||||||
|
public class ShortMessageController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private SmsRecordMapper smsRecordMapper;
|
||||||
|
@Autowired
|
||||||
|
private ShortMessageService shortMessageService;
|
||||||
|
@Autowired
|
||||||
|
MsSmsSendRecordParamMapper recordParamMapper;
|
||||||
|
@Autowired
|
||||||
|
MsSmsSendHistoryRecordParamMapper historyRecordParamMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询短信发送记录
|
||||||
|
*
|
||||||
|
* @param smsSendRecord
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/recordList")
|
||||||
|
public TableDataInfo smsSendRecordList(SmsSendRecord smsSendRecord) {
|
||||||
|
startPage();
|
||||||
|
List<SmsSendRecord> list = shortMessageService.smsSendRecordList(smsSendRecord);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Anonymous
|
||||||
|
@PostMapping("/updateSendContent")
|
||||||
|
public AjaxResult update(@RequestBody SmsSendRecord smsSendRecord) {
|
||||||
|
if (smsSendRecord == null || smsSendRecord.getId() == null || CollectionUtil.isEmpty(smsSendRecord.getTemplateParams())) {
|
||||||
|
return AjaxResult.error("参数校验失败");
|
||||||
|
}
|
||||||
|
// 查询当前版本记录
|
||||||
|
SmsSendRecord oldSendRecord = smsRecordMapper.selectById(smsSendRecord.getId());
|
||||||
|
smsSendRecord.setUpdateTime(new Date());
|
||||||
|
// 更新短信内容,先删除短信记录参数表
|
||||||
|
Example recordParamExam = new Example(MsSmsSendRecordParam.class);
|
||||||
|
recordParamExam.createCriteria().andEqualTo("smsRecordId", smsSendRecord.getId());
|
||||||
|
recordParamMapper.deleteByExample(recordParamExam);
|
||||||
|
// 新增短信记录参数表
|
||||||
|
List<MsSmsSendRecordParam> recordParams = new ArrayList<>();
|
||||||
|
for (MsSmsTemplateParam templateParam : smsSendRecord.getTemplateParams()) {
|
||||||
|
MsSmsSendRecordParam recordParam = new MsSmsSendRecordParam();
|
||||||
|
recordParam.setSmsRecordId(smsSendRecord.getId());
|
||||||
|
recordParam.setParamValue(templateParam.getParamValue());
|
||||||
|
recordParams.add(recordParam);
|
||||||
|
}
|
||||||
|
recordParamMapper.batchInsert(recordParams);
|
||||||
|
shortMessageService.insertShortMessageHistoryRecord(oldSendRecord, recordParams);
|
||||||
|
return AjaxResult.success();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重新发送短信
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@PostMapping("/reSendShortMessage")
|
||||||
|
public AjaxResult reSendShortMessage(@RequestBody ReSendMessageVO reSendMessageVO) {
|
||||||
|
if (reSendMessageVO != null) {
|
||||||
|
AjaxResult result = shortMessageService.reSendShortMessage(reSendMessageVO);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return AjaxResult.error("参数缺失");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
MeetingInfoMapper meetingInfoMapper;
|
||||||
|
@Autowired
|
||||||
|
SysUserMapper sysUserMapper;
|
||||||
|
@Autowired
|
||||||
|
private TokenService tokenService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询UID好的密钥
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@GetMapping("/getMeetingInfo")
|
||||||
|
public Object getEncryptInfoByUid(@RequestParam(name = "authId", required = true) String authId) {
|
||||||
|
MeetingInfoVO result = new MeetingInfoVO();
|
||||||
|
if (authId != null) {
|
||||||
|
MeetingInfo meetingInfo = meetingInfoMapper.selectByPrimaryKey(authId);
|
||||||
|
if (meetingInfo != null && meetingInfo.getUserId() != null) {
|
||||||
|
BeanUtils.copyProperties(meetingInfo, result);
|
||||||
|
SysUser sysUser = sysUserMapper.selectUserById(meetingInfo.getUserId());
|
||||||
|
LoginUser loginUser = new LoginUser();
|
||||||
|
loginUser.setUserId(sysUser.getUserId());
|
||||||
|
loginUser.setUser(sysUser);
|
||||||
|
String token = tokenService.createVideoToken(loginUser, 120);
|
||||||
|
// String createToken = createToken(claims);
|
||||||
|
result.setToken(token);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return AjaxResult.error("查询失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
+55
@@ -0,0 +1,55 @@
|
|||||||
|
package com.ruoyi.web.controller.wisdomarbitrate.sms;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.system.domain.entity.sms.MsSmsTemplate;
|
||||||
|
import com.ruoyi.wisdomarbitrate.service.sms.SMSTemplateService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信模板控制器
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/smsTemplate")
|
||||||
|
public class SMSTemplateController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private SMSTemplateService templateService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/page")
|
||||||
|
public TableDataInfo page( ){
|
||||||
|
startPage();
|
||||||
|
List<MsSmsTemplate> list = templateService.page();
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增或者修改
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/insert")
|
||||||
|
public AjaxResult insert(@RequestBody MsSmsTemplate template){
|
||||||
|
return templateService.insert(template);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/delete")
|
||||||
|
public AjaxResult delete(@RequestBody MsSmsTemplate template){
|
||||||
|
if(template.getId()==null){
|
||||||
|
return AjaxResult.warn("id不能为空");
|
||||||
|
}
|
||||||
|
return templateService.delete(template.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
package com.ruoyi.web.core.config;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
|
import springfox.documentation.builders.ApiInfoBuilder;
|
||||||
|
import springfox.documentation.builders.PathSelectors;
|
||||||
|
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||||
|
import springfox.documentation.service.ApiInfo;
|
||||||
|
import springfox.documentation.service.ApiKey;
|
||||||
|
import springfox.documentation.service.AuthorizationScope;
|
||||||
|
import springfox.documentation.service.Contact;
|
||||||
|
import springfox.documentation.service.SecurityReference;
|
||||||
|
import springfox.documentation.service.SecurityScheme;
|
||||||
|
import springfox.documentation.spi.DocumentationType;
|
||||||
|
import springfox.documentation.spi.service.contexts.SecurityContext;
|
||||||
|
import springfox.documentation.spring.web.plugins.Docket;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Swagger2的接口配置
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class SwaggerConfig
|
||||||
|
{
|
||||||
|
/** 系统基础配置 */
|
||||||
|
@Autowired
|
||||||
|
private RuoYiConfig ruoyiConfig;
|
||||||
|
|
||||||
|
/** 是否开启swagger */
|
||||||
|
@Value("${swagger.enabled}")
|
||||||
|
private boolean enabled;
|
||||||
|
|
||||||
|
/** 设置请求的统一前缀 */
|
||||||
|
@Value("${swagger.pathMapping}")
|
||||||
|
private String pathMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建API
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public Docket createRestApi()
|
||||||
|
{
|
||||||
|
return new Docket(DocumentationType.OAS_30)
|
||||||
|
// 是否启用Swagger
|
||||||
|
.enable(enabled)
|
||||||
|
// 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
|
||||||
|
.apiInfo(apiInfo())
|
||||||
|
// 设置哪些接口暴露给Swagger展示
|
||||||
|
.select()
|
||||||
|
// 扫描所有有注解的api,用这种方式更灵活
|
||||||
|
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||||
|
// 扫描指定包中的swagger注解
|
||||||
|
// .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
|
||||||
|
// 扫描所有 .apis(RequestHandlerSelectors.any())
|
||||||
|
.paths(PathSelectors.any())
|
||||||
|
.build()
|
||||||
|
/* 设置安全模式,swagger可以设置访问token */
|
||||||
|
.securitySchemes(securitySchemes())
|
||||||
|
.securityContexts(securityContexts())
|
||||||
|
.pathMapping(pathMapping);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全模式,这里指定token通过Authorization头请求头传递
|
||||||
|
*/
|
||||||
|
private List<SecurityScheme> securitySchemes()
|
||||||
|
{
|
||||||
|
List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
|
||||||
|
apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue()));
|
||||||
|
return apiKeyList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全上下文
|
||||||
|
*/
|
||||||
|
private List<SecurityContext> securityContexts()
|
||||||
|
{
|
||||||
|
List<SecurityContext> securityContexts = new ArrayList<>();
|
||||||
|
securityContexts.add(
|
||||||
|
SecurityContext.builder()
|
||||||
|
.securityReferences(defaultAuth())
|
||||||
|
.operationSelector(o -> o.requestMappingPattern().matches("/.*"))
|
||||||
|
.build());
|
||||||
|
return securityContexts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认的安全上引用
|
||||||
|
*/
|
||||||
|
private List<SecurityReference> defaultAuth()
|
||||||
|
{
|
||||||
|
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
|
||||||
|
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
|
||||||
|
authorizationScopes[0] = authorizationScope;
|
||||||
|
List<SecurityReference> securityReferences = new ArrayList<>();
|
||||||
|
securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
|
||||||
|
return securityReferences;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加摘要信息
|
||||||
|
*/
|
||||||
|
private ApiInfo apiInfo()
|
||||||
|
{
|
||||||
|
// 用ApiInfoBuilder进行定制
|
||||||
|
return new ApiInfoBuilder()
|
||||||
|
// 设置标题
|
||||||
|
.title("标题:若依管理系统_接口文档")
|
||||||
|
// 描述
|
||||||
|
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
|
||||||
|
// 作者信息
|
||||||
|
.contact(new Contact(ruoyiConfig.getName(), null, null))
|
||||||
|
// 版本
|
||||||
|
.version("版本号:" + ruoyiConfig.getVersion())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
restart.include.json=/com.alibaba.fastjson.*.jar
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
MIIEuwIBADANBgkqhkiG9w0BAQEFAASCBKUwggShAgEAAoIBAQC12YM9mR+HFQYTx/fHKHZbgszVtDHDB0B/ysWl3MbcPpGtjcZlDr5aynRMRLaoduRHT++A98IaNVIVGj9RHdXrX2j9I/Uz6fYDH63cdu6FZ6Pk82yPwNZW7pebprbVHInR/7gzsKQWSWEST70BgjCRqlbfAE6xzUZFTeYxciCjptm0rUQ2MC24xRdkvZByIDIYFnQ/AdmSFqNtKDR2WpEV/M8aBjyuPPomRJZ1X8oudWuJIU4ySdas04fCbDxD10TY/wyQcDHXuG1IrQpXme4DOGQeJZ0/aOFphBkDFUyPGfYMmLshOPNdBKi2IqWHPPs4XsV4Rv6+tvTSnMF2uGqHAgMBAAECggEAPa1sifPpcZN74DGupGng2uDeQI1BY3iOM8m+h6b9+61tE4RGifgaMAkCsOuNWE4a1uURwphFyUXUdTvVxdlsuMw/e7w6akUsH5sbCO99rtmcCQdXBtrM1+dMnIpK8LUhOYyWGVIMFVMGDYPmAyD5AC7aEAC2sC+DafYl4RdoYpidq1YxeE7DVw1aQHCI2mKhYjZG+3RDDGDfNFvdyH61MgdYjoGkeXNvARzEXgfWvfiTrHZ3H1SYgvOEHofzKDTrWsQL2dvaEsc55Jiw0AgNUVcgby7al8PUekTJoK3ZvrE3pSWaUirBcqsqWISHjeR7Xx501CHIha8EnZwlnDoM4QKBgQDtnYzwQ5mHg7cRHD8Z6QdTpvBvYSEPesiUT/HeI+AKQKDCVJxKiLvJagc6zZkOzV9bZDS/WLgzXWMyxUb+OTjht0jLWAMcf7NfFp3tPKq9wkmQQ/vQSBQ1lFmO6A4Zq1eoGKeUCB4pKBG6cSM+t8+ruhm7s1ZUt+6EBwCVN/izrQKBgQDD62jIm+6NFErdidUaIrGiFUrzqdR13w6JOexfk+O6Aau3wRqsr7Wz4nqQvVVxGMRpXbOH06zpeiS+vMmjwgO973VoLAmH+hJ0GZz8qj3zA2GEOFWjD2V7tqeRvGkQvz0v46pl+8sBJkrRHLN7DWNYY5NDI+b7exwqcTc/LL19gwJ/a6r4MeZvqvgD+7zQ2uy8ZSs/xzg7wsfgG1QeRIn8+qhOL8AnEZ7jeGCS5hJDSHHGw6KkRA/vZ1bpnBfIE2naXGywj3NR9Zfnry6QYO8cbt+adcRYVghTH/QYoKiFuxvonEKPrIQBJqUBY3ngforLjwTEpEie1cSCT1Dc8sBp8QKBgQCaz8fqzRyBKknGKQXVMxj+JKknRUl3IpzP3o9jLu9BqdRQzSwQzH9d91Y2TQXY6mM5hys35xG5JCUo+vCyj7p5OWCiwjl90yMFzr93/+YXwtIpsoIo6R+d1EUxKZoz+4mT7+hT0dUlwWZZOr6wO3IHBBf3c8UvbqZg+zlWmDnblQKBgEs6jwMkb5zaG2fyBJ7PJUN/8nIz8V+X0SxQfcEqIX0J+EC+7MAgFjcdZFp+lca3Vd9z+8Ksd4rMzMa5y856ositL2NZ+K0fs8i8EBaQPny61OgCFUuXEuv5keB2YuGMSns5FYRWuByrtDXl4PxzKXvq05iKWLKCaCq9v4momvKZ
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhUnjdAKwZApwZEcfq+5L0pa77Vg3mqcoXv+th8RR0SYotkPsH1f2JkbS48ySaSCM6YNWSMNfqp5qdOla2zUJOBnJ/yaBg7s7fVD6V3M2mEog8kCDYGKt/3P4VII3xYl8lFYMQ3IcFRELkxCBBCA8JDKmf5z2R4F/Z/jFFEuOwxaJvp+7Ke9OzZHYdWGNnU6QP8YYLYUeX7VNZLHEuly34ExAw6A+yJkNDsYEho2Lu31QjT2pLh9g+88MlRfiI92iN25O9NVdeM4f5RcpvBPrBQZQs9tlFmALYSFS3prIf3FAobWM+W7iwxT6J25nFIhst1DdJQfIBpaeRUJVTkn99QIDAQAB
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
# 数据源配置
|
||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
|
druid:
|
||||||
|
# 主库数据源
|
||||||
|
master:
|
||||||
|
# url: jdbc:mysql://121.40.189.20:3306/mediation_system?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=true&serverTimezone=Asia/Shanghai&useSSL=false
|
||||||
|
url: jdbc:mysql://121.40.189.20:3306/mediation_system_prod?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=true&serverTimezone=Asia/Shanghai&useSSL=false
|
||||||
|
username: root
|
||||||
|
password: YMzc157#
|
||||||
|
# 从库数据源
|
||||||
|
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
|
||||||
@@ -0,0 +1,225 @@
|
|||||||
|
# 项目相关配置
|
||||||
|
ruoyi:
|
||||||
|
# 名称
|
||||||
|
name: RuoYi
|
||||||
|
# 版本
|
||||||
|
version: 3.8.6
|
||||||
|
# 版权年份
|
||||||
|
copyrightYear: 2023
|
||||||
|
# 实例演示开关
|
||||||
|
demoEnabled: true
|
||||||
|
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||||
|
profile: /home/ruoyi/uploadPath
|
||||||
|
# 获取ip地址开关
|
||||||
|
addressEnabled: false
|
||||||
|
# 验证码类型 math 数字计算 char 字符验证
|
||||||
|
captchaType: math
|
||||||
|
|
||||||
|
# 开发环境配置
|
||||||
|
server:
|
||||||
|
# 测试环境6001,开发环境7001
|
||||||
|
port: 7001
|
||||||
|
servlet:
|
||||||
|
# 应用的访问路径
|
||||||
|
context-path: /
|
||||||
|
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
|
||||||
|
org.springframework: warn
|
||||||
|
|
||||||
|
# 用户配置
|
||||||
|
user:
|
||||||
|
password:
|
||||||
|
# 密码最大错误次数
|
||||||
|
maxRetryCount: 5
|
||||||
|
# 密码锁定时间(默认10分钟)
|
||||||
|
lockTime: 10
|
||||||
|
|
||||||
|
# Spring配置
|
||||||
|
spring:
|
||||||
|
# 资源信息
|
||||||
|
messages:
|
||||||
|
# 国际化资源文件路径
|
||||||
|
basename: i18n/messages
|
||||||
|
profiles:
|
||||||
|
active: druid
|
||||||
|
# 文件上传
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
# 单个文件大小
|
||||||
|
max-file-size: 50MB
|
||||||
|
# 设置总上传的文件大小
|
||||||
|
max-request-size: 500MB
|
||||||
|
# 服务模块
|
||||||
|
devtools:
|
||||||
|
restart:
|
||||||
|
# 热部署开关
|
||||||
|
enabled: true
|
||||||
|
# redis 配置
|
||||||
|
redis:
|
||||||
|
# 地址
|
||||||
|
host: 121.40.189.20
|
||||||
|
# 端口,默认为6379
|
||||||
|
port: 6389
|
||||||
|
# TODO 数据库索引,测试环境1,正式环境0
|
||||||
|
database: 0
|
||||||
|
# 密码
|
||||||
|
password:
|
||||||
|
# 连接超时时间
|
||||||
|
timeout: 10s
|
||||||
|
lettuce:
|
||||||
|
pool:
|
||||||
|
# 连接池中的最小空闲连接
|
||||||
|
min-idle: 0
|
||||||
|
# 连接池中的最大空闲连接
|
||||||
|
max-idle: 8
|
||||||
|
# 连接池的最大数据库连接数
|
||||||
|
max-active: 8
|
||||||
|
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||||
|
max-wait: -1ms
|
||||||
|
web:
|
||||||
|
resources:
|
||||||
|
static-locations: file:/home/ruoyi/
|
||||||
|
mail:
|
||||||
|
host: smtp.163.com
|
||||||
|
port: 25
|
||||||
|
username: lmj1549843951@163.com
|
||||||
|
password: JGIOQVFCLAZKXRKO
|
||||||
|
default-encoding: UTF-8
|
||||||
|
properties:
|
||||||
|
mail:
|
||||||
|
smtp:
|
||||||
|
connectiontimeout: 5000
|
||||||
|
timeout: 5000
|
||||||
|
writetimeout: 5000
|
||||||
|
socketFactoryClass: javax.net.ssl.SSLSocketFactory
|
||||||
|
socketFactoryFallback: false
|
||||||
|
socketFactoryPort: 465
|
||||||
|
debug: false
|
||||||
|
protocol: smtp
|
||||||
|
#上上签配置参数
|
||||||
|
ssq:
|
||||||
|
developerId: 1695872832013855470
|
||||||
|
privateKey: MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCiDRuz+dxqkWqHdov0hK+KEWLw/e8MQSqkZZ4c01Yr6cSmQiWyV8Xin0u5S/EA02FWxpjLi1nLriVtOBhZGsoryFmcJrwzSnQ5PORP/HhfcAWFE/Y+3qSQS1OiU7e5wbReCgEUvx4GHZuhdu8cOvq5DG9l33YFZrIEMBTmnf8eKT54STx0tjcKl7U6B6nsiThy3zVtpWXVv6H1HGmxC0KT4EQ388s/PFjrwmk+GFb3EpKCns/GQHf7QrtNz1ZOgCXfgQiQ+91/tcngzUH+zMCIxn5lS+ENAxVI6Ev3W9Y0QHtKwmO4ORVuAskJYzBB2xKI/gw8+PUXNziMAKXuoUAjAgMBAAECggEAd7yHw6vTGUrpE76cGsgPjEzcdoSqpLth7qbG9TWSblAEZXRqtiP0q0ZYhUl/gcSuH5gOPhdw+fZq4RCZrP0GdONMkvxsAtn4lnJPoGpD5wC2k2X0hO+tWJDP8xk4n6BozTNHKTUt0gb+f4eJlapep2xwwy0h30vKLR3504zafEV9j/2D8l5TFSv6rd3UVxUvrDKQ9mhfATEUlrTpjs0SfWupMkr4j7TuJJ8qSUSiEADe4hyUB6+LouDZCt8jV4aLojQBJKrQ6VPVdDFkHGsePu4tHtvcKsaOZJ0pjpJ7MT6D5ElD/sJjo0g/3qK5/FToVFVbrxtykVreK6mE5oSTQQKBgQDpEFSgH1d4N7NsZhviaCIUkB97hO0jpRbD7UZirzZ9ok96Fk+SmfhdmypDMoiaRHCNhQuu5dI9mg5RbUhz9mCZnAhzJRL+DmE4bhNvQmbtJA7KT6n/AdH2zy0mYulrcG17dQspvTr/5421PTEE2+FRoCbG6hBsSSUit9HLvAU13QKBgQCx/7ql+hbx+t0Yb02XckBHiA+MWrFLO4dMX9cKf3LldC0nhn0K9HOSoZmM0KcmXRnMo+/4t89xOJRl7JRXwcLoy/64OaUBVv+8FFV1yY4THka3nEnQE40vVWy+vuNJtt+eKlEhJ35N1GIHXo7/4j0POtEuNU7KSqMnLUD+Oy/t/wKBgEiajcJUASuyLnLWXFlrlzJQs34HKtiv1Se0Avk7G/6HUbr2uFMzI+wFKmVEmMl2CJoNmFYjwhruowc6xBdb6TvxH7C/G+uJD0BFCkjeprG5SeI8bvjB2GbKo4YRyiVuIK0VCSU3jemqeLq9FUguN0L2YR4WTIdvQeJO4UxWhkkBAoGBAJk7TxDHZK1XirIYTzGK928c4FWxVWMwkd7buqGc6epBwwV9r3OY0U1vtGIW1W4fQ7B5iIISqpALZyT/Lw0FDqedxWAOr8+hd3IQBynpI1et/q7d6mUoD6ip332tkrjIp2TfhQwHlaGmreUuL+h0eJ/9wEoJNhTLf/yf5o11omM9AoGBAOLVlXR9FbU2Ubpp3HwTumSzKDWzq3T5eQcqC1zE3BPOo29uAf9BQTumPxe51U64egttW/nif5FH4v4Gentmxb2B2ckdOs/u9zIWz3JPfHU7RqMyMokuWrQ6lMoiSYpH3MSHoavLyAEhAnpceX3oktXgpYHO9d8MfON3XKJl23ip
|
||||||
|
serverHost: https://openapi.bestsign.info/openapi/v2/
|
||||||
|
|
||||||
|
# token配置
|
||||||
|
token:
|
||||||
|
# 令牌自定义标识
|
||||||
|
header: Authorization
|
||||||
|
# 令牌密钥
|
||||||
|
secret: abcdefghijklmnopqrstuvwxyz
|
||||||
|
# 令牌有效期(默认30分钟)
|
||||||
|
expireTime: 120
|
||||||
|
|
||||||
|
# MyBatis配置
|
||||||
|
mybatis:
|
||||||
|
# 搜索指定包别名
|
||||||
|
typeAliasesPackage: com.ruoyi.**.domain
|
||||||
|
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||||
|
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||||
|
# 加载全局的配置文件
|
||||||
|
configLocation: classpath:mybatis/mybatis-config.xml
|
||||||
|
configuration:
|
||||||
|
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
|
# PageHelper分页插件
|
||||||
|
pagehelper:
|
||||||
|
helperDialect: mysql
|
||||||
|
supportMethodsArguments: true
|
||||||
|
params: count=countSql
|
||||||
|
|
||||||
|
# Swagger配置
|
||||||
|
swagger:
|
||||||
|
# 是否开启swagger
|
||||||
|
enabled: true
|
||||||
|
# 请求前缀
|
||||||
|
pathMapping:
|
||||||
|
|
||||||
|
# 防止XSS攻击
|
||||||
|
xss:
|
||||||
|
# 过滤开关
|
||||||
|
enabled: true
|
||||||
|
# 排除链接(多个用逗号分隔)
|
||||||
|
excludes: /system/notice
|
||||||
|
# 匹配链接
|
||||||
|
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||||
|
#支付相关配置
|
||||||
|
elegent:
|
||||||
|
pay:
|
||||||
|
wxpay:
|
||||||
|
mchId: 1561414331
|
||||||
|
appId: wx6592a2db3f85ed25
|
||||||
|
appSecret: d9a9ff00a633cd7353a8925119063b01
|
||||||
|
mchSerialNo: 25FBDE3EFD31B03A4377EB9A4A47C517969E6620
|
||||||
|
apiV3Key: CZBK51236435wxpay435434323FFDuv3
|
||||||
|
alipay:
|
||||||
|
appId: 2021003141676135
|
||||||
|
callback:
|
||||||
|
# TODO
|
||||||
|
domain: http://121.40.189.20:7001/
|
||||||
|
watch: true
|
||||||
|
cycle: 10
|
||||||
|
identityAuthentication:
|
||||||
|
credentialSecretId: AKID3xfHgroY4MQHvLXUXMwIQL1UjmbBX1Tv
|
||||||
|
credentialSecretKey: INDrIXcT8YmomZBcsy0oNirnU0LTN4X7
|
||||||
|
# 小程序端人脸核身商户id
|
||||||
|
merchantId: 0NSJ2309281116194321
|
||||||
|
# pc端人脸核身商户id
|
||||||
|
pcMerchantId: 0NSJ2404231626029804
|
||||||
|
privateKeyHexDecodeinfo: 4c3b311bf7b98969994e85928e069574a1e95777f24d1c510679cc3c2f460faf
|
||||||
|
# 腾讯云即时通信相关配置
|
||||||
|
imConfig:
|
||||||
|
# sdkAppId
|
||||||
|
sdkAppId: 1600011167
|
||||||
|
# 密钥
|
||||||
|
sdkSecretKey: 17d136d9327576a247f991bdfed3a6d14cebc7d540a52245086829c3a1421a86
|
||||||
|
# 腾讯云账户 SecretId
|
||||||
|
secretId: AKID3xfHgroY4MQHvLXUXMwIQL1UjmbBX1Tv
|
||||||
|
# 腾讯云密钥
|
||||||
|
secretKey: INDrIXcT8YmomZBcsy0oNirnU0LTN4X7
|
||||||
|
# TODO 调解机构代码配置
|
||||||
|
organizeConfig:
|
||||||
|
# creditCode
|
||||||
|
creditCode: 910000870060480009
|
||||||
|
# TODO 引入仲裁系统url配置
|
||||||
|
arbitrateConfig:
|
||||||
|
url: http://121.40.189.20:9001/callArbitrateCaseApplication/generateCaseApplication
|
||||||
|
smsURL: http://121.40.189.20:9001/shortMessage/smsCallBack
|
||||||
|
# TODO 回调通知
|
||||||
|
signSealCallbackConfig:
|
||||||
|
url: http://121.40.189.20:7001/mssignSeal/signSeaalCaseApplicaCallback
|
||||||
|
# onlyOffice系统url配置
|
||||||
|
onlyOfficeConfig:
|
||||||
|
# url: http://172.16.0.254:9090/files/upload
|
||||||
|
url: http://121.40.189.20:9090/files/upload
|
||||||
|
# 北明
|
||||||
|
BMConfig:
|
||||||
|
userName: BWT_MEDIATION
|
||||||
|
password: 86251b190e3a40f3942v215d1762c663
|
||||||
|
syncSource: BWT_MEDIATION
|
||||||
|
#jodconverter:
|
||||||
|
# local:
|
||||||
|
# host: 121.40.189.20
|
||||||
|
#暂时关闭预览,启动时会有点慢
|
||||||
|
# enabled: true
|
||||||
|
#设置libreoffice主目录 linux地址如:/usr/lib64/libreoffice
|
||||||
|
# office-home: /usr/lib64/libreoffice/
|
||||||
|
# office-home: D:\app\libreOffice\
|
||||||
|
#开启多个libreoffice进程,每个端口对应一个进程
|
||||||
|
# port-numbers: 8100
|
||||||
|
#libreoffice进程重启前的最大进程数
|
||||||
|
# max-tasks-per-process: 100
|
||||||
|
beimingapihost: https://zj.odrcloud.cn
|
||||||
|
beimingapiprefix: /onestop/sync
|
||||||
|
beimingprivatekey: d7724e72c4be93196a35203e8379ded5
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Application Version: ${ruoyi.version}
|
||||||
|
Spring Boot Version: ${spring-boot.version}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
#错误消息
|
||||||
|
not.null=* 必须填写
|
||||||
|
user.jcaptcha.error=验证码错误
|
||||||
|
user.jcaptcha.expire=验证码已失效
|
||||||
|
user.not.exists=用户不存在/密码错误
|
||||||
|
user.password.not.match=用户不存在/密码错误
|
||||||
|
user.password.retry.limit.count=密码输入错误{0}次
|
||||||
|
user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟
|
||||||
|
user.password.delete=对不起,您的账号已被删除
|
||||||
|
user.blocked=用户已封禁,请联系管理员
|
||||||
|
role.blocked=角色已封禁,请联系管理员
|
||||||
|
login.blocked=很遗憾,访问IP已被列入系统黑名单
|
||||||
|
user.logout.success=退出成功
|
||||||
|
|
||||||
|
length.not.valid=长度必须在{min}到{max}个字符之间
|
||||||
|
|
||||||
|
user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头
|
||||||
|
user.password.not.valid=* 5-50个字符
|
||||||
|
|
||||||
|
user.email.not.valid=邮箱格式错误
|
||||||
|
user.mobile.phone.number.not.valid=手机号格式错误
|
||||||
|
user.login.success=登录成功
|
||||||
|
user.register.success=注册成功
|
||||||
|
user.notfound=请重新登录
|
||||||
|
user.forcelogout=管理员强制退出,请重新登录
|
||||||
|
user.unknown.error=未知错误,请重新登录
|
||||||
|
|
||||||
|
##文件上传消息
|
||||||
|
upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB!
|
||||||
|
upload.filename.exceed.length=上传的文件名最长{0}个字符
|
||||||
|
|
||||||
|
##权限
|
||||||
|
no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
|
||||||
|
no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
|
||||||
|
no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}]
|
||||||
|
no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}]
|
||||||
|
no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}]
|
||||||
|
no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}]
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<!-- 日志存放路径 -->
|
||||||
|
<property name="log.path" value="/home/ruoyi/logs" />
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||||
|
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统日志输出 -->
|
||||||
|
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/sys-info.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>INFO</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/sys-error.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>ERROR</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 用户访问日志输出 -->
|
||||||
|
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/sys-user.log</file>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 按天回滚 daily -->
|
||||||
|
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统模块日志级别控制 -->
|
||||||
|
<logger name="com.ruoyi" level="info" />
|
||||||
|
<!-- Spring日志级别控制 -->
|
||||||
|
<logger name="org.springframework" level="warn" />
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="console" />
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统操作日志-->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="file_info" />
|
||||||
|
<appender-ref ref="file_error" />
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统用户操作日志-->
|
||||||
|
<logger name="sys-user" level="info">
|
||||||
|
<appender-ref ref="sys-user"/>
|
||||||
|
</logger>
|
||||||
|
</configuration>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE configuration
|
||||||
|
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||||
|
<configuration>
|
||||||
|
<!-- 全局参数 -->
|
||||||
|
<settings>
|
||||||
|
<!-- 使全局的映射器启用或禁用缓存 -->
|
||||||
|
<setting name="cacheEnabled" value="true" />
|
||||||
|
<!-- 允许JDBC 支持自动生成主键 -->
|
||||||
|
<setting name="useGeneratedKeys" value="true" />
|
||||||
|
<!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
|
||||||
|
<setting name="defaultExecutorType" value="SIMPLE" />
|
||||||
|
<!-- 指定 MyBatis 所用日志的具体实现 -->
|
||||||
|
<setting name="logImpl" value="SLF4J" />
|
||||||
|
<!-- 使用驼峰命名法转换字段 -->
|
||||||
|
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
|
||||||
|
</settings>
|
||||||
|
|
||||||
|
</configuration>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDBHGgIh80193GhdpD1LtMZfTRpcWI0fImyuBCyrd3gYb3rrsARebGcHdJsQA3mVjVqVp5ybhEZDPa4ecoK4Ye1hTppNpI/lmLt4/uUV/zhF5ahli7hi+116Ty6svHSbuMQBuUZeTFOwGrxjvofU/4pGIwh8ZvkcSnyOp9uX2177UVxDBkhgbZbJp9XF2b83vUa5eHo93CziPzn3hFdAlBCdTXB7DH+m0nN3Jou0szGukvq7cIgGpHku4ycKSTkIhhl9WRhN6OoSEJxq88MXzjkzTruc85PHN52aUTUifwg3T8Y4XqFQ61dTnEmgxeD2O6/pLdB9gLsp6yCGqN5Lqk7AgMBAAECggEBAL4X+WzUSbSjFS9NKNrCMjm4H1zgqTxjj6TnPkC1mGEltjAHwLgzJBw62wWGdGhWWpSIGccpBBm1wjTMZpAZfF66fEpP1t1Ta6UjtGZNyvfFIZmE3jdWZ/WXGBnsxtFQKKKBNwrBW0Fbdqq9BQjLxLitmlxbmwrgPttcy855j6vZqq4MBT1v8CtUT/gz4UWW2xWovVnmWOrRSScv7Nh0pMbRpPLkNHXrBwSSNz/keORzXB9JSm85wlkafa7n5/IJbdTml3A/uAgW3q3JZZQotHxQsYvD4Zb5Cnc9CPAXE5L2Yk877kVXZMGt5QPIVcPMj/72AMtaJT67Y0fN0RYHEGkCgYEA38BIGDY6pePgPbxB7N/l6Df0/OKPP0u8mqR4Q0aQD3VxeGiZUN1uWXEFKsKwlOxLfIFIFk1/6zQeC0xetNTKk0gTL8hpMUTNkE7vI9gFWws2LY6DE86Lm0bdFEIwh6d7Fr7zZtyQKPzMsesC3XV9sdSUExEi5o/VwAyf+xZlOXcCgYEA3PGZYlILjg3esPNkhDz2wxFw432i8l/BCPD8ZtqIV9eguu4fVtFYcUVfawBb0T11RamJkc4eiSOqayC+2ehgb+GyRLJNK4FqbFcsIT+CK0HlscZw51jrMR0MxTc4RzuOIMoYDeZqeGB6/YnNyG4pw2sD8bIwHm8406gtJsX/v10CgYAo8g3/aEUZQHcztPS3fU2cTkkl0ev24Ew2XGypmwsX2R0XtMSBuNPNyFHyvkgEKK2zrhDcC/ihuRraZHJcUyhzBViFgP5HBtk7VEaM36YzP/z9Hzw7bqu7kZ85atdoq6xpwC3Yn/o9le17jY8rqamD1mv2hUdGvAGYsHbCQxnpBwKBgHTkeaMUBzr7yZLS4p435tHje1dQVBJpaKaDYPZFrhbTZR0g+IGlNmaPLmFdCjbUjiPyA2+Znnwt227cHz0IfWUUAo3ny3419QkmwZlBkWuzbIO2mms7lwsf9G6uvV6qepKMeVd5TWEsokVbT/03k27pQmfwPxcK/wS0GFdIL/udAoGAOYdDqY5/aadWCyhzTGI6qXPLvC+fsJBPhK2RXyc+jYV0KmrEv4ewxlK5NksuFsNkyB7wlI1oMCa/xB3T/2vTBALgGFPi8BJqceUjtnTYtI4R2JIVEl08RtEJwyU5JZ2rvWcilsotVZYwfuLZ9KfdhkTrgNxlp/KKkr+UuKce4Vs=
|
||||||
@@ -0,0 +1,295 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>ruoyi</artifactId>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<version>3.8.6</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>ruoyi-common</artifactId>
|
||||||
|
|
||||||
|
|
||||||
|
<description>
|
||||||
|
common通用工具
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!--docx文件下载问题-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
<version>4.1.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- POI依赖,读取.doc型文档-->
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-scratchpad -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-scratchpad</artifactId>
|
||||||
|
<version>4.1.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
<version>2.6</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jodconverter</groupId>
|
||||||
|
<artifactId>jodconverter-core</artifactId>
|
||||||
|
<version>4.2.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jodconverter</groupId>
|
||||||
|
<artifactId>jodconverter-local</artifactId>
|
||||||
|
<version>4.2.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jodconverter</groupId>
|
||||||
|
<artifactId>jodconverter-spring-boot-starter</artifactId>
|
||||||
|
<version>4.2.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.artofsolving</groupId>
|
||||||
|
<artifactId>jodconverter</artifactId>
|
||||||
|
<version>2.2.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openoffice</groupId>
|
||||||
|
<artifactId>jurt</artifactId>
|
||||||
|
<version>3.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openoffice</groupId>
|
||||||
|
<artifactId>ridl</artifactId>
|
||||||
|
<version>3.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openoffice</groupId>
|
||||||
|
<artifactId>juh</artifactId>
|
||||||
|
<version>3.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openoffice</groupId>
|
||||||
|
<artifactId>unoil</artifactId>
|
||||||
|
<version>3.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Spring框架基本的核心工具 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-context-support</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringWeb模块 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- spring security 安全认证 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- pagehelper 分页插件 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 自定义验证注解 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--常用工具类 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- JSON工具类 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 动态数据源 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||||
|
<version>3.5.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 阿里JSON解析器 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.fastjson2</groupId>
|
||||||
|
<artifactId>fastjson2</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- io常用工具类 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- excel工具 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- yml解析器 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.yaml</groupId>
|
||||||
|
<artifactId>snakeyaml</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Token生成与解析-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
<artifactId>jjwt</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Jaxb -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- redis 缓存操作 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- pool 对象池 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-pool2</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 解析客户端操作系统、浏览器等 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>eu.bitwalker</groupId>
|
||||||
|
<artifactId>UserAgentUtils</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- servlet包 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.22</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 腾讯短信sdk -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tencentcloudapi</groupId>
|
||||||
|
<artifactId>tencentcloud-sdk-java</artifactId>
|
||||||
|
<version>3.1.962</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tencentcloudapi</groupId>
|
||||||
|
<artifactId>tencentcloud-sdk-java-faceid</artifactId>
|
||||||
|
<version>3.1.875</version>
|
||||||
|
</dependency>
|
||||||
|
<!--用户信息解密-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>5.7.15</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bouncycastle</groupId>
|
||||||
|
<artifactId>bcprov-jdk15to18</artifactId>
|
||||||
|
<version>1.69</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- poi-tl-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.deepoove</groupId>
|
||||||
|
<artifactId>poi-tl</artifactId>
|
||||||
|
<version>1.9.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.documents4j</groupId>
|
||||||
|
<artifactId>documents4j-local</artifactId>
|
||||||
|
<version>1.0.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.documents4j</groupId>
|
||||||
|
<artifactId>documents4j-transformer-msoffice-word</artifactId>
|
||||||
|
<version>1.0.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.pdfbox</groupId>
|
||||||
|
<artifactId>pdfbox</artifactId>
|
||||||
|
<version>2.0.27</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.itextpdf</groupId>
|
||||||
|
<artifactId>itextpdf</artifactId>
|
||||||
|
<version>5.5.13</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.itextpdf.tool</groupId>
|
||||||
|
<artifactId>xmlworker</artifactId>
|
||||||
|
<version>5.5.13</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 发送邮件-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-mail</artifactId>
|
||||||
|
<version>3.1.4</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.activation</groupId>
|
||||||
|
<artifactId>activation</artifactId>
|
||||||
|
<version>1.1.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/javax.mail/mail -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.mail</groupId>
|
||||||
|
<artifactId>mail</artifactId>
|
||||||
|
<version>1.4.7</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.httpcomponents</groupId>
|
||||||
|
<artifactId>httpclient</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.thymeleaf</groupId>
|
||||||
|
<artifactId>thymeleaf</artifactId>
|
||||||
|
<version>3.0.12.RELEASE</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.ruoyi.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.Documented;
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 匿名访问不鉴权注解
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Target({ ElementType.METHOD, ElementType.TYPE })
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface Anonymous
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.ruoyi.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.Documented;
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限过滤注解
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface DataScope
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 部门表的别名
|
||||||
|
*/
|
||||||
|
public String deptAlias() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户表的别名
|
||||||
|
*/
|
||||||
|
public String userAlias() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@ss获取,多个权限用逗号分隔开来
|
||||||
|
*/
|
||||||
|
public String permission() default "";
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.ruoyi.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.Documented;
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Inherited;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
import com.ruoyi.common.enums.DataSourceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义多数据源切换注解
|
||||||
|
*
|
||||||
|
* 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Target({ ElementType.METHOD, ElementType.TYPE })
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
@Inherited
|
||||||
|
public @interface DataSource
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 切换数据源名称
|
||||||
|
*/
|
||||||
|
public DataSourceType value() default DataSourceType.MASTER;
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.ruoyi.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
/**
|
||||||
|
* 查询时字典转换注解 支持的返回类型:PageRes,List,VO类
|
||||||
|
* @Author wangqiong
|
||||||
|
* @Date 2023/01/5
|
||||||
|
* @Version V1.0
|
||||||
|
*/
|
||||||
|
// 标注这个类它可以标注的位置
|
||||||
|
@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE})
|
||||||
|
// 标注这个注解的注解保留时期
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
// 是否生成注解文档
|
||||||
|
@Documented
|
||||||
|
public @interface DictConvert {
|
||||||
|
//转换字典的目标字段,不填时默认为注解的字段本身
|
||||||
|
String targetField() default "";
|
||||||
|
//是否多选
|
||||||
|
boolean isMultiple() default false;
|
||||||
|
//分隔符 默认为逗号
|
||||||
|
String separator() default ",";
|
||||||
|
// 字典类型
|
||||||
|
String dictType() default "";
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.ruoyi.common.annotation;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ruoyi.common.interfaces.EnumsInterface;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
/**
|
||||||
|
* 枚举转义
|
||||||
|
* @Author wangqiong
|
||||||
|
* @Date 2023/01/5
|
||||||
|
* @Version V1.0
|
||||||
|
*/
|
||||||
|
// 标注这个类它可以标注的位置
|
||||||
|
@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE})
|
||||||
|
// 标注这个注解的注解保留时期
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
// 是否生成注解文档
|
||||||
|
@Documented
|
||||||
|
public @interface EnumsConvert {
|
||||||
|
Class<? extends EnumsInterface> getEnumsInterface();
|
||||||
|
|
||||||
|
//转换字典的目标字段,不填时默认为注解的字段本身
|
||||||
|
String targetField() default "";
|
||||||
|
}
|
||||||
@@ -0,0 +1,187 @@
|
|||||||
|
package com.ruoyi.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||||
|
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelHandlerAdapter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义导出Excel数据注解
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.FIELD)
|
||||||
|
public @interface Excel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 导出时在excel中排序
|
||||||
|
*/
|
||||||
|
public int sort() default Integer.MAX_VALUE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出到Excel中的名字.
|
||||||
|
*/
|
||||||
|
public String name() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期格式, 如: yyyy-MM-dd
|
||||||
|
*/
|
||||||
|
public String dateFormat() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 如果是字典类型,请设置字典的type值 (如: sys_user_sex)
|
||||||
|
*/
|
||||||
|
public String dictType() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读取内容转表达式 (如: 0=男,1=女,2=未知)
|
||||||
|
*/
|
||||||
|
public String readConverterExp() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分隔符,读取字符串组内容
|
||||||
|
*/
|
||||||
|
public String separator() default ",";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
|
||||||
|
*/
|
||||||
|
public int scale() default -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
|
||||||
|
*/
|
||||||
|
public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出时在excel中每个列的高度
|
||||||
|
*/
|
||||||
|
public double height() default 14;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出时在excel中每个列的宽度
|
||||||
|
*/
|
||||||
|
public double width() default 16;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文字后缀,如% 90 变成90%
|
||||||
|
*/
|
||||||
|
public String suffix() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当值为空时,字段的默认值
|
||||||
|
*/
|
||||||
|
public String defaultValue() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提示信息
|
||||||
|
*/
|
||||||
|
public String prompt() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置只能选择不能输入的列内容.
|
||||||
|
*/
|
||||||
|
public String[] combo() default {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否需要纵向合并单元格,应对需求:含有list集合单元格)
|
||||||
|
*/
|
||||||
|
public boolean needMerge() default false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
|
||||||
|
*/
|
||||||
|
public boolean isExport() default true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 另一个类中的属性名称,支持多级获取,以小数点隔开
|
||||||
|
*/
|
||||||
|
public String targetAttr() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否自动统计数据,在最后追加一行统计数据总和
|
||||||
|
*/
|
||||||
|
public boolean isStatistics() default false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出类型(0数字 1字符串 2图片)
|
||||||
|
*/
|
||||||
|
public ColumnType cellType() default ColumnType.STRING;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出列头背景颜色
|
||||||
|
*/
|
||||||
|
public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出列头字体颜色
|
||||||
|
*/
|
||||||
|
public IndexedColors headerColor() default IndexedColors.WHITE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出单元格背景颜色
|
||||||
|
*/
|
||||||
|
public IndexedColors backgroundColor() default IndexedColors.WHITE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出单元格字体颜色
|
||||||
|
*/
|
||||||
|
public IndexedColors color() default IndexedColors.BLACK;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出字段对齐方式
|
||||||
|
*/
|
||||||
|
public HorizontalAlignment align() default HorizontalAlignment.CENTER;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义数据处理器
|
||||||
|
*/
|
||||||
|
public Class<?> handler() default ExcelHandlerAdapter.class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义数据处理器参数
|
||||||
|
*/
|
||||||
|
public String[] args() default {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
|
||||||
|
*/
|
||||||
|
Type type() default Type.ALL;
|
||||||
|
|
||||||
|
public enum Type
|
||||||
|
{
|
||||||
|
ALL(0), EXPORT(1), IMPORT(2);
|
||||||
|
private final int value;
|
||||||
|
|
||||||
|
Type(int value)
|
||||||
|
{
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int value()
|
||||||
|
{
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum ColumnType
|
||||||
|
{
|
||||||
|
NUMERIC(0), STRING(1), IMAGE(2);
|
||||||
|
private final int value;
|
||||||
|
|
||||||
|
ColumnType(int value)
|
||||||
|
{
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int value()
|
||||||
|
{
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.ruoyi.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Excel注解集
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Target(ElementType.FIELD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface Excels
|
||||||
|
{
|
||||||
|
public Excel[] value();
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package com.ruoyi.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.Documented;
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.enums.OperatorType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义操作日志记录注解
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Target({ ElementType.PARAMETER, ElementType.METHOD })
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface Log
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 模块
|
||||||
|
*/
|
||||||
|
public String title() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能
|
||||||
|
*/
|
||||||
|
public BusinessType businessType() default BusinessType.OTHER;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人类别
|
||||||
|
*/
|
||||||
|
public OperatorType operatorType() default OperatorType.MANAGE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否保存请求的参数
|
||||||
|
*/
|
||||||
|
public boolean isSaveRequestData() default true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否保存响应的参数
|
||||||
|
*/
|
||||||
|
public boolean isSaveResponseData() default true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排除指定的请求参数
|
||||||
|
*/
|
||||||
|
public String[] excludeParamNames() default {};
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user