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

Commit 3f19773a authored by anjiabin's avatar anjiabin

优化相关策略实现

parent 5f1ad96c
......@@ -14,7 +14,8 @@ public enum GalaxyErrorCodeEnum {
SERIES_CLAIM_ERROR_FIVE_TIMES("NFT0010002","NFT系列声明失败,任务查询超过5次"),
PUBLISH_FAIL("NFT0010003","NFT发行失败,未获取nft"),
PUBLISH_BUY_FAIL("NFT0010004","NFT发行购买失败,未发起购买"),
PUBLISH_FAIL_ALREADY_EXIST("NFT0010005","NFT发行失败,该订单已经发行过指定nft!");
PUBLISH_FAIL_ALREADY_EXIST("NFT0010005","NFT发行失败,该订单已经发行过指定nft!"),
ROUTER_NOT_EXIST("NFT0010006","路由类型不存在");
private String code;
private String message;
......
......@@ -8,13 +8,13 @@ import com.liquidnet.service.galaxy.service.IGalaxyArtworkService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
/**
......@@ -32,7 +32,7 @@ import javax.validation.Valid;
@Validated
@Slf4j
public class GalaxyArtworkController {
@Autowired
@Resource(name = "galaxyArtworkServiceImpl")
private IGalaxyArtworkService galaxyArtworkService;
@ControllerLog(description = "NFT图片风险检测")
......
......@@ -5,17 +5,19 @@ import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.galaxy.aop.annotation.ControllerLog;
import com.liquidnet.service.galaxy.dto.param.GalaxyNftPublishReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyNftPublishRespDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyNftPublishResultQueryReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyNftPublishResultQueryRespDto;
import com.liquidnet.service.galaxy.service.IGalaxyPublishService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
/**
......@@ -33,7 +35,7 @@ import javax.validation.Valid;
@Validated
@Slf4j
public class GalaxyPublishController {
@Autowired
@Resource(name = "galaxyPublishServiceImpl")
private IGalaxyPublishService galaxyPublishService;
@ControllerLog(description = "NFT发行")
......@@ -43,4 +45,12 @@ public class GalaxyPublishController {
public ResponseDto<GalaxyNftPublishRespDto> nftPublish(@Valid @RequestBody GalaxyNftPublishReqDto reqDto){
return galaxyPublishService.nftPublish(reqDto);
}
@ControllerLog(description = "NFT发行结果查询")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "NFT发行结果查询")
@PostMapping(value = {"nftPublishResultQuery"})
public ResponseDto<GalaxyNftPublishResultQueryRespDto> nftPublishResultQuery(@Valid @RequestBody GalaxyNftPublishResultQueryReqDto reqDto) {
return galaxyPublishService.nftPublishResultQuery(reqDto);
}
}
......@@ -3,21 +3,18 @@ package com.liquidnet.service.galaxy.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.galaxy.aop.annotation.ControllerLog;
import com.liquidnet.service.galaxy.dto.param.GalaxyNftBuyReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyNftBuyRespDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyNftPublishAndBuyReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyNftPublishAndBuyRespDto;
import com.liquidnet.service.galaxy.dto.param.*;
import com.liquidnet.service.galaxy.service.IGalaxyTradeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
/**
......@@ -35,7 +32,7 @@ import javax.validation.Valid;
@Validated
@Slf4j
public class GalaxyTradeController {
@Autowired
@Resource(name = "galaxyTradeServiceImpl")
private IGalaxyTradeService galaxyTradeService;
@ControllerLog(description = "NFT购买")
......@@ -46,6 +43,14 @@ public class GalaxyTradeController {
return galaxyTradeService.nftBuy(reqDto);
}
@ControllerLog(description = "NFT购买结果查询")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "NFT购买结果查询")
@PostMapping(value = {"nftBuyResultQuery"})
public ResponseDto<GalaxyNftBuyResultQueryRespDto> nftBuyResultQuery(@Valid @RequestBody GalaxyNftBuyResultQueryReqDto reqDto){
return galaxyTradeService.nftBuyResultQuery(reqDto);
}
@ControllerLog(description = "NFT购买(发行+购买)")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "NFT购买(发行+购买)")
......@@ -53,4 +58,12 @@ public class GalaxyTradeController {
public ResponseDto<GalaxyNftPublishAndBuyRespDto> nftPublishAndBuy(@Valid @RequestBody GalaxyNftPublishAndBuyReqDto reqDto){
return galaxyTradeService.nftPublishAndBuy(reqDto);
}
@ControllerLog(description = "NFT购买支付结果查询")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "NFT购买支付结果查询")
@PostMapping(value = {"nftBuyPayResultQuery"})
public ResponseDto<GalaxyNftBuyPayResultQueryRespDto> nftBuyPayResultQuery(@Valid @RequestBody GalaxyNftBuyPayResultQueryReqDto reqDto){
return galaxyTradeService.nftBuyPayResultQuery(reqDto);
}
}
......@@ -3,19 +3,21 @@ package com.liquidnet.service.galaxy.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.galaxy.aop.annotation.ControllerLog;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserBindStatusQueryReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserBindStatusQueryRespDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterRespDto;
import com.liquidnet.service.galaxy.service.IGalaxyUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
/**
......@@ -33,7 +35,7 @@ import javax.validation.Valid;
@Validated
@Slf4j
public class GalaxyUserController {
@Autowired
@Resource(name = "galaxyUserServiceImpl")
private IGalaxyUserService galaxyUserService;
@ControllerLog(description = "NFT用户注册")
......@@ -43,4 +45,12 @@ public class GalaxyUserController {
public ResponseDto<GalaxyUserRegisterRespDto> register(@Valid @RequestBody GalaxyUserRegisterReqDto reqDto) {
return galaxyUserService.userRegister(reqDto);
}
@ControllerLog(description = "用户绑定状态查询")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "用户绑定状态查询")
@PostMapping(value = {"userBindStatusQuery"})
public ResponseDto<GalaxyUserBindStatusQueryRespDto> userBindStatusQuery(@Valid @RequestBody GalaxyUserBindStatusQueryReqDto reqDto) {
return galaxyUserService.userBindStatusQuery(reqDto);
}
}
package com.liquidnet.service.galaxy.router.strategy;
import com.liquidnet.common.exception.LiquidnetServiceException;
import com.liquidnet.commons.lang.util.StringUtil;
import com.liquidnet.service.galaxy.constant.GalaxyErrorCodeEnum;
import org.springframework.stereotype.Component;
import java.util.HashMap;
......@@ -22,7 +25,9 @@ public class GalaxyRouterStrategyContext {
private final Map<String, IGalaxyRouterStrategyTrade> tradeHandlerMap = new HashMap<>();
public IGalaxyRouterStrategyArtwork getArtworkStrategy(String type) {
return artworkHandlerMap.get(type);
IGalaxyRouterStrategyArtwork obj = artworkHandlerMap.get(type);
if(StringUtil.isNull(obj)) throw new LiquidnetServiceException(GalaxyErrorCodeEnum.ROUTER_NOT_EXIST.getCode(),GalaxyErrorCodeEnum.ROUTER_NOT_EXIST.getMessage());
return obj;
}
public void putArtworkStrategy(String code, IGalaxyRouterStrategyArtwork strategy) {
......@@ -30,7 +35,9 @@ public class GalaxyRouterStrategyContext {
}
public IGalaxyRouterStrategyUser getUserStrategy(String type) {
return userHandlerMap.get(type);
IGalaxyRouterStrategyUser obj = userHandlerMap.get(type);
if(StringUtil.isNull(obj)) throw new LiquidnetServiceException(GalaxyErrorCodeEnum.ROUTER_NOT_EXIST.getCode(),GalaxyErrorCodeEnum.ROUTER_NOT_EXIST.getMessage());
return obj;
}
public void putUserStrategy(String code, IGalaxyRouterStrategyUser strategy) {
......@@ -38,7 +45,9 @@ public class GalaxyRouterStrategyContext {
}
public IGalaxyRouterStrategyPublish getPublishStrategy(String type) {
return publishHandlerMap.get(type);
IGalaxyRouterStrategyPublish obj = publishHandlerMap.get(type);
if(StringUtil.isNull(obj)) throw new LiquidnetServiceException(GalaxyErrorCodeEnum.ROUTER_NOT_EXIST.getCode(),GalaxyErrorCodeEnum.ROUTER_NOT_EXIST.getMessage());
return obj;
}
public void putPublishStrategy(String code, IGalaxyRouterStrategyPublish strategy) {
......@@ -46,7 +55,9 @@ public class GalaxyRouterStrategyContext {
}
public IGalaxyRouterStrategyTrade getTradeStrategy(String type) {
return tradeHandlerMap.get(type);
IGalaxyRouterStrategyTrade obj = tradeHandlerMap.get(type);
if(StringUtil.isNull(obj)) throw new LiquidnetServiceException(GalaxyErrorCodeEnum.ROUTER_NOT_EXIST.getCode(),GalaxyErrorCodeEnum.ROUTER_NOT_EXIST.getMessage());
return obj;
}
public void putTradeStrategy(String code, IGalaxyRouterStrategyTrade strategy) {
......
......@@ -13,10 +13,13 @@ import com.liquidnet.common.third.zxlnft.exception.ZxlNftException;
import com.liquidnet.common.third.zxlnft.util.ZxlWalletSdkUtil;
import com.liquidnet.common.third.zxlnft.util.ZxlnftSdkUtil;
import com.liquidnet.commons.lang.util.BASE64Util;
import com.liquidnet.commons.lang.util.BeanUtil;
import com.liquidnet.commons.lang.util.StringUtil;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.galaxy.constant.GalaxyConstant;
import com.liquidnet.service.galaxy.dto.bo.GalaxyUserInfoBo;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserBindStatusQueryReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserBindStatusQueryRespDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterRespDto;
import com.liquidnet.service.galaxy.utils.DataUtils;
......@@ -181,4 +184,18 @@ public class ZxinUserBiz {
}
return ResponseDto.success(respDto);
}
public ResponseDto<GalaxyUserBindStatusQueryRespDto> userBindStatusQuery(GalaxyUserBindStatusQueryReqDto reqDto){
Nft016IdentityBindQueryReqDto nft016ReqDto = Nft016IdentityBindQueryReqDto.getNew();
nft016ReqDto.setAddressList(reqDto.getBlockChainAddress());
ZxlnftResponseDto<Nft016IdentityBindQueryRespDto> zxlnftResponseDto = zxlnftSdkUtil.nft016IdentityBindQuery(nft016ReqDto);
GalaxyUserBindStatusQueryRespDto userBindStatusQueryRespDto = GalaxyUserBindStatusQueryRespDto.getNew();
if(zxlnftResponseDto.isSuccess()){
BeanUtil.copy(zxlnftResponseDto.getData().getList().get(0),userBindStatusQueryRespDto);
}else{
return ResponseDto.failure();
}
return ResponseDto.success(userBindStatusQueryRespDto);
}
}
......@@ -36,6 +36,6 @@ public class GalaxyRouterStrategyZxlUserImpl implements IGalaxyRouterStrategyUse
@Override
public ResponseDto<GalaxyUserBindStatusQueryRespDto> userBindStatusQuery(GalaxyUserBindStatusQueryReqDto reqDto) {
return null;
return zxinUserBiz.userBindStatusQuery(reqDto);
}
}
......@@ -18,7 +18,7 @@ import org.springframework.stereotype.Service;
* @date 2022/3/12 00:14
*/
@Slf4j
@Service
@Service("galaxyArtworkServiceImpl")
public class GalaxyArtworkServiceImpl implements IGalaxyArtworkService {
@Autowired
private GalaxyRouterStrategyContext galaxyRouterStrategyContext;
......
......@@ -18,7 +18,7 @@ import org.springframework.stereotype.Service;
* @date 2022/3/15 11:28
*/
@Slf4j
@Service
@Service("galaxyPublishServiceImpl")
public class GalaxyPublishServiceImpl implements IGalaxyPublishService {
@Autowired
private GalaxyRouterStrategyContext galaxyRouterStrategyContext;
......@@ -30,6 +30,6 @@ public class GalaxyPublishServiceImpl implements IGalaxyPublishService {
@Override
public ResponseDto<GalaxyNftPublishResultQueryRespDto> nftPublishResultQuery(GalaxyNftPublishResultQueryReqDto reqDto) {
return null;
return galaxyRouterStrategyContext.getPublishStrategy(reqDto.getRouteType()).nftPublishResultQuery(reqDto);
}
}
......@@ -18,7 +18,7 @@ import org.springframework.stereotype.Service;
* @date 2022/3/17 14:19
*/
@Slf4j
@Service
@Service("galaxyTradeServiceImpl")
public class GalaxyTradeServiceImpl implements IGalaxyTradeService {
@Autowired
private GalaxyRouterStrategyContext galaxyRouterStrategyContext;
......@@ -35,11 +35,11 @@ public class GalaxyTradeServiceImpl implements IGalaxyTradeService {
@Override
public ResponseDto<GalaxyNftBuyResultQueryRespDto> nftBuyResultQuery(GalaxyNftBuyResultQueryReqDto reqDto) {
return null;
return galaxyRouterStrategyContext.getTradeStrategy(reqDto.getRouteType()).nftBuyResultQuery(reqDto);
}
@Override
public ResponseDto<GalaxyNftBuyPayResultQueryRespDto> nftBuyPayResultQuery(GalaxyNftBuyPayResultQueryReqDto reqDto) {
return null;
return galaxyRouterStrategyContext.getTradeStrategy(reqDto.getRouteType()).nftBuyPayResultQuery(reqDto);
}
}
......@@ -21,7 +21,7 @@ import org.springframework.stereotype.Service;
* @date 2022/3/11 12:09
*/
@Slf4j
@Service
@Service("galaxyUserServiceImpl")
public class GalaxyUserServiceImpl implements IGalaxyUserService {
@Autowired
private GalaxyRouterStrategyContext galaxyRouterStrategyContext;
......@@ -33,6 +33,6 @@ public class GalaxyUserServiceImpl implements IGalaxyUserService {
@Override
public ResponseDto<GalaxyUserBindStatusQueryRespDto> userBindStatusQuery(GalaxyUserBindStatusQueryReqDto reqDto) {
return null;
return galaxyRouterStrategyContext.getUserStrategy(reqDto.getRouteType()).userBindStatusQuery(reqDto);
}
}
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