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

Commit 6f0c2f27 authored by zhanggb's avatar zhanggb

+api:nft三要素同步adam实名;

parent 9a0b3ab2
......@@ -15,4 +15,6 @@ public interface IAdamRealNameService {
void add(AdamRealName realName);
void upsert(AdamRealName realName, boolean updateFlg);
void update(AdamRealName realName, String mobile);
}
......@@ -70,4 +70,6 @@ public interface IAdamUserService {
AdamRealInfoVo identity(String uid, String name, String idCard, String mobile);
AdamRealInfoVo identityForUpsert(String uid, String name, String idCard, String mobile, boolean updateFlg);
AdamRealInfoVo identityForUpdate(String uid, String mobile, int idType, int node, String idCard, String idName);
}
......@@ -2,6 +2,8 @@ package com.liquidnet.service.adam.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.liquidnet.commons.lang.util.DESUtils;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.adam.dto.rsc.AdamChimeUinfoDto;
import com.liquidnet.service.adam.dto.rsc.AdamChimeUinfoReq;
import com.liquidnet.service.adam.dto.vo.*;
......@@ -175,11 +177,28 @@ public class AdamRscController {
@ApiOperationSupport(order = 50)
@ApiOperation(value = "@API:NFT三要素", notes = "用于NFT认证成功的用户同步更新用户账号实名信息")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "certmeta", value = "三要素加密信息"),
})
@PostMapping(value = {"syn/certmeta"})
public void syncUpdateReal(@NotBlank @RequestParam String certmeta) {
log.info("NFT三要素同步更新实名信息:{} => {}", certmeta, certmeta);
public void syncUpdateReal(@NotBlank @RequestBody String certmeta) {
try {
String certmetaPlain = DESUtils.DES().decrypt(certmeta);// {uid},{mobile},{证件类型}{证件号},{姓名}
log.info("NFT三要素同步实名信息:加解密信息[{} => {}]", certmeta, certmetaPlain);
String[] certmetaPlainArr = certmetaPlain.split(",");
String uid = certmetaPlainArr[0], mobile = certmetaPlainArr[1], idTypeCardNo = certmetaPlainArr[2];
String uidByMobile = adamRdmService.getUidByMobile(mobile);
if (org.apache.commons.lang3.StringUtils.isEmpty(uidByMobile) || !org.apache.commons.lang3.StringUtils.equals(uidByMobile, uid)) {
log.warn("NFT三要素同步实名信息:手机号未注册/不匹配[{}]", certmetaPlain);
return;
}
AdamRealInfoVo realInfoVoByUidPlain = adamRdmService.getRealInfoVoByUidPlain(uid);
if (null == realInfoVoByUidPlain || realInfoVoByUidPlain.getNode() == 2) {
int idType = Integer.parseInt(idTypeCardNo.substring(0, 1));
adamUserService.identityForUpdate(uid, mobile, idType, 3, idTypeCardNo.substring(1), certmetaPlainArr[3]);
} else {
log.warn("NFT三要素同步实名信息:三要素信息已存在[certmetaPlain={},realInfoVoByUidPlain={}]", certmetaPlain, JsonUtils.toJson(realInfoVoByUidPlain));
}
} catch (Exception e) {
log.warn("NFT三要素同步实名信息:参数解析失败[certmeta={}]", certmeta, e);
}
}
}
......@@ -119,4 +119,43 @@ public class AdamRealNameServiceImpl implements IAdamRealNameService {
);
log.debug("#MQ耗时:{}ms", System.currentTimeMillis() - s);
}
@Override
public void update(AdamRealName realName, String mobile) {
List<Object> paramList = Arrays.asList(
realName.getRealNameId(),
realName.getUid(),
realName.getType(),
realName.getNode(),
realName.getName(),
realName.getIdCard(),
realName.getState(),
realName.getCreatedAt()
);
LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
LinkedList<Object[]> initUserRealInfoObjs = CollectionUtil.linkedListObjectArr(),
delUserRealInfoObjs = CollectionUtil.linkedListObjectArr(),
updateUserMobileLocateObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("adam_real_name.del_by_nft"));
delUserRealInfoObjs.add(new Object[]{realName.getCreatedAt(), realName.getUid()});
toMqSqls.add(SqlMapping.get("adam_real_name.add"));
initUserRealInfoObjs.add(paramList.toArray());
String[] mobileLocateArr = adamRdmService.getMobileLocateArr(mobile);
toMqSqls.add(SqlMapping.get("adam_user_mobile_locate.real_name"));
if (null != mobileLocateArr && mobileLocateArr.length > 0) {
updateUserMobileLocateObjs.add(new Object[]{
realName.getName(), realName.getIdCard(), realName.getCreatedAt(), realName.getUid()
});
}
long s = System.currentTimeMillis();
queueUtils.sendMsgByRedis(
MQConst.AdamQueue.SQL_UCENTER.getKey(),
SqlMapping.gets(toMqSqls, delUserRealInfoObjs, initUserRealInfoObjs, updateUserMobileLocateObjs)
);
log.debug("#MQ耗时:{}ms", System.currentTimeMillis() - s);
}
}
......@@ -476,4 +476,25 @@ public class AdamUserServiceImpl implements IAdamUserService {
log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s);
return vo;
}
@Override
public AdamRealInfoVo identityForUpdate(String uid, String mobile, int idType, int node, String idCard, String idName) {
AdamRealName realName = new AdamRealName();
realName.setRealNameId(IDGenerator.nextSnowId() + "");
realName.setUid(uid);
realName.setType(idType);
realName.setNode(node);
realName.setName(idName);
realName.setIdCard(idCard);
realName.setState(1);
realName.setCreatedAt(LocalDateTime.now());
adamRealNameService.update(realName, mobile);
AdamRealInfoVo vo = AdamRealInfoVo.getNew().copy(realName);
long s = System.currentTimeMillis();
adamRdmService.setRealInfoVoByUid(uid, vo);
log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s);
return vo;
}
}
......@@ -12,7 +12,8 @@ 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`,`node`,`name`,id_card,`state`,created_at) VALUES (?,?,?,?,?,?,?,?)
adam_real_name.del=UPDATE adam_real_name SET `state`=2, updated_at=?, comment='三要素认证覆盖' WHERE `uid`=? and `state`=1 and node=2
adam_real_name.del=UPDATE adam_real_name SET `state`=2, updated_at=?, comment='\u4E09\u8981\u7D20\u8BA4\u8BC1\u8986\u76D6' WHERE `uid`=? and `state`=1 and node=2
adam_real_name.del_by_nft=UPDATE adam_real_name SET `state`=2, updated_at=?, comment='\u4E09\u8981\u7D20\u8BA4\u8BC1\u8986\u76D6NFT' WHERE `uid`=? and `state`=1 and node=2
adam_real_name.close=UPDATE adam_real_name SET `state`=2, updated_at=?, comment='close' WHERE `uid`=?
# ----------------------------------------------------
......
......@@ -42,7 +42,7 @@ public class GoblinNftUserServiceImpl implements IGoblinNftUserService {
userRegisterReqDto.setUserName(name);
userRegisterReqDto.setIdCard(idCard);
userRegisterReqDto.setMobile(mobile);
userRegisterReqDto.setIdCardType("1");
userRegisterReqDto.setIdCardType("1");// 同步com.liquidnet.service.galaxy.constant.GalaxyEnum.CardTypeEnum
userRegisterReqDto.setRouterType(GalaxyEnum.RouterTypeEnum.ZXINCHAIN.getCode());
ResponseDto<GalaxyUserRegisterRespDto> userRegisterRespDto = galaxyUserService.userRegister(userRegisterReqDto);
......
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