feat:身份证背面解析
This commit is contained in:
@@ -69,6 +69,7 @@ public class AliyunServiceImpl implements AliyunService {
|
||||
RecognizeIdentityCardResponse idCardResponse = client.recognizeIdentityCardAdvance(recognizeIdentityCardAdvanceRequest, runtime);
|
||||
log.info("身份证解析结果:{}", JSONObject.toJSONString(idCardResponse));
|
||||
RecognizeIdentityCardResponseBody.RecognizeIdentityCardResponseBodyDataFrontResult frontResult = Optional.ofNullable(idCardResponse).map(o -> o.getBody()).map(o -> o.data).map(o -> o.frontResult).orElse(null);
|
||||
RecognizeIdentityCardResponseBody.RecognizeIdentityCardResponseBodyDataBackResult BackResult = Optional.ofNullable(idCardResponse).map(o -> o.getBody()).map(o -> o.data).map(o -> o.backResult).orElse(null);
|
||||
if(Objects.nonNull(frontResult)){
|
||||
String username = frontResult.name;
|
||||
String liveAddress = frontResult.address;
|
||||
@@ -80,7 +81,15 @@ public class AliyunServiceImpl implements AliyunService {
|
||||
String idCard = frontResult.IDNumber;
|
||||
String nation = frontResult.nationality;
|
||||
IdentityCardInfoVO result = new IdentityCardInfoVO(username, liveAddress, birthdate, sex, idCard, nation);
|
||||
log.info("身份证解析:{}", JSONObject.toJSONString(result));
|
||||
log.info("身份证正面解析:{}", JSONObject.toJSONString(result));
|
||||
return result;
|
||||
}
|
||||
if (Objects.nonNull(BackResult)){
|
||||
String endDate = BackResult.getEndDate();
|
||||
String issue = BackResult.getIssue();
|
||||
String startDate = BackResult.getStartDate();
|
||||
IdentityCardInfoVO result = new IdentityCardInfoVO(endDate,issue,startDate);
|
||||
log.info("身份证背面解析:{}", JSONObject.toJSONString(result));
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user