Authored by qinchao

fix

... ... @@ -13,6 +13,8 @@ public interface IZhiMaCertDao {
int updateValidStatusByPrimaryKey(int id);
int updatePhotoStatusByPrimaryKeyAndValidStatus(@Param("id")int id,@Param("validPhoto")int validPhoto);
int updateBizNoByByPrimaryKey(@Param("id")int id, @Param("bizNo")String bizNo);
int updatePhotoToValidByPK(@Param("id")int id, @Param("imageUrl")String imageUrl,@Param("validPhoto")int validPhoto);
... ...
... ... @@ -71,6 +71,13 @@
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updatePhotoStatusByPrimaryKeyAndValidStatus">
update zhima_cert
set valid_photo = #{validPhoto}
where id = #{id,jdbcType=INTEGER} and valid_status = 1
</update>
<update id="updateBizNoByByPrimaryKey">
update zhima_cert
set biz_no = #{bizNo}
... ...
... ... @@ -44,10 +44,9 @@ public class OcrCertPhotoService {
@Value("${yoho.reviewed.controller.url}")
private String messageUrl;
public Response<ImageReviewResp> ocrCheck(RealNameAuthorizeReqVO reqVO , List<ImageBO> imageBOList) {
public Response<ImageReviewResp> ocrCheck(int uid , List<ImageBO> imageBOList) {
Response<ImageReviewResp> respVo = null;
try{
int uid= reqVO.getUid();
ImageReviewedReq req=new ImageReviewedReq();
req.setUid(uid);
req.setImageBOList(imageBOList);
... ... @@ -57,7 +56,7 @@ public class OcrCertPhotoService {
req.setLicense("22c5c86b-3dad-473b-8688-a386a0695ba1");
//调用校验,然后直接返回
logger.info("checkCertPhoto call OcrCertPhotoService ocrCheck call begin uid {} ,RealNameAuthorizeReqVO {},ImageReviewedReq {}",uid,reqVO, JSON.toJSONString(req));
logger.info("checkCertPhoto call OcrCertPhotoService ocrCheck call begin uid {} ,ImageReviewedReq {}",uid, JSON.toJSONString(req));
String url = messageUrl + "/imageAudit/imageAudit";
logger.info("checkCertPhoto call OcrCertPhotoService ocrCheck sendMessage url is {}", url);
... ...
... ... @@ -372,33 +372,25 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService {
private PhotoCheckResultVO zhiMaCertPhotoCheck(RealNameAuthorizeReqVO reqVO){
//每天:记录一个累加的次数 ,超过一定的数量不允许继续调
String dayStr = getStringDate("yyyyMMdd");
List<ImageBO> ls=new ArrayList<>();
List<ImageBO> imageBoList=new ArrayList<>();
ImageBO frontUploadModel=new ImageBO();
frontUploadModel.setImageSide("front");
frontUploadModel.setImageUrl(signPrivateUrl(reqVO.getFrontImageUrl()));
ls.add(frontUploadModel);
frontUploadModel.setImageUrl(ZhiMaCallUtil.signPrivateUrl(reqVO.getFrontImageUrl()));
imageBoList.add(frontUploadModel);
//不再校验反面
/*
ImageBO backUploadModel=new ImageBO();
backUploadModel.setImageSide("back");
backUploadModel.setImageUrl(signPrivateUrl(reqVO.getBackImageUrl()));
ls.add(backUploadModel);
imageBoList.add(backUploadModel);
*/
//调用接口,ocr验证
PhotoCheckResultVO certPhotoCheckResult = checkCertPhoto(dayStr,ls ,reqVO);
PhotoCheckResultVO certPhotoCheckResult = checkCertPhoto(dayStr,imageBoList ,reqVO);
return certPhotoCheckResult;
}
private String signPrivateUrl(String imgUrl){
//获取加载凭证后的url
String accessKey = "BwWhoJN536BnV3CzlE20AjNKC9O2bP0l5tFpKsDU";
String secretKey = "_x2VtO7fEmylgjojmLi7qwTBtRm30S8BrO0FxOPK";
Auth auth = Auth.create(accessKey,secretKey);
String downloadUrl = auth.privateDownloadUrl(imgUrl);
return downloadUrl;
}
/**
* 调用通用的图片验证ocr
... ... @@ -428,7 +420,7 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService {
long num = cacheService.incrementPhotoCheckCount(dayStr,reqVO.getUid());
logger.info("checkCertPhoto call begin reqVO {} ,call redis count {}",reqVO, num);
Response<ImageReviewResp> imageReviewRespResponse =ocrCertPhotoService.ocrCheck(reqVO,imageBOList);
Response<ImageReviewResp> imageReviewRespResponse =ocrCertPhotoService.ocrCheck(reqVO.getUid(),imageBOList);
logger.info("checkCertPhoto call end reqVO {} ,resp {} ",reqVO,JSON.toJSONString(imageReviewRespResponse));
if(imageReviewRespResponse==null||imageReviewRespResponse.getCode()!=200){
... ...
... ... @@ -9,6 +9,8 @@ import com.alipay.api.request.ZhimaCustomerCertificationQueryRequest;
import com.alipay.api.response.ZhimaCustomerCertificationCertifyResponse;
import com.alipay.api.response.ZhimaCustomerCertificationInitializeResponse;
import com.alipay.api.response.ZhimaCustomerCertificationQueryResponse;
import com.qiniu.util.Auth;
import com.yoho.service.model.reviewed.request.ImageBO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -169,4 +171,18 @@ public class ZhiMaCallUtil {
}
}
/************************************
* ocr 七牛私有bucket的url
***********************************/
public static String signPrivateUrl(String imgUrl){
//获取加载凭证后的url
String accessKey = "BwWhoJN536BnV3CzlE20AjNKC9O2bP0l5tFpKsDU";
String secretKey = "_x2VtO7fEmylgjojmLi7qwTBtRm30S8BrO0FxOPK";
Auth auth = Auth.create(accessKey,secretKey);
String downloadUrl = auth.privateDownloadUrl(imgUrl);
return downloadUrl;
}
}
... ...