Bladeren bron

调解系统初始化版本

gy b 2 jaren geleden
bovenliggende
commit
04b4df2964
100 gewijzigde bestanden met toevoegingen van 8593 en 0 verwijderingen
  1. 47
    0
      .gitignore
  2. 20
    0
      LICENSE
  3. 59
    0
      pay/pom.xml
  4. 32
    0
      pay/src/main/java/com/ruoyi/CallBackService.java
  5. 66
    0
      pay/src/main/java/com/ruoyi/ElegentPay.java
  6. 40
    0
      pay/src/main/java/com/ruoyi/ali/AlipayConfig.java
  7. 30
    0
      pay/src/main/java/com/ruoyi/ali/AlipayConstant.java
  8. 461
    0
      pay/src/main/java/com/ruoyi/ali/AlipayElegentTrade.java
  9. 124
    0
      pay/src/main/java/com/ruoyi/ali/AlipayElegentValid.java
  10. 20
    0
      pay/src/main/java/com/ruoyi/annotation/TradePlatform.java
  11. 23
    0
      pay/src/main/java/com/ruoyi/config/CallbackConfig.java
  12. 11
    0
      pay/src/main/java/com/ruoyi/constant/PayConstant.java
  13. 16
    0
      pay/src/main/java/com/ruoyi/constant/Platform.java
  14. 33
    0
      pay/src/main/java/com/ruoyi/constant/TradeType.java
  15. 35
    0
      pay/src/main/java/com/ruoyi/core/CallBackServiceImpl.java
  16. 90
    0
      pay/src/main/java/com/ruoyi/core/CallbackController.java
  17. 73
    0
      pay/src/main/java/com/ruoyi/core/CallbackWatch.java
  18. 27
    0
      pay/src/main/java/com/ruoyi/core/ElegentConfig.java
  19. 82
    0
      pay/src/main/java/com/ruoyi/core/ElegentLoader.java
  20. 136
    0
      pay/src/main/java/com/ruoyi/core/ElegentPayImpl.java
  21. 54
    0
      pay/src/main/java/com/ruoyi/core/ElegentTrade.java
  22. 48
    0
      pay/src/main/java/com/ruoyi/core/ElegentValid.java
  23. 20
    0
      pay/src/main/java/com/ruoyi/core/WatchList.java
  24. 20
    0
      pay/src/main/java/com/ruoyi/dto/PayRequest.java
  25. 29
    0
      pay/src/main/java/com/ruoyi/dto/PayResponse.java
  26. 24
    0
      pay/src/main/java/com/ruoyi/dto/QueryRefundResponse.java
  27. 25
    0
      pay/src/main/java/com/ruoyi/dto/QueryResponse.java
  28. 16
    0
      pay/src/main/java/com/ruoyi/dto/RefundRequest.java
  29. 15
    0
      pay/src/main/java/com/ruoyi/dto/ValidResponse.java
  30. 12
    0
      pay/src/main/java/com/ruoyi/dto/WatchDTO.java
  31. 24
    0
      pay/src/main/java/com/ruoyi/exceptions/TradeException.java
  32. 16
    0
      pay/src/main/java/com/ruoyi/key/KeyManager.java
  33. 19
    0
      pay/src/main/java/com/ruoyi/key/impl/DefaultKeyManager.java
  34. 37
    0
      pay/src/main/java/com/ruoyi/util/FileUtil.java
  35. 459
    0
      pay/src/main/java/com/ruoyi/wx/WxPayElegentTrade.java
  36. 153
    0
      pay/src/main/java/com/ruoyi/wx/WxPayElegentValid.java
  37. 20
    0
      pay/src/main/java/com/ruoyi/wx/WxpayConfig.java
  38. 48
    0
      pay/src/main/java/com/ruoyi/wx/WxpayConstant.java
  39. 14
    0
      pay/src/main/resources/META-INF/spring.factories
  40. 231
    0
      pom.xml
  41. 100
    0
      ruoyi-admin/pom.xml
  42. 32
    0
      ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
  43. 18
    0
      ruoyi-admin/src/main/java/com/ruoyi/RuoYiServletInitializer.java
  44. 33
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/bestsign/ArbitrSignatuController.java
  45. 31
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/bestsign/RegisterController.java
  46. 94
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java
  47. 163
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
  48. 120
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java
  49. 27
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java
  50. 82
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java
  51. 69
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java
  52. 83
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java
  53. 133
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java
  54. 132
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java
  55. 121
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java
  56. 131
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java
  57. 29
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java
  58. 100
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
  59. 142
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java
  60. 91
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java
  61. 129
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java
  62. 136
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java
  63. 38
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java
  64. 262
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
  65. 258
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
  66. 183
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java
  67. 191
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java
  68. 44
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/ArbitratorController.java
  69. 588
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java
  70. 107
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationLogController.java
  71. 47
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseArbitrateController.java
  72. 160
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java
  73. 40
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseLogRecordController.java
  74. 74
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseNumRuleController.java
  75. 110
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CasePaymentController.java
  76. 237
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java
  77. 43
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/IdentityAuthenticationController.java
  78. 48
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/SendMailRecordController.java
  79. 59
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/TemplateController.java
  80. 149
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/VideoController.java
  81. 62
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/WeChatUserController.java
  82. 125
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java
  83. 1
    0
      ruoyi-admin/src/main/resources/META-INF/spring-devtools.properties
  84. 1
    0
      ruoyi-admin/src/main/resources/alipay_private.key
  85. 1
    0
      ruoyi-admin/src/main/resources/alipay_public.key
  86. 61
    0
      ruoyi-admin/src/main/resources/application-druid.yml
  87. 197
    0
      ruoyi-admin/src/main/resources/application.yml
  88. 24
    0
      ruoyi-admin/src/main/resources/banner.txt
  89. 38
    0
      ruoyi-admin/src/main/resources/i18n/messages.properties
  90. 93
    0
      ruoyi-admin/src/main/resources/logback.xml
  91. 20
    0
      ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml
  92. 1
    0
      ruoyi-admin/src/main/resources/wxpay_private.key
  93. 290
    0
      ruoyi-common/pom.xml
  94. 19
    0
      ruoyi-common/src/main/java/com/ruoyi/common/annotation/Anonymous.java
  95. 33
    0
      ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java
  96. 28
    0
      ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataSource.java
  97. 187
    0
      ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java
  98. 18
    0
      ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excels.java
  99. 51
    0
      ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java
  100. 0
    0
      ruoyi-common/src/main/java/com/ruoyi/common/annotation/RateLimiter.java

+ 47
- 0
.gitignore Bestand weergeven

@@ -0,0 +1,47 @@
1
+######################################################################
2
+# Build Tools
3
+
4
+.gradle
5
+/build/
6
+!gradle/wrapper/gradle-wrapper.jar
7
+
8
+target/
9
+!.mvn/wrapper/maven-wrapper.jar
10
+
11
+######################################################################
12
+# IDE
13
+
14
+### STS ###
15
+.apt_generated
16
+.classpath
17
+.factorypath
18
+.project
19
+.settings
20
+.springBeans
21
+
22
+### IntelliJ IDEA ###
23
+.idea
24
+*.iws
25
+*.iml
26
+*.ipr
27
+
28
+### JRebel ###
29
+rebel.xml
30
+
31
+### NetBeans ###
32
+nbproject/private/
33
+build/*
34
+nbbuild/
35
+dist/
36
+nbdist/
37
+.nb-gradle/
38
+
39
+######################################################################
40
+# Others
41
+*.log
42
+*.xml.versionsBackup
43
+*.swp
44
+
45
+!*/build/*.java
46
+!*/build/*.html
47
+!*/build/*.xml

+ 20
- 0
LICENSE Bestand weergeven

@@ -0,0 +1,20 @@
1
+The MIT License (MIT)
2
+
3
+Copyright (c) 2018 RuoYi
4
+
5
+Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+this software and associated documentation files (the "Software"), to deal in
7
+the Software without restriction, including without limitation the rights to
8
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+the Software, and to permit persons to whom the Software is furnished to do so,
10
+subject to the following conditions:
11
+
12
+The above copyright notice and this permission notice shall be included in all
13
+copies or substantial portions of the Software.
14
+
15
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 59
- 0
pay/pom.xml Bestand weergeven

@@ -0,0 +1,59 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project xmlns="http://maven.apache.org/POM/4.0.0"
3
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
+    <parent>
6
+        <artifactId>ruoyi</artifactId>
7
+        <groupId>com.ruoyi</groupId>
8
+        <version>3.8.6</version>
9
+    </parent>
10
+    <modelVersion>4.0.0</modelVersion>
11
+    <artifactId>pay</artifactId>
12
+    <version>1.0.0-SNAPSHOT</version>
13
+
14
+    <properties>
15
+        <maven.compiler.source>8</maven.compiler.source>
16
+        <maven.compiler.target>8</maven.compiler.target>
17
+    </properties>
18
+
19
+    <dependencies>
20
+        <dependency>
21
+            <groupId>org.springframework.boot</groupId>
22
+            <artifactId>spring-boot-starter-web</artifactId>
23
+        </dependency>
24
+        <dependency>
25
+            <groupId>org.springframework.boot</groupId>
26
+            <artifactId>spring-boot-autoconfigure</artifactId>
27
+            <version>2.7.10</version>
28
+            <optional>true</optional>
29
+        </dependency>
30
+
31
+        <dependency>
32
+            <groupId>org.projectlombok</groupId>
33
+            <artifactId>lombok</artifactId>
34
+            <version>1.18.22</version>
35
+        </dependency>
36
+        <dependency>
37
+            <groupId>com.alibaba</groupId>
38
+            <artifactId>fastjson</artifactId>
39
+            <version>1.2.72</version>
40
+        </dependency>
41
+        <dependency>
42
+            <groupId>cn.hutool</groupId>
43
+            <artifactId>hutool-all</artifactId>
44
+            <version>5.7.12</version>
45
+        </dependency>
46
+        <dependency>
47
+            <groupId>com.github.wechatpay-apiv3</groupId>
48
+            <artifactId>wechatpay-apache-httpclient</artifactId>
49
+            <version>0.4.7</version>
50
+        </dependency>
51
+        <dependency>
52
+            <groupId>com.alipay.sdk</groupId>
53
+            <artifactId>alipay-sdk-java</artifactId>
54
+            <version>4.34.8.ALL</version>
55
+        </dependency>
56
+    </dependencies>
57
+
58
+
59
+</project>

+ 32
- 0
pay/src/main/java/com/ruoyi/CallBackService.java Bestand weergeven

@@ -0,0 +1,32 @@
1
+package com.ruoyi;
2
+
3
+/**
4
+ * 业务回调处理接口
5
+ */
6
+public interface CallBackService {
7
+
8
+    /**
9
+     * 成功支付--处理业务逻辑
10
+     * @param orderSn 订单号
11
+     */
12
+    void successPay(String orderSn);
13
+
14
+    /**
15
+     * 失败支付-处理业务逻辑
16
+     * @param orderSn 订单号
17
+     */
18
+    void failPay(String orderSn);
19
+
20
+    /**
21
+     * 退款成功-处理业务逻辑
22
+     * @param orderSn 订单号
23
+     */
24
+    void successRefund(String orderSn);
25
+
26
+    /**
27
+     * 退款失败-处理业务逻辑
28
+     * @param orderSn 订单号
29
+     */
30
+    void failRefund(String orderSn);
31
+
32
+}

+ 66
- 0
pay/src/main/java/com/ruoyi/ElegentPay.java Bestand weergeven

@@ -0,0 +1,66 @@
1
+package com.ruoyi;
2
+
3
+
4
+import com.ruoyi.dto.*;
5
+import com.ruoyi.exceptions.TradeException;
6
+
7
+public interface ElegentPay {
8
+
9
+
10
+    /**
11
+     * 统一下单接口
12
+     * @param payRequest 支付请求
13
+     * @param tradeType 交易类型
14
+     * @param platform 平台
15
+     * @return 支付响应
16
+     * @throws TradeException
17
+     */
18
+    PayResponse requestPay(PayRequest payRequest, String tradeType, String platform) throws TradeException;
19
+
20
+
21
+    /**
22
+     * 关闭订单
23
+     * @param orderSn 订单号
24
+     * @param platform 平台
25
+     * @return 是否成功关闭订单
26
+     * @throws TradeException
27
+     */
28
+    Boolean closePay(String orderSn, String platform) throws TradeException;
29
+
30
+    /**
31
+     * 退款
32
+     * @param refundRequest 退款请求封装对象
33
+     * @param platform 平台
34
+     * @return 是否成功退款
35
+     * @throws TradeException
36
+     */
37
+    Boolean refund(RefundRequest refundRequest, String platform) throws TradeException;
38
+
39
+    /**
40
+     * 根据订单号查询订单
41
+     * @param orderSn 订单号
42
+     * @param platform 平台
43
+     * @return 查询响应对象
44
+     * @throws TradeException
45
+     */
46
+    QueryResponse queryTradingOrderNo(String orderSn , String platform) throws TradeException;
47
+
48
+
49
+    /**
50
+     * 查询单笔退款API
51
+     * @param orderSn 订单号
52
+     * @param platform 平台
53
+     * @return 查询退款响应对象
54
+     * @throws TradeException
55
+     */
56
+    QueryRefundResponse queryRefundTrading(String orderSn , String platform) throws TradeException;
57
+
58
+
59
+    /**
60
+     * 获得openID
61
+     * @param code
62
+     * @return
63
+     */
64
+    public String getOpenid(String code, String platform);
65
+
66
+}

+ 40
- 0
pay/src/main/java/com/ruoyi/ali/AlipayConfig.java Bestand weergeven

@@ -0,0 +1,40 @@
1
+package com.ruoyi.ali;
2
+
3
+import com.ruoyi.key.KeyManager;
4
+import lombok.Data;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.beans.factory.annotation.Value;
7
+import org.springframework.boot.context.properties.ConfigurationProperties;
8
+import org.springframework.stereotype.Component;
9
+
10
+/**
11
+ * 支付宝权限对接类
12
+ */
13
+@Component
14
+@ConfigurationProperties("elegent.pay.alipay")
15
+@Data
16
+public class AlipayConfig {
17
+    /**
18
+     * 应用识别码
19
+     */
20
+    private String appId;
21
+
22
+    /**
23
+     * 密钥加密方式 RSA2
24
+     */
25
+    @Value("${elegent.pay.alipay.charset:RSA2}")
26
+    private String signType;
27
+
28
+    @Autowired
29
+    private KeyManager keyManager;
30
+
31
+    public String getPrivateKey(){
32
+        return keyManager.getKey("alipay_private.key");
33
+    }
34
+
35
+    public String getPublicKey(){
36
+        return keyManager.getKey("alipay_public.key");
37
+    }
38
+
39
+
40
+}

+ 30
- 0
pay/src/main/java/com/ruoyi/ali/AlipayConstant.java Bestand weergeven

@@ -0,0 +1,30 @@
1
+package com.ruoyi.ali;
2
+
3
+import java.util.HashMap;
4
+import java.util.Map;
5
+
6
+/**
7
+ * ZFBConstant
8
+ * @description 支付宝相关的常量
9
+*/
10
+public class AlipayConstant {
11
+
12
+    public static final String SUCCESS = "SUCCESS";
13
+
14
+    public static final String  FAIL  = "FAIL";
15
+
16
+    /**
17
+     * 交易状态(用于转换)
18
+     */
19
+    public static final Map<String,String> TRADE_STATE = new HashMap<String,String>(){
20
+        {
21
+            put("TRADE_SUCCESS", "SUCCESS");
22
+            put("WAIT_BUYER_PAY", "NOTPAY");
23
+            put("TRADE_CLOSED", "CLOSED");
24
+            put("TRADE_FINISHED", "FINISHED");
25
+        }
26
+    };
27
+
28
+    public static final String domain="https://openapi.alipay.com/gateway.do";
29
+
30
+}

+ 461
- 0
pay/src/main/java/com/ruoyi/ali/AlipayElegentTrade.java Bestand weergeven

@@ -0,0 +1,461 @@
1
+package com.ruoyi.ali;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.alibaba.fastjson.JSONObject;
5
+import com.alipay.api.AlipayApiException;
6
+import com.alipay.api.AlipayClient;
7
+import com.alipay.api.DefaultAlipayClient;
8
+import com.alipay.api.request.*;
9
+import com.alipay.api.response.*;
10
+import com.ruoyi.CallBackService;
11
+import com.ruoyi.annotation.TradePlatform;
12
+import com.ruoyi.config.CallbackConfig;
13
+import com.ruoyi.constant.PayConstant;
14
+import com.ruoyi.constant.Platform;
15
+import com.ruoyi.constant.TradeType;
16
+import com.ruoyi.core.ElegentTrade;
17
+import com.ruoyi.dto.*;
18
+import com.ruoyi.exceptions.TradeException;
19
+import lombok.extern.slf4j.Slf4j;
20
+import org.springframework.beans.factory.annotation.Autowired;
21
+import org.springframework.stereotype.Service;
22
+
23
+import java.math.BigDecimal;
24
+import java.util.Map;
25
+
26
+/**
27
+ * 支付宝支付的策略类
28
+ * @author wgl
29
+ */
30
+@Service
31
+@TradePlatform(Platform.ALI)
32
+@Slf4j
33
+public class AlipayElegentTrade implements ElegentTrade {
34
+
35
+    @Autowired
36
+    private AlipayConfig alipayConfig;
37
+
38
+    @Autowired
39
+    private CallbackConfig callbackConfig;
40
+
41
+    @Autowired
42
+    private CallBackService callBackService;
43
+
44
+
45
+    /**
46
+     * 获取回调地址
47
+     * @return
48
+     */
49
+    private String getPayNotifyUrl(){
50
+        return callbackConfig.getDomain()+ PayConstant.CALLBACK_PATH+ PayConstant.NOTIFY +"/"+ Platform.ALI;
51
+    }
52
+
53
+    /**
54
+     * 获取退款回调
55
+     * @return
56
+     */
57
+    private String getRefundNotifyUrl(){
58
+        return callbackConfig.getDomain()+ PayConstant.CALLBACK_PATH+ PayConstant.REFUND_NOTIFY +"/"+ Platform.ALI;
59
+    }
60
+
61
+
62
+
63
+    /**
64
+     * 创建支付订单
65
+      * @param payRequest
66
+     * @return
67
+     * @throws TradeException
68
+     */
69
+    @Override
70
+    public PayResponse requestPay(PayRequest payRequest, String tradeType) throws TradeException {
71
+        if(TradeType.NATIVE.equals( tradeType )){
72
+            return createNativeOrder(payRequest);
73
+        }
74
+        if(TradeType.JSAPI.equals( tradeType )){
75
+            return createJsApiOrder(payRequest);
76
+        }
77
+        if(TradeType.H5.equals( tradeType )){
78
+            return createH5Order(payRequest);
79
+        }
80
+        if(TradeType.APP.equals( tradeType )){
81
+            return createAPPOrder(payRequest);
82
+        }
83
+        return createNativeOrder(payRequest);
84
+    }
85
+
86
+
87
+    /**
88
+     * 本地支付(扫码)
89
+     * https://opendocs.alipay.com/open/194/106078?ref=api#预下单
90
+     * @param payRequest
91
+     * @return
92
+     * @throws TradeException
93
+     */
94
+    private PayResponse createNativeOrder(PayRequest payRequest) throws TradeException {
95
+        try {
96
+            AlipayClient alipayClient = getAliHttpClient();
97
+            AlipayTradePrecreateRequest request = new AlipayTradePrecreateRequest();
98
+
99
+            request.setNotifyUrl(getPayNotifyUrl());
100
+
101
+            JSONObject bizContent = new JSONObject();
102
+            bizContent.put("out_trade_no", payRequest.getOrderSn());
103
+            //转换
104
+            //String totalFee= BigDecimal.valueOf(payRequest.getTotalFee()).divide(new BigDecimal(100)  ).toString();
105
+            bizContent.put("total_amount", fenToYuan(payRequest.getTotalFee()));
106
+            bizContent.put("subject", payRequest.getBody());
107
+            request.setBizContent(bizContent.toString());
108
+            AlipayTradePrecreateResponse response = alipayClient.execute(request);
109
+
110
+            if (response.isSuccess()) {
111
+                PayResponse payResponse =new PayResponse();
112
+                payResponse.setSuccess(true);
113
+                payResponse.setCode_url(response.getQrCode()); //本地支付二维码
114
+                payResponse.setOrder_sn(payRequest.getOrderSn());
115
+                return payResponse;
116
+            } else {
117
+                log.error("调用失败");
118
+                return null;
119
+            }
120
+        }catch (Exception e){
121
+            e.printStackTrace();
122
+            throw new TradeException("订单创建失败,订单号:"+ payRequest.getOrderSn());
123
+        }
124
+    }
125
+
126
+
127
+    /**
128
+     * 小程序
129
+     * https://opendocs.alipay.com/mini/03l5wn
130
+     * @param payRequest
131
+     * @return
132
+     * @throws TradeException
133
+     */
134
+    private PayResponse createJsApiOrder(PayRequest payRequest) throws TradeException {
135
+        AlipayClient alipayClient = getAliHttpClient();
136
+        try {
137
+            AlipayTradeCreateRequest request = new AlipayTradeCreateRequest();
138
+            request.setNotifyUrl(getPayNotifyUrl());
139
+            JSONObject bizContent = new JSONObject();
140
+            bizContent.put("out_trade_no", payRequest.getOrderSn());
141
+            bizContent.put("total_amount", fenToYuan( payRequest.getTotalFee() ));
142
+            bizContent.put("subject", payRequest.getBody());
143
+            bizContent.put("buyer_id", payRequest.getOpenid());
144
+            bizContent.put("timeout_express", "10m");
145
+            request.setBizContent(bizContent.toString());
146
+            AlipayTradeCreateResponse response = alipayClient.sdkExecute(request);
147
+            if (response.isSuccess()) {
148
+                PayResponse payResponse =new PayResponse();
149
+                payResponse.setSuccess(true);
150
+                payResponse.setPrepay_id(response.getTradeNo());
151
+                payResponse.setOrder_sn(response.getOutTradeNo());
152
+                return payResponse;
153
+            } else {
154
+                log.error("调用失败");
155
+                return null;
156
+            }
157
+        }catch (Exception e){
158
+            throw new TradeException("订单创建失败,订单号:"+ payRequest.getOrderSn());
159
+        }
160
+    }
161
+
162
+
163
+    /**
164
+     * H5
165
+     * https://opendocs.alipay.com/mini/03l5wn
166
+     * @param payRequest
167
+     * @return
168
+     * @throws TradeException
169
+     */
170
+    private PayResponse createH5Order(PayRequest payRequest) throws TradeException {
171
+        AlipayClient alipayClient = getAliHttpClient();
172
+        try {
173
+            AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest();
174
+            request.setNotifyUrl(getPayNotifyUrl());
175
+            request.setReturnUrl("");
176
+            JSONObject bizContent = new JSONObject();
177
+            bizContent.put("out_trade_no", payRequest.getOrderSn());
178
+            bizContent.put("total_amount", fenToYuan( payRequest.getTotalFee() ));
179
+            bizContent.put("subject", payRequest.getBody());
180
+            bizContent.put("product_code", "QUICK_WAP_WAY");
181
+
182
+            request.setBizContent(bizContent.toString());
183
+            AlipayTradeWapPayResponse response = alipayClient.pageExecute(request);
184
+            if (response.isSuccess()) {
185
+                PayResponse payResponse =new PayResponse();
186
+                payResponse.setSuccess(true);
187
+                payResponse.setPrepay_id(response.getTradeNo());
188
+                payResponse.setOrder_sn(response.getOutTradeNo());
189
+                return payResponse;
190
+            } else {
191
+                log.error("调用失败");
192
+                return null;
193
+            }
194
+        }catch (Exception e){
195
+            throw new TradeException("订单创建失败,订单号:"+ payRequest.getOrderSn());
196
+        }
197
+    }
198
+
199
+
200
+    /**
201
+     * APP
202
+     * https://opendocs.alipay.com/open/02e7gq?ref=api&scene=20
203
+     * @param payRequest
204
+     * @return
205
+     * @throws TradeException
206
+     */
207
+    private PayResponse createAPPOrder(PayRequest payRequest) throws TradeException {
208
+        AlipayClient alipayClient = getAliHttpClient();
209
+        try {
210
+            AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
211
+            request.setNotifyUrl(getPayNotifyUrl());
212
+            JSONObject bizContent = new JSONObject();
213
+            bizContent.put("out_trade_no", payRequest.getOrderSn());
214
+            bizContent.put("total_amount", fenToYuan( payRequest.getTotalFee() ));
215
+            bizContent.put("subject", payRequest.getBody());
216
+            bizContent.put("product_code", "QUICK_MSECURITY_PAY");
217
+
218
+            request.setBizContent(bizContent.toString());
219
+            AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request);
220
+            if (response.isSuccess()) {
221
+                PayResponse payResponse =new PayResponse();
222
+                payResponse.setSuccess(true);
223
+                payResponse.setPrepay_id(response.getTradeNo());
224
+                payResponse.setOrder_sn(response.getOutTradeNo());
225
+                return payResponse;
226
+            } else {
227
+                log.error("调用失败");
228
+                return null;
229
+            }
230
+        }catch (Exception e){
231
+            throw new TradeException("订单创建失败,订单号:"+ payRequest.getOrderSn());
232
+        }
233
+    }
234
+
235
+
236
+
237
+    /**
238
+     * 关闭订单
239
+     * @param orderSn
240
+     * @return
241
+     * @throws TradeException
242
+     */
243
+    @Override
244
+    public Boolean closePay(String orderSn) throws TradeException {
245
+        try {
246
+            AlipayClient alipayClient = getAliHttpClient();
247
+            AlipayTradeCloseRequest request = new AlipayTradeCloseRequest();
248
+            JSONObject bizContent = new JSONObject();
249
+            bizContent.put("trade_no", orderSn);
250
+            request.setBizContent(bizContent.toString());
251
+            AlipayTradeCloseResponse response = alipayClient.execute(request);
252
+            if (response.isSuccess()) {
253
+                log.info("调用成功");
254
+                return true;
255
+            } else {
256
+                log.error("调用失败");
257
+                return false;
258
+            }
259
+        }catch (Exception e){
260
+            throw new TradeException("订单关闭失败,订单号:"+orderSn);
261
+        }
262
+    }
263
+
264
+    /**
265
+     * 退款接口
266
+     * alipay.trade.refund(统一收单交易退款接口)
267
+     * https://opendocs.alipay.com/open/02ekfk
268
+     * @param refundRequest
269
+     * @return
270
+     * @throws TradeException
271
+     */
272
+    @Override
273
+    public Boolean refund(RefundRequest refundRequest) throws TradeException {
274
+        try {
275
+            AlipayClient alipayClient = getAliHttpClient();
276
+            AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();
277
+            request.setNotifyUrl(getRefundNotifyUrl()); //退款回调
278
+            JSONObject bizContent = new JSONObject();
279
+            bizContent.put("refund_amount", fenToYuan(refundRequest.getRefundAmount() ));
280
+            bizContent.put("out_trade_no", refundRequest.getOrderSn());
281
+            //退款请求号,做幂等性校验
282
+            if(refundRequest.getRequestNo()!=null){
283
+                bizContent.put("out_request_no", refundRequest.getRequestNo());
284
+            }else{
285
+                bizContent.put("out_request_no", refundRequest.getOrderSn());
286
+            }
287
+            request.setBizContent(bizContent.toString());
288
+            AlipayTradeRefundResponse response = alipayClient.execute(request);
289
+            if (response.isSuccess()) {
290
+                if("Y".equals(response.getFundChange())) {
291
+                    log.info("退款成功{}",refundRequest.getOrderSn());
292
+                    callBackService.successRefund(refundRequest.getOrderSn());
293
+                    return true;
294
+                }else{
295
+                    //退款失败
296
+                    log.error("退款失败{}",refundRequest.getOrderSn());
297
+                    callBackService.failRefund(refundRequest.getOrderSn());
298
+                    return false;
299
+                }
300
+            } else {
301
+                log.error("退款调用失败{}",refundRequest.getOrderSn());
302
+                return false;
303
+            }
304
+        }catch (Exception e){
305
+            e.printStackTrace();
306
+            throw new TradeException("订单退款失败,订单号:"+ refundRequest.getOrderSn());
307
+        }
308
+    }
309
+
310
+    /**
311
+     * 查询单笔交易订单
312
+     * 参考官网: https://opendocs.alipay.com/open/02e7gm?ref=api#请求示例
313
+     *
314
+     * @param orderSn
315
+     * @return
316
+     * @throws TradeException
317
+     */
318
+    @Override
319
+    public QueryResponse queryTradingOrderNo(String orderSn) throws TradeException {
320
+        AlipayClient alipayClient = getAliHttpClient();
321
+        try {
322
+            AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();
323
+            JSONObject bizContent = new JSONObject();
324
+            bizContent.put("out_trade_no", orderSn);
325
+            request.setBizContent(bizContent.toString());
326
+            AlipayTradeQueryResponse response = alipayClient.execute(request);
327
+            QueryResponse queryResponse=new QueryResponse();
328
+            queryResponse.setOrder_sn(orderSn );
329
+            if (response.isSuccess()) {
330
+                queryResponse.setTransaction_id( response.getTradeNo() );
331
+                queryResponse.setTrade_state(AlipayConstant.TRADE_STATE.get(  response.getTradeStatus()) );//交易状态
332
+
333
+                //int total = BigDecimal.valueOf(Double.valueOf(response.getTotalAmount())).multiply(new BigDecimal(100)).intValue();
334
+                queryResponse.setTotal(  yuanToFen(response.getTotalAmount())   ); //总金额
335
+
336
+                //int buyer_pay_amount = BigDecimal.valueOf(Double.valueOf(response.getBuyerPayAmount())).multiply(new BigDecimal(100)).intValue();
337
+                //queryResponse.setPayer_total( yuanToFen(response.getBuyerPayAmount()) );//支付金额
338
+
339
+                queryResponse.setOpenid( response.getBuyerUserId());
340
+                Map map = JSON.parseObject(response.getBody(), Map.class  ) ;
341
+                queryResponse.setExpand(map);//全部数据
342
+                return queryResponse;
343
+            } else {
344
+                queryResponse.setTrade_state("NOTPAY");
345
+                return queryResponse;
346
+            }
347
+        }catch (Exception e){
348
+            e.printStackTrace();
349
+            //throw new TradeException("订单查询失败,订单号:"+orderSn);
350
+            return null;
351
+        }
352
+    }
353
+
354
+    /**
355
+     * 查询退款订单
356
+     * @param orderSn
357
+     * @return
358
+     * @throws TradeException
359
+     */
360
+    @Override
361
+    public QueryRefundResponse queryRefundTrading(String orderSn) throws TradeException {
362
+        try {
363
+            AlipayClient alipayClient = getAliHttpClient();
364
+            AlipayTradeFastpayRefundQueryRequest request = new AlipayTradeFastpayRefundQueryRequest();
365
+            JSONObject bizContent = new JSONObject();
366
+            bizContent.put("out_request_no", orderSn);
367
+            request.setBizContent(bizContent.toString());
368
+            AlipayTradeFastpayRefundQueryResponse response = alipayClient.execute(request);
369
+            if (response.isSuccess()) {
370
+                log.info("调用成功");
371
+                Map map = JSON.parseObject(response.getBody(), Map.class   );
372
+
373
+                QueryRefundResponse queryRefundResponse=new QueryRefundResponse();
374
+
375
+                queryRefundResponse.setOrder_sn( (String) map.get("out_trade_no") );
376
+                queryRefundResponse.setTransaction_id(   (String) map.get("trade_no") );
377
+                queryRefundResponse.setTotal( (Integer) map.get("total_amount")  ); //总金额
378
+                //queryRefundResponse.setPayer_total( (Integer) map.get("total_amount")  );//支付金额
379
+                queryRefundResponse.setRefund((Integer) map.get("refund_amount")   ); //退款金额
380
+                queryRefundResponse.setRefund_id((String) map.get("trade_no")  );  //退款单号
381
+                queryRefundResponse.setOut_refund_no( (String) map.get("out_request_no")    );//退款订单号
382
+                //queryRefundResponse.setChannel(  (String) map.get("channel")  );  //通道
383
+                //queryRefundResponse.setUser_received_account(  (String) map.get("user_received_account") ); //账号
384
+                queryRefundResponse.setStatus(   (String) map.get("refund_status")  ); //状态
385
+                queryRefundResponse.setSuccess_time(  (String) map.get("gmt_refund_pay")  );
386
+                //queryRefundResponse.setCreate_time(  (String) map.get("gmt_refund_pay") );
387
+
388
+                queryRefundResponse.setExpand(map);
389
+                return queryRefundResponse;
390
+
391
+            } else {
392
+                log.error("调用失败");
393
+                return null;
394
+            }
395
+        }catch (Exception e){
396
+            e.printStackTrace();
397
+            //throw new TradeException("退款订单查询失败,订单号:"+ orderSn);
398
+            return null;
399
+        }
400
+    }
401
+
402
+    @Override
403
+    public String getOpenid(String code) {
404
+        AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do",
405
+                alipayConfig.getAppId(), alipayConfig.getPrivateKey(), "json", "utf-8", alipayConfig.getPublicKey(), alipayConfig.getSignType());
406
+        AlipaySystemOauthTokenRequest request = new AlipaySystemOauthTokenRequest();
407
+        request.setCode(code);
408
+        request.setGrantType("authorization_code");
409
+        try {
410
+            AlipaySystemOauthTokenResponse oauthTokenResponse = alipayClient.execute(request);
411
+            return  oauthTokenResponse.getUserId();
412
+        } catch (AlipayApiException e) {
413
+            //处理异常
414
+            e.printStackTrace();
415
+            return "";
416
+        }
417
+    }
418
+
419
+
420
+    /**
421
+     * 获取支付宝连接
422
+     * 参考官网:https://opendocs.alipay.com/open/01csp3?ref=api#公钥模式加签
423
+     * 公钥模式加签
424
+     * @return
425
+     */
426
+    private AlipayClient getAliHttpClient(){
427
+        try {
428
+            com.alipay.api.AlipayConfig alipayConfig = new com.alipay.api.AlipayConfig();
429
+            alipayConfig.setServerUrl(AlipayConstant.domain);
430
+            alipayConfig.setAppId(this.alipayConfig.getAppId());
431
+            alipayConfig.setPrivateKey(this.alipayConfig.getPrivateKey());
432
+            alipayConfig.setFormat("json");
433
+            alipayConfig.setCharset("utf-8");
434
+            alipayConfig.setAlipayPublicKey(this.alipayConfig.getPublicKey());
435
+            alipayConfig.setSignType(this.alipayConfig.getSignType());
436
+            //构造client
437
+            AlipayClient alipayClient = new DefaultAlipayClient(alipayConfig);
438
+            return alipayClient;
439
+        }catch (Exception e){
440
+            e.printStackTrace();
441
+            throw new TradeException("支付宝支付--初始化,校验系统参数失败");
442
+        }
443
+
444
+    }
445
+
446
+    /**
447
+     * 分转换为元
448
+     * @param fen
449
+     * @return
450
+     */
451
+    private String fenToYuan(int fen){
452
+        //转换为元
453
+        return BigDecimal.valueOf(fen).divide(new BigDecimal(100)  ).toString();
454
+    }
455
+
456
+    private int yuanToFen(String yuan){
457
+        return BigDecimal.valueOf(Double.valueOf(yuan)).multiply(new BigDecimal(100)).intValue();
458
+    }
459
+
460
+
461
+}

+ 124
- 0
pay/src/main/java/com/ruoyi/ali/AlipayElegentValid.java Bestand weergeven

@@ -0,0 +1,124 @@
1
+package com.ruoyi.ali;
2
+
3
+
4
+import com.alipay.api.internal.util.AlipaySignature;
5
+import com.ruoyi.annotation.TradePlatform;
6
+import com.ruoyi.constant.Platform;
7
+import com.ruoyi.core.ElegentValid;
8
+import com.ruoyi.dto.ValidResponse;
9
+import com.ruoyi.exceptions.TradeException;
10
+import lombok.extern.slf4j.Slf4j;
11
+import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.http.HttpEntity;
13
+import org.springframework.stereotype.Service;
14
+
15
+import javax.servlet.http.HttpServletRequest;
16
+import java.util.HashMap;
17
+import java.util.Iterator;
18
+import java.util.Map;
19
+
20
+@Service
21
+@TradePlatform(Platform.ALI)
22
+@Slf4j
23
+public class AlipayElegentValid implements ElegentValid {
24
+
25
+
26
+    @Autowired
27
+    private AlipayConfig alipayConfig;
28
+
29
+
30
+    /**
31
+     * 订单回调结果通知验签
32
+     * 参考代码: https://opendocs.alipay.com/open/194/103296?ref=api  异步返回结果的验签
33
+     * @param httpEntity
34
+     * @param httpRequest
35
+     * @return
36
+     */
37
+    @Override
38
+    public ValidResponse validPay(HttpEntity<String> httpEntity, HttpServletRequest httpRequest) throws TradeException {
39
+        ValidResponse validResponse=new ValidResponse();
40
+        try {
41
+            Map<String, String> params = getParams(httpRequest);
42
+            //获取支付宝POST过来反馈信息,将异步通知中收到的待验证所有参数都存放到map中
43
+            //String body = httpEntity.getBody();
44
+            //调用SDK验证签名
45
+            //公钥验签示例代码
46
+            boolean signVerified = AlipaySignature.rsaCheckV1(params, alipayConfig.getPublicKey(), "utf-8", alipayConfig.getSignType());
47
+            if (signVerified) {
48
+                validResponse.setValid(true);
49
+                validResponse.setOrderSn((String) params.get("out_trade_no"));
50
+                return validResponse;
51
+            } else {
52
+                validResponse.setValid(false);
53
+                validResponse.setOrderSn( (String) params.get("out_trade_no") );
54
+                return validResponse;
55
+            }
56
+        }catch (Exception e){
57
+            e.printStackTrace();
58
+            throw new TradeException("验签异常");
59
+        }
60
+    }
61
+
62
+    /**
63
+     * 退款结果通知验签
64
+     * 参考官网 https://opendocs.alipay.com/support/01ravh
65
+     * @param httpEntity
66
+     * @param httpRequest
67
+     * @return
68
+     * @throws TradeException
69
+     */
70
+    @Override
71
+    public ValidResponse validRefund(HttpEntity<String> httpEntity, HttpServletRequest httpRequest) throws TradeException {
72
+        ValidResponse validResponse=new ValidResponse();
73
+
74
+        try {
75
+            //获取支付宝POST过来反馈信息,将异步通知中收到的待验证所有参数都存放到map中
76
+            Map<String, String> params = getParams(httpRequest);
77
+            //调用SDK验证签名
78
+            //公钥验签示例代码
79
+            boolean signVerified = AlipaySignature.rsaCheckV1(params, alipayConfig.getPublicKey(), "utf-8", alipayConfig.getSignType());
80
+            if (signVerified) {
81
+                validResponse.setValid(true);
82
+                validResponse.setOrderSn( (String) params.get("out_trade_no") );
83
+                return validResponse;
84
+            } else {
85
+                validResponse.setValid(false);
86
+                validResponse.setOrderSn( (String) params.get("out_trade_no") );
87
+                return validResponse;
88
+            }
89
+        }catch (Exception e){
90
+            e.printStackTrace();
91
+            validResponse.setValid(false);
92
+            return validResponse;
93
+        }
94
+    }
95
+
96
+    private Map<String,String> getParams(HttpServletRequest httpServletRequest){
97
+        Map<String,String> params = new HashMap< String , String >();
98
+        Map requestParams = httpServletRequest.getParameterMap();
99
+
100
+        for(Iterator iter = requestParams.keySet().iterator(); iter.hasNext();){
101
+            String name = (String)iter.next();
102
+            String[] values = (String [])requestParams.get(name);
103
+            String valueStr = "";
104
+            for(int i = 0;i < values.length;i ++ ){
105
+                valueStr =  (i==values.length-1)?valueStr + values [i]:valueStr + values[i] + ",";
106
+            }
107
+            //乱码解决,这段代码在出现乱码时使用。
108
+            //valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8");
109
+            params.put (name,valueStr);
110
+        }
111
+        log.info("params:{}",params);
112
+        return params;
113
+    }
114
+
115
+    @Override
116
+    public String successResult() {
117
+        return AlipayConstant.SUCCESS;
118
+    }
119
+
120
+    @Override
121
+    public String failResult() {
122
+        return AlipayConstant.FAIL;
123
+    }
124
+}

+ 20
- 0
pay/src/main/java/com/ruoyi/annotation/TradePlatform.java Bestand weergeven

@@ -0,0 +1,20 @@
1
+package com.ruoyi.annotation;
2
+
3
+import java.lang.annotation.*;
4
+
5
+/**
6
+ * create by: wgl
7
+ * desc: 自定义支付平台注解,支付平台 微信:wx 支付宝:zfb
8
+ */
9
+@Documented
10
+@Retention(RetentionPolicy.RUNTIME)
11
+@Target({ElementType.TYPE})
12
+public @interface TradePlatform {
13
+
14
+    /**
15
+     * 平台的id
16
+     * Platform.WX
17
+     * @return
18
+     */
19
+    String value();
20
+}

+ 23
- 0
pay/src/main/java/com/ruoyi/config/CallbackConfig.java Bestand weergeven

@@ -0,0 +1,23 @@
1
+package com.ruoyi.config;
2
+import lombok.Data;
3
+import org.springframework.beans.factory.annotation.Value;
4
+import org.springframework.boot.context.properties.ConfigurationProperties;
5
+import org.springframework.stereotype.Component;
6
+
7
+/**
8
+ * 微信权限对接类
9
+ */
10
+@Component
11
+@ConfigurationProperties("elegent.pay.callback")
12
+@Data
13
+public class CallbackConfig {
14
+
15
+    private String domain; //回调域名
16
+
17
+    @Value("${elegent.pay.callback.watch:false}")
18
+    private boolean watch; //是否开启监听
19
+
20
+    @Value("${elegent.pay.callback.cycle:10}")
21
+    private int cycle;//检查周期
22
+
23
+}

+ 11
- 0
pay/src/main/java/com/ruoyi/constant/PayConstant.java Bestand weergeven

@@ -0,0 +1,11 @@
1
+package com.ruoyi.constant;
2
+
3
+public class PayConstant {
4
+
5
+    public final static String CALLBACK_PATH = "/payCallBack";
6
+
7
+    public final static String NOTIFY = "/notify";
8
+
9
+    public final static String  REFUND_NOTIFY = "/refund_notify";
10
+
11
+}

+ 16
- 0
pay/src/main/java/com/ruoyi/constant/Platform.java Bestand weergeven

@@ -0,0 +1,16 @@
1
+package com.ruoyi.constant;
2
+
3
+/**
4
+ * Platform
5
+ * 支付方式
6
+*/
7
+public class Platform {
8
+    /**
9
+     * 微信
10
+     */
11
+    public final static String WX = "wxpay";
12
+    /**
13
+     * 支付宝
14
+     */
15
+    public final static String ALI = "alipay";
16
+}

+ 33
- 0
pay/src/main/java/com/ruoyi/constant/TradeType.java Bestand weergeven

@@ -0,0 +1,33 @@
1
+package com.ruoyi.constant;
2
+
3
+import lombok.Data;
4
+
5
+/**
6
+ * 交易类型
7
+ */
8
+@Data
9
+public class TradeType {
10
+
11
+    /**
12
+     * native(扫码)
13
+     */
14
+    public final static String NATIVE = "native";
15
+
16
+    /**
17
+     * jsapi(小程序)
18
+     */
19
+    public final static String JSAPI = "jsapi";
20
+
21
+
22
+    /**
23
+     * app
24
+     */
25
+    public final static String APP = "app";
26
+
27
+
28
+    /**
29
+     * h5
30
+     */
31
+    public final static String H5 = "h5";
32
+
33
+}

+ 35
- 0
pay/src/main/java/com/ruoyi/core/CallBackServiceImpl.java Bestand weergeven

@@ -0,0 +1,35 @@
1
+package com.ruoyi.core;
2
+
3
+import com.ruoyi.CallBackService;
4
+import lombok.extern.slf4j.Slf4j;
5
+
6
+/**
7
+ * 回调类
8
+ */
9
+@Slf4j
10
+public class CallBackServiceImpl implements CallBackService {
11
+
12
+
13
+    @Override
14
+    public void successPay(String orderSn) {
15
+        log.info("支付成功回调!"+orderSn);
16
+    }
17
+
18
+    @Override
19
+    public void failPay(String orderSn) {
20
+        log.info("支付失败回调!"+orderSn);
21
+    }
22
+
23
+
24
+    @Override
25
+    public void successRefund(String orderSn) {
26
+        log.info("退款成功回调!"+orderSn);
27
+    }
28
+
29
+    @Override
30
+    public void failRefund(String orderSn) {
31
+        log.info("退款失败回调!"+orderSn);
32
+    }
33
+
34
+
35
+}

+ 90
- 0
pay/src/main/java/com/ruoyi/core/CallbackController.java Bestand weergeven

@@ -0,0 +1,90 @@
1
+package com.ruoyi.core;
2
+
3
+import com.ruoyi.CallBackService;
4
+import com.ruoyi.constant.PayConstant;
5
+import com.ruoyi.dto.ValidResponse;
6
+import lombok.extern.slf4j.Slf4j;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.http.HttpEntity;
9
+import org.springframework.web.bind.annotation.PathVariable;
10
+import org.springframework.web.bind.annotation.RequestMapping;
11
+import org.springframework.web.bind.annotation.RestController;
12
+
13
+import javax.servlet.http.HttpServletRequest;
14
+import javax.servlet.http.HttpServletResponse;
15
+
16
+/**
17
+ * CallbackController
18
+ * @description 系统默认提供的微信回调的Controller
19
+*/
20
+@RestController
21
+@Slf4j
22
+@RequestMapping(PayConstant.CALLBACK_PATH)
23
+public class CallbackController {
24
+
25
+    @Autowired
26
+    private CallBackService callBackService;
27
+
28
+    /**
29
+     * 系统提供的默认的微信回调的接口(支付回调)
30
+     * @param httpEntity
31
+     * @param response
32
+     * @return
33
+     */
34
+    @RequestMapping( PayConstant.NOTIFY + "/{platform}")
35
+    public String notify(HttpEntity<String> httpEntity, HttpServletRequest request, HttpServletResponse response, @PathVariable("platform") String platform){
36
+
37
+        ElegentValid elegentValid = ElegentLoader.getElegentValid(platform);  //获取验证器
38
+        try {
39
+            ValidResponse validResponse = elegentValid.validPay(httpEntity, request);//验证支付通知
40
+            String orderSn =validResponse.getOrderSn(); //订单号
41
+            if(validResponse.isValid()){  //返回码成功
42
+                callBackService.successPay(orderSn);
43
+                //返回成功消费
44
+                return elegentValid.successResult();
45
+            }else{
46
+                callBackService.failPay(orderSn);
47
+                return elegentValid.failResult();
48
+            }
49
+        }catch (Exception e){
50
+            log.error("支付回调处理失败",e);
51
+            //微信返回的状态非正常
52
+            return elegentValid.failResult();
53
+        }
54
+    }
55
+
56
+
57
+    /**
58
+     * 系统提供的默认的微信回调的接口(退款通知)
59
+     *
60
+     * @param httpEntity
61
+     * @param response
62
+     * @return
63
+     */
64
+    @RequestMapping( PayConstant.REFUND_NOTIFY + "/{platform}")
65
+    public String refundNotify(HttpEntity<String> httpEntity, HttpServletRequest request, HttpServletResponse response,@PathVariable("platform") String platform) {
66
+
67
+        ElegentValid elegentValid = ElegentLoader.getElegentValid(platform);  //获取验证器
68
+
69
+        try {
70
+            ValidResponse validResponse = elegentValid.validRefund(httpEntity, request);
71
+            String orderSn = validResponse.getOrderSn();
72
+            //订单号
73
+            if (validResponse.isValid()) {  //返回码成功
74
+                callBackService.successRefund(orderSn);
75
+                //返回成功消费
76
+                return elegentValid.successResult();
77
+            } else {
78
+                callBackService.failRefund(orderSn);
79
+                return elegentValid.failResult();
80
+            }
81
+        } catch (Exception e) {
82
+            log.error("退款回调处理失败", e);
83
+            //微信返回的状态非正常
84
+            return elegentValid.failResult();
85
+        }
86
+
87
+    }
88
+
89
+
90
+}

+ 73
- 0
pay/src/main/java/com/ruoyi/core/CallbackWatch.java Bestand weergeven

@@ -0,0 +1,73 @@
1
+package com.ruoyi.core;
2
+
3
+
4
+
5
+import com.ruoyi.CallBackService;
6
+import com.ruoyi.ElegentPay;
7
+import com.ruoyi.config.CallbackConfig;
8
+import com.ruoyi.dto.QueryRefundResponse;
9
+import com.ruoyi.dto.QueryResponse;
10
+import com.ruoyi.dto.WatchDTO;
11
+import lombok.extern.slf4j.Slf4j;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
14
+import org.springframework.stereotype.Component;
15
+import javax.annotation.PostConstruct;
16
+import java.util.Timer;
17
+import java.util.TimerTask;
18
+
19
+@Component
20
+@ConditionalOnProperty(prefix = "elegent.pay.callback",name = "watch",havingValue = "true")
21
+@Slf4j
22
+public class CallbackWatch {
23
+
24
+    @Autowired
25
+    private CallBackService callBackService;
26
+
27
+    @Autowired
28
+    private CallbackConfig callbackConfig;
29
+
30
+    @Autowired
31
+    private ElegentPay elegentPay;
32
+
33
+    @PostConstruct
34
+    public void queryWatch(){
35
+        if(callbackConfig.getCycle()<=0){
36
+            return;
37
+        }
38
+        //log.info("开启支付结果定期巡检");
39
+        Timer timer = new Timer();
40
+        // 2、创建 TimerTask 任务线程
41
+        TimerTask task=new TimerTask() {
42
+            @Override
43
+            public void run() {
44
+                try{
45
+                    //查询支付状态
46
+                    //log.info("支付状态定期巡检,{}",WatchList.payList);
47
+                    for( WatchDTO watchDTO: WatchList.payList ){
48
+                        //查询订单是否支付成功
49
+                        QueryResponse queryResponse = elegentPay.queryTradingOrderNo(watchDTO.getOrderSn(),watchDTO.getPlatform());
50
+                        if("SUCCESS".equals(queryResponse.getTrade_state())){
51
+                            callBackService.successPay(queryResponse.getOrder_sn());
52
+                            WatchList.payList.remove(watchDTO );
53
+                        }
54
+                    }
55
+                    //log.info("退款状态定期巡检,{}",WatchList.refundList);
56
+                    //查询退款状态
57
+                    for( WatchDTO watchDTO: WatchList.refundList ){
58
+                        //查询退款中订单
59
+                        QueryRefundResponse queryResponse = elegentPay.queryRefundTrading( watchDTO.getOrderSn(),watchDTO.getPlatform());
60
+                        if("SUCCESS".equals(queryResponse.getStatus())){
61
+                            callBackService.successRefund(queryResponse.getOrder_sn());
62
+                            WatchList.refundList.remove(watchDTO);
63
+                        }
64
+                    }
65
+                }catch (Exception ex){
66
+                }
67
+            }
68
+        };
69
+        // 4、启动定时任务
70
+        timer.schedule(task, callbackConfig.getCycle()*1000, callbackConfig.getCycle()*1000);
71
+    }
72
+
73
+}

+ 27
- 0
pay/src/main/java/com/ruoyi/core/ElegentConfig.java Bestand weergeven

@@ -0,0 +1,27 @@
1
+package com.ruoyi.core;
2
+
3
+
4
+import com.ruoyi.CallBackService;
5
+import com.ruoyi.key.KeyManager;
6
+import com.ruoyi.key.impl.DefaultKeyManager;
7
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
8
+import org.springframework.context.annotation.Bean;
9
+import org.springframework.context.annotation.Configuration;
10
+
11
+@Configuration
12
+public class ElegentConfig {
13
+
14
+    @Bean
15
+    @ConditionalOnMissingBean
16
+    public CallBackService callBackService(){
17
+        return new CallBackServiceImpl();
18
+    }
19
+
20
+
21
+    @Bean
22
+    @ConditionalOnMissingBean
23
+    public KeyManager keyManager(){
24
+        return new DefaultKeyManager();
25
+    }
26
+
27
+}

+ 82
- 0
pay/src/main/java/com/ruoyi/core/ElegentLoader.java Bestand weergeven

@@ -0,0 +1,82 @@
1
+package com.ruoyi.core;
2
+
3
+import com.ruoyi.annotation.TradePlatform;
4
+import com.ruoyi.exceptions.TradeException;
5
+import lombok.extern.slf4j.Slf4j;
6
+import org.springframework.beans.BeansException;
7
+import org.springframework.context.ApplicationContext;
8
+import org.springframework.context.ApplicationContextAware;
9
+import org.springframework.stereotype.Component;
10
+
11
+import java.util.Collection;
12
+import java.util.HashMap;
13
+import java.util.Map;
14
+
15
+/**
16
+ * PlatformLoader
17
+ * @description 第三方支付平台类加载器
18
+ * 服务启动的时候自动加载第三方支付组件
19
+*/
20
+@Component
21
+@Slf4j
22
+public class ElegentLoader implements ApplicationContextAware {
23
+
24
+    private static Map<String, ElegentTrade> elegentTradeMap = new HashMap<>();
25
+
26
+    private static Map<String, ElegentValid> elegentValidMap = new HashMap<>();
27
+
28
+    @Override
29
+    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
30
+
31
+        //加载所有的交易实现类
32
+        Collection<ElegentTrade> elegentTrades = applicationContext.getBeansOfType(ElegentTrade.class).values();
33
+        elegentTrades.stream().forEach(e->{
34
+            //通过反射拿到类上的平台注解
35
+            TradePlatform annotation = e.getClass().getAnnotation(TradePlatform.class);
36
+            if (annotation != null) {
37
+                elegentTradeMap.put(annotation.value(), e);
38
+            }
39
+        });
40
+
41
+        //加载所有的验证实现类
42
+        Collection<ElegentValid> elegentValids = applicationContext.getBeansOfType(ElegentValid.class).values();
43
+        elegentValids.stream().forEach(e->{
44
+            //通过反射拿到类上的平台注解
45
+            TradePlatform annotation = e.getClass().getAnnotation(TradePlatform.class);
46
+            if (annotation != null) {
47
+                elegentValidMap.put(annotation.value(), e);
48
+            }
49
+        });
50
+
51
+    }
52
+
53
+    /**
54
+     * 根据平台id获取具体的第三方平台
55
+     * @param platform 平台id
56
+     * @return
57
+     */
58
+    public static ElegentTrade getElegentTrade(String platform){
59
+        ElegentTrade elegentPayTemplate = elegentTradeMap.get(platform);
60
+        if(elegentPayTemplate!=null){
61
+            return elegentPayTemplate;
62
+        }else{
63
+            throw new TradeException("未找到适配的交易类型,交易平台id:"+platform);
64
+        }
65
+    }
66
+
67
+
68
+    /**
69
+     * 根据平台id获取具体的验证类
70
+     * @param platform 平台id
71
+     * @return
72
+     */
73
+    public static ElegentValid getElegentValid(String platform){
74
+        ElegentValid elegentValidTemplate = elegentValidMap.get(platform);
75
+        if(elegentValidTemplate!=null){
76
+            return elegentValidTemplate;
77
+        }else{
78
+            throw new TradeException("未找到适配的交易类型,交易平台id:"+platform);
79
+        }
80
+    }
81
+
82
+}

+ 136
- 0
pay/src/main/java/com/ruoyi/core/ElegentPayImpl.java Bestand weergeven

@@ -0,0 +1,136 @@
1
+package com.ruoyi.core;
2
+import com.ruoyi.ElegentPay;
3
+import com.ruoyi.config.CallbackConfig;
4
+import com.ruoyi.dto.*;
5
+import com.ruoyi.exceptions.TradeException;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.stereotype.Component;
8
+
9
+/**
10
+ * ElegentPayTemplate
11
+ * @description 统一模板 在模板层进行第三方平台的选择
12
+*/
13
+@Component
14
+public class ElegentPayImpl implements ElegentPay {
15
+
16
+    @Autowired
17
+    private CallbackConfig callbackConfig;
18
+
19
+    /**
20
+     * 统一下单接口
21
+     * @param payRequest
22
+     * @return
23
+     */
24
+    @Override
25
+    public PayResponse requestPay(PayRequest payRequest, String tradeType, String platform) throws TradeException {
26
+        //获取交易策略
27
+        PayResponse payResponse = getPlatFormService(platform).requestPay(payRequest, tradeType);
28
+
29
+        //加入监听列表
30
+        if(callbackConfig.isWatch()){
31
+            WatchDTO watchDTO=new WatchDTO();
32
+            watchDTO.setOrderSn(payRequest.getOrderSn());
33
+            watchDTO.setPlatform(platform);
34
+            WatchList.payList.add( watchDTO );
35
+        }
36
+        return payResponse;
37
+    }
38
+
39
+
40
+    /**
41
+     * 关闭订单
42
+     * @param orderSn
43
+     * @param platform
44
+     * @return
45
+     * @throws Exception
46
+     */
47
+    @Override
48
+    public Boolean closePay(String orderSn, String platform) throws TradeException {
49
+        //调用对应第三方的创建订单接口
50
+        Boolean aBoolean = getPlatFormService(platform).closePay(orderSn);
51
+        //加入监听列表
52
+        if(callbackConfig.isWatch()){
53
+            WatchDTO watchDTO=new WatchDTO();
54
+            watchDTO.setOrderSn(orderSn);
55
+            watchDTO.setPlatform(platform);
56
+            WatchList.payList.remove( watchDTO );
57
+        }
58
+
59
+        return aBoolean;
60
+    }
61
+
62
+    /**
63
+     * 退款方法
64
+     * @param refundRequest
65
+     * @return
66
+     * @throws Exception
67
+     */
68
+    @Override
69
+    public Boolean refund(RefundRequest refundRequest, String platform) throws TradeException {
70
+        Boolean refund = getPlatFormService(platform).refund(refundRequest);
71
+        //加入监听列表
72
+        if(callbackConfig.isWatch()  && refund){
73
+            WatchDTO watchDTO=new WatchDTO();
74
+            watchDTO.setOrderSn(refundRequest.getRequestNo());
75
+            watchDTO.setPlatform(platform);
76
+            WatchList.refundList.add( watchDTO );
77
+        }
78
+        return refund;
79
+    }
80
+
81
+
82
+    /**
83
+     * 手动查询订单的方法
84
+     * 商户订单号查询 根据订单号查询订单
85
+     * 该接口基于生成的订单号来进行订单的查询
86
+     * 可以基于查询的结果判断用户订单是否支付成功
87
+     * @param orderSn
88
+     * @param Platform
89
+     * @return
90
+     * @throws Exception
91
+     */
92
+    @Override
93
+    public QueryResponse queryTradingOrderNo(String  orderSn , String Platform) throws TradeException {
94
+        //调用具体第三方的退款接口
95
+        return getPlatFormService(Platform).queryTradingOrderNo(orderSn);
96
+    }
97
+
98
+
99
+    /**
100
+     * 查询退款单号
101
+     *
102
+     * @return
103
+     * @throws Exception
104
+     */
105
+    @Override
106
+    public QueryRefundResponse queryRefundTrading(String orderSn , String platform) throws TradeException {
107
+        //获取请求参数
108
+        return getPlatFormService(platform).queryRefundTrading(orderSn);
109
+    }
110
+
111
+    /**
112
+     * 获得openId
113
+     * @param code
114
+     * @param platform
115
+     * @return
116
+     */
117
+    @Override
118
+    public String getOpenid(String code, String platform) {
119
+        return getPlatFormService(platform).getOpenid(code);
120
+    }
121
+
122
+/**
123
+ * ====================================提供的模板类需要使用的方法=====================================
124
+ */
125
+
126
+
127
+    /**
128
+     * 跟进具体内容获取实现类的方法
129
+     * @param platForm
130
+     * @return
131
+     */
132
+    private ElegentTrade getPlatFormService(String platForm) {
133
+        return ElegentLoader.getElegentTrade(platForm);
134
+    }
135
+
136
+}

+ 54
- 0
pay/src/main/java/com/ruoyi/core/ElegentTrade.java Bestand weergeven

@@ -0,0 +1,54 @@
1
+package com.ruoyi.core;
2
+
3
+
4
+import com.ruoyi.dto.*;
5
+import com.ruoyi.exceptions.TradeException;
6
+
7
+public interface ElegentTrade {
8
+
9
+
10
+    /**
11
+     * 单独的创建本地支付订单接口
12
+     * 该接口基于设计模式实现,对接了微信V3版支付代码和支付宝支付sdk
13
+     * 业务编写人员仅仅只需要准备好请求参数调用该方法即可完成下单请求
14
+     * @return 交易数据对象 包含有native支付的二维码+jsApi支付的支付组件
15
+     */
16
+    PayResponse requestPay(PayRequest payRequest, String tradeType) throws TradeException;
17
+
18
+    /**
19
+     * 关闭订单
20
+     * 该结构基于设计模式实现,对接了微信V3版支付代码和支付宝支付sdk
21
+     * 业务编写人员在处理超时订单的时候需要 通知微信 由于是超时订单需要进行远程关闭
22
+     */
23
+    Boolean closePay(String orderSn) throws TradeException;
24
+
25
+    /**
26
+     * 退款s申请
27
+     * 该接口基于设计模式实现,对接了微信V3版支付代码和支付宝支付sdk
28
+     * 业务编写人员在处理业务执行失败时需要进行退款
29
+     */
30
+    Boolean refund(RefundRequest refundRequest) throws TradeException;
31
+
32
+    /**
33
+     * 商户订单号查询 根据订单号查询订单
34
+     * 该接口基于生成的订单号来进行订单的查询
35
+     * 可以基于查询的结果判断用户订单是否支付成功
36
+     */
37
+    QueryResponse queryTradingOrderNo(String orderSn) throws TradeException;
38
+
39
+
40
+    /**
41
+     * 查询单笔退款API
42
+     *
43
+     */
44
+    QueryRefundResponse queryRefundTrading(String orderSn) throws TradeException;
45
+
46
+
47
+    /**
48
+     * 获得openId
49
+     * @param code
50
+     * @return
51
+     */
52
+    String getOpenid(String code);
53
+
54
+}

+ 48
- 0
pay/src/main/java/com/ruoyi/core/ElegentValid.java Bestand weergeven

@@ -0,0 +1,48 @@
1
+package com.ruoyi.core;
2
+
3
+
4
+import com.ruoyi.dto.ValidResponse;
5
+import com.ruoyi.exceptions.TradeException;
6
+import org.springframework.http.HttpEntity;
7
+
8
+import javax.servlet.http.HttpServletRequest;
9
+
10
+/**
11
+ * 验证器接口
12
+ *
13
+ */
14
+public interface ElegentValid {
15
+
16
+
17
+    /**
18
+     * 支付结果通知校验
19
+     * 该接口基于设计模式实现,对接了微信V3版支付代码和支付宝支付sdk
20
+     * 业务编写人员在接收到微信或支付宝回调的时候可以使用该方法验证回调是否成功,是否是伪回调
21
+     * @return 交易数据对象
22
+     */
23
+    ValidResponse validPay(HttpEntity<String> httpEntity, HttpServletRequest request) throws TradeException;
24
+
25
+
26
+
27
+    /**
28
+     * 退款结果通知校验
29
+     * 该接口基于设计模式实现,对接了微信V3版支付代码和支付宝支付sdk
30
+     * 业务编写人员在接收到微信或支付宝回调的时候可以使用该方法验证回调是否成功,是否是伪回调
31
+     */
32
+    ValidResponse validRefund(HttpEntity<String> httpEntity, HttpServletRequest request) throws TradeException;
33
+
34
+
35
+    /**
36
+     * 成功返回结构
37
+     * @return
38
+     */
39
+    String successResult();
40
+
41
+
42
+    /**
43
+     * 失败返回内容
44
+     * @return
45
+     */
46
+    String failResult();
47
+
48
+}

+ 20
- 0
pay/src/main/java/com/ruoyi/core/WatchList.java Bestand weergeven

@@ -0,0 +1,20 @@
1
+package com.ruoyi.core;
2
+
3
+
4
+
5
+import com.ruoyi.dto.WatchDTO;
6
+
7
+import java.util.concurrent.CopyOnWriteArraySet;
8
+
9
+/**
10
+ * 监听列表
11
+ */
12
+public class WatchList {
13
+
14
+
15
+
16
+    public static CopyOnWriteArraySet<WatchDTO> payList=new CopyOnWriteArraySet<>(); //支付中列表
17
+
18
+    public static CopyOnWriteArraySet<WatchDTO> refundList=new CopyOnWriteArraySet<>();  //退款中列表
19
+
20
+}

+ 20
- 0
pay/src/main/java/com/ruoyi/dto/PayRequest.java Bestand weergeven

@@ -0,0 +1,20 @@
1
+package com.ruoyi.dto;
2
+
3
+
4
+import lombok.Data;
5
+
6
+/**
7
+ * PayRequest
8
+ * 支付请求外观类
9
+*/
10
+@Data
11
+public class PayRequest {
12
+
13
+    private String body;//商品描述
14
+
15
+    private String orderSn; //订单号
16
+
17
+    private int totalFee; //订单金额
18
+
19
+    private String openid;//openId
20
+}

+ 29
- 0
pay/src/main/java/com/ruoyi/dto/PayResponse.java Bestand weergeven

@@ -0,0 +1,29 @@
1
+package com.ruoyi.dto;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.Map;
6
+
7
+/**
8
+ * 结果统一封装类
9
+ */
10
+@Data
11
+public class PayResponse {
12
+
13
+    private boolean success;  //是否成功
14
+
15
+    private String message;//信息
16
+
17
+    private String order_sn;//订单编号
18
+
19
+    private Map<String,String>  expand;//扩展属性
20
+
21
+    private String code_url;//二维码连接(native返回)
22
+
23
+    private String prepay_id;//预支付Id(小程序返回)
24
+
25
+    private String h5_url;//支付跳转链接
26
+
27
+    private Map<String,String>  jsapiData;//小程序返回
28
+
29
+}

+ 24
- 0
pay/src/main/java/com/ruoyi/dto/QueryRefundResponse.java Bestand weergeven

@@ -0,0 +1,24 @@
1
+package com.ruoyi.dto;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class QueryRefundResponse extends QueryResponse{
7
+
8
+
9
+    private String refund_id;  //微信支付退款单号
10
+
11
+    private String out_refund_no;//商户退款单号
12
+
13
+    private String channel;//退款渠道
14
+
15
+    private String user_received_account;//退款账号
16
+
17
+    private String success_time;//退款成功时间
18
+
19
+    private String status;//退款状态
20
+
21
+    private int refund;//退款金额
22
+
23
+
24
+}

+ 25
- 0
pay/src/main/java/com/ruoyi/dto/QueryResponse.java Bestand weergeven

@@ -0,0 +1,25 @@
1
+package com.ruoyi.dto;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.Map;
6
+
7
+/**
8
+ * 查询响应对象
9
+ */
10
+@Data
11
+public class QueryResponse {
12
+
13
+    private String openid;//用户id
14
+
15
+    private String trade_state;//交易状态
16
+
17
+    private String order_sn;//订单号
18
+
19
+    private String transaction_id;//交易单号
20
+
21
+    private int total;//金额
22
+
23
+    private Map expand;//扩展(全部的返回数据)
24
+
25
+}

+ 16
- 0
pay/src/main/java/com/ruoyi/dto/RefundRequest.java Bestand weergeven

@@ -0,0 +1,16 @@
1
+package com.ruoyi.dto;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class RefundRequest {
7
+
8
+    private int totalFee; //订单金额
9
+
10
+    private int refundAmount; //退款金额
11
+
12
+    private String orderSn; //订单号
13
+
14
+    private String requestNo; //退款请求号,做退款幂等性校验,当部分退款时必须给出
15
+
16
+}

+ 15
- 0
pay/src/main/java/com/ruoyi/dto/ValidResponse.java Bestand weergeven

@@ -0,0 +1,15 @@
1
+package com.ruoyi.dto;
2
+
3
+import lombok.Data;
4
+
5
+/**
6
+ * 验证签名
7
+ */
8
+@Data
9
+public class ValidResponse {
10
+
11
+    private boolean isValid;// 是否通过验签
12
+
13
+    private String orderSn;// 订单号
14
+
15
+}

+ 12
- 0
pay/src/main/java/com/ruoyi/dto/WatchDTO.java Bestand weergeven

@@ -0,0 +1,12 @@
1
+package com.ruoyi.dto;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class WatchDTO {
7
+
8
+    private String orderSn; //订单号
9
+
10
+    private String platform;//平台
11
+
12
+}

+ 24
- 0
pay/src/main/java/com/ruoyi/exceptions/TradeException.java Bestand weergeven

@@ -0,0 +1,24 @@
1
+package com.ruoyi.exceptions;
2
+
3
+import lombok.Getter;
4
+import lombok.Setter;
5
+
6
+/**
7
+ * 交易SDK提供的总的异常
8
+ */
9
+@Getter
10
+@Setter
11
+public class TradeException extends RuntimeException{
12
+    private String code;
13
+    private String msg;
14
+
15
+    public TradeException(String code, String msg) {
16
+        super(msg);
17
+        this.code = code;
18
+        this.msg = msg;
19
+    }
20
+
21
+    public TradeException(String msg) {
22
+        super(msg);
23
+    }
24
+}

+ 16
- 0
pay/src/main/java/com/ruoyi/key/KeyManager.java Bestand weergeven

@@ -0,0 +1,16 @@
1
+package com.ruoyi.key;
2
+
3
+/**
4
+ * 密钥管理器接口
5
+ */
6
+public interface KeyManager {
7
+
8
+
9
+    /**
10
+     * 根据名字获取key字符串
11
+     * @param name
12
+     * @return
13
+     */
14
+    String getKey(String name);
15
+
16
+}

+ 19
- 0
pay/src/main/java/com/ruoyi/key/impl/DefaultKeyManager.java Bestand weergeven

@@ -0,0 +1,19 @@
1
+package com.ruoyi.key.impl;
2
+
3
+
4
+import com.ruoyi.key.KeyManager;
5
+import com.ruoyi.util.FileUtil;
6
+
7
+/**
8
+ * 默认的key管理器-文件管理器
9
+ */
10
+public class DefaultKeyManager implements KeyManager {
11
+
12
+
13
+    @Override
14
+    public String getKey(String name) {
15
+        return FileUtil.readToStr(name);
16
+    }
17
+
18
+
19
+}

+ 37
- 0
pay/src/main/java/com/ruoyi/util/FileUtil.java Bestand weergeven

@@ -0,0 +1,37 @@
1
+package com.ruoyi.util;
2
+
3
+import java.io.ByteArrayOutputStream;
4
+import java.io.IOException;
5
+import java.io.InputStream;
6
+
7
+/**
8
+ * 文件读取类
9
+ */
10
+public class FileUtil {
11
+
12
+
13
+    /**
14
+     * 获取文件内容
15
+     * @param fileName
16
+     * @return
17
+     */
18
+    public static String readToStr(String fileName){
19
+        InputStream is = FileUtil.class.getClassLoader().getResourceAsStream(fileName);
20
+        ByteArrayOutputStream os = new ByteArrayOutputStream(2048);
21
+        byte[] buffer = new byte[1024];
22
+
23
+        String str;
24
+        try {
25
+            int length;
26
+            while((length = is.read(buffer)) != -1) {
27
+                os.write(buffer, 0, length);
28
+            }
29
+
30
+            str = os.toString("UTF-8");
31
+        } catch (IOException var5) {
32
+            throw new IllegalArgumentException("无效的密钥", var5);
33
+        }
34
+        return str;
35
+    }
36
+
37
+}

+ 459
- 0
pay/src/main/java/com/ruoyi/wx/WxPayElegentTrade.java Bestand weergeven

@@ -0,0 +1,459 @@
1
+package com.ruoyi.wx;
2
+
3
+
4
+import cn.hutool.core.util.CharsetUtil;
5
+import cn.hutool.core.util.IdUtil;
6
+import cn.hutool.core.util.StrUtil;
7
+import com.alibaba.fastjson.JSON;
8
+import com.ruoyi.annotation.TradePlatform;
9
+import com.ruoyi.config.CallbackConfig;
10
+import com.ruoyi.constant.PayConstant;
11
+import com.ruoyi.constant.Platform;
12
+import com.ruoyi.core.ElegentTrade;
13
+import com.ruoyi.dto.*;
14
+import com.ruoyi.exceptions.TradeException;
15
+import com.ruoyi.util.FileUtil;
16
+import com.wechat.pay.contrib.apache.httpclient.WechatPayHttpClientBuilder;
17
+import com.wechat.pay.contrib.apache.httpclient.auth.PrivateKeySigner;
18
+import com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Credentials;
19
+import com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Validator;
20
+import com.wechat.pay.contrib.apache.httpclient.cert.CertificatesManager;
21
+import com.wechat.pay.contrib.apache.httpclient.util.PemUtil;
22
+import lombok.extern.slf4j.Slf4j;
23
+import org.apache.http.client.methods.CloseableHttpResponse;
24
+import org.apache.http.client.methods.HttpGet;
25
+import org.apache.http.client.methods.HttpPost;
26
+import org.apache.http.client.utils.URIBuilder;
27
+import org.apache.http.entity.StringEntity;
28
+import org.apache.http.impl.client.CloseableHttpClient;
29
+import org.apache.http.util.EntityUtils;
30
+import org.springframework.beans.factory.annotation.Autowired;
31
+import org.springframework.stereotype.Component;
32
+import org.springframework.web.client.RestTemplate;
33
+
34
+import java.io.ByteArrayInputStream;
35
+import java.io.IOException;
36
+import java.net.URISyntaxException;
37
+import java.security.PrivateKey;
38
+import java.security.Signature;
39
+import java.util.Base64;
40
+import java.util.HashMap;
41
+import java.util.Map;
42
+
43
+@Component
44
+@Slf4j
45
+@TradePlatform(Platform.WX)
46
+public class WxPayElegentTrade implements ElegentTrade {
47
+
48
+    @Autowired
49
+    private WxpayConfig wxpayConfig;
50
+
51
+    @Autowired
52
+    private CallbackConfig callbackConfig;
53
+
54
+    /**
55
+     * 创建微信支付订单方法
56
+     * 这里参考官网代码:
57
+     * https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_4_1.shtml   Native下单
58
+     * https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_1.shtml   JSAPI 下单
59
+     * https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_3_1.shtml   H5下单
60
+     * https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_2_1.shtml   APP下单
61
+     * @param payRequest 支付请求
62
+     * @return 支付响应
63
+     * @throws IOException
64
+     */
65
+    @Override
66
+    public PayResponse requestPay(PayRequest payRequest, String tradeType)throws TradeException {
67
+        PayResponse payResponse = new PayResponse(); //返回结果
68
+        try {
69
+            // 请求body参数构建
70
+            Map<String, Object> params = new HashMap<String, Object>() {
71
+                {
72
+                    put("mchid", wxpayConfig.getMchId());
73
+                    put("appid", wxpayConfig.getAppId());
74
+                    put("notify_url", callbackConfig.getDomain()+ PayConstant.CALLBACK_PATH + PayConstant.NOTIFY +"/"+ Platform.WX );
75
+                    put("out_trade_no", payRequest.getOrderSn());
76
+                    put("amount", new HashMap<String, Object>() {
77
+                        {
78
+                            put("total", payRequest.getTotalFee());//金额,单位:分
79
+                            put("currency", "CNY");//人民币
80
+                        }
81
+                    });
82
+                    put("description", payRequest.getBody());
83
+                }
84
+            };
85
+
86
+            if("h5".equals(tradeType)){ //h5
87
+                params.put("scene_info", new HashMap<String, Object>() {
88
+                    {
89
+                        put("payer_client_ip", "127.0.0.1");
90
+                        put("h5_info", new HashMap<String, Object>() {
91
+                            {
92
+                                put("type", "Wap");
93
+                            }
94
+                        });
95
+                    }
96
+                });
97
+            }
98
+            if ("jsapi".equals(tradeType)) {  //如果是小程序支付
99
+                params.put("payer", new HashMap<String, Object>() {
100
+                    {
101
+                        put("openid", payRequest.getOpenid());
102
+                    }
103
+                });
104
+            }
105
+
106
+
107
+            String url = WxpayConstant.createOrder + tradeType; //创建订单
108
+            log.info("elegent-pay 请求参数{}",params);
109
+            Map<String, String> map = postApiTemplate(url, params);
110
+
111
+            if("SUCCESS".equals( map.get("code") )){
112
+                payResponse.setOrder_sn(payRequest.getOrderSn());
113
+                payResponse.setSuccess(true);
114
+                payResponse.setCode_url(map.get("code_url"));
115
+                payResponse.setMessage(map.get("message"));
116
+
117
+                payResponse.setPrepay_id(map.get("prepay_id"));
118
+                payResponse.setH5_url( map.get("h5_url") );
119
+
120
+                payResponse.setExpand(map); //全部数据
121
+
122
+                if("jsapi".equals(tradeType)){//如果是小程序,需要封装到Expand
123
+                    Map<String, String> data=new HashMap<>();
124
+                    String timeStamp = String.valueOf(System.currentTimeMillis() / 1000);
125
+                    String nonceStr = IdUtil.simpleUUID();
126
+                    String packages = "prepay_id=" + payResponse.getPrepay_id();
127
+                    String privateKey = FileUtil.readToStr("wxpay_private.key");
128
+                    String paySign = this.createPaySign(wxpayConfig.getAppId(), timeStamp, nonceStr, packages, privateKey);
129
+                    data.put("appId", wxpayConfig.getAppId());// appid
130
+                    data.put("timeStamp", timeStamp);// 时间戳
131
+                    data.put("nonceStr", nonceStr);// 随机字符串
132
+                    data.put("package","prepay_id="+payResponse.getPrepay_id());
133
+                    data.put("signType", "RSA");// 签名类型,默认为RSA,仅支持RSA
134
+                    data.put("paySign", paySign);// 签名
135
+                    data.put("orderNo",payRequest.getOrderSn());
136
+                    payResponse.setJsapiData(data);
137
+                }
138
+
139
+
140
+                log.info("createOrder: {}", payResponse);
141
+
142
+            }else{
143
+                payResponse.setSuccess(false);
144
+                payResponse.setMessage( map.get("message") );
145
+            }
146
+            return payResponse;
147
+        }catch (Exception e){
148
+            e.printStackTrace();
149
+            payResponse.setSuccess(false);
150
+        }
151
+        return payResponse;
152
+    }
153
+
154
+
155
+    /**
156
+     * 关闭订单
157
+     * 参考官网代码
158
+     * https://pay.weixin.qq.com/wiki/doc/apiv3/open/pay/chapter2_7_2.shtml 3.2.5. 【服务端】关闭订单
159
+     * @return
160
+     */
161
+    @Override
162
+    public Boolean closePay(String orderSn) throws TradeException {
163
+        // 请求body参数构建
164
+        Map<String, Object> params = new HashMap<String, Object>();
165
+        params.put("mchid", wxpayConfig.getMchId());
166
+        String url = WxpayConstant.closeOrder.replaceAll("\\{out_trade_no\\}",orderSn);
167
+        Map map = postApiTemplate(url, params);
168
+        if("SUCCESS".equals(  map.get("code"))){
169
+            return true;
170
+        }else{
171
+            return false;
172
+        }
173
+    }
174
+
175
+
176
+    /**
177
+     * 退款
178
+     * 参考官网代码 https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_3_9.shtml
179
+     * @param refundRequest
180
+     * @return
181
+     */
182
+    @Override
183
+    public Boolean refund(RefundRequest refundRequest) {
184
+        // 请求body参数构建
185
+        // 请求body参数构建
186
+        Map<String, Object> params = new HashMap<String, Object>();
187
+        params.put("notify_url", callbackConfig.getDomain()+ PayConstant.CALLBACK_PATH +PayConstant.REFUND_NOTIFY +"/"+ Platform.WX    );  //回调地址
188
+        params.put("out_trade_no", refundRequest.getOrderSn());//订单编号
189
+        //out_refund_no
190
+        params.put("out_refund_no", refundRequest.getRequestNo());//退款申请单编号  (多次退款需要不一样才行)
191
+        params.put("amount", new HashMap<String, Object>() {
192
+            {
193
+                put("refund",refundRequest.getRefundAmount());//退款金额
194
+                put("total", refundRequest.getTotalFee());//原金额,单位:分
195
+                put("currency", "CNY");//人民币
196
+            }
197
+        });
198
+        String url = WxpayConstant.refund;  //创建订单
199
+        Map map = postApiTemplate(url, params);
200
+        if("SUCCESS".equals(  map.get("code"))){
201
+
202
+            return true;
203
+        }else{
204
+            return false;
205
+        }
206
+    }
207
+
208
+
209
+
210
+    /**
211
+     * 手动查询订单
212
+     * 参考官网代码: https://pay.weixin.qq.com/wiki/doc/apiv3/open/pay/chapter2_6_2.shtml   3.2.4. 【服务端】查询订单
213
+     * @param orderSn
214
+     * @return
215
+     */
216
+    @Override
217
+    public QueryResponse queryTradingOrderNo(String orderSn) throws TradeException {
218
+        // 请求body参数构建
219
+        Map<String, String> params = new HashMap<String, String>();
220
+        params.put("mchid", wxpayConfig.getMchId());
221
+        String url = WxpayConstant.queryOrderNo+orderSn;;
222
+        try {
223
+            Map map = getApiTemplate(url, params);
224
+            QueryResponse queryResponse=new QueryResponse();
225
+            queryResponse.setOrder_sn((String)map.get("out_trade_no")  ); //订单号
226
+            queryResponse.setTransaction_id((String)map.get("transaction_id") ); //交易单类型
227
+            queryResponse.setTrade_state(   (String) map.get("trade_state") );//交易状态
228
+            Map amount = (Map)map.get("amount");
229
+            if(amount!=null){
230
+                queryResponse.setTotal( (Integer) amount.get("total")  ); //总金额
231
+            }
232
+            Map payer= (Map)map.get("payer");
233
+            if(payer!=null){
234
+                queryResponse.setOpenid(  (String)payer.get("openid")  );
235
+            }
236
+            queryResponse.setExpand(map);//全部数据
237
+            return queryResponse;
238
+
239
+        } catch (URISyntaxException e) {
240
+            throw new RuntimeException(e);
241
+        } catch (IOException e) {
242
+            throw new RuntimeException(e);
243
+        }
244
+
245
+    }
246
+
247
+
248
+    /**
249
+     * 查询退款订单
250
+     * https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_4_10.shtml
251
+     * @param out_refund_no
252
+     * @return
253
+     * @throws TradeException
254
+     */
255
+    @Override
256
+    public QueryRefundResponse queryRefundTrading(String out_refund_no) throws TradeException {
257
+
258
+        // 请求body参数构建
259
+        Map<String, String> params = new HashMap<String, String>();
260
+        String url = WxpayConstant.queryRufundOrderNo + out_refund_no;
261
+        try {
262
+            Map map = getApiTemplate(url, params);
263
+            QueryRefundResponse queryRefundResponse=new QueryRefundResponse();
264
+            queryRefundResponse.setOrder_sn( (String) map.get("out_trade_no") );
265
+            queryRefundResponse.setTransaction_id(   (String) map.get("transaction_id") );
266
+            Map amount = (Map)map.get("amount");
267
+            queryRefundResponse.setTotal( (Integer) amount.get("total")  ); //总金额
268
+            queryRefundResponse.setRefund((Integer) amount.get("payer_refund")   ); //退款金额
269
+            queryRefundResponse.setRefund_id((String) map.get("refund_id")  );  //退款单号
270
+            queryRefundResponse.setOut_refund_no( (String) map.get("out_refund_no")    );//退款订单号
271
+
272
+            queryRefundResponse.setChannel(  (String) map.get("channel")  );  //通道
273
+            queryRefundResponse.setUser_received_account(  (String) map.get("user_received_account") ); //账号
274
+            queryRefundResponse.setStatus(   (String) map.get("status")  ); //状态
275
+            queryRefundResponse.setSuccess_time(  (String) map.get("success_time")  );
276
+            queryRefundResponse.setExpand(map);
277
+            return queryRefundResponse;
278
+        } catch (URISyntaxException e) {
279
+            throw new RuntimeException(e);
280
+        } catch (IOException e) {
281
+            throw new RuntimeException(e);
282
+        }
283
+    }
284
+
285
+    @Override
286
+    public String getOpenid(String code) {
287
+        String getOpenIdUrl = "https://api.weixin.qq.com/sns/jscode2session?" +
288
+                "appid="+wxpayConfig.getAppId()
289
+                +"&secret="+wxpayConfig.getAppSecret()
290
+                +"&js_code="+code+"&grant_type=authorization_code";
291
+        RestTemplate restTemplate = new RestTemplate();
292
+        String respResult = restTemplate.getForObject(getOpenIdUrl,String.class);
293
+        log.info("获取openid的url:{},respResult:{}",getOpenIdUrl,respResult);
294
+        if( respResult==null || "".equals(respResult)  ) return "";
295
+        try{
296
+
297
+            Map<String,String> map = JSON.parseObject(respResult, Map.class);
298
+            String errorCode = map.get("errcode") ;
299
+            if(errorCode!=null && !"".equals(errorCode)){
300
+                int errorCodeInt = Integer.valueOf(errorCode).intValue();
301
+
302
+                log.info("获取openid的errorCode,{}",errorCodeInt);
303
+                if(errorCodeInt != 0) return "";
304
+            }
305
+            return map.get("openid");
306
+        }catch (Exception ex){
307
+            ex.printStackTrace();
308
+            return "";
309
+        }
310
+    }
311
+
312
+
313
+    private Map getApiTemplate(String url, Map<String, String> params) throws URISyntaxException, IOException {
314
+        URIBuilder uriBuilder = new URIBuilder(url);
315
+        //添加参数
316
+        for (String key : params.keySet()) {
317
+            uriBuilder.addParameter(key, params.get(key));
318
+        }
319
+        //完成签名并执行请求
320
+        HttpGet httpGet = new HttpGet(uriBuilder.build());
321
+        httpGet.addHeader("Accept", "application/json");
322
+        CloseableHttpClient httpClient = getWxHttpClient();
323
+        CloseableHttpResponse response = httpClient.execute(httpGet);
324
+        return responseTemplate(response);
325
+    }
326
+
327
+
328
+    private Map responseTemplate(CloseableHttpResponse response) {
329
+        Map result = null;
330
+        try {
331
+            int statusCode = response.getStatusLine().getStatusCode();
332
+            if (statusCode == 200) { //处理成功
333
+               // log.info("success,return body = " + EntityUtils.toString(response.getEntity()));
334
+                result = JSON.parseObject(EntityUtils.toString(response.getEntity()), Map.class);
335
+                result.put("code", "SUCCESS");
336
+            } else if (statusCode == 204) { //处理成功,无返回Body
337
+                log.info("success");
338
+                result = new HashMap<String, Object>() {
339
+                    {
340
+                        put("code", "SUCCESS");
341
+                    }
342
+                };
343
+            } else {
344
+                String returnBody = EntityUtils.toString(response.getEntity());
345
+                log.error("failed,resp code = " + statusCode + ",return body = " + returnBody);
346
+                //throw new TradeException("创建本地支付订单失败!"+payDTO.getOrderSn());
347
+                Map<String, String> map = JSON.parseObject(returnBody, Map.class);
348
+                result = new HashMap<String, Object>() {
349
+                    {
350
+                        put("code", "FAIL");
351
+                        put("message", map.get("message"));
352
+                    }
353
+                };
354
+            }
355
+        } catch (Exception e) {
356
+            result = new HashMap<String, Object>() {
357
+                {
358
+                    put("code", "FAIL");
359
+                    put("message", e.getMessage());
360
+                }
361
+            };
362
+        } finally {
363
+            closeConnect(response);
364
+            return result;
365
+        }
366
+    }
367
+
368
+    private Map postApiTemplate(String url, Map<String, Object> params) {
369
+        try {
370
+            HttpPost httpPost = new HttpPost(url);
371
+            StringEntity entity = new StringEntity(JSON.toJSONString(params));
372
+            entity.setContentType("application/json");
373
+            httpPost.setEntity(entity);
374
+            httpPost.setHeader("Accept", "application/json");
375
+            //完成签名并执行请求
376
+            CloseableHttpClient httpClient = getWxHttpClient();
377
+            CloseableHttpResponse response = httpClient.execute(httpPost);
378
+            return responseTemplate( response );
379
+        } catch (IOException e) {
380
+            throw new RuntimeException(e);
381
+        }
382
+
383
+    }
384
+
385
+
386
+    /**
387
+     * 获取微信HTTP连接
388
+     *
389
+     * @return
390
+     */
391
+    private CloseableHttpClient getWxHttpClient() {
392
+        try {
393
+            //这里对秘钥进行加密使用的完全是官网上的代码
394
+            //TODO 参考官网代码 https://pay.weixin.qq.com/wiki/doc/apiv3/open/pay/chapter2_6_2.shtml
395
+            // 加载商户私钥(privateKey:私钥字符串)
396
+            String key = FileUtil.readToStr("wxpay_private.key");
397
+
398
+            PrivateKey merchantPrivateKey = PemUtil
399
+                    .loadPrivateKey(new ByteArrayInputStream(key.getBytes("utf-8")));
400
+            // 加载平台证书(mchId:商户号,mchSerialNo:商户证书序列号,apiV3Key:V3密钥)
401
+            //PrivateKey merchantPrivateKey = keyManager.getPrivateKey("wxpay_private.key");//读取私钥
402
+            PrivateKeySigner privateKeySigner = new PrivateKeySigner(wxpayConfig.getMchSerialNo(), merchantPrivateKey);
403
+            WechatPay2Credentials wechatPay2Credentials = new WechatPay2Credentials(
404
+                    wxpayConfig.getMchId(), privateKeySigner);
405
+            // 向证书管理器增加需要自动更新平台证书的商户信息
406
+            CertificatesManager certificatesManager = CertificatesManager.getInstance();
407
+            certificatesManager.putMerchant(wxpayConfig.getMchId(), wechatPay2Credentials, wxpayConfig.getApiV3Key().getBytes("utf-8"));
408
+            // 初始化httpClient
409
+            return WechatPayHttpClientBuilder.create()
410
+                    .withMerchant(wxpayConfig.getMchId(), wxpayConfig.getMchSerialNo(), merchantPrivateKey)
411
+                    .withValidator(new WechatPay2Validator(certificatesManager.getVerifier(wxpayConfig.getMchId()))).build();
412
+        } catch (Exception e) {
413
+            e.printStackTrace();
414
+            throw new RuntimeException("微信支付--初始化,校验系统参数失败");
415
+        }
416
+
417
+    }
418
+
419
+
420
+    /**
421
+     * 关闭资源
422
+     */
423
+    private void closeConnect(CloseableHttpResponse response) {
424
+        try {
425
+            response.close();
426
+        } catch (Exception e) {
427
+            e.printStackTrace();
428
+            throw new RuntimeException("资源回收出错");
429
+        }
430
+    }
431
+
432
+
433
+    /**
434
+     *  创建支付签名
435
+     * @param appid
436
+     * @param timeStamp
437
+     * @param nonceStr
438
+     * @param packages
439
+     * @param privateKey
440
+     * @return
441
+     * @throws Exception
442
+     */
443
+    private String createPaySign(String appid, String timeStamp, String nonceStr, String packages,String  privateKey) throws Exception {
444
+        Signature sign = Signature.getInstance("SHA256withRSA");
445
+        // 加载商户私钥
446
+        PrivateKey key = PemUtil
447
+                .loadPrivateKey(new ByteArrayInputStream(privateKey.getBytes(CharsetUtil.CHARSET_UTF_8)));
448
+        sign.initSign(key);
449
+        String message = StrUtil.format("{}\n{}\n{}\n{}\n",
450
+                appid,
451
+                timeStamp,
452
+                nonceStr,
453
+                packages);
454
+        sign.update(message.getBytes());
455
+        return Base64.getEncoder().encodeToString(sign.sign());
456
+    }
457
+
458
+
459
+}

+ 153
- 0
pay/src/main/java/com/ruoyi/wx/WxPayElegentValid.java Bestand weergeven

@@ -0,0 +1,153 @@
1
+package com.ruoyi.wx;
2
+
3
+
4
+import com.alibaba.fastjson.JSON;
5
+import com.ruoyi.annotation.TradePlatform;
6
+import com.ruoyi.constant.Platform;
7
+import com.ruoyi.core.ElegentValid;
8
+import com.ruoyi.dto.ValidResponse;
9
+import com.ruoyi.exceptions.TradeException;
10
+import com.wechat.pay.contrib.apache.httpclient.auth.Verifier;
11
+import com.wechat.pay.contrib.apache.httpclient.cert.CertificatesManager;
12
+import com.wechat.pay.contrib.apache.httpclient.notification.Notification;
13
+import com.wechat.pay.contrib.apache.httpclient.notification.NotificationHandler;
14
+import com.wechat.pay.contrib.apache.httpclient.notification.NotificationRequest;
15
+import lombok.extern.slf4j.Slf4j;
16
+import org.springframework.beans.factory.annotation.Autowired;
17
+import org.springframework.http.HttpEntity;
18
+import org.springframework.http.HttpHeaders;
19
+import org.springframework.stereotype.Component;
20
+
21
+import javax.servlet.http.HttpServletRequest;
22
+import java.nio.charset.StandardCharsets;
23
+import java.util.Map;
24
+
25
+@Component
26
+@Slf4j
27
+@TradePlatform(Platform.WX)
28
+public class WxPayElegentValid implements ElegentValid {
29
+
30
+
31
+    @Autowired
32
+    private WxpayConfig wxpayConfig;
33
+
34
+    @Override
35
+    public ValidResponse validPay(HttpEntity<String> httpEntity, HttpServletRequest httpServletRequest) throws TradeException {
36
+        ValidResponse validResponse=new ValidResponse();
37
+
38
+        try {
39
+            //获取请求头
40
+            HttpHeaders headers = httpEntity.getHeaders();
41
+            //构建微信请求数据对象
42
+            NotificationRequest request = new NotificationRequest.Builder()
43
+                    .withSerialNumber(headers.getFirst("Wechatpay-Serial")) //证书序列号(微信平台)
44
+                    .withNonce(headers.getFirst("Wechatpay-Nonce"))  //随机串
45
+                    .withTimestamp(headers.getFirst("Wechatpay-Timestamp")) //时间戳
46
+                    .withSignature(headers.getFirst("Wechatpay-Signature")) //签名字符串
47
+                    .withBody(httpEntity.getBody())
48
+                    .build();
49
+
50
+
51
+            //微信通知的业务处理
52
+            //验证签名,确保请求来自微信
53
+            Map jsonData = null;
54
+            try {
55
+                //确保在管理器中存在自动更新的商户证书
56
+                CertificatesManager certificatesManager = CertificatesManager.getInstance();
57
+                Verifier verifier = certificatesManager.getVerifier(wxpayConfig.getMchId());
58
+
59
+                //验签和解析请求数据
60
+                NotificationHandler notificationHandler = new NotificationHandler(verifier, wxpayConfig.getApiV3Key().getBytes(StandardCharsets.UTF_8));
61
+                Notification notification = notificationHandler.parse(request);
62
+
63
+                if (!"TRANSACTION.SUCCESS".equals(notification.getEventType())) {
64
+                    validResponse.setValid(false);
65
+                    return validResponse;
66
+                }
67
+                //获取解密后的数据
68
+                jsonData =  JSON.parseObject(notification.getDecryptData(),Map.class   );
69
+                log.info("解密后的数据为:"+jsonData);
70
+            } catch (Exception e) {
71
+                throw new TradeException("验签失败");
72
+            }
73
+            if (!"SUCCESS".equals(jsonData.get("trade_state"))) {
74
+                validResponse.setValid(false);
75
+                return validResponse;
76
+            }
77
+            validResponse.setValid(true);
78
+            validResponse.setOrderSn(  (String) jsonData.get("out_trade_no")  ); //订单号
79
+            return validResponse;
80
+        } catch (Exception e) {
81
+            validResponse.setValid(false);
82
+            return validResponse;
83
+        }
84
+    }
85
+
86
+    @Override
87
+    public ValidResponse validRefund(HttpEntity<String> httpEntity, HttpServletRequest httpServletRequest) throws TradeException {
88
+
89
+        ValidResponse validResponse=new ValidResponse();
90
+        try {
91
+            //获取请求头
92
+            HttpHeaders headers = httpEntity.getHeaders();
93
+
94
+            //构建微信请求数据对象
95
+            NotificationRequest request = new NotificationRequest.Builder()
96
+                    .withSerialNumber(headers.getFirst("Wechatpay-Serial")) //证书序列号(微信平台)
97
+                    .withNonce(headers.getFirst("Wechatpay-Nonce"))  //随机串
98
+                    .withTimestamp(headers.getFirst("Wechatpay-Timestamp")) //时间戳
99
+                    .withSignature(headers.getFirst("Wechatpay-Signature")) //签名字符串
100
+                    .withBody(httpEntity.getBody())
101
+                    .build();
102
+
103
+            //微信通知的业务处理
104
+            Map jsonData = null;
105
+            //验证签名,确保请求来自微信
106
+            try {
107
+                //确保在管理器中存在自动更新的商户证书
108
+                CertificatesManager certificatesManager = CertificatesManager.getInstance();
109
+                Verifier verifier = certificatesManager.getVerifier(wxpayConfig.getMchId());
110
+
111
+                //验签和解析请求数据
112
+                NotificationHandler notificationHandler = new NotificationHandler(verifier, wxpayConfig.getApiV3Key().getBytes(StandardCharsets.UTF_8));
113
+                Notification notification = notificationHandler.parse(request);
114
+
115
+                if (!"REFUND.SUCCESS".equals(notification.getEventType())) {
116
+                    //非成功请求直接返回,理论上都是成功的请求
117
+                    validResponse.setValid(false);
118
+                    return validResponse;
119
+                }
120
+                //获取解密后的数据
121
+                jsonData = JSON.parseObject( notification.getDecryptData(),Map.class  );
122
+
123
+
124
+            } catch (Exception e) {
125
+                throw new TradeException("验签失败");
126
+            }
127
+            if (!"SUCCESS".equals(jsonData.get("refund_status"))) {
128
+                //非成功请求直接返回,理论上都是成功的请求
129
+                validResponse.setValid(false);
130
+                return validResponse;
131
+            }
132
+
133
+            //交易单号
134
+            validResponse.setValid(true);
135
+            validResponse.setOrderSn(  (String) jsonData.get("out_trade_no")  ); //订单号
136
+            return validResponse;
137
+        } catch (Exception e) {
138
+            //非成功请求直接返回,理论上都是成功的请求
139
+            validResponse.setValid(false);
140
+            return validResponse;
141
+        }
142
+    }
143
+
144
+    @Override
145
+    public String successResult() {
146
+        return  JSON.toJSONString(WxpayConstant.SUCCESS ) ;
147
+    }
148
+
149
+    @Override
150
+    public String failResult() {
151
+        return JSON.toJSONString( WxpayConstant.FAIL);
152
+    }
153
+}

+ 20
- 0
pay/src/main/java/com/ruoyi/wx/WxpayConfig.java Bestand weergeven

@@ -0,0 +1,20 @@
1
+package com.ruoyi.wx;
2
+import lombok.Data;
3
+import org.springframework.boot.context.properties.ConfigurationProperties;
4
+import org.springframework.stereotype.Component;
5
+
6
+/**
7
+ * 微信权限对接类
8
+ */
9
+@Component
10
+@ConfigurationProperties("elegent.pay.wxpay")
11
+@Data
12
+public class WxpayConfig {
13
+
14
+    private String mchId; //商户号
15
+    private String appId; //APPID
16
+    private String appSecret;//app密钥
17
+    private String mchSerialNo; //商户证书序列号
18
+    private String apiV3Key; //V3密钥
19
+
20
+}

+ 48
- 0
pay/src/main/java/com/ruoyi/wx/WxpayConstant.java Bestand weergeven

@@ -0,0 +1,48 @@
1
+package com.ruoyi.wx;
2
+
3
+import java.util.HashMap;
4
+import java.util.Map;
5
+
6
+public class WxpayConstant {
7
+
8
+    public static final Map SUCCESS = new HashMap<String,Object>(){
9
+        {
10
+            put("code", "SUCCESS");
11
+        }
12
+    };
13
+
14
+    public static final Map FAIL  = new HashMap<String,Object>(){
15
+        {
16
+            put("code", "FAIL");
17
+            put("message","微信回调错误结果");
18
+        }
19
+    };
20
+
21
+
22
+    public final static String domain ="https://api.mch.weixin.qq.com/v3";
23
+
24
+    /**
25
+     * 创建订单
26
+     */
27
+    public final static String createOrder = domain +"/pay/transactions/";
28
+
29
+    /**
30
+     * 关闭订单
31
+     */
32
+    public final static String closeOrder = domain+"/pay/transactions/out-trade-no/{out_trade_no}/close";
33
+
34
+    /**
35
+     * 查询订单编号
36
+     */
37
+    public static String queryOrderNo = domain+"/pay/transactions/out-trade-no/";
38
+
39
+    /**
40
+     * 查询退款订单
41
+     */
42
+    public static String queryRufundOrderNo =domain+ "/refund/domestic/refunds/";
43
+
44
+    /**
45
+     * 退款接口
46
+     */
47
+    public static String refund = domain+"/refund/domestic/refunds";
48
+}

+ 14
- 0
pay/src/main/resources/META-INF/spring.factories Bestand weergeven

@@ -0,0 +1,14 @@
1
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
2
+  com.ruoyi.config.CallbackConfig,\
3
+  com.ruoyi.core.CallbackWatch,\
4
+  com.ruoyi.core.ElegentPayImpl,\
5
+  com.ruoyi.core.ElegentLoader,\
6
+  com.ruoyi.core.ElegentConfig,\
7
+  com.ruoyi.key.impl.DefaultKeyManager,\
8
+  com.ruoyi.core.CallbackController,\
9
+  com.ruoyi.wx.WxpayConfig,\
10
+  com.ruoyi.wx.WxPayElegentTrade,\
11
+  com.ruoyi.wx.WxPayElegentValid,\
12
+  com.ruoyi.ali.AlipayConfig,\
13
+  com.ruoyi.ali.AlipayElegentTrade,\
14
+  com.ruoyi.ali.AlipayElegentValid

+ 231
- 0
pom.xml Bestand weergeven

@@ -0,0 +1,231 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project xmlns="http://maven.apache.org/POM/4.0.0"
3
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
+	<modelVersion>4.0.0</modelVersion>
6
+	
7
+    <groupId>com.ruoyi</groupId>
8
+    <artifactId>ruoyi</artifactId>
9
+    <version>3.8.6</version>
10
+
11
+    <name>ruoyi</name>
12
+    <url>http://www.ruoyi.vip</url>
13
+    <description>若依管理系统</description>
14
+    
15
+    <properties>
16
+        <ruoyi.version>3.8.6</ruoyi.version>
17
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
18
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
19
+        <java.version>1.8</java.version>
20
+        <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
21
+        <druid.version>1.2.16</druid.version>
22
+        <bitwalker.version>1.21</bitwalker.version>
23
+        <swagger.version>3.0.0</swagger.version>
24
+        <kaptcha.version>2.3.3</kaptcha.version>
25
+        <pagehelper.boot.version>1.4.6</pagehelper.boot.version>
26
+        <fastjson.version>2.0.39</fastjson.version>
27
+        <oshi.version>6.4.4</oshi.version>
28
+        <commons.io.version>2.13.0</commons.io.version>
29
+        <commons.collections.version>3.2.2</commons.collections.version>
30
+        <poi.version>4.1.2</poi.version>
31
+        <velocity.version>2.3</velocity.version>
32
+        <jwt.version>0.9.1</jwt.version>
33
+    </properties>
34
+
35
+    <!-- 依赖声明 -->
36
+    <dependencyManagement>
37
+        <dependencies>
38
+
39
+            <!-- SpringBoot的依赖配置-->
40
+            <dependency>
41
+                <groupId>org.springframework.boot</groupId>
42
+                <artifactId>spring-boot-dependencies</artifactId>
43
+                <version>2.5.15</version>
44
+                <type>pom</type>
45
+                <scope>import</scope>
46
+            </dependency>
47
+
48
+            <!-- 阿里数据库连接池 -->
49
+            <dependency>
50
+                <groupId>com.alibaba</groupId>
51
+                <artifactId>druid-spring-boot-starter</artifactId>
52
+                <version>${druid.version}</version>
53
+            </dependency>
54
+
55
+            <!-- 解析客户端操作系统、浏览器等 -->
56
+            <dependency>
57
+                <groupId>eu.bitwalker</groupId>
58
+                <artifactId>UserAgentUtils</artifactId>
59
+                <version>${bitwalker.version}</version>
60
+            </dependency>
61
+
62
+            <!-- pagehelper 分页插件 -->
63
+            <dependency>
64
+                <groupId>com.github.pagehelper</groupId>
65
+                <artifactId>pagehelper-spring-boot-starter</artifactId>
66
+                <version>${pagehelper.boot.version}</version>
67
+            </dependency>
68
+
69
+            <!-- 获取系统信息 -->
70
+            <dependency>
71
+                <groupId>com.github.oshi</groupId>
72
+                <artifactId>oshi-core</artifactId>
73
+                <version>${oshi.version}</version>
74
+            </dependency>
75
+
76
+            <!-- Swagger3依赖 -->
77
+            <dependency>
78
+                <groupId>io.springfox</groupId>
79
+                <artifactId>springfox-boot-starter</artifactId>
80
+                <version>${swagger.version}</version>
81
+                <exclusions>
82
+                    <exclusion>
83
+                        <groupId>io.swagger</groupId>
84
+                        <artifactId>swagger-models</artifactId>
85
+                    </exclusion>
86
+                </exclusions>
87
+            </dependency>
88
+
89
+            <!-- io常用工具类 -->
90
+            <dependency>
91
+                <groupId>commons-io</groupId>
92
+                <artifactId>commons-io</artifactId>
93
+                <version>${commons.io.version}</version>
94
+            </dependency>
95
+
96
+            <!-- excel工具 -->
97
+            <dependency>
98
+                <groupId>org.apache.poi</groupId>
99
+                <artifactId>poi-ooxml</artifactId>
100
+                <version>${poi.version}</version>
101
+            </dependency>
102
+
103
+            <!-- velocity代码生成使用模板 -->
104
+            <dependency>
105
+                <groupId>org.apache.velocity</groupId>
106
+                <artifactId>velocity-engine-core</artifactId>
107
+                <version>${velocity.version}</version>
108
+            </dependency>
109
+
110
+            <!-- collections工具类 -->
111
+            <dependency>
112
+                <groupId>commons-collections</groupId>
113
+                <artifactId>commons-collections</artifactId>
114
+                <version>${commons.collections.version}</version>
115
+            </dependency>
116
+
117
+            <!-- 阿里JSON解析器 -->
118
+            <dependency>
119
+                <groupId>com.alibaba.fastjson2</groupId>
120
+                <artifactId>fastjson2</artifactId>
121
+                <version>${fastjson.version}</version>
122
+            </dependency>
123
+
124
+            <!-- Token生成与解析-->
125
+            <dependency>
126
+                <groupId>io.jsonwebtoken</groupId>
127
+                <artifactId>jjwt</artifactId>
128
+                <version>${jwt.version}</version>
129
+            </dependency>
130
+
131
+            <!-- 验证码 -->
132
+            <dependency>
133
+                <groupId>pro.fessional</groupId>
134
+                <artifactId>kaptcha</artifactId>
135
+                <version>${kaptcha.version}</version>
136
+            </dependency>
137
+
138
+            <!-- 定时任务-->
139
+            <dependency>
140
+                <groupId>com.ruoyi</groupId>
141
+                <artifactId>ruoyi-quartz</artifactId>
142
+                <version>${ruoyi.version}</version>
143
+            </dependency>
144
+
145
+            <!-- 代码生成-->
146
+            <dependency>
147
+                <groupId>com.ruoyi</groupId>
148
+                <artifactId>ruoyi-generator</artifactId>
149
+                <version>${ruoyi.version}</version>
150
+            </dependency>
151
+
152
+            <!-- 核心模块-->
153
+            <dependency>
154
+                <groupId>com.ruoyi</groupId>
155
+                <artifactId>ruoyi-framework</artifactId>
156
+                <version>${ruoyi.version}</version>
157
+            </dependency>
158
+
159
+            <!-- 系统模块-->
160
+            <dependency>
161
+                <groupId>com.ruoyi</groupId>
162
+                <artifactId>ruoyi-system</artifactId>
163
+                <version>${ruoyi.version}</version>
164
+            </dependency>
165
+
166
+            <!-- 通用工具-->
167
+            <dependency>
168
+                <groupId>com.ruoyi</groupId>
169
+                <artifactId>ruoyi-common</artifactId>
170
+                <version>${ruoyi.version}</version>
171
+            </dependency>
172
+
173
+        </dependencies>
174
+    </dependencyManagement>
175
+
176
+    <modules>
177
+        <module>ruoyi-admin</module>
178
+        <module>ruoyi-framework</module>
179
+        <module>ruoyi-system</module>
180
+        <module>ruoyi-quartz</module>
181
+        <module>ruoyi-generator</module>
182
+        <module>ruoyi-common</module>
183
+        <module>pay</module>
184
+    </modules>
185
+    <packaging>pom</packaging>
186
+
187
+    <build>
188
+        <plugins>
189
+            <plugin>
190
+                <groupId>org.apache.maven.plugins</groupId>
191
+                <artifactId>maven-compiler-plugin</artifactId>
192
+                <version>3.1</version>
193
+                <configuration>
194
+                    <source>${java.version}</source>
195
+                    <target>${java.version}</target>
196
+                    <encoding>${project.build.sourceEncoding}</encoding>
197
+                    <excludes>
198
+                        <exclude>ruoyi-system/**</exclude>
199
+                        <exclude>ruoyi-common/**</exclude>
200
+                    </excludes>
201
+                </configuration>
202
+            </plugin>
203
+        </plugins>
204
+    </build>
205
+
206
+    <repositories>
207
+        <repository>
208
+            <id>public</id>
209
+            <name>aliyun nexus</name>
210
+            <url>https://maven.aliyun.com/repository/public</url>
211
+            <releases>
212
+                <enabled>true</enabled>
213
+            </releases>
214
+        </repository>
215
+    </repositories>
216
+
217
+    <pluginRepositories>
218
+        <pluginRepository>
219
+            <id>public</id>
220
+            <name>aliyun nexus</name>
221
+            <url>https://maven.aliyun.com/repository/public</url>
222
+            <releases>
223
+                <enabled>true</enabled>
224
+            </releases>
225
+            <snapshots>
226
+                <enabled>false</enabled>
227
+            </snapshots>
228
+        </pluginRepository>
229
+    </pluginRepositories>
230
+
231
+</project>

+ 100
- 0
ruoyi-admin/pom.xml Bestand weergeven

@@ -0,0 +1,100 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project xmlns="http://maven.apache.org/POM/4.0.0"
3
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
+    <parent>
6
+        <artifactId>ruoyi</artifactId>
7
+        <groupId>com.ruoyi</groupId>
8
+        <version>3.8.6</version>
9
+    </parent>
10
+    <modelVersion>4.0.0</modelVersion>
11
+    <packaging>jar</packaging>
12
+    <artifactId>ruoyi-admin</artifactId>
13
+
14
+    <description>
15
+        web服务入口
16
+    </description>
17
+
18
+    <dependencies>
19
+
20
+        <!-- spring-boot-devtools -->
21
+        <dependency>
22
+            <groupId>org.springframework.boot</groupId>
23
+            <artifactId>spring-boot-devtools</artifactId>
24
+            <optional>true</optional> <!-- 表示依赖不会传递 -->
25
+        </dependency>
26
+
27
+        <!-- swagger3-->
28
+        <dependency>
29
+            <groupId>io.springfox</groupId>
30
+            <artifactId>springfox-boot-starter</artifactId>
31
+        </dependency>
32
+
33
+        <!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 -->
34
+        <dependency>
35
+            <groupId>io.swagger</groupId>
36
+            <artifactId>swagger-models</artifactId>
37
+            <version>1.6.2</version>
38
+        </dependency>
39
+
40
+         <!-- Mysql驱动包 -->
41
+        <dependency>
42
+            <groupId>mysql</groupId>
43
+            <artifactId>mysql-connector-java</artifactId>
44
+        </dependency>
45
+
46
+        <!-- 核心模块-->
47
+        <dependency>
48
+            <groupId>com.ruoyi</groupId>
49
+            <artifactId>ruoyi-framework</artifactId>
50
+        </dependency>
51
+
52
+        <!-- 定时任务-->
53
+        <dependency>
54
+            <groupId>com.ruoyi</groupId>
55
+            <artifactId>ruoyi-quartz</artifactId>
56
+        </dependency>
57
+
58
+        <!-- 代码生成-->
59
+        <dependency>
60
+            <groupId>com.ruoyi</groupId>
61
+            <artifactId>ruoyi-generator</artifactId>
62
+        </dependency>
63
+        <dependency>
64
+            <groupId>com.ruoyi</groupId>
65
+            <artifactId>pay</artifactId>
66
+            <version>1.0.0-SNAPSHOT</version>
67
+        </dependency>
68
+    </dependencies>
69
+
70
+    <build>
71
+        <plugins>
72
+            <plugin>
73
+                <groupId>org.springframework.boot</groupId>
74
+                <artifactId>spring-boot-maven-plugin</artifactId>
75
+                <version>2.5.15</version>
76
+                <configuration>
77
+                    <fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
78
+                </configuration>
79
+                <executions>
80
+                    <execution>
81
+                        <goals>
82
+                            <goal>repackage</goal>
83
+                        </goals>
84
+                    </execution>
85
+                </executions>
86
+            </plugin>
87
+            <plugin>   
88
+                <groupId>org.apache.maven.plugins</groupId>   
89
+                <artifactId>maven-war-plugin</artifactId>   
90
+                <version>3.1.0</version>   
91
+                <configuration>
92
+                    <failOnMissingWebXml>false</failOnMissingWebXml>
93
+                    <warName>${project.artifactId}</warName>
94
+                </configuration>   
95
+           </plugin>   
96
+        </plugins>
97
+        <finalName>${project.artifactId}</finalName>
98
+    </build>
99
+
100
+</project>

+ 32
- 0
ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java Bestand weergeven

@@ -0,0 +1,32 @@
1
+package com.ruoyi;
2
+
3
+import org.springframework.boot.SpringApplication;
4
+import org.springframework.boot.autoconfigure.SpringBootApplication;
5
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
6
+import org.springframework.scheduling.annotation.EnableScheduling;
7
+
8
+/**
9
+ * 启动程序
10
+ * 
11
+ * @author ruoyi
12
+ */
13
+@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
14
+@EnableScheduling
15
+public class RuoYiApplication
16
+{
17
+    public static void main(String[] args)
18
+    {
19
+        // System.setProperty("spring.devtools.restart.enabled", "false");
20
+        SpringApplication.run(RuoYiApplication.class, args);
21
+        System.out.println("(♥◠‿◠)ノ゙  若依启动成功   ლ(´ڡ`ლ)゙  \n" +
22
+                " .-------.       ____     __        \n" +
23
+                " |  _ _   \\      \\   \\   /  /    \n" +
24
+                " | ( ' )  |       \\  _. /  '       \n" +
25
+                " |(_ o _) /        _( )_ .'         \n" +
26
+                " | (_,_).' __  ___(_ o _)'          \n" +
27
+                " |  |\\ \\  |  ||   |(_,_)'         \n" +
28
+                " |  | \\ `'   /|   `-'  /           \n" +
29
+                " |  |  \\    /  \\      /           \n" +
30
+                " ''-'   `'-'    `-..-'              ");
31
+    }
32
+}

+ 18
- 0
ruoyi-admin/src/main/java/com/ruoyi/RuoYiServletInitializer.java Bestand weergeven

@@ -0,0 +1,18 @@
1
+package com.ruoyi;
2
+
3
+import org.springframework.boot.builder.SpringApplicationBuilder;
4
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
5
+
6
+/**
7
+ * web容器中进行部署
8
+ * 
9
+ * @author ruoyi
10
+ */
11
+public class RuoYiServletInitializer extends SpringBootServletInitializer
12
+{
13
+    @Override
14
+    protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
15
+    {
16
+        return application.sources(RuoYiApplication.class);
17
+    }
18
+}

+ 33
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/bestsign/ArbitrSignatuController.java Bestand weergeven

@@ -0,0 +1,33 @@
1
+package com.ruoyi.web.controller.bestsign;
2
+
3
+import com.ruoyi.bestsign.domain.ArbitrSignatuVO;
4
+import com.ruoyi.bestsign.domain.PersonRegisterVO;
5
+import com.ruoyi.bestsign.service.ArbitrSignatuService;
6
+import com.ruoyi.common.core.domain.AjaxResult;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.validation.annotation.Validated;
9
+import org.springframework.web.bind.annotation.PostMapping;
10
+import org.springframework.web.bind.annotation.RequestBody;
11
+import org.springframework.web.bind.annotation.RequestMapping;
12
+import org.springframework.web.bind.annotation.RestController;
13
+
14
+@RestController
15
+@RequestMapping("/arbitrSignatu")
16
+public class ArbitrSignatuController {
17
+    @Autowired
18
+    ArbitrSignatuService arbitrSignatuService;
19
+
20
+    /**
21
+     * 申请状态查询
22
+     *
23
+     * @param arbitrSignatuVO
24
+     * @return
25
+     */
26
+    @PostMapping("/selectApplyStatus")
27
+    public AjaxResult selectApplyStatus (@Validated @RequestBody ArbitrSignatuVO arbitrSignatuVO) {
28
+        return arbitrSignatuService.selectApplyStatus(arbitrSignatuVO);
29
+    }
30
+
31
+
32
+
33
+}

+ 31
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/bestsign/RegisterController.java Bestand weergeven

@@ -0,0 +1,31 @@
1
+package com.ruoyi.web.controller.bestsign;
2
+
3
+import com.ruoyi.bestsign.domain.PersonRegisterVO;
4
+import com.ruoyi.bestsign.service.SignRegisterService;
5
+import com.ruoyi.common.core.domain.AjaxResult;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.validation.annotation.Validated;
8
+import org.springframework.web.bind.annotation.PostMapping;
9
+import org.springframework.web.bind.annotation.RequestBody;
10
+import org.springframework.web.bind.annotation.RequestMapping;
11
+import org.springframework.web.bind.annotation.RestController;
12
+
13
+@RestController
14
+@RequestMapping("/register")
15
+public class RegisterController {
16
+    @Autowired
17
+    SignRegisterService signRegisterService;
18
+
19
+    /**
20
+     * 注册上上签个人用户
21
+     *
22
+     * @param personRegisterVO
23
+     * @return
24
+     */
25
+    @PostMapping("/registerPerson")
26
+    public AjaxResult createDocument(@Validated @RequestBody PersonRegisterVO personRegisterVO) {
27
+        return signRegisterService.registerPerson(personRegisterVO);
28
+    }
29
+//    @PostMapping("/registerEnterprise")
30
+//    public AjaxResult
31
+}

+ 94
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java Bestand weergeven

@@ -0,0 +1,94 @@
1
+package com.ruoyi.web.controller.common;
2
+
3
+import java.awt.image.BufferedImage;
4
+import java.io.IOException;
5
+import java.util.concurrent.TimeUnit;
6
+import javax.annotation.Resource;
7
+import javax.imageio.ImageIO;
8
+import javax.servlet.http.HttpServletResponse;
9
+import org.springframework.beans.factory.annotation.Autowired;
10
+import org.springframework.util.FastByteArrayOutputStream;
11
+import org.springframework.web.bind.annotation.GetMapping;
12
+import org.springframework.web.bind.annotation.RestController;
13
+import com.google.code.kaptcha.Producer;
14
+import com.ruoyi.common.config.RuoYiConfig;
15
+import com.ruoyi.common.constant.CacheConstants;
16
+import com.ruoyi.common.constant.Constants;
17
+import com.ruoyi.common.core.domain.AjaxResult;
18
+import com.ruoyi.common.core.redis.RedisCache;
19
+import com.ruoyi.common.utils.sign.Base64;
20
+import com.ruoyi.common.utils.uuid.IdUtils;
21
+import com.ruoyi.system.service.ISysConfigService;
22
+
23
+/**
24
+ * 验证码操作处理
25
+ * 
26
+ * @author ruoyi
27
+ */
28
+@RestController
29
+public class CaptchaController
30
+{
31
+    @Resource(name = "captchaProducer")
32
+    private Producer captchaProducer;
33
+
34
+    @Resource(name = "captchaProducerMath")
35
+    private Producer captchaProducerMath;
36
+
37
+    @Autowired
38
+    private RedisCache redisCache;
39
+    
40
+    @Autowired
41
+    private ISysConfigService configService;
42
+    /**
43
+     * 生成验证码
44
+     */
45
+    @GetMapping("/captchaImage")
46
+    public AjaxResult getCode(HttpServletResponse response) throws IOException
47
+    {
48
+        AjaxResult ajax = AjaxResult.success();
49
+        boolean captchaEnabled = configService.selectCaptchaEnabled();
50
+        ajax.put("captchaEnabled", captchaEnabled);
51
+        if (!captchaEnabled)
52
+        {
53
+            return ajax;
54
+        }
55
+
56
+        // 保存验证码信息
57
+        String uuid = IdUtils.simpleUUID();
58
+        String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
59
+
60
+        String capStr = null, code = null;
61
+        BufferedImage image = null;
62
+
63
+        // 生成验证码
64
+        String captchaType = RuoYiConfig.getCaptchaType();
65
+        if ("math".equals(captchaType))
66
+        {
67
+            String capText = captchaProducerMath.createText();
68
+            capStr = capText.substring(0, capText.lastIndexOf("@"));
69
+            code = capText.substring(capText.lastIndexOf("@") + 1);
70
+            image = captchaProducerMath.createImage(capStr);
71
+        }
72
+        else if ("char".equals(captchaType))
73
+        {
74
+            capStr = code = captchaProducer.createText();
75
+            image = captchaProducer.createImage(capStr);
76
+        }
77
+
78
+        redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
79
+        // 转换流信息写出
80
+        FastByteArrayOutputStream os = new FastByteArrayOutputStream();
81
+        try
82
+        {
83
+            ImageIO.write(image, "jpg", os);
84
+        }
85
+        catch (IOException e)
86
+        {
87
+            return AjaxResult.error(e.getMessage());
88
+        }
89
+
90
+        ajax.put("uuid", uuid);
91
+        ajax.put("img", Base64.encode(os.toByteArray()));
92
+        return ajax;
93
+    }
94
+}

+ 163
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java Bestand weergeven

@@ -0,0 +1,163 @@
1
+package com.ruoyi.web.controller.common;
2
+
3
+import java.util.ArrayList;
4
+import java.util.List;
5
+import javax.servlet.http.HttpServletRequest;
6
+import javax.servlet.http.HttpServletResponse;
7
+import org.slf4j.Logger;
8
+import org.slf4j.LoggerFactory;
9
+import org.springframework.beans.factory.annotation.Autowired;
10
+import org.springframework.http.MediaType;
11
+import org.springframework.web.bind.annotation.GetMapping;
12
+import org.springframework.web.bind.annotation.PostMapping;
13
+import org.springframework.web.bind.annotation.RequestMapping;
14
+import org.springframework.web.bind.annotation.RestController;
15
+import org.springframework.web.multipart.MultipartFile;
16
+import com.ruoyi.common.config.RuoYiConfig;
17
+import com.ruoyi.common.constant.Constants;
18
+import com.ruoyi.common.core.domain.AjaxResult;
19
+import com.ruoyi.common.utils.StringUtils;
20
+import com.ruoyi.common.utils.file.FileUploadUtils;
21
+import com.ruoyi.common.utils.file.FileUtils;
22
+import com.ruoyi.framework.config.ServerConfig;
23
+
24
+/**
25
+ * 通用请求处理
26
+ * 
27
+ * @author ruoyi
28
+ */
29
+@RestController
30
+@RequestMapping("/common")
31
+public class CommonController
32
+{
33
+    private static final Logger log = LoggerFactory.getLogger(CommonController.class);
34
+
35
+    @Autowired
36
+    private ServerConfig serverConfig;
37
+
38
+    private static final String FILE_DELIMETER = ",";
39
+
40
+    /**
41
+     * 通用下载请求
42
+     * 
43
+     * @param fileName 文件名称
44
+     * @param delete 是否删除
45
+     */
46
+    @GetMapping("/download")
47
+    public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
48
+    {
49
+        try
50
+        {
51
+            if (!FileUtils.checkAllowDownload(fileName))
52
+            {
53
+                throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
54
+            }
55
+            String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
56
+            String filePath = RuoYiConfig.getDownloadPath() + fileName;
57
+
58
+            response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
59
+            FileUtils.setAttachmentResponseHeader(response, realFileName);
60
+            FileUtils.writeBytes(filePath, response.getOutputStream());
61
+            if (delete)
62
+            {
63
+                FileUtils.deleteFile(filePath);
64
+            }
65
+        }
66
+        catch (Exception e)
67
+        {
68
+            log.error("下载文件失败", e);
69
+        }
70
+    }
71
+
72
+    /**
73
+     * 通用上传请求(单个)
74
+     */
75
+    @PostMapping("/upload")
76
+    public AjaxResult uploadFile(MultipartFile file) throws Exception
77
+    {
78
+        try
79
+        {
80
+            // 上传文件路径
81
+            String filePath = RuoYiConfig.getUploadPath();
82
+            // 上传并返回新文件名称
83
+            String fileName = FileUploadUtils.upload(filePath, file);
84
+            String url = serverConfig.getUrl() + fileName;
85
+            AjaxResult ajax = AjaxResult.success();
86
+            ajax.put("url", url);
87
+            ajax.put("fileName", fileName);
88
+            ajax.put("newFileName", FileUtils.getName(fileName));
89
+            ajax.put("originalFilename", file.getOriginalFilename());
90
+            return ajax;
91
+        }
92
+        catch (Exception e)
93
+        {
94
+            return AjaxResult.error(e.getMessage());
95
+        }
96
+    }
97
+
98
+    /**
99
+     * 通用上传请求(多个)
100
+     */
101
+    @PostMapping("/uploads")
102
+    public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception
103
+    {
104
+        try
105
+        {
106
+            // 上传文件路径
107
+            String filePath = RuoYiConfig.getUploadPath();
108
+            List<String> urls = new ArrayList<String>();
109
+            List<String> fileNames = new ArrayList<String>();
110
+            List<String> newFileNames = new ArrayList<String>();
111
+            List<String> originalFilenames = new ArrayList<String>();
112
+            for (MultipartFile file : files)
113
+            {
114
+                // 上传并返回新文件名称
115
+                String fileName = FileUploadUtils.upload(filePath, file);
116
+                String url = serverConfig.getUrl() + fileName;
117
+                urls.add(url);
118
+                fileNames.add(fileName);
119
+                newFileNames.add(FileUtils.getName(fileName));
120
+                originalFilenames.add(file.getOriginalFilename());
121
+            }
122
+            AjaxResult ajax = AjaxResult.success();
123
+            ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
124
+            ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
125
+            ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
126
+            ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
127
+            return ajax;
128
+        }
129
+        catch (Exception e)
130
+        {
131
+            return AjaxResult.error(e.getMessage());
132
+        }
133
+    }
134
+
135
+    /**
136
+     * 本地资源通用下载
137
+     */
138
+    @GetMapping("/download/resource")
139
+    public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
140
+            throws Exception
141
+    {
142
+        try
143
+        {
144
+            if (!FileUtils.checkAllowDownload(resource))
145
+            {
146
+                throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
147
+            }
148
+            // 本地资源路径
149
+            String localPath = RuoYiConfig.getProfile();
150
+            // 数据库资源地址
151
+            String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
152
+            // 下载名称
153
+            String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
154
+            response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
155
+            FileUtils.setAttachmentResponseHeader(response, downloadName);
156
+            FileUtils.writeBytes(downloadPath, response.getOutputStream());
157
+        }
158
+        catch (Exception e)
159
+        {
160
+            log.error("下载文件失败", e);
161
+        }
162
+    }
163
+}

+ 120
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java Bestand weergeven

@@ -0,0 +1,120 @@
1
+package com.ruoyi.web.controller.monitor;
2
+
3
+import java.util.ArrayList;
4
+import java.util.Collection;
5
+import java.util.HashMap;
6
+import java.util.List;
7
+import java.util.Map;
8
+import java.util.Properties;
9
+import java.util.Set;
10
+import org.springframework.beans.factory.annotation.Autowired;
11
+import org.springframework.data.redis.core.RedisCallback;
12
+import org.springframework.data.redis.core.RedisTemplate;
13
+import org.springframework.security.access.prepost.PreAuthorize;
14
+import org.springframework.web.bind.annotation.DeleteMapping;
15
+import org.springframework.web.bind.annotation.GetMapping;
16
+import org.springframework.web.bind.annotation.PathVariable;
17
+import org.springframework.web.bind.annotation.RequestMapping;
18
+import org.springframework.web.bind.annotation.RestController;
19
+import com.ruoyi.common.constant.CacheConstants;
20
+import com.ruoyi.common.core.domain.AjaxResult;
21
+import com.ruoyi.common.utils.StringUtils;
22
+import com.ruoyi.system.domain.SysCache;
23
+
24
+/**
25
+ * 缓存监控
26
+ * 
27
+ * @author ruoyi
28
+ */
29
+@RestController
30
+@RequestMapping("/monitor/cache")
31
+public class CacheController
32
+{
33
+    @Autowired
34
+    private RedisTemplate<String, String> redisTemplate;
35
+
36
+    private final static List<SysCache> caches = new ArrayList<SysCache>();
37
+    {
38
+        caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息"));
39
+        caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息"));
40
+        caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "数据字典"));
41
+        caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码"));
42
+        caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交"));
43
+        caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理"));
44
+        caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数"));
45
+    }
46
+
47
+    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
48
+    @GetMapping()
49
+    public AjaxResult getInfo() throws Exception
50
+    {
51
+        Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
52
+        Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
53
+        Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
54
+
55
+        Map<String, Object> result = new HashMap<>(3);
56
+        result.put("info", info);
57
+        result.put("dbSize", dbSize);
58
+
59
+        List<Map<String, String>> pieList = new ArrayList<>();
60
+        commandStats.stringPropertyNames().forEach(key -> {
61
+            Map<String, String> data = new HashMap<>(2);
62
+            String property = commandStats.getProperty(key);
63
+            data.put("name", StringUtils.removeStart(key, "cmdstat_"));
64
+            data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
65
+            pieList.add(data);
66
+        });
67
+        result.put("commandStats", pieList);
68
+        return AjaxResult.success(result);
69
+    }
70
+
71
+    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
72
+    @GetMapping("/getNames")
73
+    public AjaxResult cache()
74
+    {
75
+        return AjaxResult.success(caches);
76
+    }
77
+
78
+    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
79
+    @GetMapping("/getKeys/{cacheName}")
80
+    public AjaxResult getCacheKeys(@PathVariable String cacheName)
81
+    {
82
+        Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
83
+        return AjaxResult.success(cacheKeys);
84
+    }
85
+
86
+    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
87
+    @GetMapping("/getValue/{cacheName}/{cacheKey}")
88
+    public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
89
+    {
90
+        String cacheValue = redisTemplate.opsForValue().get(cacheKey);
91
+        SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
92
+        return AjaxResult.success(sysCache);
93
+    }
94
+
95
+    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
96
+    @DeleteMapping("/clearCacheName/{cacheName}")
97
+    public AjaxResult clearCacheName(@PathVariable String cacheName)
98
+    {
99
+        Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
100
+        redisTemplate.delete(cacheKeys);
101
+        return AjaxResult.success();
102
+    }
103
+
104
+    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
105
+    @DeleteMapping("/clearCacheKey/{cacheKey}")
106
+    public AjaxResult clearCacheKey(@PathVariable String cacheKey)
107
+    {
108
+        redisTemplate.delete(cacheKey);
109
+        return AjaxResult.success();
110
+    }
111
+
112
+    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
113
+    @DeleteMapping("/clearCacheAll")
114
+    public AjaxResult clearCacheAll()
115
+    {
116
+        Collection<String> cacheKeys = redisTemplate.keys("*");
117
+        redisTemplate.delete(cacheKeys);
118
+        return AjaxResult.success();
119
+    }
120
+}

+ 27
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java Bestand weergeven

@@ -0,0 +1,27 @@
1
+package com.ruoyi.web.controller.monitor;
2
+
3
+import org.springframework.security.access.prepost.PreAuthorize;
4
+import org.springframework.web.bind.annotation.GetMapping;
5
+import org.springframework.web.bind.annotation.RequestMapping;
6
+import org.springframework.web.bind.annotation.RestController;
7
+import com.ruoyi.common.core.domain.AjaxResult;
8
+import com.ruoyi.framework.web.domain.Server;
9
+
10
+/**
11
+ * 服务器监控
12
+ * 
13
+ * @author ruoyi
14
+ */
15
+@RestController
16
+@RequestMapping("/monitor/server")
17
+public class ServerController
18
+{
19
+    @PreAuthorize("@ss.hasPermi('monitor:server:list')")
20
+    @GetMapping()
21
+    public AjaxResult getInfo() throws Exception
22
+    {
23
+        Server server = new Server();
24
+        server.copyTo();
25
+        return AjaxResult.success(server);
26
+    }
27
+}

+ 82
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java Bestand weergeven

@@ -0,0 +1,82 @@
1
+package com.ruoyi.web.controller.monitor;
2
+
3
+import java.util.List;
4
+import javax.servlet.http.HttpServletResponse;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.security.access.prepost.PreAuthorize;
7
+import org.springframework.web.bind.annotation.DeleteMapping;
8
+import org.springframework.web.bind.annotation.GetMapping;
9
+import org.springframework.web.bind.annotation.PathVariable;
10
+import org.springframework.web.bind.annotation.PostMapping;
11
+import org.springframework.web.bind.annotation.RequestMapping;
12
+import org.springframework.web.bind.annotation.RestController;
13
+import com.ruoyi.common.annotation.Log;
14
+import com.ruoyi.common.core.controller.BaseController;
15
+import com.ruoyi.common.core.domain.AjaxResult;
16
+import com.ruoyi.common.core.page.TableDataInfo;
17
+import com.ruoyi.common.enums.BusinessType;
18
+import com.ruoyi.common.utils.poi.ExcelUtil;
19
+import com.ruoyi.framework.web.service.SysPasswordService;
20
+import com.ruoyi.system.domain.SysLogininfor;
21
+import com.ruoyi.system.service.ISysLogininforService;
22
+
23
+/**
24
+ * 系统访问记录
25
+ * 
26
+ * @author ruoyi
27
+ */
28
+@RestController
29
+@RequestMapping("/monitor/logininfor")
30
+public class SysLogininforController extends BaseController
31
+{
32
+    @Autowired
33
+    private ISysLogininforService logininforService;
34
+
35
+    @Autowired
36
+    private SysPasswordService passwordService;
37
+
38
+    @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
39
+    @GetMapping("/list")
40
+    public TableDataInfo list(SysLogininfor logininfor)
41
+    {
42
+        startPage();
43
+        List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
44
+        return getDataTable(list);
45
+    }
46
+
47
+    @Log(title = "登录日志", businessType = BusinessType.EXPORT)
48
+    @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
49
+    @PostMapping("/export")
50
+    public void export(HttpServletResponse response, SysLogininfor logininfor)
51
+    {
52
+        List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
53
+        ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
54
+        util.exportExcel(response, list, "登录日志");
55
+    }
56
+
57
+    @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
58
+    @Log(title = "登录日志", businessType = BusinessType.DELETE)
59
+    @DeleteMapping("/{infoIds}")
60
+    public AjaxResult remove(@PathVariable Long[] infoIds)
61
+    {
62
+        return toAjax(logininforService.deleteLogininforByIds(infoIds));
63
+    }
64
+
65
+    @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
66
+    @Log(title = "登录日志", businessType = BusinessType.CLEAN)
67
+    @DeleteMapping("/clean")
68
+    public AjaxResult clean()
69
+    {
70
+        logininforService.cleanLogininfor();
71
+        return success();
72
+    }
73
+
74
+    @PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')")
75
+    @Log(title = "账户解锁", businessType = BusinessType.OTHER)
76
+    @GetMapping("/unlock/{userName}")
77
+    public AjaxResult unlock(@PathVariable("userName") String userName)
78
+    {
79
+        passwordService.clearLoginRecordCache(userName);
80
+        return success();
81
+    }
82
+}

+ 69
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java Bestand weergeven

@@ -0,0 +1,69 @@
1
+package com.ruoyi.web.controller.monitor;
2
+
3
+import java.util.List;
4
+import javax.servlet.http.HttpServletResponse;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.security.access.prepost.PreAuthorize;
7
+import org.springframework.web.bind.annotation.DeleteMapping;
8
+import org.springframework.web.bind.annotation.GetMapping;
9
+import org.springframework.web.bind.annotation.PathVariable;
10
+import org.springframework.web.bind.annotation.PostMapping;
11
+import org.springframework.web.bind.annotation.RequestMapping;
12
+import org.springframework.web.bind.annotation.RestController;
13
+import com.ruoyi.common.annotation.Log;
14
+import com.ruoyi.common.core.controller.BaseController;
15
+import com.ruoyi.common.core.domain.AjaxResult;
16
+import com.ruoyi.common.core.page.TableDataInfo;
17
+import com.ruoyi.common.enums.BusinessType;
18
+import com.ruoyi.common.utils.poi.ExcelUtil;
19
+import com.ruoyi.system.domain.SysOperLog;
20
+import com.ruoyi.system.service.ISysOperLogService;
21
+
22
+/**
23
+ * 操作日志记录
24
+ * 
25
+ * @author ruoyi
26
+ */
27
+@RestController
28
+@RequestMapping("/monitor/operlog")
29
+public class SysOperlogController extends BaseController
30
+{
31
+    @Autowired
32
+    private ISysOperLogService operLogService;
33
+
34
+    @PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
35
+    @GetMapping("/list")
36
+    public TableDataInfo list(SysOperLog operLog)
37
+    {
38
+        startPage();
39
+        List<SysOperLog> list = operLogService.selectOperLogList(operLog);
40
+        return getDataTable(list);
41
+    }
42
+
43
+    @Log(title = "操作日志", businessType = BusinessType.EXPORT)
44
+    @PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
45
+    @PostMapping("/export")
46
+    public void export(HttpServletResponse response, SysOperLog operLog)
47
+    {
48
+        List<SysOperLog> list = operLogService.selectOperLogList(operLog);
49
+        ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
50
+        util.exportExcel(response, list, "操作日志");
51
+    }
52
+
53
+    @Log(title = "操作日志", businessType = BusinessType.DELETE)
54
+    @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
55
+    @DeleteMapping("/{operIds}")
56
+    public AjaxResult remove(@PathVariable Long[] operIds)
57
+    {
58
+        return toAjax(operLogService.deleteOperLogByIds(operIds));
59
+    }
60
+
61
+    @Log(title = "操作日志", businessType = BusinessType.CLEAN)
62
+    @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
63
+    @DeleteMapping("/clean")
64
+    public AjaxResult clean()
65
+    {
66
+        operLogService.cleanOperLog();
67
+        return success();
68
+    }
69
+}

+ 83
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java Bestand weergeven

@@ -0,0 +1,83 @@
1
+package com.ruoyi.web.controller.monitor;
2
+
3
+import java.util.ArrayList;
4
+import java.util.Collection;
5
+import java.util.Collections;
6
+import java.util.List;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.security.access.prepost.PreAuthorize;
9
+import org.springframework.web.bind.annotation.DeleteMapping;
10
+import org.springframework.web.bind.annotation.GetMapping;
11
+import org.springframework.web.bind.annotation.PathVariable;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RestController;
14
+import com.ruoyi.common.annotation.Log;
15
+import com.ruoyi.common.constant.CacheConstants;
16
+import com.ruoyi.common.core.controller.BaseController;
17
+import com.ruoyi.common.core.domain.AjaxResult;
18
+import com.ruoyi.common.core.domain.model.LoginUser;
19
+import com.ruoyi.common.core.page.TableDataInfo;
20
+import com.ruoyi.common.core.redis.RedisCache;
21
+import com.ruoyi.common.enums.BusinessType;
22
+import com.ruoyi.common.utils.StringUtils;
23
+import com.ruoyi.system.domain.SysUserOnline;
24
+import com.ruoyi.system.service.ISysUserOnlineService;
25
+
26
+/**
27
+ * 在线用户监控
28
+ * 
29
+ * @author ruoyi
30
+ */
31
+@RestController
32
+@RequestMapping("/monitor/online")
33
+public class SysUserOnlineController extends BaseController
34
+{
35
+    @Autowired
36
+    private ISysUserOnlineService userOnlineService;
37
+
38
+    @Autowired
39
+    private RedisCache redisCache;
40
+
41
+    @PreAuthorize("@ss.hasPermi('monitor:online:list')")
42
+    @GetMapping("/list")
43
+    public TableDataInfo list(String ipaddr, String userName)
44
+    {
45
+        Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
46
+        List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
47
+        for (String key : keys)
48
+        {
49
+            LoginUser user = redisCache.getCacheObject(key);
50
+            if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
51
+            {
52
+                userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
53
+            }
54
+            else if (StringUtils.isNotEmpty(ipaddr))
55
+            {
56
+                userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
57
+            }
58
+            else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
59
+            {
60
+                userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
61
+            }
62
+            else
63
+            {
64
+                userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
65
+            }
66
+        }
67
+        Collections.reverse(userOnlineList);
68
+        userOnlineList.removeAll(Collections.singleton(null));
69
+        return getDataTable(userOnlineList);
70
+    }
71
+
72
+    /**
73
+     * 强退用户
74
+     */
75
+    @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
76
+    @Log(title = "在线用户", businessType = BusinessType.FORCE)
77
+    @DeleteMapping("/{tokenId}")
78
+    public AjaxResult forceLogout(@PathVariable String tokenId)
79
+    {
80
+        redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
81
+        return success();
82
+    }
83
+}

+ 133
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java Bestand weergeven

@@ -0,0 +1,133 @@
1
+package com.ruoyi.web.controller.system;
2
+
3
+import java.util.List;
4
+import javax.servlet.http.HttpServletResponse;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.security.access.prepost.PreAuthorize;
7
+import org.springframework.validation.annotation.Validated;
8
+import org.springframework.web.bind.annotation.DeleteMapping;
9
+import org.springframework.web.bind.annotation.GetMapping;
10
+import org.springframework.web.bind.annotation.PathVariable;
11
+import org.springframework.web.bind.annotation.PostMapping;
12
+import org.springframework.web.bind.annotation.PutMapping;
13
+import org.springframework.web.bind.annotation.RequestBody;
14
+import org.springframework.web.bind.annotation.RequestMapping;
15
+import org.springframework.web.bind.annotation.RestController;
16
+import com.ruoyi.common.annotation.Log;
17
+import com.ruoyi.common.core.controller.BaseController;
18
+import com.ruoyi.common.core.domain.AjaxResult;
19
+import com.ruoyi.common.core.page.TableDataInfo;
20
+import com.ruoyi.common.enums.BusinessType;
21
+import com.ruoyi.common.utils.poi.ExcelUtil;
22
+import com.ruoyi.system.domain.SysConfig;
23
+import com.ruoyi.system.service.ISysConfigService;
24
+
25
+/**
26
+ * 参数配置 信息操作处理
27
+ * 
28
+ * @author ruoyi
29
+ */
30
+@RestController
31
+@RequestMapping("/system/config")
32
+public class SysConfigController extends BaseController
33
+{
34
+    @Autowired
35
+    private ISysConfigService configService;
36
+
37
+    /**
38
+     * 获取参数配置列表
39
+     */
40
+    @PreAuthorize("@ss.hasPermi('system:config:list')")
41
+    @GetMapping("/list")
42
+    public TableDataInfo list(SysConfig config)
43
+    {
44
+        startPage();
45
+        List<SysConfig> list = configService.selectConfigList(config);
46
+        return getDataTable(list);
47
+    }
48
+
49
+    @Log(title = "参数管理", businessType = BusinessType.EXPORT)
50
+    @PreAuthorize("@ss.hasPermi('system:config:export')")
51
+    @PostMapping("/export")
52
+    public void export(HttpServletResponse response, SysConfig config)
53
+    {
54
+        List<SysConfig> list = configService.selectConfigList(config);
55
+        ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
56
+        util.exportExcel(response, list, "参数数据");
57
+    }
58
+
59
+    /**
60
+     * 根据参数编号获取详细信息
61
+     */
62
+    @PreAuthorize("@ss.hasPermi('system:config:query')")
63
+    @GetMapping(value = "/{configId}")
64
+    public AjaxResult getInfo(@PathVariable Long configId)
65
+    {
66
+        return success(configService.selectConfigById(configId));
67
+    }
68
+
69
+    /**
70
+     * 根据参数键名查询参数值
71
+     */
72
+    @GetMapping(value = "/configKey/{configKey}")
73
+    public AjaxResult getConfigKey(@PathVariable String configKey)
74
+    {
75
+        return success(configService.selectConfigByKey(configKey));
76
+    }
77
+
78
+    /**
79
+     * 新增参数配置
80
+     */
81
+    @PreAuthorize("@ss.hasPermi('system:config:add')")
82
+    @Log(title = "参数管理", businessType = BusinessType.INSERT)
83
+    @PostMapping
84
+    public AjaxResult add(@Validated @RequestBody SysConfig config)
85
+    {
86
+        if (!configService.checkConfigKeyUnique(config))
87
+        {
88
+            return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
89
+        }
90
+        config.setCreateBy(getUsername());
91
+        return toAjax(configService.insertConfig(config));
92
+    }
93
+
94
+    /**
95
+     * 修改参数配置
96
+     */
97
+    @PreAuthorize("@ss.hasPermi('system:config:edit')")
98
+    @Log(title = "参数管理", businessType = BusinessType.UPDATE)
99
+    @PutMapping
100
+    public AjaxResult edit(@Validated @RequestBody SysConfig config)
101
+    {
102
+        if (!configService.checkConfigKeyUnique(config))
103
+        {
104
+            return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
105
+        }
106
+        config.setUpdateBy(getUsername());
107
+        return toAjax(configService.updateConfig(config));
108
+    }
109
+
110
+    /**
111
+     * 删除参数配置
112
+     */
113
+    @PreAuthorize("@ss.hasPermi('system:config:remove')")
114
+    @Log(title = "参数管理", businessType = BusinessType.DELETE)
115
+    @DeleteMapping("/{configIds}")
116
+    public AjaxResult remove(@PathVariable Long[] configIds)
117
+    {
118
+        configService.deleteConfigByIds(configIds);
119
+        return success();
120
+    }
121
+
122
+    /**
123
+     * 刷新参数缓存
124
+     */
125
+    @PreAuthorize("@ss.hasPermi('system:config:remove')")
126
+    @Log(title = "参数管理", businessType = BusinessType.CLEAN)
127
+    @DeleteMapping("/refreshCache")
128
+    public AjaxResult refreshCache()
129
+    {
130
+        configService.resetConfigCache();
131
+        return success();
132
+    }
133
+}

+ 132
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java Bestand weergeven

@@ -0,0 +1,132 @@
1
+package com.ruoyi.web.controller.system;
2
+
3
+import java.util.List;
4
+import org.apache.commons.lang3.ArrayUtils;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.security.access.prepost.PreAuthorize;
7
+import org.springframework.validation.annotation.Validated;
8
+import org.springframework.web.bind.annotation.DeleteMapping;
9
+import org.springframework.web.bind.annotation.GetMapping;
10
+import org.springframework.web.bind.annotation.PathVariable;
11
+import org.springframework.web.bind.annotation.PostMapping;
12
+import org.springframework.web.bind.annotation.PutMapping;
13
+import org.springframework.web.bind.annotation.RequestBody;
14
+import org.springframework.web.bind.annotation.RequestMapping;
15
+import org.springframework.web.bind.annotation.RestController;
16
+import com.ruoyi.common.annotation.Log;
17
+import com.ruoyi.common.constant.UserConstants;
18
+import com.ruoyi.common.core.controller.BaseController;
19
+import com.ruoyi.common.core.domain.AjaxResult;
20
+import com.ruoyi.common.core.domain.entity.SysDept;
21
+import com.ruoyi.common.enums.BusinessType;
22
+import com.ruoyi.common.utils.StringUtils;
23
+import com.ruoyi.system.service.ISysDeptService;
24
+
25
+/**
26
+ * 部门信息
27
+ * 
28
+ * @author ruoyi
29
+ */
30
+@RestController
31
+@RequestMapping("/system/dept")
32
+public class SysDeptController extends BaseController
33
+{
34
+    @Autowired
35
+    private ISysDeptService deptService;
36
+
37
+    /**
38
+     * 获取部门列表
39
+     */
40
+    @PreAuthorize("@ss.hasPermi('system:dept:list')")
41
+    @GetMapping("/list")
42
+    public AjaxResult list(SysDept dept)
43
+    {
44
+        List<SysDept> depts = deptService.selectDeptList(dept);
45
+        return success(depts);
46
+    }
47
+
48
+    /**
49
+     * 查询部门列表(排除节点)
50
+     */
51
+    @PreAuthorize("@ss.hasPermi('system:dept:list')")
52
+    @GetMapping("/list/exclude/{deptId}")
53
+    public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
54
+    {
55
+        List<SysDept> depts = deptService.selectDeptList(new SysDept());
56
+        depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
57
+        return success(depts);
58
+    }
59
+
60
+    /**
61
+     * 根据部门编号获取详细信息
62
+     */
63
+    @PreAuthorize("@ss.hasPermi('system:dept:query')")
64
+    @GetMapping(value = "/{deptId}")
65
+    public AjaxResult getInfo(@PathVariable Long deptId)
66
+    {
67
+        deptService.checkDeptDataScope(deptId);
68
+        return success(deptService.selectDeptById(deptId));
69
+    }
70
+
71
+    /**
72
+     * 新增部门
73
+     */
74
+    @PreAuthorize("@ss.hasPermi('system:dept:add')")
75
+    @Log(title = "部门管理", businessType = BusinessType.INSERT)
76
+    @PostMapping
77
+    public AjaxResult add(@Validated @RequestBody SysDept dept)
78
+    {
79
+        if (!deptService.checkDeptNameUnique(dept))
80
+        {
81
+            return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
82
+        }
83
+        dept.setCreateBy(getUsername());
84
+        return toAjax(deptService.insertDept(dept));
85
+    }
86
+
87
+    /**
88
+     * 修改部门
89
+     */
90
+    @PreAuthorize("@ss.hasPermi('system:dept:edit')")
91
+    @Log(title = "部门管理", businessType = BusinessType.UPDATE)
92
+    @PutMapping
93
+    public AjaxResult edit(@Validated @RequestBody SysDept dept)
94
+    {
95
+        Long deptId = dept.getDeptId();
96
+        deptService.checkDeptDataScope(deptId);
97
+        if (!deptService.checkDeptNameUnique(dept))
98
+        {
99
+            return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
100
+        }
101
+        else if (dept.getParentId().equals(deptId))
102
+        {
103
+            return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
104
+        }
105
+        else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
106
+        {
107
+            return error("该部门包含未停用的子部门!");
108
+        }
109
+        dept.setUpdateBy(getUsername());
110
+        return toAjax(deptService.updateDept(dept));
111
+    }
112
+
113
+    /**
114
+     * 删除部门
115
+     */
116
+    @PreAuthorize("@ss.hasPermi('system:dept:remove')")
117
+    @Log(title = "部门管理", businessType = BusinessType.DELETE)
118
+    @DeleteMapping("/{deptId}")
119
+    public AjaxResult remove(@PathVariable Long deptId)
120
+    {
121
+        if (deptService.hasChildByDeptId(deptId))
122
+        {
123
+            return warn("存在下级部门,不允许删除");
124
+        }
125
+        if (deptService.checkDeptExistUser(deptId))
126
+        {
127
+            return warn("部门存在用户,不允许删除");
128
+        }
129
+        deptService.checkDeptDataScope(deptId);
130
+        return toAjax(deptService.deleteDeptById(deptId));
131
+    }
132
+}

+ 121
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java Bestand weergeven

@@ -0,0 +1,121 @@
1
+package com.ruoyi.web.controller.system;
2
+
3
+import java.util.ArrayList;
4
+import java.util.List;
5
+import javax.servlet.http.HttpServletResponse;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.security.access.prepost.PreAuthorize;
8
+import org.springframework.validation.annotation.Validated;
9
+import org.springframework.web.bind.annotation.DeleteMapping;
10
+import org.springframework.web.bind.annotation.GetMapping;
11
+import org.springframework.web.bind.annotation.PathVariable;
12
+import org.springframework.web.bind.annotation.PostMapping;
13
+import org.springframework.web.bind.annotation.PutMapping;
14
+import org.springframework.web.bind.annotation.RequestBody;
15
+import org.springframework.web.bind.annotation.RequestMapping;
16
+import org.springframework.web.bind.annotation.RestController;
17
+import com.ruoyi.common.annotation.Log;
18
+import com.ruoyi.common.core.controller.BaseController;
19
+import com.ruoyi.common.core.domain.AjaxResult;
20
+import com.ruoyi.common.core.domain.entity.SysDictData;
21
+import com.ruoyi.common.core.page.TableDataInfo;
22
+import com.ruoyi.common.enums.BusinessType;
23
+import com.ruoyi.common.utils.StringUtils;
24
+import com.ruoyi.common.utils.poi.ExcelUtil;
25
+import com.ruoyi.system.service.ISysDictDataService;
26
+import com.ruoyi.system.service.ISysDictTypeService;
27
+
28
+/**
29
+ * 数据字典信息
30
+ * 
31
+ * @author ruoyi
32
+ */
33
+@RestController
34
+@RequestMapping("/system/dict/data")
35
+public class SysDictDataController extends BaseController
36
+{
37
+    @Autowired
38
+    private ISysDictDataService dictDataService;
39
+
40
+    @Autowired
41
+    private ISysDictTypeService dictTypeService;
42
+
43
+    @PreAuthorize("@ss.hasPermi('system:dict:list')")
44
+    @GetMapping("/list")
45
+    public TableDataInfo list(SysDictData dictData)
46
+    {
47
+        startPage();
48
+        List<SysDictData> list = dictDataService.selectDictDataList(dictData);
49
+        return getDataTable(list);
50
+    }
51
+
52
+    @Log(title = "字典数据", businessType = BusinessType.EXPORT)
53
+    @PreAuthorize("@ss.hasPermi('system:dict:export')")
54
+    @PostMapping("/export")
55
+    public void export(HttpServletResponse response, SysDictData dictData)
56
+    {
57
+        List<SysDictData> list = dictDataService.selectDictDataList(dictData);
58
+        ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
59
+        util.exportExcel(response, list, "字典数据");
60
+    }
61
+
62
+    /**
63
+     * 查询字典数据详细
64
+     */
65
+    @PreAuthorize("@ss.hasPermi('system:dict:query')")
66
+    @GetMapping(value = "/{dictCode}")
67
+    public AjaxResult getInfo(@PathVariable Long dictCode)
68
+    {
69
+        return success(dictDataService.selectDictDataById(dictCode));
70
+    }
71
+
72
+    /**
73
+     * 根据字典类型查询字典数据信息
74
+     */
75
+    @GetMapping(value = "/type/{dictType}")
76
+    public AjaxResult dictType(@PathVariable String dictType)
77
+    {
78
+        List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
79
+        if (StringUtils.isNull(data))
80
+        {
81
+            data = new ArrayList<SysDictData>();
82
+        }
83
+        return success(data);
84
+    }
85
+
86
+    /**
87
+     * 新增字典类型
88
+     */
89
+    @PreAuthorize("@ss.hasPermi('system:dict:add')")
90
+    @Log(title = "字典数据", businessType = BusinessType.INSERT)
91
+    @PostMapping
92
+    public AjaxResult add(@Validated @RequestBody SysDictData dict)
93
+    {
94
+        dict.setCreateBy(getUsername());
95
+        return toAjax(dictDataService.insertDictData(dict));
96
+    }
97
+
98
+    /**
99
+     * 修改保存字典类型
100
+     */
101
+    @PreAuthorize("@ss.hasPermi('system:dict:edit')")
102
+    @Log(title = "字典数据", businessType = BusinessType.UPDATE)
103
+    @PutMapping
104
+    public AjaxResult edit(@Validated @RequestBody SysDictData dict)
105
+    {
106
+        dict.setUpdateBy(getUsername());
107
+        return toAjax(dictDataService.updateDictData(dict));
108
+    }
109
+
110
+    /**
111
+     * 删除字典类型
112
+     */
113
+    @PreAuthorize("@ss.hasPermi('system:dict:remove')")
114
+    @Log(title = "字典类型", businessType = BusinessType.DELETE)
115
+    @DeleteMapping("/{dictCodes}")
116
+    public AjaxResult remove(@PathVariable Long[] dictCodes)
117
+    {
118
+        dictDataService.deleteDictDataByIds(dictCodes);
119
+        return success();
120
+    }
121
+}

+ 131
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java Bestand weergeven

@@ -0,0 +1,131 @@
1
+package com.ruoyi.web.controller.system;
2
+
3
+import java.util.List;
4
+import javax.servlet.http.HttpServletResponse;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.security.access.prepost.PreAuthorize;
7
+import org.springframework.validation.annotation.Validated;
8
+import org.springframework.web.bind.annotation.DeleteMapping;
9
+import org.springframework.web.bind.annotation.GetMapping;
10
+import org.springframework.web.bind.annotation.PathVariable;
11
+import org.springframework.web.bind.annotation.PostMapping;
12
+import org.springframework.web.bind.annotation.PutMapping;
13
+import org.springframework.web.bind.annotation.RequestBody;
14
+import org.springframework.web.bind.annotation.RequestMapping;
15
+import org.springframework.web.bind.annotation.RestController;
16
+import com.ruoyi.common.annotation.Log;
17
+import com.ruoyi.common.core.controller.BaseController;
18
+import com.ruoyi.common.core.domain.AjaxResult;
19
+import com.ruoyi.common.core.domain.entity.SysDictType;
20
+import com.ruoyi.common.core.page.TableDataInfo;
21
+import com.ruoyi.common.enums.BusinessType;
22
+import com.ruoyi.common.utils.poi.ExcelUtil;
23
+import com.ruoyi.system.service.ISysDictTypeService;
24
+
25
+/**
26
+ * 数据字典信息
27
+ * 
28
+ * @author ruoyi
29
+ */
30
+@RestController
31
+@RequestMapping("/system/dict/type")
32
+public class SysDictTypeController extends BaseController
33
+{
34
+    @Autowired
35
+    private ISysDictTypeService dictTypeService;
36
+
37
+    @PreAuthorize("@ss.hasPermi('system:dict:list')")
38
+    @GetMapping("/list")
39
+    public TableDataInfo list(SysDictType dictType)
40
+    {
41
+        startPage();
42
+        List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
43
+        return getDataTable(list);
44
+    }
45
+
46
+    @Log(title = "字典类型", businessType = BusinessType.EXPORT)
47
+    @PreAuthorize("@ss.hasPermi('system:dict:export')")
48
+    @PostMapping("/export")
49
+    public void export(HttpServletResponse response, SysDictType dictType)
50
+    {
51
+        List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
52
+        ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
53
+        util.exportExcel(response, list, "字典类型");
54
+    }
55
+
56
+    /**
57
+     * 查询字典类型详细
58
+     */
59
+    @PreAuthorize("@ss.hasPermi('system:dict:query')")
60
+    @GetMapping(value = "/{dictId}")
61
+    public AjaxResult getInfo(@PathVariable Long dictId)
62
+    {
63
+        return success(dictTypeService.selectDictTypeById(dictId));
64
+    }
65
+
66
+    /**
67
+     * 新增字典类型
68
+     */
69
+    @PreAuthorize("@ss.hasPermi('system:dict:add')")
70
+    @Log(title = "字典类型", businessType = BusinessType.INSERT)
71
+    @PostMapping
72
+    public AjaxResult add(@Validated @RequestBody SysDictType dict)
73
+    {
74
+        if (!dictTypeService.checkDictTypeUnique(dict))
75
+        {
76
+            return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
77
+        }
78
+        dict.setCreateBy(getUsername());
79
+        return toAjax(dictTypeService.insertDictType(dict));
80
+    }
81
+
82
+    /**
83
+     * 修改字典类型
84
+     */
85
+    @PreAuthorize("@ss.hasPermi('system:dict:edit')")
86
+    @Log(title = "字典类型", businessType = BusinessType.UPDATE)
87
+    @PutMapping
88
+    public AjaxResult edit(@Validated @RequestBody SysDictType dict)
89
+    {
90
+        if (!dictTypeService.checkDictTypeUnique(dict))
91
+        {
92
+            return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
93
+        }
94
+        dict.setUpdateBy(getUsername());
95
+        return toAjax(dictTypeService.updateDictType(dict));
96
+    }
97
+
98
+    /**
99
+     * 删除字典类型
100
+     */
101
+    @PreAuthorize("@ss.hasPermi('system:dict:remove')")
102
+    @Log(title = "字典类型", businessType = BusinessType.DELETE)
103
+    @DeleteMapping("/{dictIds}")
104
+    public AjaxResult remove(@PathVariable Long[] dictIds)
105
+    {
106
+        dictTypeService.deleteDictTypeByIds(dictIds);
107
+        return success();
108
+    }
109
+
110
+    /**
111
+     * 刷新字典缓存
112
+     */
113
+    @PreAuthorize("@ss.hasPermi('system:dict:remove')")
114
+    @Log(title = "字典类型", businessType = BusinessType.CLEAN)
115
+    @DeleteMapping("/refreshCache")
116
+    public AjaxResult refreshCache()
117
+    {
118
+        dictTypeService.resetDictCache();
119
+        return success();
120
+    }
121
+
122
+    /**
123
+     * 获取字典选择框列表
124
+     */
125
+    @GetMapping("/optionselect")
126
+    public AjaxResult optionselect()
127
+    {
128
+        List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
129
+        return success(dictTypes);
130
+    }
131
+}

+ 29
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java Bestand weergeven

@@ -0,0 +1,29 @@
1
+package com.ruoyi.web.controller.system;
2
+
3
+import org.springframework.beans.factory.annotation.Autowired;
4
+import org.springframework.web.bind.annotation.RequestMapping;
5
+import org.springframework.web.bind.annotation.RestController;
6
+import com.ruoyi.common.config.RuoYiConfig;
7
+import com.ruoyi.common.utils.StringUtils;
8
+
9
+/**
10
+ * 首页
11
+ *
12
+ * @author ruoyi
13
+ */
14
+@RestController
15
+public class SysIndexController
16
+{
17
+    /** 系统基础配置 */
18
+    @Autowired
19
+    private RuoYiConfig ruoyiConfig;
20
+
21
+    /**
22
+     * 访问首页,提示语
23
+     */
24
+    @RequestMapping("/")
25
+    public String index()
26
+    {
27
+        return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
28
+    }
29
+}

+ 100
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java Bestand weergeven

@@ -0,0 +1,100 @@
1
+package com.ruoyi.web.controller.system;
2
+
3
+import java.util.List;
4
+import java.util.Set;
5
+
6
+import com.ruoyi.system.service.ISysUserService;
7
+import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication;
8
+import com.ruoyi.wisdomarbitrate.service.IdentityAuthenticationService;
9
+import org.springframework.beans.factory.annotation.Autowired;
10
+import org.springframework.web.bind.annotation.GetMapping;
11
+import org.springframework.web.bind.annotation.PostMapping;
12
+import org.springframework.web.bind.annotation.RequestBody;
13
+import org.springframework.web.bind.annotation.RestController;
14
+import com.ruoyi.common.constant.Constants;
15
+import com.ruoyi.common.core.domain.AjaxResult;
16
+import com.ruoyi.common.core.domain.entity.SysMenu;
17
+import com.ruoyi.common.core.domain.entity.SysUser;
18
+import com.ruoyi.common.core.domain.model.LoginBody;
19
+import com.ruoyi.common.utils.SecurityUtils;
20
+import com.ruoyi.framework.web.service.SysLoginService;
21
+import com.ruoyi.framework.web.service.SysPermissionService;
22
+import com.ruoyi.system.service.ISysMenuService;
23
+
24
+/**
25
+ * 登录验证
26
+ *
27
+ * @author ruoyi
28
+ */
29
+@RestController
30
+public class SysLoginController {
31
+    @Autowired
32
+    private SysLoginService loginService;
33
+
34
+    @Autowired
35
+    private ISysMenuService menuService;
36
+
37
+    @Autowired
38
+    private SysPermissionService permissionService;
39
+    @Autowired
40
+    IdentityAuthenticationService identityAuthenticationService;
41
+    @Autowired
42
+    private ISysUserService sysUserService;
43
+
44
+    /**
45
+     * 登录方法
46
+     *
47
+     * @param loginBody 登录信息
48
+     * @return 结果
49
+     */
50
+    @PostMapping("/login")
51
+    public AjaxResult login(@RequestBody LoginBody loginBody) {
52
+        AjaxResult ajax = AjaxResult.success();
53
+        // 生成令牌
54
+        String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
55
+                loginBody.getUuid());
56
+        ajax.put(Constants.TOKEN, token);
57
+        //判断该用户是否已经实名认证(certificationStatus1已认证0未认证)
58
+        IdentityAuthentication identityAuthentication=new IdentityAuthentication();
59
+        identityAuthentication.setUserName(loginBody.getUsername());
60
+        String status = identityAuthenticationService.checkIsAuthentication(identityAuthentication);
61
+
62
+        ajax.put("certificationStatus", status);
63
+        // 获取用户信息
64
+        SysUser sysUser = sysUserService.selectUserByUserName(loginBody.getUsername());
65
+        ajax.put("userId", sysUser!=null?sysUser.getUserId():"");
66
+        ajax.put("userName", sysUser!=null?sysUser.getUserName():"");
67
+        return ajax;
68
+    }
69
+
70
+    /**
71
+     * 获取用户信息
72
+     *
73
+     * @return 用户信息
74
+     */
75
+    @GetMapping("getInfo")
76
+    public AjaxResult getInfo() {
77
+        SysUser user = SecurityUtils.getLoginUser().getUser();
78
+        // 角色集合
79
+        Set<String> roles = permissionService.getRolePermission(user);
80
+        // 权限集合
81
+        Set<String> permissions = permissionService.getMenuPermission(user);
82
+        AjaxResult ajax = AjaxResult.success();
83
+        ajax.put("user", user);
84
+        ajax.put("roles", roles);
85
+        ajax.put("permissions", permissions);
86
+        return ajax;
87
+    }
88
+
89
+    /**
90
+     * 获取路由信息
91
+     *
92
+     * @return 路由信息
93
+     */
94
+    @GetMapping("getRouters")
95
+    public AjaxResult getRouters() {
96
+        Long userId = SecurityUtils.getUserId();
97
+        List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
98
+        return AjaxResult.success(menuService.buildMenus(menus));
99
+    }
100
+}

+ 142
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java Bestand weergeven

@@ -0,0 +1,142 @@
1
+package com.ruoyi.web.controller.system;
2
+
3
+import java.util.List;
4
+import org.springframework.beans.factory.annotation.Autowired;
5
+import org.springframework.security.access.prepost.PreAuthorize;
6
+import org.springframework.validation.annotation.Validated;
7
+import org.springframework.web.bind.annotation.DeleteMapping;
8
+import org.springframework.web.bind.annotation.GetMapping;
9
+import org.springframework.web.bind.annotation.PathVariable;
10
+import org.springframework.web.bind.annotation.PostMapping;
11
+import org.springframework.web.bind.annotation.PutMapping;
12
+import org.springframework.web.bind.annotation.RequestBody;
13
+import org.springframework.web.bind.annotation.RequestMapping;
14
+import org.springframework.web.bind.annotation.RestController;
15
+import com.ruoyi.common.annotation.Log;
16
+import com.ruoyi.common.constant.UserConstants;
17
+import com.ruoyi.common.core.controller.BaseController;
18
+import com.ruoyi.common.core.domain.AjaxResult;
19
+import com.ruoyi.common.core.domain.entity.SysMenu;
20
+import com.ruoyi.common.enums.BusinessType;
21
+import com.ruoyi.common.utils.StringUtils;
22
+import com.ruoyi.system.service.ISysMenuService;
23
+
24
+/**
25
+ * 菜单信息
26
+ * 
27
+ * @author ruoyi
28
+ */
29
+@RestController
30
+@RequestMapping("/system/menu")
31
+public class SysMenuController extends BaseController
32
+{
33
+    @Autowired
34
+    private ISysMenuService menuService;
35
+
36
+    /**
37
+     * 获取菜单列表
38
+     */
39
+    @PreAuthorize("@ss.hasPermi('system:menu:list')")
40
+    @GetMapping("/list")
41
+    public AjaxResult list(SysMenu menu)
42
+    {
43
+        List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
44
+        return success(menus);
45
+    }
46
+
47
+    /**
48
+     * 根据菜单编号获取详细信息
49
+     */
50
+    @PreAuthorize("@ss.hasPermi('system:menu:query')")
51
+    @GetMapping(value = "/{menuId}")
52
+    public AjaxResult getInfo(@PathVariable Long menuId)
53
+    {
54
+        return success(menuService.selectMenuById(menuId));
55
+    }
56
+
57
+    /**
58
+     * 获取菜单下拉树列表
59
+     */
60
+    @GetMapping("/treeselect")
61
+    public AjaxResult treeselect(SysMenu menu)
62
+    {
63
+        List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
64
+        return success(menuService.buildMenuTreeSelect(menus));
65
+    }
66
+
67
+    /**
68
+     * 加载对应角色菜单列表树
69
+     */
70
+    @GetMapping(value = "/roleMenuTreeselect/{roleId}")
71
+    public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
72
+    {
73
+        List<SysMenu> menus = menuService.selectMenuList(getUserId());
74
+        AjaxResult ajax = AjaxResult.success();
75
+        ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
76
+        ajax.put("menus", menuService.buildMenuTreeSelect(menus));
77
+        return ajax;
78
+    }
79
+
80
+    /**
81
+     * 新增菜单
82
+     */
83
+    @PreAuthorize("@ss.hasPermi('system:menu:add')")
84
+    @Log(title = "菜单管理", businessType = BusinessType.INSERT)
85
+    @PostMapping
86
+    public AjaxResult add(@Validated @RequestBody SysMenu menu)
87
+    {
88
+        if (!menuService.checkMenuNameUnique(menu))
89
+        {
90
+            return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
91
+        }
92
+        else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
93
+        {
94
+            return error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
95
+        }
96
+        menu.setCreateBy(getUsername());
97
+        return toAjax(menuService.insertMenu(menu));
98
+    }
99
+
100
+    /**
101
+     * 修改菜单
102
+     */
103
+    @PreAuthorize("@ss.hasPermi('system:menu:edit')")
104
+    @Log(title = "菜单管理", businessType = BusinessType.UPDATE)
105
+    @PutMapping
106
+    public AjaxResult edit(@Validated @RequestBody SysMenu menu)
107
+    {
108
+        if (!menuService.checkMenuNameUnique(menu))
109
+        {
110
+            return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
111
+        }
112
+        else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
113
+        {
114
+            return error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
115
+        }
116
+        else if (menu.getMenuId().equals(menu.getParentId()))
117
+        {
118
+            return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
119
+        }
120
+        menu.setUpdateBy(getUsername());
121
+        return toAjax(menuService.updateMenu(menu));
122
+    }
123
+
124
+    /**
125
+     * 删除菜单
126
+     */
127
+    @PreAuthorize("@ss.hasPermi('system:menu:remove')")
128
+    @Log(title = "菜单管理", businessType = BusinessType.DELETE)
129
+    @DeleteMapping("/{menuId}")
130
+    public AjaxResult remove(@PathVariable("menuId") Long menuId)
131
+    {
132
+        if (menuService.hasChildByMenuId(menuId))
133
+        {
134
+            return warn("存在子菜单,不允许删除");
135
+        }
136
+        if (menuService.checkMenuExistRole(menuId))
137
+        {
138
+            return warn("菜单已分配,不允许删除");
139
+        }
140
+        return toAjax(menuService.deleteMenuById(menuId));
141
+    }
142
+}

+ 91
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java Bestand weergeven

@@ -0,0 +1,91 @@
1
+package com.ruoyi.web.controller.system;
2
+
3
+import java.util.List;
4
+import org.springframework.beans.factory.annotation.Autowired;
5
+import org.springframework.security.access.prepost.PreAuthorize;
6
+import org.springframework.validation.annotation.Validated;
7
+import org.springframework.web.bind.annotation.DeleteMapping;
8
+import org.springframework.web.bind.annotation.GetMapping;
9
+import org.springframework.web.bind.annotation.PathVariable;
10
+import org.springframework.web.bind.annotation.PostMapping;
11
+import org.springframework.web.bind.annotation.PutMapping;
12
+import org.springframework.web.bind.annotation.RequestBody;
13
+import org.springframework.web.bind.annotation.RequestMapping;
14
+import org.springframework.web.bind.annotation.RestController;
15
+import com.ruoyi.common.annotation.Log;
16
+import com.ruoyi.common.core.controller.BaseController;
17
+import com.ruoyi.common.core.domain.AjaxResult;
18
+import com.ruoyi.common.core.page.TableDataInfo;
19
+import com.ruoyi.common.enums.BusinessType;
20
+import com.ruoyi.system.domain.SysNotice;
21
+import com.ruoyi.system.service.ISysNoticeService;
22
+
23
+/**
24
+ * 公告 信息操作处理
25
+ * 
26
+ * @author ruoyi
27
+ */
28
+@RestController
29
+@RequestMapping("/system/notice")
30
+public class SysNoticeController extends BaseController
31
+{
32
+    @Autowired
33
+    private ISysNoticeService noticeService;
34
+
35
+    /**
36
+     * 获取通知公告列表
37
+     */
38
+    @PreAuthorize("@ss.hasPermi('system:notice:list')")
39
+    @GetMapping("/list")
40
+    public TableDataInfo list(SysNotice notice)
41
+    {
42
+        startPage();
43
+        List<SysNotice> list = noticeService.selectNoticeList(notice);
44
+        return getDataTable(list);
45
+    }
46
+
47
+    /**
48
+     * 根据通知公告编号获取详细信息
49
+     */
50
+    @PreAuthorize("@ss.hasPermi('system:notice:query')")
51
+    @GetMapping(value = "/{noticeId}")
52
+    public AjaxResult getInfo(@PathVariable Long noticeId)
53
+    {
54
+        return success(noticeService.selectNoticeById(noticeId));
55
+    }
56
+
57
+    /**
58
+     * 新增通知公告
59
+     */
60
+    @PreAuthorize("@ss.hasPermi('system:notice:add')")
61
+    @Log(title = "通知公告", businessType = BusinessType.INSERT)
62
+    @PostMapping
63
+    public AjaxResult add(@Validated @RequestBody SysNotice notice)
64
+    {
65
+        notice.setCreateBy(getUsername());
66
+        return toAjax(noticeService.insertNotice(notice));
67
+    }
68
+
69
+    /**
70
+     * 修改通知公告
71
+     */
72
+    @PreAuthorize("@ss.hasPermi('system:notice:edit')")
73
+    @Log(title = "通知公告", businessType = BusinessType.UPDATE)
74
+    @PutMapping
75
+    public AjaxResult edit(@Validated @RequestBody SysNotice notice)
76
+    {
77
+        notice.setUpdateBy(getUsername());
78
+        return toAjax(noticeService.updateNotice(notice));
79
+    }
80
+
81
+    /**
82
+     * 删除通知公告
83
+     */
84
+    @PreAuthorize("@ss.hasPermi('system:notice:remove')")
85
+    @Log(title = "通知公告", businessType = BusinessType.DELETE)
86
+    @DeleteMapping("/{noticeIds}")
87
+    public AjaxResult remove(@PathVariable Long[] noticeIds)
88
+    {
89
+        return toAjax(noticeService.deleteNoticeByIds(noticeIds));
90
+    }
91
+}

+ 129
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java Bestand weergeven

@@ -0,0 +1,129 @@
1
+package com.ruoyi.web.controller.system;
2
+
3
+import java.util.List;
4
+import javax.servlet.http.HttpServletResponse;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.security.access.prepost.PreAuthorize;
7
+import org.springframework.validation.annotation.Validated;
8
+import org.springframework.web.bind.annotation.DeleteMapping;
9
+import org.springframework.web.bind.annotation.GetMapping;
10
+import org.springframework.web.bind.annotation.PathVariable;
11
+import org.springframework.web.bind.annotation.PostMapping;
12
+import org.springframework.web.bind.annotation.PutMapping;
13
+import org.springframework.web.bind.annotation.RequestBody;
14
+import org.springframework.web.bind.annotation.RequestMapping;
15
+import org.springframework.web.bind.annotation.RestController;
16
+import com.ruoyi.common.annotation.Log;
17
+import com.ruoyi.common.core.controller.BaseController;
18
+import com.ruoyi.common.core.domain.AjaxResult;
19
+import com.ruoyi.common.core.page.TableDataInfo;
20
+import com.ruoyi.common.enums.BusinessType;
21
+import com.ruoyi.common.utils.poi.ExcelUtil;
22
+import com.ruoyi.system.domain.SysPost;
23
+import com.ruoyi.system.service.ISysPostService;
24
+
25
+/**
26
+ * 岗位信息操作处理
27
+ * 
28
+ * @author ruoyi
29
+ */
30
+@RestController
31
+@RequestMapping("/system/post")
32
+public class SysPostController extends BaseController
33
+{
34
+    @Autowired
35
+    private ISysPostService postService;
36
+
37
+    /**
38
+     * 获取岗位列表
39
+     */
40
+    @PreAuthorize("@ss.hasPermi('system:post:list')")
41
+    @GetMapping("/list")
42
+    public TableDataInfo list(SysPost post)
43
+    {
44
+        startPage();
45
+        List<SysPost> list = postService.selectPostList(post);
46
+        return getDataTable(list);
47
+    }
48
+    
49
+    @Log(title = "岗位管理", businessType = BusinessType.EXPORT)
50
+    @PreAuthorize("@ss.hasPermi('system:post:export')")
51
+    @PostMapping("/export")
52
+    public void export(HttpServletResponse response, SysPost post)
53
+    {
54
+        List<SysPost> list = postService.selectPostList(post);
55
+        ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
56
+        util.exportExcel(response, list, "岗位数据");
57
+    }
58
+
59
+    /**
60
+     * 根据岗位编号获取详细信息
61
+     */
62
+    @PreAuthorize("@ss.hasPermi('system:post:query')")
63
+    @GetMapping(value = "/{postId}")
64
+    public AjaxResult getInfo(@PathVariable Long postId)
65
+    {
66
+        return success(postService.selectPostById(postId));
67
+    }
68
+
69
+    /**
70
+     * 新增岗位
71
+     */
72
+    @PreAuthorize("@ss.hasPermi('system:post:add')")
73
+    @Log(title = "岗位管理", businessType = BusinessType.INSERT)
74
+    @PostMapping
75
+    public AjaxResult add(@Validated @RequestBody SysPost post)
76
+    {
77
+        if (!postService.checkPostNameUnique(post))
78
+        {
79
+            return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
80
+        }
81
+        else if (!postService.checkPostCodeUnique(post))
82
+        {
83
+            return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
84
+        }
85
+        post.setCreateBy(getUsername());
86
+        return toAjax(postService.insertPost(post));
87
+    }
88
+
89
+    /**
90
+     * 修改岗位
91
+     */
92
+    @PreAuthorize("@ss.hasPermi('system:post:edit')")
93
+    @Log(title = "岗位管理", businessType = BusinessType.UPDATE)
94
+    @PutMapping
95
+    public AjaxResult edit(@Validated @RequestBody SysPost post)
96
+    {
97
+        if (!postService.checkPostNameUnique(post))
98
+        {
99
+            return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
100
+        }
101
+        else if (!postService.checkPostCodeUnique(post))
102
+        {
103
+            return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
104
+        }
105
+        post.setUpdateBy(getUsername());
106
+        return toAjax(postService.updatePost(post));
107
+    }
108
+
109
+    /**
110
+     * 删除岗位
111
+     */
112
+    @PreAuthorize("@ss.hasPermi('system:post:remove')")
113
+    @Log(title = "岗位管理", businessType = BusinessType.DELETE)
114
+    @DeleteMapping("/{postIds}")
115
+    public AjaxResult remove(@PathVariable Long[] postIds)
116
+    {
117
+        return toAjax(postService.deletePostByIds(postIds));
118
+    }
119
+
120
+    /**
121
+     * 获取岗位选择框列表
122
+     */
123
+    @GetMapping("/optionselect")
124
+    public AjaxResult optionselect()
125
+    {
126
+        List<SysPost> posts = postService.selectPostAll();
127
+        return success(posts);
128
+    }
129
+}

+ 136
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java Bestand weergeven

@@ -0,0 +1,136 @@
1
+package com.ruoyi.web.controller.system;
2
+
3
+import org.springframework.beans.factory.annotation.Autowired;
4
+import org.springframework.web.bind.annotation.GetMapping;
5
+import org.springframework.web.bind.annotation.PostMapping;
6
+import org.springframework.web.bind.annotation.PutMapping;
7
+import org.springframework.web.bind.annotation.RequestBody;
8
+import org.springframework.web.bind.annotation.RequestMapping;
9
+import org.springframework.web.bind.annotation.RequestParam;
10
+import org.springframework.web.bind.annotation.RestController;
11
+import org.springframework.web.multipart.MultipartFile;
12
+import com.ruoyi.common.annotation.Log;
13
+import com.ruoyi.common.config.RuoYiConfig;
14
+import com.ruoyi.common.core.controller.BaseController;
15
+import com.ruoyi.common.core.domain.AjaxResult;
16
+import com.ruoyi.common.core.domain.entity.SysUser;
17
+import com.ruoyi.common.core.domain.model.LoginUser;
18
+import com.ruoyi.common.enums.BusinessType;
19
+import com.ruoyi.common.utils.SecurityUtils;
20
+import com.ruoyi.common.utils.StringUtils;
21
+import com.ruoyi.common.utils.file.FileUploadUtils;
22
+import com.ruoyi.common.utils.file.MimeTypeUtils;
23
+import com.ruoyi.framework.web.service.TokenService;
24
+import com.ruoyi.system.service.ISysUserService;
25
+
26
+/**
27
+ * 个人信息 业务处理
28
+ * 
29
+ * @author ruoyi
30
+ */
31
+@RestController
32
+@RequestMapping("/system/user/profile")
33
+public class SysProfileController extends BaseController
34
+{
35
+    @Autowired
36
+    private ISysUserService userService;
37
+
38
+    @Autowired
39
+    private TokenService tokenService;
40
+
41
+    /**
42
+     * 个人信息
43
+     */
44
+    @GetMapping
45
+    public AjaxResult profile()
46
+    {
47
+        LoginUser loginUser = getLoginUser();
48
+        SysUser user = loginUser.getUser();
49
+        AjaxResult ajax = AjaxResult.success(user);
50
+        ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
51
+        ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
52
+        return ajax;
53
+    }
54
+
55
+    /**
56
+     * 修改用户
57
+     */
58
+    @Log(title = "个人信息", businessType = BusinessType.UPDATE)
59
+    @PutMapping
60
+    public AjaxResult updateProfile(@RequestBody SysUser user)
61
+    {
62
+        LoginUser loginUser = getLoginUser();
63
+        SysUser currentUser = loginUser.getUser();
64
+        currentUser.setNickName(user.getNickName());
65
+        currentUser.setEmail(user.getEmail());
66
+        currentUser.setPhonenumber(user.getPhonenumber());
67
+        currentUser.setSex(user.getSex());
68
+        if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser))
69
+        {
70
+            return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
71
+        }
72
+        if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser))
73
+        {
74
+            return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
75
+        }
76
+        if (userService.updateUserProfile(currentUser) > 0)
77
+        {
78
+            // 更新缓存用户信息
79
+            tokenService.setLoginUser(loginUser);
80
+            return success();
81
+        }
82
+        return error("修改个人信息异常,请联系管理员");
83
+    }
84
+
85
+    /**
86
+     * 重置密码
87
+     */
88
+    @Log(title = "个人信息", businessType = BusinessType.UPDATE)
89
+    @PutMapping("/updatePwd")
90
+    public AjaxResult updatePwd(String oldPassword, String newPassword)
91
+    {
92
+        LoginUser loginUser = getLoginUser();
93
+        String userName = loginUser.getUsername();
94
+        String password = loginUser.getPassword();
95
+        if (!SecurityUtils.matchesPassword(oldPassword, password))
96
+        {
97
+            return error("修改密码失败,旧密码错误");
98
+        }
99
+        if (SecurityUtils.matchesPassword(newPassword, password))
100
+        {
101
+            return error("新密码不能与旧密码相同");
102
+        }
103
+        if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0)
104
+        {
105
+            // 更新缓存用户密码
106
+            loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
107
+            tokenService.setLoginUser(loginUser);
108
+            return success();
109
+        }
110
+        return error("修改密码异常,请联系管理员");
111
+    }
112
+
113
+    /**
114
+     * 头像上传
115
+     */
116
+    @Log(title = "用户头像", businessType = BusinessType.UPDATE)
117
+    @PostMapping("/avatar")
118
+    public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception
119
+    {
120
+        if (!file.isEmpty())
121
+        {
122
+            LoginUser loginUser = getLoginUser();
123
+            String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
124
+            if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
125
+            {
126
+                AjaxResult ajax = AjaxResult.success();
127
+                ajax.put("imgUrl", avatar);
128
+                // 更新缓存用户头像
129
+                loginUser.getUser().setAvatar(avatar);
130
+                tokenService.setLoginUser(loginUser);
131
+                return ajax;
132
+            }
133
+        }
134
+        return error("上传图片异常,请联系管理员");
135
+    }
136
+}

+ 38
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java Bestand weergeven

@@ -0,0 +1,38 @@
1
+package com.ruoyi.web.controller.system;
2
+
3
+import org.springframework.beans.factory.annotation.Autowired;
4
+import org.springframework.web.bind.annotation.PostMapping;
5
+import org.springframework.web.bind.annotation.RequestBody;
6
+import org.springframework.web.bind.annotation.RestController;
7
+import com.ruoyi.common.core.controller.BaseController;
8
+import com.ruoyi.common.core.domain.AjaxResult;
9
+import com.ruoyi.common.core.domain.model.RegisterBody;
10
+import com.ruoyi.common.utils.StringUtils;
11
+import com.ruoyi.framework.web.service.SysRegisterService;
12
+import com.ruoyi.system.service.ISysConfigService;
13
+
14
+/**
15
+ * 注册验证
16
+ * 
17
+ * @author ruoyi
18
+ */
19
+@RestController
20
+public class SysRegisterController extends BaseController
21
+{
22
+    @Autowired
23
+    private SysRegisterService registerService;
24
+
25
+    @Autowired
26
+    private ISysConfigService configService;
27
+
28
+    @PostMapping("/register")
29
+    public AjaxResult register(@RequestBody RegisterBody user)
30
+    {
31
+        if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
32
+        {
33
+            return error("当前系统没有开启注册功能!");
34
+        }
35
+        String msg = registerService.register(user);
36
+        return StringUtils.isEmpty(msg) ? success() : error(msg);
37
+    }
38
+}

+ 262
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java Bestand weergeven

@@ -0,0 +1,262 @@
1
+package com.ruoyi.web.controller.system;
2
+
3
+import java.util.List;
4
+import javax.servlet.http.HttpServletResponse;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.security.access.prepost.PreAuthorize;
7
+import org.springframework.validation.annotation.Validated;
8
+import org.springframework.web.bind.annotation.DeleteMapping;
9
+import org.springframework.web.bind.annotation.GetMapping;
10
+import org.springframework.web.bind.annotation.PathVariable;
11
+import org.springframework.web.bind.annotation.PostMapping;
12
+import org.springframework.web.bind.annotation.PutMapping;
13
+import org.springframework.web.bind.annotation.RequestBody;
14
+import org.springframework.web.bind.annotation.RequestMapping;
15
+import org.springframework.web.bind.annotation.RestController;
16
+import com.ruoyi.common.annotation.Log;
17
+import com.ruoyi.common.core.controller.BaseController;
18
+import com.ruoyi.common.core.domain.AjaxResult;
19
+import com.ruoyi.common.core.domain.entity.SysDept;
20
+import com.ruoyi.common.core.domain.entity.SysRole;
21
+import com.ruoyi.common.core.domain.entity.SysUser;
22
+import com.ruoyi.common.core.domain.model.LoginUser;
23
+import com.ruoyi.common.core.page.TableDataInfo;
24
+import com.ruoyi.common.enums.BusinessType;
25
+import com.ruoyi.common.utils.StringUtils;
26
+import com.ruoyi.common.utils.poi.ExcelUtil;
27
+import com.ruoyi.framework.web.service.SysPermissionService;
28
+import com.ruoyi.framework.web.service.TokenService;
29
+import com.ruoyi.system.domain.SysUserRole;
30
+import com.ruoyi.system.service.ISysDeptService;
31
+import com.ruoyi.system.service.ISysRoleService;
32
+import com.ruoyi.system.service.ISysUserService;
33
+
34
+/**
35
+ * 角色信息
36
+ * 
37
+ * @author ruoyi
38
+ */
39
+@RestController
40
+@RequestMapping("/system/role")
41
+public class SysRoleController extends BaseController
42
+{
43
+    @Autowired
44
+    private ISysRoleService roleService;
45
+
46
+    @Autowired
47
+    private TokenService tokenService;
48
+
49
+    @Autowired
50
+    private SysPermissionService permissionService;
51
+
52
+    @Autowired
53
+    private ISysUserService userService;
54
+
55
+    @Autowired
56
+    private ISysDeptService deptService;
57
+
58
+    @PreAuthorize("@ss.hasPermi('system:role:list')")
59
+    @GetMapping("/list")
60
+    public TableDataInfo list(SysRole role)
61
+    {
62
+        startPage();
63
+        List<SysRole> list = roleService.selectRoleList(role);
64
+        return getDataTable(list);
65
+    }
66
+
67
+    @Log(title = "角色管理", businessType = BusinessType.EXPORT)
68
+    @PreAuthorize("@ss.hasPermi('system:role:export')")
69
+    @PostMapping("/export")
70
+    public void export(HttpServletResponse response, SysRole role)
71
+    {
72
+        List<SysRole> list = roleService.selectRoleList(role);
73
+        ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
74
+        util.exportExcel(response, list, "角色数据");
75
+    }
76
+
77
+    /**
78
+     * 根据角色编号获取详细信息
79
+     */
80
+    @PreAuthorize("@ss.hasPermi('system:role:query')")
81
+    @GetMapping(value = "/{roleId}")
82
+    public AjaxResult getInfo(@PathVariable Long roleId)
83
+    {
84
+        roleService.checkRoleDataScope(roleId);
85
+        return success(roleService.selectRoleById(roleId));
86
+    }
87
+
88
+    /**
89
+     * 新增角色
90
+     */
91
+    @PreAuthorize("@ss.hasPermi('system:role:add')")
92
+    @Log(title = "角色管理", businessType = BusinessType.INSERT)
93
+    @PostMapping
94
+    public AjaxResult add(@Validated @RequestBody SysRole role)
95
+    {
96
+        if (!roleService.checkRoleNameUnique(role))
97
+        {
98
+            return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
99
+        }
100
+        else if (!roleService.checkRoleKeyUnique(role))
101
+        {
102
+            return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
103
+        }
104
+        role.setCreateBy(getUsername());
105
+        return toAjax(roleService.insertRole(role));
106
+
107
+    }
108
+
109
+    /**
110
+     * 修改保存角色
111
+     */
112
+    @PreAuthorize("@ss.hasPermi('system:role:edit')")
113
+    @Log(title = "角色管理", businessType = BusinessType.UPDATE)
114
+    @PutMapping
115
+    public AjaxResult edit(@Validated @RequestBody SysRole role)
116
+    {
117
+        roleService.checkRoleAllowed(role);
118
+        roleService.checkRoleDataScope(role.getRoleId());
119
+        if (!roleService.checkRoleNameUnique(role))
120
+        {
121
+            return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
122
+        }
123
+        else if (!roleService.checkRoleKeyUnique(role))
124
+        {
125
+            return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
126
+        }
127
+        role.setUpdateBy(getUsername());
128
+        
129
+        if (roleService.updateRole(role) > 0)
130
+        {
131
+            // 更新缓存用户权限
132
+            LoginUser loginUser = getLoginUser();
133
+            if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
134
+            {
135
+                loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
136
+                loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
137
+                tokenService.setLoginUser(loginUser);
138
+            }
139
+            return success();
140
+        }
141
+        return error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
142
+    }
143
+
144
+    /**
145
+     * 修改保存数据权限
146
+     */
147
+    @PreAuthorize("@ss.hasPermi('system:role:edit')")
148
+    @Log(title = "角色管理", businessType = BusinessType.UPDATE)
149
+    @PutMapping("/dataScope")
150
+    public AjaxResult dataScope(@RequestBody SysRole role)
151
+    {
152
+        roleService.checkRoleAllowed(role);
153
+        roleService.checkRoleDataScope(role.getRoleId());
154
+        return toAjax(roleService.authDataScope(role));
155
+    }
156
+
157
+    /**
158
+     * 状态修改
159
+     */
160
+    @PreAuthorize("@ss.hasPermi('system:role:edit')")
161
+    @Log(title = "角色管理", businessType = BusinessType.UPDATE)
162
+    @PutMapping("/changeStatus")
163
+    public AjaxResult changeStatus(@RequestBody SysRole role)
164
+    {
165
+        roleService.checkRoleAllowed(role);
166
+        roleService.checkRoleDataScope(role.getRoleId());
167
+        role.setUpdateBy(getUsername());
168
+        return toAjax(roleService.updateRoleStatus(role));
169
+    }
170
+
171
+    /**
172
+     * 删除角色
173
+     */
174
+    @PreAuthorize("@ss.hasPermi('system:role:remove')")
175
+    @Log(title = "角色管理", businessType = BusinessType.DELETE)
176
+    @DeleteMapping("/{roleIds}")
177
+    public AjaxResult remove(@PathVariable Long[] roleIds)
178
+    {
179
+        return toAjax(roleService.deleteRoleByIds(roleIds));
180
+    }
181
+
182
+    /**
183
+     * 获取角色选择框列表
184
+     */
185
+    @PreAuthorize("@ss.hasPermi('system:role:query')")
186
+    @GetMapping("/optionselect")
187
+    public AjaxResult optionselect()
188
+    {
189
+        return success(roleService.selectRoleAll());
190
+    }
191
+
192
+    /**
193
+     * 查询已分配用户角色列表
194
+     */
195
+    @PreAuthorize("@ss.hasPermi('system:role:list')")
196
+    @GetMapping("/authUser/allocatedList")
197
+    public TableDataInfo allocatedList(SysUser user)
198
+    {
199
+        startPage();
200
+        List<SysUser> list = userService.selectAllocatedList(user);
201
+        return getDataTable(list);
202
+    }
203
+
204
+    /**
205
+     * 查询未分配用户角色列表
206
+     */
207
+    @PreAuthorize("@ss.hasPermi('system:role:list')")
208
+    @GetMapping("/authUser/unallocatedList")
209
+    public TableDataInfo unallocatedList(SysUser user)
210
+    {
211
+        startPage();
212
+        List<SysUser> list = userService.selectUnallocatedList(user);
213
+        return getDataTable(list);
214
+    }
215
+
216
+    /**
217
+     * 取消授权用户
218
+     */
219
+    @PreAuthorize("@ss.hasPermi('system:role:edit')")
220
+    @Log(title = "角色管理", businessType = BusinessType.GRANT)
221
+    @PutMapping("/authUser/cancel")
222
+    public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
223
+    {
224
+        return toAjax(roleService.deleteAuthUser(userRole));
225
+    }
226
+
227
+    /**
228
+     * 批量取消授权用户
229
+     */
230
+    @PreAuthorize("@ss.hasPermi('system:role:edit')")
231
+    @Log(title = "角色管理", businessType = BusinessType.GRANT)
232
+    @PutMapping("/authUser/cancelAll")
233
+    public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
234
+    {
235
+        return toAjax(roleService.deleteAuthUsers(roleId, userIds));
236
+    }
237
+
238
+    /**
239
+     * 批量选择用户授权
240
+     */
241
+    @PreAuthorize("@ss.hasPermi('system:role:edit')")
242
+    @Log(title = "角色管理", businessType = BusinessType.GRANT)
243
+    @PutMapping("/authUser/selectAll")
244
+    public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
245
+    {
246
+        roleService.checkRoleDataScope(roleId);
247
+        return toAjax(roleService.insertAuthUsers(roleId, userIds));
248
+    }
249
+
250
+    /**
251
+     * 获取对应角色部门树列表
252
+     */
253
+    @PreAuthorize("@ss.hasPermi('system:role:query')")
254
+    @GetMapping(value = "/deptTree/{roleId}")
255
+    public AjaxResult deptTree(@PathVariable("roleId") Long roleId)
256
+    {
257
+        AjaxResult ajax = AjaxResult.success();
258
+        ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
259
+        ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));
260
+        return ajax;
261
+    }
262
+}

+ 258
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java Bestand weergeven

@@ -0,0 +1,258 @@
1
+package com.ruoyi.web.controller.system;
2
+
3
+import java.util.List;
4
+import java.util.stream.Collectors;
5
+import javax.servlet.http.HttpServletResponse;
6
+
7
+import cn.hutool.core.util.StrUtil;
8
+import com.ruoyi.common.annotation.Anonymous;
9
+import org.apache.commons.lang3.ArrayUtils;
10
+import org.springframework.beans.factory.annotation.Autowired;
11
+import org.springframework.security.access.prepost.PreAuthorize;
12
+import org.springframework.validation.annotation.Validated;
13
+import org.springframework.web.bind.annotation.*;
14
+import org.springframework.web.multipart.MultipartFile;
15
+import com.ruoyi.common.annotation.Log;
16
+import com.ruoyi.common.core.controller.BaseController;
17
+import com.ruoyi.common.core.domain.AjaxResult;
18
+import com.ruoyi.common.core.domain.entity.SysDept;
19
+import com.ruoyi.common.core.domain.entity.SysRole;
20
+import com.ruoyi.common.core.domain.entity.SysUser;
21
+import com.ruoyi.common.core.page.TableDataInfo;
22
+import com.ruoyi.common.enums.BusinessType;
23
+import com.ruoyi.common.utils.SecurityUtils;
24
+import com.ruoyi.common.utils.StringUtils;
25
+import com.ruoyi.common.utils.poi.ExcelUtil;
26
+import com.ruoyi.system.service.ISysDeptService;
27
+import com.ruoyi.system.service.ISysPostService;
28
+import com.ruoyi.system.service.ISysRoleService;
29
+import com.ruoyi.system.service.ISysUserService;
30
+
31
+/**
32
+ * 用户信息
33
+ * 
34
+ * @author ruoyi
35
+ */
36
+@RestController
37
+@RequestMapping("/system/user")
38
+public class SysUserController extends BaseController
39
+{
40
+    @Autowired
41
+    private ISysUserService userService;
42
+
43
+    @Autowired
44
+    private ISysRoleService roleService;
45
+
46
+    @Autowired
47
+    private ISysDeptService deptService;
48
+
49
+    @Autowired
50
+    private ISysPostService postService;
51
+
52
+    /**
53
+     * 获取用户列表
54
+     */
55
+    @PreAuthorize("@ss.hasPermi('system:user:list')")
56
+    @GetMapping("/list")
57
+    public TableDataInfo list(SysUser user)
58
+    {
59
+        startPage();
60
+        List<SysUser> list = userService.selectUserList(user);
61
+        return getDataTable(list);
62
+    }
63
+
64
+    @Log(title = "用户管理", businessType = BusinessType.EXPORT)
65
+    @PreAuthorize("@ss.hasPermi('system:user:export')")
66
+    @PostMapping("/export")
67
+    public void export(HttpServletResponse response, SysUser user)
68
+    {
69
+        List<SysUser> list = userService.selectUserList(user);
70
+        ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
71
+        util.exportExcel(response, list, "用户数据");
72
+    }
73
+
74
+    @Log(title = "用户管理", businessType = BusinessType.IMPORT)
75
+    @PreAuthorize("@ss.hasPermi('system:user:import')")
76
+    @PostMapping("/importData")
77
+    public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
78
+    {
79
+        ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
80
+        List<SysUser> userList = util.importExcel(file.getInputStream());
81
+        String operName = getUsername();
82
+        String message = userService.importUser(userList, updateSupport, operName);
83
+        return success(message);
84
+    }
85
+
86
+    @PostMapping("/importTemplate")
87
+    public void importTemplate(HttpServletResponse response)
88
+    {
89
+        ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
90
+        util.importTemplateExcel(response, "用户数据");
91
+    }
92
+
93
+    /**
94
+     * 根据用户编号获取详细信息
95
+     */
96
+    @PreAuthorize("@ss.hasPermi('system:user:query')")
97
+    @GetMapping(value = { "/", "/{userId}" })
98
+    public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
99
+    {
100
+        userService.checkUserDataScope(userId);
101
+        AjaxResult ajax = AjaxResult.success();
102
+        List<SysRole> roles = roleService.selectRoleAll();
103
+        ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
104
+        ajax.put("posts", postService.selectPostAll());
105
+        if (StringUtils.isNotNull(userId))
106
+        {
107
+            SysUser sysUser = userService.selectUserById(userId);
108
+            ajax.put(AjaxResult.DATA_TAG, sysUser);
109
+            ajax.put("postIds", postService.selectPostListByUserId(userId));
110
+            ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
111
+        }
112
+        return ajax;
113
+    }
114
+
115
+    /**
116
+     * 新增用户
117
+     */
118
+    @PreAuthorize("@ss.hasPermi('system:user:add')")
119
+    @Log(title = "用户管理", businessType = BusinessType.INSERT)
120
+    @PostMapping
121
+    public AjaxResult add(@Validated @RequestBody SysUser user)
122
+    {
123
+        if (!userService.checkUserNameUnique(user))
124
+        {
125
+            return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
126
+        }
127
+        else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
128
+        {
129
+            return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
130
+        }
131
+        else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
132
+        {
133
+            return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
134
+        }
135
+        user.setCreateBy(getUsername());
136
+        user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
137
+        return userService.insertUser(user);
138
+    }
139
+
140
+    /**
141
+     * 修改用户
142
+     */
143
+    @PreAuthorize("@ss.hasPermi('system:user:edit')")
144
+    @Log(title = "用户管理", businessType = BusinessType.UPDATE)
145
+    @PutMapping
146
+    public AjaxResult edit(@Validated @RequestBody SysUser user)
147
+    {
148
+        userService.checkUserAllowed(user);
149
+        userService.checkUserDataScope(user.getUserId());
150
+        if (!userService.checkUserNameUnique(user))
151
+        {
152
+            return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
153
+        }
154
+        else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
155
+        {
156
+            return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
157
+        }
158
+        else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
159
+        {
160
+            return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
161
+        }
162
+        user.setUpdateBy(getUsername());
163
+        return userService.updateUser(user);
164
+    }
165
+
166
+    /**
167
+     * 删除用户
168
+     */
169
+    @PreAuthorize("@ss.hasPermi('system:user:remove')")
170
+    @Log(title = "用户管理", businessType = BusinessType.DELETE)
171
+    @DeleteMapping("/{userIds}")
172
+    public AjaxResult remove(@PathVariable Long[] userIds)
173
+    {
174
+        if (ArrayUtils.contains(userIds, getUserId()))
175
+        {
176
+            return error("当前用户不能删除");
177
+        }
178
+        return toAjax(userService.deleteUserByIds(userIds));
179
+    }
180
+
181
+    /**
182
+     * 重置密码
183
+     */
184
+    @PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
185
+    @Log(title = "用户管理", businessType = BusinessType.UPDATE)
186
+    @PutMapping("/resetPwd")
187
+    public AjaxResult resetPwd(@RequestBody SysUser user)
188
+    {
189
+        userService.checkUserAllowed(user);
190
+        userService.checkUserDataScope(user.getUserId());
191
+        user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
192
+        user.setUpdateBy(getUsername());
193
+        return toAjax(userService.resetPwd(user));
194
+    }
195
+
196
+    /**
197
+     * 状态修改
198
+     */
199
+    @PreAuthorize("@ss.hasPermi('system:user:edit')")
200
+    @Log(title = "用户管理", businessType = BusinessType.UPDATE)
201
+    @PutMapping("/changeStatus")
202
+    public AjaxResult changeStatus(@RequestBody SysUser user)
203
+    {
204
+        userService.checkUserAllowed(user);
205
+        userService.checkUserDataScope(user.getUserId());
206
+        user.setUpdateBy(getUsername());
207
+        return toAjax(userService.updateUserStatus(user));
208
+    }
209
+
210
+    /**
211
+     * 根据用户编号获取授权角色
212
+     */
213
+    @PreAuthorize("@ss.hasPermi('system:user:query')")
214
+    @GetMapping("/authRole/{userId}")
215
+    public AjaxResult authRole(@PathVariable("userId") Long userId)
216
+    {
217
+        AjaxResult ajax = AjaxResult.success();
218
+        SysUser user = userService.selectUserById(userId);
219
+        List<SysRole> roles = roleService.selectRolesByUserId(userId);
220
+        ajax.put("user", user);
221
+        ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
222
+        return ajax;
223
+    }
224
+
225
+    /**
226
+     * 用户授权角色
227
+     */
228
+    @PreAuthorize("@ss.hasPermi('system:user:edit')")
229
+    @Log(title = "用户管理", businessType = BusinessType.GRANT)
230
+    @PutMapping("/authRole")
231
+    public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
232
+    {
233
+        userService.checkUserDataScope(userId);
234
+        userService.insertUserAuth(userId, roleIds);
235
+        return success();
236
+    }
237
+
238
+    /**
239
+     * 获取部门树列表
240
+     */
241
+    @PreAuthorize("@ss.hasPermi('system:user:list')")
242
+    @GetMapping("/deptTree")
243
+    public AjaxResult deptTree(SysDept dept)
244
+    {
245
+        return success(deptService.selectDeptTreeList(dept));
246
+    }
247
+    /**
248
+     * 根据userId获取用户信息
249
+     * @param userId
250
+     * @return
251
+     */
252
+    @Anonymous
253
+    @GetMapping("/selectUserById")
254
+    public AjaxResult selectUserById(@RequestParam(required = true) Long userId){
255
+        return AjaxResult.success(userService.selectUserById(userId));
256
+    }
257
+
258
+}

+ 183
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java Bestand weergeven

@@ -0,0 +1,183 @@
1
+package com.ruoyi.web.controller.tool;
2
+
3
+import java.util.ArrayList;
4
+import java.util.LinkedHashMap;
5
+import java.util.List;
6
+import java.util.Map;
7
+import org.springframework.web.bind.annotation.DeleteMapping;
8
+import org.springframework.web.bind.annotation.GetMapping;
9
+import org.springframework.web.bind.annotation.PathVariable;
10
+import org.springframework.web.bind.annotation.PostMapping;
11
+import org.springframework.web.bind.annotation.PutMapping;
12
+import org.springframework.web.bind.annotation.RequestBody;
13
+import org.springframework.web.bind.annotation.RequestMapping;
14
+import org.springframework.web.bind.annotation.RestController;
15
+import com.ruoyi.common.core.controller.BaseController;
16
+import com.ruoyi.common.core.domain.R;
17
+import com.ruoyi.common.utils.StringUtils;
18
+import io.swagger.annotations.Api;
19
+import io.swagger.annotations.ApiImplicitParam;
20
+import io.swagger.annotations.ApiImplicitParams;
21
+import io.swagger.annotations.ApiModel;
22
+import io.swagger.annotations.ApiModelProperty;
23
+import io.swagger.annotations.ApiOperation;
24
+
25
+/**
26
+ * swagger 用户测试方法
27
+ * 
28
+ * @author ruoyi
29
+ */
30
+@Api("用户信息管理")
31
+@RestController
32
+@RequestMapping("/test/user")
33
+public class TestController extends BaseController
34
+{
35
+    private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
36
+    {
37
+        users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
38
+        users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
39
+    }
40
+
41
+    @ApiOperation("获取用户列表")
42
+    @GetMapping("/list")
43
+    public R<List<UserEntity>> userList()
44
+    {
45
+        List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
46
+        return R.ok(userList);
47
+    }
48
+
49
+    @ApiOperation("获取用户详细")
50
+    @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
51
+    @GetMapping("/{userId}")
52
+    public R<UserEntity> getUser(@PathVariable Integer userId)
53
+    {
54
+        if (!users.isEmpty() && users.containsKey(userId))
55
+        {
56
+            return R.ok(users.get(userId));
57
+        }
58
+        else
59
+        {
60
+            return R.fail("用户不存在");
61
+        }
62
+    }
63
+
64
+    @ApiOperation("新增用户")
65
+    @ApiImplicitParams({
66
+        @ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class),
67
+        @ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class),
68
+        @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class),
69
+        @ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class)
70
+    })
71
+    @PostMapping("/save")
72
+    public R<String> save(UserEntity user)
73
+    {
74
+        if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
75
+        {
76
+            return R.fail("用户ID不能为空");
77
+        }
78
+        users.put(user.getUserId(), user);
79
+        return R.ok();
80
+    }
81
+
82
+    @ApiOperation("更新用户")
83
+    @PutMapping("/update")
84
+    public R<String> update(@RequestBody UserEntity user)
85
+    {
86
+        if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
87
+        {
88
+            return R.fail("用户ID不能为空");
89
+        }
90
+        if (users.isEmpty() || !users.containsKey(user.getUserId()))
91
+        {
92
+            return R.fail("用户不存在");
93
+        }
94
+        users.remove(user.getUserId());
95
+        users.put(user.getUserId(), user);
96
+        return R.ok();
97
+    }
98
+
99
+    @ApiOperation("删除用户信息")
100
+    @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
101
+    @DeleteMapping("/{userId}")
102
+    public R<String> delete(@PathVariable Integer userId)
103
+    {
104
+        if (!users.isEmpty() && users.containsKey(userId))
105
+        {
106
+            users.remove(userId);
107
+            return R.ok();
108
+        }
109
+        else
110
+        {
111
+            return R.fail("用户不存在");
112
+        }
113
+    }
114
+}
115
+
116
+@ApiModel(value = "UserEntity", description = "用户实体")
117
+class UserEntity
118
+{
119
+    @ApiModelProperty("用户ID")
120
+    private Integer userId;
121
+
122
+    @ApiModelProperty("用户名称")
123
+    private String username;
124
+
125
+    @ApiModelProperty("用户密码")
126
+    private String password;
127
+
128
+    @ApiModelProperty("用户手机")
129
+    private String mobile;
130
+
131
+    public UserEntity()
132
+    {
133
+
134
+    }
135
+
136
+    public UserEntity(Integer userId, String username, String password, String mobile)
137
+    {
138
+        this.userId = userId;
139
+        this.username = username;
140
+        this.password = password;
141
+        this.mobile = mobile;
142
+    }
143
+
144
+    public Integer getUserId()
145
+    {
146
+        return userId;
147
+    }
148
+
149
+    public void setUserId(Integer userId)
150
+    {
151
+        this.userId = userId;
152
+    }
153
+
154
+    public String getUsername()
155
+    {
156
+        return username;
157
+    }
158
+
159
+    public void setUsername(String username)
160
+    {
161
+        this.username = username;
162
+    }
163
+
164
+    public String getPassword()
165
+    {
166
+        return password;
167
+    }
168
+
169
+    public void setPassword(String password)
170
+    {
171
+        this.password = password;
172
+    }
173
+
174
+    public String getMobile()
175
+    {
176
+        return mobile;
177
+    }
178
+
179
+    public void setMobile(String mobile)
180
+    {
181
+        this.mobile = mobile;
182
+    }
183
+}

+ 191
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java Bestand weergeven

@@ -0,0 +1,191 @@
1
+package com.ruoyi.web.controller.wisdomarbitrate;
2
+
3
+import cn.hutool.core.collection.CollectionUtil;
4
+import cn.hutool.core.util.StrUtil;
5
+import com.ruoyi.common.core.controller.BaseController;
6
+import com.ruoyi.common.core.domain.AjaxResult;
7
+import com.ruoyi.common.core.page.TableDataInfo;
8
+import com.ruoyi.common.core.redis.RedisCache;
9
+import com.ruoyi.wisdomarbitrate.StringIdsReq;
10
+import com.ruoyi.wisdomarbitrate.domain.BatchCaseApplication;
11
+import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
12
+import com.ruoyi.wisdomarbitrate.domain.SealSignRecord;
13
+import com.ruoyi.wisdomarbitrate.domain.vo.BookSendVO;
14
+import com.ruoyi.wisdomarbitrate.domain.vo.LogisticsInfoVO;
15
+import com.ruoyi.wisdomarbitrate.service.IAdjudicationService;
16
+import org.springframework.beans.factory.annotation.Autowired;
17
+import org.springframework.security.access.prepost.PreAuthorize;
18
+import org.springframework.validation.annotation.Validated;
19
+import org.springframework.web.bind.annotation.*;
20
+
21
+import java.util.List;
22
+
23
+@RestController
24
+@RequestMapping("/adjudication")
25
+public class AdjudicationController extends BaseController {
26
+    @Autowired
27
+    private IAdjudicationService adjudicationService;
28
+
29
+    /**
30
+     * 根据签署流程id查询批量签名链接
31
+     */
32
+//    @PreAuthorize("@ss.hasPermi('caseManagement:list:selectSignUrl')")
33
+    @PostMapping("/selectBatchSignUrl")
34
+    public AjaxResult selectBatchSignUrl(@RequestBody StringIdsReq idsReq) {
35
+        if(CollectionUtil.isEmpty(idsReq.getIds())|| StrUtil.isEmpty(idsReq.getPsnAccount())){
36
+            return error("参数校验失败");
37
+        }
38
+        SealSignRecord sealSignRecordselect = adjudicationService.selectBatchSignUrl(idsReq);
39
+        return success(sealSignRecordselect);
40
+    }
41
+
42
+    /**
43
+     * 根据签署流程id查询批量用印链接
44
+     */
45
+//    @PreAuthorize("@ss.hasPermi('caseManagement:list:selectSignUrl')")
46
+    @PostMapping("/selectBatchSealUrl")
47
+    public AjaxResult selectBatchSealUrl(@RequestBody StringIdsReq idsReq) {
48
+        if(CollectionUtil.isEmpty(idsReq.getIds())|| StrUtil.isEmpty(idsReq.getPsnAccount())){
49
+            return error("参数校验失败");
50
+        }
51
+        SealSignRecord sealSignRecordselect = adjudicationService.selectBatchSealUrl(idsReq);
52
+        return success(sealSignRecordselect);
53
+    }
54
+    /**
55
+     * 根据仲裁员手机号分页查询待签名/待用印的案件
56
+     */
57
+//    @PreAuthorize("@ss.hasPermi('caseManagement:list:selectSignUrl')")
58
+    @GetMapping("/pageSignAdjudicate")
59
+    public TableDataInfo pageSignAdjudicate(@RequestParam(value = "personAccount",required = false) String personAccount, @RequestParam("caseStatus") Integer caseStatus)  {
60
+        startPage();
61
+        List<CaseApplication> list = adjudicationService.selectSealSigning(personAccount,caseStatus);
62
+        return getDataTable(list);
63
+    }
64
+
65
+
66
+    /**
67
+     * 生成裁决书
68
+     * @param caseApplication
69
+     * @return
70
+     */
71
+    @PostMapping("/document")
72
+    public AjaxResult createDocument(@Validated @RequestBody CaseApplication caseApplication){
73
+        if (caseApplication.getId() == null) {
74
+            return AjaxResult.error("案件id不能为空");
75
+        }
76
+        return adjudicationService.createDocument(caseApplication);
77
+    }
78
+    /**
79
+     * 批量生成裁决书
80
+     * @param caseApplication
81
+     * @return
82
+     */
83
+    @PostMapping("/batchDocument")
84
+    public AjaxResult batchDocument(@Validated @RequestBody BatchCaseApplication caseApplication){
85
+        if (CollectionUtil.isEmpty(caseApplication.getIds())) {
86
+            return AjaxResult.error("参数校验失败");
87
+        }
88
+        return adjudicationService.batchDocument(caseApplication.getIds());
89
+    }
90
+
91
+    /**
92
+     * 重新生成裁决书
93
+     * @param caseApplication
94
+     * @return
95
+     */
96
+    @PostMapping("/regenerationDocument")
97
+    public AjaxResult regenerationDocument(@Validated @RequestBody CaseApplication caseApplication){
98
+        return adjudicationService.regenerationDocument(caseApplication);
99
+    }
100
+
101
+    /**
102
+     * 裁决书送达(电子邮件)
103
+     * @param bookSendVO
104
+     * @return
105
+     */
106
+    @PostMapping("/delivery")
107
+    public AjaxResult sendDocumentByEmail(@RequestBody BookSendVO bookSendVO){
108
+        return adjudicationService.sendDocumentByEmail(bookSendVO.getId(),bookSendVO.getAppEmail(),bookSendVO.getResEmail(),bookSendVO.getApptrackingNum(),bookSendVO.getRestrackingNum());
109
+    }
110
+
111
+    /**
112
+     * 根据快递单号查询物流信息
113
+     * @param caseApplication
114
+     * @return
115
+     */
116
+    @GetMapping("/logistics")
117
+//    @PreAuthorize("@ss.hasPermi('delivery:detail')")
118
+    public AjaxResult  getLogisticsInfo(CaseApplication caseApplication){
119
+        List<LogisticsInfoVO> logisticsInfo = adjudicationService.getLogisticsInfo(caseApplication);
120
+        return AjaxResult.success(logisticsInfo);
121
+    }
122
+
123
+    /**
124
+     * 签名(暂时只改案件状态)
125
+     * @param caseApplication
126
+     * @return
127
+     */
128
+    @PostMapping("/signature")
129
+//    @PreAuthorize("@ss.hasPermi('awardManagement:list:sign')")
130
+    public AjaxResult signature(@Validated @RequestBody CaseApplication caseApplication){
131
+        return adjudicationService.signature(caseApplication);
132
+    }
133
+
134
+
135
+    /**
136
+     * 归档(暂时只改案件状态)
137
+     * @param batchCaseApplication
138
+     * @return
139
+     */
140
+    @PostMapping("/caseFile")
141
+//    @PreAuthorize("@ss.hasPermi('awardManagement:list:file')")
142
+    public AjaxResult caseFile(@RequestBody BatchCaseApplication batchCaseApplication){
143
+        if(CollectionUtil.isEmpty(batchCaseApplication.getIds())){
144
+            return error("参数校验失败");
145
+        }
146
+        return adjudicationService.caseFile(batchCaseApplication.getIds());
147
+    }
148
+
149
+    /**
150
+     * 送达(不包含发送电子邮件)
151
+     * @param bookSendVO
152
+     * @return
153
+     */
154
+    @PostMapping("/service")
155
+//    @PreAuthorize("@ss.hasPermi('awardManagement:list:sendaward')")
156
+    public AjaxResult service(@RequestBody BookSendVO bookSendVO){
157
+        return adjudicationService.service(bookSendVO.getId(),bookSendVO.getAppEmail(),bookSendVO.getResEmail(),bookSendVO.getApptrackingNum(),bookSendVO.getRestrackingNum());
158
+    }
159
+    /**
160
+     * 用印(暂时只改案件状态)
161
+     * @param caseApplication
162
+     * @return
163
+     */
164
+    @PostMapping("/stamp")
165
+//    @PreAuthorize("@ss.hasPermi('awardManagement:list:signprint')")
166
+    public AjaxResult stamp(@Validated @RequestBody CaseApplication caseApplication){
167
+        return adjudicationService.stamp(caseApplication);
168
+    }
169
+
170
+    /**
171
+     * 档案详情查询
172
+     * @param id 案件id
173
+     * @return
174
+     */
175
+    @GetMapping("/archives")
176
+    public AjaxResult getArchivesDetail(Long id){
177
+
178
+        return adjudicationService.getArchivesDetail(id);
179
+    }
180
+    /**
181
+     * 根据案件id获取邮箱
182
+     * @param id 案件id
183
+     * @return
184
+     */
185
+    @GetMapping("/emailByCaseId")
186
+    public AjaxResult emailByCaseId(@RequestParam("id") Long id){
187
+
188
+        return adjudicationService.emailByCaseId(id);
189
+    }
190
+
191
+}

+ 44
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/ArbitratorController.java Bestand weergeven

@@ -0,0 +1,44 @@
1
+package com.ruoyi.web.controller.wisdomarbitrate;
2
+
3
+import com.ruoyi.common.core.controller.BaseController;
4
+import com.ruoyi.common.core.domain.entity.SysUser;
5
+import com.ruoyi.common.core.page.TableDataInfo;
6
+import com.ruoyi.system.mapper.SysUserMapper;
7
+import com.ruoyi.system.service.ISysUserService;
8
+import com.ruoyi.wisdomarbitrate.domain.Arbitrator;
9
+import com.ruoyi.wisdomarbitrate.service.IArbitratorService;
10
+import org.springframework.beans.factory.annotation.Autowired;
11
+import org.springframework.security.access.prepost.PreAuthorize;
12
+import org.springframework.web.bind.annotation.GetMapping;
13
+import org.springframework.web.bind.annotation.RequestMapping;
14
+import org.springframework.web.bind.annotation.RestController;
15
+
16
+import java.util.List;
17
+
18
+@RestController
19
+@RequestMapping("/arbitrator")
20
+public class ArbitratorController   extends BaseController {
21
+    @Autowired
22
+    private ISysUserService sysUserService;
23
+
24
+    /**
25
+     * 查询仲裁员信息
26
+     */
27
+//    @PreAuthorize("@ss.hasPermi('arbitrator:list')")
28
+    @GetMapping("/list")
29
+    public TableDataInfo list(Arbitrator arbitrator)
30
+    {
31
+        startPage();
32
+        List<SysUser> list = sysUserService.selectUserListByAdRole(arbitrator);
33
+        return getDataTable(list);
34
+    }
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+}

+ 588
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java Bestand weergeven

@@ -0,0 +1,588 @@
1
+package com.ruoyi.web.controller.wisdomarbitrate;
2
+
3
+import cn.hutool.core.collection.CollectionUtil;
4
+import cn.hutool.core.util.StrUtil;
5
+import com.alipay.api.internal.util.file.IOUtils;
6
+import com.ruoyi.common.annotation.Anonymous;
7
+import com.ruoyi.common.annotation.Log;
8
+import com.ruoyi.common.constant.FileTransformation;
9
+import com.ruoyi.common.core.controller.BaseController;
10
+import com.ruoyi.common.core.domain.AjaxResult;
11
+import com.ruoyi.common.core.page.TableDataInfo;
12
+import com.ruoyi.common.enums.BusinessType;
13
+import com.ruoyi.common.exception.EsignDemoException;
14
+import com.ruoyi.common.exception.ServiceException;
15
+import com.ruoyi.common.utils.StringUtils;
16
+import com.ruoyi.common.utils.WxAppletNotifyUtils;
17
+import com.ruoyi.util.FileUtil;
18
+import com.ruoyi.wisdomarbitrate.StringIdsReq;
19
+import com.ruoyi.wisdomarbitrate.domain.*;
20
+import com.ruoyi.wisdomarbitrate.domain.vo.ReservedConferenceVO;
21
+import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
22
+import com.ruoyi.wisdomarbitrate.domain.vo.ToDoCount;
23
+import com.ruoyi.wisdomarbitrate.service.IAdjudicationService;
24
+import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
25
+import org.springframework.beans.factory.annotation.Autowired;
26
+import org.springframework.security.access.prepost.PreAuthorize;
27
+import org.springframework.validation.annotation.Validated;
28
+import org.springframework.web.bind.annotation.*;
29
+import com.ruoyi.common.utils.poi.ExcelUtil;
30
+import org.springframework.web.multipart.MultipartFile;
31
+
32
+import javax.servlet.ServletException;
33
+import javax.servlet.http.HttpServletRequest;
34
+import javax.servlet.http.HttpServletResponse;
35
+import java.io.*;
36
+import java.net.URL;
37
+import java.net.URLEncoder;
38
+import java.util.List;
39
+
40
+
41
+@RestController
42
+@RequestMapping("/caseApplication")
43
+public class CaseApplicationController extends BaseController {
44
+    @Autowired
45
+    private ICaseApplicationService caseApplicationService;
46
+    @Autowired
47
+    private IAdjudicationService adjudicationService;
48
+
49
+
50
+    /**
51
+     * 查询立案数据
52
+     */
53
+//    @PreAuthorize("@ss.hasPermi('caseManagement:list')")
54
+    @GetMapping("/list")
55
+    public TableDataInfo list(CaseApplication caseApplication) {
56
+        if(StrUtil.isEmpty(caseApplication.getSelectCaseStatus())){
57
+          caseApplication.setSelectCaseStatus("0");
58
+        }
59
+        startPage();
60
+        List<CaseApplication> list = caseApplicationService.selectCaseApplicationListByRole(caseApplication);
61
+        return getDataTable(list);
62
+    }
63
+
64
+    /**
65
+     * 查询批量管理案件列表
66
+     */
67
+    @GetMapping("/listBatch")
68
+    public TableDataInfo listBatch(CaseApplication caseApplication) {
69
+        startPage();
70
+        List<CaseApplication> list = caseApplicationService.selectCaseApplicationListBatchByRole(caseApplication);
71
+        return getDataTable(list);
72
+    }
73
+
74
+    /**
75
+     * 根据角色查询待办数量
76
+     * @return
77
+     */
78
+
79
+    @GetMapping("/toDoCount")
80
+    public AjaxResult toDoCount() {
81
+        ToDoCount toDoCount = caseApplicationService.selectToDoCount();
82
+//        List<CaseApplication> list = caseApplicationService.selectCaseApplicationList(caseApplication);
83
+        return success(toDoCount);
84
+    }
85
+
86
+    /**
87
+     * 新增立案数据
88
+     */
89
+//    @PreAuthorize("@ss.hasPermi('caseManagement:list:add')")
90
+    @Log(title = "新增立案数据", businessType = BusinessType.INSERT)
91
+    @PostMapping("/addCaseApplication")
92
+    public AjaxResult addCaseApplication(@Validated @RequestBody CaseApplication caseApplication)
93
+    {
94
+
95
+        caseApplication.setCreateBy(getUsername());
96
+        return toAjax(caseApplicationService.insertcaseApplication(caseApplication));
97
+    }
98
+
99
+    /**
100
+     * 修改立案数据
101
+     */
102
+//    @PreAuthorize("@ss.hasPermi('caseManagement:list:update')")
103
+    @Log(title = "修改立案数据", businessType = BusinessType.UPDATE)
104
+    @PostMapping("/editCaseApplication")
105
+    public AjaxResult editCaseApplication(@Validated @RequestBody CaseApplication caseApplication) {
106
+
107
+        caseApplication.setUpdateBy(getUsername());
108
+        return caseApplicationService.editCaseApplication(caseApplication);
109
+    }
110
+
111
+    /**
112
+     * 修改立案数据自定义字段
113
+     */
114
+//    @PreAuthorize("@ss.hasPermi('caseManagement:list:update')")
115
+    @Log(title = "修改立案数据自定义字段", businessType = BusinessType.UPDATE)
116
+    @PostMapping("/editCaseApplicationDefineval")
117
+    public AjaxResult editCaseApplicationDefineval(@Validated @RequestBody CaseApplication caseApplication) {
118
+        return caseApplicationService.editCaseApplicationDefineval(caseApplication);
119
+    }
120
+
121
+    /**
122
+     * 提交立案申请
123
+     */
124
+//    @PreAuthorize("@ss.hasPermi('caseManagement:list:submit')")
125
+    @Log(title = "提交立案申请", businessType = BusinessType.UPDATE)
126
+    @PostMapping("/submitCaseApplication")
127
+    public AjaxResult submitCaseApplication(@RequestBody  BatchCaseApplication batchCaseApplication) {
128
+        if(CollectionUtil.isEmpty(batchCaseApplication.getIds())){
129
+            return error("参数校验失败");
130
+        }
131
+        return toAjax(caseApplicationService.submitCaseApplication(batchCaseApplication.getIds()));
132
+    }
133
+
134
+    /**
135
+     * 批量提交立案申请
136
+     */
137
+    @Log(title = "批量提交立案申请", businessType = BusinessType.UPDATE)
138
+    @PostMapping("/submitCaseApplicationBatch")
139
+    public AjaxResult submitCaseApplicationBatch(@RequestBody  BatchCaseApplication batchCaseApplication) {
140
+        if(StringUtils.isEmpty(batchCaseApplication.getBatchNumber())){
141
+            return error("参数校验失败");
142
+        }
143
+        return toAjax(caseApplicationService.submitCaseApplicationBatch(batchCaseApplication.getBatchNumber()));
144
+    }
145
+
146
+
147
+
148
+
149
+    /**
150
+     * 删除立案数据
151
+     */
152
+//    @PreAuthorize("@ss.hasPermi('caseManagement:list:delete')")
153
+    @Log(title = "删除立案数据", businessType = BusinessType.DELETE)
154
+    @PostMapping("/removeCaseApplication")
155
+    public AjaxResult removeCaseApplication(@RequestBody  BatchCaseApplication batchCaseApplication) {
156
+        if(CollectionUtil.isEmpty(batchCaseApplication.getIds())){
157
+            return error("参数校验失败");
158
+        }
159
+        return success(caseApplicationService.deletecaseApplicationByIds(batchCaseApplication.getIds()));
160
+    }
161
+
162
+    /**
163
+     * 查询立案信息
164
+     */
165
+//     @PreAuthorize("@ss.hasPermi('caseManagement:list:detail')")
166
+    @PostMapping("/selectCaseApplication")
167
+    public AjaxResult selectCaseApplication(@Validated @RequestBody CaseApplication caseApplication) {
168
+
169
+        CaseApplication caseApplicationselect = caseApplicationService.selectCaseApplication(caseApplication);
170
+        return success(caseApplicationselect);
171
+    }
172
+
173
+    /**
174
+     * 查询已签署裁决书URL
175
+     */
176
+    @PostMapping("/selectSignSealUrl")
177
+    public AjaxResult selectSignSealUrl(@Validated @RequestBody CaseApplication caseApplication) throws EsignDemoException {
178
+        CaseApplication caseApplicationselect = caseApplicationService.selectSignSealUrl(caseApplication);
179
+        return success(caseApplicationselect);
180
+    }
181
+
182
+    /**
183
+     * 查询案件进度
184
+     */
185
+    @PostMapping("/selectCaseProgress")
186
+    public AjaxResult selectCaseProgress(@Validated @RequestBody CaseApplication caseApplication) {
187
+        AjaxResult caseApplicationselect = caseApplicationService.selectCaseProgress(caseApplication);
188
+        return success(caseApplicationselect);
189
+    }
190
+
191
+
192
+    /**
193
+     * 查询签名链接
194
+     */
195
+//    @PreAuthorize("@ss.hasPermi('caseManagement:list:selectSignUrl')")
196
+    @PostMapping("/selectSignUrl")
197
+    public AjaxResult selectSignUrl(@Validated @RequestBody CaseApplication caseApplication) throws EsignDemoException {
198
+        SealSignRecord sealSignRecordselect = caseApplicationService.selectSignUrl(caseApplication);
199
+        return success(sealSignRecordselect);
200
+    }
201
+
202
+
203
+    /**
204
+     * 查询用印链接
205
+     */
206
+//    @PreAuthorize("@ss.hasPermi('caseManagement:list:selectSealUrl')")
207
+    @PostMapping("/selectSealUrl")
208
+    public AjaxResult selectSealUrl(@Validated @RequestBody CaseApplication caseApplication) throws EsignDemoException {
209
+        SealSignRecord sealUrlRecordselect = caseApplicationService.selectSealUrl(caseApplication);
210
+        return success(sealUrlRecordselect);
211
+    }
212
+
213
+
214
+    /**
215
+     * 案件证据材料压缩包上传
216
+     *
217
+     * @param file      附件
218
+     * @param id        案件申请id
219
+     * @return
220
+     */
221
+    @PostMapping("/uploadZipFile")
222
+    public AjaxResult uploadZipFile(@RequestParam("file") MultipartFile file, Long id) {
223
+        String username = this.getUsername();
224
+        Long userId = this.getUserId();
225
+        return caseApplicationService.uploadZipFile(file, id, username, userId);
226
+    }
227
+
228
+    /**
229
+     * 立案申请导入模板下载
230
+     */
231
+    @PostMapping("/importTemplate")
232
+    public void importTemplate(HttpServletResponse response) {
233
+        // 读取文件
234
+        try {
235
+            InputStream fileInputStream = new URL("http://121.40.189.20:8000/API/uploadPath/template/案件导入模板.xlsx").openStream();
236
+            response.setHeader("content-type", "application/octet-stream");
237
+            response.setContentType("application/octet-stream");
238
+            response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("案件导入模板.xlsx","UTF-8"));
239
+                        byte[] buffer = new byte[1024];
240
+            int length;
241
+            while ((length = fileInputStream.read(buffer)) > 0) {
242
+                response.getOutputStream().write(buffer, 0, length);
243
+            }
244
+
245
+        } catch (IOException e) {
246
+            throw new RuntimeException(e);
247
+        }
248
+
249
+    }
250
+
251
+    @Log(title = "立案信息导入", businessType = BusinessType.IMPORT)
252
+//    @PreAuthorize("@ss.hasPermi('caseManagement:list:import')")
253
+    @PostMapping("/importData")
254
+    public AjaxResult importData(MultipartFile file) throws Exception {
255
+        if(file==null){
256
+            return warn("请上传文件");
257
+        }
258
+        ExcelUtil<CaseApplication> util = new ExcelUtil<CaseApplication>(CaseApplication.class);
259
+        List<CaseApplication> caseApplicationList = util.importExcel(file.getInputStream());
260
+        String operName = getUsername();
261
+        String message = caseApplicationService.importCaseApplication(caseApplicationList, operName);
262
+        return success(message);
263
+    }
264
+
265
+    /**
266
+     * 组庭
267
+     */
268
+//    @PreAuthorize("@ss.hasPermi('caseApplication:pendTral')")
269
+    @Log(title = "组庭", businessType = BusinessType.UPDATE)
270
+    @PostMapping("/pendTral")
271
+    public AjaxResult pendTral(@Validated @RequestBody CaseApplication caseApplication) {
272
+        return toAjax(caseApplicationService.pendTral(caseApplication));
273
+    }
274
+
275
+    /**
276
+     * 组庭审核
277
+     */
278
+//    @PreAuthorize("@ss.hasPermi('caseManagement:list:checkgroup')")
279
+    @Log(title = "组庭审核", businessType = BusinessType.UPDATE)
280
+    @PostMapping("/pendTralCheck")
281
+    public AjaxResult pendTralCheck(@Validated @RequestBody CaseApplication caseApplication) {
282
+        return toAjax(caseApplicationService.pendTralCheck(caseApplication));
283
+    }
284
+
285
+    /**
286
+     * 组庭确认
287
+     */
288
+//    @PreAuthorize("@ss.hasPermi('caseManagement:list:confirmgroup')")
289
+    @Log(title = "组庭确认", businessType = BusinessType.UPDATE)
290
+    @PostMapping("/pendTralSure")
291
+    public AjaxResult pendTralSure(@Validated @RequestBody CaseApplication caseApplication) {
292
+        return toAjax(caseApplicationService.pendTralSure(caseApplication));
293
+    }
294
+
295
+    /**
296
+     * 批量组庭审核
297
+     */
298
+//    @PreAuthorize("@ss.hasPermi('caseManagement:list:checkgroup')")
299
+    @Log(title = "批量组庭审核", businessType = BusinessType.UPDATE)
300
+    @PostMapping("/pendTralCheckBatch")
301
+    public AjaxResult pendTralCheckBatch(@Validated @RequestBody CaseApplication caseApplication) {
302
+        return toAjax(caseApplicationService.pendTralCheckBatch(caseApplication));
303
+    }
304
+
305
+    /**
306
+     * 批量组庭确认
307
+     */
308
+    @Log(title = "批量组庭确认", businessType = BusinessType.UPDATE)
309
+    @PostMapping("/pendTralSureBatch")
310
+    public AjaxResult pendTralSureBatch(@Validated @RequestBody CaseApplication caseApplication) {
311
+        return toAjax(caseApplicationService.pendTralSureBatch(caseApplication));
312
+    }
313
+
314
+    /**
315
+     * 修改开庭时间
316
+     */
317
+    @Log(title = "修改开庭时间", businessType = BusinessType.UPDATE)
318
+    @PostMapping("/updateHeardate")
319
+    public AjaxResult updateHeardate(@Validated @RequestBody CaseApplication caseApplication) {
320
+        return toAjax(caseApplicationService.updateHeardate(caseApplication));
321
+    }
322
+
323
+    /**
324
+     * 核验裁决书
325
+     */
326
+//    @PreAuthorize("@ss.hasPermi('caseApplication:verificationArbitrateRecord')")
327
+    @Log(title = "核验裁决书", businessType = BusinessType.UPDATE)
328
+    @PostMapping("/verificationArbitrateRecord")
329
+    public AjaxResult verificationArbitrateRecord(@Validated @RequestBody CaseApplication caseApplication) {
330
+        return toAjax(caseApplicationService.verificationArbitrateRecord(caseApplication));
331
+    }
332
+
333
+    /**
334
+     * 部门长审核裁决书
335
+     */
336
+//    @PreAuthorize("@ss.hasPermi('caseApplication:checkArbitrateRecord')")
337
+    @Log(title = "部门长审核裁决书", businessType = BusinessType.UPDATE)
338
+    @PostMapping("/checkArbitrateRecord")
339
+    public AjaxResult checkArbitrateRecord(@Validated @RequestBody CaseApplication caseApplication) {
340
+
341
+        return caseApplicationService.checkArbitrateRecord(caseApplication);
342
+    }
343
+    /**
344
+     * 仲裁员审核裁决书
345
+     */
346
+//    @PreAuthorize("@ss.hasPermi('caseApplication:checkArbitrateRecord')")
347
+    @Log(title = "仲裁员审核裁决书", businessType = BusinessType.UPDATE)
348
+    @PostMapping("/arbitrator/checkArbitrateRecord")
349
+    public AjaxResult arbitratorCheckArbitrateRecord(@Validated @RequestBody CaseApplication caseApplication) {
350
+
351
+        return caseApplicationService.arbitratorCheckArbitrateRecord(caseApplication);
352
+    }
353
+
354
+    /**
355
+     * 批量操作仲裁员审核裁决书
356
+     */
357
+    @Log(title = "批量操作仲裁员审核裁决书", businessType = BusinessType.UPDATE)
358
+    @PostMapping("/arbitrator/checkArbitrateRecordBatch")
359
+    public AjaxResult arbitratorCheckArbitrateRecordBatch(@Validated @RequestBody CaseApplication caseApplication) {
360
+
361
+        return caseApplicationService.arbitratorCheckArbitrateRecordBatch(caseApplication);
362
+    }
363
+
364
+    /**
365
+     * 批量部门长审核裁决书
366
+     */
367
+    @Log(title = "批量部门长审核裁决书", businessType = BusinessType.UPDATE)
368
+    @PostMapping("/checkArbitrateRecordBatch")
369
+    public AjaxResult checkArbitrateRecordBatch(@Validated @RequestBody CaseApplication caseApplication) {
370
+
371
+        return caseApplicationService.checkArbitrateRecordBatch(caseApplication);
372
+    }
373
+
374
+    /**
375
+     * 批量核验裁决书
376
+     */
377
+    @Log(title = "批量核验裁决书", businessType = BusinessType.UPDATE)
378
+    @PostMapping("/verificationArbitrateRecordBatch")
379
+    public AjaxResult verificationArbitrateRecordBatch(@Validated @RequestBody CaseApplication caseApplication) {
380
+        return toAjax(caseApplicationService.verificationArbitrateRecordBatch(caseApplication));
381
+    }
382
+
383
+
384
+    /**
385
+     * 是否指派仲裁员
386
+     */
387
+//    @PreAuthorize("@ss.hasPermi('caseApplication:pendingAppointArbotrar')")
388
+    @Log(title = "是否指派仲裁员", businessType = BusinessType.UPDATE)
389
+    @PostMapping("/pendingAppointArbotrar")
390
+    public AjaxResult pendingAppointArbotrar(@Validated @RequestBody CaseApplication caseApplication) {
391
+        return toAjax(caseApplicationService.pendingAppointArbotrar(caseApplication));
392
+    }
393
+
394
+    /**
395
+     * 提交立案审查
396
+     */
397
+//    @PreAuthorize("@ss.hasPermi('caseManagement:list:check')")
398
+    @Log(title = "提交立案审查", businessType = BusinessType.UPDATE)
399
+    @PostMapping("/submitCaseApplicationCheck")
400
+    public AjaxResult submitCaseApplicationCheck(@RequestBody BatchCaseApplication batchCaseApplication) {
401
+        if(CollectionUtil.isEmpty(batchCaseApplication.getIds())|| batchCaseApplication.getAgreeOrNotCheck()==null){
402
+            return error("参数校验失败");
403
+        }
404
+        return success(caseApplicationService.submitCaseApplicationCheck(batchCaseApplication.getIds(),batchCaseApplication.getAgreeOrNotCheck(),batchCaseApplication.getCaseCheckReject()));
405
+    }
406
+
407
+    /**
408
+     * 确认缴费查询立案信息
409
+     */
410
+//    @PreAuthorize("@ss.hasPermi('paymentManagement:list:detail')")
411
+    @PostMapping("/selectCaseApplicationConfirm")
412
+    public AjaxResult selectCaseApplicationConfirm(@Validated @RequestBody CaseApplication caseApplication) {
413
+        CaseApplication caseApplicationselect = caseApplicationService.selectCaseApplicationConfirm(caseApplication);
414
+        return success(caseApplicationselect);
415
+    }
416
+
417
+    /**
418
+     * 批量提交立案审查
419
+     */
420
+    @Log(title = "批量提交立案审查", businessType = BusinessType.UPDATE)
421
+    @PostMapping("/submitCaseApplicationCheckBatch")
422
+    public AjaxResult submitCaseApplicationCheckBatch(@RequestBody BatchCaseApplication batchCaseApplication) {
423
+        if(StringUtils.isEmpty(batchCaseApplication.getBatchNumber()) || batchCaseApplication.getAgreeOrNotCheck()==null){
424
+            return error("参数校验失败");
425
+        }
426
+        return success(caseApplicationService.submitCaseApplicationCheckBatch(batchCaseApplication.getBatchNumber(),batchCaseApplication.getAgreeOrNotCheck(),batchCaseApplication.getCaseCheckReject()));
427
+    }
428
+
429
+    /**
430
+     * 下载案件压缩包
431
+     */
432
+    @PostMapping("/downloadCaseZipFile")
433
+    public AjaxResult downloadCaseZipFile(@Validated @RequestBody CaseApplication caseApplication) {
434
+
435
+        CaseAttach caseAttach = caseApplicationService.downloadCaseZipFile(caseApplication);
436
+        return success(caseAttach);
437
+    }
438
+
439
+
440
+
441
+
442
+
443
+    /**
444
+     * 发送房间号短信
445
+     */
446
+    @Anonymous
447
+    @PostMapping("/sendRoomNoMessage")
448
+    public AjaxResult sendRoomNoMessage(@Validated @RequestBody SendRoomNoMessageVO messageVO) {
449
+        String result = caseApplicationService.sendRoomNoMessage(messageVO);
450
+        return success(result);
451
+    }
452
+    /**
453
+     * 获取UrlScheme
454
+     */
455
+    @Anonymous
456
+    @GetMapping("/getUrlScheme")
457
+    public AjaxResult getUrlScheme() {
458
+        String schemeUrl = WxAppletNotifyUtils.jumpAppletSchemeUrl();
459
+        return success(schemeUrl);
460
+    }
461
+
462
+    /**
463
+     * 生成庭审笔录
464
+     * @param arbitrateRecord
465
+     * @return
466
+     */
467
+    @PostMapping("/creatTrialRecord")
468
+//    @PreAuthorize("@ss.hasPermi('caseManagement:list:creatTrialRecord')")
469
+    public AjaxResult creatTrialRecord(@Validated @RequestBody ArbitrateRecord arbitrateRecord){
470
+        return caseApplicationService.creatTrialRecord(arbitrateRecord);
471
+    }
472
+
473
+    /**
474
+     * 记录庭审笔录
475
+     * @param arbitrateRecord
476
+     * @return
477
+     */
478
+    @PostMapping("/creatTrialRecordnew")
479
+//    @PreAuthorize("@ss.hasPermi('caseManagement:list:creatTrialRecord')")
480
+    public AjaxResult creatTrialRecordnew(@Validated @RequestBody ArbitrateRecord arbitrateRecord){
481
+        return caseApplicationService.creatTrialRecordnew(arbitrateRecord);
482
+    }
483
+
484
+    /**
485
+     * 案件锁定或者解锁
486
+     * @param caseApplication
487
+     * @return
488
+     */
489
+    @PostMapping("/updateCaseLockStatus")
490
+//    @PreAuthorize("@ss.hasPermi('caseManagement:list:creatTrialRecord')")
491
+    public AjaxResult updateCaseLockStatus(@Validated @RequestBody CaseApplication caseApplication){
492
+        if(caseApplication.getId()==null || caseApplication.getLockStatus()==null){
493
+            return error("参数校验失败");
494
+        }
495
+        return AjaxResult.success(caseApplicationService.updateCaseLockStatus(caseApplication));
496
+    }
497
+
498
+    /**
499
+     * 查询短信发送记录
500
+     * @param smsSendRecord
501
+     * @return
502
+     */
503
+    @PostMapping("/smsRecord")
504
+    public TableDataInfo getSmsSendRecord(@RequestBody SmsSendRecord smsSendRecord){
505
+        startPage();
506
+        List<SmsSendRecord> list = caseApplicationService.getSmsSendRecord(smsSendRecord);
507
+        return getDataTable(list);
508
+    }
509
+    /**
510
+     * 获取userSign
511
+     * @param userId
512
+     * @return
513
+     */
514
+    @Anonymous
515
+    @GetMapping("/generateUserSign")
516
+    public AjaxResult generateUserSign(@RequestParam(required = true) String userId){
517
+        if(StrUtil.isEmpty(userId)){
518
+            error("参数校验失败");
519
+        }
520
+        return AjaxResult.success(caseApplicationService.generateUserSign(userId));
521
+    }
522
+    /**
523
+     * 预约会议
524
+     * @param reservedConferenceVO
525
+     * @return
526
+     */
527
+    @PostMapping("/reservedConference")
528
+    public AjaxResult reservedConference(@Validated @RequestBody ReservedConferenceVO reservedConferenceVO) throws Exception {
529
+
530
+        return caseApplicationService.reservedConference(reservedConferenceVO);
531
+    }
532
+
533
+    /**
534
+     * 生成房间号
535
+     * @return
536
+     */
537
+    @Anonymous
538
+    @GetMapping("/createRoomId")
539
+    public AjaxResult createRoomId(@RequestParam("caseId") Long caseId) {
540
+
541
+        return  success(caseApplicationService.createRoomId(caseId));
542
+    }
543
+    /**
544
+     * 删除房间号
545
+     * @return
546
+     */
547
+    @Anonymous
548
+    @PostMapping("/deleteRoom")
549
+    public AjaxResult deleteRoom(@RequestParam("roomId") String roomId) {
550
+
551
+        return  caseApplicationService.deleteRoom(roomId);
552
+    }
553
+    /**
554
+     * 根据案件id查询已预约的会议
555
+     * @param caseId
556
+     * @return
557
+     */
558
+    @Anonymous
559
+    @GetMapping("/reserveConferenceList")
560
+    public AjaxResult reserveConferenceList(  @RequestParam("caseId") Long caseId) {
561
+
562
+        return  success(caseApplicationService.reserveConferenceList(caseId));
563
+    }
564
+
565
+    /**
566
+     * 案件压缩包导入
567
+     * @param file
568
+     * @return
569
+     * @throws IOException
570
+     */
571
+    @PostMapping("/uploadCaseZipFile")
572
+    public AjaxResult uploadCaseZipFile(@RequestParam("file") MultipartFile file,@RequestParam("templateId")  Long templateId) throws IOException {
573
+        return caseApplicationService.uploadCaseZipFile(file,templateId);
574
+    }
575
+
576
+    /**
577
+     * 根据附件id修改案件id
578
+     * @param caseAttach
579
+     * @return
580
+     */
581
+    @PostMapping("/updateCaseIdByAnnexId")
582
+    public AjaxResult updateCaseIdByAnnexId(@RequestBody CaseAttach caseAttach)  {
583
+        if(caseAttach.getAnnexId()==null || caseAttach.getCaseAppliId()==null){
584
+            return error("参数校验失败");
585
+        }
586
+        return caseApplicationService.updateCaseIdByAnnexId(caseAttach);
587
+    }
588
+}

+ 107
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationLogController.java Bestand weergeven

@@ -0,0 +1,107 @@
1
+package com.ruoyi.web.controller.wisdomarbitrate;
2
+
3
+import com.ruoyi.common.annotation.Anonymous;
4
+import com.ruoyi.common.core.domain.AjaxResult;
5
+import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
6
+import com.ruoyi.wisdomarbitrate.domain.vo.UpdateSubmitVO;
7
+import com.ruoyi.wisdomarbitrate.service.CaseApplicationLogService;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.web.bind.annotation.*;
10
+import org.springframework.web.bind.annotation.PostMapping;
11
+
12
+import static com.ruoyi.common.core.domain.AjaxResult.success;
13
+
14
+/**
15
+ * @author wangqiong
16
+ * @description 案件日志
17
+ * @date 2023-11-17 13:58
18
+ */
19
+@RestController
20
+@RequestMapping (value = "/caseApplicationLog")
21
+public class CaseApplicationLogController {
22
+
23
+    @Autowired
24
+    private CaseApplicationLogService caseApplicationLogService;
25
+
26
+    /**
27
+     * 新增
28
+     * @author wangqiong
29
+     * @date 2023/11/17
30
+     **/
31
+    @PostMapping("/insert")
32
+    public AjaxResult insert(@RequestBody CaseApplication caseApplicationLog){
33
+        return success(caseApplicationLogService.insert(caseApplicationLog));
34
+    }
35
+
36
+    /**
37
+     * 刪除
38
+     * @author wangqiong
39
+     * @date 2023/11/17
40
+     **/
41
+    @PostMapping("/delete")
42
+    public AjaxResult delete(Long id){
43
+        return success(caseApplicationLogService.delete(id));
44
+    }
45
+    /**
46
+     * 修改的案件提交到秘书
47
+     * @author wangqiong
48
+     * @date 2023/11/17
49
+     **/
50
+    @PostMapping("/submit")
51
+    public AjaxResult submit(@RequestBody UpdateSubmitVO vo){
52
+        if(vo.getCaseId()==null || vo.getVersion()==null){
53
+            return AjaxResult.error("参数校验错误");
54
+        }
55
+        return caseApplicationLogService.submit(vo);
56
+    }
57
+
58
+    /**
59
+     * 修改撤销申请
60
+     * @author wangqiong
61
+     * @date 2023/11/17
62
+     **/
63
+    @PostMapping("/revoke")
64
+    public AjaxResult revoke(@RequestBody UpdateSubmitVO vo){
65
+        if(vo.getCaseId()==null || vo.getVersion()==null){
66
+            return AjaxResult.error("参数校验错误");
67
+        }
68
+        // todo 需确定
69
+        return caseApplicationLogService.revoke(vo);
70
+    }
71
+
72
+    /**
73
+     * 查询 根据主键 id 查询
74
+     * @author wangqiong
75
+     * @date 2023/11/17
76
+     **/
77
+    @GetMapping("/selectByCaseIdAndVersion")
78
+    public AjaxResult selectByCaseIdAndVersion(@RequestParam(value = "caseId") Long caseId,@RequestParam(value = "version")Integer version ){
79
+        return success(caseApplicationLogService.selectByCaseIdAndVersion(caseId,version));
80
+    }
81
+    /**
82
+     * 秘书审核修改的案件
83
+     * @author wangqiong
84
+     * @date 2023/11/17
85
+     **/
86
+    @PostMapping("/updateAudit")
87
+    public AjaxResult updateAudit(@RequestBody UpdateSubmitVO vo){
88
+        if(vo.getCaseId()==null || vo.getVersion()==null || vo.getIsAgree()==null || vo.getUpdateSubmitStatus()==null){
89
+            return AjaxResult.error("参数校验错误");
90
+        }
91
+        return caseApplicationLogService.updateAudit(vo);
92
+    }
93
+    /**
94
+     * 查询该版本及之前版本案件进行对比
95
+     * @author wangqiong
96
+     * @date 2023/11/17
97
+     **/
98
+    @Anonymous
99
+    @PostMapping("/selectCompareCase")
100
+    public AjaxResult selectCompareCase(@RequestBody UpdateSubmitVO vo){
101
+        if(vo.getCaseId()==null || vo.getVersion()==null ){
102
+            return AjaxResult.error("参数校验错误");
103
+        }
104
+        return caseApplicationLogService.selectCompareCase(vo);
105
+    }
106
+  
107
+}

+ 47
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseArbitrateController.java Bestand weergeven

@@ -0,0 +1,47 @@
1
+package com.ruoyi.web.controller.wisdomarbitrate;
2
+
3
+import cn.hutool.core.collection.CollectionUtil;
4
+import com.ruoyi.common.core.controller.BaseController;
5
+import com.ruoyi.common.core.domain.AjaxResult;
6
+import com.ruoyi.wisdomarbitrate.domain.ArbitrateRecord;
7
+import com.ruoyi.wisdomarbitrate.domain.BatchCaseApplication;
8
+import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
9
+import com.ruoyi.wisdomarbitrate.domain.CaseIds;
10
+import com.ruoyi.wisdomarbitrate.service.ICaseArbitrateService;
11
+import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.security.access.prepost.PreAuthorize;
13
+import org.springframework.validation.annotation.Validated;
14
+import org.springframework.web.bind.annotation.*;
15
+
16
+import java.util.List;
17
+
18
+@RestController
19
+@RequestMapping("/arbitrate")
20
+public class CaseArbitrateController extends BaseController {
21
+    @Autowired
22
+    private ICaseArbitrateService caseArbitrateService;
23
+
24
+    /**
25
+     * 审核仲裁方式
26
+     * @param caseApplication
27
+     * @param opinion   1同意,0拒绝
28
+     * @return
29
+     */
30
+    @PutMapping("/method")
31
+//    @PreAuthorize("@ss.hasPermi('caseManagement:list:checkarbitrationway')")
32
+    public AjaxResult examineArbitrateMethod(@Validated @RequestBody CaseApplication caseApplication
33
+            , Integer opinion, Integer arbitratMethod){
34
+        return caseArbitrateService.examineArbitrateMethod(caseApplication,opinion,arbitratMethod);
35
+    }
36
+
37
+    /**
38
+     * 书面审理
39
+     * @param
40
+     * @return
41
+     */
42
+    @PostMapping("/writtenHear")
43
+    public AjaxResult writtenHear(@RequestBody CaseIds caseIds){
44
+        return  caseArbitrateService.writtenHear(caseIds);
45
+
46
+    }
47
+}

+ 160
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java Bestand weergeven

@@ -0,0 +1,160 @@
1
+package com.ruoyi.web.controller.wisdomarbitrate;
2
+
3
+import cn.hutool.core.collection.CollectionUtil;
4
+import cn.hutool.core.util.StrUtil;
5
+import com.ruoyi.common.core.controller.BaseController;
6
+import com.ruoyi.common.core.domain.AjaxResult;
7
+import com.ruoyi.common.core.page.TableDataInfo;
8
+import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
9
+import com.ruoyi.wisdomarbitrate.domain.CaseEvidenceDirectory;
10
+import com.ruoyi.wisdomarbitrate.domain.dto.CaseEvidenceDTO;
11
+import com.ruoyi.wisdomarbitrate.domain.vo.CaseEvidenceVO;
12
+import com.ruoyi.wisdomarbitrate.service.ICaseEvidenceService;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.security.access.prepost.PreAuthorize;
15
+import org.springframework.validation.annotation.Validated;
16
+import org.springframework.web.bind.annotation.*;
17
+import org.springframework.web.multipart.MultipartFile;
18
+
19
+import java.util.ArrayList;
20
+import java.util.List;
21
+
22
+/**
23
+ * 案件证据
24
+ */
25
+@RestController
26
+@RequestMapping("/evidence")
27
+public class CaseEvidenceController extends BaseController {
28
+    private final ICaseEvidenceService caseEvidenceService;
29
+
30
+    @Autowired
31
+    public CaseEvidenceController(ICaseEvidenceService caseEvidenceService) {
32
+        this.caseEvidenceService = caseEvidenceService;
33
+    }
34
+
35
+    /**
36
+     * 根据案件id查询案件详情
37
+     *
38
+     * @param id
39
+     * @return
40
+     */
41
+    @GetMapping("/{id}")
42
+    public AjaxResult getCaseDetailsById(@PathVariable Long id) {
43
+        String username = this.getUsername();
44
+        return caseEvidenceService.getCaseDetailsById(id, username);
45
+    }
46
+
47
+    /**
48
+     * 案件证据上传
49
+     *
50
+     * @param file      附件
51
+     * @param annexType 附件类型,立案申请书(1)、证据材料(2)、仲裁文书(3)、案件视频(4)、身份证件(5)
52
+     * @param id        案件申请id
53
+     * @return
54
+     */
55
+    @PostMapping("/upload")
56
+    public AjaxResult uploadEvidence(@RequestParam("file") MultipartFile file, Integer annexType, Long id) {
57
+        String username = this.getUsername();
58
+        Long userId = this.getUserId();
59
+        return caseEvidenceService.uploadEvidence(file, annexType, id, username, userId);
60
+    }
61
+
62
+    /**
63
+     * 上传庭审笔录
64
+     *
65
+     * @param file      附件
66
+     * @param annexType 附件类型,庭审笔录(7)
67
+     * @param id        案件申请id
68
+     * @return
69
+     */
70
+    @PostMapping("/uploadRecord")
71
+    public AjaxResult uploadRecord(@RequestParam("file") MultipartFile file, Integer annexType, Long id) {
72
+        String username = this.getUsername();
73
+        Long userId = this.getUserId();
74
+        return caseEvidenceService.uploadRecord(file, annexType, id, username, userId);
75
+    }
76
+
77
+    @PostMapping("/batchUpload")
78
+    public AjaxResult batchUpload(@RequestParam("file") MultipartFile[] file, Integer annexType, Long id) {
79
+        if(file==null){
80
+            return error("请选择要上传的文件");
81
+        }
82
+        String username = this.getUsername();
83
+        Long userId = this.getUserId();
84
+        return caseEvidenceService.batchUpload(file, annexType, id, username, userId);
85
+    }
86
+
87
+    /**
88
+     * 获取附件
89
+     * @param caseAppliId
90
+     * @param annexTypeList
91
+     * @param
92
+     * @return
93
+     */
94
+    @GetMapping("/fileList")
95
+    public AjaxResult fileList(Long caseAppliId, @RequestParam("annexTypeList") List<Integer> annexTypeList){
96
+        if(caseAppliId==null){
97
+            return error("案件id不能为空");
98
+        }
99
+        return caseEvidenceService.fileList(caseAppliId, annexTypeList);
100
+    }
101
+
102
+    /**
103
+     * 删除附件
104
+     * @param fileIds
105
+     * @return
106
+     */
107
+    @PostMapping("/deleteFile")
108
+    public AjaxResult deleteFile( @RequestParam("fileIds") List<Integer> fileIds){
109
+
110
+        if(CollectionUtil.isEmpty(fileIds)){
111
+            return error("附件id不能为空");
112
+        }
113
+        return toAjax(caseEvidenceService.deleteFile( fileIds));
114
+    }
115
+
116
+
117
+    /**
118
+     * 查询当前用户案件列表
119
+     *
120
+     * @param caseStatus
121
+     * @return
122
+     */
123
+    @GetMapping("/all")
124
+    public AjaxResult getCaseListAll(@RequestParam("caseStatus") Integer caseStatus) {
125
+
126
+       return success(caseEvidenceService.getCaseListAll(caseStatus));
127
+
128
+    }
129
+
130
+    /**
131
+     * 证据确认
132
+     *
133
+     * @param caseApplication 案件对象
134
+     * @return 统一返回结果
135
+     */
136
+    @PutMapping("/confirm")
137
+    public AjaxResult evidenceConfirmation(@Validated @RequestBody CaseApplication caseApplication) {
138
+        return caseEvidenceService.evidenceConfirmation(caseApplication);
139
+    }
140
+
141
+    /**
142
+     * 案件质证
143
+     *
144
+     * @param caseEvidenceDTO
145
+     * @return
146
+     */
147
+    @PostMapping("/crossexami")
148
+    public AjaxResult caseCrossexamination(@Validated @RequestBody CaseEvidenceDTO caseEvidenceDTO) {
149
+        return caseEvidenceService.caseCrossexamination(caseEvidenceDTO);
150
+    }
151
+    /**
152
+     * 获取证据目录树列表
153
+     */
154
+    @GetMapping("/evidenceTree")
155
+    public AjaxResult evidenceTree(CaseEvidenceDirectory caseEvidenceDirectory)
156
+    {
157
+        return success(caseEvidenceService.selectEvidenceTreeList(caseEvidenceDirectory)) ;
158
+    }
159
+
160
+}

+ 40
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseLogRecordController.java Bestand weergeven

@@ -0,0 +1,40 @@
1
+package com.ruoyi.web.controller.wisdomarbitrate;
2
+
3
+import com.ruoyi.common.core.controller.BaseController;
4
+import com.ruoyi.common.core.domain.AjaxResult;
5
+import com.ruoyi.common.core.page.TableDataInfo;
6
+import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
7
+import com.ruoyi.wisdomarbitrate.domain.CaseLogRecord;
8
+import com.ruoyi.wisdomarbitrate.service.ICaseLogRecordService;
9
+import org.springframework.beans.factory.annotation.Autowired;
10
+import org.springframework.security.access.prepost.PreAuthorize;
11
+import org.springframework.web.bind.annotation.GetMapping;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RestController;
14
+
15
+import java.util.List;
16
+
17
+@RestController
18
+@RequestMapping("/caseLogRecord")
19
+public class CaseLogRecordController   extends BaseController {
20
+    @Autowired
21
+    private ICaseLogRecordService caseLogRecordService;
22
+
23
+    /**
24
+     * 查询案件日志列表
25
+     */
26
+//    @PreAuthorize("@ss.hasPermi('caseLog:list')")
27
+    @GetMapping("/list")
28
+    public AjaxResult list(CaseLogRecord caseLogRecord)
29
+    {
30
+        List<CaseLogRecord> list = caseLogRecordService.selectCaseLogRecordList(caseLogRecord);
31
+        return AjaxResult.success(list);
32
+    }
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+}

+ 74
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseNumRuleController.java Bestand weergeven

@@ -0,0 +1,74 @@
1
+package com.ruoyi.web.controller.wisdomarbitrate;
2
+
3
+import com.ruoyi.common.core.controller.BaseController;
4
+import com.ruoyi.common.core.domain.AjaxResult;
5
+import com.ruoyi.common.core.page.TableDataInfo;
6
+import com.ruoyi.wisdomarbitrate.domain.CaseNumRule;
7
+import com.ruoyi.wisdomarbitrate.domain.TemplateManual;
8
+import com.ruoyi.wisdomarbitrate.service.ICaseNumRuleService;
9
+import org.springframework.beans.factory.annotation.Autowired;
10
+import org.springframework.web.bind.annotation.*;
11
+
12
+import java.util.List;
13
+
14
+@RestController
15
+@RequestMapping("/caseNumRule")
16
+public class CaseNumRuleController  extends BaseController {
17
+    @Autowired
18
+    private ICaseNumRuleService caseNumRuleService;
19
+
20
+    /**
21
+     * 新增案件编号规则
22
+     * @param caseNumRule
23
+     * @return
24
+     */
25
+    @PostMapping("/insertCaseNumRule")
26
+    public AjaxResult insertCaseNumRule(@RequestBody CaseNumRule caseNumRule){
27
+        caseNumRule.setCreateBy(getUsername());
28
+        return caseNumRuleService.insertCaseNumRule(caseNumRule);
29
+    }
30
+
31
+
32
+
33
+    /**
34
+     * 修改案件编号规则
35
+     * @param caseNumRule
36
+     * @return
37
+     */
38
+    @PostMapping("/updateCaseNumRule")
39
+    public AjaxResult updateCaseNumRule(@RequestBody CaseNumRule caseNumRule){
40
+        return caseNumRuleService.updateCaseNumRule(caseNumRule);
41
+    }
42
+
43
+    /**
44
+     * 删除案件编号规则
45
+     * @param caseNumRule
46
+     * @return
47
+     */
48
+    @PostMapping("/deleteCaseNumRule")
49
+    public AjaxResult deleteCaseNumRule(@RequestBody CaseNumRule caseNumRule){
50
+        return caseNumRuleService.deleteCaseNumRule(caseNumRule);
51
+    }
52
+
53
+    /**
54
+     * 查询案件编号规则
55
+     */
56
+    @GetMapping("/list")
57
+    public TableDataInfo list(CaseNumRule caseNumRule) {
58
+        startPage();
59
+        List<CaseNumRule> list = caseNumRuleService.selectCaseNumRule(caseNumRule);
60
+        return getDataTable(list);
61
+    }
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+}

+ 110
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CasePaymentController.java Bestand weergeven

@@ -0,0 +1,110 @@
1
+package com.ruoyi.web.controller.wisdomarbitrate;
2
+
3
+import cn.hutool.core.collection.CollectionUtil;
4
+import com.ruoyi.common.core.domain.AjaxResult;
5
+import com.ruoyi.common.utils.StringUtils;
6
+import com.ruoyi.wisdomarbitrate.domain.BatchCaseApplication;
7
+import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
8
+import com.ruoyi.wisdomarbitrate.domain.dto.CaseConfirmPayDTO;
9
+import com.ruoyi.wisdomarbitrate.service.ICasePaymentService;
10
+import com.ruoyi.wisdomarbitrate.domain.dto.CasePayDTO;
11
+import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.validation.annotation.Validated;
13
+import org.springframework.web.bind.annotation.*;
14
+
15
+import java.util.ArrayList;
16
+import java.util.List;
17
+
18
+/**
19
+ * 缴费支付
20
+ */
21
+@RestController
22
+@RequestMapping("/pay")
23
+public class CasePaymentController {
24
+    private final ICasePaymentService paymentService;
25
+    @Autowired
26
+    public CasePaymentController(ICasePaymentService paymentService){
27
+       this.paymentService=paymentService;
28
+    }
29
+    /**
30
+     * 案件缴费
31
+     * @param casePayDTO 缴费传入参数
32
+     * @return 统一响应结果
33
+     */
34
+//    @PreAuthorize("@ss.hasPermi('caseManagement:list:pay')")
35
+    @PostMapping("/casePay")
36
+    public AjaxResult casePay(@Validated @RequestBody CasePayDTO casePayDTO) {
37
+        return paymentService.casePay(casePayDTO);
38
+    }
39
+    /**
40
+     * 确认缴费
41
+     * @param payDTO 缴费传入参数
42
+     * @return 统一响应结果
43
+     */
44
+//    @PreAuthorize("@ss.hasPermi('caseManagement:list:pay')")
45
+    @PostMapping("/confirmPay")
46
+    public AjaxResult confirmPay(@Validated @RequestBody CaseConfirmPayDTO payDTO) {
47
+        return paymentService.confirmPay(payDTO);
48
+    }
49
+
50
+    /**
51
+     * 批量缴费
52
+     * @param casePayDTO 缴费传入参数
53
+     * @return 统一响应结果
54
+     */
55
+    @PostMapping("/casePayBatch")
56
+    public AjaxResult casePayBatch(@Validated @RequestBody CasePayDTO casePayDTO) {
57
+        return paymentService.casePayBatch(casePayDTO);
58
+    }
59
+
60
+    /**
61
+     * 批量缴费
62
+     * @param payDTO 缴费传入参数
63
+     * @return 统一响应结果
64
+     */
65
+    @PostMapping("/confirmPayBatch")
66
+    public AjaxResult confirmPayBatch(@Validated @RequestBody CasePayDTO payDTO) {
67
+        return paymentService.confirmPayBatch(payDTO);
68
+    }
69
+
70
+    /**
71
+     * 缴费确认
72
+     * @param batchCaseApplication
73
+     * @return
74
+     */
75
+//    @PreAuthorize("@ss.hasPermi('paymentManagement:list:payconfirm')")
76
+    @PutMapping("/confirm")
77
+    public AjaxResult confirmPayment(@Validated @RequestBody BatchCaseApplication batchCaseApplication) {
78
+        if(CollectionUtil.isEmpty(batchCaseApplication.getIds())){
79
+            return AjaxResult.error("参数校验失败");
80
+        }
81
+            return paymentService.confirmPayment(batchCaseApplication.getIds());
82
+    }
83
+    /**
84
+     * 缴费列表查询
85
+     * @param casePayDTO
86
+     * @return
87
+     */
88
+    @GetMapping("/list")
89
+    public AjaxResult casePayList(CasePayDTO casePayDTO) {
90
+        return paymentService.casePayList(casePayDTO);
91
+    }
92
+
93
+    @PostMapping("/listBatch")
94
+    public AjaxResult casePayListBatch(@Validated @RequestBody CasePayDTO casePayDTO) {
95
+        return paymentService.casePayListBatch(casePayDTO);
96
+    }
97
+
98
+    /**
99
+     * 批量缴费确认
100
+     * @param batchCaseApplication
101
+     * @return
102
+     */
103
+    @PostMapping("/confirmBatch")
104
+    public AjaxResult confirmPaymentBatch(@Validated @RequestBody BatchCaseApplication batchCaseApplication) {
105
+        if(StringUtils.isEmpty(batchCaseApplication.getBatchNumber())){
106
+            return AjaxResult.error("参数校验失败");
107
+        }
108
+        return paymentService.confirmPaymentBatch(batchCaseApplication.getBatchNumber());
109
+    }
110
+}

+ 237
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java Bestand weergeven

@@ -0,0 +1,237 @@
1
+package com.ruoyi.web.controller.wisdomarbitrate;
2
+import cn.hutool.core.util.StrUtil;
3
+import com.ruoyi.common.core.controller.BaseController;
4
+import com.ruoyi.common.core.domain.AjaxResult;
5
+import com.ruoyi.common.core.page.TableDataInfo;
6
+import com.ruoyi.common.exception.EsignDemoException;
7
+import com.ruoyi.wisdomarbitrate.domain.*;
8
+import com.ruoyi.wisdomarbitrate.domain.vo.SealListVO;
9
+import com.ruoyi.wisdomarbitrate.service.IDeptIdentifyService;
10
+import org.springframework.beans.factory.annotation.Autowired;
11
+import org.springframework.validation.annotation.Validated;
12
+import org.springframework.web.bind.annotation.*;
13
+import org.springframework.web.multipart.MultipartFile;
14
+
15
+import java.util.List;
16
+
17
+@RestController
18
+@RequestMapping("/deptIdentify")
19
+public class DeptIdentifyController extends BaseController {
20
+    @Autowired
21
+    private IDeptIdentifyService deptIdentifyService;
22
+
23
+    /**
24
+     * 新增机构
25
+     * @param deptIdentify
26
+     * @return
27
+     */
28
+    @PostMapping("/insert")
29
+    public AjaxResult insertDeptIdentify(@RequestBody DeptIdentify deptIdentify){
30
+        return deptIdentifyService.insertDeptIdentify(deptIdentify);
31
+    }
32
+
33
+    /**
34
+     * 删除机构
35
+     * @param id
36
+     * @return
37
+     */
38
+    @DeleteMapping("/delete")
39
+    public AjaxResult deleteDeptIdentify(Long id){
40
+        return deptIdentifyService.deleteDeptIdentify(id);
41
+    }
42
+
43
+    /**
44
+     * 修改机构信息
45
+     * @param deptIdentify
46
+     * @return
47
+     */
48
+    @PutMapping("/update")
49
+    public AjaxResult updateDeptIdentify(@RequestBody DeptIdentify deptIdentify){
50
+        return deptIdentifyService.updateDeptIdentify(deptIdentify);
51
+    }
52
+
53
+    /**
54
+     * 查询机构信息
55
+     */
56
+    @GetMapping("/list")
57
+    public TableDataInfo list(DeptIdentify deptIdentify) {
58
+        startPage();
59
+        List<DeptIdentify> list = deptIdentifyService.selectDeptIdentify(deptIdentify);
60
+        return getDataTable(list);
61
+    }
62
+
63
+    /**
64
+     * 查询机构认证链接
65
+     */
66
+    @PostMapping("/selectDeptIndefiUrl")
67
+    public AjaxResult selectDeptIndefiUrl(@Validated @RequestBody DeptIdentify deptIdentify) throws EsignDemoException {
68
+        DeptIdentify deptIdentifyselect = deptIdentifyService.selectDeptIndefiUrl(deptIdentify);
69
+        return success(deptIdentifyselect);
70
+    }
71
+
72
+    /**
73
+     * 机构启用/禁用
74
+     */
75
+    @PostMapping("/enableDept")
76
+    public AjaxResult enableDept(@Validated @RequestBody DeptIdentify deptIdentify) {
77
+        return deptIdentifyService.enableDept(deptIdentify);
78
+    }
79
+
80
+    /**
81
+     * 上传自定义公章
82
+     *
83
+     * @param
84
+     * @param file
85
+     * @return
86
+     */
87
+    @PostMapping("/sealUpload")
88
+    public AjaxResult sealUpload(Long id, String sealName , @RequestParam("file") MultipartFile file) {
89
+        return deptIdentifyService.sealUpload(id, sealName ,file);
90
+    }
91
+
92
+    /**
93
+     * 接收E签宝回调通知
94
+     * @param body
95
+     * @return
96
+     */
97
+    @GetMapping("/notify")
98
+    public AjaxResult receiveNotify(String body) {
99
+        return deptIdentifyService.receiveNotify(body);
100
+    }
101
+
102
+    /**
103
+     * 公章列表查询
104
+     * @param deptIdentify
105
+     * @return
106
+     */
107
+    @GetMapping("/sealList")
108
+    public  TableDataInfo getSealList( DeptIdentify deptIdentify ){
109
+        startPage();
110
+        List<SealManage> sealList = deptIdentifyService.getSealList(deptIdentify);
111
+        return getDataTable(sealList);
112
+    }
113
+
114
+    /**
115
+     * 印章启用或者禁用
116
+     * @param sealManage
117
+     * @return
118
+     */
119
+    @PostMapping("/updateSealLockStatus")
120
+    public AjaxResult updateSealLockStatus(@Validated @RequestBody SealManage sealManage){
121
+        if(sealManage.getId()==null ||sealManage.getIsUse()==null){
122
+            return error("参数校验失败");
123
+        }
124
+        return deptIdentifyService.updateSealLockStatus(sealManage);
125
+    }
126
+
127
+    /**
128
+     * 新增模板
129
+     * @param templateManage
130
+     * @return
131
+     */
132
+    @PostMapping("/insertTemplate")
133
+    public AjaxResult insertTemplate(TemplateManage templateManage,@RequestParam("file") MultipartFile file){
134
+        return deptIdentifyService.insertTemplate(templateManage,file);
135
+    }
136
+    /**
137
+     * 修改模板
138
+     * @param templateManage
139
+     * @return
140
+     */
141
+    @PostMapping("/updateTemplate")
142
+    public AjaxResult updateTemplate(TemplateManage templateManage,@RequestParam(value = "file", required = false) MultipartFile file){
143
+        return deptIdentifyService.updateTemplate(templateManage,file);
144
+    }
145
+
146
+    /**
147
+     * 删除模板
148
+     * @param id
149
+     * @return
150
+     */
151
+    @DeleteMapping("/deleteTemplate")
152
+    public AjaxResult deleteTemplate(Long id){
153
+        return deptIdentifyService.deleteTemplate(id);
154
+    }
155
+
156
+    /**
157
+     * 根据机构id查询模板
158
+     * @param deptIdentify
159
+     * @return
160
+     */
161
+    @GetMapping("/getTemplate")
162
+    public TableDataInfo getTemplateList( DeptIdentify deptIdentify){
163
+        startPage();
164
+        List<TemplateManage> sealList = deptIdentifyService.getTemplateList(deptIdentify);
165
+        return getDataTable(sealList);
166
+    }
167
+    /**
168
+     * 根据部门id查询岗位用户信息
169
+     */
170
+    @GetMapping("selectPostUserByDeptId")
171
+    public AjaxResult selectPostUserByDeptId(DeptIdentify deptIdentify){
172
+        return AjaxResult.success(deptIdentifyService.selectPostUserByDeptId(deptIdentify));
173
+    }
174
+    /**
175
+     * 给机构绑定经办人
176
+     */
177
+    @GetMapping("bindHandler")
178
+    public AjaxResult bindHandler(DeptIdentify deptIdentify){
179
+        return deptIdentifyService.bindHandler(deptIdentify);
180
+    }
181
+
182
+    /**
183
+     * 根据模板id查询抓取规则
184
+     * @param templateManage
185
+     * @return
186
+     */
187
+    @PostMapping("/getFatchRuleByTemplateid")
188
+    public AjaxResult getFatchRuleByTemplateid(@RequestBody  TemplateManage templateManage){
189
+        List<FatchRule> fatchRuleList = deptIdentifyService.getFatchRuleByTemplateid(templateManage);
190
+        return AjaxResult.success(fatchRuleList);
191
+    }
192
+
193
+    /**
194
+     * 保存抓取规则
195
+     * @param templateManage
196
+     * @return
197
+     */
198
+    @PostMapping("/saveFatchRules")
199
+    public AjaxResult saveFatchRules(@RequestBody  TemplateManage templateManage){
200
+        return deptIdentifyService.saveFatchRules(templateManage);
201
+    }
202
+
203
+    /**
204
+     * 查询column和注释
205
+     * @return
206
+     */
207
+    @PostMapping("/selectColumnandComment")
208
+    public AjaxResult selectColumnandComment(){
209
+        List<FatchRule> fatchRuleList = deptIdentifyService.selectColumnandComment();
210
+        return AjaxResult.success(fatchRuleList);
211
+    }
212
+
213
+    /**
214
+     * 查询column
215
+     * @return
216
+     */
217
+    @PostMapping("/selectColumnbycomment")
218
+    public AjaxResult selectColumnbycomment(@RequestBody  FatchRule fatchRule){
219
+        FatchRule fatchRulesel = deptIdentifyService.selectColumnbycomment(fatchRule);
220
+        return AjaxResult.success(fatchRulesel);
221
+    }
222
+
223
+    /**
224
+     * 根据模板id查询模板字段列表
225
+     * @param id
226
+     * @return
227
+     */
228
+    @GetMapping("/getTemplateInfoById")
229
+    public AjaxResult getTemplateInfoById(@RequestParam("id") Long id){
230
+        TemplateManage templateManage = new TemplateManage();
231
+        templateManage.setId(id);
232
+        List<FatchRule> fatchRuleList = deptIdentifyService.getTemplateInfoById(templateManage);
233
+        return AjaxResult.success(fatchRuleList);
234
+    }
235
+
236
+
237
+}

+ 43
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/IdentityAuthenticationController.java Bestand weergeven

@@ -0,0 +1,43 @@
1
+package com.ruoyi.web.controller.wisdomarbitrate;
2
+
3
+import com.alibaba.fastjson.JSONObject;
4
+import com.ruoyi.common.annotation.Anonymous;
5
+import com.ruoyi.common.core.controller.BaseController;
6
+import com.ruoyi.common.core.domain.AjaxResult;
7
+import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication;
8
+import com.ruoyi.wisdomarbitrate.service.IdentityAuthenticationService;
9
+import org.springframework.beans.factory.annotation.Autowired;
10
+import org.springframework.validation.annotation.Validated;
11
+import org.springframework.web.bind.annotation.PostMapping;
12
+import org.springframework.web.bind.annotation.RequestBody;
13
+import org.springframework.web.bind.annotation.RequestMapping;
14
+import org.springframework.web.bind.annotation.RestController;
15
+
16
+@RestController
17
+@RequestMapping("/identityAuthentication")
18
+public class IdentityAuthenticationController extends BaseController {
19
+    @Autowired
20
+    private IdentityAuthenticationService identityAuthenticationService;
21
+
22
+    /**
23
+     * 获取EIDtoken
24
+     */
25
+    @Anonymous
26
+    @PostMapping("/selectIdentityAuthenticaEIDtoken")
27
+    public AjaxResult selectIdentityAuthenticaEIDtoken() {
28
+        JSONObject tokenResult = identityAuthenticationService.selectIdentityAuthenticaEIDtoken();
29
+        return success(tokenResult);
30
+    }
31
+
32
+    /**
33
+     * 小程序人脸核身后查询身份认证结果
34
+     */
35
+    @Anonymous
36
+    @PostMapping("/selectIdentityAuthenticaRespon")
37
+    public AjaxResult selectIdentityAuthenticaRespon(@Validated @RequestBody IdentityAuthentication ientityAuthentication) {
38
+        AjaxResult checkResult = identityAuthenticationService.selectIdentityAuthenticaRespon(ientityAuthentication);
39
+        return checkResult;
40
+    }
41
+
42
+
43
+}

+ 48
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/SendMailRecordController.java Bestand weergeven

@@ -0,0 +1,48 @@
1
+package com.ruoyi.web.controller.wisdomarbitrate;
2
+
3
+import com.ruoyi.common.core.controller.BaseController;
4
+import com.ruoyi.common.core.page.TableDataInfo;
5
+import com.ruoyi.wisdomarbitrate.domain.CaseLogRecord;
6
+import com.ruoyi.wisdomarbitrate.domain.SendMailRecord;
7
+import com.ruoyi.wisdomarbitrate.service.ISendMailRecordService;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.web.bind.annotation.GetMapping;
10
+import org.springframework.web.bind.annotation.RequestMapping;
11
+import org.springframework.web.bind.annotation.RestController;
12
+
13
+import java.util.List;
14
+
15
+@RestController
16
+@RequestMapping("/sendMailRecord")
17
+public class SendMailRecordController  extends BaseController {
18
+    @Autowired
19
+    private ISendMailRecordService sendMailRecordService;
20
+
21
+    /**
22
+     * 查询发送邮件记录列表
23
+     */
24
+    @GetMapping("/list")
25
+    public TableDataInfo list(SendMailRecord sendMailRecord)
26
+    {
27
+        startPage();
28
+        List<SendMailRecord> list = sendMailRecordService.selectSendMailRecordList(sendMailRecord);
29
+        return getDataTable(list);
30
+    }
31
+
32
+
33
+//    /**
34
+//     * 新增立案数据
35
+//     */
36
+//    @Log(title = "新增立案数据", businessType = BusinessType.INSERT)
37
+//    @PostMapping("/addSendMailRecord")
38
+//    public AjaxResult addSendMailRecord(@Validated @RequestBody SendMailRecord sendMailRecord)
39
+//    {
40
+//
41
+//        return toAjax(sendMailRecordService.addSendMailRecord(sendMailRecord));
42
+//    }
43
+
44
+
45
+
46
+
47
+
48
+}

+ 59
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/TemplateController.java Bestand weergeven

@@ -0,0 +1,59 @@
1
+package com.ruoyi.web.controller.wisdomarbitrate;
2
+
3
+import com.ruoyi.common.core.controller.BaseController;
4
+import com.ruoyi.common.core.domain.AjaxResult;
5
+import com.ruoyi.common.core.page.TableDataInfo;
6
+import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
7
+import com.ruoyi.wisdomarbitrate.domain.TemplateManual;
8
+import com.ruoyi.wisdomarbitrate.service.ITemplateService;
9
+import org.springframework.beans.factory.annotation.Autowired;
10
+import org.springframework.web.bind.annotation.*;
11
+
12
+import java.util.List;
13
+
14
+@RestController
15
+@RequestMapping("/template")
16
+public class TemplateController extends BaseController {
17
+    @Autowired
18
+    private ITemplateService templateService;
19
+    /**
20
+     * 新增模板
21
+     * @param templateManual
22
+     * @return
23
+     */
24
+    @PostMapping("/insert")
25
+    public AjaxResult insertTemplate(@RequestBody TemplateManual templateManual){
26
+        return templateService.insertTemplate(templateManual);
27
+    }
28
+
29
+    /**
30
+     * 删除模板
31
+     * @param id
32
+     * @return
33
+     */
34
+    @DeleteMapping("/delete")
35
+    public AjaxResult deleteTemplate(Long id){
36
+        return templateService.deleteTemplate(id);
37
+    }
38
+
39
+    /**
40
+     * 修改模板
41
+     * @param templateManual
42
+     * @return
43
+     */
44
+    @PutMapping("/update")
45
+    public AjaxResult updateTemplate(@RequestBody TemplateManual templateManual){
46
+        return templateService.updateTemplate(templateManual);
47
+    }
48
+
49
+    /**
50
+     * 查询模板
51
+     */
52
+    @GetMapping("/list")
53
+    public TableDataInfo list( TemplateManual templateManual) {
54
+        startPage();
55
+        List<TemplateManual> list = templateService.selectTemplate(templateManual);
56
+        return getDataTable(list);
57
+    }
58
+
59
+}

+ 149
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/VideoController.java Bestand weergeven

@@ -0,0 +1,149 @@
1
+package com.ruoyi.web.controller.wisdomarbitrate;
2
+
3
+import cn.hutool.core.util.StrUtil;
4
+import com.alibaba.fastjson.JSON;
5
+import com.ruoyi.common.annotation.Anonymous;
6
+import com.ruoyi.common.core.controller.BaseController;
7
+import com.ruoyi.common.core.domain.AjaxResult;
8
+import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication;
9
+import com.ruoyi.wisdomarbitrate.domain.vo.ReservedConferenceVO;
10
+import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
11
+import com.ruoyi.wisdomarbitrate.domain.vo.WeChatUserVO;
12
+import com.ruoyi.wisdomarbitrate.service.VideoService;
13
+import com.ruoyi.wisdomarbitrate.service.WeChatUserService;
14
+import com.tencentcloudapi.common.Credential;
15
+import com.tencentcloudapi.common.exception.TencentCloudSDKException;
16
+import com.tencentcloudapi.common.profile.ClientProfile;
17
+import com.tencentcloudapi.common.profile.HttpProfile;
18
+import com.tencentcloudapi.trtc.v20190722.TrtcClient;
19
+import com.tencentcloudapi.trtc.v20190722.models.*;
20
+import com.tencentyun.TLSSigAPIv2;
21
+import org.springframework.beans.factory.annotation.Autowired;
22
+import org.springframework.web.bind.annotation.*;
23
+import org.springframework.web.multipart.MultipartFile;
24
+
25
+import javax.servlet.http.HttpServletRequest;
26
+import javax.validation.Valid;
27
+import java.io.IOException;
28
+
29
+/**
30
+ * @author wangqiong
31
+ * @description trtc实时音视频
32
+ * @date 2023-10-26 11:25
33
+ */
34
+@RestController
35
+@RequestMapping("/video")
36
+public class VideoController extends BaseController {
37
+    @Autowired
38
+    private VideoService videoService;
39
+
40
+    /**
41
+     * 从腾讯云下载文件到本地
42
+     * @param
43
+     * @return
44
+     */
45
+    @Anonymous
46
+    @PostMapping("/videoRollBack")
47
+    public AjaxResult videoRollBack(  @RequestBody String body, HttpServletRequest request) {
48
+        videoService.videoRollBack(body,request);
49
+       return success();
50
+    }
51
+    /**
52
+     * 根据房间号绑定案件ID
53
+     * @param
54
+     * @return
55
+     */
56
+    @Anonymous
57
+    @PostMapping("/bindCaseId")
58
+    public AjaxResult bindCaseId(@Valid @RequestBody SendRoomNoMessageVO vo) {
59
+
60
+        return videoService.bindCaseId(vo.getId(),vo.getRoomNo());
61
+    }
62
+    /**
63
+     * 根据案件ID查询视频
64
+     * @param caseId 案件id
65
+     * @return
66
+     */
67
+    @GetMapping("/videoList")
68
+    public AjaxResult videoList(  @RequestParam Long caseId) {
69
+
70
+        return videoService.videoList(caseId);
71
+    }
72
+    /**
73
+     * 开启腾讯云录制
74
+     * @param vo
75
+     * @return
76
+     * @throws Exception
77
+     */
78
+    @Anonymous
79
+    @PostMapping("/openCloudRecording")
80
+    private AjaxResult openCloudRecording( @RequestBody ReservedConferenceVO vo)  {
81
+        if(vo.getCaseId()==null || vo.getRoomId()==null){
82
+            return AjaxResult.error("参数错误");
83
+        }
84
+        return videoService.openCloudRecording(vo.getCaseId(),vo.getRoomId());
85
+    }
86
+    /**
87
+     * 关闭腾讯云录制
88
+     * @param taskId 任务ID
89
+     * @return
90
+     */
91
+    @Anonymous
92
+    @PostMapping("/closeDeleteCloudRecording")
93
+    public AjaxResult closeDeleteCloudRecording(@RequestParam("taskId") String taskId){
94
+        return videoService.closeDeleteCloudRecording(taskId);
95
+    }
96
+    /**
97
+     * 解散房间
98
+     * @param reservedConferenceVO
99
+     * @return
100
+     */
101
+    @Anonymous
102
+    @PostMapping("/dissolveRoom")
103
+    public AjaxResult dissolveRoom(   @RequestBody ReservedConferenceVO reservedConferenceVO) {
104
+        if( reservedConferenceVO.getRoomId()==null){
105
+            return error("参数校验失败");
106
+        }
107
+
108
+        return  videoService.dissolveRoom(reservedConferenceVO.getRoomId());
109
+    }
110
+    /**
111
+     * 根据userId查询该用户是否是秘书
112
+     * @param userId
113
+     * @return
114
+     */
115
+    @Anonymous
116
+    @GetMapping("secretaryRoleByUserId")
117
+    public AjaxResult secretaryRoleByUserId(   @RequestParam(value = "userId",required = true) Long userId) {
118
+
119
+        return  videoService.secretaryRoleByUserId(userId);
120
+    }
121
+    /**
122
+     * 根据html字符串转pdf并和案件关联
123
+     * @param reservedConferenceVO
124
+     * @return
125
+     */
126
+    @Anonymous
127
+    @PostMapping("htmlToPDF")
128
+    public AjaxResult secretaryRoleByUserId( @RequestBody ReservedConferenceVO reservedConferenceVO) {
129
+        if( reservedConferenceVO.getCaseId()==null || StrUtil.isEmpty(reservedConferenceVO.getHtmlContent())){
130
+            return success();
131
+        }
132
+
133
+        return  videoService.htmlToPDF(reservedConferenceVO);
134
+    }
135
+    /**
136
+     * 根据案件id和类型查询附件
137
+     * @param caseAppliId
138
+     * @param annexType
139
+     * @return
140
+     */
141
+
142
+    @GetMapping("attachListByCaseId")
143
+    public AjaxResult attachListByCaseId( @RequestParam("caseAppliId") Long caseAppliId,@RequestParam("annexType") Integer annexType) {
144
+
145
+        return  videoService.attachListByCaseId(caseAppliId,annexType);
146
+    }
147
+
148
+
149
+}

+ 62
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/WeChatUserController.java Bestand weergeven

@@ -0,0 +1,62 @@
1
+package com.ruoyi.web.controller.wisdomarbitrate;
2
+
3
+import cn.hutool.core.util.StrUtil;
4
+import com.ruoyi.common.annotation.Anonymous;
5
+import com.ruoyi.common.core.controller.BaseController;
6
+import com.ruoyi.common.core.domain.AjaxResult;
7
+import com.ruoyi.common.exception.ServiceException;
8
+import com.ruoyi.common.utils.http.HttpUtils;
9
+import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
10
+import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication;
11
+import com.ruoyi.wisdomarbitrate.domain.vo.WeChatUserVO;
12
+import com.ruoyi.wisdomarbitrate.service.WeChatUserService;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.validation.annotation.Validated;
15
+import org.springframework.web.bind.annotation.*;
16
+
17
+/**
18
+ * @author wangqiong
19
+ * @description 微信小程序用户注册登录
20
+ * @date 2023-10-16 11:25
21
+ */
22
+@RestController
23
+@RequestMapping("/weChatUser")
24
+public class WeChatUserController extends BaseController {
25
+    @Autowired
26
+    private WeChatUserService weChatUserService;
27
+
28
+    /**
29
+     * 小程序端获取手机验证码
30
+     * @param userVO
31
+     * @return
32
+     */
33
+    @Anonymous
34
+    @GetMapping("/sendCode")
35
+    public AjaxResult sendCode(  WeChatUserVO userVO)
36
+    {
37
+        if(StrUtil.isEmpty(userVO.getPhone())){
38
+            return warn("手机号不能为空");
39
+        }
40
+        return weChatUserService.sendCode(userVO);
41
+    }
42
+    /**
43
+     * 小程序注册
44
+     */
45
+    @Anonymous
46
+    @PostMapping("/registerUser")
47
+    public AjaxResult registerUser( @RequestBody IdentityAuthentication ientityAuthentication) {
48
+        if(ientityAuthentication.getId()==null
49
+                || StrUtil.isEmpty(ientityAuthentication.getName())
50
+                || StrUtil.isEmpty(ientityAuthentication.getIdentityNo())
51
+                || StrUtil.isEmpty(ientityAuthentication.getPhone())
52
+                || StrUtil.isEmpty(ientityAuthentication.getUserName())
53
+                || StrUtil.isEmpty(ientityAuthentication.getEmail())
54
+                || StrUtil.isEmpty(ientityAuthentication.getVerifyCode())
55
+        ){
56
+            return warn("参数校验失败");
57
+        }
58
+        logger.info("调用小程序注册==="+ientityAuthentication.toString());
59
+        return weChatUserService.registerUser(ientityAuthentication);
60
+    }
61
+
62
+}

+ 125
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java Bestand weergeven

@@ -0,0 +1,125 @@
1
+package com.ruoyi.web.core.config;
2
+
3
+import java.util.ArrayList;
4
+import java.util.List;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.beans.factory.annotation.Value;
7
+import org.springframework.context.annotation.Bean;
8
+import org.springframework.context.annotation.Configuration;
9
+import com.ruoyi.common.config.RuoYiConfig;
10
+import io.swagger.annotations.ApiOperation;
11
+import io.swagger.models.auth.In;
12
+import springfox.documentation.builders.ApiInfoBuilder;
13
+import springfox.documentation.builders.PathSelectors;
14
+import springfox.documentation.builders.RequestHandlerSelectors;
15
+import springfox.documentation.service.ApiInfo;
16
+import springfox.documentation.service.ApiKey;
17
+import springfox.documentation.service.AuthorizationScope;
18
+import springfox.documentation.service.Contact;
19
+import springfox.documentation.service.SecurityReference;
20
+import springfox.documentation.service.SecurityScheme;
21
+import springfox.documentation.spi.DocumentationType;
22
+import springfox.documentation.spi.service.contexts.SecurityContext;
23
+import springfox.documentation.spring.web.plugins.Docket;
24
+
25
+/**
26
+ * Swagger2的接口配置
27
+ * 
28
+ * @author ruoyi
29
+ */
30
+@Configuration
31
+public class SwaggerConfig
32
+{
33
+    /** 系统基础配置 */
34
+    @Autowired
35
+    private RuoYiConfig ruoyiConfig;
36
+
37
+    /** 是否开启swagger */
38
+    @Value("${swagger.enabled}")
39
+    private boolean enabled;
40
+
41
+    /** 设置请求的统一前缀 */
42
+    @Value("${swagger.pathMapping}")
43
+    private String pathMapping;
44
+
45
+    /**
46
+     * 创建API
47
+     */
48
+    @Bean
49
+    public Docket createRestApi()
50
+    {
51
+        return new Docket(DocumentationType.OAS_30)
52
+                // 是否启用Swagger
53
+                .enable(enabled)
54
+                // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
55
+                .apiInfo(apiInfo())
56
+                // 设置哪些接口暴露给Swagger展示
57
+                .select()
58
+                // 扫描所有有注解的api,用这种方式更灵活
59
+                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
60
+                // 扫描指定包中的swagger注解
61
+                // .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
62
+                // 扫描所有 .apis(RequestHandlerSelectors.any())
63
+                .paths(PathSelectors.any())
64
+                .build()
65
+                /* 设置安全模式,swagger可以设置访问token */
66
+                .securitySchemes(securitySchemes())
67
+                .securityContexts(securityContexts())
68
+                .pathMapping(pathMapping);
69
+    }
70
+
71
+    /**
72
+     * 安全模式,这里指定token通过Authorization头请求头传递
73
+     */
74
+    private List<SecurityScheme> securitySchemes()
75
+    {
76
+        List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
77
+        apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue()));
78
+        return apiKeyList;
79
+    }
80
+
81
+    /**
82
+     * 安全上下文
83
+     */
84
+    private List<SecurityContext> securityContexts()
85
+    {
86
+        List<SecurityContext> securityContexts = new ArrayList<>();
87
+        securityContexts.add(
88
+                SecurityContext.builder()
89
+                        .securityReferences(defaultAuth())
90
+                        .operationSelector(o -> o.requestMappingPattern().matches("/.*"))
91
+                        .build());
92
+        return securityContexts;
93
+    }
94
+
95
+    /**
96
+     * 默认的安全上引用
97
+     */
98
+    private List<SecurityReference> defaultAuth()
99
+    {
100
+        AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
101
+        AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
102
+        authorizationScopes[0] = authorizationScope;
103
+        List<SecurityReference> securityReferences = new ArrayList<>();
104
+        securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
105
+        return securityReferences;
106
+    }
107
+
108
+    /**
109
+     * 添加摘要信息
110
+     */
111
+    private ApiInfo apiInfo()
112
+    {
113
+        // 用ApiInfoBuilder进行定制
114
+        return new ApiInfoBuilder()
115
+                // 设置标题
116
+                .title("标题:若依管理系统_接口文档")
117
+                // 描述
118
+                .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
119
+                // 作者信息
120
+                .contact(new Contact(ruoyiConfig.getName(), null, null))
121
+                // 版本
122
+                .version("版本号:" + ruoyiConfig.getVersion())
123
+                .build();
124
+    }
125
+}

+ 1
- 0
ruoyi-admin/src/main/resources/META-INF/spring-devtools.properties Bestand weergeven

@@ -0,0 +1 @@
1
+restart.include.json=/com.alibaba.fastjson.*.jar

+ 1
- 0
ruoyi-admin/src/main/resources/alipay_private.key Bestand weergeven

@@ -0,0 +1 @@
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

+ 1
- 0
ruoyi-admin/src/main/resources/alipay_public.key Bestand weergeven

@@ -0,0 +1 @@
1
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhUnjdAKwZApwZEcfq+5L0pa77Vg3mqcoXv+th8RR0SYotkPsH1f2JkbS48ySaSCM6YNWSMNfqp5qdOla2zUJOBnJ/yaBg7s7fVD6V3M2mEog8kCDYGKt/3P4VII3xYl8lFYMQ3IcFRELkxCBBCA8JDKmf5z2R4F/Z/jFFEuOwxaJvp+7Ke9OzZHYdWGNnU6QP8YYLYUeX7VNZLHEuly34ExAw6A+yJkNDsYEho2Lu31QjT2pLh9g+88MlRfiI92iN25O9NVdeM4f5RcpvBPrBQZQs9tlFmALYSFS3prIf3FAobWM+W7iwxT6J25nFIhst1DdJQfIBpaeRUJVTkn99QIDAQAB

+ 61
- 0
ruoyi-admin/src/main/resources/application-druid.yml Bestand weergeven

@@ -0,0 +1,61 @@
1
+# 数据源配置
2
+spring:
3
+    datasource:
4
+        type: com.alibaba.druid.pool.DruidDataSource
5
+        driverClassName: com.mysql.cj.jdbc.Driver
6
+        druid:
7
+            # 主库数据源
8
+            master:
9
+                url: jdbc:mysql://121.40.189.20:3306/test_smart_arbitration?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=Asia/Shanghai&useSSL=false
10
+                username: root
11
+                password: YMzc157#
12
+            # 从库数据源
13
+            slave:
14
+                # 从数据源开关/默认关闭
15
+                enabled: false
16
+                url: 
17
+                username: 
18
+                password: 
19
+            # 初始连接数
20
+            initialSize: 5
21
+            # 最小连接池数量
22
+            minIdle: 10
23
+            # 最大连接池数量
24
+            maxActive: 20
25
+            # 配置获取连接等待超时的时间
26
+            maxWait: 60000
27
+            # 配置连接超时时间
28
+            connectTimeout: 30000
29
+            # 配置网络超时时间
30
+            socketTimeout: 60000
31
+            # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
32
+            timeBetweenEvictionRunsMillis: 60000
33
+            # 配置一个连接在池中最小生存的时间,单位是毫秒
34
+            minEvictableIdleTimeMillis: 300000
35
+            # 配置一个连接在池中最大生存的时间,单位是毫秒
36
+            maxEvictableIdleTimeMillis: 900000
37
+            # 配置检测连接是否有效
38
+            validationQuery: SELECT 1 FROM DUAL
39
+            testWhileIdle: true
40
+            testOnBorrow: false
41
+            testOnReturn: false
42
+            webStatFilter: 
43
+                enabled: true
44
+            statViewServlet:
45
+                enabled: true
46
+                # 设置白名单,不填则允许所有访问
47
+                allow:
48
+                url-pattern: /druid/*
49
+                # 控制台管理用户名和密码
50
+                login-username: ruoyi
51
+                login-password: 123456
52
+            filter:
53
+                stat:
54
+                    enabled: true
55
+                    # 慢SQL记录
56
+                    log-slow-sql: true
57
+                    slow-sql-millis: 1000
58
+                    merge-sql: true
59
+                wall:
60
+                    config:
61
+                        multi-statement-allow: true

+ 197
- 0
ruoyi-admin/src/main/resources/application.yml Bestand weergeven

@@ -0,0 +1,197 @@
1
+# 项目相关配置
2
+ruoyi:
3
+  # 名称
4
+  name: RuoYi
5
+  # 版本
6
+  version: 3.8.6
7
+  # 版权年份
8
+  copyrightYear: 2023
9
+  # 实例演示开关
10
+  demoEnabled: true
11
+  # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
12
+  profile: /home/ruoyi/uploadPath
13
+  # 获取ip地址开关
14
+  addressEnabled: false
15
+  # 验证码类型 math 数字计算 char 字符验证
16
+  captchaType: math
17
+
18
+# 开发环境配置
19
+server:
20
+  # 服务器的HTTP端口,默认为8080
21
+  port: 8001
22
+  servlet:
23
+    # 应用的访问路径
24
+    context-path: /
25
+  tomcat:
26
+    # tomcat的URI编码
27
+    uri-encoding: UTF-8
28
+    # 连接数满后的排队数,默认为100
29
+    accept-count: 1000
30
+    threads:
31
+      # tomcat最大线程数,默认为200
32
+      max: 800
33
+      # Tomcat启动初始化的线程数,默认值10
34
+      min-spare: 100
35
+# 日志配置
36
+logging:
37
+  level:
38
+    com.ruoyi: debug
39
+    org.springframework: warn
40
+
41
+# 用户配置
42
+user:
43
+  password:
44
+    # 密码最大错误次数
45
+    maxRetryCount: 5
46
+    # 密码锁定时间(默认10分钟)
47
+    lockTime: 10
48
+
49
+# Spring配置
50
+spring:
51
+  # 资源信息
52
+  messages:
53
+    # 国际化资源文件路径
54
+    basename: i18n/messages
55
+  profiles:
56
+    active: druid
57
+  # 文件上传
58
+  servlet:
59
+    multipart:
60
+      # 单个文件大小
61
+      max-file-size: 50MB
62
+      # 设置总上传的文件大小
63
+      max-request-size: 500MB
64
+  # 服务模块
65
+  devtools:
66
+    restart:
67
+      # 热部署开关
68
+      enabled: true
69
+  # redis 配置
70
+  redis:
71
+    # 地址
72
+    host: 121.40.189.20
73
+    # 端口,默认为6379
74
+    port: 6389
75
+    # 数据库索引
76
+    database: 0
77
+    # 密码
78
+    password:
79
+    # 连接超时时间
80
+    timeout: 10s
81
+    lettuce:
82
+      pool:
83
+        # 连接池中的最小空闲连接
84
+        min-idle: 0
85
+        # 连接池中的最大空闲连接
86
+        max-idle: 8
87
+        # 连接池的最大数据库连接数
88
+        max-active: 8
89
+        # #连接池最大阻塞等待时间(使用负值表示没有限制)
90
+        max-wait: -1ms
91
+  web:
92
+    resources:
93
+      static-locations:  file:/home/ruoyi/
94
+  mail:
95
+    host: smtp.163.com
96
+    port: 25
97
+    username: lmj1549843951@163.com
98
+    password: JGIOQVFCLAZKXRKO
99
+    default-encoding: UTF-8
100
+    properties:
101
+      mail:
102
+        smtp:
103
+          connectiontimeout: 5000
104
+          timeout: 5000
105
+          writetimeout: 5000
106
+          socketFactoryClass: javax.net.ssl.SSLSocketFactory
107
+          socketFactoryFallback: false
108
+          socketFactoryPort: 465
109
+        debug: false
110
+    protocol: smtp
111
+#上上签配置参数
112
+ssq:
113
+  developerId: 1695872832013855470
114
+  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
115
+  serverHost: https://openapi.bestsign.info/openapi/v2/
116
+
117
+# token配置
118
+token:
119
+  # 令牌自定义标识
120
+  header: Authorization
121
+  # 令牌密钥
122
+  secret: abcdefghijklmnopqrstuvwxyz
123
+  # 令牌有效期(默认30分钟)
124
+  expireTime: 30
125
+
126
+# MyBatis配置
127
+mybatis:
128
+  # 搜索指定包别名
129
+  typeAliasesPackage: com.ruoyi.**.domain
130
+  # 配置mapper的扫描,找到所有的mapper.xml映射文件
131
+  mapperLocations: classpath*:mapper/**/*Mapper.xml
132
+  # 加载全局的配置文件
133
+  configLocation: classpath:mybatis/mybatis-config.xml
134
+
135
+# PageHelper分页插件
136
+pagehelper:
137
+  helperDialect: mysql
138
+  supportMethodsArguments: true
139
+  params: count=countSql
140
+
141
+# Swagger配置
142
+swagger:
143
+  # 是否开启swagger
144
+  enabled: true
145
+  # 请求前缀
146
+  pathMapping: /dev-api
147
+
148
+# 防止XSS攻击
149
+xss:
150
+  # 过滤开关
151
+  enabled: true
152
+  # 排除链接(多个用逗号分隔)
153
+  excludes: /system/notice
154
+  # 匹配链接
155
+  urlPatterns: /system/*,/monitor/*,/tool/*
156
+#支付相关配置
157
+elegent:
158
+  pay:
159
+    wxpay:
160
+      mchId: 1561414331
161
+      appId: wx6592a2db3f85ed25
162
+      appSecret: d9a9ff00a633cd7353a8925119063b01
163
+      mchSerialNo: 25FBDE3EFD31B03A4377EB9A4A47C517969E6620
164
+      apiV3Key: CZBK51236435wxpay435434323FFDuv3
165
+    alipay:
166
+      appId: 2021003141676135
167
+    callback:
168
+      domain: http://121.40.189.20:9001/
169
+      watch: true
170
+      cycle: 10
171
+identityAuthentication:
172
+  credentialSecretId: AKID3xfHgroY4MQHvLXUXMwIQL1UjmbBX1Tv
173
+  credentialSecretKey: INDrIXcT8YmomZBcsy0oNirnU0LTN4X7
174
+  merchantId: 0NSJ2309281116194321
175
+  privateKeyHexDecodeinfo: 4c3b311bf7b98969994e85928e069574a1e95777f24d1c510679cc3c2f460faf
176
+# 腾讯云即时通信相关配置
177
+imConfig:
178
+  # sdkAppId
179
+  sdkAppId: 1600011167
180
+  # 密钥
181
+  sdkSecretKey: 17d136d9327576a247f991bdfed3a6d14cebc7d540a52245086829c3a1421a86
182
+  # 腾讯云账户 SecretId
183
+  secretId: AKID3xfHgroY4MQHvLXUXMwIQL1UjmbBX1Tv
184
+  # 腾讯云密钥
185
+  secretKey: INDrIXcT8YmomZBcsy0oNirnU0LTN4X7
186
+#jodconverter:
187
+#  local:
188
+#    host: 121.40.189.20
189
+    #暂时关闭预览,启动时会有点慢
190
+#    enabled: true
191
+    #设置libreoffice主目录 linux地址如:/usr/lib64/libreoffice
192
+#    office-home: /usr/lib64/libreoffice/
193
+#    office-home: D:\app\libreOffice\
194
+    #开启多个libreoffice进程,每个端口对应一个进程
195
+#    port-numbers: 8100
196
+    #libreoffice进程重启前的最大进程数
197
+#    max-tasks-per-process: 100

+ 24
- 0
ruoyi-admin/src/main/resources/banner.txt Bestand weergeven

@@ -0,0 +1,24 @@
1
+Application Version: ${ruoyi.version}
2
+Spring Boot Version: ${spring-boot.version}
3
+////////////////////////////////////////////////////////////////////
4
+//                          _ooOoo_                               //
5
+//                         o8888888o                              //
6
+//                         88" . "88                              //
7
+//                         (| ^_^ |)                              //
8
+//                         O\  =  /O                              //
9
+//                      ____/`---'\____                           //
10
+//                    .'  \\|     |//  `.                         //
11
+//                   /  \\|||  :  |||//  \                        //
12
+//                  /  _||||| -:- |||||-  \                       //
13
+//                  |   | \\\  -  /// |   |                       //
14
+//                  | \_|  ''\---/''  |   |                       //
15
+//                  \  .-\__  `-`  ___/-. /                       //
16
+//                ___`. .'  /--.--\  `. . ___                     //
17
+//              ."" '<  `.___\_<|>_/___.'  >'"".                  //
18
+//            | | :  `- \`.;`\ _ /`;.`/ - ` : | |                 //
19
+//            \  \ `-.   \_ __\ /__ _/   .-` /  /                 //
20
+//      ========`-.____`-.___\_____/___.-`____.-'========         //
21
+//                           `=---='                              //
22
+//      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^        //
23
+//             佛祖保佑       永不宕机      永无BUG               //
24
+////////////////////////////////////////////////////////////////////

+ 38
- 0
ruoyi-admin/src/main/resources/i18n/messages.properties Bestand weergeven

@@ -0,0 +1,38 @@
1
+#错误消息
2
+not.null=* 必须填写
3
+user.jcaptcha.error=验证码错误
4
+user.jcaptcha.expire=验证码已失效
5
+user.not.exists=用户不存在/密码错误
6
+user.password.not.match=用户不存在/密码错误
7
+user.password.retry.limit.count=密码输入错误{0}次
8
+user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟
9
+user.password.delete=对不起,您的账号已被删除
10
+user.blocked=用户已封禁,请联系管理员
11
+role.blocked=角色已封禁,请联系管理员
12
+login.blocked=很遗憾,访问IP已被列入系统黑名单
13
+user.logout.success=退出成功
14
+
15
+length.not.valid=长度必须在{min}到{max}个字符之间
16
+
17
+user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头
18
+user.password.not.valid=* 5-50个字符
19
+ 
20
+user.email.not.valid=邮箱格式错误
21
+user.mobile.phone.number.not.valid=手机号格式错误
22
+user.login.success=登录成功
23
+user.register.success=注册成功
24
+user.notfound=请重新登录
25
+user.forcelogout=管理员强制退出,请重新登录
26
+user.unknown.error=未知错误,请重新登录
27
+
28
+##文件上传消息
29
+upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB!
30
+upload.filename.exceed.length=上传的文件名最长{0}个字符
31
+
32
+##权限
33
+no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
34
+no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
35
+no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}]
36
+no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}]
37
+no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}]
38
+no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}]

+ 93
- 0
ruoyi-admin/src/main/resources/logback.xml Bestand weergeven

@@ -0,0 +1,93 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<configuration>
3
+    <!-- 日志存放路径 -->
4
+	<property name="log.path" value="/home/ruoyi/logs" />
5
+    <!-- 日志输出格式 -->
6
+	<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
7
+
8
+	<!-- 控制台输出 -->
9
+	<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
10
+		<encoder>
11
+			<pattern>${log.pattern}</pattern>
12
+		</encoder>
13
+	</appender>
14
+	
15
+	<!-- 系统日志输出 -->
16
+	<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
17
+	    <file>${log.path}/sys-info.log</file>
18
+        <!-- 循环政策:基于时间创建日志文件 -->
19
+		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
20
+            <!-- 日志文件名格式 -->
21
+			<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
22
+			<!-- 日志最大的历史 60天 -->
23
+			<maxHistory>60</maxHistory>
24
+		</rollingPolicy>
25
+		<encoder>
26
+			<pattern>${log.pattern}</pattern>
27
+		</encoder>
28
+		<filter class="ch.qos.logback.classic.filter.LevelFilter">
29
+            <!-- 过滤的级别 -->
30
+            <level>INFO</level>
31
+            <!-- 匹配时的操作:接收(记录) -->
32
+            <onMatch>ACCEPT</onMatch>
33
+            <!-- 不匹配时的操作:拒绝(不记录) -->
34
+            <onMismatch>DENY</onMismatch>
35
+        </filter>
36
+	</appender>
37
+	
38
+	<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
39
+	    <file>${log.path}/sys-error.log</file>
40
+        <!-- 循环政策:基于时间创建日志文件 -->
41
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
42
+            <!-- 日志文件名格式 -->
43
+            <fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
44
+			<!-- 日志最大的历史 60天 -->
45
+			<maxHistory>60</maxHistory>
46
+        </rollingPolicy>
47
+        <encoder>
48
+            <pattern>${log.pattern}</pattern>
49
+        </encoder>
50
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
51
+            <!-- 过滤的级别 -->
52
+            <level>ERROR</level>
53
+			<!-- 匹配时的操作:接收(记录) -->
54
+            <onMatch>ACCEPT</onMatch>
55
+			<!-- 不匹配时的操作:拒绝(不记录) -->
56
+            <onMismatch>DENY</onMismatch>
57
+        </filter>
58
+    </appender>
59
+	
60
+	<!-- 用户访问日志输出  -->
61
+    <appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
62
+		<file>${log.path}/sys-user.log</file>
63
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
64
+            <!-- 按天回滚 daily -->
65
+            <fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
66
+            <!-- 日志最大的历史 60天 -->
67
+            <maxHistory>60</maxHistory>
68
+        </rollingPolicy>
69
+        <encoder>
70
+            <pattern>${log.pattern}</pattern>
71
+        </encoder>
72
+    </appender>
73
+	
74
+	<!-- 系统模块日志级别控制  -->
75
+	<logger name="com.ruoyi" level="info" />
76
+	<!-- Spring日志级别控制  -->
77
+	<logger name="org.springframework" level="warn" />
78
+
79
+	<root level="info">
80
+		<appender-ref ref="console" />
81
+	</root>
82
+	
83
+	<!--系统操作日志-->
84
+    <root level="info">
85
+        <appender-ref ref="file_info" />
86
+        <appender-ref ref="file_error" />
87
+    </root>
88
+	
89
+	<!--系统用户操作日志-->
90
+    <logger name="sys-user" level="info">
91
+        <appender-ref ref="sys-user"/>
92
+    </logger>
93
+</configuration> 

+ 20
- 0
ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml Bestand weergeven

@@ -0,0 +1,20 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE configuration
3
+PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
4
+"http://mybatis.org/dtd/mybatis-3-config.dtd">
5
+<configuration>
6
+    <!-- 全局参数 -->
7
+    <settings>
8
+        <!-- 使全局的映射器启用或禁用缓存 -->
9
+        <setting name="cacheEnabled"             value="true"   />
10
+        <!-- 允许JDBC 支持自动生成主键 -->
11
+        <setting name="useGeneratedKeys"         value="true"   />
12
+        <!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
13
+        <setting name="defaultExecutorType"      value="SIMPLE" />
14
+		<!-- 指定 MyBatis 所用日志的具体实现 -->
15
+        <setting name="logImpl"                  value="SLF4J"  />
16
+        <!-- 使用驼峰命名法转换字段 -->
17
+		<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
18
+	</settings>
19
+	
20
+</configuration>

+ 1
- 0
ruoyi-admin/src/main/resources/wxpay_private.key Bestand weergeven

@@ -0,0 +1 @@
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=

+ 290
- 0
ruoyi-common/pom.xml Bestand weergeven

@@ -0,0 +1,290 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project xmlns="http://maven.apache.org/POM/4.0.0"
3
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
+    <parent>
6
+        <artifactId>ruoyi</artifactId>
7
+        <groupId>com.ruoyi</groupId>
8
+        <version>3.8.6</version>
9
+    </parent>
10
+    <modelVersion>4.0.0</modelVersion>
11
+
12
+    <artifactId>ruoyi-common</artifactId>
13
+
14
+
15
+    <description>
16
+        common通用工具
17
+    </description>
18
+
19
+    <dependencies>
20
+
21
+        <!--docx文件下载问题-->
22
+        <dependency>
23
+            <groupId>org.apache.poi</groupId>
24
+            <artifactId>poi-ooxml</artifactId>
25
+            <version>4.1.2</version>
26
+        </dependency>
27
+
28
+        <!-- POI依赖,读取.doc型文档-->
29
+        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-scratchpad -->
30
+        <dependency>
31
+            <groupId>org.apache.poi</groupId>
32
+            <artifactId>poi-scratchpad</artifactId>
33
+            <version>4.1.1</version>
34
+        </dependency>
35
+
36
+        <dependency>
37
+            <groupId>commons-io</groupId>
38
+            <artifactId>commons-io</artifactId>
39
+            <version>2.6</version>
40
+        </dependency>
41
+        <dependency>
42
+            <groupId>org.jodconverter</groupId>
43
+            <artifactId>jodconverter-core</artifactId>
44
+            <version>4.2.0</version>
45
+        </dependency>
46
+        <dependency>
47
+            <groupId>org.jodconverter</groupId>
48
+            <artifactId>jodconverter-local</artifactId>
49
+            <version>4.2.0</version>
50
+        </dependency>
51
+        <dependency>
52
+            <groupId>org.jodconverter</groupId>
53
+            <artifactId>jodconverter-spring-boot-starter</artifactId>
54
+            <version>4.2.0</version>
55
+        </dependency>
56
+        <dependency>
57
+            <groupId>com.artofsolving</groupId>
58
+            <artifactId>jodconverter</artifactId>
59
+            <version>2.2.1</version>
60
+        </dependency>
61
+        <dependency>
62
+            <groupId>org.openoffice</groupId>
63
+            <artifactId>jurt</artifactId>
64
+            <version>3.0.1</version>
65
+        </dependency>
66
+        <dependency>
67
+            <groupId>org.openoffice</groupId>
68
+            <artifactId>ridl</artifactId>
69
+            <version>3.0.1</version>
70
+        </dependency>
71
+        <dependency>
72
+            <groupId>org.openoffice</groupId>
73
+            <artifactId>juh</artifactId>
74
+            <version>3.0.1</version>
75
+        </dependency>
76
+        <dependency>
77
+            <groupId>org.openoffice</groupId>
78
+            <artifactId>unoil</artifactId>
79
+            <version>3.0.1</version>
80
+        </dependency>
81
+
82
+
83
+
84
+        <!-- Spring框架基本的核心工具 -->
85
+        <dependency>
86
+            <groupId>org.springframework</groupId>
87
+            <artifactId>spring-context-support</artifactId>
88
+        </dependency>
89
+
90
+        <!-- SpringWeb模块 -->
91
+        <dependency>
92
+            <groupId>org.springframework</groupId>
93
+            <artifactId>spring-web</artifactId>
94
+        </dependency>
95
+
96
+        <!-- spring security 安全认证 -->
97
+        <dependency>
98
+            <groupId>org.springframework.boot</groupId>
99
+            <artifactId>spring-boot-starter-security</artifactId>
100
+        </dependency>
101
+
102
+        <!-- pagehelper 分页插件 -->
103
+        <dependency>
104
+            <groupId>com.github.pagehelper</groupId>
105
+            <artifactId>pagehelper-spring-boot-starter</artifactId>
106
+        </dependency>
107
+
108
+        <!-- 自定义验证注解 -->
109
+        <dependency>
110
+            <groupId>org.springframework.boot</groupId>
111
+            <artifactId>spring-boot-starter-validation</artifactId>
112
+        </dependency>
113
+
114
+        <!--常用工具类 -->
115
+        <dependency>
116
+            <groupId>org.apache.commons</groupId>
117
+            <artifactId>commons-lang3</artifactId>
118
+        </dependency>
119
+
120
+        <!-- JSON工具类 -->
121
+        <dependency>
122
+            <groupId>com.fasterxml.jackson.core</groupId>
123
+            <artifactId>jackson-databind</artifactId>
124
+        </dependency>
125
+
126
+        <!-- 动态数据源 -->
127
+        <dependency>
128
+            <groupId>com.baomidou</groupId>
129
+            <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
130
+            <version>3.5.2</version>
131
+        </dependency>
132
+
133
+        <!-- 阿里JSON解析器 -->
134
+        <dependency>
135
+            <groupId>com.alibaba.fastjson2</groupId>
136
+            <artifactId>fastjson2</artifactId>
137
+        </dependency>
138
+
139
+        <!-- io常用工具类 -->
140
+        <dependency>
141
+            <groupId>commons-io</groupId>
142
+            <artifactId>commons-io</artifactId>
143
+        </dependency>
144
+
145
+        <!-- excel工具 -->
146
+        <dependency>
147
+            <groupId>org.apache.poi</groupId>
148
+            <artifactId>poi-ooxml</artifactId>
149
+        </dependency>
150
+
151
+        <!-- yml解析器 -->
152
+        <dependency>
153
+            <groupId>org.yaml</groupId>
154
+            <artifactId>snakeyaml</artifactId>
155
+        </dependency>
156
+
157
+        <!-- Token生成与解析-->
158
+        <dependency>
159
+            <groupId>io.jsonwebtoken</groupId>
160
+            <artifactId>jjwt</artifactId>
161
+        </dependency>
162
+
163
+        <!-- Jaxb -->
164
+        <dependency>
165
+            <groupId>javax.xml.bind</groupId>
166
+            <artifactId>jaxb-api</artifactId>
167
+        </dependency>
168
+
169
+        <!-- redis 缓存操作 -->
170
+        <dependency>
171
+            <groupId>org.springframework.boot</groupId>
172
+            <artifactId>spring-boot-starter-data-redis</artifactId>
173
+        </dependency>
174
+
175
+        <!-- pool 对象池 -->
176
+        <dependency>
177
+            <groupId>org.apache.commons</groupId>
178
+            <artifactId>commons-pool2</artifactId>
179
+        </dependency>
180
+
181
+        <!-- 解析客户端操作系统、浏览器等 -->
182
+        <dependency>
183
+            <groupId>eu.bitwalker</groupId>
184
+            <artifactId>UserAgentUtils</artifactId>
185
+        </dependency>
186
+
187
+        <!-- servlet包 -->
188
+        <dependency>
189
+            <groupId>javax.servlet</groupId>
190
+            <artifactId>javax.servlet-api</artifactId>
191
+        </dependency>
192
+
193
+        <dependency>
194
+            <groupId>org.projectlombok</groupId>
195
+            <artifactId>lombok</artifactId>
196
+            <version>1.18.22</version>
197
+        </dependency>
198
+
199
+        <!-- 腾讯短信sdk -->
200
+        <dependency>
201
+            <groupId>com.tencentcloudapi</groupId>
202
+            <artifactId>tencentcloud-sdk-java</artifactId>
203
+            <version>3.1.876</version>
204
+        </dependency>
205
+
206
+        <dependency>
207
+            <groupId>com.tencentcloudapi</groupId>
208
+            <artifactId>tencentcloud-sdk-java-faceid</artifactId>
209
+            <version>3.1.875</version>
210
+        </dependency>
211
+        <!--用户信息解密-->
212
+        <dependency>
213
+            <groupId>cn.hutool</groupId>
214
+            <artifactId>hutool-all</artifactId>
215
+            <version>5.7.15</version>
216
+        </dependency>
217
+
218
+        <dependency>
219
+            <groupId>org.bouncycastle</groupId>
220
+            <artifactId>bcprov-jdk15to18</artifactId>
221
+            <version>1.69</version>
222
+        </dependency>
223
+
224
+        <!-- poi-tl-->
225
+        <dependency>
226
+            <groupId>com.deepoove</groupId>
227
+            <artifactId>poi-tl</artifactId>
228
+            <version>1.9.1</version>
229
+        </dependency>
230
+
231
+        <dependency>
232
+            <groupId>com.documents4j</groupId>
233
+            <artifactId>documents4j-local</artifactId>
234
+            <version>1.0.3</version>
235
+        </dependency>
236
+        <dependency>
237
+            <groupId>com.documents4j</groupId>
238
+            <artifactId>documents4j-transformer-msoffice-word</artifactId>
239
+            <version>1.0.3</version>
240
+        </dependency>
241
+        <dependency>
242
+            <groupId>org.apache.pdfbox</groupId>
243
+            <artifactId>pdfbox</artifactId>
244
+            <version>2.0.27</version>
245
+        </dependency>
246
+
247
+
248
+        <dependency>
249
+            <groupId>com.itextpdf</groupId>
250
+            <artifactId>itextpdf</artifactId>
251
+            <version>5.5.13</version>
252
+        </dependency>
253
+        <dependency>
254
+            <groupId>com.itextpdf.tool</groupId>
255
+            <artifactId>xmlworker</artifactId>
256
+            <version>5.5.13</version>
257
+        </dependency>
258
+
259
+
260
+        <!--  发送邮件-->
261
+        <dependency>
262
+            <groupId>org.springframework.boot</groupId>
263
+            <artifactId>spring-boot-starter-mail</artifactId>
264
+            <version>3.1.4</version>
265
+        </dependency>
266
+        <dependency>
267
+            <groupId>org.springframework.boot</groupId>
268
+            <artifactId>spring-boot-starter-websocket</artifactId>
269
+        </dependency>
270
+        <dependency>
271
+            <groupId>javax.activation</groupId>
272
+            <artifactId>activation</artifactId>
273
+            <version>1.1.1</version>
274
+        </dependency>
275
+
276
+        <!-- https://mvnrepository.com/artifact/javax.mail/mail -->
277
+        <dependency>
278
+            <groupId>javax.mail</groupId>
279
+            <artifactId>mail</artifactId>
280
+            <version>1.4.7</version>
281
+        </dependency>
282
+        <dependency>
283
+            <groupId>org.apache.httpcomponents</groupId>
284
+            <artifactId>httpclient</artifactId>
285
+        </dependency>
286
+
287
+
288
+    </dependencies>
289
+
290
+</project>

+ 19
- 0
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Anonymous.java Bestand weergeven

@@ -0,0 +1,19 @@
1
+package com.ruoyi.common.annotation;
2
+
3
+import java.lang.annotation.Documented;
4
+import java.lang.annotation.ElementType;
5
+import java.lang.annotation.Retention;
6
+import java.lang.annotation.RetentionPolicy;
7
+import java.lang.annotation.Target;
8
+
9
+/**
10
+ * 匿名访问不鉴权注解
11
+ * 
12
+ * @author ruoyi
13
+ */
14
+@Target({ ElementType.METHOD, ElementType.TYPE })
15
+@Retention(RetentionPolicy.RUNTIME)
16
+@Documented
17
+public @interface Anonymous
18
+{
19
+}

+ 33
- 0
ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java Bestand weergeven

@@ -0,0 +1,33 @@
1
+package com.ruoyi.common.annotation;
2
+
3
+import java.lang.annotation.Documented;
4
+import java.lang.annotation.ElementType;
5
+import java.lang.annotation.Retention;
6
+import java.lang.annotation.RetentionPolicy;
7
+import java.lang.annotation.Target;
8
+
9
+/**
10
+ * 数据权限过滤注解
11
+ * 
12
+ * @author ruoyi
13
+ */
14
+@Target(ElementType.METHOD)
15
+@Retention(RetentionPolicy.RUNTIME)
16
+@Documented
17
+public @interface DataScope
18
+{
19
+    /**
20
+     * 部门表的别名
21
+     */
22
+    public String deptAlias() default "";
23
+
24
+    /**
25
+     * 用户表的别名
26
+     */
27
+    public String userAlias() default "";
28
+
29
+    /**
30
+     * 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@ss获取,多个权限用逗号分隔开来
31
+     */
32
+    public String permission() default "";
33
+}

+ 28
- 0
ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataSource.java Bestand weergeven

@@ -0,0 +1,28 @@
1
+package com.ruoyi.common.annotation;
2
+
3
+import java.lang.annotation.Documented;
4
+import java.lang.annotation.ElementType;
5
+import java.lang.annotation.Inherited;
6
+import java.lang.annotation.Retention;
7
+import java.lang.annotation.RetentionPolicy;
8
+import java.lang.annotation.Target;
9
+import com.ruoyi.common.enums.DataSourceType;
10
+
11
+/**
12
+ * 自定义多数据源切换注解
13
+ *
14
+ * 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准
15
+ *
16
+ * @author ruoyi
17
+ */
18
+@Target({ ElementType.METHOD, ElementType.TYPE })
19
+@Retention(RetentionPolicy.RUNTIME)
20
+@Documented
21
+@Inherited
22
+public @interface DataSource
23
+{
24
+    /**
25
+     * 切换数据源名称
26
+     */
27
+    public DataSourceType value() default DataSourceType.MASTER;
28
+}

+ 187
- 0
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java Bestand weergeven

@@ -0,0 +1,187 @@
1
+package com.ruoyi.common.annotation;
2
+
3
+import java.lang.annotation.ElementType;
4
+import java.lang.annotation.Retention;
5
+import java.lang.annotation.RetentionPolicy;
6
+import java.lang.annotation.Target;
7
+import java.math.BigDecimal;
8
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
9
+import org.apache.poi.ss.usermodel.IndexedColors;
10
+import com.ruoyi.common.utils.poi.ExcelHandlerAdapter;
11
+
12
+/**
13
+ * 自定义导出Excel数据注解
14
+ * 
15
+ * @author ruoyi
16
+ */
17
+@Retention(RetentionPolicy.RUNTIME)
18
+@Target(ElementType.FIELD)
19
+public @interface Excel
20
+{
21
+    /**
22
+     * 导出时在excel中排序
23
+     */
24
+    public int sort() default Integer.MAX_VALUE;
25
+
26
+    /**
27
+     * 导出到Excel中的名字.
28
+     */
29
+    public String name() default "";
30
+
31
+    /**
32
+     * 日期格式, 如: yyyy-MM-dd
33
+     */
34
+    public String dateFormat() default "";
35
+
36
+    /**
37
+     * 如果是字典类型,请设置字典的type值 (如: sys_user_sex)
38
+     */
39
+    public String dictType() default "";
40
+
41
+    /**
42
+     * 读取内容转表达式 (如: 0=男,1=女,2=未知)
43
+     */
44
+    public String readConverterExp() default "";
45
+
46
+    /**
47
+     * 分隔符,读取字符串组内容
48
+     */
49
+    public String separator() default ",";
50
+
51
+    /**
52
+     * BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
53
+     */
54
+    public int scale() default -1;
55
+
56
+    /**
57
+     * BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
58
+     */
59
+    public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
60
+
61
+    /**
62
+     * 导出时在excel中每个列的高度
63
+     */
64
+    public double height() default 14;
65
+
66
+    /**
67
+     * 导出时在excel中每个列的宽度
68
+     */
69
+    public double width() default 16;
70
+
71
+    /**
72
+     * 文字后缀,如% 90 变成90%
73
+     */
74
+    public String suffix() default "";
75
+
76
+    /**
77
+     * 当值为空时,字段的默认值
78
+     */
79
+    public String defaultValue() default "";
80
+
81
+    /**
82
+     * 提示信息
83
+     */
84
+    public String prompt() default "";
85
+
86
+    /**
87
+     * 设置只能选择不能输入的列内容.
88
+     */
89
+    public String[] combo() default {};
90
+
91
+    /**
92
+     * 是否需要纵向合并单元格,应对需求:含有list集合单元格)
93
+     */
94
+    public boolean needMerge() default false;
95
+
96
+    /**
97
+     * 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
98
+     */
99
+    public boolean isExport() default true;
100
+
101
+    /**
102
+     * 另一个类中的属性名称,支持多级获取,以小数点隔开
103
+     */
104
+    public String targetAttr() default "";
105
+
106
+    /**
107
+     * 是否自动统计数据,在最后追加一行统计数据总和
108
+     */
109
+    public boolean isStatistics() default false;
110
+
111
+    /**
112
+     * 导出类型(0数字 1字符串 2图片)
113
+     */
114
+    public ColumnType cellType() default ColumnType.STRING;
115
+
116
+    /**
117
+     * 导出列头背景颜色
118
+     */
119
+    public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT;
120
+
121
+    /**
122
+     * 导出列头字体颜色
123
+     */
124
+    public IndexedColors headerColor() default IndexedColors.WHITE;
125
+
126
+    /**
127
+     * 导出单元格背景颜色
128
+     */
129
+    public IndexedColors backgroundColor() default IndexedColors.WHITE;
130
+
131
+    /**
132
+     * 导出单元格字体颜色
133
+     */
134
+    public IndexedColors color() default IndexedColors.BLACK;
135
+
136
+    /**
137
+     * 导出字段对齐方式
138
+     */
139
+    public HorizontalAlignment align() default HorizontalAlignment.CENTER;
140
+
141
+    /**
142
+     * 自定义数据处理器
143
+     */
144
+    public Class<?> handler() default ExcelHandlerAdapter.class;
145
+
146
+    /**
147
+     * 自定义数据处理器参数
148
+     */
149
+    public String[] args() default {};
150
+
151
+    /**
152
+     * 字段类型(0:导出导入;1:仅导出;2:仅导入)
153
+     */
154
+    Type type() default Type.ALL;
155
+
156
+    public enum Type
157
+    {
158
+        ALL(0), EXPORT(1), IMPORT(2);
159
+        private final int value;
160
+
161
+        Type(int value)
162
+        {
163
+            this.value = value;
164
+        }
165
+
166
+        public int value()
167
+        {
168
+            return this.value;
169
+        }
170
+    }
171
+
172
+    public enum ColumnType
173
+    {
174
+        NUMERIC(0), STRING(1), IMAGE(2);
175
+        private final int value;
176
+
177
+        ColumnType(int value)
178
+        {
179
+            this.value = value;
180
+        }
181
+
182
+        public int value()
183
+        {
184
+            return this.value;
185
+        }
186
+    }
187
+}

+ 18
- 0
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excels.java Bestand weergeven

@@ -0,0 +1,18 @@
1
+package com.ruoyi.common.annotation;
2
+
3
+import java.lang.annotation.ElementType;
4
+import java.lang.annotation.Retention;
5
+import java.lang.annotation.RetentionPolicy;
6
+import java.lang.annotation.Target;
7
+
8
+/**
9
+ * Excel注解集
10
+ * 
11
+ * @author ruoyi
12
+ */
13
+@Target(ElementType.FIELD)
14
+@Retention(RetentionPolicy.RUNTIME)
15
+public @interface Excels
16
+{
17
+    public Excel[] value();
18
+}

+ 51
- 0
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java Bestand weergeven

@@ -0,0 +1,51 @@
1
+package com.ruoyi.common.annotation;
2
+
3
+import java.lang.annotation.Documented;
4
+import java.lang.annotation.ElementType;
5
+import java.lang.annotation.Retention;
6
+import java.lang.annotation.RetentionPolicy;
7
+import java.lang.annotation.Target;
8
+import com.ruoyi.common.enums.BusinessType;
9
+import com.ruoyi.common.enums.OperatorType;
10
+
11
+/**
12
+ * 自定义操作日志记录注解
13
+ * 
14
+ * @author ruoyi
15
+ *
16
+ */
17
+@Target({ ElementType.PARAMETER, ElementType.METHOD })
18
+@Retention(RetentionPolicy.RUNTIME)
19
+@Documented
20
+public @interface Log
21
+{
22
+    /**
23
+     * 模块
24
+     */
25
+    public String title() default "";
26
+
27
+    /**
28
+     * 功能
29
+     */
30
+    public BusinessType businessType() default BusinessType.OTHER;
31
+
32
+    /**
33
+     * 操作人类别
34
+     */
35
+    public OperatorType operatorType() default OperatorType.MANAGE;
36
+
37
+    /**
38
+     * 是否保存请求的参数
39
+     */
40
+    public boolean isSaveRequestData() default true;
41
+
42
+    /**
43
+     * 是否保存响应的参数
44
+     */
45
+    public boolean isSaveResponseData() default true;
46
+
47
+    /**
48
+     * 排除指定的请求参数
49
+     */
50
+    public String[] excludeParamNames() default {};
51
+}

+ 0
- 0
ruoyi-common/src/main/java/com/ruoyi/common/annotation/RateLimiter.java Bestand weergeven


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