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

Commit aa1cffd1 authored by 张国柄's avatar 张国柄

~API:实名认证、购买会员实名调整为三要素认证;

parent 1ded0d6a
......@@ -22,6 +22,11 @@ public class AdamRedisConst {
public static final String INFO_ADDRESSES = PREFIX.concat("info:addresses:");
public static final String INFO_CERTIFICATION = PREFIX.concat("info:certification:");
/**
* {adam:info:certmeta:{idType+idNo},{idname,mobile}}
*/
public static final String INFO_CERTMETA = PREFIX.concat("info:certmeta:");
public static final String INFO_CERTMETA_JUNK = PREFIX.concat("info:certmeta:");
/**
* 认证失败标记
*/
......
......@@ -21,9 +21,15 @@ public class AdamRealInfoVo implements Serializable, Cloneable {
private String idCard;
@ApiModelProperty(position = 13, value = "类型[1-大陆身份证,2-港澳通行证,3-台胞证,4-护照,5-军官证]")
private Integer type;
@ApiModelProperty(position = 13, value = "认证节点[2-二要素|3-三要素]")
private Integer node;
@ApiModelProperty(position = 14, value = "状态:1-正常")
private Integer state;
public Integer getNode() {
return null == node ? 2 : node;
}
private static final AdamRealInfoVo obj = new AdamRealInfoVo();
public static AdamRealInfoVo getNew() {
......@@ -40,6 +46,7 @@ public class AdamRealInfoVo implements Serializable, Cloneable {
this.setName(source.getName());
this.setIdCard(source.getIdCard());
this.setType(source.getType());
this.setNode(source.getNode());
this.setState(source.getState());
return this;
}
......
......@@ -67,5 +67,5 @@ public interface IAdamUserService {
void close(String uid);
AdamRealInfoVo identity(String uid, String name, String idCard);
AdamRealInfoVo identity(String uid, String name, String idCard, String mobile);
}
......@@ -128,7 +128,7 @@ public class AdamMemberOrderController {
if (StringUtils.isBlank(param.getName()) || StringUtils.isBlank(param.getIdCard())) {
return ResponseDto.failure(ErrorMapping.get("10101"));
}
adamUserService.identity(currentUid, param.getName(), param.getIdCard());
adamUserService.identity(currentUid, param.getName(), param.getIdCard(), (String) CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_MOBILE));
}
return adamMemberOrderService.buyMemberOrMemberCode(currentUid, param);
......@@ -247,7 +247,7 @@ public class AdamMemberOrderController {
if (StringUtils.isBlank(param.getName()) || StringUtils.isBlank(param.getIdCard())) {
return ResponseDto.failure(ErrorMapping.get("10101"));
}
AdamRealInfoVo vo = adamUserService.identity(currentUid, param.getName(), param.getIdCard());
AdamRealInfoVo vo = adamUserService.identity(currentUid, param.getName(), param.getIdCard(), (String) CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_MOBILE));
if (null == vo) {
return ResponseDto.failure(ErrorMapping.get("10000"));
}
......
......@@ -298,7 +298,7 @@ public class AdamUserController {
realInfoVoByUid.setIdCard(SensitizeUtil.custom(realInfoVoByUid.getIdCard(), 3, 2));
return ResponseDto.success(realInfoVoByUid);
}
AdamRealInfoVo vo = adamUserService.identity(currentUid, name, idCard);
AdamRealInfoVo vo = adamUserService.identity(currentUid, name, idCard, (String) CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_MOBILE));
vo.setName(SensitizeUtil.chineseName(vo.getName()));
vo.setIdCard(SensitizeUtil.custom(vo.getIdCard(), 3, 2));
return ResponseDto.success(vo);
......
......@@ -17,11 +17,9 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.time.Month;
import java.time.temporal.ChronoField;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import java.time.temporal.TemporalField;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
......@@ -204,6 +202,15 @@ 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> */
/**
......@@ -235,6 +242,8 @@ public class AdamRdmService {
// return !StringUtils.isEmpty(o) && o.equals(idName);
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 认证处理 */
/**
* 身份证实名处理
*
......@@ -276,6 +285,29 @@ public class AdamRdmService {
}
}
/**
* 身份证实名处理:三要素
*
* @param name
* @param idCard
* @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());
}
String respStr = IdentityUtils.ali3Meta(name, idCard, mobile);
JsonNode respJNode = JsonUtils.fromJson(respStr, JsonNode.class);
if (null == respJNode || !"200".equals(String.valueOf(respJNode.get("code")))
|| !String.valueOf(respJNode.get("data").get("bizCode")).equals("1")) {
log.warn("###实名认证失败[{}]", respStr);
this.setCertmetaJunk(1, idCard, name, mobile);
ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("10112");
throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
}
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | <UID, List<AdamThirdPartInfoVo>> */
public boolean setThirdPartVoListByUid(String uid, List<AdamThirdPartInfoVo> voList) {
......
......@@ -39,6 +39,7 @@ public class AdamRealNameServiceImpl implements IAdamRealNameService {
realName.getRealNameId(),
realName.getUid(),
realName.getType(),
realName.getNode(),
realName.getName(),
realName.getIdCard(),
realName.getState(),
......
......@@ -415,7 +415,7 @@ public class AdamUserServiceImpl implements IAdamUserService {
@Override
// @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public AdamRealInfoVo identity(String uid, String name, String idCard) {
public AdamRealInfoVo identity(String uid, String name, String idCard, String mobile) {
// if (!adamRdmService.isCertification(1, idCard, name)) {
// if (adamRdmService.isCertificationJunk(1, idCard, name)) {
// ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("10102");
......@@ -432,12 +432,14 @@ public class AdamUserServiceImpl implements IAdamUserService {
// }
// adamRdmService.setCertification(1, idCard, name);
// }
adamRdmService.identityHandler1(uid, name, idCard);
// adamRdmService.identityHandler1(uid, name, idCard);
adamRdmService.identityHandler3(name, idCard, mobile);
AdamRealName realName = new AdamRealName();
realName.setRealNameId(IDGenerator.nextSnowId() + "");
realName.setUid(uid);
realName.setType(1);
realName.setNode(3);
realName.setName(name);
realName.setIdCard(idCard);
realName.setState(1);
......
......@@ -44,6 +44,7 @@
10109=不支持中国大陆护照
10110=护照号码不合规
10111=军官证号不合规
10112=证件信息或手机号不一致
10200=仅限从未购买过会员的用户使用
......
......@@ -11,7 +11,7 @@ adam_user_info.update_by_member=UPDATE adam_user_info SET birthday=?, area=? WHE
adam_user_info.update_qr_code=UPDATE adam_user_info SET qr_code=? WHERE uid=?
# ----------------------------------------------------
adam_real_name.add=INSERT INTO adam_real_name (real_name_id, `uid`, `type`, `name`, id_card, `state`, created_at) VALUES (?,?,?,?,?,?,?)
adam_real_name.add=INSERT INTO adam_real_name (real_name_id,`uid`,`type`,`node`,`name`,id_card,`state`,created_at) VALUES (?,?,?,?,?,?,?,?)
adam_real_name.close=UPDATE adam_real_name SET `state`=2, updated_at=?, comment='close' WHERE `uid`=?
# ----------------------------------------------------
......
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