...
|
...
|
@@ -3,14 +3,11 @@ package com.yohoufo.user.controller.passport; |
|
|
|
|
|
import com.yoho.tools.common.beans.ApiResponse;
|
|
|
import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO;
|
|
|
import com.yohoufo.common.constant.CertPhotoEnum;
|
|
|
import com.yohoufo.common.exception.GatewayException;
|
|
|
import com.yohoufo.common.helper.ImageUrlAssist;
|
|
|
import com.yohoufo.common.utils.UserInfoHiddenHelper;
|
|
|
import com.yohoufo.dal.user.model.ZhiMaCert;
|
|
|
import com.yohoufo.user.common.IDCardUtils;
|
|
|
import com.yohoufo.user.helper.HideDataUtil;
|
|
|
import com.yohoufo.user.requestVO.PhotoCheckResultVO;
|
|
|
import com.yohoufo.user.requestVO.RealNameAuthorizeReqVO;
|
|
|
import com.yohoufo.user.service.IRealNameAuthorizeService;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
...
|
...
|
@@ -21,8 +18,6 @@ import org.springframework.web.bind.annotation.RequestMapping; |
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* 用户身份通过银行卡实名认证
|
|
|
* Created by craig.qin on 2018/9/11.
|
...
|
...
|
@@ -165,91 +160,6 @@ public class RealNameAuthorizeController { |
|
|
return new ApiResponse(zhiMaCertInfo);
|
|
|
}
|
|
|
|
|
|
/*@RequestMapping(params = "method=ufo.user.photoCheckExceedLimit")
|
|
|
public ApiResponse photoCheckExceedLimit(@RequestParam("uid") Integer uid) throws GatewayException {
|
|
|
logger.info("enter realNameAuthorize.photoCheckExceedLimit param uid is {}", uid);
|
|
|
//(1) 优先校验请求的参数
|
|
|
if (uid == null || uid <=0 ){
|
|
|
throw new GatewayException(400, "参数错误,uid不存在!");
|
|
|
}
|
|
|
|
|
|
boolean b =realNameAuthorizeService.isPhotoCheckExceedLimit(uid);
|
|
|
|
|
|
return new ApiResponse(b);
|
|
|
}*/
|
|
|
|
|
|
/**
|
|
|
* 6.9.1版本 ,上传身份证图片并校验
|
|
|
* 由于调用百度云ocr验证接口,需求图片流
|
|
|
* 因此要求正反面一起上传,两张
|
|
|
* bucket :yohocard
|
|
|
*/
|
|
|
/*
|
|
|
@Deprecated
|
|
|
@RequestMapping(params = "method=ufo.user.zhiMaCertUploadPhotoAndCheck")
|
|
|
public ApiResponse zhiMaCertUploadPhotoAndCheck(@RequestParam("files") MultipartFile[] files,
|
|
|
@RequestParam(value = "bucket") String bucket,
|
|
|
@RequestParam(value = "limitType", required = false) Integer limitType,
|
|
|
RealNameAuthorizeReqVO reqVO) throws Exception {
|
|
|
logger.info("zhiMaCertUploadPhotoAndCheck , reqVO [{}], files by files [{}] , and bucket [{}] , limitType [{}]",reqVO , files, bucket, limitType);
|
|
|
try {
|
|
|
//(1) 优先校验请求的参数
|
|
|
if (reqVO == null || reqVO.getUid()<=0){
|
|
|
throw new GatewayException(400, "uid不能为空!");
|
|
|
}
|
|
|
|
|
|
if ( StringUtils.isEmpty(reqVO.getCertNo())|| StringUtils.isEmpty(reqVO.getCertName())){
|
|
|
throw new GatewayException(400, "身份证号、姓名不能为空!");
|
|
|
}
|
|
|
|
|
|
//身份证格式校验IDCardUtils
|
|
|
if(!IDCardUtils.validate(reqVO.getCertNo())){
|
|
|
throw new GatewayException(400, "身份证号格式不正确!");
|
|
|
}
|
|
|
|
|
|
List<String> imgUrls = realNameAuthorizeService.zhiMaCertUploadPhotoAndCheck(files, bucket, limitType,reqVO);
|
|
|
return new ApiResponse(200, "上传成功", imgUrls);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
logger.info("upload files fail");
|
|
|
return new ApiResponse(400, "上传失败" + e.getMessage(), null);
|
|
|
}
|
|
|
}
|
|
|
*/
|
|
|
|
|
|
/*@RequestMapping(params = "method=ufo.user.zhiMaCertPhotoCheck")
|
|
|
public ApiResponse zhiMaCertPhotoCheck(RealNameAuthorizeReqVO reqVO) {
|
|
|
logger.info("zhiMaCertPhotoCheck , reqVO [{}]",reqVO );
|
|
|
try {
|
|
|
//(1) 优先校验请求的参数
|
|
|
if (reqVO == null || reqVO.getUid()<=0){
|
|
|
throw new GatewayException(400, "uid不能为空!");
|
|
|
}
|
|
|
|
|
|
if ( StringUtils.isEmpty(reqVO.getCertNo())|| StringUtils.isEmpty(reqVO.getCertName())){
|
|
|
throw new GatewayException(400, "身份证号、姓名不能为空!");
|
|
|
}
|
|
|
|
|
|
//身份证格式校验IDCardUtils
|
|
|
if(!IDCardUtils.validate(reqVO.getCertNo())){
|
|
|
throw new GatewayException(400, "身份证号格式不正确!");
|
|
|
}
|
|
|
|
|
|
//身份证图片,必须
|
|
|
if(StringUtils.isBlank(reqVO.getFrontImageUrl())||StringUtils.isBlank(reqVO.getBackImageUrl())){
|
|
|
throw new GatewayException(400, "身份证正反面图片不能为空!");
|
|
|
}
|
|
|
|
|
|
PhotoCheckResultVO result = realNameAuthorizeService.zhiMaCertPhotoCheck(reqVO);
|
|
|
|
|
|
return new ApiResponse(200, "上传图片验证完成", result);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
logger.info("upload files fail");
|
|
|
return new ApiResponse(400, "上传图片验证异常" + e.getMessage(), null);
|
|
|
}
|
|
|
}*/
|
|
|
|
|
|
@RequestMapping(params = "method=ufo.user.zhiMaCertWithPhotoCheckInit")
|
|
|
public ApiResponse zhiMaCertWithPhotoCheckInit(RealNameAuthorizeReqVO reqVO) throws GatewayException {
|
|
|
logger.info("enter realNameAuthorize.zhiMaCertWithPhotoCheckInit param reqVO is {}", reqVO);
|
...
|
...
|
@@ -293,52 +203,6 @@ public class RealNameAuthorizeController { |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 6.9.1版本 ,芝麻认证要求上传图片
|
|
|
* 原接口保持不变,芝麻认证用新的接口
|
|
|
* 芝麻认证(初始化并购置返回url)
|
|
|
*/
|
|
|
/*@RequestMapping(params = "method=ufo.user.zhiMaCertWithPhotoInit")
|
|
|
public ApiResponse zhiMaCertWithPhotoInit(RealNameAuthorizeReqVO reqVO) throws GatewayException {
|
|
|
logger.info("enter realNameAuthorize.zhiMaCertWithPhotoInit param reqVO is {}", reqVO);
|
|
|
|
|
|
//(1) 优先校验请求的参数
|
|
|
if (reqVO == null || reqVO.getUid()<=0){
|
|
|
throw new GatewayException(400, "uid不能为空!");
|
|
|
}
|
|
|
|
|
|
if ( StringUtils.isEmpty(reqVO.getCertNo())|| StringUtils.isEmpty(reqVO.getCertName())){
|
|
|
throw new GatewayException(400, "身份证号、姓名不能为空!");
|
|
|
}
|
|
|
|
|
|
//身份证格式校验IDCardUtils
|
|
|
if(!IDCardUtils.validate(reqVO.getCertNo())){
|
|
|
throw new GatewayException(400, "身份证号格式不正确!");
|
|
|
}
|
|
|
|
|
|
//身份证图片,必须
|
|
|
if(StringUtils.isBlank(reqVO.getFrontImageUrl())||StringUtils.isBlank(reqVO.getBackImageUrl())){
|
|
|
throw new GatewayException(400, "身份证正反面图片不能为空!");
|
|
|
}
|
|
|
|
|
|
if(CertPhotoEnum.valid.getStatus()!=reqVO.getPhotoValidStatus()
|
|
|
&&CertPhotoEnum.valid_but_uncheck.getStatus()!=reqVO.getPhotoValidStatus()){
|
|
|
throw new GatewayException(400, "身份证图片状态异常!");
|
|
|
}
|
|
|
|
|
|
//调用芝麻,得到回调url
|
|
|
AuthorizeResultRespVO resultVo=realNameAuthorizeService.zhiMaCertWithPhotoInit(reqVO,false);
|
|
|
logger.info("realNameAuthorize.zhiMaCertInit result vo {} ",resultVo);
|
|
|
ApiResponse apiResponse=new ApiResponse();
|
|
|
if(resultVo==null){
|
|
|
apiResponse.setCode(201);
|
|
|
apiResponse.setMessage("异常结果为空");
|
|
|
}
|
|
|
apiResponse.setData(resultVo);
|
|
|
return apiResponse;
|
|
|
|
|
|
}*/
|
|
|
|
|
|
/**
|
|
|
* 芝麻认证(初始化并购置返回url)
|
|
|
*/
|
|
|
@RequestMapping(params = "method=ufo.user.zhiMaCertInit")
|
...
|
...
|
|