记得上下班打卡 | 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
c7fb31ff
Commit
c7fb31ff
authored
Mar 31, 2022
by
anjiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nft修改购买逻辑
parent
6eda986e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
22 deletions
+43
-22
GalaxyConstant.java
...com/liquidnet/service/galaxy/constant/GalaxyConstant.java
+1
-1
GalaxyEnum.java
...ava/com/liquidnet/service/galaxy/constant/GalaxyEnum.java
+1
-0
ZxinTradeBiz.java
...iquidnet/service/galaxy/router/zxin/biz/ZxinTradeBiz.java
+32
-11
DataUtils.java
...in/java/com/liquidnet/service/galaxy/utils/DataUtils.java
+7
-8
sqlmap.properties
...-service-galaxy-impl/src/main/resources/sqlmap.properties
+2
-2
No files found.
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/constant/GalaxyConstant.java
View file @
c7fb31ff
...
...
@@ -14,7 +14,7 @@ public class GalaxyConstant {
public
static
final
String
REDIS_KEY_GALAXY_SERIES
=
"galaxy:series:"
;
public
static
final
String
REDIS_KEY_GALAXY_SERIES_NFT_UPLOAD
=
"galaxy:series:nft:upload:"
;
public
static
final
String
REDIS_KEY_GALAXY_SERIES_NFT
=
"galaxy:series:nft:"
;
public
static
final
String
REDIS_KEY_GALAXY_TRADE
=
"galaxy:trade:order:"
;
public
static
final
String
REDIS_KEY_GALAXY_TRADE
_ORDER
=
"galaxy:trade:order:"
;
public
static
final
String
REDIS_KEY_GALAXY_PUBLISH_NFT
=
"galaxy:publish:nft:"
;
public
static
final
String
REDIS_KEY_GALAXY_PUBLISH_ORDER
=
"galaxy:publish:order:"
;
...
...
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/constant/GalaxyEnum.java
View file @
c7fb31ff
...
...
@@ -152,6 +152,7 @@ public class GalaxyEnum {
* 标记任务状态
*/
public
enum
TaskStatusEnum
{
INIT
(
"-1"
,
"数据初始化"
),
PROCESSING
(
"0"
,
"任务执行中"
),
TASK_SUCCESS
(
"1"
,
"任务成功"
),
TASK_FAIL
(
"2"
,
"任务失败"
);
...
...
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/main/java/com/liquidnet/service/galaxy/router/zxin/biz/ZxinTradeBiz.java
View file @
c7fb31ff
...
...
@@ -8,6 +8,7 @@ import com.liquidnet.common.third.zxlnft.dto.*;
import
com.liquidnet.common.third.zxlnft.util.ZxlnftSdkUtil
;
import
com.liquidnet.commons.lang.util.*
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.galaxy.constant.GalaxyEnum
;
import
com.liquidnet.service.galaxy.constant.GalaxyErrorEnum
;
import
com.liquidnet.service.galaxy.dto.bo.GalaxyNftOrderBindBo
;
import
com.liquidnet.service.galaxy.dto.bo.GalaxyNftOrderBo
;
...
...
@@ -53,6 +54,9 @@ public class ZxinTradeBiz {
@Autowired
private
ZxinCommonBiz
zxinCommonBiz
;
@Autowired
private
ZxinPublishBiz
zxinPublishBiz
;
public
ResponseDto
<
GalaxyNftBuyRespDto
>
nftBuy
(
GalaxyNftBuyReqDto
nftBuyReqDto
){
//获取订单信息
GalaxyNftOrderBo
nftOrderBo
=
dataUtils
.
getNftOrderBo
(
nftBuyReqDto
.
getRouterType
(),
nftBuyReqDto
.
getNftOrderPayId
());
...
...
@@ -307,22 +311,38 @@ public class ZxinTradeBiz {
return
ResponseDto
.
failure
(
GalaxyErrorEnum
.
PUBLISH_ORDER_NOT_EXIST
.
getCode
(),
GalaxyErrorEnum
.
PUBLISH_ORDER_NOT_EXIST
.
getMessage
());
}
/**
* TODO 查询订单相关信息
*/
GalaxyNftPublishAndBuyResultQueryRespDto
resultQueryRespDto
=
GalaxyNftPublishAndBuyResultQueryRespDto
.
getNew
();
GalaxyNftOrderBo
galaxyNftOrderBo
=
dataUtils
.
getNftOrderBo
(
reqDto
.
getRouterType
(),
reqDto
.
getNftOrderPayId
());
/**
* TODO 如果订单信息是购买失败,则直接调用至信链查询购买结果
*/
if
(
StringUtil
.
isNull
(
galaxyNftOrderBo
)){
//3.2.5查询NFT购买支付结果
Nft044BuyResultReqDto
nft044ReqDto
=
Nft044BuyResultReqDto
.
getNew
();
nft044ReqDto
.
setTaskId
(
nftOrderBo
.
getNftBuyTaskId
());
ZxlnftResponseDto
<
Nft044BuyResultRespDto
>
nft044RespDto
=
zxlnftSdkUtil
.
nft044BuyResult
(
nft044ReqDto
);
if
(
StringUtil
.
isNotEmpty
(
nftOrderBo
.
getNftPublishStatus
())
&&
(
GalaxyEnum
.
TaskStatusEnum
.
INIT
.
getCode
().
equalsIgnoreCase
(
nftOrderBo
.
getNftPublishStatus
())
||
GalaxyEnum
.
TaskStatusEnum
.
PROCESSING
.
getCode
().
equalsIgnoreCase
(
nftOrderBo
.
getNftPublishStatus
()))){
//执行nft发行结果查询
GalaxyNftPublishResultQueryReqDto
nftPublishResultQueryReqDto
=
GalaxyNftPublishResultQueryReqDto
.
getNew
();
nftPublishResultQueryReqDto
.
setNftOrderPayId
(
reqDto
.
getNftOrderPayId
());
nftPublishResultQueryReqDto
.
setRouterType
(
reqDto
.
getRouterType
());
ResponseDto
<
GalaxyNftPublishResultQueryRespDto
>
publishResultQueryRespDto
=
zxinPublishBiz
.
nftPublishResultQuery
(
nftPublishResultQueryReqDto
);
if
(
publishResultQueryRespDto
.
isSuccess
()){
GalaxyNftPublishResultQueryRespDto
nftPublishResultQueryRespDtoTemp
=
publishResultQueryRespDto
.
getData
();
BeanUtil
.
copy
(
nftPublishResultQueryRespDtoTemp
,
nftOrderBo
);
}
}
if
(
StringUtil
.
isNotEmpty
(
nftOrderBo
.
getNftBuyStatus
())
&&
(
GalaxyEnum
.
TaskStatusEnum
.
INIT
.
getCode
().
equalsIgnoreCase
(
nftOrderBo
.
getNftBuyStatus
())
||
GalaxyEnum
.
TaskStatusEnum
.
PROCESSING
.
getCode
().
equalsIgnoreCase
(
nftOrderBo
.
getNftBuyStatus
()))){
//执行nft购买结果查询
GalaxyNftBuyResultQueryReqDto
nftBuyResultQueryReqDto
=
GalaxyNftBuyResultQueryReqDto
.
getNew
();
nftBuyResultQueryReqDto
.
setNftOrderPayId
(
reqDto
.
getNftOrderPayId
());
nftBuyResultQueryReqDto
.
setRouterType
(
reqDto
.
getRouterType
());
ResponseDto
<
GalaxyNftBuyResultQueryRespDto
>
buyResultQueryRespDto
=
this
.
nftBuyResultQuery
(
nftBuyResultQueryReqDto
);
if
(
buyResultQueryRespDto
.
isSuccess
()){
GalaxyNftBuyResultQueryRespDto
nftBuyResultQueryRespDtoTemp
=
buyResultQueryRespDto
.
getData
();
BeanUtil
.
copy
(
nftBuyResultQueryRespDtoTemp
,
nftOrderBo
);
}
}
BeanUtil
.
copy
(
galaxyNftOrderBo
,
resultQueryRespDto
);
GalaxyNftPublishAndBuyResultQueryRespDto
resultQueryRespDto
=
GalaxyNftPublishAndBuyResultQueryRespDto
.
getNew
();
BeanUtil
.
copy
(
nftOrderBo
,
resultQueryRespDto
);
return
ResponseDto
.
success
(
resultQueryRespDto
);
}
...
...
@@ -501,6 +521,7 @@ public class ZxinTradeBiz {
nftOrderBo
.
setNftBuyChainTimestamp
(
nftBuyChainTimestampStr
);
nftOrderBo
.
setNftBuyStatus
(
nftBuyStatusStr
);
nftOrderBo
.
setNftBuyTradeHash
(
nftBuyTradeHash
);
nftOrderBo
.
setNftBuyPayTaskId
(
nftBuyPayTaskId
);
nftOrderBo
.
setUpdatedAt
(
LocalDateTime
.
now
());
//先更新nft发行数据
dataUtils
.
updateNftOrderBuyInfo
(
routerType
,
nftOrderBo
.
getNftOrderPayId
(),
nftOrderBo
);
...
...
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/main/java/com/liquidnet/service/galaxy/utils/DataUtils.java
View file @
c7fb31ff
...
...
@@ -289,7 +289,7 @@ public class DataUtils {
public
void
setNftOrderBo
(
String
routerType
,
String
nftOrderPayId
,
GalaxyNftOrderBo
nftOrderBo
)
{
redisUtil
.
set
(
GalaxyConstant
.
REDIS_KEY_GALAXY_TRADE
.
concat
(
routerType
).
concat
(
":"
)
+
nftOrderPayId
,
nftOrderBo
,
keyExpireTime
);
redisUtil
.
set
(
GalaxyConstant
.
REDIS_KEY_GALAXY_TRADE
_ORDER
.
concat
(
routerType
).
concat
(
":"
)
+
nftOrderPayId
,
nftOrderBo
,
keyExpireTime
);
/**
* 入库mongo
*/
...
...
@@ -330,7 +330,7 @@ public class DataUtils {
}
public
GalaxyNftOrderBo
getNftOrderBo
(
String
routerType
,
String
nftOrderPayId
)
{
Object
obj
=
redisUtil
.
get
(
GalaxyConstant
.
REDIS_KEY_GALAXY_TRADE
.
concat
(
routerType
).
concat
(
":"
)
+
nftOrderPayId
);
Object
obj
=
redisUtil
.
get
(
GalaxyConstant
.
REDIS_KEY_GALAXY_TRADE
_ORDER
.
concat
(
routerType
).
concat
(
":"
)
+
nftOrderPayId
);
if
(
obj
!=
null
){
return
(
GalaxyNftOrderBo
)
obj
;
}
else
{
...
...
@@ -340,7 +340,7 @@ public class DataUtils {
}
GalaxyNftOrderBo
nftOrderBo
=
GalaxyNftOrderBo
.
getNew
();
BeanUtil
.
copy
(
nftOrderVo
,
nftOrderBo
);
redisUtil
.
set
(
GalaxyConstant
.
REDIS_KEY_GALAXY_TRADE
.
concat
(
routerType
).
concat
(
":"
)
+
nftOrderPayId
,
nftOrderBo
);
redisUtil
.
set
(
GalaxyConstant
.
REDIS_KEY_GALAXY_TRADE
_ORDER
.
concat
(
routerType
).
concat
(
":"
)
+
nftOrderPayId
,
nftOrderBo
);
return
nftOrderBo
;
}
}
...
...
@@ -352,11 +352,10 @@ public class DataUtils {
* @param nftOrderBo
*/
public
void
updateNftOrderPublishInfo
(
String
routerType
,
String
nftOrderPayId
,
GalaxyNftOrderBo
nftOrderBo
)
{
redisUtil
.
set
(
GalaxyConstant
.
REDIS_KEY_GALAXY_TRADE
.
concat
(
routerType
).
concat
(
":"
)
+
nftOrderPayId
,
nftOrderBo
,
keyExpireTime
);
redisUtil
.
set
(
GalaxyConstant
.
REDIS_KEY_GALAXY_TRADE
_ORDER
.
concat
(
routerType
).
concat
(
":"
)
+
nftOrderPayId
,
nftOrderBo
,
keyExpireTime
);
Query
query
=
Query
.
query
(
Criteria
.
where
(
"nftOrderPayId"
).
is
(
nftOrderBo
.
getNftOrderPayId
()));
Update
update
=
Update
.
fromDocument
(
Document
.
parse
(
JsonUtils
.
toJson
(
nftOrderBo
)));
update
.
set
(
"nftId"
,
nftOrderBo
.
getNftId
());
String
nowTimeStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
nftOrderBo
.
getUpdatedAt
());
update
.
set
(
"updatedAt"
,
nowTimeStr
);
UpdateResult
result
=
mongoTemplate
.
updateFirst
(
query
,
update
,
GalaxyNftOrderVo
.
class
,
GalaxyNftOrderVo
.
class
.
getSimpleName
());
...
...
@@ -364,7 +363,7 @@ public class DataUtils {
try
{
queueUtil
.
sendMySqlRedis
(
SqlMapping
.
get
(
"galaxy_nft_order_info.updateNft
Id
"
),
SqlMapping
.
get
(
"galaxy_nft_order_info.updateNft
PublishInfo
"
),
new
Object
[]{
nftOrderBo
.
getNftId
(),
LocalDateTime
.
now
(),
nftOrderBo
.
getNftOrderPayId
()}
,
MQConst
.
GalaxyQueue
.
SQL_NFT_TRADE_INFO
.
getKey
()
);
...
...
@@ -381,7 +380,7 @@ public class DataUtils {
* @param nftOrderBo
*/
public
void
updateNftOrderBuyInfo
(
String
routerType
,
String
nftOrderPayId
,
GalaxyNftOrderBo
nftOrderBo
)
{
redisUtil
.
set
(
GalaxyConstant
.
REDIS_KEY_GALAXY_TRADE
.
concat
(
routerType
).
concat
(
":"
)
+
nftOrderPayId
,
nftOrderBo
,
keyExpireTime
);
redisUtil
.
set
(
GalaxyConstant
.
REDIS_KEY_GALAXY_TRADE
_ORDER
.
concat
(
routerType
).
concat
(
":"
)
+
nftOrderPayId
,
nftOrderBo
,
keyExpireTime
);
Query
query
=
Query
.
query
(
Criteria
.
where
(
"nftOrderPayId"
).
is
(
nftOrderPayId
));
Update
update
=
Update
.
fromDocument
(
Document
.
parse
(
JsonUtils
.
toJson
(
nftOrderBo
)));
...
...
@@ -392,7 +391,7 @@ public class DataUtils {
try
{
queueUtil
.
sendMySqlRedis
(
SqlMapping
.
get
(
"galaxy_nft_order_info.updateNftBuy
TaskId
"
),
SqlMapping
.
get
(
"galaxy_nft_order_info.updateNftBuy
Info
"
),
new
Object
[]{
nftOrderBo
.
getNftBuyTaskId
(),
LocalDateTime
.
now
(),
nftOrderBo
.
getNftOrderPayId
()}
,
MQConst
.
GalaxyQueue
.
SQL_NFT_TRADE_INFO
.
getKey
()
);
...
...
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/main/resources/sqlmap.properties
View file @
c7fb31ff
...
...
@@ -14,9 +14,9 @@ galaxy_series_info.updateSeriesIdAndStatus=update galaxy_series_info t set t.ser
galaxy_series_nft_info.updateSeriesIdAndStatus
=
update galaxy_series_nft_info t set t.series_id = ?,t.updated_at =? where t.sku_id = ?
galaxy_nft_order_info.updateNft
Id
=
update galaxy_nft_order_info t set t.nft_id = ?
,t.updated_at =? where t.nft_order_pay_id = ?
galaxy_nft_order_info.updateNft
PublishInfo
=
update galaxy_nft_order_info t set t.nft_id = ? ,t.nft_publish_task_id = ?,t.nft_publish_chain_timestamp = ?,t.nft_publish_status = ?,t.nft_publish_trade_hash = ?
,t.updated_at =? where t.nft_order_pay_id = ?
galaxy_nft_order_info.updateNftBuy
TaskId
=
update galaxy_nft_order_info t set t.nft_bu
y_task_id = ? ,t.updated_at =? where t.nft_order_pay_id = ?
galaxy_nft_order_info.updateNftBuy
Info
=
update galaxy_nft_order_info t set t.nft_buy_task_id = ? ,t.nft_buy_chain_timestamp = ? ,t.nft_buy_status = ? ,t.nft_buy_trade_hash = ? ,t.nft_buy_pa
y_task_id = ? ,t.updated_at =? where t.nft_order_pay_id = ?
#更新已发行个数
galaxy_series_info.updateSeriesCrtCount
=
update galaxy_series_info t set t.crt_count = ?,t.updated_at =? where t.series_code = ?
...
...
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