瀏覽代碼

Merge branch 'dev' of http://git.xayunmei.com/SH-Arbitrate/Arbitrate-Backend into qtz3

qitz 2 年之前
父節點
當前提交
2101dddcc6
共有 100 個檔案被更改,包括 8231 行新增86 行删除
  1. 59
    0
      pay/pom.xml
  2. 32
    0
      pay/src/main/java/com/ruoyi/CallBackService.java
  3. 66
    0
      pay/src/main/java/com/ruoyi/ElegentPay.java
  4. 40
    0
      pay/src/main/java/com/ruoyi/ali/AlipayConfig.java
  5. 30
    0
      pay/src/main/java/com/ruoyi/ali/AlipayConstant.java
  6. 461
    0
      pay/src/main/java/com/ruoyi/ali/AlipayElegentTrade.java
  7. 124
    0
      pay/src/main/java/com/ruoyi/ali/AlipayElegentValid.java
  8. 20
    0
      pay/src/main/java/com/ruoyi/annotation/TradePlatform.java
  9. 23
    0
      pay/src/main/java/com/ruoyi/config/CallbackConfig.java
  10. 11
    0
      pay/src/main/java/com/ruoyi/constant/PayConstant.java
  11. 16
    0
      pay/src/main/java/com/ruoyi/constant/Platform.java
  12. 33
    0
      pay/src/main/java/com/ruoyi/constant/TradeType.java
  13. 35
    0
      pay/src/main/java/com/ruoyi/core/CallBackServiceImpl.java
  14. 90
    0
      pay/src/main/java/com/ruoyi/core/CallbackController.java
  15. 73
    0
      pay/src/main/java/com/ruoyi/core/CallbackWatch.java
  16. 27
    0
      pay/src/main/java/com/ruoyi/core/ElegentConfig.java
  17. 82
    0
      pay/src/main/java/com/ruoyi/core/ElegentLoader.java
  18. 136
    0
      pay/src/main/java/com/ruoyi/core/ElegentPayImpl.java
  19. 54
    0
      pay/src/main/java/com/ruoyi/core/ElegentTrade.java
  20. 48
    0
      pay/src/main/java/com/ruoyi/core/ElegentValid.java
  21. 20
    0
      pay/src/main/java/com/ruoyi/core/WatchList.java
  22. 20
    0
      pay/src/main/java/com/ruoyi/dto/PayRequest.java
  23. 29
    0
      pay/src/main/java/com/ruoyi/dto/PayResponse.java
  24. 24
    0
      pay/src/main/java/com/ruoyi/dto/QueryRefundResponse.java
  25. 25
    0
      pay/src/main/java/com/ruoyi/dto/QueryResponse.java
  26. 16
    0
      pay/src/main/java/com/ruoyi/dto/RefundRequest.java
  27. 15
    0
      pay/src/main/java/com/ruoyi/dto/ValidResponse.java
  28. 12
    0
      pay/src/main/java/com/ruoyi/dto/WatchDTO.java
  29. 24
    0
      pay/src/main/java/com/ruoyi/exceptions/TradeException.java
  30. 16
    0
      pay/src/main/java/com/ruoyi/key/KeyManager.java
  31. 19
    0
      pay/src/main/java/com/ruoyi/key/impl/DefaultKeyManager.java
  32. 37
    0
      pay/src/main/java/com/ruoyi/util/FileUtil.java
  33. 459
    0
      pay/src/main/java/com/ruoyi/wx/WxPayElegentTrade.java
  34. 153
    0
      pay/src/main/java/com/ruoyi/wx/WxPayElegentValid.java
  35. 20
    0
      pay/src/main/java/com/ruoyi/wx/WxpayConfig.java
  36. 48
    0
      pay/src/main/java/com/ruoyi/wx/WxpayConstant.java
  37. 14
    0
      pay/src/main/resources/META-INF/spring.factories
  38. 1
    0
      pom.xml
  39. 5
    1
      ruoyi-admin/pom.xml
  40. 33
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/bestsign/ArbitrSignatuController.java
  41. 31
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/bestsign/RegisterController.java
  42. 18
    12
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
  43. 107
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java
  44. 41
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/ArbitratorController.java
  45. 214
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java
  46. 42
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseArbitrateController.java
  47. 96
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java
  48. 40
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseLogRecordController.java
  49. 44
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CasePaymentController.java
  50. 40
    0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/IdentityAuthenticationController.java
  51. 1
    0
      ruoyi-admin/src/main/resources/alipay_private.key
  52. 1
    0
      ruoyi-admin/src/main/resources/alipay_public.key
  53. 3
    3
      ruoyi-admin/src/main/resources/application-druid.yml
  54. 43
    5
      ruoyi-admin/src/main/resources/application.yml
  55. 1
    0
      ruoyi-admin/src/main/resources/wxpay_private.key
  56. 70
    7
      ruoyi-common/pom.xml
  57. 13
    0
      ruoyi-common/src/main/java/com/ruoyi/common/config/EsignDemoConfig.java
  58. 53
    0
      ruoyi-common/src/main/java/com/ruoyi/common/constant/CaseApplicationConstants.java
  59. 371
    0
      ruoyi-common/src/main/java/com/ruoyi/common/constant/EsignEncryption.java
  60. 26
    0
      ruoyi-common/src/main/java/com/ruoyi/common/constant/EsignHeaderConstant.java
  61. 486
    0
      ruoyi-common/src/main/java/com/ruoyi/common/constant/EsignHttpCfgHelper.java
  62. 284
    0
      ruoyi-common/src/main/java/com/ruoyi/common/constant/FileTransformation.java
  63. 44
    45
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java
  64. 24
    0
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/EsignCoreSdkInfo.java
  65. 24
    0
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/EsignHttpResponse.java
  66. 39
    0
      ruoyi-common/src/main/java/com/ruoyi/common/enums/EsignRequestType.java
  67. 6
    10
      ruoyi-common/src/main/java/com/ruoyi/common/enums/HttpMethod.java
  68. 36
    0
      ruoyi-common/src/main/java/com/ruoyi/common/exception/EsignDemoException.java
  69. 187
    0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/EmailOutUtil.java
  70. 178
    0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/EsignHttpHelper.java
  71. 77
    0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/SmsUtils.java
  72. 156
    0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/WordUtil.java
  73. 57
    0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/EsignFileBean.java
  74. 83
    0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java
  75. 2
    1
      ruoyi-framework/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java
  76. 1
    1
      ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
  77. 5
    1
      ruoyi-system/pom.xml
  78. 51
    0
      ruoyi-system/src/main/java/com/ruoyi/bestsign/domain/ArbitrSignatuVO.java
  79. 22
    0
      ruoyi-system/src/main/java/com/ruoyi/bestsign/domain/CredentialVO.java
  80. 29
    0
      ruoyi-system/src/main/java/com/ruoyi/bestsign/domain/PersonRegisterVO.java
  81. 12
    0
      ruoyi-system/src/main/java/com/ruoyi/bestsign/service/ArbitrSignatuService.java
  82. 18
    0
      ruoyi-system/src/main/java/com/ruoyi/bestsign/service/SignRegisterService.java
  83. 29
    0
      ruoyi-system/src/main/java/com/ruoyi/bestsign/service/impl/ArbitrSignatuServiceImpl.java
  84. 63
    0
      ruoyi-system/src/main/java/com/ruoyi/bestsign/service/impl/RegisterServiceImpl.java
  85. 286
    0
      ruoyi-system/src/main/java/com/ruoyi/bestsign/utils/BestsignOpenApiClient.java
  86. 390
    0
      ruoyi-system/src/main/java/com/ruoyi/bestsign/utils/HttpClientSender.java
  87. 281
    0
      ruoyi-system/src/main/java/com/ruoyi/bestsign/utils/RSAUtils.java
  88. 188
    0
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/Adjudication.java
  89. 34
    0
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/ArbitrateRecord.java
  90. 123
    0
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/Arbitrator.java
  91. 171
    0
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseAffiliate.java
  92. 732
    0
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java
  93. 46
    0
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseAttach.java
  94. 105
    0
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseLogRecord.java
  95. 41
    0
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CasePaymentRecord.java
  96. 129
    0
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/IdentityAuthentication.java
  97. 37
    0
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/CaseEvidenceDTO.java
  98. 26
    0
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/CasePayDTO.java
  99. 24
    0
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/ArchivesDetailVO.java
  100. 0
    0
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/BookSendVO.java

+ 59
- 0
pay/pom.xml 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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

+ 1
- 0
pom.xml 查看文件

@@ -180,6 +180,7 @@
180 180
         <module>ruoyi-quartz</module>
181 181
         <module>ruoyi-generator</module>
182 182
         <module>ruoyi-common</module>
183
+        <module>pay</module>
183 184
     </modules>
184 185
     <packaging>pom</packaging>
185 186
 

+ 5
- 1
ruoyi-admin/pom.xml 查看文件

@@ -60,7 +60,11 @@
60 60
             <groupId>com.ruoyi</groupId>
61 61
             <artifactId>ruoyi-generator</artifactId>
62 62
         </dependency>
63
-
63
+        <dependency>
64
+            <groupId>com.ruoyi</groupId>
65
+            <artifactId>pay</artifactId>
66
+            <version>1.0.0-SNAPSHOT</version>
67
+        </dependency>
64 68
     </dependencies>
65 69
 
66 70
     <build>

+ 33
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/bestsign/ArbitrSignatuController.java 查看文件

@@ -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 查看文件

@@ -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
+}

+ 18
- 12
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java 查看文件

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

+ 107
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java 查看文件

@@ -0,0 +1,107 @@
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.wisdomarbitrate.domain.CaseApplication;
6
+import com.ruoyi.wisdomarbitrate.domain.vo.BookSendVO;
7
+import com.ruoyi.wisdomarbitrate.domain.vo.LogisticsInfoVO;
8
+import com.ruoyi.wisdomarbitrate.service.IAdjudicationService;
9
+import org.springframework.beans.factory.annotation.Autowired;
10
+import org.springframework.security.access.prepost.PreAuthorize;
11
+import org.springframework.validation.annotation.Validated;
12
+import org.springframework.web.bind.annotation.*;
13
+
14
+import java.util.List;
15
+
16
+@RestController
17
+@RequestMapping("/adjudication")
18
+public class AdjudicationController extends BaseController {
19
+    @Autowired
20
+    private IAdjudicationService adjudicationService;
21
+
22
+    /**
23
+     * 生成裁决书
24
+     * @param caseApplication
25
+     * @return
26
+     */
27
+    @PostMapping("/document")
28
+    @PreAuthorize("@ss.hasPermi('caseManagement:list:createaward')")
29
+    public AjaxResult createDocument(@Validated @RequestBody CaseApplication caseApplication){
30
+        return adjudicationService.createDocument(caseApplication);
31
+    }
32
+
33
+    /**
34
+     * 裁决书送达(电子邮件)
35
+     * @param bookSendVO
36
+     * @return
37
+     */
38
+    @PostMapping("/delivery")
39
+    public AjaxResult sendDocumentByEmail(@RequestBody BookSendVO bookSendVO){
40
+        return adjudicationService.sendDocumentByEmail(bookSendVO.getId(),bookSendVO.getAppEmail(),bookSendVO.getResEmail(),bookSendVO.getApptrackingNum(),bookSendVO.getRestrackingNum());
41
+    }
42
+
43
+    /**
44
+     * 根据快递单号查询物流信息
45
+     * @param caseApplication
46
+     * @return
47
+     */
48
+    @GetMapping("/logistics")
49
+    @PreAuthorize("@ss.hasPermi('delivery:detail')")
50
+    public AjaxResult  getLogisticsInfo(CaseApplication caseApplication){
51
+        List<LogisticsInfoVO> logisticsInfo = adjudicationService.getLogisticsInfo(caseApplication);
52
+        return AjaxResult.success(logisticsInfo);
53
+    }
54
+
55
+    /**
56
+     * 签名(暂时只改案件状态)
57
+     * @param caseApplication
58
+     * @return
59
+     */
60
+    @PostMapping("/signature")
61
+    @PreAuthorize("@ss.hasPermi('awardManagement:list:sign')")
62
+    public AjaxResult signature(@Validated @RequestBody CaseApplication caseApplication){
63
+        return adjudicationService.signature(caseApplication);
64
+    }
65
+
66
+    /**
67
+     * 归档(暂时只改案件状态)
68
+     * @param caseApplication
69
+     * @return
70
+     */
71
+    @PostMapping("/caseFile")
72
+    @PreAuthorize("@ss.hasPermi('awardManagement:list:file')")
73
+    public AjaxResult caseFile(@Validated @RequestBody CaseApplication caseApplication){
74
+        return adjudicationService.caseFile(caseApplication);
75
+    }
76
+
77
+    /**
78
+     * 送达(不包含发送电子邮件)
79
+     * @param bookSendVO
80
+     * @return
81
+     */
82
+    @PostMapping("/service")
83
+    @PreAuthorize("@ss.hasPermi('awardManagement:list:sendaward')")
84
+    public AjaxResult service(@RequestBody BookSendVO bookSendVO){
85
+        return adjudicationService.service(bookSendVO.getId(),bookSendVO.getAppEmail(),bookSendVO.getResEmail(),bookSendVO.getApptrackingNum(),bookSendVO.getRestrackingNum());
86
+    }
87
+    /**
88
+     * 用印(暂时只改案件状态)
89
+     * @param caseApplication
90
+     * @return
91
+     */
92
+    @PostMapping("/stamp")
93
+    @PreAuthorize("@ss.hasPermi('awardManagement:list:signprint')")
94
+    public AjaxResult stamp(@Validated @RequestBody CaseApplication caseApplication){
95
+        return adjudicationService.stamp(caseApplication);
96
+    }
97
+
98
+    /**
99
+     * 档案详情查询
100
+     * @param id 案件id
101
+     * @return
102
+     */
103
+    @GetMapping("/archives")
104
+    public AjaxResult getArchivesDetail(Long id){
105
+        return adjudicationService.getArchivesDetail(id);
106
+    }
107
+}

+ 41
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/ArbitratorController.java 查看文件

@@ -0,0 +1,41 @@
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.Arbitrator;
6
+import com.ruoyi.wisdomarbitrate.service.IArbitratorService;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.security.access.prepost.PreAuthorize;
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("/arbitrator")
17
+public class ArbitratorController   extends BaseController {
18
+    @Autowired
19
+    private IArbitratorService arbitratorService;
20
+
21
+    /**
22
+     * 查询仲裁员信息
23
+     */
24
+//    @PreAuthorize("@ss.hasPermi('arbitrator:list')")
25
+    @GetMapping("/list")
26
+    public TableDataInfo list(Arbitrator arbitrator)
27
+    {
28
+        startPage();
29
+        List<Arbitrator> list = arbitratorService.selectArbitratorList(arbitrator);
30
+        return getDataTable(list);
31
+    }
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+}

+ 214
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java 查看文件

@@ -0,0 +1,214 @@
1
+package com.ruoyi.web.controller.wisdomarbitrate;
2
+
3
+import com.ruoyi.common.annotation.Anonymous;
4
+import com.ruoyi.common.annotation.Log;
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.enums.BusinessType;
9
+import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
10
+import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
11
+import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.security.access.prepost.PreAuthorize;
14
+import org.springframework.validation.annotation.Validated;
15
+import org.springframework.web.bind.annotation.*;
16
+import com.ruoyi.common.utils.poi.ExcelUtil;
17
+import org.springframework.web.multipart.MultipartFile;
18
+
19
+import javax.servlet.http.HttpServletResponse;
20
+import java.util.List;
21
+
22
+
23
+@RestController
24
+@RequestMapping("/caseApplication")
25
+public class CaseApplicationController extends BaseController {
26
+    @Autowired
27
+    private ICaseApplicationService caseApplicationService;
28
+
29
+
30
+    /**
31
+     * 查询立案数据
32
+     */
33
+    @PreAuthorize("@ss.hasPermi('caseManagement:list')")
34
+    @GetMapping("/list")
35
+    public TableDataInfo list(CaseApplication caseApplication) {
36
+        startPage();
37
+        List<CaseApplication> list = caseApplicationService.selectCaseApplicationList(caseApplication);
38
+        return getDataTable(list);
39
+    }
40
+
41
+    /**
42
+     * 新增立案数据
43
+     */
44
+    @PreAuthorize("@ss.hasPermi('caseManagement:list:add')")
45
+    @Log(title = "新增立案数据", businessType = BusinessType.INSERT)
46
+    @PostMapping("/addCaseApplication")
47
+    public AjaxResult addCaseApplication(@Validated @RequestBody CaseApplication caseApplication)
48
+    {
49
+
50
+        caseApplication.setCreateBy(getUsername());
51
+        return toAjax(caseApplicationService.insertcaseApplication(caseApplication));
52
+    }
53
+
54
+    /**
55
+     * 修改立案数据
56
+     */
57
+    @PreAuthorize("@ss.hasPermi('caseManagement:list:update')")
58
+    @Log(title = "修改立案数据", businessType = BusinessType.UPDATE)
59
+    @PostMapping("/editCaseApplication")
60
+    public AjaxResult editCaseApplication(@Validated @RequestBody CaseApplication caseApplication) {
61
+
62
+        caseApplication.setUpdateBy(getUsername());
63
+        return toAjax(caseApplicationService.editCaseApplication(caseApplication));
64
+    }
65
+
66
+    /**
67
+     * 提交立案申请
68
+     */
69
+    @PreAuthorize("@ss.hasPermi('caseManagement:list:submit')")
70
+    @Log(title = "提交立案申请", businessType = BusinessType.UPDATE)
71
+    @PostMapping("/submitCaseApplication")
72
+    public AjaxResult submitCaseApplication(@Validated @RequestBody CaseApplication caseApplication) {
73
+
74
+        return toAjax(caseApplicationService.submitCaseApplication(caseApplication));
75
+    }
76
+
77
+    /**
78
+     * 删除立案数据
79
+     */
80
+    @PreAuthorize("@ss.hasPermi('caseManagement:list:delete')")
81
+    @Log(title = "删除立案数据", businessType = BusinessType.DELETE)
82
+    @PostMapping("/removeCaseApplication")
83
+    public AjaxResult removeCaseApplication(@Validated @RequestBody CaseApplication caseApplication) {
84
+
85
+        return toAjax(caseApplicationService.deletecaseApplicationByIds(caseApplication));
86
+    }
87
+
88
+    /**
89
+     * 查询立案信息
90
+     */
91
+     @PreAuthorize("@ss.hasPermi('caseManagement:list:detail')")
92
+    @PostMapping("/selectCaseApplication")
93
+    public AjaxResult selectCaseApplication(@Validated @RequestBody CaseApplication caseApplication) {
94
+        CaseApplication caseApplicationselect = caseApplicationService.selectCaseApplication(caseApplication);
95
+        return success(caseApplicationselect);
96
+    }
97
+
98
+    /**
99
+     * 立案申请导入模板下载
100
+     */
101
+    @PostMapping("/importTemplate")
102
+    public void importTemplate(HttpServletResponse response) {
103
+        ExcelUtil<CaseApplication> util = new ExcelUtil<CaseApplication>(CaseApplication.class);
104
+        util.importTemplateExcel(response, "立案申请数据");
105
+    }
106
+
107
+    @Log(title = "立案信息导入", businessType = BusinessType.IMPORT)
108
+    @PreAuthorize("@ss.hasPermi('caseManagement:list:import')")
109
+    @PostMapping("/importData")
110
+    public AjaxResult importData(MultipartFile file) throws Exception {
111
+        if(file==null){
112
+            return warn("请上传文件");
113
+        }
114
+        ExcelUtil<CaseApplication> util = new ExcelUtil<CaseApplication>(CaseApplication.class);
115
+        List<CaseApplication> caseApplicationList = util.importExcel(file.getInputStream());
116
+        String operName = getUsername();
117
+        String message = caseApplicationService.importCaseApplication(caseApplicationList, operName);
118
+        return success(message);
119
+    }
120
+
121
+    /**
122
+     * 组庭
123
+     */
124
+    @PreAuthorize("@ss.hasPermi('caseApplication:pendTral')")
125
+    @Log(title = "组庭", businessType = BusinessType.UPDATE)
126
+    @PostMapping("/pendTral")
127
+    public AjaxResult pendTral(@Validated @RequestBody CaseApplication caseApplication) {
128
+        return toAjax(caseApplicationService.pendTral(caseApplication));
129
+    }
130
+
131
+    /**
132
+     * 组庭审核
133
+     */
134
+    @PreAuthorize("@ss.hasPermi('caseManagement:list:checkgroup')")
135
+    @Log(title = "组庭审核", businessType = BusinessType.UPDATE)
136
+    @PostMapping("/pendTralCheck")
137
+    public AjaxResult pendTralCheck(@Validated @RequestBody CaseApplication caseApplication) {
138
+        return toAjax(caseApplicationService.pendTralCheck(caseApplication));
139
+    }
140
+
141
+    /**
142
+     * 组庭确认
143
+     */
144
+    @PreAuthorize("@ss.hasPermi('caseManagement:list:confirmgroup')")
145
+    @Log(title = "组庭确认", businessType = BusinessType.UPDATE)
146
+    @PostMapping("/pendTralSure")
147
+    public AjaxResult pendTralSure(@Validated @RequestBody CaseApplication caseApplication) {
148
+        return toAjax(caseApplicationService.pendTralSure(caseApplication));
149
+    }
150
+
151
+    /**
152
+     * 核验裁决书
153
+     */
154
+    @PreAuthorize("@ss.hasPermi('caseApplication:verificationArbitrateRecord')")
155
+    @Log(title = "核验裁决书", businessType = BusinessType.UPDATE)
156
+    @PostMapping("/verificationArbitrateRecord")
157
+    public AjaxResult verificationArbitrateRecord(@Validated @RequestBody CaseApplication caseApplication) {
158
+        return toAjax(caseApplicationService.verificationArbitrateRecord(caseApplication));
159
+    }
160
+
161
+    /**
162
+     * 审核裁决书
163
+     */
164
+    @PreAuthorize("@ss.hasPermi('caseApplication:checkArbitrateRecord')")
165
+    @Log(title = "审核裁决书", businessType = BusinessType.UPDATE)
166
+    @PostMapping("/checkArbitrateRecord")
167
+    public AjaxResult checkArbitrateRecord(@Validated @RequestBody CaseApplication caseApplication) {
168
+        return toAjax(caseApplicationService.checkArbitrateRecord(caseApplication));
169
+    }
170
+
171
+
172
+    /**
173
+     * 是否指派仲裁员
174
+     */
175
+    @PreAuthorize("@ss.hasPermi('caseApplication:pendingAppointArbotrar')")
176
+    @Log(title = "是否指派仲裁员", businessType = BusinessType.UPDATE)
177
+    @PostMapping("/pendingAppointArbotrar")
178
+    public AjaxResult pendingAppointArbotrar(@Validated @RequestBody CaseApplication caseApplication) {
179
+        return toAjax(caseApplicationService.pendingAppointArbotrar(caseApplication));
180
+    }
181
+
182
+    /**
183
+     * 提交立案审查
184
+     */
185
+    @PreAuthorize("@ss.hasPermi('caseManagement:list:check')")
186
+    @Log(title = "提交立案审查", businessType = BusinessType.UPDATE)
187
+    @PostMapping("/submitCaseApplicationCheck")
188
+    public AjaxResult submitCaseApplicationCheck(@Validated @RequestBody CaseApplication caseApplication) {
189
+
190
+        return toAjax(caseApplicationService.submitCaseApplicationCheck(caseApplication));
191
+    }
192
+
193
+    /**
194
+     * 确认缴费查询立案信息
195
+     */
196
+    @PreAuthorize("@ss.hasPermi('paymentManagement:list:detail')")
197
+    @PostMapping("/selectCaseApplicationConfirm")
198
+    public AjaxResult selectCaseApplicationConfirm(@Validated @RequestBody CaseApplication caseApplication) {
199
+        CaseApplication caseApplicationselect = caseApplicationService.selectCaseApplicationConfirm(caseApplication);
200
+        return success(caseApplicationselect);
201
+    }
202
+
203
+
204
+    /**
205
+     * 发送房间号短信
206
+     */
207
+    @Anonymous
208
+    @PostMapping("/sendRoomNoMessage")
209
+    public AjaxResult sendRoomNoMessage(@Validated @RequestBody SendRoomNoMessageVO messageVO) {
210
+        String result = caseApplicationService.sendRoomNoMessage(messageVO);
211
+        return success(result);
212
+    }
213
+
214
+}

+ 42
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseArbitrateController.java 查看文件

@@ -0,0 +1,42 @@
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.wisdomarbitrate.domain.ArbitrateRecord;
6
+import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
7
+import com.ruoyi.wisdomarbitrate.service.ICaseArbitrateService;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.security.access.prepost.PreAuthorize;
10
+import org.springframework.validation.annotation.Validated;
11
+import org.springframework.web.bind.annotation.*;
12
+
13
+@RestController
14
+@RequestMapping("/arbitrate")
15
+public class CaseArbitrateController extends BaseController {
16
+    @Autowired
17
+    private ICaseArbitrateService caseArbitrateService;
18
+
19
+    /**
20
+     * 审核仲裁方式
21
+     * @param caseApplication
22
+     * @param opinion   1同意,0拒绝
23
+     * @return
24
+     */
25
+    @PutMapping("/method")
26
+    @PreAuthorize("@ss.hasPermi('caseManagement:list:checkarbitrationway')")
27
+    public AjaxResult examineArbitrateMethod(@Validated @RequestBody CaseApplication caseApplication
28
+            ,Integer opinion){
29
+        return caseArbitrateService.examineArbitrateMethod(caseApplication,opinion);
30
+    }
31
+
32
+    /**
33
+     * 书面审理
34
+     * @param arbitrateRecord
35
+     * @return
36
+     */
37
+    @PostMapping("/writtenHear")
38
+    @PreAuthorize("@ss.hasPermi('caseManagement:hear')")
39
+    public AjaxResult writtenHear(@Validated @RequestBody ArbitrateRecord arbitrateRecord){
40
+        return caseArbitrateService.writtenHear(arbitrateRecord);
41
+    }
42
+}

+ 96
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java 查看文件

@@ -0,0 +1,96 @@
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.dto.CaseEvidenceDTO;
8
+import com.ruoyi.wisdomarbitrate.domain.vo.CaseEvidenceVO;
9
+import com.ruoyi.wisdomarbitrate.service.ICaseEvidenceService;
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
+
16
+import java.util.ArrayList;
17
+import java.util.List;
18
+
19
+/**
20
+ * 案件证据
21
+ */
22
+@RestController
23
+@RequestMapping("/evidence")
24
+public class CaseEvidenceController extends BaseController {
25
+    private final ICaseEvidenceService caseEvidenceService;
26
+
27
+    @Autowired
28
+    public CaseEvidenceController(ICaseEvidenceService caseEvidenceService) {
29
+        this.caseEvidenceService = caseEvidenceService;
30
+    }
31
+
32
+    /**
33
+     * 根据案件id查询案件详情
34
+     *
35
+     * @param id
36
+     * @return
37
+     */
38
+    @GetMapping("/{id}")
39
+    public AjaxResult getCaseDetailsById(@PathVariable Long id) {
40
+        String username = this.getUsername();
41
+        return caseEvidenceService.getCaseDetailsById(id, username);
42
+    }
43
+
44
+    /**
45
+     * 案件证据上传
46
+     *
47
+     * @param file      附件
48
+     * @param annexType 附件类型,立案申请书(1)、证据材料(2)、仲裁文书(3)、案件视频(4)、身份证件(5)
49
+     * @param id        案件申请id
50
+     * @return
51
+     */
52
+    @PostMapping("/upload")
53
+    public AjaxResult uploadEvidence(@RequestParam("file") MultipartFile file, Integer annexType, Long id) {
54
+        String username = this.getUsername();
55
+        Long userId = this.getUserId();
56
+        return caseEvidenceService.uploadEvidence(file, annexType, id, username, userId);
57
+    }
58
+
59
+    /**
60
+     * 查询当前用户案件列表
61
+     *
62
+     * @param identityNum
63
+     * @return
64
+     */
65
+    @GetMapping("/all")
66
+    public TableDataInfo getCaseListAll(@RequestParam(required = false) String identityNum) {
67
+        startPage();
68
+        List<CaseEvidenceVO> list = caseEvidenceService.getCaseListAll(identityNum);
69
+        if (list != null) {
70
+            return getDataTable(list);
71
+        }
72
+        return getDataTable(new ArrayList<>());
73
+    }
74
+
75
+    /**
76
+     * 证据确认
77
+     *
78
+     * @param caseApplication 案件对象
79
+     * @return 统一返回结果
80
+     */
81
+    @PutMapping("/confirm")
82
+    public AjaxResult evidenceConfirmation(@Validated @RequestBody CaseApplication caseApplication) {
83
+        return caseEvidenceService.evidenceConfirmation(caseApplication);
84
+    }
85
+
86
+    /**
87
+     * 案件质证
88
+     *
89
+     * @param caseEvidenceDTO
90
+     * @return
91
+     */
92
+    @PostMapping("/crossexami")
93
+    public AjaxResult caseCrossexamination(@Validated @RequestBody CaseEvidenceDTO caseEvidenceDTO) {
94
+        return caseEvidenceService.caseCrossexamination(caseEvidenceDTO);
95
+    }
96
+}

+ 40
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseLogRecordController.java 查看文件

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

+ 44
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CasePaymentController.java 查看文件

@@ -0,0 +1,44 @@
1
+package com.ruoyi.web.controller.wisdomarbitrate;
2
+
3
+import com.ruoyi.common.core.domain.AjaxResult;
4
+import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
5
+import com.ruoyi.wisdomarbitrate.service.ICasePaymentService;
6
+import com.ruoyi.wisdomarbitrate.domain.dto.CasePayDTO;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.security.access.prepost.PreAuthorize;
9
+import org.springframework.validation.annotation.Validated;
10
+import org.springframework.web.bind.annotation.*;
11
+
12
+/**
13
+ * 缴费支付
14
+ */
15
+@RestController
16
+@RequestMapping("/pay")
17
+public class CasePaymentController {
18
+    private final ICasePaymentService paymentService;
19
+    @Autowired
20
+    public CasePaymentController(ICasePaymentService paymentService){
21
+       this.paymentService=paymentService;
22
+    }
23
+    /**
24
+     * 案件缴费
25
+     * @param casePayDTO 缴费传入参数
26
+     * @return 统一响应结果
27
+     */
28
+    @PreAuthorize("@ss.hasPermi('caseManagement:list:pay')")
29
+    @PostMapping("/casePay")
30
+    public AjaxResult casePay(@Validated @RequestBody CasePayDTO casePayDTO) {
31
+        return paymentService.casePay(casePayDTO);
32
+    }
33
+
34
+    /**
35
+     * 缴费确认
36
+     * @param caseApplication
37
+     * @return
38
+     */
39
+    @PreAuthorize("@ss.hasPermi('paymentManagement:list:payconfirm')")
40
+    @PutMapping("/confirm")
41
+    public AjaxResult confirmPayment(@Validated @RequestBody CaseApplication caseApplication) {
42
+        return paymentService.confirmPayment(caseApplication);
43
+    }
44
+}

+ 40
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/IdentityAuthenticationController.java 查看文件

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

+ 1
- 0
ruoyi-admin/src/main/resources/alipay_private.key 查看文件

@@ -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 查看文件

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

+ 3
- 3
ruoyi-admin/src/main/resources/application-druid.yml 查看文件

@@ -6,9 +6,9 @@ spring:
6 6
         druid:
7 7
             # 主库数据源
8 8
             master:
9
-                url: jdbc:mysql://localhost:3306/ruyivue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
10
-                username: ruyivue
11
-                password: rybackproje13689
9
+                url: jdbc:mysql://121.40.189.20:3306/arbitrate?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=Asia/Shanghai&useSSL=false
10
+                username: root
11
+                password: root123456
12 12
             # 从库数据源
13 13
             slave:
14 14
                 # 从数据源开关/默认关闭

+ 43
- 5
ruoyi-admin/src/main/resources/application.yml 查看文件

@@ -9,7 +9,7 @@ ruoyi:
9 9
   # 实例演示开关
10 10
   demoEnabled: true
11 11
   # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
12
-  profile: D:/ruoyi/uploadPath
12
+  profile: /home/ruoyi/uploadPath
13 13
   # 获取ip地址开关
14 14
   addressEnabled: false
15 15
   # 验证码类型 math 数字计算 char 字符验证
@@ -18,7 +18,7 @@ ruoyi:
18 18
 # 开发环境配置
19 19
 server:
20 20
   # 服务器的HTTP端口,默认为8080
21
-  port: 8080
21
+  port: 9001
22 22
   servlet:
23 23
     # 应用的访问路径
24 24
     context-path: /
@@ -32,7 +32,6 @@ server:
32 32
       max: 800
33 33
       # Tomcat启动初始化的线程数,默认值10
34 34
       min-spare: 100
35
-
36 35
 # 日志配置
37 36
 logging:
38 37
   level:
@@ -70,9 +69,9 @@ spring:
70 69
   # redis 配置
71 70
   redis:
72 71
     # 地址
73
-    host: localhost
72
+    host: 121.40.189.20
74 73
     # 端口,默认为6379
75
-    port: 6379
74
+    port: 6389
76 75
     # 数据库索引
77 76
     database: 0
78 77
     # 密码
@@ -89,6 +88,25 @@ spring:
89 88
         max-active: 8
90 89
         # #连接池最大阻塞等待时间(使用负值表示没有限制)
91 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: hjbjava@163.com
98
+    password: BSRSSEPJWGNNVYYL
99
+    default-encoding: UTF-8
100
+    properties:
101
+      mail:
102
+        smtp:
103
+          socketFactoryClass: javax.net.ssl.SSLSocketFactory
104
+        debug: false
105
+#上上签配置参数
106
+ssq:
107
+  developerId: 1695872832013855470
108
+  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
109
+  serverHost: https://openapi.bestsign.info/openapi/v2/
92 110
 
93 111
 # token配置
94 112
 token:
@@ -129,3 +147,23 @@ xss:
129 147
   excludes: /system/notice
130 148
   # 匹配链接
131 149
   urlPatterns: /system/*,/monitor/*,/tool/*
150
+#支付相关配置
151
+elegent:
152
+  pay:
153
+    wxpay:
154
+      mchId: 1561414331
155
+      appId: wx6592a2db3f85ed25
156
+      appSecret: d9a9ff00a633cd7353a8925119063b01
157
+      mchSerialNo: 25FBDE3EFD31B03A4377EB9A4A47C517969E6620
158
+      apiV3Key: CZBK51236435wxpay435434323FFDuv3
159
+    alipay:
160
+      appId: 2021003141676135
161
+    callback:
162
+      domain: http://121.40.189.20:9001/
163
+      watch: true
164
+      cycle: 10
165
+identityAuthentication:
166
+  credentialSecretId: AKID3xfHgroY4MQHvLXUXMwIQL1UjmbBX1Tv
167
+  credentialSecretKey: INDrIXcT8YmomZBcsy0oNirnU0LTN4X7
168
+  merchantId: 0NSJ2309281116194321
169
+  privateKeyHexDecodeinfo: 4c3b311bf7b98969994e85928e069574a1e95777f24d1c510679cc3c2f460faf

+ 1
- 0
ruoyi-admin/src/main/resources/wxpay_private.key 查看文件

@@ -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=

+ 70
- 7
ruoyi-common/pom.xml 查看文件

@@ -52,19 +52,19 @@
52 52
             <groupId>org.apache.commons</groupId>
53 53
             <artifactId>commons-lang3</artifactId>
54 54
         </dependency>
55
-  
55
+
56 56
         <!-- JSON工具类 -->
57 57
         <dependency>
58 58
             <groupId>com.fasterxml.jackson.core</groupId>
59 59
             <artifactId>jackson-databind</artifactId>
60 60
         </dependency>
61
-        
61
+
62 62
         <!-- 动态数据源 -->
63
-		<dependency>
64
-			<groupId>com.baomidou</groupId>
65
-			<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
66
-			<version>3.5.2</version>
67
-		</dependency>
63
+        <dependency>
64
+            <groupId>com.baomidou</groupId>
65
+            <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
66
+            <version>3.5.2</version>
67
+        </dependency>
68 68
 
69 69
         <!-- 阿里JSON解析器 -->
70 70
         <dependency>
@@ -126,6 +126,69 @@
126 126
             <artifactId>javax.servlet-api</artifactId>
127 127
         </dependency>
128 128
 
129
+        <dependency>
130
+            <groupId>org.projectlombok</groupId>
131
+            <artifactId>lombok</artifactId>
132
+            <version>1.18.22</version>
133
+        </dependency>
134
+
135
+        <!-- 腾讯短信sdk -->
136
+        <dependency>
137
+            <groupId>com.tencentcloudapi</groupId>
138
+            <artifactId>tencentcloud-sdk-java</artifactId>
139
+            <version>3.1.876</version>
140
+        </dependency>
141
+
142
+        <dependency>
143
+            <groupId>com.tencentcloudapi</groupId>
144
+            <artifactId>tencentcloud-sdk-java-faceid</artifactId>
145
+            <version>3.1.875</version>
146
+        </dependency>
147
+        <!--用户信息解密-->
148
+        <dependency>
149
+            <groupId>cn.hutool</groupId>
150
+            <artifactId>hutool-all</artifactId>
151
+            <version>5.7.15</version>
152
+        </dependency>
153
+
154
+        <dependency>
155
+            <groupId>org.bouncycastle</groupId>
156
+            <artifactId>bcprov-jdk15to18</artifactId>
157
+            <version>1.69</version>
158
+        </dependency>
159
+
160
+        <!-- poi-tl-->
161
+        <dependency>
162
+            <groupId>com.deepoove</groupId>
163
+            <artifactId>poi-tl</artifactId>
164
+            <version>1.9.1</version>
165
+        </dependency>
166
+
167
+        <!--  发送邮件-->
168
+        <dependency>
169
+            <groupId>org.springframework.boot</groupId>
170
+            <artifactId>spring-boot-starter-mail</artifactId>
171
+            <version>3.1.4</version>
172
+        </dependency>
173
+
174
+        <dependency>
175
+            <groupId>javax.activation</groupId>
176
+            <artifactId>activation</artifactId>
177
+            <version>1.1.1</version>
178
+        </dependency>
179
+
180
+        <!-- https://mvnrepository.com/artifact/javax.mail/mail -->
181
+        <dependency>
182
+            <groupId>javax.mail</groupId>
183
+            <artifactId>mail</artifactId>
184
+            <version>1.4.7</version>
185
+        </dependency>
186
+        <dependency>
187
+            <groupId>org.apache.httpcomponents</groupId>
188
+            <artifactId>httpclient</artifactId>
189
+        </dependency>
190
+
191
+
129 192
     </dependencies>
130 193
 
131 194
 </project>

+ 13
- 0
ruoyi-common/src/main/java/com/ruoyi/common/config/EsignDemoConfig.java 查看文件

@@ -0,0 +1,13 @@
1
+package com.ruoyi.common.config;
2
+
3
+public class EsignDemoConfig {
4
+
5
+    // 应用ID
6
+    public static final String EsignAppId = "7438987614";
7
+    // 应用密钥
8
+    public static final String EsignAppSecret = "9d7844f13830931037772b9d20cf1529";
9
+    // e签宝接口调用域名(模拟环境)
10
+    public static final String EsignHost = "https://smlopenapi.esign.cn";
11
+    // e签宝接口调用域名(正式环境)
12
+    // public static final String EsignHost = "https://openapi.esign.cn";
13
+}

+ 53
- 0
ruoyi-common/src/main/java/com/ruoyi/common/constant/CaseApplicationConstants.java 查看文件

@@ -0,0 +1,53 @@
1
+package com.ruoyi.common.constant;
2
+/**
3
+ * 立案申请案件状态
4
+ *
5
+ */
6
+public class CaseApplicationConstants {
7
+    /** 立案申请 */
8
+    public static final int CASE_APPLICATION = 0;
9
+    /** 待立案审查 */
10
+    public static final int CASE_CHECK = 1;
11
+    /** 待缴费 */
12
+    public static final int PENDING_PAYMENT = 2;
13
+    /** 待缴费确认  */
14
+    public static final int PENDING_PAYMENT_CONFIRM = 3;
15
+    /** 待案件质证 */
16
+    public static final int CASE_CROSSEXAMI = 4;
17
+
18
+    /** 待组庭  */
19
+    public static final int PENDING_TRIAL = 26;
20
+    /** 待组庭审核  */
21
+    public static final int CONFIRMDED_PENDING_TRIAL_SUBMMIT = 5;
22
+    /** 待组庭确定   */
23
+    public static final int CONFIRMDED_PENDING_TRIAL = 6;
24
+
25
+    /** 待审核仲裁方式 */
26
+    public static final int CHECK_ARBITRATION_METHOD = 7;
27
+    /** 待开庭审理 */
28
+    public static final int PENDING_OPENCOURT_HEAR = 8;
29
+    /** 待书面审理 */
30
+    public static final int PENDING_WRIITEN_HEAR = 9;
31
+    /** 待生成仲裁文书  */
32
+    public static final int GENERATED_ARBITRATION = 10;
33
+    /**待核验仲裁文书*/
34
+    public static final int VERPRIF_ARBITRATION = 11;
35
+    /**待审核仲裁文书*/
36
+    public static final int CHECK_ARBITRATION = 12;
37
+    /**待仲裁文书签名*/
38
+    public static final int SIGN_ARBITRATION = 13;
39
+    /** 待仲裁文书用印 */
40
+    public static final int     ARBITRATED_SEAL = 14;
41
+    /** 待仲裁文书送达 */
42
+    public static final int ARBITRATION_DELIVERY = 15;
43
+    /** 待案件归档*/
44
+    public static final int CASE_FILING = 16;
45
+    /** 已归档*/
46
+    public static final int CASE_ARCHIVED = 17;
47
+
48
+
49
+
50
+
51
+
52
+
53
+}

+ 371
- 0
ruoyi-common/src/main/java/com/ruoyi/common/constant/EsignEncryption.java 查看文件

@@ -0,0 +1,371 @@
1
+/*
2
+ *
3
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
4
+ * the License. You may obtain a copy of the License at
5
+ *
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ *
8
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
9
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
10
+ * specific language governing permissions and limitations under the License.
11
+ */
12
+package com.ruoyi.common.constant;
13
+import com.ruoyi.common.exception.EsignDemoException;
14
+import org.apache.commons.codec.binary.Base64;
15
+import org.apache.http.message.BasicNameValuePair;
16
+
17
+import javax.crypto.Mac;
18
+import javax.crypto.spec.SecretKeySpec;
19
+import java.io.UnsupportedEncodingException;
20
+import java.security.InvalidKeyException;
21
+import java.security.MessageDigest;
22
+import java.security.NoSuchAlgorithmException;
23
+import java.text.Collator;
24
+import java.text.MessageFormat;
25
+import java.util.*;
26
+
27
+/**
28
+ * @description 请求数据通用处理类
29
+ * @author 澄泓
30
+ * @date 2020年10月22日 下午14:25:31
31
+ * @since JDK1.7
32
+ */
33
+public class EsignEncryption {
34
+
35
+    /**
36
+     * 不允许外部创建实例
37
+     */
38
+    private EsignEncryption(){}
39
+
40
+    /**
41
+     * 拼接待签名字符串
42
+     * @param httpMethod
43
+     * @param url
44
+     * @return
45
+     */
46
+    public static String appendSignDataString(String httpMethod, String contentMd5,String accept,String contentType,String headers,String date, String url) throws EsignDemoException {
47
+        StringBuffer sb = new StringBuffer();
48
+        sb.append(httpMethod).append("\n").append(accept).append("\n").append(contentMd5).append("\n")
49
+                .append(contentType).append("\n");
50
+
51
+        if ("".equals(date) || date == null) {
52
+            sb.append("\n");
53
+        } else {
54
+            sb.append(date).append("\n");
55
+        }
56
+        if ("".equals(headers) || headers == null) {
57
+            sb.append(url);
58
+        } else {
59
+            sb.append(headers).append("\n").append(url);
60
+        }
61
+        return new String(sb);
62
+    }
63
+
64
+    /***
65
+     *  Content-MD5的计算方法
66
+     * @param str 待计算的消息
67
+     * @return MD5计算后摘要值的Base64编码(ContentMD5)
68
+     * @throws EsignDemoException 加密过程中的异常信息
69
+     */
70
+    public static String doContentMD5(String str) throws EsignDemoException {
71
+        byte[] md5Bytes = null;
72
+        MessageDigest md5 = null;
73
+        String contentMD5 = null;
74
+        try {
75
+            md5 = MessageDigest.getInstance("MD5");
76
+            // 计算md5函数
77
+            md5.update(str.getBytes("UTF-8"));
78
+            // 获取文件MD5的二进制数组(128位)
79
+            md5Bytes = md5.digest();
80
+            // 把MD5摘要后的二进制数组md5Bytes使用Base64进行编码(而不是对32位的16进制字符串进行编码)
81
+            contentMD5 = Base64.encodeBase64String(md5Bytes);
82
+
83
+        } catch (NoSuchAlgorithmException e) {
84
+            EsignDemoException ex = new EsignDemoException("不支持此算法",e);
85
+            ex.initCause(e);
86
+            throw ex;
87
+        } catch (UnsupportedEncodingException e) {
88
+            e.printStackTrace();
89
+        }
90
+        return contentMD5;
91
+    }
92
+
93
+    /***
94
+     * 计算请求签名值-HmacSHA256摘要
95
+     * @param message 待签名字符串
96
+     * @param secret  密钥APP KEY
97
+     * @return reqSignature HmacSHA256计算后摘要值的Base64编码
98
+     * @throws EsignDemoException 加密过程中的异常信息
99
+     */
100
+    public static String doSignatureBase64(String message, String secret) throws EsignDemoException {
101
+        String algorithm = "HmacSHA256";
102
+        Mac hmacSha256;
103
+        String digestBase64 = null;
104
+        try {
105
+            hmacSha256 = Mac.getInstance(algorithm);
106
+            byte[] keyBytes = secret.getBytes("UTF-8");
107
+            byte[] messageBytes = message.getBytes("UTF-8");
108
+            hmacSha256.init(new SecretKeySpec(keyBytes, 0, keyBytes.length, algorithm));
109
+            // 使用HmacSHA256对二进制数据消息Bytes计算摘要
110
+            byte[] digestBytes = hmacSha256.doFinal(messageBytes);
111
+            // 把摘要后的结果digestBytes使用Base64进行编码
112
+            digestBase64 = Base64.encodeBase64String(digestBytes);
113
+        } catch (NoSuchAlgorithmException e) {
114
+            EsignDemoException ex = new EsignDemoException("不支持此算法",e);
115
+            ex.initCause(e);
116
+            throw ex;
117
+        } catch (InvalidKeyException e) {
118
+            EsignDemoException ex = new EsignDemoException("无效的密钥规范",e);
119
+            ex.initCause(e);
120
+            throw ex;
121
+        } catch (UnsupportedEncodingException e) {
122
+            e.printStackTrace();
123
+        }
124
+        return digestBase64;
125
+    }
126
+
127
+    /**
128
+     * 获取时间戳
129
+     * @return
130
+     */
131
+    public static String timeStamp() {
132
+        long timeStamp = System.currentTimeMillis();
133
+        return String.valueOf(timeStamp);
134
+    }
135
+
136
+    /**
137
+     * byte字节数组转换成字符串
138
+     * @param b
139
+     * @return
140
+     */
141
+    public static String byteArrayToHexString(byte[] b) {
142
+        StringBuilder hs = new StringBuilder();
143
+        String stmp;
144
+        for (int n = 0; b != null && n < b.length; n++) {
145
+            stmp = Integer.toHexString(b[n] & 0XFF);
146
+            if (stmp.length() == 1)
147
+                hs.append('0');
148
+            hs.append(stmp);
149
+        }
150
+        return hs.toString().toLowerCase();
151
+    }
152
+
153
+    /**
154
+     * hash散列加密算法
155
+     * @return
156
+     */
157
+    public static String Hmac_SHA256(String message,String key) throws EsignDemoException {
158
+        byte[] rawHmac=null;
159
+        try {
160
+            SecretKeySpec sk = new SecretKeySpec(key.getBytes(), "HmacSHA256");
161
+            Mac mac = Mac.getInstance("HmacSHA256");
162
+            mac.init(sk);
163
+            rawHmac = mac.doFinal(message.getBytes());
164
+        }catch (InvalidKeyException e){
165
+            EsignDemoException ex = new EsignDemoException("无效的密钥规范",e);
166
+            ex.initCause(e);
167
+            throw ex;
168
+        } catch (NoSuchAlgorithmException e) {
169
+            EsignDemoException ex = new EsignDemoException("不支持此算法",e);
170
+            ex.initCause(e);
171
+            throw ex;
172
+        }catch (Exception e){
173
+            EsignDemoException ex = new EsignDemoException("hash散列加密算法报错",e);
174
+            ex.initCause(e);
175
+            throw ex;
176
+        }finally {
177
+            return byteArrayToHexString(rawHmac);
178
+        }
179
+
180
+    }
181
+
182
+    /**
183
+     * MD5加密32位
184
+     */
185
+    public static String MD5Digest(String text) throws EsignDemoException {
186
+        byte[] digest=null;
187
+        try {
188
+            MessageDigest md5 = MessageDigest.getInstance("MD5");
189
+            md5.update(text.getBytes());
190
+            digest = md5.digest();
191
+        }catch (NoSuchAlgorithmException e){
192
+            EsignDemoException ex = new EsignDemoException("不支持此算法",e);
193
+            ex.initCause(e);
194
+            throw ex;
195
+        }finally {
196
+            return byteArrayToHexString(digest);
197
+        }
198
+
199
+    }
200
+
201
+    public static void formDataSort(List<BasicNameValuePair> param) {
202
+        Collections.sort(param, new Comparator<BasicNameValuePair>() {
203
+            @Override
204
+            public int compare(BasicNameValuePair o1, BasicNameValuePair o2) {
205
+                Comparator<Object> com = Collator.getInstance(Locale.CHINA);
206
+                return com.compare(o1.getName(), o2.getName());
207
+            }
208
+        });
209
+    }
210
+
211
+    /***
212
+     * 字符串是否为空(含空格校验)
213
+     * @param str
214
+     * @return
215
+     */
216
+    public static boolean isBlank(String str) {
217
+        if (null == str || 0 == str.length()) {
218
+            return true;
219
+        }
220
+
221
+        int strLen = str.length();
222
+
223
+        for (int i = 0; i < strLen; i++) {
224
+            if (!Character.isWhitespace(str.charAt(i))) {
225
+                return false;
226
+            }
227
+        }
228
+        return true;
229
+    }
230
+
231
+
232
+    /***
233
+     * 对请求URL中的Query参数按照字段名的 ASCII 码从小到大排序(字典排序)
234
+     *
235
+     * @param apiUrl
236
+     * @return 排序后的API接口地址
237
+     * @throws Exception
238
+     */
239
+    public static String sortApiUrl(String apiUrl) throws EsignDemoException {
240
+
241
+        if (!apiUrl.contains("?")) {
242
+            return apiUrl;
243
+        }
244
+
245
+        int queryIndex = apiUrl.indexOf("?");
246
+        String apiUrlPath =apiUrl.substring(0,queryIndex+1);
247
+        String apiUrlQuery = apiUrl.substring(queryIndex+1);
248
+        //apiUrlQuery为空时返回
249
+        if(isBlank(apiUrlQuery)){
250
+            return apiUrl.substring(0,apiUrl.length()-1);
251
+             }
252
+        // 请求URL中Query参数转成Map
253
+        Map<Object, Object> queryParamsMap = new HashMap<Object, Object>();
254
+        String[] params = apiUrlQuery.split("&");
255
+        for (String str : params) {
256
+            int index = str.indexOf("=");
257
+            String key = str.substring(0, index);
258
+            String value = str.substring(index + 1);
259
+            if (queryParamsMap.containsKey(key)) {
260
+                String msg = MessageFormat.format("请求URL中的Query参数的{0}重复", key);
261
+                throw new EsignDemoException(msg);
262
+            }
263
+            queryParamsMap.put(key, value);
264
+        }
265
+
266
+        ArrayList<String> queryMapKeys = new ArrayList<String>();
267
+        for (Map.Entry<Object, Object> entry : queryParamsMap.entrySet()) {
268
+            queryMapKeys.add((String) entry.getKey());
269
+        }
270
+        // 按照字段名的 ASCII 码从小到大排序(字典排序)
271
+        Collections.sort(queryMapKeys, new Comparator<String>() {
272
+            @Override
273
+            public int compare(String o1, String o2) {
274
+                return (o1.compareToIgnoreCase(o2) == 0 ? -o1.compareTo(o2) : o1.compareToIgnoreCase(o2));
275
+            }
276
+        });
277
+
278
+        StringBuffer queryString = new StringBuffer();
279
+        // 构造Query参数键值对值对的格式
280
+        for (int i = 0; i < queryMapKeys.size(); i++) {
281
+            String key = queryMapKeys.get(i);
282
+            String value = (String) queryParamsMap.get(key);
283
+            queryString.append(key);
284
+            queryString.append("=");
285
+            queryString.append(value);
286
+            queryString.append("&");
287
+        }
288
+        if (queryString.length() > 0) {
289
+            queryString = queryString.deleteCharAt(queryString.length() - 1);
290
+        }
291
+
292
+        // Query参数排序后的接口请求地址
293
+        StringBuffer sortApiUrl = new StringBuffer();
294
+        sortApiUrl.append(apiUrlPath);
295
+        sortApiUrl.append(queryString.toString());
296
+        return sortApiUrl.toString();
297
+    }
298
+
299
+    /**
300
+     *获取query
301
+     * @param apiUrl
302
+     * @return
303
+     * @throws EsignDemoException
304
+     */
305
+    public static ArrayList<BasicNameValuePair> getQuery(String apiUrl) throws EsignDemoException {
306
+        ArrayList<BasicNameValuePair> BasicNameValuePairList = new ArrayList<>();
307
+
308
+        if (!apiUrl.contains("?")) {
309
+            return BasicNameValuePairList;
310
+        }
311
+
312
+        int queryIndex = apiUrl.indexOf("\\?");
313
+        String apiUrlQuery = apiUrl.substring(queryIndex,apiUrl.length());
314
+
315
+        // 请求URL中Query参数转成Map
316
+        Map<Object, Object> queryParamsMap = new HashMap<Object, Object>();
317
+        String[] params = apiUrlQuery.split("&");
318
+        for (String str : params) {
319
+            int index = str.indexOf("=");
320
+            String key = str.substring(0, index);
321
+            String value = str.substring(index + 1);
322
+            if (queryParamsMap.containsKey(key)) {
323
+                String msg = MessageFormat.format("请求URL中的Query参数的{0}重复", key);
324
+                throw new EsignDemoException(msg);
325
+            }
326
+            BasicNameValuePairList.add(new BasicNameValuePair(key,value));
327
+            queryParamsMap.put(key, value);
328
+        }
329
+        return BasicNameValuePairList;
330
+    }
331
+    /**
332
+     *
333
+     */
334
+    public static boolean callBackCheck(String timestamp,String requestQuery,String body,String key,String signature){
335
+        String algorithm="HmacSHA256";
336
+        String encoding="UTF-8";
337
+        Mac mac = null;
338
+        try {
339
+            String data = timestamp + requestQuery + body;
340
+            mac = Mac.getInstance(algorithm);
341
+            SecretKeySpec secretKey = new SecretKeySpec(key.getBytes(encoding), algorithm);
342
+            mac.init(secretKey);
343
+            mac.update(data.getBytes(encoding));
344
+        } catch (NoSuchAlgorithmException | InvalidKeyException | UnsupportedEncodingException e) {
345
+            e.printStackTrace();
346
+            System.out.println("获取Signature签名信息异常:" + e.getMessage());
347
+            return false;
348
+        }
349
+        return byte2hex(mac.doFinal()).equalsIgnoreCase(signature);
350
+    }
351
+
352
+    /***
353
+     * 将byte[]转成16进制字符串
354
+     *
355
+     * @param data
356
+     *
357
+     * @return 16进制字符串
358
+     */
359
+    public static String byte2hex(byte[] data) {
360
+        StringBuilder hash = new StringBuilder();
361
+        String stmp;
362
+        for (int n = 0; data != null && n < data.length; n++) {
363
+            stmp = Integer.toHexString(data[n] & 0XFF);
364
+            if (stmp.length() == 1)
365
+                hash.append('0');
366
+            hash.append(stmp);
367
+        }
368
+        return hash.toString();
369
+    }
370
+
371
+}

+ 26
- 0
ruoyi-common/src/main/java/com/ruoyi/common/constant/EsignHeaderConstant.java 查看文件

@@ -0,0 +1,26 @@
1
+package com.ruoyi.common.constant;
2
+/**
3
+ * @description  头部信息常量
4
+ * @author  澄泓
5
+ * @date  2020/10/22 15:05
6
+ * @version JDK1.7
7
+ */
8
+public enum EsignHeaderConstant {
9
+    ACCEPT("*/*"),
10
+    DATE(""),
11
+    HEADERS( ""),
12
+    CONTENTTYPE_FORMDATA("application/x-www-form-urlencoded"),
13
+    CONTENTTYPE_JSON("application/json; charset=UTF-8"),
14
+    CONTENTTYPE_PDF("application/pdf"),
15
+    CONTENTTYPE_STREAM("application/octet-stream"),
16
+    AUTHMODE("Signature");
17
+
18
+    private String value;
19
+    private EsignHeaderConstant(String value) {
20
+        this.value=value;
21
+    }
22
+
23
+    public String VALUE(){
24
+        return this.value;
25
+    }
26
+}

+ 486
- 0
ruoyi-common/src/main/java/com/ruoyi/common/constant/EsignHttpCfgHelper.java 查看文件

@@ -0,0 +1,486 @@
1
+/*
2
+ *
3
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
4
+ * the License. You may obtain a copy of the License at
5
+ *
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ *
8
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
9
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
10
+ * specific language governing permissions and limitations under the License.
11
+ */
12
+package com.ruoyi.common.constant;
13
+import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
14
+import com.ruoyi.common.enums.EsignRequestType;
15
+import com.ruoyi.common.exception.EsignDemoException;
16
+import org.apache.http.*;
17
+import org.apache.http.auth.AuthScope;
18
+import org.apache.http.auth.UsernamePasswordCredentials;
19
+import org.apache.http.client.ClientProtocolException;
20
+import org.apache.http.client.CredentialsProvider;
21
+import org.apache.http.client.HttpRequestRetryHandler;
22
+import org.apache.http.client.config.RequestConfig;
23
+import org.apache.http.client.entity.UrlEncodedFormEntity;
24
+import org.apache.http.client.methods.CloseableHttpResponse;
25
+import org.apache.http.client.methods.HttpRequestBase;
26
+import org.apache.http.client.protocol.HttpClientContext;
27
+import org.apache.http.client.utils.URIBuilder;
28
+import org.apache.http.config.Registry;
29
+import org.apache.http.config.RegistryBuilder;
30
+import org.apache.http.conn.ConnectTimeoutException;
31
+import org.apache.http.conn.socket.ConnectionSocketFactory;
32
+import org.apache.http.conn.socket.LayeredConnectionSocketFactory;
33
+import org.apache.http.conn.socket.PlainConnectionSocketFactory;
34
+import org.apache.http.conn.ssl.NoopHostnameVerifier;
35
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
36
+import org.apache.http.entity.ByteArrayEntity;
37
+import org.apache.http.entity.ContentType;
38
+import org.apache.http.entity.StringEntity;
39
+import org.apache.http.impl.client.BasicCredentialsProvider;
40
+import org.apache.http.impl.client.CloseableHttpClient;
41
+import org.apache.http.impl.client.HttpClientBuilder;
42
+import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
43
+import org.apache.http.message.BasicNameValuePair;
44
+import org.apache.http.protocol.HttpContext;
45
+import org.apache.http.util.EntityUtils;
46
+import org.slf4j.Logger;
47
+import org.slf4j.LoggerFactory;
48
+
49
+import javax.net.ssl.*;
50
+import java.io.IOException;
51
+import java.io.InterruptedIOException;
52
+import java.net.UnknownHostException;
53
+import java.security.cert.CertificateException;
54
+import java.security.cert.X509Certificate;
55
+import java.text.MessageFormat;
56
+import java.util.ArrayList;
57
+import java.util.Arrays;
58
+import java.util.List;
59
+import java.util.Map;
60
+
61
+/**
62
+ * @description Http请求 辅助类
63
+ * @author 澄泓
64
+ * @since JDK1.7
65
+ */
66
+public class EsignHttpCfgHelper {
67
+
68
+	private static Logger LOGGER = LoggerFactory.getLogger(EsignHttpCfgHelper.class);
69
+	/**
70
+	 * 超时时间,默认15000毫秒
71
+	 */
72
+	private static int MAX_TIMEOUT = 15000;
73
+	/**
74
+	 * 请求池最大连接数,默认100个
75
+	 */
76
+	private static  int MAX_TOTAL=100;
77
+	/**
78
+	 * 单域名最大的连接数,默认50个
79
+	 */
80
+	private static  int ROUTE_MAX_TOTAL=50;
81
+	/**
82
+	 * 请求失败重试次数,默认3次
83
+	 */
84
+	private static   int MAX_RETRY = 3;
85
+	/**
86
+	 * 是否需要域名校验,默认不需要校验
87
+	 */
88
+	private static boolean SSL_VERIFY=false;
89
+
90
+	/**
91
+	 * 正向代理IP
92
+	 */
93
+	private static String PROXY_IP;
94
+	/**
95
+	 * 正向代理端口,默认8888
96
+	 */
97
+	private static int PROXY_PORT=8888;
98
+	/**
99
+	 * 代理协议,默认http
100
+	 */
101
+	private static String PROXY_AGREEMENT="http";
102
+
103
+	/**
104
+	 * 是否开启代理,默认false
105
+	 */
106
+	private static boolean OPEN_PROXY=false;
107
+
108
+	/**
109
+	 * 代理服务器用户名
110
+	 */
111
+	private static String PROXY_USERNAME="";
112
+
113
+	/**
114
+	 * 代理服务器密码
115
+	 */
116
+	private static String PROXY_PASSWORD="";
117
+
118
+
119
+	private static PoolingHttpClientConnectionManager connMgr; //连接池
120
+	private static HttpRequestRetryHandler retryHandler; //重试机制
121
+
122
+	private static CloseableHttpClient httpClient=null;
123
+
124
+	public static int getMaxTimeout() {
125
+		return MAX_TIMEOUT;
126
+	}
127
+
128
+	public static void setMaxTimeout(int maxTimeout) {
129
+		MAX_TIMEOUT = maxTimeout;
130
+	}
131
+
132
+	public static int getMaxTotal() {
133
+		return MAX_TOTAL;
134
+	}
135
+
136
+	public static void setMaxTotal(int maxTotal) {
137
+		MAX_TOTAL = maxTotal;
138
+	}
139
+
140
+	public static int getRouteMaxTotal() {
141
+		return ROUTE_MAX_TOTAL;
142
+	}
143
+
144
+	public static void setRouteMaxTotal(int routeMaxTotal) {
145
+		ROUTE_MAX_TOTAL = routeMaxTotal;
146
+	}
147
+
148
+	public static int getMaxRetry() {
149
+		return MAX_RETRY;
150
+	}
151
+
152
+	public static void setMaxRetry(int maxRetry) {
153
+		MAX_RETRY = maxRetry;
154
+	}
155
+
156
+	public static boolean isSslVerify() {
157
+		return SSL_VERIFY;
158
+	}
159
+
160
+	public static void setSslVerify(boolean sslVerify) {
161
+		SSL_VERIFY = sslVerify;
162
+	}
163
+
164
+	public static String getProxyIp() {
165
+		return PROXY_IP;
166
+	}
167
+
168
+	public static void setProxyIp(String proxyIp) {
169
+		PROXY_IP = proxyIp;
170
+	}
171
+
172
+	public static int getProxyPort() {
173
+		return PROXY_PORT;
174
+	}
175
+
176
+	public static void setProxyPort(int proxyPort) {
177
+		PROXY_PORT = proxyPort;
178
+	}
179
+
180
+	public static String getProxyAgreement() {
181
+		return PROXY_AGREEMENT;
182
+	}
183
+
184
+	public static void setProxyAgreement(String proxyAgreement) {
185
+		PROXY_AGREEMENT = proxyAgreement;
186
+	}
187
+
188
+	public static boolean getOpenProxy() {
189
+		return OPEN_PROXY;
190
+	}
191
+
192
+	public static void setOpenProxy(boolean openProxy) {
193
+		OPEN_PROXY = openProxy;
194
+	}
195
+
196
+	public static String getProxyUsername() {
197
+		return PROXY_USERNAME;
198
+	}
199
+
200
+	public static void setProxyUserame(String proxyUsername) {
201
+		PROXY_USERNAME = proxyUsername;
202
+	}
203
+
204
+	public static String getProxyPassword() {
205
+		return PROXY_PASSWORD;
206
+	}
207
+
208
+	public static void setProxyPassword(String proxyPassword) {
209
+		PROXY_PASSWORD = proxyPassword;
210
+	}
211
+
212
+
213
+
214
+
215
+	/**
216
+	 * 不允许外部创建实例
217
+	 */
218
+	private EsignHttpCfgHelper() {
219
+	}
220
+
221
+	//------------------------------公有方法start--------------------------------------------
222
+
223
+
224
+	/**
225
+	 * @description 发起HTTP / HTTPS 请求
226
+	 *
227
+	 * @param reqType
228
+	 * 			{@link EsignRequestType} 请求类型  GET、 POST 、 DELETE 、 PUT
229
+	 * @param httpUrl
230
+	 * 			{@link String} 请求目标地址
231
+	 * @param headers
232
+	 * 			{@link Map} 请求头
233
+	 * @param param
234
+	 * 			{@link Object} 参数
235
+	 * @return
236
+	 * @throws EsignDemoException
237
+	 * @author 澄泓
238
+	 */
239
+	public static EsignHttpResponse sendHttp(EsignRequestType reqType, String httpUrl, Map<String, String> headers, Object param, boolean debug)
240
+			throws EsignDemoException {
241
+		HttpRequestBase reqBase=null;
242
+		if(httpUrl.startsWith("http")){
243
+			reqBase=reqType.getHttpType(httpUrl);
244
+		}else{
245
+			throw new EsignDemoException("请求url地址格式错误");
246
+		}
247
+		if(debug){
248
+			LOGGER.info("请求头:{}",headers+"\n");
249
+			LOGGER.info("请求参数\n{}", param+"\n");
250
+			LOGGER.info("请求地址\n:{}\n请求方式\n:{}",reqBase.getURI(),reqType+"\n");
251
+		}
252
+		//请求方法不是GET或者DELETE时传入body体,否则不传入。
253
+		String[] methods = {"DELETE", "GET"};
254
+		if(param instanceof String&&Arrays.binarySearch(methods, reqType.name())<0){//POST或者PUT请求
255
+			((HttpEntityEnclosingRequest) reqBase).setEntity(
256
+					new StringEntity(String.valueOf(param), ContentType.create("application/json", "UTF-8")));
257
+		}
258
+		//参数时字节流数组
259
+		else if(param instanceof byte[]) {
260
+			reqBase=reqType.getHttpType(httpUrl);
261
+			byte[] paramBytes = (byte[])param;
262
+			((HttpEntityEnclosingRequest) reqBase).setEntity(new ByteArrayEntity(paramBytes));
263
+		}
264
+		//参数是form表单时
265
+		else if(param instanceof List){
266
+			((HttpEntityEnclosingRequest) reqBase).setEntity(new UrlEncodedFormEntity((Iterable<? extends NameValuePair>) param));
267
+		}
268
+		httpClient = getHttpClient();
269
+		config(reqBase);
270
+
271
+		//设置请求头
272
+		if(headers != null &&headers.size()>0) {
273
+			for(Map.Entry<String, String> entry :headers.entrySet()) {
274
+				reqBase.setHeader(entry.getKey(), entry.getValue());
275
+			}
276
+		}
277
+		//响应对象
278
+		CloseableHttpResponse res = null;
279
+		//响应内容
280
+		String resCtx = null;
281
+		int status;
282
+		EsignHttpResponse esignHttpResponse = new EsignHttpResponse();
283
+		try {
284
+			//执行请求
285
+			res = httpClient.execute(reqBase);
286
+			status=res.getStatusLine().getStatusCode();
287
+
288
+			//获取请求响应对象和响应entity
289
+			HttpEntity httpEntity = res.getEntity();
290
+			if(httpEntity != null) {
291
+				resCtx = EntityUtils.toString(httpEntity,"utf-8");
292
+			}
293
+			if(debug) {
294
+				LOGGER.info("响应\n{}", resCtx + "\n");
295
+				LOGGER.info("----------------------------end------------------------");
296
+			}
297
+		} catch (NoHttpResponseException e) {
298
+			throw new EsignDemoException("服务器丢失了",e);
299
+		} catch (SSLHandshakeException e){
300
+			String msg = MessageFormat.format("SSL握手异常", e);
301
+			EsignDemoException ex = new EsignDemoException(msg, e);
302
+			throw ex;
303
+		} catch (UnknownHostException e){
304
+			EsignDemoException ex = new EsignDemoException("服务器找不到", e);
305
+			ex.initCause(e);
306
+			throw ex;
307
+		} catch(ConnectTimeoutException e){
308
+			EsignDemoException ex = new EsignDemoException("连接超时", e);
309
+			ex.initCause(e);
310
+			throw ex;
311
+		} catch(SSLException e){
312
+			EsignDemoException ex = new EsignDemoException("SSL异常",e);
313
+			ex.initCause(e);
314
+			throw ex;
315
+		} catch (ClientProtocolException e) {
316
+			EsignDemoException ex = new EsignDemoException("请求头异常",e);
317
+			ex.initCause(e);
318
+			throw ex;
319
+		} catch (IOException e) {
320
+			EsignDemoException ex = new EsignDemoException("网络请求失败",e);
321
+			ex.initCause(e);
322
+			throw ex;
323
+		} finally {
324
+			if(res != null) {
325
+				try {
326
+					res.close();
327
+				} catch (IOException e) {
328
+					EsignDemoException ex = new EsignDemoException("--->>关闭请求响应失败",e);
329
+					ex.initCause(e);
330
+					throw ex;
331
+				}
332
+			}
333
+		}
334
+		esignHttpResponse.setStatus(status);
335
+		esignHttpResponse.setBody(resCtx);
336
+		return esignHttpResponse;
337
+	}
338
+	//------------------------------公有方法end----------------------------------------------
339
+
340
+	//------------------------------私有方法start--------------------------------------------
341
+
342
+	/**
343
+	 * @description 请求头和超时时间配置
344
+	 *
345
+	 * @param httpReqBase
346
+	 * @author 澄泓
347
+	 */
348
+	private static void config(HttpRequestBase httpReqBase) {
349
+		// 配置请求的超时设置
350
+		RequestConfig.Builder builder = RequestConfig.custom()
351
+				.setConnectionRequestTimeout(MAX_TIMEOUT)
352
+				.setConnectTimeout(MAX_TIMEOUT)
353
+				.setSocketTimeout(MAX_TIMEOUT);
354
+		if(OPEN_PROXY){
355
+			HttpHost proxy=new HttpHost(PROXY_IP,PROXY_PORT,PROXY_AGREEMENT);
356
+			builder.setProxy(proxy);
357
+		}
358
+		RequestConfig requestConfig = builder.build();
359
+		httpReqBase.setConfig(requestConfig);
360
+	}
361
+
362
+	/**
363
+	 * @description 连接池配置
364
+	 *
365
+	 * @return
366
+	 * @author 澄泓
367
+	 */
368
+	private static void cfgPoolMgr() throws EsignDemoException {
369
+		ConnectionSocketFactory plainsf = PlainConnectionSocketFactory.getSocketFactory();
370
+		LayeredConnectionSocketFactory sslsf = SSLConnectionSocketFactory.getSocketFactory();
371
+		if(!SSL_VERIFY){
372
+            sslsf=sslConnectionSocketFactory();
373
+        }
374
+
375
+		Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create()
376
+				.register("http", plainsf)
377
+				.register("https", sslsf)
378
+				.build();
379
+
380
+		//连接池管理器
381
+		connMgr = new PoolingHttpClientConnectionManager(registry);
382
+		//请求池最大连接数
383
+		connMgr.setMaxTotal(MAX_TOTAL);
384
+		//但域名最大的连接数
385
+		connMgr.setDefaultMaxPerRoute(ROUTE_MAX_TOTAL);
386
+	}
387
+
388
+
389
+
390
+
391
+	/**
392
+	 * @description 设置重试机制
393
+	 *
394
+	 * @author 澄泓
395
+	 */
396
+	private static void cfgRetryHandler() {
397
+		retryHandler = new HttpRequestRetryHandler() {
398
+
399
+			@Override
400
+			public boolean retryRequest(IOException e, int excCount, HttpContext ctx) {
401
+				//超过最大重试次数,就放弃
402
+				if(excCount > MAX_RETRY) {
403
+					return false;
404
+				}
405
+				//服务器丢掉了链接,就重试
406
+				if(e instanceof NoHttpResponseException) {
407
+					return true;
408
+				}
409
+				//不重试SSL握手异常
410
+				if(e instanceof SSLHandshakeException) {
411
+					return false;
412
+				}
413
+				//中断
414
+				if(e instanceof InterruptedIOException) {
415
+					return false;
416
+				}
417
+				//目标服务器不可达
418
+				if(e instanceof UnknownHostException) {
419
+					return false;
420
+				}
421
+				//连接超时
422
+				//SSL异常
423
+				if(e instanceof SSLException) {
424
+					return false;
425
+				}
426
+
427
+				HttpClientContext clientCtx = HttpClientContext.adapt(ctx);
428
+				HttpRequest req = clientCtx.getRequest();
429
+				//如果是幂等请求,就再次尝试
430
+				if(!(req instanceof HttpEntityEnclosingRequest)) {
431
+					return true;
432
+				}
433
+				return false;
434
+			}
435
+		};
436
+	}
437
+
438
+    /**
439
+     * 忽略域名校验
440
+     */
441
+    private static SSLConnectionSocketFactory sslConnectionSocketFactory() throws EsignDemoException {
442
+        try {
443
+            SSLContext ctx = SSLContext.getInstance("TLS");    // 创建一个上下文(此处指定的协议类型似乎不是重点)
444
+            X509TrustManager tm = new X509TrustManager() {     // 创建一个跳过SSL证书的策略
445
+                public X509Certificate[] getAcceptedIssuers() {
446
+                    return null;
447
+                }
448
+
449
+                public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
450
+                }
451
+
452
+                public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
453
+                }
454
+            };
455
+            ctx.init(null, new TrustManager[] { tm }, null);    // 使用上面的策略初始化上下文
456
+            return new SSLConnectionSocketFactory(ctx, new String[] { "SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2" }, null, NoopHostnameVerifier.INSTANCE);
457
+        }catch (Exception e){
458
+            EsignDemoException ex = new EsignDemoException("忽略域名校验失败",e);
459
+            ex.initCause(e);
460
+            throw ex;
461
+        }
462
+
463
+    }
464
+
465
+	/**
466
+	 * @description 获取单例HttpClient
467
+	 *
468
+	 * @return
469
+	 * @author 澄泓
470
+	 */
471
+	private static synchronized CloseableHttpClient getHttpClient() throws EsignDemoException {
472
+		if(httpClient==null) {
473
+			CredentialsProvider credsProvider = new BasicCredentialsProvider();
474
+			credsProvider.setCredentials(new AuthScope(PROXY_IP,PROXY_PORT),new UsernamePasswordCredentials(PROXY_USERNAME, PROXY_PASSWORD));
475
+			cfgPoolMgr();
476
+			cfgRetryHandler();
477
+            HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
478
+            httpClient =  httpClientBuilder.setDefaultCredentialsProvider(credsProvider).setConnectionManager(connMgr).setRetryHandler(retryHandler).build();
479
+		}
480
+		return httpClient;
481
+
482
+	}
483
+	//------------------------------私有方法end----------------------------------------------
484
+
485
+
486
+}

+ 284
- 0
ruoyi-common/src/main/java/com/ruoyi/common/constant/FileTransformation.java 查看文件

@@ -0,0 +1,284 @@
1
+/*
2
+ *
3
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
4
+ * the License. You may obtain a copy of the License at
5
+ *
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ *
8
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
9
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
10
+ * specific language governing permissions and limitations under the License.
11
+ */
12
+package com.ruoyi.common.constant;
13
+
14
+import com.ruoyi.common.exception.EsignDemoException;
15
+import org.apache.commons.codec.binary.Base64;
16
+
17
+import java.io.*;
18
+import java.net.HttpURLConnection;
19
+import java.net.URL;
20
+import java.security.MessageDigest;
21
+import java.security.NoSuchAlgorithmException;
22
+import java.util.HashMap;
23
+import java.util.Map;
24
+
25
+/**
26
+ * @author 澄泓
27
+ * @version JDK1.7
28
+ * @description 文件转换类
29
+ * @date 2020/10/26 10:47
30
+ */
31
+public class FileTransformation {
32
+
33
+    /**
34
+     * 传入本地文件路径转二进制byte
35
+     *
36
+     * @param srcFilePath 本地文件路径
37
+     * @return
38
+     * @throws EsignDemoException
39
+     */
40
+    public static byte[] fileToBytes(String srcFilePath) throws EsignDemoException {
41
+        return getBytes(srcFilePath);
42
+    }
43
+
44
+    /**
45
+     * 图片转base64
46
+     *
47
+     * @param filePath 本地文件路径
48
+     * @return
49
+     * @throws EsignDemoException
50
+     */
51
+    public static String fileToBase64(String filePath) throws EsignDemoException {
52
+        byte[] bytes;
53
+        String base64 = null;
54
+        bytes = fileToBytes(filePath);
55
+        base64 = Base64.encodeBase64String(bytes);
56
+        base64 = base64.replaceAll("\r\n", "");
57
+        return base64;
58
+    }
59
+
60
+    public static void main(String[] args) throws EsignDemoException {
61
+        System.out.println(getFileContentMD5("D:\\文档\\PLT2022-02124CT.pdf"));
62
+    }
63
+
64
+    /***
65
+     * 计算文件内容的Content-MD5
66
+     * @param filePath 文件路径
67
+     * @return
68
+     */
69
+    public static String getFileContentMD5(String filePath) throws EsignDemoException {
70
+        // 获取文件MD5的二进制数组(128位)
71
+        byte[] bytes = getFileMD5Bytes128(filePath);
72
+        // 对文件MD5的二进制数组进行base64编码
73
+        return new String(Base64.encodeBase64String(bytes));
74
+    }
75
+
76
+    /**
77
+     * 下载文件
78
+     *
79
+     * @param httpUrl 网络文件地址url
80
+     * @return
81
+     */
82
+    public static boolean downLoadFileByUrl(String httpUrl, String dir) throws EsignDemoException {
83
+        InputStream fis = null;
84
+        FileOutputStream fileOutputStream = null;
85
+        try {
86
+            URL url = new URL(httpUrl);
87
+            HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
88
+            httpConn.connect();
89
+            fis = httpConn.getInputStream();
90
+            fileOutputStream = new FileOutputStream(new File(dir));
91
+            byte[] md5Bytes = null;
92
+
93
+            byte[] buffer = new byte[1024];
94
+            int length = -1;
95
+            while ((length = fis.read(buffer, 0, 1024)) != -1) {
96
+                fileOutputStream.write(buffer, 0, length);
97
+            }
98
+        } catch (IOException e) {
99
+            EsignDemoException ex = new EsignDemoException("获取文件流异常", e);
100
+            ex.initCause(e);
101
+            throw ex;
102
+        } finally {
103
+            try {
104
+                if (fis != null) {
105
+                    fis.close();
106
+                }
107
+                if (fileOutputStream != null) {
108
+                    fileOutputStream.close();
109
+                }
110
+            } catch (IOException e) {
111
+                EsignDemoException ex = new EsignDemoException("关闭文件流异常", e);
112
+                ex.initCause(e);
113
+                throw ex;
114
+            }
115
+        }
116
+        return true;
117
+    }
118
+
119
+
120
+    /**
121
+     * 网络文件转二进制MD5数组并获取文件大小
122
+     *
123
+     * @param fileUrl 网络文件地址url
124
+     * @return
125
+     */
126
+    public static Map fileUrlToBytes(String fileUrl) throws EsignDemoException {
127
+        HashMap<String, Object> map = new HashMap<String, Object>();
128
+        try {
129
+            URL url = new URL(fileUrl);
130
+            HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
131
+            httpConn.connect();
132
+            InputStream fis = httpConn.getInputStream();
133
+            ByteArrayOutputStream outStream = new ByteArrayOutputStream();
134
+            outStream.close();
135
+            map.put("fileSize", fis.available());
136
+            byte[] md5Bytes = null;
137
+            MessageDigest md5 = MessageDigest.getInstance("MD5");
138
+            byte[] buffer = new byte[1024];
139
+            int length = -1;
140
+            while ((length = fis.read(buffer, 0, 1024)) != -1) {
141
+                md5.update(buffer, 0, length);
142
+                outStream.write(buffer, 0, length);
143
+            }
144
+            md5Bytes = md5.digest();
145
+            byte[] fileData = outStream.toByteArray();
146
+            map.put("fileData", fileData);
147
+            outStream.close();
148
+            fis.close();
149
+            map.put("md5Bytes", md5Bytes);
150
+        } catch (IOException e) {
151
+            EsignDemoException ex = new EsignDemoException("获取文件流异常", e);
152
+            ex.initCause(e);
153
+            throw ex;
154
+        } catch (NoSuchAlgorithmException e) {
155
+            EsignDemoException ex = new EsignDemoException("文件计算异常", e);
156
+            ex.initCause(e);
157
+            throw ex;
158
+        }
159
+        return map;
160
+    }
161
+
162
+    /***
163
+     * 获取文件MD5的二进制数组(128位)
164
+     * @param filePath
165
+     * @return
166
+     * @throws EsignDemoException
167
+     */
168
+    public static byte[] getFileMD5Bytes128(String filePath) throws EsignDemoException {
169
+        FileInputStream fis = null;
170
+        byte[] md5Bytes = null;
171
+        try {
172
+            File file = new File(filePath);
173
+            fis = new FileInputStream(file);
174
+            MessageDigest md5 = MessageDigest.getInstance("MD5");
175
+            byte[] buffer = new byte[1024];
176
+            int length = -1;
177
+            while ((length = fis.read(buffer, 0, 1024)) != -1) {
178
+                md5.update(buffer, 0, length);
179
+            }
180
+            md5Bytes = md5.digest();
181
+            fis.close();
182
+        } catch (FileNotFoundException e) {
183
+            EsignDemoException ex = new EsignDemoException("文件找不到", e);
184
+            ex.initCause(e);
185
+            throw ex;
186
+        } catch (NoSuchAlgorithmException e) {
187
+            EsignDemoException ex = new EsignDemoException("不支持此算法", e);
188
+            ex.initCause(e);
189
+            throw ex;
190
+        } catch (IOException e) {
191
+            EsignDemoException ex = new EsignDemoException("输入流或输出流异常", e);
192
+            ex.initCause(e);
193
+            throw ex;
194
+        } finally {
195
+            if (fis != null) {
196
+                try {
197
+                    fis.close();
198
+                } catch (IOException e) {
199
+                    EsignDemoException ex = new EsignDemoException("关闭文件输入流失败", e);
200
+                    ex.initCause(e);
201
+                    throw ex;
202
+                }
203
+            }
204
+        }
205
+        return md5Bytes;
206
+    }
207
+
208
+    /**
209
+     * @param path
210
+     * @return
211
+     * @throws EsignDemoException
212
+     * @description 根据文件路径,获取文件base64
213
+     * @author 宫清
214
+     * @date 2019年7月21日 下午4:22:08
215
+     */
216
+    public static String getBase64Str(String path) throws EsignDemoException {
217
+        InputStream is = null;
218
+        try {
219
+            is = new FileInputStream(new File(path));
220
+            byte[] bytes = new byte[is.available()];
221
+            is.read(bytes);
222
+            return Base64.encodeBase64String(bytes);
223
+        } catch (Exception e) {
224
+            EsignDemoException ex = new EsignDemoException("获取文件输入流失败", e);
225
+            ex.initCause(e);
226
+            throw ex;
227
+        } finally {
228
+            if (is != null) {
229
+                try {
230
+                    is.close();
231
+                } catch (IOException e) {
232
+                    EsignDemoException ex = new EsignDemoException("关闭文件输入流失败", e);
233
+                    ex.initCause(e);
234
+                    throw ex;
235
+                }
236
+            }
237
+        }
238
+    }
239
+
240
+    /**
241
+     * @param path 文件路径
242
+     * @return
243
+     * @description 获取文件名称
244
+     * @author 宫清
245
+     * @date 2019年7月21日 下午8:21:16
246
+     */
247
+    public static String getFileName(String path) {
248
+        return new File(path).getName();
249
+    }
250
+
251
+    /**
252
+     * @param filePath {@link String} 文件地址
253
+     * @return
254
+     * @throws EsignDemoException
255
+     * @description 获取文件字节流
256
+     * @date 2019年7月10日 上午9:17:00
257
+     * @author 宫清
258
+     */
259
+    public static byte[] getBytes(String filePath) throws EsignDemoException {
260
+        File file = new File(filePath);
261
+        FileInputStream fis = null;
262
+        byte[] buffer = null;
263
+        try {
264
+            fis = new FileInputStream(file);
265
+            buffer = new byte[(int) file.length()];
266
+            fis.read(buffer);
267
+        } catch (Exception e) {
268
+            EsignDemoException ex = new EsignDemoException("获取文件字节流失败", e);
269
+            ex.initCause(e);
270
+            throw ex;
271
+        } finally {
272
+            if (fis != null) {
273
+                try {
274
+                    fis.close();
275
+                } catch (IOException e) {
276
+                    EsignDemoException ex = new EsignDemoException("关闭文件字节流失败", e);
277
+                    ex.initCause(e);
278
+                    throw ex;
279
+                }
280
+            }
281
+        }
282
+        return buffer;
283
+    }
284
+}

+ 44
- 45
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java 查看文件

@@ -1,118 +1,117 @@
1 1
 package com.ruoyi.common.core.domain;
2 2
 
3
+import com.fasterxml.jackson.annotation.JsonFormat;
4
+import com.fasterxml.jackson.annotation.JsonIgnore;
5
+import com.fasterxml.jackson.annotation.JsonInclude;
6
+
3 7
 import java.io.Serializable;
4 8
 import java.util.Date;
5 9
 import java.util.HashMap;
6 10
 import java.util.Map;
7
-import com.fasterxml.jackson.annotation.JsonFormat;
8
-import com.fasterxml.jackson.annotation.JsonIgnore;
9
-import com.fasterxml.jackson.annotation.JsonInclude;
10 11
 
11 12
 /**
12 13
  * Entity基类
13
- * 
14
+ *
14 15
  * @author ruoyi
15 16
  */
16
-public class BaseEntity implements Serializable
17
-{
17
+public class BaseEntity implements Serializable {
18 18
     private static final long serialVersionUID = 1L;
19 19
 
20
-    /** 搜索值 */
20
+    /**
21
+     * 搜索值
22
+     */
21 23
     @JsonIgnore
22 24
     private String searchValue;
23 25
 
24
-    /** 创建者 */
26
+    /**
27
+     * 创建者
28
+     */
25 29
     private String createBy;
26 30
 
27
-    /** 创建时间 */
28
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
31
+    /**
32
+     * 创建时间
33
+     */
34
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
29 35
     private Date createTime;
30 36
 
31
-    /** 更新者 */
37
+    /**
38
+     * 更新者
39
+     */
32 40
     private String updateBy;
33 41
 
34
-    /** 更新时间 */
35
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
42
+    /**
43
+     * 更新时间
44
+     */
45
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
36 46
     private Date updateTime;
37 47
 
38
-    /** 备注 */
48
+    /**
49
+     * 备注
50
+     */
39 51
     private String remark;
40 52
 
41
-    /** 请求参数 */
53
+    /**
54
+     * 请求参数
55
+     */
42 56
     @JsonInclude(JsonInclude.Include.NON_EMPTY)
43 57
     private Map<String, Object> params;
44 58
 
45
-    public String getSearchValue()
46
-    {
59
+    public String getSearchValue() {
47 60
         return searchValue;
48 61
     }
49 62
 
50
-    public void setSearchValue(String searchValue)
51
-    {
63
+    public void setSearchValue(String searchValue) {
52 64
         this.searchValue = searchValue;
53 65
     }
54 66
 
55
-    public String getCreateBy()
56
-    {
67
+    public String getCreateBy() {
57 68
         return createBy;
58 69
     }
59 70
 
60
-    public void setCreateBy(String createBy)
61
-    {
71
+    public void setCreateBy(String createBy) {
62 72
         this.createBy = createBy;
63 73
     }
64 74
 
65
-    public Date getCreateTime()
66
-    {
75
+    public Date getCreateTime() {
67 76
         return createTime;
68 77
     }
69 78
 
70
-    public void setCreateTime(Date createTime)
71
-    {
79
+    public void setCreateTime(Date createTime) {
72 80
         this.createTime = createTime;
73 81
     }
74 82
 
75
-    public String getUpdateBy()
76
-    {
83
+    public String getUpdateBy() {
77 84
         return updateBy;
78 85
     }
79 86
 
80
-    public void setUpdateBy(String updateBy)
81
-    {
87
+    public void setUpdateBy(String updateBy) {
82 88
         this.updateBy = updateBy;
83 89
     }
84 90
 
85
-    public Date getUpdateTime()
86
-    {
91
+    public Date getUpdateTime() {
87 92
         return updateTime;
88 93
     }
89 94
 
90
-    public void setUpdateTime(Date updateTime)
91
-    {
95
+    public void setUpdateTime(Date updateTime) {
92 96
         this.updateTime = updateTime;
93 97
     }
94 98
 
95
-    public String getRemark()
96
-    {
99
+    public String getRemark() {
97 100
         return remark;
98 101
     }
99 102
 
100
-    public void setRemark(String remark)
101
-    {
103
+    public void setRemark(String remark) {
102 104
         this.remark = remark;
103 105
     }
104 106
 
105
-    public Map<String, Object> getParams()
106
-    {
107
-        if (params == null)
108
-        {
107
+    public Map<String, Object> getParams() {
108
+        if (params == null) {
109 109
             params = new HashMap<>();
110 110
         }
111 111
         return params;
112 112
     }
113 113
 
114
-    public void setParams(Map<String, Object> params)
115
-    {
114
+    public void setParams(Map<String, Object> params) {
116 115
         this.params = params;
117 116
     }
118 117
 }

+ 24
- 0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/EsignCoreSdkInfo.java 查看文件

@@ -0,0 +1,24 @@
1
+package com.ruoyi.common.core.domain.entity;
2
+/**
3
+ * esignSDK-core信息类
4
+ * @author  澄泓
5
+ * @date  2022/2/22 13:59
6
+ * @version
7
+ */
8
+public class EsignCoreSdkInfo {
9
+    private static final String SdkVersion="Esign-Sdk-Core1.0";
10
+    private static final String SupportedVersion="JDK1.7 MORE THAN";
11
+
12
+    private static final String Info="sdk-esign-api核心工具包,主要处理e签宝公有云产品接口调用时的签名计算以及网络请求,通过EsignHttpHelper.signAndBuildSignAndJsonHeader构造签名鉴权+json数据格式的请求头,通过HttpHelper.doCommHttp方法入参发起网络请求。让开发者无需关注具体的请求签名算法,专注于接口业务的json参数构造";
13
+    public static String getSdkVersion() {
14
+        return SdkVersion;
15
+    }
16
+
17
+    public static String getInfo() {
18
+        return Info;
19
+    }
20
+
21
+    public static String getSupportedVersion() {
22
+        return SupportedVersion;
23
+    }
24
+}

+ 24
- 0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/EsignHttpResponse.java 查看文件

@@ -0,0 +1,24 @@
1
+package com.ruoyi.common.core.domain.entity;
2
+/**
3
+ * 网络请求的response类
4
+ */
5
+public class EsignHttpResponse {
6
+    private int status;
7
+    private String body;
8
+
9
+    public int getStatus() {
10
+        return status;
11
+    }
12
+
13
+    public void setStatus(int status) {
14
+        this.status = status;
15
+    }
16
+
17
+    public String getBody() {
18
+        return body;
19
+    }
20
+
21
+    public void setBody(String body) {
22
+        this.body = body;
23
+    }
24
+}

+ 39
- 0
ruoyi-common/src/main/java/com/ruoyi/common/enums/EsignRequestType.java 查看文件

@@ -0,0 +1,39 @@
1
+package com.ruoyi.common.enums;
2
+
3
+import org.apache.http.client.methods.*;
4
+
5
+/**
6
+ * @description 请求类型
7
+ * @author 澄泓
8
+ * @since JDK1.7
9
+ */
10
+public enum EsignRequestType {
11
+
12
+	POST{
13
+		@Override
14
+		public HttpRequestBase getHttpType(String url) {
15
+			return new HttpPost(url);
16
+		}
17
+	},
18
+	GET{
19
+		@Override
20
+		public HttpRequestBase getHttpType(String url) {
21
+			return new HttpGet(url);
22
+		}
23
+	},
24
+	DELETE{
25
+		@Override
26
+		public HttpRequestBase getHttpType(String url) {
27
+			return new HttpDelete(url);
28
+		}
29
+	},
30
+	PUT{
31
+		@Override
32
+		public HttpRequestBase getHttpType(String url) {
33
+			return new HttpPut(url);
34
+		}
35
+	},
36
+	;
37
+
38
+   public abstract HttpRequestBase getHttpType(String url);
39
+}

+ 6
- 10
ruoyi-common/src/main/java/com/ruoyi/common/enums/HttpMethod.java 查看文件

@@ -2,6 +2,7 @@ package com.ruoyi.common.enums;
2 2
 
3 3
 import java.util.HashMap;
4 4
 import java.util.Map;
5
+
5 6
 import org.springframework.lang.Nullable;
6 7
 
7 8
 /**
@@ -9,28 +10,23 @@ import org.springframework.lang.Nullable;
9 10
  *
10 11
  * @author ruoyi
11 12
  */
12
-public enum HttpMethod
13
-{
13
+public enum HttpMethod {
14 14
     GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE;
15 15
 
16 16
     private static final Map<String, HttpMethod> mappings = new HashMap<>(16);
17 17
 
18
-    static
19
-    {
20
-        for (HttpMethod httpMethod : values())
21
-        {
18
+    static {
19
+        for (HttpMethod httpMethod : values()) {
22 20
             mappings.put(httpMethod.name(), httpMethod);
23 21
         }
24 22
     }
25 23
 
26 24
     @Nullable
27
-    public static HttpMethod resolve(@Nullable String method)
28
-    {
25
+    public static HttpMethod resolve(@Nullable String method) {
29 26
         return (method != null ? mappings.get(method) : null);
30 27
     }
31 28
 
32
-    public boolean matches(String method)
33
-    {
29
+    public boolean matches(String method) {
34 30
         return (this == resolve(method));
35 31
     }
36 32
 }

+ 36
- 0
ruoyi-common/src/main/java/com/ruoyi/common/exception/EsignDemoException.java 查看文件

@@ -0,0 +1,36 @@
1
+package com.ruoyi.common.exception;
2
+
3
+/**
4
+ * description 自定义全局异常
5
+ * @author 澄泓
6
+ * datetime 2019年7月1日上午10:43:24
7
+ */
8
+public class EsignDemoException extends Exception {
9
+
10
+	private static final long serialVersionUID = 4359180081622082792L;
11
+	private Exception e;
12
+
13
+	public EsignDemoException(String msg) {
14
+		super(msg);
15
+	}
16
+
17
+	public EsignDemoException(String msg, Throwable cause) {
18
+		super(msg,cause);
19
+	}
20
+
21
+	public EsignDemoException(){
22
+
23
+	}
24
+
25
+	public Exception getE() {
26
+		return e;
27
+	}
28
+
29
+	public void setE(Exception e) {
30
+		this.e = e;
31
+	}
32
+
33
+
34
+
35
+
36
+}

+ 187
- 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/EmailOutUtil.java 查看文件

@@ -0,0 +1,187 @@
1
+package com.ruoyi.common.utils;
2
+
3
+
4
+import lombok.Data;
5
+import lombok.extern.slf4j.Slf4j;
6
+import org.springframework.beans.factory.annotation.Value;
7
+import org.springframework.mail.SimpleMailMessage;
8
+
9
+import org.springframework.mail.javamail.JavaMailSender;
10
+import org.springframework.mail.javamail.JavaMailSenderImpl;
11
+import org.springframework.mail.javamail.MimeMessageHelper;
12
+import org.springframework.stereotype.Component;
13
+
14
+import javax.mail.MessagingException;
15
+import javax.mail.internet.MimeMessage;
16
+import javax.validation.constraints.NotNull;
17
+import java.io.File;
18
+import java.io.IOException;
19
+import java.util.List;
20
+import java.util.regex.Matcher;
21
+import java.util.regex.Pattern;
22
+
23
+/**
24
+ * @ClassName EmailInUtil
25
+ * @Description 邮件发送工具
26
+ */
27
+@Component
28
+@Data
29
+@Slf4j
30
+public class EmailOutUtil {
31
+    private static Pattern emailPattern = Pattern.compile("^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$");
32
+    //    private static Pattern phonePattern = Pattern.compile("0?(13|14|15|18)[0-9]{9}");
33
+    private static Pattern phonePattern = Pattern.compile("^1\\d{10}$");
34
+
35
+
36
+//    @Autowired
37
+//    private JavaMailSender mailSender;
38
+
39
+    // 发送发邮箱地址(外网地址)
40
+//    @Value("${spring.mail-out-network.from}")
41
+//    private static String fromOut;
42
+    @Value("${spring.mail.host}")
43
+    private  String hostOut;
44
+    @Value("${spring.mail.username}")
45
+    private  String usernameOut;
46
+    @Value("${spring.mail.password}")
47
+    private   String passwordOut;
48
+    @Value("${spring.mail.port}")
49
+    private  Integer portOut;
50
+
51
+    public  JavaMailSender rebuildMailSender() {
52
+        JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
53
+        mailSender.setHost(hostOut);
54
+        mailSender.setUsername(usernameOut);
55
+        mailSender.setPassword(passwordOut);
56
+        mailSender.setPort(portOut);
57
+        mailSender.setProtocol("smtp");
58
+        mailSender.setDefaultEncoding("UTF-8");
59
+        return mailSender;
60
+    }
61
+
62
+    /**
63
+     * 发送纯文本邮件信息
64
+     *
65
+     * @param to      接收方
66
+     * @param subject 邮件主题
67
+     * @param content 邮件内容(发送内容)
68
+     */
69
+    public  void sendMessage(String to, String subject, String content, String from, JavaMailSender mailSender) {
70
+        // 创建一个邮件对象
71
+        SimpleMailMessage msg = new SimpleMailMessage();
72
+        msg.setFrom(from);
73
+        msg.setTo(to);
74
+        // 设置邮件主题
75
+        msg.setSubject(subject);
76
+        // 设置邮件内容
77
+        msg.setText(content);
78
+        // 发送邮件
79
+        mailSender.send(msg);
80
+        ////System.out.println("发送成功:" + from + ":to:" + to);
81
+    }
82
+
83
+    /**
84
+     * 发送带附件的邮件信息
85
+     *
86
+     * @param to      接收方
87
+     * @param subject 邮件主题
88
+     * @param content 邮件内容(发送内容)
89
+     * @param fileList   文件集合 // 可发送多个附件
90
+     */
91
+    public  void sendMessageCarryFiles(String to, String subject, String content, List<File> fileList, String from, @NotNull JavaMailSender mailSender) {
92
+        MimeMessage mimeMessage = mailSender.createMimeMessage();
93
+        try {
94
+            MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
95
+            helper.setFrom(from);
96
+            helper.setTo(to);
97
+            // 设置邮件主题
98
+            helper.setSubject(subject);
99
+            // 设置邮件内容
100
+            helper.setText(content);
101
+            // 添加附件(多个)
102
+            if (fileList != null && fileList.size() > 0) {
103
+                for (File file : fileList) {
104
+                    helper.addAttachment(file.getName(), file);
105
+                }
106
+            }
107
+        } catch (MessagingException e) {
108
+            e.printStackTrace();
109
+        }
110
+        // 发送邮件
111
+        mailSender.send(mimeMessage);
112
+    }
113
+
114
+    /**
115
+     * 发送带附件的邮件信息
116
+     *
117
+     * @param to      接收方
118
+     * @param subject 邮件主题
119
+     * @param content 邮件内容(发送内容)
120
+     * @param file    单个文件
121
+     */
122
+    public void sendMessageCarryFile(String to, String subject, String content, File file, String from, JavaMailSender mailSender) {
123
+        MimeMessage mimeMessage = mailSender.createMimeMessage();
124
+        try {
125
+            MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
126
+            helper.setFrom(from);
127
+            helper.setTo(to);
128
+            // 设置邮件主题
129
+            helper.setSubject(subject);
130
+            // 设置邮件内容
131
+            helper.setText(content);
132
+            // 单个附件
133
+            helper.addAttachment(file.getName(), file);
134
+        } catch (MessagingException e) {
135
+            e.printStackTrace();
136
+        }
137
+        // 发送邮件
138
+        mailSender.send(mimeMessage);
139
+    }
140
+
141
+    /**
142
+     * 初始化内外网邮件发送对象
143
+     *
144
+     * @param num
145
+     */
146
+//    public static JavaMailSender initJavaMailSender(Integer num) {
147
+//        if (num != null && num == 1) {
148
+//            //内网
149
+//            return rebuildMailSender(hostIn, usernameIn, passwordIn, Integer.parseInt(portIn), "smtps");
150
+//        } else {
151
+//            //外网
152
+//            return rebuildMailSender(hostOut, usernameOut, passwordOut, Integer.parseInt(portOut), "smtps");
153
+//        }
154
+//    }
155
+
156
+//    public static String getInnerFrom() {
157
+//        return EmailInUtil;
158
+//    }
159
+//
160
+//    public static String getOutterFrom() {
161
+//        return fromOut;
162
+//    }
163
+
164
+    /**
165
+     * 验证邮箱格式
166
+     *
167
+     * @param str
168
+     * @return
169
+     */
170
+    public static boolean isEmail(String str) {
171
+        boolean flag = false;
172
+        Matcher matcher = emailPattern.matcher(str);
173
+        if (matcher.matches()) {
174
+            flag = true;
175
+        }
176
+        return flag;
177
+    }
178
+
179
+    public static boolean isPhoneNumber(String str) {
180
+        boolean flag = false;
181
+        Matcher matcher = phonePattern.matcher(str);
182
+        if (matcher.matches()) {
183
+            flag = true;
184
+        }
185
+        return flag;
186
+    }
187
+}

+ 178
- 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/EsignHttpHelper.java 查看文件

@@ -0,0 +1,178 @@
1
+package com.ruoyi.common.utils;
2
+
3
+
4
+import com.ruoyi.common.constant.EsignEncryption;
5
+import com.ruoyi.common.constant.EsignHeaderConstant;
6
+import com.ruoyi.common.constant.EsignHttpCfgHelper;
7
+import com.ruoyi.common.core.domain.entity.EsignCoreSdkInfo;
8
+import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
9
+import com.ruoyi.common.enums.EsignRequestType;
10
+import com.ruoyi.common.exception.EsignDemoException;
11
+import org.slf4j.Logger;
12
+import org.slf4j.LoggerFactory;
13
+
14
+import java.util.HashMap;
15
+import java.util.Map;
16
+
17
+/**
18
+ * @description Http 请求 辅助类
19
+ * @author 澄泓
20
+ * @since JDK1.7
21
+ */
22
+public class EsignHttpHelper {
23
+	private static final Logger LOGGER = LoggerFactory.getLogger(EsignHttpHelper.class);
24
+
25
+	/**
26
+	 * 不允许外部创建实例
27
+	 */
28
+	private EsignHttpHelper() {
29
+
30
+	}
31
+
32
+	/**
33
+	 * @description 发送常规HTTP 请求
34
+	 *
35
+	 * @param reqType 请求方式
36
+	 * @param url 请求路径
37
+	 * @param paramStr 请求参数
38
+	 * @return
39
+	 * @throws EsignDemoException
40
+	 * @author 澄泓
41
+	 */
42
+	public static EsignHttpResponse doCommHttp(String host, String url, EsignRequestType reqType, Object paramStr , Map<String,String> httpHeader, boolean debug) throws EsignDemoException {
43
+
44
+		return EsignHttpCfgHelper.sendHttp(reqType, host+url,httpHeader, paramStr, debug);
45
+
46
+	}
47
+
48
+
49
+	/**
50
+	 * @description 发送文件流上传 HTTP 请求
51
+	 *
52
+	 * @param reqType 请求方式
53
+	 * @param uploadUrl 请求路径
54
+	 * @param param 请求参数
55
+	 * @param fileContentMd5 文件fileContentMd5
56
+	 * @param contentType 文件MIME类型
57
+	 * @return
58
+	 * @throws EsignDemoException
59
+	 * @author 澄泓
60
+	 */
61
+	public static EsignHttpResponse doUploadHttp( String uploadUrl,EsignRequestType reqType,byte[] param, String fileContentMd5,
62
+												 String contentType, boolean debug) throws EsignDemoException {
63
+		Map<String, String> uploadHeader = buildUploadHeader(fileContentMd5, contentType);
64
+		if(debug){
65
+			LOGGER.info("----------------------------start------------------------");
66
+			LOGGER.info("fileContentMd5:{}",fileContentMd5);
67
+			LOGGER.info("contentType:{}",contentType);
68
+		}
69
+		return EsignHttpCfgHelper.sendHttp(reqType,uploadUrl, uploadHeader, param,debug);
70
+	}
71
+
72
+
73
+
74
+	/**
75
+	 * @description 构建一个签名鉴权+json数据的esign请求头
76
+	 * @return
77
+	 * @author 澄泓
78
+	 */
79
+	public static Map<String, String> buildSignAndJsonHeader(String projectId,String contentMD5,String accept,String contentType,String authMode) {
80
+
81
+		Map<String, String> header = new HashMap<>();
82
+		header.put("X-Tsign-Open-App-Id", projectId);
83
+		header.put("X-Tsign-Open-Version-Sdk",EsignCoreSdkInfo.getSdkVersion());
84
+		header.put("X-Tsign-Open-Ca-Timestamp", EsignEncryption.timeStamp());
85
+		header.put("Accept",accept);
86
+		header.put("Content-MD5",contentMD5);
87
+		header.put("Content-Type", contentType);
88
+		header.put("X-Tsign-Open-Auth-Mode", authMode);
89
+		return header;
90
+	}
91
+
92
+	/**
93
+	 * 签名计算并且构建一个签名鉴权+json数据的esign请求头
94
+	 * @param  httpMethod
95
+	 *      *         The name of a supported {@linkplain java.nio.charset.Charset
96
+	 *      *         charset}
97
+	 * @return
98
+	 */
99
+	public static Map<String,String> signAndBuildSignAndJsonHeader(String projectId, String secret,String paramStr,String httpMethod,String url,boolean debug) throws EsignDemoException {
100
+		String contentMD5="";
101
+		//统一转大写处理
102
+		httpMethod = httpMethod.toUpperCase();
103
+		if("GET".equals(httpMethod)||"DELETE".equals(httpMethod)){
104
+			paramStr=null;
105
+			contentMD5="";
106
+		} else if("PUT".equals(httpMethod)||"POST".equals(httpMethod)){
107
+			//对body体做md5摘要
108
+			contentMD5= EsignEncryption.doContentMD5(paramStr);
109
+		}else{
110
+			throw new EsignDemoException(String.format("不支持的请求方法%s",httpMethod));
111
+		}
112
+		//构造一个初步的请求头
113
+		Map<String, String> esignHeaderMap = buildSignAndJsonHeader(projectId, contentMD5, EsignHeaderConstant.ACCEPT.VALUE(), EsignHeaderConstant.CONTENTTYPE_JSON.VALUE(), EsignHeaderConstant.AUTHMODE.VALUE());
114
+		//排序
115
+		url=EsignEncryption.sortApiUrl(url);
116
+		//传入生成的bodyMd5,加上其他请求头部信息拼接成字符串
117
+		String message = EsignEncryption.appendSignDataString(httpMethod, esignHeaderMap.get("Content-MD5"),esignHeaderMap.get("Accept"),esignHeaderMap.get("Content-Type"),esignHeaderMap.get("Headers"),esignHeaderMap.get("Date"), url);
118
+		//整体做sha256签名
119
+		String reqSignature = EsignEncryption.doSignatureBase64(message, secret);
120
+		//请求头添加签名值
121
+		esignHeaderMap.put("X-Tsign-Open-Ca-Signature",reqSignature);
122
+		if(debug){
123
+			LOGGER.info("----------------------------start------------------------");
124
+			LOGGER.info("待计算body值:{}", paramStr+"\n");
125
+			LOGGER.info("MD5值:{}",contentMD5+"\n");
126
+			LOGGER.info("待签名字符串:{}",message+"\n");
127
+			LOGGER.info("签名值:{}",reqSignature+"\n");
128
+		}
129
+		return esignHeaderMap;
130
+	}
131
+
132
+
133
+	/**
134
+	 * @description 构建一个Token鉴权+jsons数据的esign请求头
135
+	 * @return
136
+	 * @author 澄泓
137
+	 */
138
+	public static Map<String, String> buildTokenAndJsonHeader(String appid,String token) {
139
+		Map<String, String> esignHeader = new HashMap<>();
140
+		esignHeader.put("X-Tsign-Open-Version-Sdk", EsignCoreSdkInfo.getSdkVersion());
141
+		esignHeader.put("Content-Type", EsignHeaderConstant.CONTENTTYPE_JSON.VALUE());
142
+		esignHeader.put("X-Tsign-Open-App-Id", appid);
143
+		esignHeader.put("X-Tsign-Open-Token", token);
144
+		return esignHeader;
145
+	}
146
+
147
+	/**
148
+	 * @description 构建一个form表单数据的esign请求头
149
+	 * @return
150
+	 * @author 澄泓
151
+	 */
152
+	public static Map<String, String> buildFormDataHeader(String appid) {
153
+		Map<String, String> esignHeader = new HashMap<>();
154
+		esignHeader.put("X-Tsign-Open-Version-Sdk",EsignCoreSdkInfo.getSdkVersion());
155
+		esignHeader.put("X-Tsign-Open-Authorization-Version","v2");
156
+		esignHeader.put("Content-Type", EsignHeaderConstant.CONTENTTYPE_FORMDATA.VALUE());
157
+		esignHeader.put("X-Tsign-Open-App-Id", appid);
158
+		return esignHeader;
159
+	}
160
+
161
+	/**
162
+	 * @description 创建文件流上传 请求头
163
+	 *
164
+	 * @param fileContentMd5
165
+	 * @param contentType
166
+	 * @return
167
+	 * @author 澄泓
168
+	 */
169
+	public static Map<String, String> buildUploadHeader(String fileContentMd5, String contentType) {
170
+		Map<String, String> header = new HashMap<>();
171
+		header.put("Content-MD5", fileContentMd5);
172
+		header.put("Content-Type", contentType);
173
+
174
+		return header;
175
+	}
176
+
177
+	// ------------------------------私有方法end----------------------------------------------
178
+}

+ 77
- 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/SmsUtils.java 查看文件

@@ -0,0 +1,77 @@
1
+package com.ruoyi.common.utils;
2
+
3
+import com.tencentcloudapi.common.Credential;
4
+import com.tencentcloudapi.common.exception.TencentCloudSDKException;
5
+import com.tencentcloudapi.common.profile.ClientProfile;
6
+import com.tencentcloudapi.common.profile.HttpProfile;
7
+import com.tencentcloudapi.cvm.v20170312.CvmClient;
8
+import com.tencentcloudapi.cvm.v20170312.models.DescribeRegionsRequest;
9
+import com.tencentcloudapi.cvm.v20170312.models.DescribeRegionsResponse;
10
+import com.tencentcloudapi.sms.v20210111.SmsClient;
11
+import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse;
12
+import com.tencentcloudapi.sms.v20210111.models.SendStatus;
13
+import lombok.Data;
14
+import lombok.extern.slf4j.Slf4j;
15
+import lombok.var;
16
+
17
+import java.util.Objects;
18
+
19
+@Slf4j
20
+public class SmsUtils {
21
+    //应用id
22
+    private static final String SDK_APP_ID = "1400854852";
23
+    //API的SecretId
24
+    private static final String SECRET_ID = "AKIDeEf2A8uX1HSainvvnXAc3X9ZlhtyvkMp";
25
+    //API的SecretKey
26
+    private static final String SECRET_KEY = "QjphKo8zkHZigT8j9PVtFPJyfIvO3d6V";
27
+    //签名内容
28
+    private static final String SIGN_NAME = "西安云美电子科技有限公司";
29
+
30
+    public static Boolean sendSms(SendSmsRequest request) {
31
+        Credential cred = new Credential(SECRET_ID, SECRET_KEY );
32
+
33
+        SmsClient client = new SmsClient(cred, "ap-guangzhou");
34
+
35
+        final var req = new com.tencentcloudapi.sms.v20210111.models.SendSmsRequest();
36
+        req.setPhoneNumberSet(new String[]{"+86" + request.getPhone()});
37
+        req.setSmsSdkAppId(SDK_APP_ID );
38
+        req.setSignName(SIGN_NAME);
39
+        req.setTemplateId(request.getTemplateId());
40
+        req.setTemplateParamSet(request.getTemplateParamSet());
41
+        SendSmsResponse res = null;
42
+        try {
43
+            res = client.SendSms(req);
44
+        } catch (TencentCloudSDKException e) {
45
+            log.error("发送短信出错:", e);
46
+            return Boolean.FALSE;
47
+        }
48
+        SendStatus sendStatus = res.getSendStatusSet()[0];
49
+        log.info("发送短信结果:Code={}, Message={}", sendStatus.getCode(), sendStatus.getMessage());
50
+
51
+        if (Objects.nonNull(res.getSendStatusSet()) && res.getSendStatusSet().length > 0 && "Ok".equals(res.getSendStatusSet()[0].getCode())){
52
+            return Boolean.TRUE;
53
+        }
54
+        return Boolean.FALSE;
55
+    }
56
+    /**
57
+     * 参数对象
58
+     */
59
+    @Data
60
+    public static class SendSmsRequest {
61
+        /**
62
+         * 电话
63
+         */
64
+        private String phone;
65
+
66
+        /**
67
+         * 模板 ID: 必须填写已审核通过的模板 ID
68
+         */
69
+        private String templateId;
70
+
71
+        /**
72
+         * 模板参数: 模板参数的个数需要与 TemplateId 对应模板的变量个数保持一致,若无模板参数,则设置为空
73
+         */
74
+        private String[] templateParamSet;
75
+
76
+    }
77
+}

+ 156
- 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/WordUtil.java 查看文件

@@ -0,0 +1,156 @@
1
+package com.ruoyi.common.utils;
2
+
3
+
4
+import com.deepoove.poi.XWPFTemplate;
5
+import com.deepoove.poi.config.Configure;
6
+import com.deepoove.poi.data.*;
7
+import com.deepoove.poi.data.style.ParagraphStyle;
8
+import com.deepoove.poi.data.style.Style;
9
+import com.deepoove.poi.util.PoitlIOUtils;
10
+import org.apache.poi.xwpf.usermodel.ParagraphAlignment;
11
+
12
+import javax.servlet.http.HttpServletResponse;
13
+import java.io.BufferedOutputStream;
14
+import java.io.FileOutputStream;
15
+import java.io.IOException;
16
+import java.io.OutputStream;
17
+import java.util.ArrayList;
18
+import java.util.List;
19
+import java.util.Map;
20
+
21
+/**
22
+ * 文档生成工具类
23
+ */
24
+public class WordUtil {
25
+
26
+    private CellRenderData cell;
27
+
28
+    /**
29
+     * 查询生成的word文件流
30
+     *
31
+     * @param response
32
+     * @param datas
33
+     * @param modalFilePath
34
+     * @param resultFilePath
35
+     * @throws IOException
36
+     */
37
+    public static void getDocStreamFile(HttpServletResponse response, Map<String, Object> datas, String modalFilePath, String resultFilePath, String fileName) throws IOException {
38
+        //获取word模板和填充数据
39
+        XWPFTemplate template = XWPFTemplate.compile(modalFilePath).render(datas);
40
+        //设置返回类型及文件名
41
+        response.setContentType("application/octet-stream");
42
+        response.setHeader("Content-disposition", "attachment;filename=\"" + fileName + "\"");
43
+        //获取返回输出流
44
+        OutputStream out = response.getOutputStream();
45
+        BufferedOutputStream bos = new BufferedOutputStream(out);
46
+        template.write(bos);
47
+        bos.flush();
48
+        out.flush();
49
+        PoitlIOUtils.closeQuietlyMulti(template, bos, out);
50
+    }
51
+
52
+    /**
53
+     * 查询生成的word文件路径
54
+     *
55
+     * @param datas
56
+     * @param modalFilePath
57
+     * @param resultFilePath
58
+     * @return
59
+     * @throws IOException
60
+     */
61
+    public static String getDocFilePath(Map<String, Object> datas, String modalFilePath, String resultFilePath) throws IOException {
62
+        //获取word模板和填充数据
63
+        XWPFTemplate template = XWPFTemplate.compile(modalFilePath).render(datas);
64
+        template.writeAndClose(new FileOutputStream(resultFilePath));
65
+        return resultFilePath;
66
+    }
67
+
68
+    /**
69
+     * 构造绘制表格的方法
70
+     */
71
+    public static TableRenderData rebuildWordTableData(List<String> headerList, String headerBackgroundColor, String textColor, List<List<String>> tableContentList) {
72
+        RowRenderData header = rebuildWordTableHead(headerList, headerBackgroundColor, textColor);
73
+        List<RowRenderData> content = rebuildWordTableContent(tableContentList);
74
+        TableRenderData tableRenderData = Tables.create().addRow(header);
75
+        for (int i = 0; content != null && i < content.size(); i++) {
76
+            tableRenderData.addRow(content.get(i));
77
+        }
78
+        return tableRenderData;
79
+    }
80
+
81
+    /**
82
+     * 构造表格表头
83
+     *
84
+     * @return
85
+     */
86
+    public static RowRenderData rebuildWordTableHead(List<String> headerList, String headerBackgroundColor, String textColor) {
87
+        RowRenderData header = new RowRenderData();
88
+        for (int i = 0; headerList != null && i < headerList.size(); i++) {
89
+            CellRenderData cellRenderData = new CellRenderData();
90
+            ParagraphRenderData paragraphRenderData = new ParagraphRenderData();
91
+            Style style = new Style();
92
+            style.setColor(textColor);
93
+            style.setFontSize(12.0);
94
+            ParagraphStyle paragraphStyle = ParagraphStyle.builder()
95
+                    .withAlign(ParagraphAlignment.CENTER)
96
+                  //  .withBackgroundColor(headerBackgroundColor)
97
+                    .withDefaultTextStyle(style)
98
+                    .build();
99
+            paragraphRenderData.addText(headerList.get(i));
100
+            paragraphRenderData.setParagraphStyle(paragraphStyle);
101
+            cellRenderData.addParagraph(paragraphRenderData);
102
+            header.addCell(cellRenderData);
103
+        }
104
+        return header;
105
+    }
106
+
107
+    /**
108
+     * 构造表格内容
109
+     *
110
+     * @return
111
+     */
112
+    public static List<RowRenderData> rebuildWordTableContent(List<List<String>> tableContentList) {
113
+        List<RowRenderData> rowContentList = new ArrayList<>();
114
+        for (int i = 0; tableContentList != null && i < tableContentList.size(); i++) {
115
+            List<String> rowdataList = tableContentList.get(i);
116
+            RowRenderData rowcontent = new RowRenderData();
117
+            for (int j = 0; rowdataList != null && j < rowdataList.size(); j++) {
118
+                CellRenderData cellRenderData = new CellRenderData();
119
+                ParagraphRenderData paragraphRenderData = new ParagraphRenderData();
120
+                Style style = new Style();
121
+                style.setFontSize(12.0);
122
+                ParagraphStyle paragraphStyle = ParagraphStyle.builder()
123
+                        .withAlign(ParagraphAlignment.CENTER)
124
+                        .withDefaultTextStyle(style)
125
+                        .build();
126
+                paragraphRenderData.addText(rowdataList.get(j));
127
+                paragraphRenderData.setParagraphStyle(paragraphStyle);
128
+                cellRenderData.addParagraph(paragraphRenderData);
129
+                rowcontent.addCell(cellRenderData);
130
+            }
131
+            rowContentList.add(rowcontent);
132
+        }
133
+        return rowContentList;
134
+    }
135
+
136
+    /**
137
+     * 构建图片内容
138
+     */
139
+    public static PictureRenderData rebuildImageContent(Integer with, Integer height, String imageUrl, String relatedPath, Byte[] imageBytes) {
140
+        PictureRenderData pictureRenderData = null;
141
+        if (!StringUtils.isBlank(imageUrl)) {
142
+           // pictureRenderData = Pictures.of(imageUrl).size(with, height).create();
143
+            //Pictures.PictureBuilder pictureBuilder = Pictures.of("https://res.wx.qq.com/a/wx_fed/weixin_portal/res/static/img/1EtCRvm.png");
144
+        }else  if (!StringUtils.isBlank(relatedPath)) {
145
+            pictureRenderData = Pictures.ofLocal(relatedPath).size(with,height).create();
146
+//            Pictures.PictureBuilder pictureBuilder = Pictures.of("https://res.wx.qq.com/a/wx_fed/weixin_portal/res/static/img/1EtCRvm.png");
147
+        }
148
+        return pictureRenderData;
149
+    }
150
+    public static String getResultFilePath(Map<String, Object> datas, Configure config, String modalFilePath, String resultFilePath) throws IOException {
151
+        //获取word模板和填充数据
152
+        XWPFTemplate template = XWPFTemplate.compile(modalFilePath,config).render(datas);
153
+        template.writeAndClose(new FileOutputStream(resultFilePath));
154
+        return resultFilePath;
155
+    }
156
+}

+ 57
- 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/EsignFileBean.java 查看文件

@@ -0,0 +1,57 @@
1
+package com.ruoyi.common.utils.bean;
2
+
3
+
4
+import com.ruoyi.common.constant.FileTransformation;
5
+import com.ruoyi.common.exception.EsignDemoException;
6
+
7
+import java.io.File;
8
+
9
+/**
10
+ * @description  文件基础信息封装类
11
+ * @author  澄泓
12
+ * @date  2020/10/26 14:54
13
+ * @version JDK1.7
14
+ */
15
+public class EsignFileBean {
16
+    //文件名称
17
+    private String fileName;
18
+    //文件大小
19
+    private int fileSize;
20
+    //文件内容MD5
21
+    private String fileContentMD5;
22
+    //文件地址
23
+    private String filePath;
24
+
25
+
26
+    public EsignFileBean(String filePath) throws EsignDemoException {
27
+            this.filePath=filePath;
28
+            this.fileContentMD5 = FileTransformation.getFileContentMD5(filePath);
29
+            File file = new File(filePath);
30
+            if (!file.exists()) {
31
+                throw new EsignDemoException("文件不存在");
32
+            }
33
+            this.fileName = file.getName();
34
+            this.fileSize = (int) file.length();
35
+    }
36
+
37
+    public String getFileName() {
38
+        return fileName;
39
+    }
40
+
41
+    public int getFileSize() {
42
+        return fileSize;
43
+    }
44
+
45
+    public String getFileContentMD5() {
46
+        return fileContentMD5;
47
+    }
48
+
49
+    /**
50
+     * 传入本地文件地址获取二进制数据
51
+     * @return
52
+     * @throws EsignDemoException
53
+     */
54
+    public byte[] getFileBytes() throws EsignDemoException {
55
+        return FileTransformation.fileToBytes(filePath);
56
+    }
57
+}

+ 83
- 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java 查看文件

@@ -0,0 +1,83 @@
1
+package com.ruoyi.common.utils.file;
2
+
3
+import cn.hutool.json.JSONObject;
4
+import com.ruoyi.common.config.EsignDemoConfig;
5
+import com.ruoyi.common.constant.EsignHeaderConstant;
6
+import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
7
+import com.ruoyi.common.enums.EsignRequestType;
8
+import com.ruoyi.common.exception.EsignDemoException;
9
+import com.ruoyi.common.utils.EsignHttpHelper;
10
+import com.ruoyi.common.utils.bean.EsignFileBean;
11
+
12
+import java.util.Map;
13
+
14
+public class SaaSAPIFileUtils {
15
+    private static String eSignHost= EsignDemoConfig.EsignHost;
16
+    private static String eSignAppId= EsignDemoConfig.EsignAppId;
17
+    private static String eSignAppSecret=EsignDemoConfig.EsignAppSecret;
18
+    /**
19
+     * 获取文件上传地址
20
+     */
21
+    public static EsignHttpResponse getUploadUrl(String filePath) throws EsignDemoException {
22
+        //自定义的文件封装类,传入文件地址可以获取文件的名称大小,文件流等数据
23
+        EsignFileBean esignFileBean = new EsignFileBean(filePath);
24
+        String apiaddr = "/v3/files/file-upload-url";
25
+        //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null
26
+        String jsonParm = "{\n" +
27
+                "    \"contentMd5\": \"" + esignFileBean.getFileContentMD5() + "\",\n" +
28
+                "    \"fileName\":\"" + esignFileBean.getFileName() + "\"," +
29
+                "    \"fileSize\": " + esignFileBean.getFileSize() + ",\n" +
30
+                "    \"convertToPDF\":" +true+ ",\n" +
31
+                "    \"contentType\": \"" + EsignHeaderConstant.CONTENTTYPE_STREAM.VALUE() + "\"\n" +
32
+                "}";
33
+        //请求方法
34
+        EsignRequestType requestType = EsignRequestType.POST;
35
+        //生成签名鉴权方式的的header
36
+        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true);
37
+        //发起接口请求
38
+        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true);
39
+    }
40
+    /**
41
+     * 上传文件流
42
+     */
43
+    public static EsignHttpResponse uploadFile(String uploadUrl,String filePath) throws EsignDemoException {
44
+        //根据文件地址获取文件contentMd5
45
+        EsignFileBean esignFileBean = new EsignFileBean(filePath);
46
+        //请求方法
47
+        EsignRequestType requestType= EsignRequestType.PUT;
48
+        return EsignHttpHelper.doUploadHttp(uploadUrl,requestType,esignFileBean.getFileBytes(),esignFileBean.getFileContentMD5(), EsignHeaderConstant.CONTENTTYPE_STREAM.VALUE(),true);
49
+    }
50
+
51
+    /**
52
+     * 获取文件上传状态
53
+     */
54
+    public static EsignHttpResponse getFileStatus(String fileId) throws EsignDemoException {
55
+        String apiaddr="/v3/files/"+fileId;
56
+
57
+        //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null
58
+        String jsonParm=null;
59
+        //请求方法
60
+        EsignRequestType requestType= EsignRequestType.GET;
61
+        //生成签名鉴权方式的的header
62
+        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true);
63
+        //发起接口请求
64
+        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true);
65
+    }
66
+
67
+//  public static void main(String[] args) throws EsignDemoException {
68
+ //      String filePath = "D:\\home\\ruoyi\\uploadPath\\upload\\2023\\10\\7\\b442880179844a848f1f8b08c29e3d0c.docx";
69
+//        EsignHttpResponse uploadUrl = getUploadUrl(filePath);
70
+//        String body = uploadUrl.getBody();
71
+//        JSONObject jsonObject = new JSONObject(body);
72
+//        JSONObject dataObj = jsonObject.getJSONObject("data");
73
+//        String fileUploadUrl = dataObj.get("fileUploadUrl").toString();
74
+//        System.out.println("这是fileUploadUrl:"+fileUploadUrl);
75
+//        String fileId = dataObj.get("fileId").toString();
76
+//        System.out.println("这是fileId:"+fileId);
77
+//        EsignHttpResponse esignHttpResponse = uploadFile(fileUploadUrl, filePath);
78
+//        System.out.println("这是上传文件流的结果:"+esignHttpResponse.getBody());
79
+//       EsignHttpResponse fileStatus = getFileStatus(fileId);
80
+//        System.out.println("这是获取文件上传状态的结果:"+fileStatus.getBody());
81
+//        getFileStatus("a0c2ad21065f48ff8b872412c39d5d3a");
82
+//    }
83
+}

+ 2
- 1
ruoyi-framework/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java 查看文件

@@ -25,6 +25,7 @@ public class ApplicationConfig
25 25
     @Bean
26 26
     public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization()
27 27
     {
28
-        return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault());
28
+//        return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault());
29
+        return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone("Asia/Shanghai");
29 30
     }
30 31
 }

+ 1
- 1
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java 查看文件

@@ -111,7 +111,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
111 111
                 // 过滤请求
112 112
                 .authorizeRequests()
113 113
                 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
114
-                .antMatchers("/login", "/register", "/captchaImage").permitAll()
114
+                .antMatchers("/login", "/register", "/captchaImage","/uploadPath/**").permitAll()
115 115
                 // 静态资源,可匿名访问
116 116
                 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
117 117
                 .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()

+ 5
- 1
ruoyi-system/pom.xml 查看文件

@@ -22,7 +22,11 @@
22 22
             <groupId>com.ruoyi</groupId>
23 23
             <artifactId>ruoyi-common</artifactId>
24 24
         </dependency>
25
-
25
+        <dependency>
26
+            <groupId>com.ruoyi</groupId>
27
+            <artifactId>pay</artifactId>
28
+            <version>1.0.0-SNAPSHOT</version>
29
+        </dependency>
26 30
     </dependencies>
27 31
 
28 32
 </project>

+ 51
- 0
ruoyi-system/src/main/java/com/ruoyi/bestsign/domain/ArbitrSignatuVO.java 查看文件

@@ -0,0 +1,51 @@
1
+package com.ruoyi.bestsign.domain;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Builder;
5
+import lombok.Data;
6
+import lombok.NoArgsConstructor;
7
+
8
+@Data
9
+@NoArgsConstructor
10
+@AllArgsConstructor
11
+@Builder
12
+public class ArbitrSignatuVO {
13
+    /**
14
+     * 用户帐号
15
+     * 任务id
16
+     * 文件MD5
17
+     * 文件内容
18
+     * 文件总页数
19
+     * 文件名称
20
+     * 文件类型
21
+     * 合同标题
22
+     * 有效期
23
+     * 合同编号
24
+     * 签署者账号
25
+     * 签名位置页码
26
+     * x坐标
27
+     * y坐标
28
+     */
29
+    private String account;
30
+    private String taskId;
31
+
32
+    private String fileMd5;
33
+    private String fileData;
34
+    private String filePages;
35
+    private String fileName;
36
+    private String fileType;
37
+    private String contractTitle;
38
+    private String periodValidity;
39
+
40
+    private String contractNum;
41
+    private String signerAccout;
42
+    private String pageNumSigner;
43
+    private String pageNumSignerX;
44
+    private String pageNumSignerY;
45
+
46
+
47
+
48
+
49
+
50
+
51
+}

+ 22
- 0
ruoyi-system/src/main/java/com/ruoyi/bestsign/domain/CredentialVO.java 查看文件

@@ -0,0 +1,22 @@
1
+package com.ruoyi.bestsign.domain;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Builder;
5
+import lombok.Data;
6
+import lombok.NoArgsConstructor;
7
+
8
+@Data
9
+@NoArgsConstructor
10
+@AllArgsConstructor
11
+@Builder
12
+public class CredentialVO {
13
+    /**
14
+     * 用户证件号
15
+     */
16
+    private String identity;
17
+    /**
18
+     * 用户证件类型
19
+     * 默认用“0”, "0"表示身份证,会校验18位身份证号格式。0-居民身份证; 1-护照;6-社会保障卡; B-港澳居民往来内地通行证; C-台湾居民来往大陆通行证; E-户口簿; F-临时居民身份证;P-外国人永久居留证;Z-其他证件
20
+     */
21
+    private String identityType;
22
+}

+ 29
- 0
ruoyi-system/src/main/java/com/ruoyi/bestsign/domain/PersonRegisterVO.java 查看文件

@@ -0,0 +1,29 @@
1
+package com.ruoyi.bestsign.domain;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Builder;
5
+import lombok.Data;
6
+import lombok.NoArgsConstructor;
7
+
8
+@Data
9
+@NoArgsConstructor
10
+@AllArgsConstructor
11
+@Builder
12
+public class PersonRegisterVO {
13
+    /**
14
+     * 用户帐号
15
+     * 用户名称
16
+     * 用户类型
17
+     * 用户邮箱
18
+     * 用户手机号
19
+     * 用户证件信息对象
20
+     * 是否申请证书
21
+     */
22
+    private String account;
23
+    private String name;
24
+    private String userType;
25
+    private String mail;
26
+    private String mobile;
27
+    private CredentialVO credential;
28
+    private String applyCert;
29
+}

+ 12
- 0
ruoyi-system/src/main/java/com/ruoyi/bestsign/service/ArbitrSignatuService.java 查看文件

@@ -0,0 +1,12 @@
1
+package com.ruoyi.bestsign.service;
2
+
3
+import com.ruoyi.bestsign.domain.ArbitrSignatuVO;
4
+import com.ruoyi.common.core.domain.AjaxResult;
5
+
6
+public interface ArbitrSignatuService {
7
+
8
+
9
+    AjaxResult selectApplyStatus(ArbitrSignatuVO arbitrSignatuVO);
10
+
11
+
12
+}

+ 18
- 0
ruoyi-system/src/main/java/com/ruoyi/bestsign/service/SignRegisterService.java 查看文件

@@ -0,0 +1,18 @@
1
+package com.ruoyi.bestsign.service;
2
+
3
+import com.ruoyi.bestsign.domain.PersonRegisterVO;
4
+import com.ruoyi.common.core.domain.AjaxResult;
5
+
6
+public interface SignRegisterService {
7
+    /**
8
+     * 注册上上签个人用户
9
+     *
10
+     * @param personRegisterVO
11
+     * @return
12
+     */
13
+    AjaxResult registerPerson(PersonRegisterVO personRegisterVO);
14
+    /**
15
+     * 查询用户认证状态/user/async/applyCert/status/
16
+     */
17
+    AjaxResult queryRegisterStatus(PersonRegisterVO personRegisterVO);
18
+}

+ 29
- 0
ruoyi-system/src/main/java/com/ruoyi/bestsign/service/impl/ArbitrSignatuServiceImpl.java 查看文件

@@ -0,0 +1,29 @@
1
+package com.ruoyi.bestsign.service.impl;
2
+
3
+import com.ruoyi.bestsign.domain.ArbitrSignatuVO;
4
+import com.ruoyi.bestsign.service.ArbitrSignatuService;
5
+import com.ruoyi.bestsign.utils.BestsignOpenApiClient;
6
+import com.ruoyi.common.core.domain.AjaxResult;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.stereotype.Service;
9
+
10
+@Service
11
+public class ArbitrSignatuServiceImpl implements ArbitrSignatuService {
12
+    @Autowired
13
+    BestsignOpenApiClient bestsignOpenApiClient;
14
+
15
+
16
+    @Override
17
+    public AjaxResult selectApplyStatus(ArbitrSignatuVO arbitrSignatuVO) {
18
+        String strRespon = "";
19
+        try {
20
+            strRespon = bestsignOpenApiClient.selectApplyStatus(arbitrSignatuVO.getAccount(),
21
+                    arbitrSignatuVO.getTaskId());
22
+        } catch (Exception e) {
23
+            e.printStackTrace();
24
+            return AjaxResult.error(e.getMessage());
25
+        }
26
+        return AjaxResult.success(strRespon);
27
+
28
+    }
29
+}

+ 63
- 0
ruoyi-system/src/main/java/com/ruoyi/bestsign/service/impl/RegisterServiceImpl.java 查看文件

@@ -0,0 +1,63 @@
1
+package com.ruoyi.bestsign.service.impl;
2
+
3
+
4
+import com.alibaba.fastjson.JSONObject;
5
+import com.ruoyi.bestsign.domain.PersonRegisterVO;
6
+import com.ruoyi.bestsign.service.SignRegisterService;
7
+import com.ruoyi.bestsign.utils.BestsignOpenApiClient;
8
+import com.ruoyi.common.core.domain.AjaxResult;
9
+import org.springframework.beans.factory.annotation.Autowired;
10
+import org.springframework.stereotype.Service;
11
+
12
+@Service
13
+public class RegisterServiceImpl implements SignRegisterService {
14
+    @Autowired
15
+    BestsignOpenApiClient bestsignOpenApiClient;
16
+
17
+    /**
18
+     * 注册上上签个人用户
19
+     *
20
+     * @param personRegisterVO
21
+     * @return
22
+     */
23
+    @Override
24
+    public AjaxResult registerPerson(PersonRegisterVO personRegisterVO) {
25
+        try {
26
+            JSONObject jsonObject = bestsignOpenApiClient.userPersonalReg(personRegisterVO.getAccount(),
27
+                    personRegisterVO.getName(),
28
+                    personRegisterVO.getMail(),
29
+                    personRegisterVO.getMobile(),
30
+                    personRegisterVO.getCredential().getIdentity(),
31
+                    personRegisterVO.getCredential().getIdentityType(),
32
+                    null, null, null, null, null, "/user/reg/");
33
+            AjaxResult.success(jsonObject);
34
+        } catch (Exception e) {
35
+            e.printStackTrace();
36
+            return AjaxResult.error(e.getMessage());
37
+        }
38
+        return AjaxResult.success();
39
+    }
40
+
41
+    /**
42
+     * 查询用户认证状态/user/async/applyCert/status/
43
+     *
44
+     * @param personRegisterVO
45
+     */
46
+    @Override
47
+    public AjaxResult queryRegisterStatus(PersonRegisterVO personRegisterVO) {
48
+        try {
49
+            JSONObject jsonObject = bestsignOpenApiClient.userPersonalReg(personRegisterVO.getAccount(),
50
+                    personRegisterVO.getName(),
51
+                    personRegisterVO.getMail(),
52
+                    personRegisterVO.getMobile(),
53
+                    personRegisterVO.getCredential().getIdentity(),
54
+                    personRegisterVO.getCredential().getIdentityType(),
55
+                    null, null, null, null, null, "/user/async/applyCert/status/");
56
+            AjaxResult.success(jsonObject);
57
+        } catch (Exception e) {
58
+            e.printStackTrace();
59
+            return AjaxResult.error(e.getMessage());
60
+        }
61
+        return AjaxResult.success();
62
+    }
63
+}

+ 286
- 0
ruoyi-system/src/main/java/com/ruoyi/bestsign/utils/BestsignOpenApiClient.java 查看文件

@@ -0,0 +1,286 @@
1
+package com.ruoyi.bestsign.utils;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.alibaba.fastjson.JSONArray;
5
+import com.alibaba.fastjson.JSONObject;
6
+import com.ruoyi.bestsign.domain.ArbitrSignatuVO;
7
+import lombok.Data;
8
+import lombok.extern.slf4j.Slf4j;
9
+import org.springframework.beans.factory.annotation.Value;
10
+import org.springframework.stereotype.Component;
11
+
12
+import javax.validation.constraints.NotNull;
13
+import java.io.IOException;
14
+
15
+/**
16
+ * 上上签混合云SDK客户端
17
+ */
18
+@Component
19
+@Data
20
+@Slf4j
21
+public class BestsignOpenApiClient {
22
+    /**
23
+     * 开发者id
24
+     */
25
+    @Value("${ssq.developerId}")
26
+    private String developerId;
27
+    /**
28
+     * 开发者私钥
29
+     */
30
+    @Value("${ssq.privateKey}")
31
+    private String privateKey;
32
+    /**
33
+     * Host地址
34
+     */
35
+    @Value("${ssq.serverHost}")
36
+    private String serverHost;
37
+    /**
38
+     * 签名参数
39
+     */
40
+    private static String urlSignParams = "?developerId=%s&rtick=%s&signType=rsa&sign=%s";
41
+
42
+//	public BestsignOpenApiClient(String developerId, String privateKey,
43
+//                                 String serverHost) {
44
+//		this.developerId = developerIds;
45
+//		this.privateKey = privateKey;
46
+//		this.serverHost = serverHost;
47
+//	}
48
+
49
+    /**
50
+     * POST方法示例
51
+     * 个人用户注册
52
+     *
53
+     * @param account       用户账号
54
+     * @param name          姓名
55
+     * @param mail          用来接收通知邮件的电子邮箱
56
+     * @param mobile        用来接收通知短信的手机号码
57
+     * @param identity      证件号码
58
+     * @param identityType  枚举值:0-身份证,目前仅支持身份证
59
+     * @param contactMail   电子邮箱
60
+     * @param contactMobile 手机号码
61
+     * @param province      省份
62
+     * @param city          城市
63
+     * @param address       地址
64
+     * @param method        地址
65
+     * @return 异步申请任务单号
66
+     * @throws IOException
67
+     */
68
+    public JSONObject userPersonalReg(String account, String name, String mail,
69
+                                      String mobile, String identity, String identityType,
70
+                                      String contactMail, String contactMobile, String province,
71
+                                      String city, String address, @NotNull String method) throws Exception {
72
+        //body参数
73
+        JSONObject requestBody = new JSONObject();
74
+
75
+        //用户帐号
76
+        requestBody.put("account", account);
77
+        //用户名称
78
+        requestBody.put("name", name);
79
+        //用户类型
80
+        requestBody.put("userType", "1");
81
+        //用户邮箱
82
+        requestBody.put("mail", mail);
83
+        //用户手机号
84
+        requestBody.put("mobile", mobile);
85
+        //用户证件信息对象
86
+        JSONObject credential = new JSONObject();
87
+        //用户证件号
88
+        credential.put("identity", identity);
89
+        //用户证件类型
90
+        credential.put("identityType", identityType);
91
+        requestBody.put("credential", credential);
92
+
93
+        //是否申请证书
94
+        requestBody.put("applyCert", "1");
95
+        // 生成一个时间戳参数
96
+        String rtick = RSAUtils.getRtick();
97
+        // 计算参数签名
98
+        String paramsSign = RSAUtils.calcRsaSign(this.developerId,
99
+                this.privateKey, this.serverHost, method, rtick, null,
100
+                requestBody.toJSONString());
101
+        // 签名参数追加为url参数
102
+        String fullUrlParams = String.format(urlSignParams, this.developerId,
103
+                rtick, paramsSign);
104
+
105
+        // 发送POST请求
106
+        String responseBody = HttpClientSender.sendHttpPost(this.serverHost, method,
107
+                fullUrlParams, requestBody.toJSONString());
108
+        System.out.println(responseBody);
109
+        // 返回结果解析
110
+        JSONObject userObj = JSON.parseObject(responseBody);
111
+        System.out.println(JSON.toJSONString(userObj));
112
+        return userObj;
113
+        // 返回errno为0,表示成功,其他表示失败
114
+//        if (userObj.getIntValue("errno") == 0) {
115
+//            JSONObject data = userObj.getJSONObject("data");
116
+//            if (data != null) {
117
+//                //对返回data进行处理
118
+//                String taskId = data.getString("taskId");
119
+//                return taskId;
120
+//            }
121
+//            return null;
122
+//        } else {
123
+//            //接口返回异常
124
+//            System.out.println(userObj.getIntValue("errno"));
125
+//            System.out.println(userObj.getString("errmsg"));
126
+//            throw new Exception(userObj.getIntValue("errno") + ":"
127
+//                    + userObj.getString("errmsg"));
128
+//        }
129
+    }
130
+
131
+
132
+    /**
133
+     * GET方法示例
134
+     * 下载合同PDF文件
135
+     *
136
+     * @param contractId 合同编号
137
+     * @return
138
+     * @throws Exception
139
+     */
140
+    public byte[] contractDownload(String contractId) throws Exception {
141
+        String host = this.serverHost;
142
+        String method = "/storage/contract/download/";
143
+
144
+        // 组装url参数
145
+        String urlParams = "contractId=" + contractId;
146
+
147
+        // 生成一个时间戳参数
148
+        String rtick = RSAUtils.getRtick();
149
+        // 计算参数签名
150
+        String paramsSign = RSAUtils.calcRsaSign(this.developerId,
151
+                this.privateKey, host, method, rtick, urlParams, null);
152
+        // 签名参数追加为url参数
153
+        urlParams = String.format(urlSignParams, this.developerId, rtick,
154
+                paramsSign) + "&" + urlParams;
155
+        // 发送请求
156
+        byte[] responseBody = HttpClientSender.sendHttpGet(host, method,
157
+                urlParams);
158
+        // 返回结果解析
159
+        return responseBody;
160
+    }
161
+
162
+    public String selectApplyStatus(String account, String taskId) throws Exception {
163
+        String methodInvoke = "/user/async/applyCert/status/";
164
+        JSONObject requestParam = new JSONObject();
165
+
166
+        //用户账号
167
+        requestParam.put("account", account);
168
+        //任务单号
169
+        requestParam.put("taskId", taskId);
170
+        String timestamsParam = RSAUtils.getRtick();
171
+        // 计算参数签名
172
+        String paramsSign = RSAUtils.calcRsaSign(this.developerId,
173
+                this.privateKey, this.serverHost, methodInvoke, timestamsParam, null,
174
+                requestParam.toJSONString());
175
+        // 签名参数追加为url参数
176
+        String fullUrlParams = String.format(urlSignParams, this.developerId,
177
+                timestamsParam, paramsSign);
178
+        String responseResult = HttpClientSender.sendHttpPost(this.serverHost, methodInvoke,
179
+                fullUrlParams, requestParam.toJSONString());
180
+        JSONObject responseObj = JSON.parseObject(responseResult);
181
+        // 返回errno为0,表示成功,其他表示失败
182
+        if (responseObj.getIntValue("errno") == 0) {
183
+            JSONObject data = responseObj.getJSONObject("data");
184
+            if (data != null) {
185
+                String message = data.getString("message");
186
+                String status = data.getString("status");
187
+                return status;
188
+            }
189
+        } else {
190
+
191
+            log.error("查询申请状态异常:" + responseObj.toJSONString());
192
+        }
193
+        return responseObj.toJSONString();
194
+    }
195
+
196
+    
197
+
198
+    /**
199
+     * 获取签署链接
200
+     *
201
+     * @param arbitrSignatuVO
202
+     * @return
203
+     * @throws Exception
204
+     */
205
+    public String getSignLink(ArbitrSignatuVO arbitrSignatuVO) throws Exception {
206
+        String methodInvoke = "/contract/send/";
207
+        JSONObject requestParam = new JSONObject();
208
+
209
+        requestParam.put("contractId", arbitrSignatuVO.getContractNum());
210
+        requestParam.put("signer", arbitrSignatuVO.getSignerAccout());
211
+
212
+        JSONArray signatureArray = new JSONArray();
213
+
214
+        JSONObject signatuItem = new JSONObject();
215
+        signatuItem.put("pageNum", arbitrSignatuVO.getPageNumSigner());
216
+        //x坐标
217
+        signatuItem.put("x", arbitrSignatuVO.getPageNumSignerX());
218
+        //y坐标
219
+        signatuItem.put("y", arbitrSignatuVO.getPageNumSignerY());
220
+        signatureArray.add(signatuItem);
221
+
222
+        requestParam.put("signaturePositions", signatureArray);
223
+
224
+
225
+        String timestamsParam = RSAUtils.getRtick();
226
+        // 计算参数签名
227
+        String paramsSign = RSAUtils.calcRsaSign(this.developerId,
228
+                this.privateKey, this.serverHost, methodInvoke, timestamsParam, null,
229
+                requestParam.toJSONString());
230
+        // 签名参数追加为url参数
231
+        String fullUrlParams = String.format(urlSignParams, this.developerId,
232
+                timestamsParam, paramsSign);
233
+        String responseResult = HttpClientSender.sendHttpPost(this.serverHost, methodInvoke,
234
+                fullUrlParams, requestParam.toJSONString());
235
+        JSONObject responseObj = JSON.parseObject(responseResult);
236
+        // 返回errno为0,表示成功,其他表示失败
237
+        if (responseObj.getIntValue("errno") == 0) {
238
+            JSONObject data = responseObj.getJSONObject("data");
239
+            if (data != null) {
240
+                String signLink = data.getString("url");
241
+                return signLink;
242
+            }
243
+        } else {
244
+
245
+            log.error("获取签署链接异常:" + responseObj.toJSONString());
246
+        }
247
+        return responseObj.toJSONString();
248
+    }
249
+
250
+    /**
251
+     * 完成签署
252
+     *
253
+     * @param arbitrSignatuVO
254
+     * @return
255
+     * @throws Exception
256
+     */
257
+    public String finishSign(ArbitrSignatuVO arbitrSignatuVO) throws Exception {
258
+        String methodInvoke = "/storage/contract/lock/";
259
+        JSONObject requestParam = new JSONObject();
260
+        requestParam.put("contractId", arbitrSignatuVO.getContractNum());
261
+        String timestamsParam = RSAUtils.getRtick();
262
+        // 计算参数签名
263
+        String paramsSign = RSAUtils.calcRsaSign(this.developerId,
264
+                this.privateKey, this.serverHost, methodInvoke, timestamsParam, null,
265
+                requestParam.toJSONString());
266
+        // 签名参数追加为url参数
267
+        String fullUrlParams = String.format(urlSignParams, this.developerId,
268
+                timestamsParam, paramsSign);
269
+        String responseResult = HttpClientSender.sendHttpPost(this.serverHost, methodInvoke,
270
+                fullUrlParams, requestParam.toJSONString());
271
+        JSONObject responseObj = JSON.parseObject(responseResult);
272
+        // 返回errno为0,表示成功,其他表示失败
273
+        if (responseObj.getIntValue("errno") == 0) {
274
+            return "完成签名";
275
+        } else {
276
+
277
+            log.error("完成签署异常:" + responseObj.toJSONString());
278
+        }
279
+        return responseObj.toJSONString();
280
+    }
281
+
282
+
283
+
284
+
285
+
286
+}

+ 390
- 0
ruoyi-system/src/main/java/com/ruoyi/bestsign/utils/HttpClientSender.java 查看文件

@@ -0,0 +1,390 @@
1
+package com.ruoyi.bestsign.utils;
2
+
3
+import org.apache.http.HttpEntity;
4
+import org.apache.http.client.config.RequestConfig;
5
+import org.apache.http.client.methods.CloseableHttpResponse;
6
+import org.apache.http.client.methods.HttpGet;
7
+import org.apache.http.client.methods.HttpPost;
8
+import org.apache.http.config.Registry;
9
+import org.apache.http.config.RegistryBuilder;
10
+import org.apache.http.conn.socket.ConnectionSocketFactory;
11
+import org.apache.http.conn.socket.PlainConnectionSocketFactory;
12
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
13
+import org.apache.http.entity.StringEntity;
14
+import org.apache.http.impl.client.CloseableHttpClient;
15
+import org.apache.http.impl.client.HttpClients;
16
+import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
17
+import org.apache.http.util.EntityUtils;
18
+
19
+import javax.net.ssl.SSLContext;
20
+import javax.net.ssl.TrustManager;
21
+import javax.net.ssl.X509TrustManager;
22
+import java.io.IOException;
23
+import java.io.InputStream;
24
+import java.io.UnsupportedEncodingException;
25
+import java.net.MalformedURLException;
26
+import java.net.URL;
27
+import java.net.URLEncoder;
28
+import java.security.cert.CertificateException;
29
+import java.security.cert.X509Certificate;
30
+import java.util.HashMap;
31
+import java.util.Map;
32
+
33
+public class HttpClientSender {
34
+
35
+    private static PoolingHttpClientConnectionManager poolingHttpClientConnectionManager = null;
36
+    private static Map<String, CloseableHttpClient> httpClients = new HashMap<String, CloseableHttpClient>();
37
+
38
+    private static Object o = new Object();
39
+
40
+    public static String sendHttpPost(String host, String method, String urlParams, String sendData) throws IOException {
41
+
42
+        String requestUrl = host + method + urlParams;
43
+
44
+        Map<String, Object> response = request("POST", requestUrl, sendData, null);
45
+        int responseCode = Integer.parseInt(response.get("responseCode").toString());
46
+        byte[] responseBytes = (byte[]) response.get("responseData");
47
+        String responseString;
48
+        try {
49
+            responseString = new String(responseBytes, "UTF-8");
50
+        } catch (UnsupportedEncodingException e) {
51
+            responseString = new String(responseBytes);
52
+        }
53
+        //请求返回结果无论成功失败,http-status均为200
54
+        if (responseCode == 200) {
55
+            //返回结果
56
+            return responseString;
57
+        } else {
58
+            throw new IOException(responseCode + ":" + responseString);
59
+        }
60
+    }
61
+
62
+    public static byte[] sendHttpGet(String host, String method, String urlParams) throws IOException {
63
+        String requestUrl = host + method + urlParams;
64
+        Map<String, Object> response = request("GET", requestUrl, null, null);
65
+        int responseCode = Integer.parseInt(response.get("responseCode").toString());
66
+        byte[] responseBytes = (byte[]) response.get("responseData");
67
+        //请求返回结果无论成功失败,http-status均为200
68
+        if (responseCode == 200) {
69
+            //返回结果
70
+            return responseBytes;
71
+        } else {
72
+            throw new IOException(responseCode + "");
73
+        }
74
+    }
75
+
76
+    public static String urlencode(String data) {
77
+        return urlencode(data, "UTF-8");
78
+    }
79
+
80
+    public static String urlencode(String data, String charset) {
81
+        try {
82
+            return URLEncoder.encode(data, charset);
83
+        } catch (UnsupportedEncodingException e) {
84
+            throw new RuntimeException(e.getMessage(), e);
85
+        }
86
+    }
87
+
88
+    public static Map<String, Object> request(String method, String url, Object sendData, Map<String, String> headers) throws IOException {
89
+
90
+
91
+        String requestPath;
92
+        try {
93
+            requestPath = new URL(url).getPath();
94
+        } catch (MalformedURLException e) {
95
+            throw new RuntimeException(e.getMessage(), e);
96
+        }
97
+        CloseableHttpClient httpClient = getHttpClient(requestPath);
98
+
99
+        Map<String, Object> response = null;
100
+        if ("POST".equals(method)) {
101
+            response = sendPost(httpClient, url, headers, sendData);
102
+        } else {
103
+            response = sendGet(httpClient, url, headers);
104
+        }
105
+        return response;
106
+    }
107
+
108
+    private static Map<String, Object> sendPost(CloseableHttpClient httpClient, String url, Map<String, String> headers, Object sendData) throws IOException {
109
+        String tag = "[HttpRequester] [POST " + url + "]";
110
+        int responseCode = -1;
111
+        byte[] responseBytes = null;
112
+
113
+        HttpPost request = new HttpPost(url);
114
+        if (headers != null && headers.size() > 0) {
115
+            for (String name : headers.keySet()) {
116
+                String value = headers.get(name);
117
+                request.setHeader(name, value);
118
+            }
119
+        }
120
+        if (sendData != null) {
121
+            StringEntity stringEntity = new StringEntity((String) sendData, "UTF-8");
122
+            stringEntity.setContentType("application/json");
123
+            request.setEntity(stringEntity);
124
+
125
+            HttpEntity httpEntity = null;
126
+            IOException exception = null;
127
+            for (int i = 0; i < 3; i++) {
128
+                try {
129
+                    CloseableHttpResponse response = httpClient.execute(request);
130
+                    responseCode = response.getStatusLine().getStatusCode();
131
+                    httpEntity = response.getEntity();
132
+
133
+                    String responseBody = EntityUtils.toString(httpEntity, "utf-8");
134
+                    if (responseBody != null) {
135
+                        responseBytes = responseBody.getBytes();
136
+                    } else {
137
+                        InputStream respStream = null;
138
+                        try {
139
+                            respStream = httpEntity.getContent();
140
+                            int respBodySize = respStream.available();
141
+                            if (respBodySize <= 0)
142
+                                throw new IOException("Invalid respBodySize: " + respBodySize);
143
+                            responseBytes = new byte[respBodySize];
144
+                            if (respStream.read(responseBytes) != respBodySize)
145
+                                throw new IOException("Read respBody Error");
146
+                        } catch (Exception e) {
147
+                        } finally {
148
+                            if (respStream != null) {
149
+                                respStream.close();
150
+                            }
151
+                        }
152
+                    }
153
+
154
+                    exception = null;
155
+                    break;
156
+                } catch (UnsupportedOperationException e) {
157
+                    try {
158
+                        EntityUtils.consume(httpEntity);
159
+                    } catch (IOException e2) {
160
+
161
+                    }
162
+                    throw new RuntimeException(e.getMessage(), e);
163
+                } catch (IOException e) {
164
+                    e.printStackTrace();
165
+                    exception = e;
166
+                    try {
167
+                        EntityUtils.consume(httpEntity);
168
+                    } catch (IOException e2) {
169
+
170
+                    }
171
+                    if (i < 2) {
172
+                        try {
173
+                            Thread.sleep(5);
174
+                        } catch (InterruptedException e2) {
175
+
176
+                        }
177
+                    }
178
+                }
179
+            }
180
+            if (exception != null) {
181
+                throw exception;
182
+            }
183
+
184
+        }
185
+        Map<String, Object> response = new HashMap<String, Object>();
186
+        response.put("responseCode", responseCode);
187
+        response.put("responseData", responseBytes);
188
+        String loggerResponseString = getLoggerString(responseBytes, 256);
189
+        return response;
190
+    }
191
+
192
+    private static Map<String, Object> sendGet(CloseableHttpClient httpClient, String url, Map<String, String> headers) throws IOException {
193
+        String tag = "[HttpRequester] [GET " + url + "]";
194
+        int responseCode = -1;
195
+        byte[] responseBytes = null;
196
+
197
+        HttpGet request = new HttpGet(url);
198
+        if (headers != null && headers.size() > 0) {
199
+            for (String name : headers.keySet()) {
200
+                String value = headers.get(name);
201
+                request.setHeader(name, value);
202
+            }
203
+        }
204
+        HttpEntity httpEntity = null;
205
+        IOException exception = null;
206
+        for (int i = 0; i < 3; i++) {
207
+            try {
208
+                CloseableHttpResponse response = httpClient.execute(request);
209
+                responseCode = response.getStatusLine().getStatusCode();
210
+                httpEntity = response.getEntity();
211
+
212
+                byte[] responseBody = EntityUtils.toByteArray(httpEntity);
213
+                if (responseBody != null) {
214
+                    responseBytes = responseBody;
215
+                } else {
216
+                    InputStream respStream = null;
217
+                    try {
218
+                        respStream = httpEntity.getContent();
219
+                        int respBodySize = respStream.available();
220
+                        if (respBodySize <= 0)
221
+                            throw new IOException("Invalid respBodySize: " + respBodySize);
222
+                        responseBytes = new byte[respBodySize];
223
+                        if (respStream.read(responseBytes) != respBodySize)
224
+                            throw new IOException("Read respBody Error");
225
+                    } catch (Exception e) {
226
+                    } finally {
227
+                        if (respStream != null) {
228
+                            respStream.close();
229
+                        }
230
+                    }
231
+                }
232
+
233
+                exception = null;
234
+                break;
235
+            } catch (UnsupportedOperationException e) {
236
+                try {
237
+                    EntityUtils.consume(httpEntity);
238
+                } catch (IOException e2) {
239
+
240
+                }
241
+                throw new RuntimeException(e.getMessage(), e);
242
+            } catch (IOException e) {
243
+                e.printStackTrace();
244
+                exception = e;
245
+                try {
246
+                    EntityUtils.consume(httpEntity);
247
+                } catch (IOException e2) {
248
+
249
+                }
250
+                if (i < 2) {
251
+                    try {
252
+                        Thread.sleep(5);
253
+                    } catch (InterruptedException e2) {
254
+
255
+                    }
256
+                }
257
+            }
258
+        }
259
+        if (exception != null) {
260
+            throw exception;
261
+        }
262
+        Map<String, Object> response = new HashMap<String, Object>();
263
+        response.put("responseCode", responseCode);
264
+        response.put("responseData", responseBytes);
265
+        String loggerResponseString = getLoggerString(responseBytes, 256);
266
+        System.out.println(tag + " response " + responseCode + " " + loggerResponseString);
267
+        return response;
268
+    }
269
+
270
+    private static String getLoggerString(final byte[] data, int maxLength) {
271
+        String loggerString;
272
+        if (data.length > maxLength) {
273
+            byte[] shortData = new byte[maxLength];
274
+            System.arraycopy(data, 0, shortData, 0, shortData.length);
275
+            try {
276
+                loggerString = new String(shortData, "UTF-8") + "...";
277
+            } catch (UnsupportedEncodingException e) {
278
+                loggerString = new String(shortData) + "...";
279
+            }
280
+        } else {
281
+            try {
282
+                loggerString = new String(data, "UTF-8");
283
+            } catch (UnsupportedEncodingException e) {
284
+                loggerString = new String(data);
285
+            }
286
+        }
287
+
288
+        char[] chars = new char[loggerString.length()];
289
+        loggerString.getChars(0, loggerString.length(), chars, 0);
290
+        for (int i = 0; i < chars.length; i++) {
291
+            char c = chars[i];
292
+            if (c == '\n' || c == '\r') {
293
+                chars[i] = ' ';
294
+            }
295
+        }
296
+        return new String(chars);
297
+    }
298
+
299
+    private static CloseableHttpClient getHttpClient(String requestPath) {
300
+        if (httpClients.containsKey(requestPath)) {
301
+            return httpClients.get(requestPath);
302
+        }
303
+        if (poolingHttpClientConnectionManager == null) {
304
+            synchronized (o) {
305
+                if (poolingHttpClientConnectionManager == null) {
306
+                    poolingHttpClientConnectionManager = HttpClientUtils.createHttpClientConnectionManager();
307
+                }
308
+            }
309
+        }
310
+        synchronized (httpClients) {
311
+            if (httpClients.containsKey(requestPath)) {
312
+                return httpClients.get(requestPath);
313
+            }
314
+            CloseableHttpClient httpClient = HttpClientUtils.createHttpClient(poolingHttpClientConnectionManager);
315
+            httpClients.put(requestPath, httpClient);
316
+            return httpClient;
317
+        }
318
+    }
319
+
320
+    private static class HttpClientUtils {
321
+
322
+        // 默认连接超时
323
+        private static int defaultConnectTimeout = 6000;
324
+        // 默认读取超时
325
+        private static int defaultReadTimeout = 30000;
326
+
327
+        public static CloseableHttpClient createHttpClient(PoolingHttpClientConnectionManager connManager) {
328
+            //HttpHost httpHost = new HttpHost("10.211.55.4", 8888);
329
+            CloseableHttpClient httpClient = HttpClients.custom()
330
+                    //.setProxy(httpHost)
331
+                    .setConnectionManager(connManager)
332
+                    .disableContentCompression()
333
+                    .setSSLContext(getSslcontext())
334
+                    .setDefaultRequestConfig(getRequestConfig())
335
+                    .build();
336
+            return httpClient;
337
+        }
338
+
339
+        public static PoolingHttpClientConnectionManager createHttpClientConnectionManager() {
340
+            SSLConnectionSocketFactory sslConnectionSocketFactory = null;
341
+            try {
342
+                sslConnectionSocketFactory = new SSLConnectionSocketFactory(getSslcontext(), SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
343
+            } catch (Exception e) {
344
+                throw new RuntimeException(e.getMessage(), e);
345
+            }
346
+            Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
347
+                    .register("https", sslConnectionSocketFactory)
348
+                    .register("http", new PlainConnectionSocketFactory())
349
+                    .build();
350
+            PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
351
+            cm.setMaxTotal(500);
352
+            cm.setDefaultMaxPerRoute(500);
353
+            return cm;
354
+        }
355
+
356
+        private static RequestConfig getRequestConfig() {
357
+            RequestConfig defaultRequestConfig = RequestConfig.custom()
358
+                    .setConnectionRequestTimeout(defaultConnectTimeout)
359
+                    .setSocketTimeout(defaultReadTimeout)
360
+                    .build();
361
+            return defaultRequestConfig;
362
+        }
363
+
364
+        private static SSLContext getSslcontext() {
365
+            SSLContext sslContext = null;
366
+            try {
367
+                sslContext = SSLContext.getInstance("TLS");
368
+                TrustManager tm = new X509TrustManager() {
369
+                    @Override
370
+                    public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
371
+                    }
372
+
373
+                    @Override
374
+                    public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
375
+                    }
376
+
377
+                    @Override
378
+                    public X509Certificate[] getAcceptedIssuers() {
379
+                        return null;
380
+                    }
381
+                };
382
+                sslContext.init(null, new TrustManager[]{tm}, null);
383
+
384
+            } catch (Exception e) {
385
+                e.printStackTrace();
386
+            }
387
+            return sslContext;
388
+        }
389
+    }
390
+}

+ 281
- 0
ruoyi-system/src/main/java/com/ruoyi/bestsign/utils/RSAUtils.java 查看文件

@@ -0,0 +1,281 @@
1
+package com.ruoyi.bestsign.utils;
2
+
3
+import org.apache.commons.codec.binary.Base64;
4
+
5
+import java.io.ByteArrayOutputStream;
6
+import java.io.IOException;
7
+import java.io.UnsupportedEncodingException;
8
+import java.net.MalformedURLException;
9
+import java.net.URL;
10
+import java.net.URLEncoder;
11
+import java.nio.charset.Charset;
12
+import java.security.*;
13
+import java.security.spec.InvalidKeySpecException;
14
+import java.security.spec.PKCS8EncodedKeySpec;
15
+import java.util.Date;
16
+import java.util.Map;
17
+import java.util.TreeMap;
18
+
19
+/**
20
+ * 参数签名算法工具类
21
+ */
22
+public class RSAUtils {
23
+
24
+    /**
25
+     * 获取当前的时间戳参数
26
+     * @return
27
+     */
28
+    public static String getRtick(){
29
+        long timestamp = System.currentTimeMillis();
30
+        int rnd = (int)Math.random() * 1000;
31
+        String rtick = timestamp + "" + rnd;
32
+        return rtick;
33
+    }
34
+
35
+    /**
36
+     * 计算参数签名
37
+     * @param developerId 开发者ID
38
+     * @param privateKey 用户私钥
39
+     * @param host 请求的HOST地址(http://ip:port/context)
40
+     * @param methodName 请求的接口方法名
41
+     * @param rtick 时间戳参数
42
+     * @param urlParams url参数(param1=value1&param2=value2&param3=value3)
43
+     * @param requestBody request body 参数(JSON字符串)
44
+     * @return
45
+     */
46
+    public static String calcRsaSign(String developerId, String privateKey, String host, String methodName, String rtick, String urlParams, String requestBody) {
47
+        String url = host+methodName;
48
+
49
+        Map<String, String> mySignedURLParams = new TreeMap<String, String>();
50
+        mySignedURLParams.put("developerId", developerId);
51
+        mySignedURLParams.put("rtick", rtick);
52
+        mySignedURLParams.put("signType", "rsa");
53
+
54
+        if(urlParams != null && !"".equals(urlParams)){
55
+            String[] params = urlParams.split("&");
56
+            for(String p1 : params){
57
+                String[] p2 = p1.split("=");
58
+                String key = p2[0];
59
+                String value = "";
60
+                if(p2.length == 2){
61
+                    value = p2[1];
62
+                }
63
+                mySignedURLParams.put(key, value);
64
+            }
65
+        }
66
+
67
+        String requestPath;
68
+        try {
69
+            requestPath = new URL(url).getPath();
70
+        }
71
+        catch (MalformedURLException e) {
72
+            throw new RuntimeException(e.getMessage(), e);
73
+        }
74
+
75
+        StringBuilder signStringBuilder = new StringBuilder();
76
+        for (String name : mySignedURLParams.keySet()) {
77
+            String value = mySignedURLParams.get(name);
78
+            signStringBuilder.append(name);
79
+            signStringBuilder.append("=");
80
+            signStringBuilder.append(value);
81
+        }
82
+        signStringBuilder.append(requestPath);
83
+
84
+        if (requestBody != null && !"".equals(requestBody) ) {
85
+            String requestMd5 = getRequestMd5(requestBody);
86
+            signStringBuilder.append(requestMd5);
87
+        }
88
+
89
+        String signString = signStringBuilder.toString();
90
+        String rsaSign =  calcRsaSign(privateKey, signString);
91
+        //rsa算出来的sign,需要urlencode
92
+        try {
93
+            rsaSign = URLEncoder.encode(rsaSign,"UTF-8");
94
+        } catch (UnsupportedEncodingException e) {
95
+            rsaSign = null;
96
+        }
97
+        return rsaSign;
98
+    }
99
+
100
+    /**
101
+     * 获取request body 的MD5
102
+     * @param requestBody
103
+     * @return
104
+     */
105
+    private static String getRequestMd5(final String requestBody) {
106
+        byte[] data;
107
+
108
+        String newRequestBody = convertToUtf8(requestBody);
109
+        try {
110
+            data = newRequestBody.getBytes("UTF-8");
111
+        }
112
+        catch (UnsupportedEncodingException e) {
113
+            throw new RuntimeException(e.getMessage(), e);
114
+        }
115
+        return md5(data);
116
+    }
117
+
118
+    /**
119
+     * 计算参数RSA签名
120
+     * @param privateKey
121
+     * @param signData
122
+     * @return
123
+     */
124
+    private static String calcRsaSign(String privateKey, final String signData) {
125
+        byte[] data;
126
+        try {
127
+            data = signData.getBytes("UTF-8");
128
+        }
129
+        catch (UnsupportedEncodingException e) {
130
+            throw new RuntimeException(e.getMessage(), e);
131
+        }
132
+        byte[] sign = null;
133
+        // 解密由base64编码的私钥
134
+        byte[] privateKeyBytes = base64decode(privateKey.getBytes());
135
+
136
+        // 构造PKCS8EncodedKeySpec对象
137
+        PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(privateKeyBytes);
138
+
139
+        // KEY_ALGORITHM 指定的加密算法
140
+        KeyFactory keyFactory;
141
+        try {
142
+            keyFactory = KeyFactory.getInstance("RSA");
143
+        }
144
+        catch (NoSuchAlgorithmException e) {
145
+            throw new RuntimeException(e.getMessage(), e);
146
+        }
147
+
148
+        // 取私钥匙对象
149
+        PrivateKey priKey;
150
+        try {
151
+            priKey = keyFactory.generatePrivate(pkcs8KeySpec);
152
+        }
153
+        catch (InvalidKeySpecException e) {
154
+            throw new RuntimeException(e.getMessage(), e);
155
+        }
156
+
157
+        // 用私钥对信息生成数字签名
158
+        Signature signature;
159
+        try {
160
+            signature = Signature.getInstance("SHA1withRSA");
161
+        }
162
+        catch (NoSuchAlgorithmException e) {
163
+            throw new RuntimeException(e.getMessage(), e);
164
+        }
165
+        try {
166
+            signature.initSign(priKey);
167
+        }
168
+        catch (InvalidKeyException e) {
169
+            throw new RuntimeException(e.getMessage(), e);
170
+        }
171
+
172
+        try {
173
+            signature.update(data);
174
+            sign = signature.sign();
175
+        }
176
+        catch (SignatureException e) {
177
+            throw new RuntimeException(e.getMessage(), e);
178
+        }
179
+        return new String(base64encode(sign));
180
+    }
181
+
182
+    /**
183
+     * 转换字符集到utf8
184
+     *
185
+     * @param src
186
+     * @return
187
+     */
188
+    private static String convertToUtf8(String src) {
189
+        if (src == null || src.length() == 0) {
190
+            return src;
191
+        }
192
+        if ("UTF-8".equalsIgnoreCase(Charset.defaultCharset().name())) {
193
+            return src;
194
+        }
195
+
196
+        byte[] srcData = src.getBytes();
197
+        try {
198
+            return new String(srcData, "UTF-8");
199
+        }
200
+        catch (UnsupportedEncodingException e) {
201
+            throw new RuntimeException(e.getMessage(), e);
202
+        }
203
+    }
204
+
205
+    /**
206
+     * md5
207
+     * @param data
208
+     * @return
209
+     */
210
+    public static String md5(byte[] data) {
211
+        char hexDigits[]={'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
212
+        byte[] btInput = data;
213
+        // 获得MD5摘要算法的 MessageDigest 对象
214
+        MessageDigest mdInst;
215
+        try {
216
+            mdInst = MessageDigest.getInstance("MD5");
217
+        }
218
+        catch (NoSuchAlgorithmException e) {
219
+            throw new RuntimeException(e.getMessage(), e);
220
+        }
221
+        // 使用指定的字节更新摘要
222
+        mdInst.update(btInput);
223
+        // 获得密文
224
+        byte[] md = mdInst.digest();
225
+        // 把密文转换成十六进制的字符串形式
226
+        int j = md.length;
227
+        char str[] = new char[j * 2];
228
+        int k = 0;
229
+        for (int i = 0; i < j; i++) {
230
+            byte byte0 = md[i];
231
+            str[k++] = hexDigits[byte0 >>> 4 & 0xf];
232
+            str[k++] = hexDigits[byte0 & 0xf];
233
+        }
234
+        return new String(str);
235
+    }
236
+
237
+    /**
238
+     * base64编码
239
+     * @param data
240
+     * @return
241
+     */
242
+    public static byte[] base64encode(byte[] data) {
243
+        return Base64.encodeBase64(data);
244
+    }
245
+    
246
+    /**
247
+     * base64编码字符串
248
+     * @param data
249
+     * @return
250
+     */
251
+    public static String base64encodeString(byte[] data) {
252
+        return Base64.encodeBase64String(data);
253
+    }
254
+    
255
+    /**
256
+     * base64解码
257
+     * @param data
258
+     * @return
259
+     */
260
+    public static byte[] base64decode(byte[] data) {
261
+        try {
262
+            return Base64.decodeBase64(data);
263
+        } catch (Exception e) {
264
+            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
265
+            for (int i = 0; i < data.length; i++) {
266
+                byte c = data[i];
267
+                if (c == 13 || c == 10) {
268
+                    continue;
269
+                }
270
+                outputStream.write(c);
271
+            }
272
+            try {
273
+                outputStream.close();
274
+            } catch (IOException e2) {
275
+
276
+            }
277
+            data = outputStream.toByteArray();
278
+            return Base64.decodeBase64(data);
279
+        }
280
+    }
281
+}

+ 188
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/Adjudication.java 查看文件

@@ -0,0 +1,188 @@
1
+package com.ruoyi.wisdomarbitrate.domain;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class Adjudication {
7
+    /**
8
+     * 申请人姓名
9
+     */
10
+    private String appName;
11
+    /**
12
+     * 申请人性别
13
+     */
14
+    private String appSex;
15
+    /**
16
+     * 申请人身份证号码
17
+     */
18
+    private String appIDNo;
19
+    /**
20
+     * 申请人住所
21
+     */
22
+    private String appAddress;
23
+
24
+    /**
25
+     * 申请人代理人姓名
26
+     */
27
+    private String appAgentName;
28
+    /**
29
+     * 申请人代理人身份证
30
+     */
31
+    private String appAgentIDNo;
32
+    /**
33
+     * 被申请人姓名
34
+     */
35
+    private String resName;
36
+    /**
37
+     * 被申请人性别
38
+     */
39
+    private String resSex;
40
+    /**
41
+     * 被申请人身份证号码
42
+     */
43
+    private String resIDNo;
44
+    /**
45
+     * 被申请人住所
46
+     */
47
+    private String resAddress;
48
+
49
+    /**
50
+     * 被申请人代理人姓名
51
+     */
52
+    private String resAgentName;
53
+    /**
54
+     * 被申请人代理人身份证
55
+     */
56
+    private String resAgentIDNo;
57
+
58
+    /**
59
+     * 案件名称
60
+     */
61
+    private String caseName;
62
+
63
+    /**
64
+     * 仲裁员名称
65
+     */
66
+    private String arbitratorName;
67
+    /**
68
+     * 开庭年
69
+     */
70
+    private String hearYear;
71
+    /**
72
+     * 开庭月
73
+     */
74
+    private String hearMonths;
75
+    /**
76
+     * 开庭日
77
+     */
78
+    private String hearDay;
79
+
80
+    /**
81
+     * 申请人具体仲裁请求
82
+     */
83
+    private String appArbitrationClaims;
84
+
85
+    /**
86
+     * 申请人证据名称
87
+     */
88
+    private String appEvidenceName;
89
+
90
+    /**
91
+     * 申请人拟证事实
92
+     */
93
+    private String appProveFacts;
94
+    /**
95
+     * 被申请人对申请人答辩内容
96
+     */
97
+    private String resDefenseContentToApp;
98
+
99
+    /**
100
+     * 被申请人具体仲裁请求
101
+     */
102
+    private String resArbitrationClaims;
103
+    /**
104
+     * 被申请人证据名称
105
+     */
106
+    private String resEvidenceName;
107
+    /**
108
+     * 被申请人拟证事实
109
+     */
110
+    private String resProveFacts;
111
+    /**
112
+     * 申请人对被申请人答辩内容
113
+     */
114
+    private String appDefenseContentToRes;
115
+    /**
116
+     * 第三人答辩内容
117
+     */
118
+    private String thirdDefenseContent;
119
+    /**
120
+     * 第三人证据名称
121
+     */
122
+    private String thirdEvidenceName;
123
+    /**
124
+     * 第三人拟证事实
125
+     */
126
+    private String thirdProveFacts;
127
+    /**
128
+     * 申请人对第三人答辩内容
129
+     */
130
+    private String appDefenseContentToThird;
131
+    /**
132
+     * 被申请人对第三人答辩内容
133
+     */
134
+    private String resDefenseContentToThird;
135
+    /**
136
+     * 证据认定
137
+     */
138
+    private String evidenDetermi;
139
+    /**
140
+     * 认定事实
141
+     */
142
+    private String factDetermi;
143
+    /**
144
+     * 综上所述
145
+     */
146
+    private String caseSketch;
147
+    /**
148
+     * 本庭认为
149
+     */
150
+    private String arbitrateThink;
151
+    /**
152
+     * 裁决如下
153
+     */
154
+    private String rulingFollows;
155
+    /**
156
+     * 法律条款
157
+     */
158
+    private String legalProvisions;
159
+    /**
160
+     * 首席仲裁
161
+     */
162
+    private String umpire;
163
+    /**
164
+     * 仲裁员1
165
+     */
166
+    private String arbitratorName1;
167
+    /**
168
+     * 仲裁员2
169
+     */
170
+    private String arbitratorName2;
171
+    /**
172
+     * 年
173
+     */
174
+    private String year;
175
+    /**
176
+     * 月
177
+     */
178
+    private String months;
179
+    /**
180
+     * 日
181
+     */
182
+    private String day;
183
+    /**
184
+     * 书记员
185
+     */
186
+    private String clerk;
187
+
188
+}

+ 34
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/ArbitrateRecord.java 查看文件

@@ -0,0 +1,34 @@
1
+package com.ruoyi.wisdomarbitrate.domain;
2
+
3
+import com.ruoyi.common.core.domain.BaseEntity;
4
+import lombok.Data;
5
+
6
+@Data
7
+public class ArbitrateRecord     extends BaseEntity {
8
+    private static final long serialVersionUID = 1L;
9
+
10
+    /** ID */
11
+    private Long id;
12
+    /** 案件申请id */
13
+    private Long caseAppliId;
14
+    /** 证据认定 */
15
+    private String evidenDetermi;
16
+    /** 认定事实 */
17
+    private String factDetermi;
18
+    /** 综上所述 */
19
+    private String caseSketch;
20
+    /** 本庭认为 */
21
+    private String arbitrateThink;
22
+    /** 裁决如下 */
23
+    private String rulingFollows;
24
+    /** 核验裁决书意见 */
25
+    private String verificaOpinion;
26
+    /** 审核裁决书意见 */
27
+    private String checkOpinion;
28
+    /** 裁决书附件id */
29
+    private Integer annexId;
30
+
31
+
32
+
33
+
34
+}

+ 123
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/Arbitrator.java 查看文件

@@ -0,0 +1,123 @@
1
+package com.ruoyi.wisdomarbitrate.domain;
2
+
3
+import com.ruoyi.common.core.domain.BaseEntity;
4
+
5
+import java.util.List;
6
+
7
+public class Arbitrator    extends BaseEntity {
8
+    private static final long serialVersionUID = 1L;
9
+
10
+    /** ID */
11
+    private Long id;
12
+    /** 仲裁员姓名 */
13
+    private String arbitratorName;
14
+    /** 职称 */
15
+    private String title;
16
+    /** 职业 */
17
+    private String career;
18
+    /** 专业分类 */
19
+    private String professiClassifi;
20
+    /** 学历 */
21
+    private String education;
22
+    /** 所在地区 */
23
+    private String area;
24
+    /** 联系电话 */
25
+    private String telephone;
26
+
27
+    List<Long> idList;
28
+
29
+    public List<Long> getIdList() {
30
+        return idList;
31
+    }
32
+
33
+    public void setIdList(List<Long> idList) {
34
+        this.idList = idList;
35
+    }
36
+
37
+    public String getArbitratorName() {
38
+        return arbitratorName;
39
+    }
40
+
41
+    public void setArbitratorName(String arbitratorName) {
42
+        this.arbitratorName = arbitratorName;
43
+    }
44
+
45
+    /** 当前案件数量 */
46
+    private int currentCaseNum;
47
+    /** 已结案数量 */
48
+    private int closedCaseNum;
49
+
50
+    public Long getId() {
51
+        return id;
52
+    }
53
+
54
+    public void setId(Long id) {
55
+        this.id = id;
56
+    }
57
+
58
+
59
+
60
+    public String getTitle() {
61
+        return title;
62
+    }
63
+
64
+    public void setTitle(String title) {
65
+        this.title = title;
66
+    }
67
+
68
+    public String getCareer() {
69
+        return career;
70
+    }
71
+
72
+    public void setCareer(String career) {
73
+        this.career = career;
74
+    }
75
+
76
+    public String getProfessiClassifi() {
77
+        return professiClassifi;
78
+    }
79
+
80
+    public void setProfessiClassifi(String professiClassifi) {
81
+        this.professiClassifi = professiClassifi;
82
+    }
83
+
84
+    public String getEducation() {
85
+        return education;
86
+    }
87
+
88
+    public void setEducation(String education) {
89
+        this.education = education;
90
+    }
91
+
92
+    public String getArea() {
93
+        return area;
94
+    }
95
+
96
+    public void setArea(String area) {
97
+        this.area = area;
98
+    }
99
+
100
+    public String getTelephone() {
101
+        return telephone;
102
+    }
103
+
104
+    public void setTelephone(String telephone) {
105
+        this.telephone = telephone;
106
+    }
107
+
108
+    public int getCurrentCaseNum() {
109
+        return currentCaseNum;
110
+    }
111
+
112
+    public void setCurrentCaseNum(int currentCaseNum) {
113
+        this.currentCaseNum = currentCaseNum;
114
+    }
115
+
116
+    public int getClosedCaseNum() {
117
+        return closedCaseNum;
118
+    }
119
+
120
+    public void setClosedCaseNum(int closedCaseNum) {
121
+        this.closedCaseNum = closedCaseNum;
122
+    }
123
+}

+ 171
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseAffiliate.java 查看文件

@@ -0,0 +1,171 @@
1
+package com.ruoyi.wisdomarbitrate.domain;
2
+
3
+import com.ruoyi.common.annotation.Excel;
4
+import com.ruoyi.common.core.domain.BaseEntity;
5
+
6
+public class CaseAffiliate   extends BaseEntity {
7
+    private static final long serialVersionUID = 1L;
8
+    /** ID */
9
+    @Excel(name = "ID", cellType = Excel.ColumnType.NUMERIC, prompt = "ID")
10
+    private Long id;
11
+    /** 案件申请id */
12
+    private Long caseAppliId;
13
+    /** 身份类型 */
14
+    private int identityType;
15
+    /** 姓名 */
16
+    @Excel(name = "姓名")
17
+    private String name;
18
+    /** 身份证号 */
19
+    @Excel(name = "身份证号")
20
+    private String identityNum;
21
+    /** 单位电话 */
22
+    @Excel(name = "单位电话")
23
+    private String workTelphone;
24
+    /** 联系电话 */
25
+    @Excel(name = "联系电话")
26
+    private String contactTelphone;
27
+    /** 联系地址 */
28
+    @Excel(name = "联系地址")
29
+    private String contactAddress;
30
+    /** 单位地址 */
31
+    @Excel(name = "单位地址")
32
+    private String workAddress;
33
+
34
+    /** 代理人姓名 */
35
+    @Excel(name = "代理人姓名")
36
+    private String nameAgent;
37
+    /** 身份证号 */
38
+    @Excel(name = "代理人身份证号")
39
+    private String identityNumAgent;
40
+    /** 联系电话 */
41
+    @Excel(name = "代理人联系电话")
42
+    private String contactTelphoneAgent;
43
+    /** 联系地址 */
44
+    @Excel(name = "代理人联系地址")
45
+    private String contactAddressAgent;
46
+
47
+    /** 送达电子邮件 */
48
+    private String sendEmail;
49
+    /** 快递单号 */
50
+    private String trackNum;
51
+
52
+    public String getSendEmail() {
53
+        return sendEmail;
54
+    }
55
+
56
+    public void setSendEmail(String sendEmail) {
57
+        this.sendEmail = sendEmail;
58
+    }
59
+
60
+    public String getTrackNum() {
61
+        return trackNum;
62
+    }
63
+
64
+    public void setTrackNum(String trackNum) {
65
+        this.trackNum = trackNum;
66
+    }
67
+
68
+    public String getNameAgent() {
69
+        return nameAgent;
70
+    }
71
+
72
+    public void setNameAgent(String nameAgent) {
73
+        this.nameAgent = nameAgent;
74
+    }
75
+
76
+    public String getIdentityNumAgent() {
77
+        return identityNumAgent;
78
+    }
79
+
80
+    public void setIdentityNumAgent(String identityNumAgent) {
81
+        this.identityNumAgent = identityNumAgent;
82
+    }
83
+
84
+    public String getContactTelphoneAgent() {
85
+        return contactTelphoneAgent;
86
+    }
87
+
88
+    public void setContactTelphoneAgent(String contactTelphoneAgent) {
89
+        this.contactTelphoneAgent = contactTelphoneAgent;
90
+    }
91
+
92
+    public String getContactAddressAgent() {
93
+        return contactAddressAgent;
94
+    }
95
+
96
+    public void setContactAddressAgent(String contactAddressAgent) {
97
+        this.contactAddressAgent = contactAddressAgent;
98
+    }
99
+
100
+    public Long getId() {
101
+        return id;
102
+    }
103
+
104
+    public void setId(Long id) {
105
+        this.id = id;
106
+    }
107
+
108
+    public Long getCaseAppliId() {
109
+        return caseAppliId;
110
+    }
111
+
112
+    public void setCaseAppliId(Long caseAppliId) {
113
+        this.caseAppliId = caseAppliId;
114
+    }
115
+
116
+    public int getIdentityType() {
117
+        return identityType;
118
+    }
119
+
120
+    public void setIdentityType(int identityType) {
121
+        this.identityType = identityType;
122
+    }
123
+
124
+    public String getName() {
125
+        return name;
126
+    }
127
+
128
+    public void setName(String name) {
129
+        this.name = name;
130
+    }
131
+
132
+    public String getIdentityNum() {
133
+        return identityNum;
134
+    }
135
+
136
+    public void setIdentityNum(String identityNum) {
137
+        this.identityNum = identityNum;
138
+    }
139
+
140
+    public String getWorkTelphone() {
141
+        return workTelphone;
142
+    }
143
+
144
+    public void setWorkTelphone(String workTelphone) {
145
+        this.workTelphone = workTelphone;
146
+    }
147
+
148
+    public String getContactTelphone() {
149
+        return contactTelphone;
150
+    }
151
+
152
+    public void setContactTelphone(String contactTelphone) {
153
+        this.contactTelphone = contactTelphone;
154
+    }
155
+
156
+    public String getContactAddress() {
157
+        return contactAddress;
158
+    }
159
+
160
+    public void setContactAddress(String contactAddress) {
161
+        this.contactAddress = contactAddress;
162
+    }
163
+
164
+    public String getWorkAddress() {
165
+        return workAddress;
166
+    }
167
+
168
+    public void setWorkAddress(String workAddress) {
169
+        this.workAddress = workAddress;
170
+    }
171
+}

+ 732
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java 查看文件

@@ -0,0 +1,732 @@
1
+package com.ruoyi.wisdomarbitrate.domain;
2
+
3
+import com.fasterxml.jackson.annotation.JsonFormat;
4
+import com.ruoyi.common.annotation.Excel;
5
+import com.ruoyi.common.core.domain.BaseEntity;
6
+import java.math.BigDecimal;
7
+import java.util.Date;
8
+import java.util.List;
9
+
10
+public class CaseApplication  extends BaseEntity {
11
+    private static final long serialVersionUID = 1L;
12
+
13
+    /** ID */
14
+    private Long id;
15
+    /** 案件编号 */
16
+//    @Excel(name = "案件编号")
17
+    private String caseNum;
18
+    /** 案件标的 */
19
+    @Excel(name = "案件标的")
20
+    private BigDecimal caseSubjectAmount;
21
+
22
+
23
+    /** 立案日期 */
24
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
25
+    private Date registerDate;
26
+    /** 仲裁方式 */
27
+    private Integer arbitratMethod;
28
+
29
+    public Integer getArbitratMethod() {
30
+        return arbitratMethod;
31
+    }
32
+
33
+    public void setArbitratMethod(Integer arbitratMethod) {
34
+        this.arbitratMethod = arbitratMethod;
35
+    }
36
+    /** 仲裁方式名称 */
37
+    private String arbitratMethodName;
38
+
39
+    public String getArbitratMethodName() {
40
+        return arbitratMethodName;
41
+    }
42
+
43
+    public void setArbitratMethodName(String arbitratMethodName) {
44
+        this.arbitratMethodName = arbitratMethodName;
45
+    }
46
+
47
+    /** 案件状态 */
48
+    private Integer caseStatus;
49
+
50
+    public Integer getCaseStatus() {
51
+        return caseStatus;
52
+    }
53
+
54
+    public void setCaseStatus(Integer caseStatus) {
55
+        this.caseStatus = caseStatus;
56
+    }
57
+
58
+    /** 开庭日期 */
59
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
60
+    private Date hearDate;
61
+
62
+    /** 借款开始日期 */
63
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
64
+    @Excel(name = "借款开始日期")
65
+    private Date loanStartDate;
66
+    /** 借款结束日期 */
67
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
68
+    @Excel(name = "借款结束日期")
69
+    private Date loanEndDate;
70
+    /** 合同编号 */
71
+    @Excel(name = "合同编号")
72
+    private String contractNumber;
73
+    /** 申请人主张欠本金 */
74
+    @Excel(name = "申请人主张欠本金")
75
+    private BigDecimal claimPrinciOwed;
76
+    /** 申请人主张欠利息 */
77
+    @Excel(name = "申请人主张欠利息")
78
+    private BigDecimal claimInterestOwed;
79
+    /** 申请人主张违约金 */
80
+    @Excel(name = "申请人主张违约金")
81
+    private BigDecimal claimLiquidDamag;
82
+    /** 申请人仲裁诉求 */
83
+    @Excel(name = "申请人仲裁诉求")
84
+    private String arbitratClaims;
85
+    /** 仲裁应缴费用 */
86
+    private BigDecimal feePayable;
87
+
88
+    /** 开始在线视频时间 */
89
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
90
+    private Date beginVideoDate;
91
+    /** 在线视频人员 */
92
+    private String onlineVideoPerson;
93
+
94
+    /** 仲裁员id */
95
+    private String arbitratorId;
96
+    /** 仲裁员名称 */
97
+    private String arbitratorName;
98
+
99
+    /** 案件名称 */
100
+    private String caseName;
101
+
102
+    /** 案件描述 */
103
+    private String caseDescribe;
104
+
105
+    /** 是否同意组庭 */
106
+    private Integer isAgreePendTral;
107
+
108
+    /** 是否有异议需要举证 */
109
+    private Integer objectionAddEviden;
110
+    /** 是否需要开庭审理 */
111
+    private Integer openCourtHear;
112
+
113
+    /** 支付状态 */
114
+    private Integer paymentStatus;
115
+    /** 支付状态描述 */
116
+    private String paymentStatusName;
117
+    // 导入校验失败信息
118
+    private StringBuilder errorMsg;
119
+
120
+    public StringBuilder getErrorMsg() {
121
+        return errorMsg;
122
+    }
123
+
124
+    public void setErrorMsg(StringBuilder errorMsg) {
125
+        this.errorMsg = errorMsg;
126
+    }
127
+
128
+    public Integer getPaymentStatus() {
129
+        return paymentStatus;
130
+    }
131
+
132
+    public void setPaymentStatus(Integer paymentStatus) {
133
+        this.paymentStatus = paymentStatus;
134
+    }
135
+
136
+    public String getPaymentStatusName() {
137
+        return paymentStatusName;
138
+    }
139
+
140
+    public void setPaymentStatusName(String paymentStatusName) {
141
+        this.paymentStatusName = paymentStatusName;
142
+    }
143
+
144
+    public Integer getIsAgreePendTral() {
145
+        return isAgreePendTral;
146
+    }
147
+
148
+    public void setIsAgreePendTral(Integer isAgreePendTral) {
149
+        this.isAgreePendTral = isAgreePendTral;
150
+    }
151
+
152
+    public Integer getObjectionAddEviden() {
153
+        return objectionAddEviden;
154
+    }
155
+
156
+    public void setObjectionAddEviden(Integer objectionAddEviden) {
157
+        this.objectionAddEviden = objectionAddEviden;
158
+    }
159
+
160
+    public Integer getOpenCourtHear() {
161
+        return openCourtHear;
162
+    }
163
+
164
+    public void setOpenCourtHear(Integer openCourtHear) {
165
+        this.openCourtHear = openCourtHear;
166
+    }
167
+
168
+    /** 案件状态名称 */
169
+    private String caseStatusName;
170
+    /** 是否同意审核 */
171
+    private Integer agreeOrNotCheck;
172
+
173
+    public Integer getAgreeOrNotCheck() {
174
+        return agreeOrNotCheck;
175
+    }
176
+
177
+    public void setAgreeOrNotCheck(Integer agreeOrNotCheck) {
178
+        this.agreeOrNotCheck = agreeOrNotCheck;
179
+    }
180
+
181
+    public String getCaseStatusName() {
182
+        return caseStatusName;
183
+    }
184
+
185
+    public void setCaseStatusName(String caseStatusName) {
186
+        this.caseStatusName = caseStatusName;
187
+    }
188
+
189
+    /** 申请人名称 */
190
+    private String applicantName;
191
+    /** 被申请人名称 */
192
+    private String respondentName;
193
+
194
+    public String getApplicantName() {
195
+        return applicantName;
196
+    }
197
+
198
+    public void setApplicantName(String applicantName) {
199
+        this.applicantName = applicantName;
200
+    }
201
+
202
+    public String getRespondentName() {
203
+        return respondentName;
204
+    }
205
+
206
+    public void setRespondentName(String respondentName) {
207
+        this.respondentName = respondentName;
208
+    }
209
+
210
+
211
+
212
+    public String getCaseName() {
213
+        return caseName;
214
+    }
215
+
216
+    public void setCaseName(String caseName) {
217
+        this.caseName = caseName;
218
+    }
219
+
220
+    public String getCaseDescribe() {
221
+        return caseDescribe;
222
+    }
223
+
224
+    public void setCaseDescribe(String caseDescribe) {
225
+        this.caseDescribe = caseDescribe;
226
+    }
227
+
228
+    public String getCaseResult() {
229
+        return caseResult;
230
+    }
231
+
232
+    public void setCaseResult(String caseResult) {
233
+        this.caseResult = caseResult;
234
+    }
235
+
236
+    /** 仲裁结果 */
237
+    private String caseResult;
238
+
239
+
240
+
241
+    public String getArbitratorName() {
242
+        return arbitratorName;
243
+    }
244
+
245
+    public void setArbitratorName(String arbitratorName) {
246
+        this.arbitratorName = arbitratorName;
247
+    }
248
+
249
+    /** 是否指派仲裁员 */
250
+    private int pendingAppointArbotrar;
251
+
252
+    public int getPendingAppointArbotrar() {
253
+        return pendingAppointArbotrar;
254
+    }
255
+
256
+    public void setPendingAppointArbotrar(int pendingAppointArbotrar) {
257
+        this.pendingAppointArbotrar = pendingAppointArbotrar;
258
+    }
259
+
260
+    public String getArbitratorId() {
261
+        return arbitratorId;
262
+    }
263
+
264
+    public void setArbitratorId(String arbitratorId) {
265
+        this.arbitratorId = arbitratorId;
266
+    }
267
+
268
+
269
+
270
+    /** 案件关联人信息 */
271
+    private List<CaseAffiliate> caseAffiliates;
272
+
273
+    /** 案件仲裁员 */
274
+    private List<Arbitrator> arbitrators;
275
+
276
+    private List<Integer> caseStatusList;
277
+
278
+    private List<Integer> annexTypeList;
279
+
280
+    private Integer annexType;
281
+
282
+    public Integer getAnnexType() {
283
+        return annexType;
284
+    }
285
+
286
+    public void setAnnexType(Integer annexType) {
287
+        this.annexType = annexType;
288
+    }
289
+
290
+    public List<Integer> getAnnexTypeList() {
291
+        return annexTypeList;
292
+    }
293
+
294
+    public void setAnnexTypeList(List<Integer> annexTypeList) {
295
+        this.annexTypeList = annexTypeList;
296
+    }
297
+
298
+    /**
299
+     * 案件附件列表
300
+     */
301
+    private List<CaseAttach> caseAttachList;
302
+
303
+    public List<CaseAttach> getCaseAttachList() {
304
+        return caseAttachList;
305
+    }
306
+
307
+    public void setCaseAttachList(List<CaseAttach> caseAttachList) {
308
+        this.caseAttachList = caseAttachList;
309
+    }
310
+
311
+    public List<Integer> getCaseStatusList() {
312
+        return caseStatusList;
313
+    }
314
+
315
+    public void setCaseStatusList(List<Integer> caseStatusList) {
316
+        this.caseStatusList = caseStatusList;
317
+    }
318
+
319
+    /** 仲裁记录 */
320
+    private ArbitrateRecord arbitrateRecord;
321
+
322
+    public ArbitrateRecord getArbitrateRecord() {
323
+        return arbitrateRecord;
324
+    }
325
+
326
+    public void setArbitrateRecord(ArbitrateRecord arbitrateRecord) {
327
+        this.arbitrateRecord = arbitrateRecord;
328
+    }
329
+
330
+    public List<Arbitrator> getArbitrators() {
331
+        return arbitrators;
332
+    }
333
+
334
+    public void setArbitrators(List<Arbitrator> arbitrators) {
335
+        this.arbitrators = arbitrators;
336
+    }
337
+
338
+    /** 身份类型 */
339
+//    @Excel(name = "身份类型")
340
+    private int identityType;
341
+    /**
342
+     * 申请人主体信息
343
+     */
344
+    /** 姓名 */
345
+    @Excel(name = "申请人主体信息-申请人(机构)",width = 26)
346
+    private String name;
347
+    /**
348
+     * 申请人主体信息-申请人(机构)id
349
+     */
350
+    private String nameId;
351
+    /** 身份证号 */
352
+    @Excel(name = "申请人主体信息-代码",width = 26)
353
+    private String identityNum;
354
+
355
+    /** 联系电话 */
356
+    @Excel(name = "申请人主体信息-联系电话",width = 26)
357
+    private String contactTelphone;
358
+    /** 联系地址 */
359
+    @Excel(name = "申请人主体信息-联系地址",width = 26)
360
+    private String contactAddress;
361
+    /** 单位电话 */
362
+    @Excel(name = "申请人主体信息-单位电话",width = 26)
363
+    private String workTelphone;
364
+    /** 单位地址 */
365
+    @Excel(name = "申请人主体信息-单位地址",width = 26)
366
+    private String workAddress;
367
+
368
+    /** 代理人姓名 */
369
+    @Excel(name = "申请人主体信息-代理人姓名",width = 26)
370
+    private String nameAgent;
371
+    /** 身份证号 */
372
+    @Excel(name = "申请人主体信息-代理人身份证号",width = 26)
373
+    private String identityNumAgent;
374
+    /** 联系电话 */
375
+    @Excel(name = "申请人主体信息-代理人联系电话",width = 26)
376
+    private String contactTelphoneAgent;
377
+    /** 联系地址 */
378
+    @Excel(name = "申请人主体信息-代理人联系地址",width = 26)
379
+    private String contactAddressAgent;
380
+    /**
381
+     * 被申请人主体信息
382
+     */
383
+    /** 姓名 */
384
+    @Excel(name = "被申请人主体信息-申请人姓名",width = 26)
385
+    private String debtorName;
386
+    /** 身份证号 */
387
+    @Excel(name = "被申请人主体信息-身份证号",width = 26)
388
+    private String debtorIdentityNum;
389
+
390
+    /** 联系电话 */
391
+    @Excel(name = "被申请人主体信息-联系电话",width = 26)
392
+    private String debtorContactTelphone;
393
+    /** 联系地址 */
394
+    @Excel(name = "被申请人主体信息-联系地址",width = 26)
395
+    private String debtorContactAddress;
396
+    /** 单位电话 */
397
+    @Excel(name = "被申请人主体信息-单位电话",width = 26)
398
+    private String debtorWorkTelphone;
399
+    /** 单位地址 */
400
+    @Excel(name = "被申请人主体信息-单位地址",width = 26)
401
+    private String debtorWorkAddress;
402
+
403
+    /** 代理人姓名 */
404
+    @Excel(name = "被申请人主体信息-代理人姓名",width = 26)
405
+    private String debtorNameAgent;
406
+    /** 身份证号 */
407
+    @Excel(name = "被申请人主体信息-代理人身份证号",width = 26)
408
+    private String debtorIdentityNumAgent;
409
+    /** 联系电话 */
410
+    @Excel(name = "被申请人主体信息-代理人联系电话",width = 26)
411
+    private String debtorContactTelphoneAgent;
412
+    /** 联系地址 */
413
+    @Excel(name = "被申请人主体信息-代理人联系地址",width = 26)
414
+    private String debtorContactAddressAgent;
415
+
416
+    public int getIdentityType() {
417
+        return identityType;
418
+    }
419
+
420
+    public void setIdentityType(int identityType) {
421
+        this.identityType = identityType;
422
+    }
423
+
424
+    public String getName() {
425
+        return name;
426
+    }
427
+
428
+    public void setName(String name) {
429
+        this.name = name;
430
+    }
431
+
432
+    public String getNameId() {
433
+        return nameId;
434
+    }
435
+
436
+    public void setNameId(String nameId) {
437
+        this.nameId = nameId;
438
+    }
439
+
440
+    public String getIdentityNum() {
441
+        return identityNum;
442
+    }
443
+
444
+    public void setIdentityNum(String identityNum) {
445
+        this.identityNum = identityNum;
446
+    }
447
+
448
+    public String getWorkTelphone() {
449
+        return workTelphone;
450
+    }
451
+
452
+    public void setWorkTelphone(String workTelphone) {
453
+        this.workTelphone = workTelphone;
454
+    }
455
+
456
+    public String getContactTelphone() {
457
+        return contactTelphone;
458
+    }
459
+
460
+    public void setContactTelphone(String contactTelphone) {
461
+        this.contactTelphone = contactTelphone;
462
+    }
463
+
464
+    public String getContactAddress() {
465
+        return contactAddress;
466
+    }
467
+
468
+    public void setContactAddress(String contactAddress) {
469
+        this.contactAddress = contactAddress;
470
+    }
471
+
472
+    public String getWorkAddress() {
473
+        return workAddress;
474
+    }
475
+
476
+    public void setWorkAddress(String workAddress) {
477
+        this.workAddress = workAddress;
478
+    }
479
+
480
+    public String getNameAgent() {
481
+        return nameAgent;
482
+    }
483
+
484
+    public void setNameAgent(String nameAgent) {
485
+        this.nameAgent = nameAgent;
486
+    }
487
+
488
+    public String getIdentityNumAgent() {
489
+        return identityNumAgent;
490
+    }
491
+
492
+    public void setIdentityNumAgent(String identityNumAgent) {
493
+        this.identityNumAgent = identityNumAgent;
494
+    }
495
+
496
+    public String getContactTelphoneAgent() {
497
+        return contactTelphoneAgent;
498
+    }
499
+
500
+    public void setContactTelphoneAgent(String contactTelphoneAgent) {
501
+        this.contactTelphoneAgent = contactTelphoneAgent;
502
+    }
503
+
504
+    public String getContactAddressAgent() {
505
+        return contactAddressAgent;
506
+    }
507
+
508
+    public void setContactAddressAgent(String contactAddressAgent) {
509
+        this.contactAddressAgent = contactAddressAgent;
510
+    }
511
+
512
+
513
+    public String getDebtorName() {
514
+        return debtorName;
515
+    }
516
+
517
+    public void setDebtorName(String debtorName) {
518
+        this.debtorName = debtorName;
519
+    }
520
+
521
+    public String getDebtorIdentityNum() {
522
+        return debtorIdentityNum;
523
+    }
524
+
525
+    public void setDebtorIdentityNum(String debtorIdentityNum) {
526
+        this.debtorIdentityNum = debtorIdentityNum;
527
+    }
528
+
529
+    public String getDebtorContactTelphone() {
530
+        return debtorContactTelphone;
531
+    }
532
+
533
+    public void setDebtorContactTelphone(String debtorContactTelphone) {
534
+        this.debtorContactTelphone = debtorContactTelphone;
535
+    }
536
+
537
+    public String getDebtorContactAddress() {
538
+        return debtorContactAddress;
539
+    }
540
+
541
+    public void setDebtorContactAddress(String debtorContactAddress) {
542
+        this.debtorContactAddress = debtorContactAddress;
543
+    }
544
+
545
+    public String getDebtorWorkTelphone() {
546
+        return debtorWorkTelphone;
547
+    }
548
+
549
+    public void setDebtorWorkTelphone(String debtorWorkTelphone) {
550
+        this.debtorWorkTelphone = debtorWorkTelphone;
551
+    }
552
+
553
+    public String getDebtorWorkAddress() {
554
+        return debtorWorkAddress;
555
+    }
556
+
557
+    public void setDebtorWorkAddress(String debtorWorkAddress) {
558
+        this.debtorWorkAddress = debtorWorkAddress;
559
+    }
560
+
561
+    public String getDebtorNameAgent() {
562
+        return debtorNameAgent;
563
+    }
564
+
565
+    public void setDebtorNameAgent(String debtorNameAgent) {
566
+        this.debtorNameAgent = debtorNameAgent;
567
+    }
568
+
569
+    public String getDebtorIdentityNumAgent() {
570
+        return debtorIdentityNumAgent;
571
+    }
572
+
573
+    public void setDebtorIdentityNumAgent(String debtorIdentityNumAgent) {
574
+        this.debtorIdentityNumAgent = debtorIdentityNumAgent;
575
+    }
576
+
577
+    public String getDebtorContactTelphoneAgent() {
578
+        return debtorContactTelphoneAgent;
579
+    }
580
+
581
+    public void setDebtorContactTelphoneAgent(String debtorContactTelphoneAgent) {
582
+        this.debtorContactTelphoneAgent = debtorContactTelphoneAgent;
583
+    }
584
+
585
+    public String getDebtorContactAddressAgent() {
586
+        return debtorContactAddressAgent;
587
+    }
588
+
589
+    public void setDebtorContactAddressAgent(String debtorContactAddressAgent) {
590
+        this.debtorContactAddressAgent = debtorContactAddressAgent;
591
+    }
592
+
593
+    public Long getId() {
594
+        return id;
595
+    }
596
+
597
+    public void setId(Long id) {
598
+        this.id = id;
599
+    }
600
+
601
+    public String getCaseNum() {
602
+        return caseNum;
603
+    }
604
+
605
+    public void setCaseNum(String caseNum) {
606
+        this.caseNum = caseNum;
607
+    }
608
+
609
+    public String getContractNumber() {
610
+        return contractNumber;
611
+    }
612
+
613
+    public void setContractNumber(String contractNumber) {
614
+        this.contractNumber = contractNumber;
615
+    }
616
+
617
+    public BigDecimal getCaseSubjectAmount() {
618
+        return caseSubjectAmount;
619
+    }
620
+
621
+    public void setCaseSubjectAmount(BigDecimal caseSubjectAmount) {
622
+        this.caseSubjectAmount = caseSubjectAmount;
623
+    }
624
+
625
+    public Date getRegisterDate() {
626
+        return registerDate;
627
+    }
628
+
629
+    public void setRegisterDate(Date registerDate) {
630
+        this.registerDate = registerDate;
631
+    }
632
+
633
+
634
+
635
+
636
+    public Date getHearDate() {
637
+        return hearDate;
638
+    }
639
+
640
+    public void setHearDate(Date hearDate) {
641
+        this.hearDate = hearDate;
642
+    }
643
+
644
+    public String getArbitratClaims() {
645
+        return arbitratClaims;
646
+    }
647
+
648
+    public void setArbitratClaims(String arbitratClaims) {
649
+        this.arbitratClaims = arbitratClaims;
650
+    }
651
+
652
+    public Date getLoanStartDate() {
653
+        return loanStartDate;
654
+    }
655
+
656
+    public void setLoanStartDate(Date loanStartDate) {
657
+        this.loanStartDate = loanStartDate;
658
+    }
659
+
660
+    public Date getLoanEndDate() {
661
+        return loanEndDate;
662
+    }
663
+
664
+    public void setLoanEndDate(Date loanEndDate) {
665
+        this.loanEndDate = loanEndDate;
666
+    }
667
+
668
+    public BigDecimal getClaimPrinciOwed() {
669
+        return claimPrinciOwed;
670
+    }
671
+
672
+    public void setClaimPrinciOwed(BigDecimal claimPrinciOwed) {
673
+        this.claimPrinciOwed = claimPrinciOwed;
674
+    }
675
+
676
+    public BigDecimal getClaimInterestOwed() {
677
+        return claimInterestOwed;
678
+    }
679
+
680
+    public void setClaimInterestOwed(BigDecimal claimInterestOwed) {
681
+        this.claimInterestOwed = claimInterestOwed;
682
+    }
683
+
684
+    public BigDecimal getClaimLiquidDamag() {
685
+        return claimLiquidDamag;
686
+    }
687
+
688
+    public void setClaimLiquidDamag(BigDecimal claimLiquidDamag) {
689
+        this.claimLiquidDamag = claimLiquidDamag;
690
+    }
691
+
692
+    public BigDecimal getFeePayable() {
693
+        return feePayable;
694
+    }
695
+
696
+    public void setFeePayable(BigDecimal feePayable) {
697
+        this.feePayable = feePayable;
698
+    }
699
+
700
+
701
+
702
+    public Date getBeginVideoDate() {
703
+        return beginVideoDate;
704
+    }
705
+
706
+    public void setBeginVideoDate(Date beginVideoDate) {
707
+        this.beginVideoDate = beginVideoDate;
708
+    }
709
+
710
+    public String getOnlineVideoPerson() {
711
+        return onlineVideoPerson;
712
+    }
713
+
714
+    public void setOnlineVideoPerson(String onlineVideoPerson) {
715
+        this.onlineVideoPerson = onlineVideoPerson;
716
+    }
717
+
718
+    public List<CaseAffiliate> getCaseAffiliates() {
719
+        return caseAffiliates;
720
+    }
721
+
722
+    public void setCaseAffiliates(List<CaseAffiliate> caseAffiliates) {
723
+        this.caseAffiliates = caseAffiliates;
724
+    }
725
+
726
+
727
+
728
+
729
+
730
+
731
+
732
+}

+ 46
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseAttach.java 查看文件

@@ -0,0 +1,46 @@
1
+package com.ruoyi.wisdomarbitrate.domain;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Builder;
5
+import lombok.Data;
6
+import lombok.NoArgsConstructor;
7
+
8
+@Data
9
+@Builder
10
+@AllArgsConstructor
11
+@NoArgsConstructor
12
+public class  CaseAttach {
13
+    /**
14
+     *  附件id
15
+     */
16
+    private Integer annexId;
17
+    /**
18
+     * 案件申请id
19
+     */
20
+    private Long caseAppliId;
21
+    /**
22
+     * 附件名称
23
+     */
24
+    private String annexName;
25
+    /**
26
+     * 附件路径
27
+     */
28
+    private String annexPath;
29
+    /**
30
+     * 附件类型,立案申请书(1)、证据材料(2)、仲裁文书(3)、案件视频(4)、身份证件(5)
31
+     */
32
+    private Integer annexType;
33
+    /**
34
+     * 备注
35
+     */
36
+    private String note;
37
+    /**
38
+     * 用户id
39
+     */
40
+    private Long userId;
41
+    /**
42
+     * 用户账户
43
+     */
44
+    private String userName;
45
+
46
+}

+ 105
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseLogRecord.java 查看文件

@@ -0,0 +1,105 @@
1
+package com.ruoyi.wisdomarbitrate.domain;
2
+
3
+import com.fasterxml.jackson.annotation.JsonFormat;
4
+import com.ruoyi.common.annotation.Excel;
5
+import com.ruoyi.common.core.domain.BaseEntity;
6
+
7
+import java.util.Date;
8
+
9
+public class CaseLogRecord     extends BaseEntity {
10
+    private static final long serialVersionUID = 1L;
11
+
12
+    /** ID */
13
+    private Long id;
14
+    /** 案件申请id */
15
+    private Long caseAppliId;
16
+    /** 案件节点 */
17
+    private Integer caseNode;
18
+
19
+    /** 案件节点时间 */
20
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
21
+    private Date caseNodeTime;
22
+
23
+    /** 备注 */
24
+    private String notes;
25
+
26
+    /** 案件编号 */
27
+    private String caseNum;
28
+    /**
29
+     * 展示的内容
30
+     */
31
+    private String content;
32
+    /**
33
+     * 用户昵称
34
+     */
35
+    private String createNickName;
36
+
37
+
38
+    public String getCaseNum() {
39
+        return caseNum;
40
+    }
41
+
42
+    public void setCaseNum(String caseNum) {
43
+        this.caseNum = caseNum;
44
+    }
45
+
46
+    public Long getId() {
47
+        return id;
48
+    }
49
+
50
+    public void setId(Long id) {
51
+        this.id = id;
52
+    }
53
+
54
+    public Long getCaseAppliId() {
55
+        return caseAppliId;
56
+    }
57
+
58
+    public void setCaseAppliId(Long caseAppliId) {
59
+        this.caseAppliId = caseAppliId;
60
+    }
61
+
62
+    public Integer getCaseNode() {
63
+        return caseNode;
64
+    }
65
+
66
+    public void setCaseNode(int caseNode) {
67
+        this.caseNode = caseNode;
68
+    }
69
+
70
+    public Date getCaseNodeTime() {
71
+        return caseNodeTime;
72
+    }
73
+
74
+    public void setCaseNodeTime(Date caseNodeTime) {
75
+        this.caseNodeTime = caseNodeTime;
76
+    }
77
+
78
+    public String getNotes() {
79
+        return notes;
80
+    }
81
+
82
+    public void setNotes(String notes) {
83
+        this.notes = notes;
84
+    }
85
+
86
+    public void setCaseNode(Integer caseNode) {
87
+        this.caseNode = caseNode;
88
+    }
89
+
90
+    public String getContent() {
91
+        return content;
92
+    }
93
+
94
+    public void setContent(String content) {
95
+        this.content = content;
96
+    }
97
+
98
+    public String getCreateNickName() {
99
+        return createNickName;
100
+    }
101
+
102
+    public void setCreateNickName(String nickName) {
103
+        this.createNickName = nickName;
104
+    }
105
+}

+ 41
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CasePaymentRecord.java 查看文件

@@ -0,0 +1,41 @@
1
+package com.ruoyi.wisdomarbitrate.domain;
2
+
3
+import com.fasterxml.jackson.annotation.JsonFormat;
4
+import com.ruoyi.common.core.domain.BaseEntity;
5
+import lombok.Data;
6
+
7
+import java.util.Date;
8
+
9
+@Data
10
+public class CasePaymentRecord {
11
+    private static final long serialVersionUID = 1L;
12
+    /**
13
+     * 主键
14
+     */
15
+    private Integer id;
16
+    /**
17
+     * 案件id
18
+     */
19
+    private Long caseId;
20
+    /**
21
+     * 订单号
22
+     */
23
+    private String orderNumber;
24
+    /**
25
+     * 支付状态(0未支付,1已支付)
26
+     */
27
+    private Integer paymentStatus;
28
+    /**
29
+     * 支付时间
30
+     */
31
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
32
+    private Date paymentTime;
33
+
34
+    /** 创建时间 */
35
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
36
+    private Date createTime;
37
+
38
+    /** 更新时间 */
39
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
40
+    private Date updateTime;
41
+}

+ 129
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/IdentityAuthentication.java 查看文件

@@ -0,0 +1,129 @@
1
+package com.ruoyi.wisdomarbitrate.domain;
2
+
3
+import com.fasterxml.jackson.annotation.JsonFormat;
4
+import com.ruoyi.common.annotation.Excel;
5
+import com.ruoyi.common.core.domain.BaseEntity;
6
+
7
+import java.util.Date;
8
+
9
+public class IdentityAuthentication   extends BaseEntity {
10
+    private static final long serialVersionUID = 1L;
11
+
12
+    /** ID */
13
+    private Long id;
14
+    /** 姓名 */
15
+    private String name;
16
+    /** 身份证号 */
17
+    private String identityNo;
18
+    /** 认证时间 */
19
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
20
+    private Date certificationTime;
21
+    /** 认证状态 */
22
+    private Integer certificationStatus;
23
+
24
+    public Integer getCertificationStatus() {
25
+        return certificationStatus;
26
+    }
27
+
28
+    public void setCertificationStatus(Integer certificationStatus) {
29
+        this.certificationStatus = certificationStatus;
30
+    }
31
+
32
+    /** 认证状态名称 */
33
+    private String certificationStatusName;
34
+
35
+    public String getCertificationStatusName() {
36
+        return certificationStatusName;
37
+    }
38
+
39
+    public void setCertificationStatusName(String certificationStatusName) {
40
+        this.certificationStatusName = certificationStatusName;
41
+    }
42
+
43
+    /** 用户ID */
44
+    private Long userId;
45
+    /** 用户账号 */
46
+    private String userName;
47
+
48
+    /** EID商户id */
49
+    private String merchantId;
50
+
51
+    /** EidToken */
52
+    private String eidToken;
53
+    /** 请求 ID */
54
+    private String requestId;
55
+
56
+    public String getMerchantId() {
57
+        return merchantId;
58
+    }
59
+
60
+    public void setMerchantId(String merchantId) {
61
+        this.merchantId = merchantId;
62
+    }
63
+
64
+    public String getEidToken() {
65
+        return eidToken;
66
+    }
67
+
68
+    public void setEidToken(String eidToken) {
69
+        this.eidToken = eidToken;
70
+    }
71
+
72
+    public String getRequestId() {
73
+        return requestId;
74
+    }
75
+
76
+    public void setRequestId(String requestId) {
77
+        this.requestId = requestId;
78
+    }
79
+
80
+    public Long getUserId() {
81
+        return userId;
82
+    }
83
+
84
+    public void setUserId(Long userId) {
85
+        this.userId = userId;
86
+    }
87
+
88
+    public String getUserName() {
89
+        return userName;
90
+    }
91
+
92
+    public void setUserName(String userName) {
93
+        this.userName = userName;
94
+    }
95
+
96
+    public Long getId() {
97
+        return id;
98
+    }
99
+
100
+    public void setId(Long id) {
101
+        this.id = id;
102
+    }
103
+
104
+    public String getName() {
105
+        return name;
106
+    }
107
+
108
+    public void setName(String name) {
109
+        this.name = name;
110
+    }
111
+
112
+    public String getIdentityNo() {
113
+        return identityNo;
114
+    }
115
+
116
+    public void setIdentityNo(String identityNo) {
117
+        this.identityNo = identityNo;
118
+    }
119
+
120
+    public Date getCertificationTime() {
121
+        return certificationTime;
122
+    }
123
+
124
+    public void setCertificationTime(Date certificationTime) {
125
+        this.certificationTime = certificationTime;
126
+    }
127
+
128
+
129
+}

+ 37
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/CaseEvidenceDTO.java 查看文件

@@ -0,0 +1,37 @@
1
+package com.ruoyi.wisdomarbitrate.domain.dto;
2
+
3
+import com.ruoyi.wisdomarbitrate.domain.Arbitrator;
4
+import lombok.Data;
5
+
6
+import java.util.List;
7
+
8
+/**
9
+ * 案件质证传入对象
10
+ */
11
+@Data
12
+public class CaseEvidenceDTO {
13
+    /**
14
+     * 案件id
15
+     */
16
+    private Long caseId;
17
+
18
+    /**
19
+     * 是否有异议需要举证,1是,0否
20
+     */
21
+    private Integer objectionAddEviden;
22
+
23
+    /**
24
+     * 是否需要开庭审理,1是,0否
25
+     */
26
+    private Integer openCourtHear;
27
+
28
+    /**
29
+     * 是否指派仲裁员,1是,2否
30
+     */
31
+    private Integer pendingAppointArbotrar;
32
+
33
+    /**
34
+     * 案件仲裁员
35
+     */
36
+    private List<Arbitrator> arbitrators;
37
+}

+ 26
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/CasePayDTO.java 查看文件

@@ -0,0 +1,26 @@
1
+package com.ruoyi.wisdomarbitrate.domain.dto;
2
+
3
+import lombok.Data;
4
+/**
5
+ * 案件缴费传入对象
6
+ */
7
+@Data
8
+public class CasePayDTO {
9
+    /**
10
+     * 案件id
11
+     */
12
+    private Long caseId;
13
+
14
+    /**
15
+     * 订单金额 单位:分
16
+     */
17
+    private int totalFee;
18
+    /**
19
+     * 交易类型 native(扫码) / jsapi(小程序) / app / h5
20
+     */
21
+    private String tradeType;
22
+    /**
23
+     * 支付方式 wxpay(微信)  alipay(支付宝)
24
+     */
25
+    private String platform;
26
+}

+ 24
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/ArchivesDetailVO.java 查看文件

@@ -0,0 +1,24 @@
1
+package com.ruoyi.wisdomarbitrate.domain.vo;
2
+
3
+import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
4
+import com.ruoyi.wisdomarbitrate.domain.CaseLogRecord;
5
+import com.ruoyi.wisdomarbitrate.mapper.CaseLogRecordMapper;
6
+import lombok.Data;
7
+
8
+import java.util.List;
9
+
10
+@Data
11
+public class ArchivesDetailVO {
12
+    /**
13
+     * 案件信息
14
+     */
15
+    private CaseApplication caseApplication;
16
+    /**
17
+     * 案件日志信息
18
+     */
19
+    private List<CaseLogRecord> caseLogRecordList;
20
+    /**
21
+     * 快递信息
22
+     */
23
+    private List<LogisticsInfoVO> logisticsInfoVOList;
24
+}

+ 0
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/BookSendVO.java 查看文件


部分文件因文件數量過多而無法顯示