Authored by 匡佳华

fix cerification version verify

... ... @@ -44,9 +44,9 @@ public class CertificationController {
public ApiResponse alipayCertification(RealNameAuthorizeReqVO reqVO) throws GatewayException {
logger.info("CertificationController.alipayCertification: Enter alipayCertification param reqVO is {}", reqVO);
//若版本低于6.9.9, 提示升级版本
if(configReader.getBoolean("ufo.user.idCertUpdateVersionSwitch",false) && compareVersion(reqVO.getApp_version(), "6.9.10") < 0){
if(configReader.getBoolean("ufo.user.idCertUpdateVersionSwitch",false) && compareVersion(reqVO.getApp_version(), "6.9.9") < 0){
logger.info("CertificationController.alipayCertification: version need update, version is {}, uid is {}", reqVO.getApp_version(), reqVO.getUid());
throw new VersionNotSupportException();
throw new GatewayException(400, "支付宝实名认证服务已升级,请升级有货APP最新版本后重新申请");
}
//(1) 必要参数的校验
if(reqVO == null || reqVO.getUid() <= 0){
... ... @@ -76,9 +76,9 @@ public class CertificationController {
public ApiResponse alipayCertifyResultQuery(RealNameAuthorizeReqVO reqVO) throws GatewayException {
logger.info("CertificationController.alipayCertifyResultQuery: Enter. RealNameAuthorizeReqVO is {}", reqVO);
//若版本低于6.9.9提示升级版本
if(configReader.getBoolean("ufo.user.idCertUpdateVersionSwitch",false) && compareVersion(reqVO.getApp_version(), "6.9.10") < 0 ){
if(configReader.getBoolean("ufo.user.idCertUpdateVersionSwitch",false) && compareVersion(reqVO.getApp_version(), "6.9.9") < 0 ){
logger.info("CertificationController.alipayCertifyResultQuery: version need update, version is {}, uid is {}", reqVO.getApp_version(), reqVO.getUid());
throw new VersionNotSupportException();
throw new GatewayException(400, "支付宝实名认证服务已升级,请升级有货APP最新版本后重新申请");
}
//(1) 校验请求的参数
if (reqVO == null || StringUtils.isBlank(reqVO.getZhiMaBizNo())){
... ...
package com.yohoufo.user.controller.passport;
import com.yoho.core.config.ConfigReader;
import com.yoho.tools.common.beans.ApiResponse;
import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO;
import com.yohoufo.common.exception.GatewayException;
... ... @@ -32,6 +33,9 @@ public class RealNameAuthorizeController {
private final String yohoCardUrlPre= "http://yhgidcard.static.yhbimg.com/yohocard";
@Autowired
private ConfigReader configReader;
/*@Autowired
GraphVerifyService graphVerifyService;*/
... ... @@ -166,6 +170,12 @@ public class RealNameAuthorizeController {
@RequestMapping(params = "method=ufo.user.zhiMaCertWithPhotoCheckInit")
public ApiResponse zhiMaCertWithPhotoCheckInit(RealNameAuthorizeReqVO reqVO) throws GatewayException {
logger.info("enter realNameAuthorize.zhiMaCertWithPhotoCheckInit param reqVO is {}", reqVO);
//若版本低于6.9.9提示升级版本
if(configReader.getBoolean("ufo.user.idCertUpdateVersionSwitch",false) && compareVersion(reqVO.getApp_version(), "6.9.9") < 0 ){
logger.info("realNameAuthorize.zhiMaCertWithPhotoCheckInit: version need update, version is {}, uid is {}", reqVO.getApp_version(), reqVO.getUid());
throw new GatewayException(400, "支付宝实名认证服务已升级,请升级有货APP最新版本后重新申请");
}
//(1) 优先校验请求的参数
if (reqVO == null || reqVO.getUid()<=0){
throw new GatewayException(400, "uid不能为空!");
... ... @@ -251,6 +261,12 @@ public class RealNameAuthorizeController {
public ApiResponse zhiMaCertResultQuery(RealNameAuthorizeReqVO reqVO) throws GatewayException {
logger.info("enter realNameAuthorize.zhiMaCertResultQuery param reqVO is {}", reqVO);
//若版本低于6.9.9提示升级版本
if(configReader.getBoolean("ufo.user.idCertUpdateVersionSwitch",false) && compareVersion(reqVO.getApp_version(), "6.9.9") < 0 ){
logger.info("realNameAuthorize.zhiMaCertResultQuery: version need update, version is {}, uid is {}", reqVO.getApp_version(), reqVO.getUid());
throw new GatewayException(400, "支付宝实名认证服务已升级,请升级有货APP最新版本后重新申请");
}
//(1) 优先校验请求的参数
if (reqVO == null || reqVO.getUid()<=0){
throw new GatewayException(400, "参数错误,uid不能为空!");
... ... @@ -266,4 +282,28 @@ public class RealNameAuthorizeController {
return result;
}
private int compareVersion(String curVersion,String sysVersion){
boolean isCurBlank = StringUtils.isBlank(curVersion);
boolean isSysBlank = StringUtils.isBlank(sysVersion);
if(isCurBlank && isSysBlank){
return 0;
}
if(isCurBlank){
return -1;
}
if(isSysBlank){
return 1;
}
String[] curArr = curVersion.split("\\.");
String[] sysArr = sysVersion.split("\\.");
for(int i=0;i<3;i++){
int cur = Integer.parseInt(curArr[i]);
int sys = Integer.parseInt(sysArr[i]);
if(cur != sys){
return cur-sys;
}
}
return 0;
}
}
... ...
... ... @@ -42,4 +42,4 @@ ufo.order.seller.noticeHKSellerEmailTo=chao.chen@yoho.cn,xiuchun.luo@yoho.cn
ufo.user.idCertSwitch=false
#实名认证提示版本升级开关
ufo.user.idCertUpdateVersionSwitch = true
\ No newline at end of file
ufo.user.idCertUpdateVersionSwitch = false
\ No newline at end of file
... ...