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

Commit 9a109820 authored by 张国柄's avatar 张国柄

~goblin+数字账号开通逻辑;

parent 1d62a79e
package com.liquidnet.service.goblin.service;
import com.liquidnet.service.base.ResponseDto;
public interface IGoblinNftUserService {
/**
* 开通NFT数字账号
*
* @param uid UID
* @param bizCode 业务码
* @param name 证件名
* @param idCard 证件号
* @param mobile 手机号
* @return Integer[1-成功]
*/
ResponseDto<Integer> openNftAccount(String uid, String bizCode, String name, String idCard, String mobile);
}
package com.liquidnet.service.goblin.controller; package com.liquidnet.service.goblin.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.liquidnet.common.exception.LiquidnetServiceException;
import com.liquidnet.commons.lang.constant.LnsRegex;
import com.liquidnet.commons.lang.util.CurrentUtil; import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.commons.lang.util.IDCardUtil;
import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.service.IGoblinNftUserService;
import com.liquidnet.service.goblin.util.GoblinRedisUtils; import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -18,47 +25,45 @@ import javax.validation.constraints.Pattern; ...@@ -18,47 +25,45 @@ import javax.validation.constraints.Pattern;
@RequestMapping("user") @RequestMapping("user")
public class GoblinNFTUserController { public class GoblinNFTUserController {
// @Autowired @Autowired
// IGoblinNftUserService goblinNftUserService; IGoblinNftUserService goblinNftUserService;
@Autowired @Autowired
GoblinRedisUtils goblinRedisUtils; GoblinRedisUtils goblinRedisUtils;
// @ApiOperationSupport(order = 11) @ApiOperationSupport(order = 11)
// @ApiOperation(value = "业务账号开通") @ApiOperation(value = "业务账号开通", notes = "返回`data`值标识:业务账号状态[1-已开通]")
// @ApiImplicitParams({ @ApiImplicitParams({
// @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "bizCode", value = "业务码[NFT_ZX]", allowableValues = "NFT_ZX"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "bizCode", value = "业务码[NFT_ZX]", allowableValues = "NFT_ZX"),
// @ApiImplicitParam(type = "form", required = false, dataType = "String", name = "name", value = "姓名"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "name", value = "姓名"),
// @ApiImplicitParam(type = "form", required = false, dataType = "String", name = "idCard", value = "身份证号"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "idCard", value = "身份证号"),
// }) })
// @PostMapping(value = "open/account") @PostMapping(value = "open/account")
// public ResponseDto<AdamUserBizAcctVo> openAccount(@Pattern(regexp = "\\b(NFT_ZX)\\b", message = "业务码无效") public ResponseDto<Integer> openAccount(@Pattern(regexp = "\\b(NFT_ZX)\\b", message = "业务码无效")
// @RequestParam String bizCode, @RequestParam String bizCode,
// @RequestParam(required = false) String name, @RequestParam(required = true) String name,
// @RequestParam(required = false) String idCard) { @RequestParam(required = true) String idCard) {
// if (!java.util.regex.Pattern.matches(LnsRegex.Valid.CN_HANZI, name)) { if (!java.util.regex.Pattern.matches(LnsRegex.Valid.CN_HANZI, name)) {
// return ResponseDto.failure(ErrorMapping.get("10103")); return ResponseDto.failure(ErrorMapping.get("10103"));
// } }
// if (!java.util.regex.Pattern.matches(LnsRegex.Valid.CN_ID_CARD_REF, idCard)) { if (!java.util.regex.Pattern.matches(LnsRegex.Valid.CN_ID_CARD_REF, idCard)) {
// return ResponseDto.failure(ErrorMapping.get("10104")); return ResponseDto.failure(ErrorMapping.get("10104"));
// } }
// if (IDCardUtil.getAge(idCard) < 18) { if (IDCardUtil.getAge(idCard) < 18) {
// return ResponseDto.failure(ErrorMapping.get("10100")); return ResponseDto.failure(ErrorMapping.get("10100"));
// } }
//
// String currentUid = CurrentUtil.getCurrentUid(); String currentUid = CurrentUtil.getCurrentUid();
// String mobile = (String) CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_MOBILE); String mobile = (String) CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_MOBILE);
// try { try {
// ResponseDto<AdamUserBizAcctVo> vo = goblinNftUserService.openNftAccount(currentUid, bizCode, name, idCard, mobile); return goblinNftUserService.openNftAccount(currentUid, bizCode, name, idCard, mobile);
// goblinRedisUtils.setNftNumAccount(currentUid); } catch (Exception e) {
// return vo; if (e instanceof LiquidnetServiceException) {
// } catch (Exception e) { LiquidnetServiceException lsEx = (LiquidnetServiceException) e;
// if (e instanceof LiquidnetServiceException) { return ResponseDto.failure(lsEx.getCode(), lsEx.getMessage());
// LiquidnetServiceException lsEx = (LiquidnetServiceException) e; }
// return ResponseDto.failure(lsEx.getCode(), lsEx.getMessage()); return ResponseDto.failure(ErrorMapping.get("140010"));
// } }
// return ResponseDto.failure(ErrorMapping.get("10113")); }
// }
// }
@ApiOperationSupport(order = 11) @ApiOperationSupport(order = 11)
@ApiOperation(value = "业务账号是否开通") @ApiOperation(value = "业务账号是否开通")
......
package com.liquidnet.service.goblin.service.impl;
import com.liquidnet.service.adam.constant.AdamEnum;
import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.galaxy.constant.GalaxyEnum;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterRespDto;
import com.liquidnet.service.galaxy.service.IGalaxyUserService;
import com.liquidnet.service.goblin.service.IGoblinNftUserService;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import com.liquidnet.service.goblin.util.QueueUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
@Slf4j
@Service
public class GoblinNftUserServiceImpl implements IGoblinNftUserService {
@Autowired
private QueueUtils queueUtils;
@Autowired
private GoblinRedisUtils goblinRedisUtils;
@Autowired
private IGalaxyUserService galaxyUserService;
@Override
public ResponseDto<Integer> openNftAccount(String uid, String bizCode, String name, String idCard, String mobile) {
if (goblinRedisUtils.getNftNumAccount(uid)) return ResponseDto.success(1);
switch (bizCode) {
case "NFT_ZX":
GalaxyUserRegisterReqDto userRegisterReqDto = GalaxyUserRegisterReqDto.getNew();
userRegisterReqDto.setUserId(uid);
userRegisterReqDto.setUserName(name);
userRegisterReqDto.setIdCard(idCard);
userRegisterReqDto.setMobile(mobile);
userRegisterReqDto.setIdCardType("1");
userRegisterReqDto.setRouterType(GalaxyEnum.RouterTypeEnum.ZXINCHAIN.getCode());
ResponseDto<GalaxyUserRegisterRespDto> userRegisterRespDto = galaxyUserService.userRegister(userRegisterReqDto);
if (userRegisterRespDto.isSuccess()) {
goblinRedisUtils.setNftNumAccount(uid);
GalaxyUserRegisterRespDto userRegisterRespDtoData = userRegisterRespDto.getData();
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(),
SqlMapping.get("adam_user_busi_acct.add", uid, AdamEnum.BizAcct.NFT_ZX.name(), userRegisterRespDtoData.getBlockChainAddress(), null, null, 1, LocalDateTime.now())
);
return ResponseDto.success(1);
}
break;
default:
log.warn("#开通业务账号:无效的业务码[UID={},bizCode={}]", bizCode, uid);
break;
}
return ResponseDto.failure(ErrorMapping.get("140010"));
}
}
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
140001= 140001=
140002= 140002=
140010=账号开通失败,请联系客服
140050=该活动优惠券不存在 140050=该活动优惠券不存在
......
...@@ -142,3 +142,5 @@ goblin_goods_anticipate_value_delete=UPDATE goblin_goods_anticipate_value SET `d ...@@ -142,3 +142,5 @@ goblin_goods_anticipate_value_delete=UPDATE goblin_goods_anticipate_value SET `d
goblin_goods_anticipate_user=INSERT INTO goblin_goods_anticipate_user(uid,sku_id,phone,state) VALUES(?,?,?,?) goblin_goods_anticipate_user=INSERT INTO goblin_goods_anticipate_user(uid,sku_id,phone,state) VALUES(?,?,?,?)
goblin_goods_anticipate_user_update=UPDATE goblin_goods_anticipate_user SET state = 1 WHERE uid = ? AND sku_id = ? goblin_goods_anticipate_user_update=UPDATE goblin_goods_anticipate_user SET state = 1 WHERE uid = ? AND sku_id = ?
goblin_goods_anticipate_user_update_sku=UPDATE goblin_goods_anticipate_user SET state = 1 WHERE sku_id = ? goblin_goods_anticipate_user_update_sku=UPDATE goblin_goods_anticipate_user SET state = 1 WHERE sku_id = ?
#---- \u4E1A\u52A1\u8D26\u53F7\u8BB0\u5F55
adam_user_busi_acct.add=INSERT INTO adam_user_busi_acct (`uid`, busi, uuid, `work`, ppwd, `state`, created_at) VALUES (?,?,?,?,?,?,?)
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