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

Commit 459ae0d6 authored by anjiabin's avatar anjiabin

修改购买逻辑

parent 4eb7e81a
...@@ -11,7 +11,10 @@ package com.liquidnet.service.galaxy.constant; ...@@ -11,7 +11,10 @@ package com.liquidnet.service.galaxy.constant;
*/ */
public enum GalaxyErrorCodeEnum { public enum GalaxyErrorCodeEnum {
SERIES_CLAIM_ERROR("NFT0010001","NFT系列声明失败"), SERIES_CLAIM_ERROR("NFT0010001","NFT系列声明失败"),
SERIES_CLAIM_ERROR_FIVE_TIMES("NFT0010002","NFT系列声明失败,任务查询超过5次"); 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!");
private String code; private String code;
private String message; private String message;
......
...@@ -32,7 +32,7 @@ public class GalaxyNftOrderBo implements Serializable,Cloneable { ...@@ -32,7 +32,7 @@ public class GalaxyNftOrderBo implements Serializable,Cloneable {
/** /**
* 接入方买入唯一标识 * 接入方买入唯一标识
*/ */
private String orderPayId; private String nftOrderPayId;
/** /**
* nftId * nftId
*/ */
......
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: NFT购买(涉及NFT发行、NFT购买)
* @class: GalaxyNftPublishAndBuyReqDto
* @Package com.liquidnet.service.galaxy.dto.param
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/3/17 13:51
*/
@ApiModel(value = "GalaxyNftPublishAndBuyReqDto", description = "NFT发行购买")
@Data
public class GalaxyNftPublishAndBuyReqDto 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;
/**
* skuId
*/
@ApiModelProperty(position = 1, required = true, value = "系列唯一id标识,不超过20个字符")
@NotBlank(message = "skuId不能为空!")
@Size(min = 2, max = 20, message = "skuId限制2-20位且不能包含特殊字符")
private String skuId;
/**
* nftOrderPayId
*/
@ApiModelProperty(position = 1, required = true, value = "nft订单支付id(保证唯一),不超过30个字符")
@NotBlank(message = "nft订单支付id不能为空")
@Size(min = 2, max = 30, message = "nft订单支付id限制2-30位且不能包含特殊字符")
private String nftOrderPayId;
@Override
public String toString(){
return JsonUtils.toJson(this);
}
private static final GalaxyNftPublishAndBuyReqDto obj = new GalaxyNftPublishAndBuyReqDto();
public static GalaxyNftPublishAndBuyReqDto getNew() {
try {
return (GalaxyNftPublishAndBuyReqDto) obj.clone();
} catch (CloneNotSupportedException e) {
return new GalaxyNftPublishAndBuyReqDto();
}
}
}
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: GalaxyNftPublishAndBuyRespDto
* @Package com.liquidnet.service.galaxy.dto.param;
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/3/17 13:51
*/
@ApiModel(value = "GalaxyNftPublishAndBuyRespDto", description = "NFT购买")
@Data
public class GalaxyNftPublishAndBuyRespDto implements Serializable,Cloneable {
@ApiModelProperty(position = 1, required = true, value = "用户Id")
private String userId;
@ApiModelProperty(position = 1, required = true, value = "用户购买的nftId")
private String nftId;
@Override
public String toString(){
return JsonUtils.toJson(this);
}
private static final GalaxyNftPublishAndBuyRespDto obj = new GalaxyNftPublishAndBuyRespDto();
public static GalaxyNftPublishAndBuyRespDto getNew() {
try {
return (GalaxyNftPublishAndBuyRespDto) obj.clone();
} catch (CloneNotSupportedException e) {
return new GalaxyNftPublishAndBuyRespDto();
}
}
}
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: NFT购买(涉及NFT发行、NFT购买)
* @class: GalaxyNftPublishReqDto
* @Package com.liquidnet.service.galaxy.dto.param
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/3/17 13:51
*/
@ApiModel(value = "GalaxyNftPublishReqDto", description = "NFT发行")
@Data
public class GalaxyNftPublishReqDto 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;
/**
* skuId
*/
@ApiModelProperty(position = 1, required = true, value = "系列唯一id标识,不超过20个字符")
@NotBlank(message = "skuId不能为空!")
@Size(min = 2, max = 20, message = "skuId限制2-20位且不能包含特殊字符")
private String skuId;
/**
* nftOrderPayId
*/
@ApiModelProperty(position = 1, required = true, value = "nft订单支付id(保证唯一),不超过30个字符")
@NotBlank(message = "nft订单支付id不能为空")
@Size(min = 2, max = 30, message = "nft订单支付id限制2-30位且不能包含特殊字符")
private String nftOrderPayId;
@Override
public String toString(){
return JsonUtils.toJson(this);
}
private static final GalaxyNftPublishReqDto obj = new GalaxyNftPublishReqDto();
public static GalaxyNftPublishReqDto getNew() {
try {
return (GalaxyNftPublishReqDto) obj.clone();
} catch (CloneNotSupportedException e) {
return new GalaxyNftPublishReqDto();
}
}
}
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: GalaxyNftPublishRespDto
* @Package com.liquidnet.service.galaxy.dto.param
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/3/17 13:51
*/
@ApiModel(value = "GalaxyNftPublishRespDto", description = "NFT发行")
@Data
public class GalaxyNftPublishRespDto implements Serializable,Cloneable {
@ApiModelProperty(position = 1, required = true, value = "用户Id")
private String userId;
@ApiModelProperty(position = 1, required = true, value = "用户购买的nftId")
private String nftId;
@Override
public String toString(){
return JsonUtils.toJson(this);
}
private static final GalaxyNftPublishRespDto obj = new GalaxyNftPublishRespDto();
public static GalaxyNftPublishRespDto getNew() {
try {
return (GalaxyNftPublishRespDto) obj.clone();
} catch (CloneNotSupportedException e) {
return new GalaxyNftPublishRespDto();
}
}
}
...@@ -32,7 +32,7 @@ public class GalaxyNftOrderVo implements Serializable,Cloneable { ...@@ -32,7 +32,7 @@ public class GalaxyNftOrderVo implements Serializable,Cloneable {
/** /**
* 接入方买入唯一标识 * 接入方买入唯一标识
*/ */
private String orderPayId; private String nftOrderPayId;
/** /**
* nftId * nftId
*/ */
......
...@@ -2,8 +2,8 @@ package com.liquidnet.service.galaxy.service; ...@@ -2,8 +2,8 @@ package com.liquidnet.service.galaxy.service;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyNftBuyReqDto; import com.liquidnet.service.galaxy.dto.param.GalaxyNftPublishReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyNftBuyRespDto; import com.liquidnet.service.galaxy.dto.param.GalaxyNftPublishRespDto;
/** /**
* @author AnJiabin <anjiabin@zhengzai.tv> * @author AnJiabin <anjiabin@zhengzai.tv>
...@@ -15,5 +15,5 @@ import com.liquidnet.service.galaxy.dto.param.GalaxyNftBuyRespDto; ...@@ -15,5 +15,5 @@ import com.liquidnet.service.galaxy.dto.param.GalaxyNftBuyRespDto;
* @date 2022/3/8 11:45 * @date 2022/3/8 11:45
*/ */
public interface IGalaxyPublishService { public interface IGalaxyPublishService {
ResponseDto<GalaxyNftBuyRespDto> nftBuy(GalaxyNftBuyReqDto reqDto); ResponseDto<GalaxyNftPublishRespDto> nftPublish(GalaxyNftPublishReqDto reqDto);
} }
package com.liquidnet.service.galaxy.service; package com.liquidnet.service.galaxy.service;
import com.liquidnet.service.base.ResponseDto;
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;
/** /**
* @author AnJiabin <anjiabin@zhengzai.tv> * @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0 * @version V1.0
...@@ -11,4 +17,7 @@ package com.liquidnet.service.galaxy.service; ...@@ -11,4 +17,7 @@ package com.liquidnet.service.galaxy.service;
* @date 2022/3/8 11:45 * @date 2022/3/8 11:45
*/ */
public interface IGalaxyTradeService { public interface IGalaxyTradeService {
ResponseDto<GalaxyNftBuyRespDto> nftBuy(GalaxyNftBuyReqDto reqDto);
ResponseDto<GalaxyNftPublishAndBuyRespDto> nftPublishAndBuy(GalaxyNftPublishAndBuyReqDto reqDto);
} }
package com.liquidnet.service.galaxy.controller;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: NFT购买
* @class: GalaxyNftTradeController
* @Package com.liquidnet.service.galaxy.controller
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/3/14 18:08
*/
@Api(tags = "NFT艺术品相关")
@RestController
@RequestMapping("nftTrade")
@Validated
@Slf4j
public class GalaxyNftTradeController {
}
...@@ -3,8 +3,8 @@ package com.liquidnet.service.galaxy.controller; ...@@ -3,8 +3,8 @@ package com.liquidnet.service.galaxy.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.galaxy.aop.annotation.ControllerLog; import com.liquidnet.service.galaxy.aop.annotation.ControllerLog;
import com.liquidnet.service.galaxy.dto.param.GalaxyNftBuyReqDto; import com.liquidnet.service.galaxy.dto.param.GalaxyNftPublishReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyNftBuyRespDto; import com.liquidnet.service.galaxy.dto.param.GalaxyNftPublishRespDto;
import com.liquidnet.service.galaxy.service.IGalaxyPublishService; import com.liquidnet.service.galaxy.service.IGalaxyPublishService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -27,7 +27,7 @@ import javax.validation.Valid; ...@@ -27,7 +27,7 @@ import javax.validation.Valid;
* @Copyright: LightNet @ Copyright (c) 2021 * @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/3/15 12:11 * @date 2022/3/15 12:11
*/ */
@Api(tags = "NFT-发行购买相关") @Api(tags = "NFT-发行相关")
@RestController @RestController
@RequestMapping("nftPublish") @RequestMapping("nftPublish")
@Validated @Validated
...@@ -36,11 +36,11 @@ public class GalaxyPublishController { ...@@ -36,11 +36,11 @@ public class GalaxyPublishController {
@Autowired @Autowired
private IGalaxyPublishService galaxyPublishService; private IGalaxyPublishService galaxyPublishService;
@ControllerLog(description = "NFT购买") @ControllerLog(description = "NFT发行")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@ApiOperation(value = "NFT购买") @ApiOperation(value = "NFT发行")
@PostMapping(value = {"nftBuy"}) @PostMapping(value = {"nftPublish"})
public ResponseDto<GalaxyNftBuyRespDto> nftBuy(@Valid @RequestBody GalaxyNftBuyReqDto reqDto){ public ResponseDto<GalaxyNftPublishRespDto> nftPublish(@Valid @RequestBody GalaxyNftPublishReqDto reqDto){
return galaxyPublishService.nftBuy(reqDto); return galaxyPublishService.nftPublish(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.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.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.validation.Valid;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: NFT购买
* @class: GalaxyNftTradeController
* @Package com.liquidnet.service.galaxy.controller
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/3/14 18:08
*/
@Api(tags = "NFT交易相关")
@RestController
@RequestMapping("nftTrade")
@Validated
@Slf4j
public class GalaxyTradeController {
@Autowired
private IGalaxyTradeService galaxyTradeService;
@ControllerLog(description = "NFT购买")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "NFT购买")
@PostMapping(value = {"nftBuy"})
public ResponseDto<GalaxyNftBuyRespDto> nftBuy(@Valid @RequestBody GalaxyNftBuyReqDto reqDto){
return galaxyTradeService.nftBuy(reqDto);
}
@ControllerLog(description = "NFT购买(发行+购买)")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "NFT购买(发行+购买)")
@PostMapping(value = {"nftPublishAndBuy"})
public ResponseDto<GalaxyNftPublishAndBuyRespDto> nftPublishAndBuy(@Valid @RequestBody GalaxyNftPublishAndBuyReqDto reqDto){
return galaxyTradeService.nftPublishAndBuy(reqDto);
}
}
...@@ -21,5 +21,9 @@ public interface IGalaxyRouterStrategy { ...@@ -21,5 +21,9 @@ public interface IGalaxyRouterStrategy {
ResponseDto<GalaxyArtSeriesClaimRespDto> seriesClaim(GalaxyArtSeriesClaimReqDto reqDto); ResponseDto<GalaxyArtSeriesClaimRespDto> seriesClaim(GalaxyArtSeriesClaimReqDto reqDto);
ResponseDto<GalaxyNftPublishRespDto> nftPublish(GalaxyNftPublishReqDto reqDto);
ResponseDto<GalaxyNftPublishAndBuyRespDto> nftPublishAndBuy(GalaxyNftPublishAndBuyReqDto reqDto);
ResponseDto<GalaxyNftBuyRespDto> nftBuy(GalaxyNftBuyReqDto reqDto); ResponseDto<GalaxyNftBuyRespDto> nftBuy(GalaxyNftBuyReqDto reqDto);
} }
...@@ -26,6 +26,16 @@ public class GalaxyRouterStrategyEthImpl extends AbstractGalaxyRouterStrategyImp ...@@ -26,6 +26,16 @@ public class GalaxyRouterStrategyEthImpl extends AbstractGalaxyRouterStrategyImp
return null; return null;
} }
@Override
public ResponseDto<GalaxyNftPublishRespDto> nftPublish(GalaxyNftPublishReqDto reqDto) {
return null;
}
@Override
public ResponseDto<GalaxyNftPublishAndBuyRespDto> nftPublishAndBuy(GalaxyNftPublishAndBuyReqDto reqDto) {
return null;
}
@Override @Override
public ResponseDto<GalaxyUserRegisterRespDto> userRegister(GalaxyUserRegisterReqDto reqDto) { public ResponseDto<GalaxyUserRegisterRespDto> userRegister(GalaxyUserRegisterReqDto reqDto) {
return null; return null;
......
...@@ -6,6 +6,7 @@ import com.liquidnet.service.galaxy.dto.param.*; ...@@ -6,6 +6,7 @@ import com.liquidnet.service.galaxy.dto.param.*;
import com.liquidnet.service.galaxy.router.strategy.annotation.StrategyGalaxyRouterHandler; import com.liquidnet.service.galaxy.router.strategy.annotation.StrategyGalaxyRouterHandler;
import com.liquidnet.service.galaxy.router.zxin.biz.ZxinArtworkBiz; import com.liquidnet.service.galaxy.router.zxin.biz.ZxinArtworkBiz;
import com.liquidnet.service.galaxy.router.zxin.biz.ZxinPublishBiz; import com.liquidnet.service.galaxy.router.zxin.biz.ZxinPublishBiz;
import com.liquidnet.service.galaxy.router.zxin.biz.ZxinTradeBiz;
import com.liquidnet.service.galaxy.router.zxin.biz.ZxinUserBiz; import com.liquidnet.service.galaxy.router.zxin.biz.ZxinUserBiz;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -33,6 +34,9 @@ public class GalaxyRouterStrategyZxlImpl extends AbstractGalaxyRouterStrategyImp ...@@ -33,6 +34,9 @@ public class GalaxyRouterStrategyZxlImpl extends AbstractGalaxyRouterStrategyImp
@Autowired @Autowired
private ZxinPublishBiz zxinPublishBiz; private ZxinPublishBiz zxinPublishBiz;
@Autowired
private ZxinTradeBiz zxinTradeBiz;
@Override @Override
public ResponseDto<GalaxyUserRegisterRespDto> userRegister(GalaxyUserRegisterReqDto reqDto) { public ResponseDto<GalaxyUserRegisterRespDto> userRegister(GalaxyUserRegisterReqDto reqDto) {
return zxinUserBiz.userRegister(reqDto); return zxinUserBiz.userRegister(reqDto);
...@@ -53,8 +57,18 @@ public class GalaxyRouterStrategyZxlImpl extends AbstractGalaxyRouterStrategyImp ...@@ -53,8 +57,18 @@ public class GalaxyRouterStrategyZxlImpl extends AbstractGalaxyRouterStrategyImp
return zxinArtworkBiz.seriesClaim(reqDto); return zxinArtworkBiz.seriesClaim(reqDto);
} }
@Override
public ResponseDto<GalaxyNftPublishRespDto> nftPublish(GalaxyNftPublishReqDto reqDto) {
return zxinPublishBiz.nftPublish(reqDto);
}
@Override
public ResponseDto<GalaxyNftPublishAndBuyRespDto> nftPublishAndBuy(GalaxyNftPublishAndBuyReqDto reqDto) {
return zxinPublishBiz.nftPublishAndBuy(reqDto);
}
@Override @Override
public ResponseDto<GalaxyNftBuyRespDto> nftBuy(GalaxyNftBuyReqDto reqDto) { public ResponseDto<GalaxyNftBuyRespDto> nftBuy(GalaxyNftBuyReqDto reqDto) {
return zxinPublishBiz.nftBuy(reqDto); return zxinTradeBiz.nftBuy(reqDto);
} }
} }
...@@ -6,13 +6,15 @@ import com.liquidnet.common.third.zxlnft.constant.ZxlnftEnum; ...@@ -6,13 +6,15 @@ import com.liquidnet.common.third.zxlnft.constant.ZxlnftEnum;
import com.liquidnet.common.third.zxlnft.dto.*; import com.liquidnet.common.third.zxlnft.dto.*;
import com.liquidnet.common.third.zxlnft.util.ZxlWalletSdkUtil; import com.liquidnet.common.third.zxlnft.util.ZxlWalletSdkUtil;
import com.liquidnet.common.third.zxlnft.util.ZxlnftSdkUtil; import com.liquidnet.common.third.zxlnft.util.ZxlnftSdkUtil;
import com.liquidnet.commons.lang.util.BeanUtil;
import com.liquidnet.commons.lang.util.IDGenerator; import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.commons.lang.util.StringUtil; import com.liquidnet.commons.lang.util.StringUtil;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.galaxy.constant.GalaxyErrorCodeEnum;
import com.liquidnet.service.galaxy.dto.bo.GalaxyNftOrderBo;
import com.liquidnet.service.galaxy.dto.bo.GalaxySeriesInfoBo; import com.liquidnet.service.galaxy.dto.bo.GalaxySeriesInfoBo;
import com.liquidnet.service.galaxy.dto.bo.GalaxyUserInfoBo; import com.liquidnet.service.galaxy.dto.bo.GalaxyUserInfoBo;
import com.liquidnet.service.galaxy.dto.param.GalaxyNftBuyReqDto; import com.liquidnet.service.galaxy.dto.param.*;
import com.liquidnet.service.galaxy.dto.param.GalaxyNftBuyRespDto;
import com.liquidnet.service.galaxy.utils.DataUtils; import com.liquidnet.service.galaxy.utils.DataUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -47,7 +49,16 @@ public class ZxinPublishBiz { ...@@ -47,7 +49,16 @@ public class ZxinPublishBiz {
@Autowired @Autowired
private DataUtils dataUtils; private DataUtils dataUtils;
public ResponseDto<GalaxyNftBuyRespDto> nftBuy(GalaxyNftBuyReqDto reqDto) { @Autowired
private ZxinTradeBiz zxinTradeBiz;
public ResponseDto<GalaxyNftPublishRespDto> nftPublish(GalaxyNftPublishReqDto reqDto) {
//获取订单信息
GalaxyNftOrderBo nftOrderBo = dataUtils.getNftOrderBo(reqDto.getRouteType(),reqDto.getNftOrderPayId());
if(StringUtil.isNotNull(nftOrderBo)&&StringUtil.isNotEmpty(nftOrderBo.getNftId())){
return ResponseDto.failure(GalaxyErrorCodeEnum.PUBLISH_FAIL_ALREADY_EXIST.getCode(),GalaxyErrorCodeEnum.PUBLISH_FAIL_ALREADY_EXIST.getMessage());
}
//获取用户信息 //获取用户信息
GalaxyUserInfoBo userInfoBo = dataUtils.getGalaxyUserInfo(reqDto.getRouteType(),reqDto.getUserId()); GalaxyUserInfoBo userInfoBo = dataUtils.getGalaxyUserInfo(reqDto.getRouteType(),reqDto.getUserId());
...@@ -70,6 +81,137 @@ public class ZxinPublishBiz { ...@@ -70,6 +81,137 @@ public class ZxinPublishBiz {
* 根据sku获取系列Id * 根据sku获取系列Id
*/ */
String seriesId = seriesInfoBo.getSkuId(); String seriesId = seriesInfoBo.getSkuId();
//返回参数nftId
String nftId = null;
String taskId = null;
//查询系列信息
Nft032SeriesReqDto nft032ReqDto = Nft032SeriesReqDto.getNew();
nft032ReqDto.setSeriesId(seriesId);
ZxlnftResponseDto<Nft032SeriesRespDto> resp = zxlnftSdkUtil.nft032Series(nft032ReqDto);
if(!resp.isSuccess()){
//该系列已经发行多少个nft
Long crtCount = resp.getData().getSeriesInfo().getCrtCount();
log.info("系列:{} 已发行 :{}", seriesId, crtCount);
//设置开始索引
seriesBeginIndex = Integer.parseInt(String.valueOf(crtCount.longValue() + 1));
}
//3.1.2调用NFT发行接口
/**
* 发行无限制系列
*/
Nft034PublishReqDto nft034ReqDto = Nft034PublishReqDto.getNew();
nft034ReqDto.setAuthor(author);
nft034ReqDto.setName(nftName);
nft034ReqDto.setUrl(nftUrl);
nft034ReqDto.setDisplayUrl(displayUrl);
nft034ReqDto.setDesc(nftDesc);
nft034ReqDto.setFlag(nftFlag);
nft034ReqDto.setPublishCount(publishCount);
//无限制零系列
nft034ReqDto.setSeriesId(seriesId);
nft034ReqDto.setSeriesBeginIndex(seriesBeginIndex);
nft034ReqDto.setSellStatus(Integer.parseInt(ZxlnftEnum.SellStatusEnum.CAN_SELL.getCode()));
nft034ReqDto.setSellCount(sellCount);
nft034ReqDto.setOperateId(IDGenerator.get32UUID());
nft034ReqDto.setMetaData("");
ZxlnftResponseDto<Nft034PublishRespDto> nft034RespDto = zxlnftSdkUtil.nft034Publish(nft034ReqDto);
if (nft034RespDto.isSuccess()) {
//3.1.4查询 NFT发行结果
Nft035PublishResultReqDto nft035ReqDto = Nft035PublishResultReqDto.getNew();
taskId = nft034RespDto.getData().getTaskId();
nft035ReqDto.setTaskId(taskId);
int count = 0;
String nftIdBegin = null;
long timeStart = System.currentTimeMillis();
while (StringUtil.isEmpty(nftIdBegin)) {
//休眠1秒钟,等待执行结果
try {
Thread.sleep(1000l);
} catch (InterruptedException e) {
e.printStackTrace();
}
count++;
ZxlnftResponseDto<Nft035PublishResultRespDto> nft035RespDtoTemp = zxlnftSdkUtil.nft035PublishResult(nft035ReqDto);
log.info("=======执行第{}次查询,taskId:{}", count, nft035ReqDto.getTaskId());
if (nft035RespDtoTemp.getData().getTaskStatus().toString().equals(ZxlnftEnum.TaskStatusEnum.TASK_SUCCESS.getCode())) {
nftIdBegin = nft035RespDtoTemp.getData().getNftIdBegin();
} else if (nft035RespDtoTemp.getData().getTaskStatus().toString().equals(ZxlnftEnum.TaskStatusEnum.TASK_FAIL.getCode())) {
log.info("任务执行失败!taskId:{}", nft035ReqDto.getTaskId());
return null;
}
if (count == 5) {
log.info("=======查询共5次,跳出循环!taskId:{}", nft035ReqDto.getTaskId());
break;
}
}
//赋值返回参数
nftId = nftIdBegin;
log.info("发行NFT后返回给前端nftID:{}", nftIdBegin);
log.info("总共执行了{}次查询 总耗时:{} MS", count, (System.currentTimeMillis() - timeStart));
}
if(StringUtil.isEmpty(nftId)){
return ResponseDto.failure(GalaxyErrorCodeEnum.PUBLISH_FAIL.getCode(),GalaxyErrorCodeEnum.PUBLISH_FAIL.getMessage());
}
GalaxyNftPublishRespDto nftPublishRespDto = GalaxyNftPublishRespDto.getNew();
nftPublishRespDto.setUserId(reqDto.getUserId());
nftPublishRespDto.setNftId(nftId);
//构造缓存数据
if(nftOrderBo==null){
nftOrderBo = GalaxyNftOrderBo.getNew();
nftOrderBo.setUserId(userInfoBo.getUserId());
nftOrderBo.setSkuId(reqDto.getSkuId());
nftOrderBo.setSeriesName(seriesInfoBo.getSeriesName());
nftOrderBo.setSeriesId(seriesInfoBo.getSeriesId());
nftOrderBo.setNftOrderPayId(reqDto.getNftOrderPayId());
nftOrderBo.setNftId(nftId);
nftOrderBo.setNftPrice(seriesInfoBo.getSellCount().longValue());
nftOrderBo.setFromAddress("");
nftOrderBo.setToAddress("");
dataUtils.setNftOrderBo(reqDto.getRouteType(),reqDto.getNftOrderPayId(),nftOrderBo);
}
return ResponseDto.success(nftPublishRespDto);
}
public ResponseDto<GalaxyNftPublishAndBuyRespDto> nftPublishAndBuy(GalaxyNftPublishAndBuyReqDto reqDto) {
//获取用户信息
GalaxyUserInfoBo userInfoBo = dataUtils.getGalaxyUserInfo(reqDto.getRouteType(),reqDto.getUserId());
//获取sku信息
GalaxySeriesInfoBo seriesInfoBo = dataUtils.getSeriesInfoBo(reqDto.getRouteType(),reqDto.getSkuId());
String author = seriesInfoBo.getAuthor();
String nftName = seriesInfoBo.getNftName();
String nftUrl = seriesInfoBo.getNftUrl();
String displayUrl = seriesInfoBo.getDisplayUrl();
String nftDesc = seriesInfoBo.getNftDesc();
String nftFlag = seriesInfoBo.getNftFlag();
//发行个数
Long publishCount = 1L;
//开始索引
Integer seriesBeginIndex = 0;
//发行金额
Long sellCount = Long.valueOf(seriesInfoBo.getSellCount().multiply(BigDecimal.valueOf(100l)).longValue()); //积分
/**
* 根据sku获取系列Id
*/
String seriesId = seriesInfoBo.getSkuId();
//返回参数nftId
String nftId = null;
//查询系列信息 //查询系列信息
...@@ -163,6 +305,7 @@ public class ZxinPublishBiz { ...@@ -163,6 +305,7 @@ public class ZxinPublishBiz {
log.info("总共执行了{}次查询 总耗时:{} MS", count, (System.currentTimeMillis() - timeStart)); log.info("总共执行了{}次查询 总耗时:{} MS", count, (System.currentTimeMillis() - timeStart));
if (StringUtil.isNotEmpty(nftIdBegin)) { if (StringUtil.isNotEmpty(nftIdBegin)) {
nftId = nftIdBegin;
//3.1.3调用NFT查询接口 //3.1.3调用NFT查询接口
Nft036InfoReqDto nft036ReqDto = Nft036InfoReqDto.getNew(); Nft036InfoReqDto nft036ReqDto = Nft036InfoReqDto.getNew();
nft036ReqDto.setNftId(nftIdBegin); nft036ReqDto.setNftId(nftIdBegin);
...@@ -171,77 +314,14 @@ public class ZxinPublishBiz { ...@@ -171,77 +314,14 @@ public class ZxinPublishBiz {
} }
} }
} }
return null; if(StringUtil.isNotEmpty(nftId)){
} //执行购买逻辑
GalaxyNftPublishAndBuyRespDto nftPublishAndBuyRespDto = GalaxyNftPublishAndBuyRespDto.getNew();
public void nftBuyBuss(GalaxyUserInfoBo userInfoBo,GalaxySeriesInfoBo seriesInfoBo){ GalaxyNftBuyRespDto nftBuyRespDto = zxinTradeBiz.nftBuyBusiness(nftId,userInfoBo,seriesInfoBo);
// 3.2.1调用积分申请接口 BeanUtil.copy(nftBuyRespDto,nftPublishAndBuyRespDto);
// 3.2.2调用购买NFT接口 return ResponseDto.success(nftPublishAndBuyRespDto);
Nft043BuyReqDto nft043BuyReqDto = Nft043BuyReqDto.getNew(); }else{
// reqDto.setNftId("7f73aca56caaf57a20f0afff59318528f0f09ffbf028fe882161d3ce599d2854_1"); return ResponseDto.failure(GalaxyErrorCodeEnum.PUBLISH_FAIL.getCode(),GalaxyErrorCodeEnum.PUBLISH_FAIL.getMessage());
// nft043BuyReqDto.setNftId("08c152e5fa467d28b7add8e408fb3ecd1ed2ff209364adc1e394bde53929df8f_1");
nft043BuyReqDto.setNftId("43c169ae33d2ca5390a49d2319c14223ed5e7447c4b40c0422ef81691ddfee89_4");
nft043BuyReqDto.setApplyScore(seriesInfoBo.getSellCount().intValue());
nft043BuyReqDto.setReceiverPubKey(userInfoBo.getUserPubKey());
nft043BuyReqDto.setPointReceiverAddr(userInfoBo.getBlockChainAddress());
nft043BuyReqDto.setOfferCount(seriesInfoBo.getSellCount().longValue());
nft043BuyReqDto.setOperateId(IDGenerator.get32UUID());
/**
* 接收人的私钥签名,签名对象是(platformPubKey_receiverPubKey_pointReceiverAddr_applyScore_接口名_nftId_offerCount_operateId)
* 接口名:buy_nft
*/
String signMetaData = zxlnftConfig.getNftPlatformPubKey()
.concat("_").concat(nft043BuyReqDto.getReceiverPubKey())
.concat("_").concat(nft043BuyReqDto.getPointReceiverAddr())
.concat("_").concat(nft043BuyReqDto.getApplyScore().toString())
.concat("_").concat("buy_nft")
.concat("_").concat(nft043BuyReqDto.getNftId())
.concat("_").concat(nft043BuyReqDto.getOfferCount().toString())
.concat("_").concat(nft043BuyReqDto.getOperateId());
String signature = zxlnftBiz.createSign(userInfoBo.getUserPriKey(),signMetaData);
nft043BuyReqDto.setSignature(signature);
ZxlnftResponseDto<Nft043BuyRespDto> nft043RespDto = zxlnftSdkUtil.nft043Buy(nft043BuyReqDto);
if(nft043RespDto.isSuccess()){
//3.2.4查询NFT购买结果
Nft044BuyResultReqDto nft044ReqDto = Nft044BuyResultReqDto.getNew();
nft044ReqDto.setTaskId(nft043RespDto.getData().getTaskId());
long timeStart = System.currentTimeMillis();
ZxlnftResponseDto<Nft044BuyResultRespDto> nft044RespDto = zxlnftSdkUtil.nft044BuyResult(nft044ReqDto);
if(nft044RespDto.isSuccess()){
int count = 1;
String payTaskId = null;
while(payTaskId == null){
try {
Thread.sleep(1000l);
} catch (InterruptedException e) {
e.printStackTrace();
}
count++;
log.info("=======执行第{}次查询,taskId:{}",1,nft044ReqDto.getTaskId());
ZxlnftResponseDto<Nft044BuyResultRespDto> nft044RespDtoTemp = zxlnftSdkUtil.nft044BuyResult(nft044ReqDto);
if(nft044RespDtoTemp.getData().getTaskStatus().toString().equals(ZxlnftEnum.TaskStatusEnum.TASK_SUCCESS.getCode())){
payTaskId = nft044RespDtoTemp.getData().getPayTaskId();
}else if(nft044RespDtoTemp.getData().getTaskStatus().toString().equals(ZxlnftEnum.TaskStatusEnum.TASK_FAIL.getCode())){
log.info("任务执行失败!taskId:{}",nft044ReqDto.getTaskId());
return;
}
if(count==6){
log.info("=======查询共6次,跳出循环!taskId:{}",nft044ReqDto.getTaskId());
break;
}
}
log.info("总共执行了多少次查询:{} 总耗时:{}",count,System.currentTimeMillis() - timeStart);
if(StringUtil.isNotEmpty(payTaskId)){
//3.2.5查询NFT购买支付结果
Nft045BuyPayResultReqDto nft045ReqDto = Nft045BuyPayResultReqDto.getNew();
nft045ReqDto.setTaskId(payTaskId);
ZxlnftResponseDto<Nft045BuyPayResultRespDto> nft045RespDto = zxlnftSdkUtil.nft045BuyPayResult(nft045ReqDto);
}
}
} }
} }
} }
package com.liquidnet.service.galaxy.router.zxin.biz; package com.liquidnet.service.galaxy.router.zxin.biz;
import com.liquidnet.common.third.zxlnft.biz.ZxlnftBiz;
import com.liquidnet.common.third.zxlnft.config.ZxlnftConfig;
import com.liquidnet.common.third.zxlnft.constant.ZxlnftEnum;
import com.liquidnet.common.third.zxlnft.dto.*;
import com.liquidnet.common.third.zxlnft.util.ZxlWalletSdkUtil;
import com.liquidnet.common.third.zxlnft.util.ZxlnftSdkUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.commons.lang.util.StringUtil;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.galaxy.constant.GalaxyErrorCodeEnum;
import com.liquidnet.service.galaxy.dto.bo.GalaxyNftOrderBo;
import com.liquidnet.service.galaxy.dto.bo.GalaxySeriesInfoBo;
import com.liquidnet.service.galaxy.dto.bo.GalaxyUserInfoBo;
import com.liquidnet.service.galaxy.dto.param.GalaxyNftBuyReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyNftBuyRespDto;
import com.liquidnet.service.galaxy.utils.DataUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
...@@ -15,4 +32,110 @@ import org.springframework.stereotype.Component; ...@@ -15,4 +32,110 @@ import org.springframework.stereotype.Component;
@Slf4j @Slf4j
@Component @Component
public class ZxinTradeBiz { public class ZxinTradeBiz {
@Autowired
private ZxlnftSdkUtil zxlnftSdkUtil;
@Autowired
private ZxlWalletSdkUtil zxlWalletSdkUtil;
@Autowired
private ZxlnftBiz zxlnftBiz;
@Autowired
private ZxlnftConfig zxlnftConfig;
@Autowired
private DataUtils dataUtils;
public ResponseDto<GalaxyNftBuyRespDto> nftBuy(GalaxyNftBuyReqDto nftBuyReqDto){
//获取用户信息
GalaxyUserInfoBo userInfoBo = dataUtils.getGalaxyUserInfo(nftBuyReqDto.getRouteType(),nftBuyReqDto.getUserId());
//获取sku信息
GalaxySeriesInfoBo seriesInfoBo = dataUtils.getSeriesInfoBo(nftBuyReqDto.getRouteType(),nftBuyReqDto.getSkuId());
//获取nftOrder信息
GalaxyNftOrderBo nftOrderBo = dataUtils.getNftOrderBo(nftBuyReqDto.getRouteType(),nftBuyReqDto.getNftOrderPayId());
//返回参数nftId
String nftId = null;
if(StringUtil.isNotNull(nftOrderBo)){
nftId = nftOrderBo.getNftId();
}
if(StringUtil.isNotEmpty(nftId)){
//执行购买逻辑
GalaxyNftBuyRespDto nftBuyRespDto = this.nftBuyBusiness(nftId,userInfoBo,seriesInfoBo);
return ResponseDto.success(nftBuyRespDto);
}else{
return ResponseDto.failure(GalaxyErrorCodeEnum.PUBLISH_BUY_FAIL.getCode(),GalaxyErrorCodeEnum.PUBLISH_BUY_FAIL.getMessage());
}
}
public GalaxyNftBuyRespDto nftBuyBusiness(String nftId,GalaxyUserInfoBo userInfoBo, GalaxySeriesInfoBo seriesInfoBo){
// 3.2.2调用购买NFT接口
Nft043BuyReqDto nft043BuyReqDto = Nft043BuyReqDto.getNew();
nft043BuyReqDto.setNftId(nftId);
nft043BuyReqDto.setApplyScore(seriesInfoBo.getSellCount().intValue());
nft043BuyReqDto.setReceiverPubKey(userInfoBo.getUserPubKey());
nft043BuyReqDto.setPointReceiverAddr(userInfoBo.getBlockChainAddress());
nft043BuyReqDto.setOfferCount(seriesInfoBo.getSellCount().longValue());
nft043BuyReqDto.setOperateId(IDGenerator.get32UUID());
/**
* 接收人的私钥签名,签名对象是(platformPubKey_receiverPubKey_pointReceiverAddr_applyScore_接口名_nftId_offerCount_operateId)
* 接口名:buy_nft
*/
String signMetaData = zxlnftConfig.getNftPlatformPubKey()
.concat("_").concat(nft043BuyReqDto.getReceiverPubKey())
.concat("_").concat(nft043BuyReqDto.getPointReceiverAddr())
.concat("_").concat(nft043BuyReqDto.getApplyScore().toString())
.concat("_").concat("buy_nft")
.concat("_").concat(nft043BuyReqDto.getNftId())
.concat("_").concat(nft043BuyReqDto.getOfferCount().toString())
.concat("_").concat(nft043BuyReqDto.getOperateId());
String signature = zxlnftBiz.createSign(userInfoBo.getUserPriKey(),signMetaData);
nft043BuyReqDto.setSignature(signature);
ZxlnftResponseDto<Nft043BuyRespDto> nft043RespDto = zxlnftSdkUtil.nft043Buy(nft043BuyReqDto);
if(nft043RespDto.isSuccess()){
//3.2.4查询NFT购买结果
Nft044BuyResultReqDto nft044ReqDto = Nft044BuyResultReqDto.getNew();
nft044ReqDto.setTaskId(nft043RespDto.getData().getTaskId());
long timeStart = System.currentTimeMillis();
ZxlnftResponseDto<Nft044BuyResultRespDto> nft044RespDto = zxlnftSdkUtil.nft044BuyResult(nft044ReqDto);
if(nft044RespDto.isSuccess()){
int count = 1;
String payTaskId = null;
while(payTaskId == null){
try {
Thread.sleep(1000l);
} catch (InterruptedException e) {
e.printStackTrace();
}
count++;
log.info("=======执行第{}次查询,taskId:{}",1,nft044ReqDto.getTaskId());
ZxlnftResponseDto<Nft044BuyResultRespDto> nft044RespDtoTemp = zxlnftSdkUtil.nft044BuyResult(nft044ReqDto);
if(nft044RespDtoTemp.getData().getTaskStatus().toString().equals(ZxlnftEnum.TaskStatusEnum.TASK_SUCCESS.getCode())){
payTaskId = nft044RespDtoTemp.getData().getPayTaskId();
}else if(nft044RespDtoTemp.getData().getTaskStatus().toString().equals(ZxlnftEnum.TaskStatusEnum.TASK_FAIL.getCode())){
log.info("任务执行失败!taskId:{}",nft044ReqDto.getTaskId());
return null;
}
if(count==6){
log.info("=======查询共6次,跳出循环!taskId:{}",nft044ReqDto.getTaskId());
break;
}
}
log.info("总共执行了多少次查询:{} 总耗时:{}",count,System.currentTimeMillis() - timeStart);
if(StringUtil.isNotEmpty(payTaskId)){
//3.2.5查询NFT购买支付结果
Nft045BuyPayResultReqDto nft045ReqDto = Nft045BuyPayResultReqDto.getNew();
nft045ReqDto.setTaskId(payTaskId);
ZxlnftResponseDto<Nft045BuyPayResultRespDto> nft045RespDto = zxlnftSdkUtil.nft045BuyPayResult(nft045ReqDto);
}
}
}
return null;
}
} }
package com.liquidnet.service.galaxy.service.impl; package com.liquidnet.service.galaxy.service.impl;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyNftBuyReqDto; import com.liquidnet.service.galaxy.dto.param.*;
import com.liquidnet.service.galaxy.dto.param.GalaxyNftBuyRespDto;
import com.liquidnet.service.galaxy.router.strategy.GalaxyRouterStrategyContext; import com.liquidnet.service.galaxy.router.strategy.GalaxyRouterStrategyContext;
import com.liquidnet.service.galaxy.service.IGalaxyPublishService; import com.liquidnet.service.galaxy.service.IGalaxyPublishService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -12,7 +11,7 @@ import org.springframework.stereotype.Service; ...@@ -12,7 +11,7 @@ import org.springframework.stereotype.Service;
/** /**
* @author AnJiabin <anjiabin@zhengzai.tv> * @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0 * @version V1.0
* @Description: TODO * @Description: NFT发行相关
* @class: GalaxyPublishServiceImpl * @class: GalaxyPublishServiceImpl
* @Package com.liquidnet.service.galaxy.service.impl * @Package com.liquidnet.service.galaxy.service.impl
* @Copyright: LightNet @ Copyright (c) 2021 * @Copyright: LightNet @ Copyright (c) 2021
...@@ -25,7 +24,7 @@ public class GalaxyPublishServiceImpl implements IGalaxyPublishService { ...@@ -25,7 +24,7 @@ public class GalaxyPublishServiceImpl implements IGalaxyPublishService {
private GalaxyRouterStrategyContext galaxyRouterStrategyContext; private GalaxyRouterStrategyContext galaxyRouterStrategyContext;
@Override @Override
public ResponseDto<GalaxyNftBuyRespDto> nftBuy(GalaxyNftBuyReqDto reqDto) { public ResponseDto<GalaxyNftPublishRespDto> nftPublish(GalaxyNftPublishReqDto reqDto) {
return galaxyRouterStrategyContext.getStrategy(reqDto.getRouteType()).nftBuy(reqDto); return galaxyRouterStrategyContext.getStrategy(reqDto.getRouteType()).nftPublish(reqDto);
} }
} }
package com.liquidnet.service.galaxy.service.impl;
import com.liquidnet.service.base.ResponseDto;
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.router.strategy.GalaxyRouterStrategyContext;
import com.liquidnet.service.galaxy.service.IGalaxyTradeService;
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: GalaxyTradeServiceImpl
* @Package com.liquidnet.service.galaxy.service.impl
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/3/17 14:19
*/
@Slf4j
@Service
public class GalaxyTradeServiceImpl implements IGalaxyTradeService {
@Autowired
private GalaxyRouterStrategyContext galaxyRouterStrategyContext;
@Override
public ResponseDto<GalaxyNftBuyRespDto> nftBuy(GalaxyNftBuyReqDto reqDto) {
return galaxyRouterStrategyContext.getStrategy(reqDto.getRouteType()).nftBuy(reqDto);
}
@Override
public ResponseDto<GalaxyNftPublishAndBuyRespDto> nftPublishAndBuy(GalaxyNftPublishAndBuyReqDto reqDto) {
return galaxyRouterStrategyContext.getStrategy(reqDto.getRouteType()).nftPublishAndBuy(reqDto);
}
}
...@@ -61,9 +61,9 @@ public class DataUtils { ...@@ -61,9 +61,9 @@ public class DataUtils {
} }
} }
public void setNftOrderBo(String routeType,String skuId, GalaxyNftOrderBo nftOrderBo) { public void setNftOrderBo(String routeType,String nftOrderPayId, GalaxyNftOrderBo nftOrderBo) {
redisUtil.set(GalaxyConstant.REDIS_KET_GALAXY_TRADE.concat(routeType).concat(":") + skuId,nftOrderBo,keyExpireTime); redisUtil.set(GalaxyConstant.REDIS_KET_GALAXY_TRADE.concat(routeType).concat(":") + nftOrderPayId,nftOrderBo,keyExpireTime);
/** /**
* 入库mongo * 入库mongo
*/ */
...@@ -77,7 +77,7 @@ public class DataUtils { ...@@ -77,7 +77,7 @@ public class DataUtils {
if(obj!=null){ if(obj!=null){
return (GalaxyNftOrderBo) obj; return (GalaxyNftOrderBo) obj;
}else { }else {
GalaxyNftOrderVo nftOrderVo = mongoTemplate.findOne(Query.query(Criteria.where("orderPayId").is(orderPayId)), GalaxyNftOrderVo.class, GalaxyNftOrderVo.class.getSimpleName()); GalaxyNftOrderVo nftOrderVo = mongoTemplate.findOne(Query.query(Criteria.where("nftOrderPayId").is(orderPayId)), GalaxyNftOrderVo.class, GalaxyNftOrderVo.class.getSimpleName());
if (nftOrderVo == null) { if (nftOrderVo == null) {
return null; return null;
} }
......
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