...
|
...
|
@@ -48,6 +48,7 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { |
|
|
private final static DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
|
|
|
|
|
|
private final String UFO_USER_AUTHORIZE_FAILED_PREX="ufo:user:authorizeFailed:";
|
|
|
private final String UFO_USER_AUTHORIZE_INFO_PREX="ufo:user:authorizeInfo:";
|
|
|
//请求实名认证银联接口url 测试环境
|
|
|
private final String requestUrl="http://58.247.0.18:29015/v1/datacenter/smartverification/bankcard/verify";
|
|
|
//请求实名认证银联接口url 生产环境
|
...
|
...
|
@@ -81,7 +82,7 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { |
|
|
AuthorizeResultRespVO result=new AuthorizeResultRespVO();
|
|
|
result.setUid(uid);
|
|
|
|
|
|
UserAuthorizeInfo info= userAuthorizeInfoDao.selectValidAuthorizeInfoByUid(uid);
|
|
|
UserAuthorizeInfo info= getValidAuthorizeInfoFromRedis(uid);
|
|
|
if(null!=info){
|
|
|
result.setAuthorizeFlag(true);
|
|
|
result.setCardNo(info.getCardNo());
|
...
|
...
|
@@ -95,6 +96,27 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { |
|
|
return result;
|
|
|
}
|
|
|
|
|
|
private UserAuthorizeInfo getValidAuthorizeInfoFromRedis(int uid){
|
|
|
// 从redis缓存中获取
|
|
|
RedisKeyBuilder key=RedisKeyBuilder.newInstance().appendFixed(UFO_USER_AUTHORIZE_INFO_PREX).appendVar(uid);
|
|
|
UserAuthorizeInfo authorizeInfo = redisValueCache.get(key,UserAuthorizeInfo.class);
|
|
|
if(null != authorizeInfo){
|
|
|
return authorizeInfo;
|
|
|
}
|
|
|
|
|
|
//如果不存在,则从数据库获取
|
|
|
authorizeInfo= userAuthorizeInfoDao.selectValidAuthorizeInfoByUid(uid);
|
|
|
if(authorizeInfo!=null){
|
|
|
//保存到redis
|
|
|
try{
|
|
|
redisValueCache.set(key, authorizeInfo,60*60*2L,TimeUnit.SECONDS);
|
|
|
}catch(Exception e){
|
|
|
logger.warn("set valid authorize info to redis error. uid={}", uid);
|
|
|
}
|
|
|
}
|
|
|
return authorizeInfo;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 实名身份认证
|
|
|
*/
|
...
|
...
|
@@ -105,7 +127,7 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { |
|
|
String name=reqVO.getName();
|
|
|
|
|
|
//检查是否已经实名认证,如果已经认证直接返回
|
|
|
if(null!=userAuthorizeInfoDao.selectValidAuthorizeInfoByUid(uid)){
|
|
|
if(null!=getValidAuthorizeInfoFromRedis(uid)){
|
|
|
return new ApiResponse(400,"已实名认证",null);
|
|
|
}
|
|
|
|
...
|
...
|
|