Преглед на файлове

实现身份认证功能

qitz преди 2 години
родител
ревизия
626ec17b45

+ 10
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/IdentityAuthenticationController.java Целия файл

@@ -18,6 +18,16 @@ public class IdentityAuthenticationController   extends BaseController {
18 18
     @Autowired
19 19
     private IdentityAuthenticationService identityAuthenticationService;
20 20
 
21
+    /**
22
+     * 查询身份认证EIDtoken
23
+     */
24
+    @PostMapping("/selectIdentityAuthenticaEIDtoken")
25
+    public AjaxResult selectIdentityAuthenticaEIDtoken()
26
+    {
27
+        IdentityAuthentication ientityAuthentication = identityAuthenticationService.selectIdentityAuthenticaEIDtoken();
28
+        return success(ientityAuthentication);
29
+    }
30
+
21 31
 
22 32
 
23 33
 

+ 2
- 1
ruoyi-admin/src/main/resources/application.yml Целия файл

@@ -148,4 +148,5 @@ elegent:
148 148
       cycle: 10
149 149
 identityAuthentication:
150 150
   credentialSecretId: 123
151
-  credentialSecretKey: 367
151
+  credentialSecretKey: 367
152
+  merchantId: 356

+ 2
- 2
ruoyi-common/pom.xml Целия файл

@@ -141,8 +141,8 @@
141 141
 
142 142
         <dependency>
143 143
             <groupId>com.tencentcloudapi</groupId>
144
-            <artifactId>tencentcloud-sdk-java-ocr</artifactId>
145
-            <version>3.1.701</version>
144
+            <artifactId>tencentcloud-sdk-java-faceid</artifactId>
145
+            <version>3.1.871</version>
146 146
         </dependency>
147 147
 
148 148
         <!-- poi-tl-->

+ 21
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseAffiliate.java Целия файл

@@ -44,6 +44,27 @@ public class CaseAffiliate   extends BaseEntity {
44 44
     @Excel(name = "代理人联系地址")
45 45
     private String contactAddressAgent;
46 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
+
47 68
     public String getNameAgent() {
48 69
         return nameAgent;
49 70
     }

+ 32
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/IdentityAuthentication.java Целия файл

@@ -45,6 +45,38 @@ public class IdentityAuthentication   extends BaseEntity {
45 45
     /** 用户账号 */
46 46
     private String userName;
47 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
+
48 80
     public Long getUserId() {
49 81
         return userId;
50 82
     }

+ 2
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IdentityAuthenticationService.java Целия файл

@@ -1,6 +1,7 @@
1 1
 package com.ruoyi.wisdomarbitrate.service;
2 2
 
3 3
 import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication;
4
+import com.tencentcloudapi.common.exception.TencentCloudSDKException;
4 5
 
5 6
 public interface IdentityAuthenticationService {
6 7
 
@@ -8,4 +9,5 @@ public interface IdentityAuthenticationService {
8 9
     IdentityAuthentication  selectIdentityAuthentication(IdentityAuthentication identityAuthentication);
9 10
 
10 11
 
12
+    IdentityAuthentication selectIdentityAuthenticaEIDtoken();
11 13
 }

+ 1
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseEvidenceServiceImpl.java Целия файл

@@ -109,7 +109,7 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService {
109 109
                 caseAttachselect.setAnnexId(caseAttach.getAnnexId());
110 110
                 caseAttachselect.setAnnexName(caseAttach.getAnnexName());
111 111
                 caseAttachselect.setAnnexType(caseAttach.getAnnexType());
112
-                return AjaxResult.success("上传成功",caseAttach);
112
+                return AjaxResult.success("上传成功",caseAttachselect);
113 113
             }
114 114
         } catch (IOException e) {
115 115
             e.printStackTrace();

+ 41
- 5
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/IdentityAuthenticationServiceImpl.java Целия файл

@@ -1,7 +1,9 @@
1 1
 package com.ruoyi.wisdomarbitrate.service.impl;
2 2
 
3
-import com.alibaba.fastjson2.JSON;
4
-import com.alibaba.fastjson2.JSONObject;
3
+
4
+
5
+import com.alibaba.fastjson.JSON;
6
+import com.alibaba.fastjson.JSONObject;
5 7
 import com.ruoyi.common.core.domain.AjaxResult;
6 8
 import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication;
7 9
 import com.ruoyi.wisdomarbitrate.mapper.IdentityAuthenticationMapper;
@@ -11,9 +13,9 @@ import com.tencentcloudapi.common.Credential;
11 13
 import com.tencentcloudapi.common.exception.TencentCloudSDKException;
12 14
 import com.tencentcloudapi.common.profile.ClientProfile;
13 15
 import com.tencentcloudapi.common.profile.HttpProfile;
14
-import com.tencentcloudapi.ocr.v20181119.OcrClient;
15
-import com.tencentcloudapi.ocr.v20181119.models.RecognizeTableAccurateOCRRequest;
16
-import com.tencentcloudapi.ocr.v20181119.models.RecognizeTableAccurateOCRResponse;
16
+import com.tencentcloudapi.faceid.v20180301.FaceidClient;
17
+import com.tencentcloudapi.faceid.v20180301.models.GetEidTokenRequest;
18
+import com.tencentcloudapi.faceid.v20180301.models.GetEidTokenResponse;
17 19
 import org.slf4j.Logger;
18 20
 import org.slf4j.LoggerFactory;
19 21
 import org.springframework.beans.factory.annotation.Autowired;
@@ -32,6 +34,11 @@ public class IdentityAuthenticationServiceImpl  implements IdentityAuthenticatio
32 34
     private String credentialSecretId;
33 35
     @Value("${identityAuthentication.credentialSecretKey}")
34 36
     private String credentialSecretKey;
37
+    @Value("${identityAuthentication.merchantId}")
38
+    private String merchantId;
39
+
40
+//    private static final String SECRET_ID = "AKIDeEf2A8uX1HSainvvnXAc3X9ZlhtyvkMp";
41
+//    private static final String SECRET_KEY = "QjphKo8zkHZigT8j9PVtFPJyfIvO3d6V";
35 42
 
36 43
     @Autowired
37 44
     private IdentityAuthenticationMapper identityAuthenticationMapper;
@@ -53,6 +60,35 @@ public class IdentityAuthenticationServiceImpl  implements IdentityAuthenticatio
53 60
 
54 61
     }
55 62
 
63
+    @Override
64
+    public IdentityAuthentication selectIdentityAuthenticaEIDtoken() {
65
+        IdentityAuthentication identityAuthentication = new IdentityAuthentication();
66
+        try{
67
+            //        Credential credIdenAuth = new Credential(SECRET_ID, SECRET_KEY);
68
+            Credential credIdenAuth = new Credential(credentialSecretId, credentialSecretKey);
69
+            HttpProfile httpProfileIdenAuth = new HttpProfile();
70
+            httpProfileIdenAuth.setEndpoint("faceid.tencentcloudapi.com");
71
+            ClientProfile clientProfileIdenAuth = new ClientProfile();
72
+            clientProfileIdenAuth.setHttpProfile(httpProfileIdenAuth);
73
+            FaceidClient clientIdenAuth = new FaceidClient(credIdenAuth, "", clientProfileIdenAuth);
74
+            // 实例化一个请求对象
75
+            GetEidTokenRequest reqIdenAuth = new GetEidTokenRequest();
76
+            //设置请求参数
77
+            reqIdenAuth.setMerchantId(merchantId);
78
+            GetEidTokenResponse respIdenAuth = clientIdenAuth.GetEidToken(reqIdenAuth);
79
+            String respJSON = GetEidTokenResponse.toJsonString(respIdenAuth);
80
+            JSONObject objJSON = JSON.parseObject(respJSON);
81
+            JSONObject objJSONRes = (JSONObject) objJSON.get("Response");
82
+            String eidToken = objJSONRes.getString("EidToken");
83
+            String requestId = objJSONRes.getString("RequestId");
84
+            identityAuthentication.setEidToken(eidToken);
85
+        }catch (TencentCloudSDKException e) {
86
+            System.out.println(e.toString());
87
+        }
88
+
89
+        return identityAuthentication;
90
+
91
+    }
56 92
 
57 93
 
58 94
 }