|
@@ -21,6 +21,7 @@ import com.yoho.service.model.reviewed.request.ImageReviewedReq; |
|
@@ -21,6 +21,7 @@ import com.yoho.service.model.reviewed.request.ImageReviewedReq; |
21
|
import com.yoho.service.model.reviewed.response.IdCardRspBO;
|
21
|
import com.yoho.service.model.reviewed.response.IdCardRspBO;
|
22
|
import com.yoho.service.model.reviewed.response.ImageReviewResp;
|
22
|
import com.yoho.service.model.reviewed.response.ImageReviewResp;
|
23
|
import com.yoho.tools.common.beans.ApiResponse;
|
23
|
import com.yoho.tools.common.beans.ApiResponse;
|
|
|
24
|
+import com.yoho.tools.common.beans.Response;
|
24
|
import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO;
|
25
|
import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO;
|
25
|
import com.yohoufo.common.constant.CertPhotoEnum;
|
26
|
import com.yohoufo.common.constant.CertPhotoEnum;
|
26
|
import com.yohoufo.common.exception.GatewayException;
|
27
|
import com.yohoufo.common.exception.GatewayException;
|
|
@@ -417,17 +418,22 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { |
|
@@ -417,17 +418,22 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { |
417
|
long num = cacheService.incrementPhotoCheckCount(dayStr,reqVO.getUid());
|
418
|
long num = cacheService.incrementPhotoCheckCount(dayStr,reqVO.getUid());
|
418
|
logger.info("checkCertPhoto call begin reqVO {} ,call redis count {}",reqVO, num);
|
419
|
logger.info("checkCertPhoto call begin reqVO {} ,call redis count {}",reqVO, num);
|
419
|
|
420
|
|
420
|
- ImageReviewResp resp =ocrCertPhotoService.ocrCheck(reqVO,imageBOList);
|
|
|
421
|
- logger.info("checkCertPhoto call end reqVO {} ,resp {} ",reqVO,JSON.toJSONString(resp));
|
421
|
+ Response<ImageReviewResp> imageReviewRespResponse =ocrCertPhotoService.ocrCheck(reqVO,imageBOList);
|
|
|
422
|
+ logger.info("checkCertPhoto call end reqVO {} ,resp {} ",reqVO,JSON.toJSONString(imageReviewRespResponse));
|
422
|
|
423
|
|
423
|
- if(resp==null||!"success".equals(resp.getResultCode())){
|
|
|
424
|
- result.setMessage("验证失败,您上传的证件照片信息不正确");
|
424
|
+ if(imageReviewRespResponse==null||imageReviewRespResponse.getCode()!=200){
|
|
|
425
|
+ result.setMessage("验证图片异常,请重试!");
|
425
|
}else{
|
426
|
}else{
|
|
|
427
|
+ ImageReviewResp reviewResp = imageReviewRespResponse.getData();
|
|
|
428
|
+ if(reviewResp==null||!"success".equals(reviewResp.getResultCode())){
|
|
|
429
|
+ throw new UfoServiceException(400, "您上传的证件照片信息不正确,请重新上传!");
|
|
|
430
|
+ }
|
|
|
431
|
+
|
426
|
//比较信息
|
432
|
//比较信息
|
427
|
- JSONObject jo = JSON.parseObject(resp.getResultDatas());
|
433
|
+ JSONObject jo = JSON.parseObject(reviewResp.getResultDatas());
|
428
|
if(jo!=null&&jo.containsKey("front")&&jo.containsKey("back")){
|
434
|
if(jo!=null&&jo.containsKey("front")&&jo.containsKey("back")){
|
429
|
- IdCardRspBO front = jo.getObject("front",IdCardRspBO.class);
|
|
|
430
|
- IdCardRspBO back = jo.getObject("back",IdCardRspBO.class);
|
435
|
+ IdCardRspBO front = JSON.parseObject(jo.getJSONObject("front").getString("resultData"),IdCardRspBO.class);
|
|
|
436
|
+ IdCardRspBO back = JSON.parseObject(jo.getJSONObject("back").getString("resultData"),IdCardRspBO.class);
|
431
|
if(front!=null&&back!=null){
|
437
|
if(front!=null&&back!=null){
|
432
|
logger.info("checkCertPhoto front {} ,back {}",front,back);
|
438
|
logger.info("checkCertPhoto front {} ,back {}",front,back);
|
433
|
String endData = back.getEndDate();
|
439
|
String endData = back.getEndDate();
|
|
@@ -435,9 +441,9 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { |
|
@@ -435,9 +441,9 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { |
435
|
throw new UfoServiceException(400, "身份证照片有效期不合法!");
|
441
|
throw new UfoServiceException(400, "身份证照片有效期不合法!");
|
436
|
}
|
442
|
}
|
437
|
endData = endData.trim();
|
443
|
endData = endData.trim();
|
438
|
- if(!"长期".equals(endData)){
|
444
|
+ if(!endData.contains("长期")){
|
439
|
//转日期
|
445
|
//转日期
|
440
|
- Date end = DateUtil.getDate(endData,"yyyy.MM.dd");
|
446
|
+ Date end = DateUtil.getDate(endData,"yyyyMMdd");
|
441
|
if(end==null||end.getTime() <= new Date().getTime()){
|
447
|
if(end==null||end.getTime() <= new Date().getTime()){
|
442
|
throw new UfoServiceException(400, "身份证照片不在有效期!");
|
448
|
throw new UfoServiceException(400, "身份证照片不在有效期!");
|
443
|
}
|
449
|
}
|
|
@@ -446,6 +452,10 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { |
|
@@ -446,6 +452,10 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { |
446
|
||!reqVO.getCertNo().equals(front.getCode())){
|
452
|
||!reqVO.getCertNo().equals(front.getCode())){
|
447
|
throw new UfoServiceException(400, "名字或者身份证号不匹配!");
|
453
|
throw new UfoServiceException(400, "名字或者身份证号不匹配!");
|
448
|
}
|
454
|
}
|
|
|
455
|
+
|
|
|
456
|
+ //验证成功
|
|
|
457
|
+ result.setPass(CertPhotoEnum.valid.isCheckPass());
|
|
|
458
|
+ result.setPhotoValidStatus(CertPhotoEnum.valid.getStatus());
|
449
|
}
|
459
|
}
|
450
|
}
|
460
|
}
|
451
|
|
461
|
|