记得上下班打卡 | 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
7a911d6b
Commit
7a911d6b
authored
Apr 01, 2022
by
anjiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nft修改购买逻辑
parent
eaffc852
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
21 deletions
+41
-21
ConsumerJsonNftPublishAndBuyProcessor.java
...vice/processor/ConsumerJsonNftPublishAndBuyProcessor.java
+41
-21
No files found.
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-kylin/src/main/java/com/liquidnet/service/consumer/kylin/service/processor/ConsumerJsonNftPublishAndBuyProcessor.java
View file @
7a911d6b
...
...
@@ -65,6 +65,9 @@ public class ConsumerJsonNftPublishAndBuyProcessor {
//获取sku信息
GalaxySeriesNftInfoBo
seriesNftInfoBo
=
dataUtils
.
getSeriesNftInfoBo
(
reqDto
.
getRouterType
(),
reqDto
.
getSkuId
());
if
(
StringUtil
.
isNull
(
seriesNftInfoBo
)){
return
ResponseDto
.
failure
(
GalaxyErrorEnum
.
SERIES_NFT_INFO_NOT_EXIST
.
getCode
(),
GalaxyErrorEnum
.
SERIES_NFT_INFO_NOT_EXIST
.
getMessage
());
}
//初始化订单数据
if
(
nftOrderBo
==
null
){
...
...
@@ -179,7 +182,10 @@ public class ConsumerJsonNftPublishAndBuyProcessor {
nftPublishTradeHash
=
nft035RespDtoTemp
.
getData
().
getTxHash
();
}
else
if
(
nft035RespDtoTemp
.
getData
().
getTaskStatus
().
toString
().
equals
(
ZxlnftEnum
.
TaskStatusEnum
.
TASK_FAIL
.
getCode
()))
{
log
.
info
(
"任务执行失败!taskId:{}"
,
nft035ReqDto
.
getTaskId
());
return
null
;
nftPublishStatus
=
nft035RespDtoTemp
.
getData
().
getTaskStatus
();
}
else
if
(
nft035RespDtoTemp
.
getData
().
getTaskStatus
().
toString
().
equals
(
ZxlnftEnum
.
TaskStatusEnum
.
PROCESSING
.
getCode
())){
log
.
info
(
"任务执行中!taskId:{}"
,
nft035ReqDto
.
getTaskId
());
nftPublishStatus
=
nft035RespDtoTemp
.
getData
().
getTaskStatus
();
}
if
(
count
==
5
)
{
...
...
@@ -192,32 +198,38 @@ public class ConsumerJsonNftPublishAndBuyProcessor {
nftId
=
nftIdBegin
;
log
.
info
(
"发行NFT后返回给前端nftID:{}"
,
nftIdBegin
);
log
.
info
(
"总共执行了{}次查询 总耗时:{} MS"
,
count
,
(
System
.
currentTimeMillis
()
-
timeStart
));
}
//更新订单缓存数据状态
nftOrderBo
.
setNftId
(
nftId
);
nftOrderBo
.
setNftPublishTaskId
(
publishTaskId
);
//设置时间
String
nftPublishChainTimestampStr
=
DateUtil
.
format
(
new
Date
(
nftPublishChainTimestamp
*
1000
),
DateUtil
.
Formatter
.
yyyyMMddHHmmss
);
//转换任务状态
String
nftPublishStatusStr
=
GalaxyEnumBiz
.
getTaskStatusEnum
(
reqDto
.
getRouterType
(),
nftPublishStatus
.
toString
()).
getCode
();
nftOrderBo
.
setNftPublishChainTimestamp
(
nftPublishChainTimestampStr
);
nftOrderBo
.
setNftPublishStatus
(
nftPublishStatusStr
);
if
(
StringUtil
.
isNotNull
(
nftPublishChainTimestamp
)){
//设置时间
String
nftPublishChainTimestampStr
=
DateUtil
.
format
(
new
Date
(
nftPublishChainTimestamp
*
1000
),
DateUtil
.
Formatter
.
yyyyMMddHHmmss
);
nftOrderBo
.
setNftPublishChainTimestamp
(
nftPublishChainTimestampStr
);
}
if
(
StringUtil
.
isNotNull
(
nftPublishStatus
)){
//转换任务状态
String
nftPublishStatusStr
=
GalaxyEnumBiz
.
getTaskStatusEnum
(
reqDto
.
getRouterType
(),
nftPublishStatus
.
toString
()).
getCode
();
nftOrderBo
.
setNftPublishStatus
(
nftPublishStatusStr
);
}
nftOrderBo
.
setNftPublishTradeHash
(
nftPublishTradeHash
);
nftOrderBo
.
setUpdatedAt
(
LocalDateTime
.
now
());
//先更新nft发行数据
dataUtils
.
updateNftOrderPublishInfo
(
reqDto
.
getRouterType
(),
reqDto
.
getNftOrderPayId
(),
nftOrderBo
);
if
(
StringUtil
.
isNotEmpty
(
nftId
)){
//执行购买逻辑
GalaxyNftPublishAndBuyRespDto
nftPublishAndBuyRespDto
=
GalaxyNftPublishAndBuyRespDto
.
getNew
();
GalaxyNftBuyRespDto
nftBuyRespDto
=
this
.
nftBuyBusinessSync
(
reqDto
.
getRouterType
(),
nftId
,
userInfoBo
,
seriesNftInfoBo
,
nftOrderBo
);
BeanUtil
.
copy
(
nftBuyRespDto
,
nftPublishAndBuyRespDto
);
return
ResponseDto
.
success
(
nftPublishAndBuyRespDto
);
}
else
{
return
ResponseDto
.
failure
(
GalaxyErrorEnum
.
PUBLISH_FAIL
.
getCode
(),
GalaxyErrorEnum
.
PUBLISH_FAIL
.
getMessage
());
}
return
ResponseDto
.
failure
(
GalaxyErrorEnum
.
PUBLISH_FAIL
.
getCode
(),
GalaxyErrorEnum
.
PUBLISH_FAIL
.
getMessage
());
}
/**
* 保持线程循环查询
* @param nftId
...
...
@@ -275,7 +287,7 @@ public class ConsumerJsonNftPublishAndBuyProcessor {
long
timeStart
=
System
.
currentTimeMillis
();
int
count
=
1
;
int
count
=
0
;
while
(
nftBuyPayTaskId
==
null
){
try
{
Thread
.
sleep
(
1000
l
);
...
...
@@ -283,7 +295,7 @@ public class ConsumerJsonNftPublishAndBuyProcessor {
e
.
printStackTrace
();
}
count
++;
log
.
info
(
"=======执行第{}次查询,taskId:{}"
,
1
,
nft044ReqDto
.
getTaskId
());
log
.
info
(
"=======执行第{}次查询,taskId:{}"
,
count
,
nft044ReqDto
.
getTaskId
());
ZxlnftResponseDto
<
Nft044BuyResultRespDto
>
nft044RespDto
=
zxlnftSdkUtil
.
nft044BuyResult
(
nft044ReqDto
);
if
(
nft044RespDto
.
getData
().
getTaskStatus
().
toString
().
equals
(
ZxlnftEnum
.
TaskStatusEnum
.
TASK_SUCCESS
.
getCode
())){
nftBuyPayTaskId
=
nft044RespDto
.
getData
().
getPayTaskId
();
...
...
@@ -292,11 +304,14 @@ public class ConsumerJsonNftPublishAndBuyProcessor {
nftBuyTradeHash
=
nft044RespDto
.
getData
().
getTxHash
();
}
else
if
(
nft044RespDto
.
getData
().
getTaskStatus
().
toString
().
equals
(
ZxlnftEnum
.
TaskStatusEnum
.
TASK_FAIL
.
getCode
())){
log
.
info
(
"任务执行失败!taskId:{}"
,
nft044ReqDto
.
getTaskId
());
return
null
;
nftBuyStatus
=
nft044RespDto
.
getData
().
getTaskStatus
();
}
else
if
(
nft044RespDto
.
getData
().
getTaskStatus
().
toString
().
equals
(
ZxlnftEnum
.
TaskStatusEnum
.
PROCESSING
.
getCode
())){
log
.
info
(
"任务执行中!taskId:{}"
,
nft044ReqDto
.
getTaskId
());
nftBuyStatus
=
nft044RespDto
.
getData
().
getTaskStatus
();
}
if
(
count
==
6
){
log
.
info
(
"=======查询共
6
次,跳出循环!taskId:{}"
,
nft044ReqDto
.
getTaskId
());
if
(
count
==
5
){
log
.
info
(
"=======查询共
5
次,跳出循环!taskId:{}"
,
nft044ReqDto
.
getTaskId
());
break
;
}
}
...
...
@@ -310,12 +325,17 @@ public class ConsumerJsonNftPublishAndBuyProcessor {
//更新订单缓存数据状态
nftOrderBo
.
setNftBuyTaskId
(
nftBuyTaskId
);
//设置时间
String
nftBuyChainTimestampStr
=
DateUtil
.
format
(
new
Date
(
nftBuyChainTimestamp
*
1000
),
DateUtil
.
Formatter
.
yyyyMMddHHmmss
);
//转换任务状态
String
nftBuyStatusStr
=
GalaxyEnumBiz
.
getTaskStatusEnum
(
routerType
,
nftBuyStatus
.
toString
()).
getCode
();
nftOrderBo
.
setNftBuyChainTimestamp
(
nftBuyChainTimestampStr
);
nftOrderBo
.
setNftBuyStatus
(
nftBuyStatusStr
);
if
(
StringUtil
.
isNotNull
(
nftBuyChainTimestamp
)){
//设置时间
String
nftBuyChainTimestampStr
=
DateUtil
.
format
(
new
Date
(
nftBuyChainTimestamp
*
1000
),
DateUtil
.
Formatter
.
yyyyMMddHHmmss
);
nftOrderBo
.
setNftBuyChainTimestamp
(
nftBuyChainTimestampStr
);
}
if
(
StringUtil
.
isNotNull
(
nftBuyStatus
)){
//转换任务状态
String
nftBuyStatusStr
=
GalaxyEnumBiz
.
getTaskStatusEnum
(
routerType
,
nftBuyStatus
.
toString
()).
getCode
();
nftOrderBo
.
setNftBuyStatus
(
nftBuyStatusStr
);
}
nftOrderBo
.
setNftBuyTradeHash
(
nftBuyTradeHash
);
nftOrderBo
.
setNftBuyPayTaskId
(
nftBuyPayTaskId
);
nftOrderBo
.
setUpdatedAt
(
LocalDateTime
.
now
());
...
...
@@ -325,7 +345,7 @@ public class ConsumerJsonNftPublishAndBuyProcessor {
GalaxyNftBuyRespDto
nftBuyRespDto
=
GalaxyNftBuyRespDto
.
getNew
();
nftBuyRespDto
.
setUserId
(
userInfoBo
.
getUserId
());
nftBuyRespDto
.
setNftId
(
n
ull
);
nftBuyRespDto
.
setNftId
(
n
ftId
);
return
nftBuyRespDto
;
}
}
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