记得上下班打卡 | git大法好,push需谨慎

Commit 15c00aec authored by 张国柄's avatar 张国柄

fix:+实名认证失败本地标记,避免失败重复刷实名接口;

fix:~实名姓名认证正则调整;
parent ac518562
...@@ -24,6 +24,10 @@ public class AdamRedisConst { ...@@ -24,6 +24,10 @@ public class AdamRedisConst {
public static final String INFO_ENTERS = INFO.concat("enters:"); public static final String INFO_ENTERS = INFO.concat("enters:");
public static final String INFO_ADDRESSES = INFO.concat("addresses:"); public static final String INFO_ADDRESSES = INFO.concat("addresses:");
public static final String INFO_CERTIFICATION = INFO.concat("certification:"); public static final String INFO_CERTIFICATION = INFO.concat("certification:");
/**
* 认证失败标记
*/
public static final String INFO_CERTIFICATION_JUNK = INFO.concat("certification_junk:");
public static final String INFO_MEMBER_SIMPLE = INFO.concat("member:simple"); public static final String INFO_MEMBER_SIMPLE = INFO.concat("member:simple");
public static final String INFO_MEMBER_CATEGORY = INFO.concat("member:category:"); public static final String INFO_MEMBER_CATEGORY = INFO.concat("member:category:");
......
...@@ -17,7 +17,7 @@ public class LnsRegex { ...@@ -17,7 +17,7 @@ public class LnsRegex {
/** /**
* 汉字-姓名(2~20位) * 汉字-姓名(2~20位)
*/ */
public static final String CN_HANZI = "^[\\u4e00-\\u9fa5]{2,20}$"; public static final String CN_HANZI = "^[\\u4e00-\\u9fa5+\\·?\\u4e00-\\u9fa5+]{2,30}$";
/** /**
* 汉字-省|市|区(2~30位) * 汉字-省|市|区(2~30位)
*/ */
......
...@@ -231,9 +231,6 @@ public class AdamUserController { ...@@ -231,9 +231,6 @@ public class AdamUserController {
return ResponseDto.failure(ErrorMapping.get("10104")); return ResponseDto.failure(ErrorMapping.get("10104"));
} }
AdamRealInfoVo vo = adamUserService.identity(CurrentUtil.getCurrentUid(), name, idCard); AdamRealInfoVo vo = adamUserService.identity(CurrentUtil.getCurrentUid(), name, idCard);
if (null == vo) {
return ResponseDto.failure(ErrorMapping.get("10000"));
}
vo.setName(SensitizeUtil.chineseName(vo.getName())); vo.setName(SensitizeUtil.chineseName(vo.getName()));
vo.setIdCard(SensitizeUtil.custom(vo.getIdCard(), 3, 2)); vo.setIdCard(SensitizeUtil.custom(vo.getIdCard(), 3, 2));
return ResponseDto.success(vo); return ResponseDto.success(vo);
......
...@@ -156,7 +156,18 @@ public class AdamRdmService { ...@@ -156,7 +156,18 @@ public class AdamRdmService {
return vo; return vo;
} }
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | <ID_TYPE+ID_NO, ID_NAME> */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 认证失败的<ID_TYPE+ID_NO, ID_NAME> */
public boolean setCertificationJunk(int idType, String idNo, String idName) {
return redisUtil.set(AdamRedisConst.INFO_CERTIFICATION_JUNK + idType + idNo, idName, 604800);
}
public boolean isCertificationJunk(int idType, String idNo, String idName) {
String o = (String) redisUtil.get(AdamRedisConst.INFO_CERTIFICATION_JUNK + idType + idNo);
return !StringUtils.isEmpty(o) && o.equals(idName);
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 认证成功的<ID_TYPE+ID_NO, ID_NAME> */
public boolean setCertification(int idType, String idNo, String idName) { public boolean setCertification(int idType, String idNo, String idName) {
return redisUtil.set(AdamRedisConst.INFO_CERTIFICATION + idType + idNo, idName); return redisUtil.set(AdamRedisConst.INFO_CERTIFICATION + idType + idNo, idName);
......
...@@ -323,10 +323,16 @@ public class AdamUserServiceImpl implements IAdamUserService { ...@@ -323,10 +323,16 @@ public class AdamUserServiceImpl implements IAdamUserService {
public AdamRealInfoVo identity(String uid, String name, String idCard) { public AdamRealInfoVo identity(String uid, String name, String idCard) {
AdamRealInfoVo vo = null; AdamRealInfoVo vo = null;
if (!adamRdmService.isCertification(1, idCard, name)) { if (!adamRdmService.isCertification(1, idCard, name)) {
if (adamRdmService.isCertificationJunk(1, idCard, name)) {
ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("10102");
throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
}
String respStr = IdentityUtils.aliThird(name, idCard); String respStr = IdentityUtils.aliThird(name, idCard);
JsonNode respJNode = JsonUtils.fromJson(respStr, JsonNode.class); JsonNode respJNode = JsonUtils.fromJson(respStr, JsonNode.class);
if (null == respJNode || !"0".equals(respJNode.get("error_code").asText())) { if (null == respJNode || !"0".equals(respJNode.get("error_code").asText())) {
log.info("###实名认证失败[{}]", respStr); log.info("###实名认证失败[{}]", respStr);
adamRdmService.setCertificationJunk(1, idCard, name);
ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("10102"); ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("10102");
throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage()); throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment