实现身份认证查询
This commit is contained in:
+3
-1
@@ -5,5 +5,7 @@ import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication;
|
||||
public interface IdentityAuthenticationService {
|
||||
|
||||
|
||||
IdentityAuthentication selectIdentityInformation();
|
||||
IdentityAuthentication selectIdentityAuthentication(IdentityAuthentication identityAuthentication);
|
||||
|
||||
|
||||
}
|
||||
|
||||
+12
-53
@@ -38,62 +38,21 @@ public class IdentityAuthenticationServiceImpl implements IdentityAuthenticatio
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(IdentityAuthenticationServiceImpl.class);
|
||||
|
||||
|
||||
@Override
|
||||
public IdentityAuthentication selectIdentityInformation() {
|
||||
/* IdentityAuthentication identityAuthentication = new IdentityAuthentication();
|
||||
try{
|
||||
Credential credIdentityAuthentication = new Credential(credentialSecretId, credentialSecretKey);
|
||||
HttpProfile httpProfileIdentityAuthentication = new HttpProfile();
|
||||
httpProfileIdentityAuthentication.setEndpoint("ocr.tencentcloudapi.com");
|
||||
String imagePathIdentityAuthentication = "本地png/jpg文件的绝对地址";
|
||||
InputStream inputStreamIdentityAuthentication = null;
|
||||
byte[] buffer = null;
|
||||
//读取图片字节数组
|
||||
try {
|
||||
inputStreamIdentityAuthentication = new FileInputStream(imagePathIdentityAuthentication);
|
||||
int count = 0;
|
||||
while (count == 0) {
|
||||
count = inputStreamIdentityAuthentication.available();
|
||||
}
|
||||
buffer = new byte[count];
|
||||
inputStreamIdentityAuthentication.read(buffer);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (inputStreamIdentityAuthentication != null) {
|
||||
try {
|
||||
// 关闭inputStream流
|
||||
inputStreamIdentityAuthentication.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String imageBase64IdentityAuthentication = Base64.getEncoder().encodeToString(buffer);
|
||||
|
||||
ClientProfile clientProfileIdentityAuthentication = new ClientProfile();
|
||||
clientProfileIdentityAuthentication.setHttpProfile(httpProfileIdentityAuthentication);
|
||||
OcrClient clientIdentityAuthentication = new OcrClient(credIdentityAuthentication, "ap-shanghai", clientProfileIdentityAuthentication);
|
||||
RecognizeTableAccurateOCRRequest reqIdentityAuthentication = new RecognizeTableAccurateOCRRequest();
|
||||
reqIdentityAuthentication.setImageBase64(imageBase64IdentityAuthentication);
|
||||
RecognizeTableAccurateOCRResponse respIdentityAuthentication = clientIdentityAuthentication.RecognizeTableAccurateOCR(reqIdentityAuthentication);
|
||||
String stringRes = RecognizeTableAccurateOCRResponse.toJsonString(respIdentityAuthentication);
|
||||
JSONObject stringObjectRes = (JSONObject) JSON.parse(stringRes);
|
||||
JSONObject stringres = (JSONObject) stringObjectRes.get("Response");
|
||||
|
||||
|
||||
identityAuthentication.setName(stringres.get("name").toString());
|
||||
identityAuthentication.setIdentityNo(stringres.get("IdNum").toString());
|
||||
|
||||
// System.out.println(RecognizeTableAccurateOCRResponse.toJsonString(respIdentityAuthentication);
|
||||
|
||||
} catch (TencentCloudSDKException e) {
|
||||
log.error("身份认证失败", e);
|
||||
public IdentityAuthentication selectIdentityAuthentication(IdentityAuthentication identityAuthentication) {
|
||||
IdentityAuthentication identityAuthenticationselect = identityAuthenticationMapper.selectIdentityAuthentication(identityAuthentication);
|
||||
if(identityAuthenticationselect!=null){
|
||||
identityAuthenticationselect.setCertificationStatusName("已身份注册");
|
||||
}else {
|
||||
IdentityAuthentication identityAuthenticationselectnew = new IdentityAuthentication();
|
||||
identityAuthenticationselectnew.setCertificationStatusName("未身份注册");
|
||||
return identityAuthenticationselectnew;
|
||||
}
|
||||
return identityAuthenticationselect;
|
||||
|
||||
return identityAuthentication;*/
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user