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

Commit 6203a456 authored by anjiabin's avatar anjiabin

nft修改购买异常逻辑

parent 4737ca49
package com.liquidnet.service.galaxy.dto.param;
import com.liquidnet.commons.lang.util.JsonUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: GalaxyQuerySeriesReqDto
* @Package com.liquidnet.service.galaxy.dto.param
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/4/7 16:27
*/
@ApiModel(value = "GalaxyQueryNftListReqDto", description = "NFT列表查询")
@Data
public class GalaxyQueryNftListReqDto extends GalaxyBaseReqDto implements Serializable,Cloneable{
/**
* 以下为发行参数***********************************
*/
@ApiModelProperty(position = 1, required = true, value = "用户ID[30]")
@NotBlank(message = "用户ID不能为空!")
@Size(min = 1, max = 30, message = "用户ID限制2-30位且不能包含特殊字符")
private String userId;
@ApiModelProperty(position = 2, required = true, value = "系列ID")
private String seriesId;
@Override
public String toString(){
return JsonUtils.toJson(this);
}
private static final GalaxyQueryNftListReqDto obj = new GalaxyQueryNftListReqDto();
public static GalaxyQueryNftListReqDto getNew() {
try {
return (GalaxyQueryNftListReqDto) obj.clone();
} catch (CloneNotSupportedException e) {
return new GalaxyQueryNftListReqDto();
}
}
}
package com.liquidnet.service.galaxy.dto.param;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.galaxy.dto.NftInfoDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: GalaxyQuerySeriesReqDto
* @Package com.liquidnet.service.galaxy.dto.param
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/4/7 16:27
*/
@ApiModel(value = "GalaxyQueryNftListRespDto", description = "NFT列表查询")
@Data
public class GalaxyQueryNftListRespDto implements Serializable,Cloneable {
@ApiModelProperty(position = 1, required = true, value = "userId")
private String userId;
@ApiModelProperty(position = 1, required = true, value = "seriesId")
private String seriesId;
/**
* 藏品总数
*/
private Long total;
/**
* nft元信息列表
*/
private List<NftInfoDto> nftList;
@Override
public String toString(){
return JsonUtils.toJson(this);
}
private static final GalaxyQueryNftListRespDto obj = new GalaxyQueryNftListRespDto();
public static GalaxyQueryNftListRespDto getNew() {
try {
return (GalaxyQueryNftListRespDto) obj.clone();
} catch (CloneNotSupportedException e) {
return new GalaxyQueryNftListRespDto();
}
}
}
\ No newline at end of file
package com.liquidnet.service.galaxy.dto.param;
import com.liquidnet.commons.lang.util.JsonUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: GalaxyQuerySeriesReqDto
* @Package com.liquidnet.service.galaxy.dto.param
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/4/7 16:27
*/
@ApiModel(value = "GalaxyQuerySeriesReqDto", description = "系列查询")
@Data
public class GalaxyQuerySeriesReqDto extends GalaxyBaseReqDto implements Serializable,Cloneable{
@ApiModelProperty(position = 1, required = true, value = "skuId")
private String skuId;
@Override
public String toString(){
return JsonUtils.toJson(this);
}
private static final GalaxyQuerySeriesReqDto obj = new GalaxyQuerySeriesReqDto();
public static GalaxyQuerySeriesReqDto getNew() {
try {
return (GalaxyQuerySeriesReqDto) obj.clone();
} catch (CloneNotSupportedException e) {
return new GalaxyQuerySeriesReqDto();
}
}
}
package com.liquidnet.service.galaxy.dto.param;
import com.liquidnet.commons.lang.util.JsonUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: GalaxyQuerySeriesReqDto
* @Package com.liquidnet.service.galaxy.dto.param
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/4/7 16:27
*/
@ApiModel(value = "GalaxyQuerySeriesRespDto", description = "系列查询")
@Data
public class GalaxyQuerySeriesRespDto implements Serializable,Cloneable {
@ApiModelProperty(position = 1, required = true, value = "skuId")
private String skuId;
@ApiModelProperty(position = 1, required = true, value = "seriesId")
private String seriesId;
@ApiModelProperty(position = 1, required = true, value = "name")
private String name;
@ApiModelProperty(position = 1, required = true, value = "creatorAddr")
private String creatorAddr;
@ApiModelProperty(position = 2, required = true, value = "totalCount")
private Long totalCount;
@ApiModelProperty(position = 3, required = true, value = "seriesBeginFromZero")
private Boolean seriesBeginFromZero;
@ApiModelProperty(position = 3, required = true, value = "crtCount")
private Long crtCount;
@ApiModelProperty(position = 3, required = true, value = "coverUrl")
private String coverUrl;
@ApiModelProperty(position = 3, required = true, value = "desc")
private String desc;
@ApiModelProperty(position = 3, required = true, value = "createTimeStamp")
private String createTimeStamp;
@Override
public String toString(){
return JsonUtils.toJson(this);
}
private static final GalaxyQuerySeriesRespDto obj = new GalaxyQuerySeriesRespDto();
public static GalaxyQuerySeriesRespDto getNew() {
try {
return (GalaxyQuerySeriesRespDto) obj.clone();
} catch (CloneNotSupportedException e) {
return new GalaxyQuerySeriesRespDto();
}
}
}
\ No newline at end of file
package com.liquidnet.service.galaxy.service;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyQueryNftListReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyQueryNftListRespDto;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: 区块链发行相关
* @class: IGalaxyPublishService
* @Package com.liquidnet.service.galaxy.service
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/4/7 11:45
*/
public interface IGalaxyTradeQueryService {
ResponseDto<GalaxyQueryNftListRespDto> nftList(GalaxyQueryNftListReqDto reqDto);
}
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.GalaxyQueryNftListReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyQueryNftListRespDto;
import com.liquidnet.service.galaxy.service.IGalaxyTradeQueryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: GalaxyTradeQueryController
* @Package com.liquidnet.service.galaxy.controller
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/4/7 16:12
*/
@Api(tags = "NFT交易查询相关")
@RestController
@RequestMapping("nftTradeQuery")
@Validated
@Slf4j
public class GalaxyTradeQueryController {
@Resource(name = "galaxyTradeQueryService")
private IGalaxyTradeQueryService galaxyTradeQueryService;
@ControllerLog(description = "NFT列表查询")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "NFT列表查询")
@PostMapping(value = {"nftList"})
public ResponseDto<GalaxyQueryNftListRespDto> nftList(@Valid @RequestBody GalaxyQueryNftListReqDto reqDto){
return galaxyTradeQueryService.nftList(reqDto);
}
}
......@@ -29,6 +29,7 @@ public class GalaxyRouterStrategyContext {
private final Map<String, IGalaxyRouterStrategyUser> userHandlerMap = new HashMap<>();
private final Map<String, IGalaxyRouterStrategyPublish> publishHandlerMap = new HashMap<>();
private final Map<String, IGalaxyRouterStrategyTrade> tradeHandlerMap = new HashMap<>();
private final Map<String, IGalaxyRouterStrategyTradeQuery> tradeQueryHandlerMap = new HashMap<>();
public IGalaxyRouterStrategyArtwork getArtworkStrategy(String type) {
if(!this.isActived(type)){
......@@ -78,6 +79,19 @@ public class GalaxyRouterStrategyContext {
return obj;
}
public IGalaxyRouterStrategyTradeQuery getTradeQueryStrategy(String type) {
if(!this.isActived(type)){
throw new LiquidnetServiceException(GalaxyErrorEnum.ROUTER_NOT_EXIST.getCode(), GalaxyErrorEnum.ROUTER_NOT_EXIST.getMessage());
}
IGalaxyRouterStrategyTradeQuery obj = tradeQueryHandlerMap.get(type);
if(StringUtil.isNull(obj)) throw new LiquidnetServiceException(GalaxyErrorEnum.ROUTER_NOT_EXIST.getCode(), GalaxyErrorEnum.ROUTER_NOT_EXIST.getMessage());
return obj;
}
public void putTradeQueryStrategy(String code, IGalaxyRouterStrategyTradeQuery strategy) {
tradeQueryHandlerMap.put(code, strategy);
}
public void putTradeStrategy(String code, IGalaxyRouterStrategyTrade strategy) {
tradeHandlerMap.put(code, strategy);
}
......
package com.liquidnet.service.galaxy.router.strategy;
import com.liquidnet.service.galaxy.router.strategy.annotation.StrategyGalaxyRouterArtworkHandler;
import com.liquidnet.service.galaxy.router.strategy.annotation.StrategyGalaxyRouterPublishHandler;
import com.liquidnet.service.galaxy.router.strategy.annotation.StrategyGalaxyRouterTradeHandler;
import com.liquidnet.service.galaxy.router.strategy.annotation.StrategyGalaxyRouterUserHandler;
import com.liquidnet.service.galaxy.router.strategy.annotation.*;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;
......@@ -51,5 +48,12 @@ public class GalaxyRouterStrategyListener implements ApplicationListener<Contex
StrategyGalaxyRouterTradeHandler typeHandler = bean.getClass().getAnnotation(StrategyGalaxyRouterTradeHandler.class);
strategyContext.putTradeStrategy(typeHandler.value().getCode(),(IGalaxyRouterStrategyTrade)bean);
});
//tradeQuery
Map<String, Object> tradeQueryBeans = event.getApplicationContext().getBeansWithAnnotation(StrategyGalaxyRouterTradeQueryHandler.class);
tradeQueryBeans.forEach((name, bean) -> {
StrategyGalaxyRouterTradeQueryHandler typeHandler = bean.getClass().getAnnotation(StrategyGalaxyRouterTradeQueryHandler.class);
strategyContext.putTradeQueryStrategy(typeHandler.value().getCode(),(IGalaxyRouterStrategyTradeQuery)bean);
});
}
}
package com.liquidnet.service.galaxy.router.strategy;
import com.liquidnet.service.galaxy.service.IGalaxyTradeQueryService;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: 用户路由策略
* @class: IGalaxyRouterUserStrategy
* @Package com.liquidnet.service.galaxy.router.strategy
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/4/7 12:27
*/
public interface IGalaxyRouterStrategyTradeQuery extends IGalaxyTradeQueryService {
}
package com.liquidnet.service.galaxy.router.strategy.annotation;
import com.liquidnet.service.galaxy.constant.GalaxyEnum;
import java.lang.annotation.*;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: StrategyGalaxyRouterUserHandler
* @Package com.liquidnet.service.galaxy.router.strategy.annotation
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/3/8 11:31
*/
@Documented
@Inherited
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface StrategyGalaxyRouterTradeQueryHandler {
GalaxyEnum.RouterTypeEnum value();
}
package com.liquidnet.service.galaxy.router.zxin.biz;
import com.liquidnet.common.third.zxlnft.biz.ZxlnftBiz;
import com.liquidnet.common.third.zxlnft.dto.Nft037AddressListReqDto;
import com.liquidnet.common.third.zxlnft.dto.Nft037AddressListRespDto;
import com.liquidnet.common.third.zxlnft.dto.ZxlnftResponseDto;
import com.liquidnet.common.third.zxlnft.util.ZxlWalletSdkUtil;
import com.liquidnet.common.third.zxlnft.util.ZxlnftSdkUtil;
import com.liquidnet.commons.lang.util.BeanUtil;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.galaxy.dto.bo.GalaxyUserInfoBo;
import com.liquidnet.service.galaxy.dto.param.GalaxyQueryNftListReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyQueryNftListRespDto;
import com.liquidnet.service.galaxy.utils.GalaxyDataUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: ZxinTradeQueryBiz
* @Package com.liquidnet.service.galaxy.router.zxin.biz
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/4/7 17:38
*/
@Slf4j
@Component
public class ZxinTradeQueryBiz {
@Autowired
private ZxlnftSdkUtil zxlnftSdkUtil;
@Autowired
private ZxlWalletSdkUtil zxlWalletSdkUtil;
@Autowired
private ZxlnftBiz zxlnftBiz;
@Autowired
private GalaxyDataUtils dataUtils;
public ResponseDto<GalaxyQueryNftListRespDto> nftList(GalaxyQueryNftListReqDto reqDto) {
//获取用户信息
GalaxyUserInfoBo userInfoBo = dataUtils.getGalaxyUserInfo(reqDto.getRouterType(),reqDto.getUserId());
Nft037AddressListReqDto nft037ReqDto = Nft037AddressListReqDto.getNew();
nft037ReqDto.setAddr(userInfoBo.getBlockChainAddress());
nft037ReqDto.setSeriesId(reqDto.getSeriesId());
nft037ReqDto.setLimit(1000l);
ZxlnftResponseDto<Nft037AddressListRespDto> zxlnftResponseDto = zxlnftSdkUtil.nft037AddressList(nft037ReqDto);
GalaxyQueryNftListRespDto queryNftListRespDto = GalaxyQueryNftListRespDto.getNew();
if(zxlnftResponseDto.isSuccess()){
BeanUtil.copy(zxlnftResponseDto.getData(),queryNftListRespDto);
queryNftListRespDto.setUserId(reqDto.getUserId());
queryNftListRespDto.setSeriesId(reqDto.getSeriesId());
}else{
return ResponseDto.failure();
}
return ResponseDto.success(queryNftListRespDto);
}
}
package com.liquidnet.service.galaxy.router.zxin.service;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.galaxy.constant.GalaxyEnum;
import com.liquidnet.service.galaxy.dto.param.GalaxyQueryNftListReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyQueryNftListRespDto;
import com.liquidnet.service.galaxy.router.strategy.IGalaxyRouterStrategyTradeQuery;
import com.liquidnet.service.galaxy.router.strategy.annotation.StrategyGalaxyRouterTradeQueryHandler;
import com.liquidnet.service.galaxy.router.zxin.biz.ZxinTradeQueryBiz;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: PayChannelStrategyAlipayImpl
* @Package com.liquidnet.service.dragon.channel.strategy.impl
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/4/7 13:06
*/
@Slf4j
@Component
@StrategyGalaxyRouterTradeQueryHandler(GalaxyEnum.RouterTypeEnum.ZXINCHAIN)
public class GalaxyRouterStrategyZxlTradeQueryImpl implements IGalaxyRouterStrategyTradeQuery {
@Autowired
private ZxinTradeQueryBiz zxinTradeQueryBiz;
@Override
public ResponseDto<GalaxyQueryNftListRespDto> nftList(GalaxyQueryNftListReqDto reqDto) {
return zxinTradeQueryBiz.nftList(reqDto);
}
}
package com.liquidnet.service.galaxy.service.impl;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyQueryNftListReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyQueryNftListRespDto;
import com.liquidnet.service.galaxy.router.strategy.GalaxyRouterStrategyContext;
import com.liquidnet.service.galaxy.service.IGalaxyTradeQueryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: GalaxyUserServiceImpl
* @Package com.liquidnet.service.galaxy.service.impl
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/4/7 12:09
*/
@Slf4j
@Service("galaxyTradeQueryService")
public class GalaxyTradeQueryServiceImpl implements IGalaxyTradeQueryService {
@Autowired
private GalaxyRouterStrategyContext galaxyRouterStrategyContext;
@Override
public ResponseDto<GalaxyQueryNftListRespDto> nftList(GalaxyQueryNftListReqDto reqDto) {
return galaxyRouterStrategyContext.getTradeQueryStrategy(reqDto.getRouterType()).nftList(reqDto);
}
}
......@@ -6,7 +6,9 @@ liquidnet:
username: user
password: user123
eureka:
host: 39.107.71.112:7001
# host: 39.107.71.112:7001
host: 127.0.0.1:7001
# end-dev-这里是配置信息基本值
spring:
......
......@@ -369,14 +369,16 @@ public class TestZxlnftSdkUtil {
System.out.println("=============执行第"+(i+1)+"个===================================");
Nft022UploadSecretReqDto reqDto = Nft022UploadSecretReqDto.getNew();
reqDto.setSeriesName("NOW_ZXL_NFT_PIC001_test_skuId001");
reqDto.setTimestamp(DateUtil.getNowSeconds().toString());
reqDto.setSeriesName("NOW_ZXL_NFT_PIC001_test_skuId001"+i);
System.out.println("timestamp=="+DateUtil.getNowSeconds().toString());
reqDto.setTimestamp(DateUtil.getNowSeconds().toString()+"123456"+i);
System.out.println("timestamp=="+reqDto.getTimestamp());
reqDto.setUserPubKey(zxlnftConfig.getNftPlatformPubKey());
try {
Thread.sleep(2000l);
} catch (InterruptedException e) {
e.printStackTrace();
}
// try {
// Thread.sleep(2000l);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
//系列为空
String userData = reqDto.getTimestamp();
//系列不为空
......@@ -550,6 +552,7 @@ public class TestZxlnftSdkUtil {
public void nft033SeriesList(){
Nft033SeriesListReqDto reqDto = Nft033SeriesListReqDto.getNew();
reqDto.setAddr("zxa66c8a684727d0f9aaa434044362aa8a18b61bb4");
// reqDto.setAddr(zhouhuanAddress1);
ZxlnftResponseDto<Nft033SeriesListRespDto> resp = zxlnftSdkUtil.nft033SeriesList(reqDto);
System.out.println(resp.toJson());
}
......
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