Procházet zdrojové kódy

Merge branch 'bgy' of SH-Arbitrate/Arbitrate-Backend into dev

bgy před 2 roky
rodič
revize
bb1f5f61ab

+ 0
- 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/bestsign/RegisterController.java Zobrazit soubor

@@ -3,7 +3,6 @@ package com.ruoyi.web.controller.bestsign;
3 3
 import com.ruoyi.bestsign.domain.PersonRegisterVO;
4 4
 import com.ruoyi.bestsign.service.SignRegisterService;
5 5
 import com.ruoyi.common.core.domain.AjaxResult;
6
-import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
7 6
 import org.springframework.beans.factory.annotation.Autowired;
8 7
 import org.springframework.validation.annotation.Validated;
9 8
 import org.springframework.web.bind.annotation.PostMapping;

+ 1
- 1
ruoyi-admin/src/main/resources/application.yml Zobrazit soubor

@@ -106,7 +106,7 @@ spring:
106 106
 ssq:
107 107
   developerId: 1695872832013855470
108 108
   privateKey: MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCiDRuz+dxqkWqHdov0hK+KEWLw/e8MQSqkZZ4c01Yr6cSmQiWyV8Xin0u5S/EA02FWxpjLi1nLriVtOBhZGsoryFmcJrwzSnQ5PORP/HhfcAWFE/Y+3qSQS1OiU7e5wbReCgEUvx4GHZuhdu8cOvq5DG9l33YFZrIEMBTmnf8eKT54STx0tjcKl7U6B6nsiThy3zVtpWXVv6H1HGmxC0KT4EQ388s/PFjrwmk+GFb3EpKCns/GQHf7QrtNz1ZOgCXfgQiQ+91/tcngzUH+zMCIxn5lS+ENAxVI6Ev3W9Y0QHtKwmO4ORVuAskJYzBB2xKI/gw8+PUXNziMAKXuoUAjAgMBAAECggEAd7yHw6vTGUrpE76cGsgPjEzcdoSqpLth7qbG9TWSblAEZXRqtiP0q0ZYhUl/gcSuH5gOPhdw+fZq4RCZrP0GdONMkvxsAtn4lnJPoGpD5wC2k2X0hO+tWJDP8xk4n6BozTNHKTUt0gb+f4eJlapep2xwwy0h30vKLR3504zafEV9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
109
+  serverHost: https://openapi.bestsign.info/openapi/v2/
110 110
 
111 111
 # token配置
112 112
 token:

+ 4
- 0
ruoyi-system/src/main/java/com/ruoyi/bestsign/service/SignRegisterService.java Zobrazit soubor

@@ -11,4 +11,8 @@ public interface SignRegisterService {
11 11
      * @return
12 12
      */
13 13
     AjaxResult registerPerson(PersonRegisterVO personRegisterVO);
14
+    /**
15
+     * 查询用户认证状态/user/async/applyCert/status/
16
+     */
17
+    AjaxResult queryRegisterStatus(PersonRegisterVO personRegisterVO);
14 18
 }

+ 27
- 3
ruoyi-system/src/main/java/com/ruoyi/bestsign/service/impl/RegisterServiceImpl.java Zobrazit soubor

@@ -1,6 +1,7 @@
1 1
 package com.ruoyi.bestsign.service.impl;
2 2
 
3 3
 
4
+import com.alibaba.fastjson.JSONObject;
4 5
 import com.ruoyi.bestsign.domain.PersonRegisterVO;
5 6
 import com.ruoyi.bestsign.service.SignRegisterService;
6 7
 import com.ruoyi.bestsign.utils.BestsignOpenApiClient;
@@ -22,14 +23,37 @@ public class RegisterServiceImpl implements SignRegisterService {
22 23
     @Override
23 24
     public AjaxResult registerPerson(PersonRegisterVO personRegisterVO) {
24 25
         try {
25
-            String s = bestsignOpenApiClient.userPersonalReg(personRegisterVO.getAccount(),
26
+            JSONObject jsonObject = bestsignOpenApiClient.userPersonalReg(personRegisterVO.getAccount(),
26 27
                     personRegisterVO.getName(),
27 28
                     personRegisterVO.getMail(),
28 29
                     personRegisterVO.getMobile(),
29 30
                     personRegisterVO.getCredential().getIdentity(),
30 31
                     personRegisterVO.getCredential().getIdentityType(),
31
-                    null, null, null, null, null);
32
-            AjaxResult.success(s);
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);
33 57
         } catch (Exception e) {
34 58
             e.printStackTrace();
35 59
             return AjaxResult.error(e.getMessage());

+ 41
- 33
ruoyi-system/src/main/java/com/ruoyi/bestsign/utils/BestsignOpenApiClient.java Zobrazit soubor

@@ -7,6 +7,7 @@ import lombok.extern.slf4j.Slf4j;
7 7
 import org.springframework.beans.factory.annotation.Value;
8 8
 import org.springframework.stereotype.Component;
9 9
 
10
+import javax.validation.constraints.NotNull;
10 11
 import java.io.IOException;
11 12
 
12 13
 /**
@@ -31,6 +32,9 @@ public class BestsignOpenApiClient {
31 32
      */
32 33
     @Value("${ssq.serverHost}")
33 34
     private String serverHost;
35
+    /**
36
+     * 签名参数
37
+     */
34 38
     private static String urlSignParams = "?developerId=%s&rtick=%s&signType=rsa&sign=%s";
35 39
 
36 40
 //	public BestsignOpenApiClient(String developerId, String privateKey,
@@ -55,35 +59,37 @@ public class BestsignOpenApiClient {
55 59
      * @param province      省份
56 60
      * @param city          城市
57 61
      * @param address       地址
62
+     * @param method        地址
58 63
      * @return 异步申请任务单号
59 64
      * @throws IOException
60 65
      */
61
-    public String userPersonalReg(String account, String name, String mail,
62
-                                  String mobile, String identity, String identityType,
63
-                                  String contactMail, String contactMobile, String province,
64
-                                  String city, String address) throws Exception {
65
-        String host = this.serverHost;
66
-        String method = "/user/reg/";
67
-
68
-        // 组装请求参数,作为requestbody
66
+    public JSONObject userPersonalReg(String account, String name, String mail,
67
+                                      String mobile, String identity, String identityType,
68
+                                      String contactMail, String contactMobile, String province,
69
+                                      String city, String address, @NotNull String method) throws Exception {
70
+        //body参数
69 71
         JSONObject requestBody = new JSONObject();
72
+
73
+        //用户帐号
70 74
         requestBody.put("account", account);
75
+        //用户名称
71 76
         requestBody.put("name", name);
77
+        //用户类型
72 78
         requestBody.put("userType", "1");
79
+        //用户邮箱
73 80
         requestBody.put("mail", mail);
81
+        //用户手机号
74 82
         requestBody.put("mobile", mobile);
75
-
83
+        //用户证件信息对象
76 84
         JSONObject credential = new JSONObject();
85
+        //用户证件号
77 86
         credential.put("identity", identity);
87
+        //用户证件类型
78 88
         credential.put("identityType", identityType);
79
-        credential.put("contactMail", contactMail);
80
-        credential.put("contactMobile", contactMobile);
81
-        credential.put("province", province);
82
-        credential.put("city", city);
83
-        credential.put("address", address);
84 89
         requestBody.put("credential", credential);
90
+
85 91
         //是否申请证书
86
-        requestBody.put("applyCert", "2");
92
+        requestBody.put("applyCert", "1");
87 93
         // 生成一个时间戳参数
88 94
         String rtick = RSAUtils.getRtick();
89 95
         // 计算参数签名
@@ -100,25 +106,27 @@ public class BestsignOpenApiClient {
100 106
         System.out.println(responseBody);
101 107
         // 返回结果解析
102 108
         JSONObject userObj = JSON.parseObject(responseBody);
109
+        System.out.println(JSON.toJSONString(userObj));
110
+        return userObj;
103 111
         // 返回errno为0,表示成功,其他表示失败
104
-        if (userObj.getIntValue("errno") == 0) {
105
-            JSONObject data = userObj.getJSONObject("data");
106
-            if (data != null) {
107
-                //对返回data进行处理
108
-                String taskId = data.getString("taskId");
109
-                return taskId;
110
-            }
111
-        } else {
112
-            //接口返回异常
113
-            System.out.println(userObj.getIntValue("errno"));
114
-            System.out.println(userObj.getString("errmsg"));
115
-        }
116
-        return userObj.toJSONString();
112
+//        if (userObj.getIntValue("errno") == 0) {
113
+//            JSONObject data = userObj.getJSONObject("data");
114
+//            if (data != null) {
115
+//                //对返回data进行处理
116
+//                String taskId = data.getString("taskId");
117
+//                return taskId;
118
+//            }
119
+//            return null;
120
+//        } else {
121
+//            //接口返回异常
122
+//            System.out.println(userObj.getIntValue("errno"));
123
+//            System.out.println(userObj.getString("errmsg"));
124
+//            throw new Exception(userObj.getIntValue("errno") + ":"
125
+//                    + userObj.getString("errmsg"));
126
+//        }
117 127
     }
118 128
 
119 129
 
120
-
121
-
122 130
     /**
123 131
      * GET方法示例
124 132
      * 下载合同PDF文件
@@ -149,7 +157,7 @@ public class BestsignOpenApiClient {
149 157
         return responseBody;
150 158
     }
151 159
 
152
-    public String selectApplyStatus(String account, String taskId)  throws Exception {
160
+    public String selectApplyStatus(String account, String taskId) throws Exception {
153 161
         String methodInvoke = "/user/async/applyCert/status/";
154 162
         JSONObject requestParam = new JSONObject();
155 163
 
@@ -163,7 +171,7 @@ public class BestsignOpenApiClient {
163 171
                 this.privateKey, this.serverHost, methodInvoke, timestamsParam, null,
164 172
                 requestParam.toJSONString());
165 173
         // 签名参数追加为url参数
166
-        String fullUrlParams = String.format(this.urlSignParams, this.developerId,
174
+        String fullUrlParams = String.format(urlSignParams, this.developerId,
167 175
                 timestamsParam, paramsSign);
168 176
 
169 177
         String responseResult = HttpClientSender.sendHttpPost(this.serverHost, methodInvoke,
@@ -181,7 +189,7 @@ public class BestsignOpenApiClient {
181 189
             }
182 190
         } else {
183 191
 
184
-            log.error("查询申请状态异常:"+responseObj.toJSONString());
192
+            log.error("查询申请状态异常:" + responseObj.toJSONString());
185 193
         }
186 194
         return responseObj.toJSONString();
187 195
     }