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

Commit 8c85baad authored by anjiabin's avatar anjiabin

增加xuper用户同步接口

parent 39112e14
package com.liquidnet.service.galaxy.controller; package com.liquidnet.service.galaxy.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.commons.lang.util.StringUtil;
import com.liquidnet.service.adam.constant.AdamEnum;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.galaxy.aop.annotation.ControllerLog; import com.liquidnet.service.galaxy.aop.annotation.ControllerLog;
import com.liquidnet.service.galaxy.constant.GalaxyEnum;
import com.liquidnet.service.galaxy.dto.bo.GalaxyUserInfoBo;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserBindStatusQueryReqDto; import com.liquidnet.service.galaxy.dto.param.GalaxyUserBindStatusQueryReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserBindStatusQueryRespDto; import com.liquidnet.service.galaxy.dto.param.GalaxyUserBindStatusQueryRespDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterReqDto; import com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterRespDto; import com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterRespDto;
import com.liquidnet.service.galaxy.router.xuper.biz.XuperUserCommonBiz;
import com.liquidnet.service.galaxy.service.IGalaxyUserService; import com.liquidnet.service.galaxy.service.IGalaxyUserService;
import com.liquidnet.service.galaxy.utils.GalaxyDataUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
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.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -19,6 +30,8 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -19,6 +30,8 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.Valid; import javax.validation.Valid;
import java.time.LocalDateTime;
import java.util.LinkedList;
/** /**
* @author AnJiabin <anjiabin@zhengzai.tv> * @author AnJiabin <anjiabin@zhengzai.tv>
...@@ -38,6 +51,12 @@ public class GalaxyUserController { ...@@ -38,6 +51,12 @@ public class GalaxyUserController {
@Resource(name = "galaxyUserServiceImpl") @Resource(name = "galaxyUserServiceImpl")
private IGalaxyUserService galaxyUserService; private IGalaxyUserService galaxyUserService;
@Autowired
private XuperUserCommonBiz xuperUserCommonBiz;
@Autowired
private GalaxyDataUtils dataUtils;
@ControllerLog(description = "NFT用户注册") @ControllerLog(description = "NFT用户注册")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@ApiOperation(value = "NFT用户注册") @ApiOperation(value = "NFT用户注册")
...@@ -53,4 +72,29 @@ public class GalaxyUserController { ...@@ -53,4 +72,29 @@ public class GalaxyUserController {
public ResponseDto<GalaxyUserBindStatusQueryRespDto> userBindStatusQuery(@Valid @RequestBody GalaxyUserBindStatusQueryReqDto reqDto) { public ResponseDto<GalaxyUserBindStatusQueryRespDto> userBindStatusQuery(@Valid @RequestBody GalaxyUserBindStatusQueryReqDto reqDto) {
return galaxyUserService.userBindStatusQuery(reqDto); return galaxyUserService.userBindStatusQuery(reqDto);
} }
@ControllerLog(description = "NFT百度用户同步")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "NFT百度用户同步")
@PostMapping(value = {"xuperUserSync"})
public boolean xuperUserSync(@Valid @RequestBody GalaxyUserRegisterReqDto reqDto) {
GalaxyUserInfoBo userInfoBo = dataUtils.getGalaxyUserInfo(reqDto.getRouterType(), reqDto.getUserId());
if(StringUtil.isNotEmpty(userInfoBo.getBlockChainAddress())){
reqDto.setRouterType(GalaxyEnum.RouterTypeEnum.XUPER.getCode());
ResponseDto<GalaxyUserRegisterRespDto> responseDto = xuperUserCommonBiz.userRegister(reqDto);
if(responseDto.isSuccess()){
//同步业务账号关联关系到adam
LinkedList<Object[]> sqlsDataA = CollectionUtil.linkedListObjectArr();
sqlsDataA.add(new Object[]{
reqDto.getUserId(), AdamEnum.BizAcct.NFT_XUPER.name(), responseDto.getData().getBlockChainAddress(), null, null, 1, LocalDateTime.now()
});
dataUtils.getQueueUtil().sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(),
SqlMapping.get("adam_user_busi_acct.add",sqlsDataA)
);
return true;
};
}
log.error("NFT百度用户同步 error 该用户至信链数字账户未开通 reqParam:{}", JsonUtils.toJson(reqDto));
return false;
}
} }
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