记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董敬伟
liquidnet-bus-v1
Commits
459ae0d6
Commit
459ae0d6
authored
Mar 17, 2022
by
anjiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改购买逻辑
parent
4eb7e81a
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
641 additions
and
121 deletions
+641
-121
GalaxyErrorCodeEnum.java
...iquidnet/service/galaxy/constant/GalaxyErrorCodeEnum.java
+4
-1
GalaxyNftOrderBo.java
...com/liquidnet/service/galaxy/dto/bo/GalaxyNftOrderBo.java
+1
-1
GalaxyNftPublishAndBuyReqDto.java
...ervice/galaxy/dto/param/GalaxyNftPublishAndBuyReqDto.java
+62
-0
GalaxyNftPublishAndBuyRespDto.java
...rvice/galaxy/dto/param/GalaxyNftPublishAndBuyRespDto.java
+42
-0
GalaxyNftPublishReqDto.java
...dnet/service/galaxy/dto/param/GalaxyNftPublishReqDto.java
+62
-0
GalaxyNftPublishRespDto.java
...net/service/galaxy/dto/param/GalaxyNftPublishRespDto.java
+42
-0
GalaxyNftOrderVo.java
...quidnet/service/galaxy/dto/vo/mongo/GalaxyNftOrderVo.java
+1
-1
IGalaxyPublishService.java
...quidnet/service/galaxy/service/IGalaxyPublishService.java
+3
-3
IGalaxyTradeService.java
...liquidnet/service/galaxy/service/IGalaxyTradeService.java
+9
-0
GalaxyNftTradeController.java
...t/service/galaxy/controller/GalaxyNftTradeController.java
+0
-24
GalaxyPublishController.java
...et/service/galaxy/controller/GalaxyPublishController.java
+8
-8
GalaxyTradeController.java
...dnet/service/galaxy/controller/GalaxyTradeController.java
+56
-0
IGalaxyRouterStrategy.java
...service/galaxy/router/strategy/IGalaxyRouterStrategy.java
+4
-0
GalaxyRouterStrategyEthImpl.java
...axy/router/strategy/impl/GalaxyRouterStrategyEthImpl.java
+10
-0
GalaxyRouterStrategyZxlImpl.java
...axy/router/strategy/impl/GalaxyRouterStrategyZxlImpl.java
+15
-1
ZxinPublishBiz.java
...uidnet/service/galaxy/router/zxin/biz/ZxinPublishBiz.java
+154
-74
ZxinTradeBiz.java
...iquidnet/service/galaxy/router/zxin/biz/ZxinTradeBiz.java
+123
-0
GalaxyPublishServiceImpl.java
...service/galaxy/service/impl/GalaxyPublishServiceImpl.java
+4
-5
GalaxyTradeServiceImpl.java
...t/service/galaxy/service/impl/GalaxyTradeServiceImpl.java
+38
-0
DataUtils.java
...in/java/com/liquidnet/service/galaxy/utils/DataUtils.java
+3
-3
No files found.
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/constant/GalaxyErrorCodeEnum.java
View file @
459ae0d6
...
@@ -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
;
...
...
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/dto/bo/GalaxyNftOrderBo.java
View file @
459ae0d6
...
@@ -32,7 +32,7 @@ public class GalaxyNftOrderBo implements Serializable,Cloneable {
...
@@ -32,7 +32,7 @@ public class GalaxyNftOrderBo implements Serializable,Cloneable {
/**
/**
* 接入方买入唯一标识
* 接入方买入唯一标识
*/
*/
private
String
o
rderPayId
;
private
String
nftO
rderPayId
;
/**
/**
* nftId
* nftId
*/
*/
...
...
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/dto/param/GalaxyNftPublishAndBuyReqDto.java
0 → 100644
View file @
459ae0d6
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
();
}
}
}
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/dto/param/GalaxyNftPublishAndBuyRespDto.java
0 → 100644
View file @
459ae0d6
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
();
}
}
}
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/dto/param/GalaxyNftPublishReqDto.java
0 → 100644
View file @
459ae0d6
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
();
}
}
}
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/dto/param/GalaxyNftPublishRespDto.java
0 → 100644
View file @
459ae0d6
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
();
}
}
}
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/dto/vo/mongo/GalaxyNftOrderVo.java
View file @
459ae0d6
...
@@ -32,7 +32,7 @@ public class GalaxyNftOrderVo implements Serializable,Cloneable {
...
@@ -32,7 +32,7 @@ public class GalaxyNftOrderVo implements Serializable,Cloneable {
/**
/**
* 接入方买入唯一标识
* 接入方买入唯一标识
*/
*/
private
String
o
rderPayId
;
private
String
nftO
rderPayId
;
/**
/**
* nftId
* nftId
*/
*/
...
...
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/service/IGalaxyPublishService.java
View file @
459ae0d6
...
@@ -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.GalaxyNft
Buy
ReqDto
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyNft
Publish
ReqDto
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyNft
Buy
RespDto
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyNft
Publish
RespDto
;
/**
/**
* @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
<
GalaxyNft
BuyRespDto
>
nftBuy
(
GalaxyNftBuy
ReqDto
reqDto
);
ResponseDto
<
GalaxyNft
PublishRespDto
>
nftPublish
(
GalaxyNftPublish
ReqDto
reqDto
);
}
}
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/service/IGalaxyTradeService.java
View file @
459ae0d6
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
);
}
}
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/main/java/com/liquidnet/service/galaxy/controller/GalaxyNftTradeController.java
deleted
100644 → 0
View file @
4eb7e81a
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
{
}
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/main/java/com/liquidnet/service/galaxy/controller/GalaxyPublishController.java
View file @
459ae0d6
...
@@ -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.GalaxyNft
Buy
ReqDto
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyNft
Publish
ReqDto
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyNft
Buy
RespDto
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyNft
Publish
RespDto
;
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
=
{
"nft
Buy
"
})
@PostMapping
(
value
=
{
"nft
Publish
"
})
public
ResponseDto
<
GalaxyNft
BuyRespDto
>
nftBuy
(
@Valid
@RequestBody
GalaxyNftBuy
ReqDto
reqDto
){
public
ResponseDto
<
GalaxyNft
PublishRespDto
>
nftPublish
(
@Valid
@RequestBody
GalaxyNftPublish
ReqDto
reqDto
){
return
galaxyPublishService
.
nft
Buy
(
reqDto
);
return
galaxyPublishService
.
nft
Publish
(
reqDto
);
}
}
}
}
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/main/java/com/liquidnet/service/galaxy/controller/GalaxyTradeController.java
0 → 100644
View file @
459ae0d6
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
);
}
}
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/main/java/com/liquidnet/service/galaxy/router/strategy/IGalaxyRouterStrategy.java
View file @
459ae0d6
...
@@ -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
);
}
}
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/main/java/com/liquidnet/service/galaxy/router/strategy/impl/GalaxyRouterStrategyEthImpl.java
View file @
459ae0d6
...
@@ -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
;
...
...
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/main/java/com/liquidnet/service/galaxy/router/strategy/impl/GalaxyRouterStrategyZxlImpl.java
View file @
459ae0d6
...
@@ -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
zxin
Publish
Biz
.
nftBuy
(
reqDto
);
return
zxin
Trade
Biz
.
nftBuy
(
reqDto
);
}
}
}
}
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/main/java/com/liquidnet/service/galaxy/router/zxin/biz/ZxinPublishBiz.java
View file @
459ae0d6
...
@@ -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
(
1000
l
);
}
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
(
100
l
)).
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
(
1000
l
);
}
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
);
}
}
}
}
}
}
}
}
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/main/java/com/liquidnet/service/galaxy/router/zxin/biz/ZxinTradeBiz.java
View file @
459ae0d6
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
(
1000
l
);
}
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
;
}
}
}
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/main/java/com/liquidnet/service/galaxy/service/impl/GalaxyPublishServiceImpl.java
View file @
459ae0d6
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
<
GalaxyNft
BuyRespDto
>
nftBuy
(
GalaxyNftBuy
ReqDto
reqDto
)
{
public
ResponseDto
<
GalaxyNft
PublishRespDto
>
nftPublish
(
GalaxyNftPublish
ReqDto
reqDto
)
{
return
galaxyRouterStrategyContext
.
getStrategy
(
reqDto
.
getRouteType
()).
nft
Buy
(
reqDto
);
return
galaxyRouterStrategyContext
.
getStrategy
(
reqDto
.
getRouteType
()).
nft
Publish
(
reqDto
);
}
}
}
}
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/main/java/com/liquidnet/service/galaxy/service/impl/GalaxyTradeServiceImpl.java
0 → 100644
View file @
459ae0d6
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
);
}
}
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/main/java/com/liquidnet/service/galaxy/utils/DataUtils.java
View file @
459ae0d6
...
@@ -61,9 +61,9 @@ public class DataUtils {
...
@@ -61,9 +61,9 @@ public class DataUtils {
}
}
}
}
public
void
setNftOrderBo
(
String
routeType
,
String
sku
Id
,
GalaxyNftOrderBo
nftOrderBo
)
{
public
void
setNftOrderBo
(
String
routeType
,
String
nftOrderPay
Id
,
GalaxyNftOrderBo
nftOrderBo
)
{
redisUtil
.
set
(
GalaxyConstant
.
REDIS_KET_GALAXY_TRADE
.
concat
(
routeType
).
concat
(
":"
)
+
sku
Id
,
nftOrderBo
,
keyExpireTime
);
redisUtil
.
set
(
GalaxyConstant
.
REDIS_KET_GALAXY_TRADE
.
concat
(
routeType
).
concat
(
":"
)
+
nftOrderPay
Id
,
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
(
"
o
rderPayId"
).
is
(
orderPayId
)),
GalaxyNftOrderVo
.
class
,
GalaxyNftOrderVo
.
class
.
getSimpleName
());
GalaxyNftOrderVo
nftOrderVo
=
mongoTemplate
.
findOne
(
Query
.
query
(
Criteria
.
where
(
"
nftO
rderPayId"
).
is
(
orderPayId
)),
GalaxyNftOrderVo
.
class
,
GalaxyNftOrderVo
.
class
.
getSimpleName
());
if
(
nftOrderVo
==
null
)
{
if
(
nftOrderVo
==
null
)
{
return
null
;
return
null
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment