记得上下班打卡 | 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
de83e896
Commit
de83e896
authored
Sep 08, 2022
by
anjiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复xuper购买sql入库数据缺失问题
parent
38d5b5ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
47 deletions
+63
-47
XuperTradeCommonBiz.java
.../service/galaxy/router/xuper/biz/XuperTradeCommonBiz.java
+63
-47
No files found.
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-common/src/main/java/com/liquidnet/service/galaxy/router/xuper/biz/XuperTradeCommonBiz.java
View file @
de83e896
...
@@ -84,6 +84,9 @@ public class XuperTradeCommonBiz {
...
@@ -84,6 +84,9 @@ public class XuperTradeCommonBiz {
return
ResponseDto
.
failure
(
GalaxyErrorEnum
.
SERIES_NFT_INFO_NOT_EXIST
.
getCode
(),
GalaxyErrorEnum
.
SERIES_NFT_INFO_NOT_EXIST
.
getMessage
());
return
ResponseDto
.
failure
(
GalaxyErrorEnum
.
SERIES_NFT_INFO_NOT_EXIST
.
getCode
(),
GalaxyErrorEnum
.
SERIES_NFT_INFO_NOT_EXIST
.
getMessage
());
}
}
//生成nftId
String
nftId
=
this
.
createNftId
(
reqDto
,
seriesNftInfoBo
);
//获取订单信息
//获取订单信息
GalaxyNftOrderBo
nftOrderBo
=
dataUtils
.
getNftOrderBo
(
reqDto
.
getRouterType
(),
reqDto
.
getNftOrderPayId
());
GalaxyNftOrderBo
nftOrderBo
=
dataUtils
.
getNftOrderBo
(
reqDto
.
getRouterType
(),
reqDto
.
getNftOrderPayId
());
//初始化订单数据
//初始化订单数据
...
@@ -92,6 +95,11 @@ public class XuperTradeCommonBiz {
...
@@ -92,6 +95,11 @@ public class XuperTradeCommonBiz {
nftOrderBo
.
setNftPublishTaskId
(
seriesNftInfoBo
.
getSeriesId
());
nftOrderBo
.
setNftPublishTaskId
(
seriesNftInfoBo
.
getSeriesId
());
nftOrderBo
.
setNftPublishFromAddress
(
xuperConfig
.
getNftPlatformAddress
());
nftOrderBo
.
setNftPublishFromAddress
(
xuperConfig
.
getNftPlatformAddress
());
nftOrderBo
.
setNftBuyFromAddress
(
xuperConfig
.
getNftPlatformAddress
());
nftOrderBo
.
setNftBuyFromAddress
(
xuperConfig
.
getNftPlatformAddress
());
//设置购买标志
nftOrderBo
.
setNftId
(
nftId
);
nftOrderBo
.
setNftPublishChainTimestamp
(
seriesNftInfoBo
.
getUpdatedAt
().
toString
());
nftOrderBo
.
setNftPublishTradeHash
(
seriesNftInfoBo
.
getNftPublishTradeHash
());
nftOrderBo
.
setNftPublishStatus
(
seriesNftInfoBo
.
getNftPublishStatus
());
dataUtils
.
setNftOrderBo
(
reqDto
.
getRouterType
(),
reqDto
.
getNftOrderPayId
(),
nftOrderBo
);
dataUtils
.
setNftOrderBo
(
reqDto
.
getRouterType
(),
reqDto
.
getNftOrderPayId
(),
nftOrderBo
);
}
else
if
(
StringUtil
.
isNotNull
(
nftOrderBo
)){
}
else
if
(
StringUtil
.
isNotNull
(
nftOrderBo
)){
if
(
nftOrderBo
.
getNftPublishStatus
().
equalsIgnoreCase
(
GalaxyEnum
.
TaskStatusEnum
.
TASK_SUCCESS
.
getCode
())
if
(
nftOrderBo
.
getNftPublishStatus
().
equalsIgnoreCase
(
GalaxyEnum
.
TaskStatusEnum
.
TASK_SUCCESS
.
getCode
())
...
@@ -116,14 +124,7 @@ public class XuperTradeCommonBiz {
...
@@ -116,14 +124,7 @@ public class XuperTradeCommonBiz {
}
}
}
}
//开始索引
Integer
seriesBeginIndex
=
null
;
/**
* 根据sku获取系列Id
*/
String
seriesId
=
seriesNftInfoBo
.
getSeriesId
();
//返回参数nftId
//返回参数nftId
String
nftId
=
null
;
String
publishTaskId
=
null
;
String
publishTaskId
=
null
;
Long
nftPublishChainTimestamp
=
null
;
Long
nftPublishChainTimestamp
=
null
;
Integer
nftPublishStatus
=
null
;
Integer
nftPublishStatus
=
null
;
...
@@ -135,46 +136,6 @@ public class XuperTradeCommonBiz {
...
@@ -135,46 +136,6 @@ public class XuperTradeCommonBiz {
boolean
isPublishSuccess
=
false
;
boolean
isPublishSuccess
=
false
;
try
{
try
{
/**
* 获取订单和nft绑定信息
*/
GalaxyNftOrderBindBo
nftOrderBindBo
=
dataUtils
.
getGalaxyNftOrderBindBo
(
reqDto
.
getRouterType
(),
reqDto
.
getNftOrderPayId
());
if
(
StringUtil
.
isNull
(
nftOrderBindBo
)){
//获取发行索引
long
nftIdNo
=
dataUtils
.
incrNftIdNo
(
reqDto
.
getRouterType
(),
reqDto
.
getSkuId
());
//如果发行数大于最大发行数量
if
(
nftIdNo
>
seriesNftInfoBo
.
getNftTotalCount
()){
//发行失败
throw
new
GalaxyNftPublishException
(
GalaxyErrorEnum
.
NFT_PUBLISH_ERROR
.
getCode
(),
"该sku:"
+
reqDto
.
getSkuId
()+
" 总共"
+
seriesNftInfoBo
.
getNftTotalCount
()+
"个NFT已经发行完毕,没有剩余库存!"
);
}
//判断是否切换订单
while
(
galaxyTradeBiz
.
isNeedSwitch
(
reqDto
.
getSkuId
(),
String
.
valueOf
(
nftIdNo
))){
long
finalNftIdNo
=
nftIdNo
;
//开启新线程去执行购买
executorService
.
submit
(()
->
{
galaxyTradeBiz
.
switchBuyRouterBySkuId
(
reqDto
.
getSkuId
(),
String
.
valueOf
(
finalNftIdNo
),
seriesNftInfoBo
);
});
nftIdNo
=
dataUtils
.
incrNftIdNo
(
reqDto
.
getRouterType
(),
reqDto
.
getSkuId
());
}
nftOrderBindBo
=
GalaxyNftOrderBindBo
.
getNew
();
nftOrderBindBo
.
setNftOrderPayId
(
reqDto
.
getNftOrderPayId
());
nftOrderBindBo
.
setSeriesId
(
seriesNftInfoBo
.
getSeriesId
());
nftOrderBindBo
.
setSeriesCode
(
seriesNftInfoBo
.
getSeriesCode
());
nftOrderBindBo
.
setNftIdIndex
(
Integer
.
valueOf
(
String
.
valueOf
(
nftIdNo
)));
nftOrderBindBo
.
setRouterType
(
reqDto
.
getRouterType
());
String
nowTimeStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
LocalDateTime
.
now
());
nftOrderBindBo
.
setCreatedAt
(
nowTimeStr
);
dataUtils
.
setGalaxyNftOrderBindBo
(
reqDto
.
getRouterType
(),
reqDto
.
getNftOrderPayId
(),
nftOrderBindBo
);
}
seriesBeginIndex
=
nftOrderBindBo
.
getNftIdIndex
();
//设置nftId
nftId
=
seriesId
.
concat
(
"_"
).
concat
(
seriesBeginIndex
.
toString
());
//设置购买标志
nftOrderBo
.
setNftId
(
nftId
);
/**
/**
* 如果已经发行成功
* 如果已经发行成功
*/
*/
...
@@ -367,6 +328,61 @@ public class XuperTradeCommonBiz {
...
@@ -367,6 +328,61 @@ public class XuperTradeCommonBiz {
return
nftPublishAndBuyRespDto
;
return
nftPublishAndBuyRespDto
;
}
}
/**
* 生成nftId
* @param reqDto
* @param seriesNftInfoBo
* @return
*/
private
String
createNftId
(
GalaxyNftPublishAndBuyReqDto
reqDto
,
GalaxySeriesNftInfoBo
seriesNftInfoBo
){
//开始索引
Integer
seriesBeginIndex
=
null
;
/**
* 根据sku获取系列Id
*/
String
seriesId
=
seriesNftInfoBo
.
getSeriesId
();
//返回参数nftId
String
nftId
=
null
;
/**
* 获取订单和nft绑定信息
*/
GalaxyNftOrderBindBo
nftOrderBindBo
=
dataUtils
.
getGalaxyNftOrderBindBo
(
reqDto
.
getRouterType
(),
reqDto
.
getNftOrderPayId
());
if
(
StringUtil
.
isNull
(
nftOrderBindBo
)){
//获取发行索引
long
nftIdNo
=
dataUtils
.
incrNftIdNo
(
reqDto
.
getRouterType
(),
reqDto
.
getSkuId
());
//如果发行数大于最大发行数量
if
(
nftIdNo
>
seriesNftInfoBo
.
getNftTotalCount
()){
//发行失败
throw
new
GalaxyNftPublishException
(
GalaxyErrorEnum
.
NFT_PUBLISH_ERROR
.
getCode
(),
"该sku:"
+
reqDto
.
getSkuId
()+
" 总共"
+
seriesNftInfoBo
.
getNftTotalCount
()+
"个NFT已经发行完毕,没有剩余库存!"
);
}
//判断是否切换订单
while
(
galaxyTradeBiz
.
isNeedSwitch
(
reqDto
.
getSkuId
(),
String
.
valueOf
(
nftIdNo
))){
long
finalNftIdNo
=
nftIdNo
;
//开启新线程去执行购买
executorService
.
submit
(()
->
{
galaxyTradeBiz
.
switchBuyRouterBySkuId
(
reqDto
.
getSkuId
(),
String
.
valueOf
(
finalNftIdNo
),
seriesNftInfoBo
);
});
nftIdNo
=
dataUtils
.
incrNftIdNo
(
reqDto
.
getRouterType
(),
reqDto
.
getSkuId
());
}
nftOrderBindBo
=
GalaxyNftOrderBindBo
.
getNew
();
nftOrderBindBo
.
setNftOrderPayId
(
reqDto
.
getNftOrderPayId
());
nftOrderBindBo
.
setSeriesId
(
seriesNftInfoBo
.
getSeriesId
());
nftOrderBindBo
.
setSeriesCode
(
seriesNftInfoBo
.
getSeriesCode
());
nftOrderBindBo
.
setNftIdIndex
(
Integer
.
valueOf
(
String
.
valueOf
(
nftIdNo
)));
nftOrderBindBo
.
setRouterType
(
reqDto
.
getRouterType
());
String
nowTimeStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
LocalDateTime
.
now
());
nftOrderBindBo
.
setCreatedAt
(
nowTimeStr
);
dataUtils
.
setGalaxyNftOrderBindBo
(
reqDto
.
getRouterType
(),
reqDto
.
getNftOrderPayId
(),
nftOrderBindBo
);
}
seriesBeginIndex
=
nftOrderBindBo
.
getNftIdIndex
();
//设置nftId
nftId
=
seriesId
.
concat
(
"_"
).
concat
(
seriesBeginIndex
.
toString
());
return
nftId
;
}
/**
/**
* 保持线程循环查询
* 保持线程循环查询
* @param nftId
* @param nftId
...
...
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