记得上下班打卡 | 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
0481d33d
Commit
0481d33d
authored
Mar 24, 2022
by
anjiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化相关策略实现
parent
045129cf
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
151 additions
and
9 deletions
+151
-9
GalaxyNftOrderBo.java
...com/liquidnet/service/galaxy/dto/bo/GalaxyNftOrderBo.java
+8
-1
GalaxyNftBuyPayResultQueryRespDto.java
...e/galaxy/dto/param/GalaxyNftBuyPayResultQueryRespDto.java
+1
-1
GalaxyNftBuyResultQueryRespDto.java
...vice/galaxy/dto/param/GalaxyNftBuyResultQueryRespDto.java
+1
-1
GalaxyNftOrderVo.java
...quidnet/service/galaxy/dto/vo/mongo/GalaxyNftOrderVo.java
+17
-0
ZxinTradeBiz.java
...iquidnet/service/galaxy/router/zxin/biz/ZxinTradeBiz.java
+122
-4
GalaxyRouterStrategyZxlTradeImpl.java
...router/zxin/service/GalaxyRouterStrategyZxlTradeImpl.java
+2
-2
No files found.
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/dto/bo/GalaxyNftOrderBo.java
View file @
0481d33d
...
@@ -58,9 +58,16 @@ public class GalaxyNftOrderBo implements Serializable,Cloneable {
...
@@ -58,9 +58,16 @@ public class GalaxyNftOrderBo implements Serializable,Cloneable {
private
String
nftPublishTaskId
;
private
String
nftPublishTaskId
;
/**
/**
* nft购买
* nft购买
任务id
* @return
* @return
*/
*/
private
String
nftBuyTaskId
;
/**
* nft购买支付任务ID
* @return
*/
private
String
nftBuyPayTaskId
;
@Override
@Override
public
String
toString
(){
public
String
toString
(){
...
...
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/dto/param/GalaxyNftBuyPayResultQueryRespDto.java
View file @
0481d33d
...
@@ -42,7 +42,7 @@ public class GalaxyNftBuyPayResultQueryRespDto implements Serializable,Cloneable
...
@@ -42,7 +42,7 @@ public class GalaxyNftBuyPayResultQueryRespDto implements Serializable,Cloneable
* 链上交易时间戳
* 链上交易时间戳
*/
*/
@ApiModelProperty
(
position
=
3
,
required
=
true
,
value
=
"chainTimestamp"
)
@ApiModelProperty
(
position
=
3
,
required
=
true
,
value
=
"chainTimestamp"
)
private
Lo
ng
chainTimestamp
;
private
Stri
ng
chainTimestamp
;
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
...
...
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/dto/param/GalaxyNftBuyResultQueryRespDto.java
View file @
0481d33d
...
@@ -39,7 +39,7 @@ public class GalaxyNftBuyResultQueryRespDto implements Serializable,Cloneable {
...
@@ -39,7 +39,7 @@ public class GalaxyNftBuyResultQueryRespDto implements Serializable,Cloneable {
* 链上交易时间戳
* 链上交易时间戳
*/
*/
@ApiModelProperty
(
position
=
3
,
required
=
true
,
value
=
"chainTimestamp"
)
@ApiModelProperty
(
position
=
3
,
required
=
true
,
value
=
"chainTimestamp"
)
private
Lo
ng
chainTimestamp
;
private
Stri
ng
chainTimestamp
;
@ApiModelProperty
(
position
=
3
,
required
=
true
,
value
=
"支付任务ID"
)
@ApiModelProperty
(
position
=
3
,
required
=
true
,
value
=
"支付任务ID"
)
private
String
payTaskId
;
private
String
payTaskId
;
...
...
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/dto/vo/mongo/GalaxyNftOrderVo.java
View file @
0481d33d
...
@@ -52,6 +52,23 @@ public class GalaxyNftOrderVo implements Serializable,Cloneable {
...
@@ -52,6 +52,23 @@ public class GalaxyNftOrderVo implements Serializable,Cloneable {
*/
*/
private
String
toAddress
;
private
String
toAddress
;
/**
* nft发行任务ID
*/
private
String
nftPublishTaskId
;
/**
* nft购买任务id
* @return
*/
private
String
nftBuyTaskId
;
/**
* nft购买支付任务ID
* @return
*/
private
String
nftBuyPayTaskId
;
/**
/**
* 创建时间
* 创建时间
*/
*/
...
...
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/main/java/com/liquidnet/service/galaxy/router/zxin/biz/ZxinTradeBiz.java
View file @
0481d33d
...
@@ -7,6 +7,7 @@ import com.liquidnet.common.third.zxlnft.dto.*;
...
@@ -7,6 +7,7 @@ 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.BeanUtil
;
import
com.liquidnet.commons.lang.util.DateUtil
;
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
;
...
@@ -14,16 +15,15 @@ import com.liquidnet.service.galaxy.constant.GalaxyErrorEnum;
...
@@ -14,16 +15,15 @@ import com.liquidnet.service.galaxy.constant.GalaxyErrorEnum;
import
com.liquidnet.service.galaxy.dto.bo.GalaxyNftOrderBo
;
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.router.strategy.biz.GalaxyEnumBiz
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyNftPublishAndBuyReqDto
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyNftPublishAndBuyRespDto
;
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
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @author AnJiabin <anjiabin@zhengzai.tv>
...
@@ -216,6 +216,49 @@ public class ZxinTradeBiz {
...
@@ -216,6 +216,49 @@ public class ZxinTradeBiz {
}
}
}
}
public
ResponseDto
<
GalaxyNftBuyResultQueryRespDto
>
nftBuyResultQuery
(
GalaxyNftBuyResultQueryReqDto
reqDto
)
{
//获取订单信息
GalaxyNftOrderBo
nftOrderBo
=
dataUtils
.
getNftOrderBo
(
reqDto
.
getRouterType
(),
reqDto
.
getNftOrderPayId
());
if
(
StringUtil
.
isNull
(
nftOrderBo
)){
return
ResponseDto
.
failure
(
GalaxyErrorEnum
.
PUBLISH_ORDER_NOT_EXIST
.
getCode
(),
GalaxyErrorEnum
.
PUBLISH_ORDER_NOT_EXIST
.
getMessage
());
}
//3.2.4查询NFT购买结果
Nft044BuyResultReqDto
nft044ReqDto
=
Nft044BuyResultReqDto
.
getNew
();
nft044ReqDto
.
setTaskId
(
nftOrderBo
.
getNftBuyTaskId
());
ZxlnftResponseDto
<
Nft044BuyResultRespDto
>
nft044RespDto
=
zxlnftSdkUtil
.
nft044BuyResult
(
nft044ReqDto
);
GalaxyNftBuyResultQueryRespDto
resultQueryRespDto
=
GalaxyNftBuyResultQueryRespDto
.
getNew
();
BeanUtil
.
copy
(
nft044RespDto
.
getData
(),
resultQueryRespDto
);
String
nowTimeStr
=
DateUtil
.
format
(
new
Date
(
nft044RespDto
.
getData
().
getChainTimestamp
().
longValue
()*
1000
),
DateUtil
.
Formatter
.
yyyyMMddHHmmss
);
//转换任务状态
Integer
taskStatus
=
Integer
.
valueOf
(
GalaxyEnumBiz
.
getTaskStatusEnum
(
reqDto
.
getRouterType
(),
nft044RespDto
.
getData
().
getTaskStatus
().
toString
()).
getCode
());
resultQueryRespDto
.
setTaskStatus
(
taskStatus
);
resultQueryRespDto
.
setChainTimestamp
(
nowTimeStr
);
return
ResponseDto
.
success
(
resultQueryRespDto
);
}
public
ResponseDto
<
GalaxyNftBuyPayResultQueryRespDto
>
nftBuyPayResultQuery
(
GalaxyNftBuyPayResultQueryReqDto
reqDto
)
{
//获取订单信息
GalaxyNftOrderBo
nftOrderBo
=
dataUtils
.
getNftOrderBo
(
reqDto
.
getRouterType
(),
reqDto
.
getNftOrderPayId
());
if
(
StringUtil
.
isNull
(
nftOrderBo
)){
return
ResponseDto
.
failure
(
GalaxyErrorEnum
.
PUBLISH_ORDER_NOT_EXIST
.
getCode
(),
GalaxyErrorEnum
.
PUBLISH_ORDER_NOT_EXIST
.
getMessage
());
}
//3.2.5查询NFT购买支付结果
Nft045BuyPayResultReqDto
nft045ReqDto
=
Nft045BuyPayResultReqDto
.
getNew
();
nft045ReqDto
.
setTaskId
(
nftOrderBo
.
getNftBuyPayTaskId
());
ZxlnftResponseDto
<
Nft045BuyPayResultRespDto
>
nft045RespDto
=
zxlnftSdkUtil
.
nft045BuyPayResult
(
nft045ReqDto
);
GalaxyNftBuyPayResultQueryRespDto
resultQueryRespDto
=
GalaxyNftBuyPayResultQueryRespDto
.
getNew
();
BeanUtil
.
copy
(
nft045RespDto
.
getData
(),
resultQueryRespDto
);
String
nowTimeStr
=
DateUtil
.
format
(
new
Date
(
nft045RespDto
.
getData
().
getChainTimestamp
().
longValue
()*
1000
),
DateUtil
.
Formatter
.
yyyyMMddHHmmss
);
//转换任务状态
Integer
taskStatus
=
Integer
.
valueOf
(
GalaxyEnumBiz
.
getTaskStatusEnum
(
reqDto
.
getRouterType
(),
nft045RespDto
.
getData
().
getTaskStatus
().
toString
()).
getCode
());
resultQueryRespDto
.
setTaskStatus
(
taskStatus
);
resultQueryRespDto
.
setChainTimestamp
(
nowTimeStr
);
return
ResponseDto
.
success
(
resultQueryRespDto
);
}
private
GalaxyNftBuyRespDto
nftBuyBusiness
(
String
nftId
,
GalaxyUserInfoBo
userInfoBo
,
GalaxySeriesInfoBo
seriesInfoBo
){
private
GalaxyNftBuyRespDto
nftBuyBusiness
(
String
nftId
,
GalaxyUserInfoBo
userInfoBo
,
GalaxySeriesInfoBo
seriesInfoBo
){
// 3.2.2调用购买NFT接口
// 3.2.2调用购买NFT接口
...
@@ -284,4 +327,79 @@ public class ZxinTradeBiz {
...
@@ -284,4 +327,79 @@ public class ZxinTradeBiz {
}
}
return
null
;
return
null
;
}
}
/**
* 保持线程循环查询
* @param nftId
* @param userInfoBo
* @param seriesInfoBo
* @return
*/
private
GalaxyNftBuyRespDto
nftBuyBusinessBackup
(
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/router/zxin/service/GalaxyRouterStrategyZxlTradeImpl.java
View file @
0481d33d
...
@@ -33,12 +33,12 @@ public class GalaxyRouterStrategyZxlTradeImpl implements IGalaxyRouterStrategyTr
...
@@ -33,12 +33,12 @@ public class GalaxyRouterStrategyZxlTradeImpl implements IGalaxyRouterStrategyTr
@Override
@Override
public
ResponseDto
<
GalaxyNftBuyResultQueryRespDto
>
nftBuyResultQuery
(
GalaxyNftBuyResultQueryReqDto
reqDto
)
{
public
ResponseDto
<
GalaxyNftBuyResultQueryRespDto
>
nftBuyResultQuery
(
GalaxyNftBuyResultQueryReqDto
reqDto
)
{
return
null
;
return
zxinTradeBiz
.
nftBuyResultQuery
(
reqDto
)
;
}
}
@Override
@Override
public
ResponseDto
<
GalaxyNftBuyPayResultQueryRespDto
>
nftBuyPayResultQuery
(
GalaxyNftBuyPayResultQueryReqDto
reqDto
)
{
public
ResponseDto
<
GalaxyNftBuyPayResultQueryRespDto
>
nftBuyPayResultQuery
(
GalaxyNftBuyPayResultQueryReqDto
reqDto
)
{
return
null
;
return
zxinTradeBiz
.
nftBuyPayResultQuery
(
reqDto
)
;
}
}
@Override
@Override
...
...
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