Showing
5 changed files
with
33 additions
and
17 deletions
@@ -13,6 +13,8 @@ public interface IZhiMaCertDao { | @@ -13,6 +13,8 @@ public interface IZhiMaCertDao { | ||
13 | 13 | ||
14 | int updateValidStatusByPrimaryKey(int id); | 14 | int updateValidStatusByPrimaryKey(int id); |
15 | 15 | ||
16 | + int updatePhotoStatusByPrimaryKeyAndValidStatus(@Param("id")int id,@Param("validPhoto")int validPhoto); | ||
17 | + | ||
16 | int updateBizNoByByPrimaryKey(@Param("id")int id, @Param("bizNo")String bizNo); | 18 | int updateBizNoByByPrimaryKey(@Param("id")int id, @Param("bizNo")String bizNo); |
17 | 19 | ||
18 | int updatePhotoToValidByPK(@Param("id")int id, @Param("imageUrl")String imageUrl,@Param("validPhoto")int validPhoto); | 20 | int updatePhotoToValidByPK(@Param("id")int id, @Param("imageUrl")String imageUrl,@Param("validPhoto")int validPhoto); |
@@ -71,6 +71,13 @@ | @@ -71,6 +71,13 @@ | ||
71 | where id = #{id,jdbcType=INTEGER} | 71 | where id = #{id,jdbcType=INTEGER} |
72 | </update> | 72 | </update> |
73 | 73 | ||
74 | + <update id="updatePhotoStatusByPrimaryKeyAndValidStatus"> | ||
75 | + update zhima_cert | ||
76 | + set valid_photo = #{validPhoto} | ||
77 | + where id = #{id,jdbcType=INTEGER} and valid_status = 1 | ||
78 | + </update> | ||
79 | + | ||
80 | + | ||
74 | <update id="updateBizNoByByPrimaryKey"> | 81 | <update id="updateBizNoByByPrimaryKey"> |
75 | update zhima_cert | 82 | update zhima_cert |
76 | set biz_no = #{bizNo} | 83 | set biz_no = #{bizNo} |
@@ -44,10 +44,9 @@ public class OcrCertPhotoService { | @@ -44,10 +44,9 @@ public class OcrCertPhotoService { | ||
44 | @Value("${yoho.reviewed.controller.url}") | 44 | @Value("${yoho.reviewed.controller.url}") |
45 | private String messageUrl; | 45 | private String messageUrl; |
46 | 46 | ||
47 | - public Response<ImageReviewResp> ocrCheck(RealNameAuthorizeReqVO reqVO , List<ImageBO> imageBOList) { | 47 | + public Response<ImageReviewResp> ocrCheck(int uid , List<ImageBO> imageBOList) { |
48 | Response<ImageReviewResp> respVo = null; | 48 | Response<ImageReviewResp> respVo = null; |
49 | try{ | 49 | try{ |
50 | - int uid= reqVO.getUid(); | ||
51 | ImageReviewedReq req=new ImageReviewedReq(); | 50 | ImageReviewedReq req=new ImageReviewedReq(); |
52 | req.setUid(uid); | 51 | req.setUid(uid); |
53 | req.setImageBOList(imageBOList); | 52 | req.setImageBOList(imageBOList); |
@@ -57,7 +56,7 @@ public class OcrCertPhotoService { | @@ -57,7 +56,7 @@ public class OcrCertPhotoService { | ||
57 | req.setLicense("22c5c86b-3dad-473b-8688-a386a0695ba1"); | 56 | req.setLicense("22c5c86b-3dad-473b-8688-a386a0695ba1"); |
58 | 57 | ||
59 | //调用校验,然后直接返回 | 58 | //调用校验,然后直接返回 |
60 | - logger.info("checkCertPhoto call OcrCertPhotoService ocrCheck call begin uid {} ,RealNameAuthorizeReqVO {},ImageReviewedReq {}",uid,reqVO, JSON.toJSONString(req)); | 59 | + logger.info("checkCertPhoto call OcrCertPhotoService ocrCheck call begin uid {} ,ImageReviewedReq {}",uid, JSON.toJSONString(req)); |
61 | 60 | ||
62 | String url = messageUrl + "/imageAudit/imageAudit"; | 61 | String url = messageUrl + "/imageAudit/imageAudit"; |
63 | logger.info("checkCertPhoto call OcrCertPhotoService ocrCheck sendMessage url is {}", url); | 62 | logger.info("checkCertPhoto call OcrCertPhotoService ocrCheck sendMessage url is {}", url); |
@@ -372,33 +372,25 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { | @@ -372,33 +372,25 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { | ||
372 | private PhotoCheckResultVO zhiMaCertPhotoCheck(RealNameAuthorizeReqVO reqVO){ | 372 | private PhotoCheckResultVO zhiMaCertPhotoCheck(RealNameAuthorizeReqVO reqVO){ |
373 | //每天:记录一个累加的次数 ,超过一定的数量不允许继续调 | 373 | //每天:记录一个累加的次数 ,超过一定的数量不允许继续调 |
374 | String dayStr = getStringDate("yyyyMMdd"); | 374 | String dayStr = getStringDate("yyyyMMdd"); |
375 | - List<ImageBO> ls=new ArrayList<>(); | 375 | + List<ImageBO> imageBoList=new ArrayList<>(); |
376 | ImageBO frontUploadModel=new ImageBO(); | 376 | ImageBO frontUploadModel=new ImageBO(); |
377 | frontUploadModel.setImageSide("front"); | 377 | frontUploadModel.setImageSide("front"); |
378 | - frontUploadModel.setImageUrl(signPrivateUrl(reqVO.getFrontImageUrl())); | ||
379 | - ls.add(frontUploadModel); | 378 | + frontUploadModel.setImageUrl(ZhiMaCallUtil.signPrivateUrl(reqVO.getFrontImageUrl())); |
379 | + imageBoList.add(frontUploadModel); | ||
380 | 380 | ||
381 | //不再校验反面 | 381 | //不再校验反面 |
382 | /* | 382 | /* |
383 | ImageBO backUploadModel=new ImageBO(); | 383 | ImageBO backUploadModel=new ImageBO(); |
384 | backUploadModel.setImageSide("back"); | 384 | backUploadModel.setImageSide("back"); |
385 | backUploadModel.setImageUrl(signPrivateUrl(reqVO.getBackImageUrl())); | 385 | backUploadModel.setImageUrl(signPrivateUrl(reqVO.getBackImageUrl())); |
386 | - ls.add(backUploadModel); | 386 | + imageBoList.add(backUploadModel); |
387 | */ | 387 | */ |
388 | 388 | ||
389 | //调用接口,ocr验证 | 389 | //调用接口,ocr验证 |
390 | - PhotoCheckResultVO certPhotoCheckResult = checkCertPhoto(dayStr,ls ,reqVO); | 390 | + PhotoCheckResultVO certPhotoCheckResult = checkCertPhoto(dayStr,imageBoList ,reqVO); |
391 | return certPhotoCheckResult; | 391 | return certPhotoCheckResult; |
392 | } | 392 | } |
393 | 393 | ||
394 | - private String signPrivateUrl(String imgUrl){ | ||
395 | - //获取加载凭证后的url | ||
396 | - String accessKey = "BwWhoJN536BnV3CzlE20AjNKC9O2bP0l5tFpKsDU"; | ||
397 | - String secretKey = "_x2VtO7fEmylgjojmLi7qwTBtRm30S8BrO0FxOPK"; | ||
398 | - Auth auth = Auth.create(accessKey,secretKey); | ||
399 | - String downloadUrl = auth.privateDownloadUrl(imgUrl); | ||
400 | - return downloadUrl; | ||
401 | - } | ||
402 | 394 | ||
403 | /** | 395 | /** |
404 | * 调用通用的图片验证ocr | 396 | * 调用通用的图片验证ocr |
@@ -428,7 +420,7 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { | @@ -428,7 +420,7 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { | ||
428 | long num = cacheService.incrementPhotoCheckCount(dayStr,reqVO.getUid()); | 420 | long num = cacheService.incrementPhotoCheckCount(dayStr,reqVO.getUid()); |
429 | logger.info("checkCertPhoto call begin reqVO {} ,call redis count {}",reqVO, num); | 421 | logger.info("checkCertPhoto call begin reqVO {} ,call redis count {}",reqVO, num); |
430 | 422 | ||
431 | - Response<ImageReviewResp> imageReviewRespResponse =ocrCertPhotoService.ocrCheck(reqVO,imageBOList); | 423 | + Response<ImageReviewResp> imageReviewRespResponse =ocrCertPhotoService.ocrCheck(reqVO.getUid(),imageBOList); |
432 | logger.info("checkCertPhoto call end reqVO {} ,resp {} ",reqVO,JSON.toJSONString(imageReviewRespResponse)); | 424 | logger.info("checkCertPhoto call end reqVO {} ,resp {} ",reqVO,JSON.toJSONString(imageReviewRespResponse)); |
433 | 425 | ||
434 | if(imageReviewRespResponse==null||imageReviewRespResponse.getCode()!=200){ | 426 | if(imageReviewRespResponse==null||imageReviewRespResponse.getCode()!=200){ |
@@ -9,6 +9,8 @@ import com.alipay.api.request.ZhimaCustomerCertificationQueryRequest; | @@ -9,6 +9,8 @@ import com.alipay.api.request.ZhimaCustomerCertificationQueryRequest; | ||
9 | import com.alipay.api.response.ZhimaCustomerCertificationCertifyResponse; | 9 | import com.alipay.api.response.ZhimaCustomerCertificationCertifyResponse; |
10 | import com.alipay.api.response.ZhimaCustomerCertificationInitializeResponse; | 10 | import com.alipay.api.response.ZhimaCustomerCertificationInitializeResponse; |
11 | import com.alipay.api.response.ZhimaCustomerCertificationQueryResponse; | 11 | import com.alipay.api.response.ZhimaCustomerCertificationQueryResponse; |
12 | +import com.qiniu.util.Auth; | ||
13 | +import com.yoho.service.model.reviewed.request.ImageBO; | ||
12 | import org.slf4j.Logger; | 14 | import org.slf4j.Logger; |
13 | import org.slf4j.LoggerFactory; | 15 | import org.slf4j.LoggerFactory; |
14 | 16 | ||
@@ -169,4 +171,18 @@ public class ZhiMaCallUtil { | @@ -169,4 +171,18 @@ public class ZhiMaCallUtil { | ||
169 | } | 171 | } |
170 | 172 | ||
171 | } | 173 | } |
174 | + | ||
175 | + | ||
176 | + /************************************ | ||
177 | + * ocr 七牛私有bucket的url | ||
178 | + ***********************************/ | ||
179 | + | ||
180 | + public static String signPrivateUrl(String imgUrl){ | ||
181 | + //获取加载凭证后的url | ||
182 | + String accessKey = "BwWhoJN536BnV3CzlE20AjNKC9O2bP0l5tFpKsDU"; | ||
183 | + String secretKey = "_x2VtO7fEmylgjojmLi7qwTBtRm30S8BrO0FxOPK"; | ||
184 | + Auth auth = Auth.create(accessKey,secretKey); | ||
185 | + String downloadUrl = auth.privateDownloadUrl(imgUrl); | ||
186 | + return downloadUrl; | ||
187 | + } | ||
172 | } | 188 | } |
-
Please register or login to post a comment