Authored by 匡佳华

fix cerification version verify

@@ -44,9 +44,9 @@ public class CertificationController { @@ -44,9 +44,9 @@ public class CertificationController {
44 public ApiResponse alipayCertification(RealNameAuthorizeReqVO reqVO) throws GatewayException { 44 public ApiResponse alipayCertification(RealNameAuthorizeReqVO reqVO) throws GatewayException {
45 logger.info("CertificationController.alipayCertification: Enter alipayCertification param reqVO is {}", reqVO); 45 logger.info("CertificationController.alipayCertification: Enter alipayCertification param reqVO is {}", reqVO);
46 //若版本低于6.9.9, 提示升级版本 46 //若版本低于6.9.9, 提示升级版本
47 - if(configReader.getBoolean("ufo.user.idCertUpdateVersionSwitch",false) && compareVersion(reqVO.getApp_version(), "6.9.10") < 0){ 47 + if(configReader.getBoolean("ufo.user.idCertUpdateVersionSwitch",false) && compareVersion(reqVO.getApp_version(), "6.9.9") < 0){
48 logger.info("CertificationController.alipayCertification: version need update, version is {}, uid is {}", reqVO.getApp_version(), reqVO.getUid()); 48 logger.info("CertificationController.alipayCertification: version need update, version is {}, uid is {}", reqVO.getApp_version(), reqVO.getUid());
49 - throw new VersionNotSupportException(); 49 + throw new GatewayException(400, "支付宝实名认证服务已升级,请升级有货APP最新版本后重新申请");
50 } 50 }
51 //(1) 必要参数的校验 51 //(1) 必要参数的校验
52 if(reqVO == null || reqVO.getUid() <= 0){ 52 if(reqVO == null || reqVO.getUid() <= 0){
@@ -76,9 +76,9 @@ public class CertificationController { @@ -76,9 +76,9 @@ public class CertificationController {
76 public ApiResponse alipayCertifyResultQuery(RealNameAuthorizeReqVO reqVO) throws GatewayException { 76 public ApiResponse alipayCertifyResultQuery(RealNameAuthorizeReqVO reqVO) throws GatewayException {
77 logger.info("CertificationController.alipayCertifyResultQuery: Enter. RealNameAuthorizeReqVO is {}", reqVO); 77 logger.info("CertificationController.alipayCertifyResultQuery: Enter. RealNameAuthorizeReqVO is {}", reqVO);
78 //若版本低于6.9.9提示升级版本 78 //若版本低于6.9.9提示升级版本
79 - if(configReader.getBoolean("ufo.user.idCertUpdateVersionSwitch",false) && compareVersion(reqVO.getApp_version(), "6.9.10") < 0 ){ 79 + if(configReader.getBoolean("ufo.user.idCertUpdateVersionSwitch",false) && compareVersion(reqVO.getApp_version(), "6.9.9") < 0 ){
80 logger.info("CertificationController.alipayCertifyResultQuery: version need update, version is {}, uid is {}", reqVO.getApp_version(), reqVO.getUid()); 80 logger.info("CertificationController.alipayCertifyResultQuery: version need update, version is {}, uid is {}", reqVO.getApp_version(), reqVO.getUid());
81 - throw new VersionNotSupportException(); 81 + throw new GatewayException(400, "支付宝实名认证服务已升级,请升级有货APP最新版本后重新申请");
82 } 82 }
83 //(1) 校验请求的参数 83 //(1) 校验请求的参数
84 if (reqVO == null || StringUtils.isBlank(reqVO.getZhiMaBizNo())){ 84 if (reqVO == null || StringUtils.isBlank(reqVO.getZhiMaBizNo())){
1 package com.yohoufo.user.controller.passport; 1 package com.yohoufo.user.controller.passport;
2 2
3 3
  4 +import com.yoho.core.config.ConfigReader;
4 import com.yoho.tools.common.beans.ApiResponse; 5 import com.yoho.tools.common.beans.ApiResponse;
5 import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO; 6 import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO;
6 import com.yohoufo.common.exception.GatewayException; 7 import com.yohoufo.common.exception.GatewayException;
@@ -32,6 +33,9 @@ public class RealNameAuthorizeController { @@ -32,6 +33,9 @@ public class RealNameAuthorizeController {
32 33
33 private final String yohoCardUrlPre= "http://yhgidcard.static.yhbimg.com/yohocard"; 34 private final String yohoCardUrlPre= "http://yhgidcard.static.yhbimg.com/yohocard";
34 35
  36 + @Autowired
  37 + private ConfigReader configReader;
  38 +
35 /*@Autowired 39 /*@Autowired
36 GraphVerifyService graphVerifyService;*/ 40 GraphVerifyService graphVerifyService;*/
37 41
@@ -166,6 +170,12 @@ public class RealNameAuthorizeController { @@ -166,6 +170,12 @@ public class RealNameAuthorizeController {
166 @RequestMapping(params = "method=ufo.user.zhiMaCertWithPhotoCheckInit") 170 @RequestMapping(params = "method=ufo.user.zhiMaCertWithPhotoCheckInit")
167 public ApiResponse zhiMaCertWithPhotoCheckInit(RealNameAuthorizeReqVO reqVO) throws GatewayException { 171 public ApiResponse zhiMaCertWithPhotoCheckInit(RealNameAuthorizeReqVO reqVO) throws GatewayException {
168 logger.info("enter realNameAuthorize.zhiMaCertWithPhotoCheckInit param reqVO is {}", reqVO); 172 logger.info("enter realNameAuthorize.zhiMaCertWithPhotoCheckInit param reqVO is {}", reqVO);
  173 + //若版本低于6.9.9提示升级版本
  174 + if(configReader.getBoolean("ufo.user.idCertUpdateVersionSwitch",false) && compareVersion(reqVO.getApp_version(), "6.9.9") < 0 ){
  175 + logger.info("realNameAuthorize.zhiMaCertWithPhotoCheckInit: version need update, version is {}, uid is {}", reqVO.getApp_version(), reqVO.getUid());
  176 + throw new GatewayException(400, "支付宝实名认证服务已升级,请升级有货APP最新版本后重新申请");
  177 + }
  178 +
169 //(1) 优先校验请求的参数 179 //(1) 优先校验请求的参数
170 if (reqVO == null || reqVO.getUid()<=0){ 180 if (reqVO == null || reqVO.getUid()<=0){
171 throw new GatewayException(400, "uid不能为空!"); 181 throw new GatewayException(400, "uid不能为空!");
@@ -251,6 +261,12 @@ public class RealNameAuthorizeController { @@ -251,6 +261,12 @@ public class RealNameAuthorizeController {
251 public ApiResponse zhiMaCertResultQuery(RealNameAuthorizeReqVO reqVO) throws GatewayException { 261 public ApiResponse zhiMaCertResultQuery(RealNameAuthorizeReqVO reqVO) throws GatewayException {
252 logger.info("enter realNameAuthorize.zhiMaCertResultQuery param reqVO is {}", reqVO); 262 logger.info("enter realNameAuthorize.zhiMaCertResultQuery param reqVO is {}", reqVO);
253 263
  264 + //若版本低于6.9.9提示升级版本
  265 + if(configReader.getBoolean("ufo.user.idCertUpdateVersionSwitch",false) && compareVersion(reqVO.getApp_version(), "6.9.9") < 0 ){
  266 + logger.info("realNameAuthorize.zhiMaCertResultQuery: version need update, version is {}, uid is {}", reqVO.getApp_version(), reqVO.getUid());
  267 + throw new GatewayException(400, "支付宝实名认证服务已升级,请升级有货APP最新版本后重新申请");
  268 + }
  269 +
254 //(1) 优先校验请求的参数 270 //(1) 优先校验请求的参数
255 if (reqVO == null || reqVO.getUid()<=0){ 271 if (reqVO == null || reqVO.getUid()<=0){
256 throw new GatewayException(400, "参数错误,uid不能为空!"); 272 throw new GatewayException(400, "参数错误,uid不能为空!");
@@ -266,4 +282,28 @@ public class RealNameAuthorizeController { @@ -266,4 +282,28 @@ public class RealNameAuthorizeController {
266 return result; 282 return result;
267 } 283 }
268 284
  285 + private int compareVersion(String curVersion,String sysVersion){
  286 + boolean isCurBlank = StringUtils.isBlank(curVersion);
  287 + boolean isSysBlank = StringUtils.isBlank(sysVersion);
  288 + if(isCurBlank && isSysBlank){
  289 + return 0;
  290 + }
  291 + if(isCurBlank){
  292 + return -1;
  293 + }
  294 + if(isSysBlank){
  295 + return 1;
  296 + }
  297 + String[] curArr = curVersion.split("\\.");
  298 + String[] sysArr = sysVersion.split("\\.");
  299 + for(int i=0;i<3;i++){
  300 + int cur = Integer.parseInt(curArr[i]);
  301 + int sys = Integer.parseInt(sysArr[i]);
  302 + if(cur != sys){
  303 + return cur-sys;
  304 + }
  305 + }
  306 + return 0;
  307 + }
  308 +
269 } 309 }
@@ -42,4 +42,4 @@ ufo.order.seller.noticeHKSellerEmailTo=chao.chen@yoho.cn,xiuchun.luo@yoho.cn @@ -42,4 +42,4 @@ ufo.order.seller.noticeHKSellerEmailTo=chao.chen@yoho.cn,xiuchun.luo@yoho.cn
42 ufo.user.idCertSwitch=false 42 ufo.user.idCertSwitch=false
43 43
44 #实名认证提示版本升级开关 44 #实名认证提示版本升级开关
45 -ufo.user.idCertUpdateVersionSwitch = true  
  45 +ufo.user.idCertUpdateVersionSwitch = false