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

Commit 28eef5a4 authored by 张国柄's avatar 张国柄

~api:入场人改三要素认证;

parent 4a808db2
......@@ -23,7 +23,7 @@ public class IdentityUtils {
try {
return HttpUtil.post(aliThirdUrl, params, header);
} catch (Exception e) {
log.error("###实名认证异常:{}", e.getLocalizedMessage(), e);
log.error("###实名认证异常:{}", params, e);
if (e instanceof UnknownHttpStatusCodeException) {
UnknownHttpStatusCodeException unknownHttpStatusCodeException = (UnknownHttpStatusCodeException) e;
......@@ -52,7 +52,7 @@ public class IdentityUtils {
try {
return HttpUtil.get(ALI_MOBILE_CERT_HOST.concat(ALI_MOBILE_CERT3_META_URI), paramsMap, headersMap);
} catch (Exception e) {
log.error("###实名认证异常:{}", e.getLocalizedMessage(), e);
log.error("###实名认证异常:{}", paramsMap, e);
if (e instanceof UnknownHttpStatusCodeException) {
UnknownHttpStatusCodeException unknownHttpStatusCodeException = (UnknownHttpStatusCodeException) e;
return unknownHttpStatusCodeException.getMessage();
......
......@@ -220,15 +220,6 @@ public class AdamRdmService {
return !StringUtils.isEmpty(o) && o.equals(idName);
}
public boolean setCertmetaJunk(int idType, String idNo, String idName, String mobile) {
return redisUtil.set(AdamRedisConst.INFO_CERTMETA_JUNK + idType + idNo, idName.concat(",").concat(mobile), 604800);
}
public boolean isCertmetaJunk(int idType, String idNo, String idName, String mobile) {
String val = (String) redisUtil.get(AdamRedisConst.INFO_CERTMETA_JUNK + idType + idNo);
return !StringUtils.isEmpty(val) && val.equals(idName.concat(",").concat(mobile));
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 认证成功的<ID_TYPE+ID_NO, ID_NAME> */
/**
......@@ -311,19 +302,52 @@ public class AdamRdmService {
* @param mobile
*/
public void identityHandler3(String name, String idCard, String mobile) {
if (this.isCertmetaJunk(1, idCard, name, mobile)) {
ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("10112");
throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
switch (this.isCertmeta(1, idCard, name, mobile)) {
case -1:// 本地不存在
if (this.isCertmetaJunk(1, idCard, name, mobile)) {
ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("10112");
throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
}
String respStr = IdentityUtils.ali3Meta(name, idCard, mobile);
JsonNode respJNode = JsonUtils.fromJson(respStr, JsonNode.class);
if (null == respJNode || !"200".equals(respJNode.get("code").asText())
|| !respJNode.get("data").get("bizCode").asText().equals("1")) {
log.warn("###实名认证失败[{}]", respStr);
this.setCertmetaJunk(1, idCard, name, mobile);
ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("10112");
throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
}
this.setCertmeta(1, idCard, name, mobile);
break;
case 0:// 本地存在,验证不通过
ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("10112");
throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
case 1:// 本地存在,验证通过
break;
}
String respStr = IdentityUtils.ali3Meta(name, idCard, mobile);
JsonNode respJNode = JsonUtils.fromJson(respStr, JsonNode.class);
if (null == respJNode || !"200".equals(respJNode.get("code").asText())
|| !respJNode.get("data").get("bizCode").asText().equals("1")) {
log.warn("###实名认证失败[{}]", respStr);
this.setCertmetaJunk(1, idCard, name, mobile);
ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("10112");
throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 三要素认证缓存的<ID_TYPE+ID_NO, "ID_NAME,MOBILE"> */
public boolean setCertmetaJunk(int idType, String idNo, String idName, String mobile) {
return redisUtil.set(AdamRedisConst.INFO_CERTMETA_JUNK + idType + idNo, idName.concat(",").concat(mobile), 604800);
}
public boolean isCertmetaJunk(int idType, String idNo, String idName, String mobile) {
String val = (String) redisUtil.get(AdamRedisConst.INFO_CERTMETA_JUNK + idType + idNo);
return !StringUtils.isEmpty(val) && val.equals(idName.concat(",").concat(mobile));
}
public boolean setCertmeta(int idType, String idNo, String idName, String mobile) {
return redisUtil.set(AdamRedisConst.INFO_CERTMETA + idType + idNo, idName.concat(",").concat(mobile));
}
public int isCertmeta(int idType, String idNo, String idName, String mobile) {
String o = (String) redisUtil.get(AdamRedisConst.INFO_CERTMETA + idType + idNo);
if (StringUtils.isEmpty(o)) {
return -1;
}
return o.equals(idName.concat(",").concat(mobile)) ? 1 : 0;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | <UID, List<AdamThirdPartInfoVo>> */
......
......@@ -54,7 +54,8 @@ public class AdamEntersServiceImpl implements IAdamEntersService {
//
// adamRdmService.setCertification(1, parameter.getIdCard(), parameter.getName());
// }
adamRdmService.identityHandler1(currentUid, parameter.getName(), parameter.getIdCard());
// adamRdmService.identityHandler1(currentUid, parameter.getName(), parameter.getIdCard());
adamRdmService.identityHandler3(parameter.getName(), parameter.getIdCard(), parameter.getMobile());
}
......@@ -134,7 +135,8 @@ public class AdamEntersServiceImpl implements IAdamEntersService {
//
// adamRdmService.setCertification(1, parameter.getIdCard(), parameter.getName());
// }
adamRdmService.identityHandler1(currentUid, parameter.getName(), parameter.getIdCard());
// adamRdmService.identityHandler1(currentUid, parameter.getName(), parameter.getIdCard());
adamRdmService.identityHandler3(parameter.getName(), parameter.getIdCard(), parameter.getMobile());
}
List<AdamEntersVo> vos = adamRdmService.getEntersVoByUid(currentUid);
......
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