记得上下班打卡 | 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
cbc252a7
Commit
cbc252a7
authored
Jun 13, 2022
by
zhanggb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
~que:GoblinQueue.BIZ_ARTWORK_CLQ:重新入队调整;
parent
3b4771c8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
41 deletions
+51
-41
ConsumerGoblinBizArtworkClqReceiver.java
...er/base/receiver/ConsumerGoblinBizArtworkClqReceiver.java
+6
-5
GoblinQueBizArtworkClqService.java
...lin/service/impl/inner/GoblinQueBizArtworkClqService.java
+45
-35
GoblinQueBizArtworkUplService.java
...lin/service/impl/inner/GoblinQueBizArtworkUplService.java
+0
-1
No files found.
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-base/src/main/java/com/liquidnet/service/consumer/base/receiver/ConsumerGoblinBizArtworkClqReceiver.java
View file @
cbc252a7
...
...
@@ -74,11 +74,12 @@ public class ConsumerGoblinBizArtworkClqReceiver extends AbstractBizRedisReceive
try
{
postDataMap
.
add
(
"skuId"
,
skuId
);
String
postRespStr
=
HttpUtil
.
post
(
postUrl
,
postDataMap
);
JsonNode
postRespJNode
=
JsonUtils
.
fromJson
(
postRespStr
,
JsonNode
.
class
),
postRespCode
;
if
(
null
==
postRespJNode
||
null
==
(
postRespCode
=
postRespJNode
.
get
(
"code"
))
||
!
postRespCode
.
asText
().
equals
(
"0"
))
{
log
.
warn
(
"#NFT声明查询:处理失败[paramsStr={},postRespStr={}]"
,
postDataMap
,
postRespStr
);
return
false
;
}
// 失败重新入队逻辑改至`被调用API`实现
// JsonNode postRespJNode = JsonUtils.fromJson(postRespStr, JsonNode.class), postRespCode;
// if (null == postRespJNode || null == (postRespCode = postRespJNode.get("code")) || !postRespCode.asText().equals("0")) {
// log.warn("#NFT声明查询:处理失败[paramsStr={},postRespStr={}]", postDataMap, postRespStr);
// return false;
// }
return
true
;
}
catch
(
Exception
e
)
{
log
.
error
(
"Ex.NFT声明查询:处理异常[url={},paramsStr={}],ex:{}"
,
postUrl
,
postDataMap
,
e
.
getMessage
());
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/inner/GoblinQueBizArtworkClqService.java
View file @
cbc252a7
...
...
@@ -12,6 +12,7 @@ import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import
com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo
;
import
com.liquidnet.service.goblin.util.GoblinMongoUtils
;
import
com.liquidnet.service.goblin.util.GoblinRedisUtils
;
import
com.liquidnet.service.goblin.util.QueueUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -31,6 +32,8 @@ import java.util.LinkedList;
@Slf4j
@Service
public
class
GoblinQueBizArtworkClqService
{
@Autowired
QueueUtils
queueUtils
;
@Autowired
GoblinRedisUtils
goblinRedisUtils
;
@Autowired
...
...
@@ -46,46 +49,53 @@ public class GoblinQueBizArtworkClqService {
private
static
final
String
SQL_UPDATE_GOODS_SKU_NFT
=
"UPDATE goblin_goods_sku_nft SET upchain=?,series_id=?,series_hash=?,nft_hash=?,declare_at=?,updated_at=? WHERE sku_id=? "
;
public
ResponseDto
<
String
>
bizArtworkClqProcessing
(
String
skuId
)
{
GoblinGoodsSkuInfoVo
mgtGoodsSkuInfoVo
=
goblinMongoUtils
.
getGoodsSkuInfoVo
(
skuId
);
if
(
null
==
mgtGoodsSkuInfoVo
)
{
log
.
warn
(
"#NFT声明查询:藏品SKU不存在[skuId={}]"
,
skuId
);
return
ResponseDto
.
success
(
String
.
format
(
"藏品SKU不存在[skuId:%s]"
,
skuId
));
}
int
skuType
=
mgtGoodsSkuInfoVo
.
getSkuType
(),
upchain
=
mgtGoodsSkuInfoVo
.
getUpchain
();
String
unbox
=
mgtGoodsSkuInfoVo
.
getUnbox
();
// 非数字藏品 || 盲盒 || 非声明中 || 已有声明系列ID
if
(
1
!=
skuType
||
!
"0"
.
equals
(
unbox
)
||
9
!=
upchain
||
StringUtils
.
isNotEmpty
(
mgtGoodsSkuInfoVo
.
getSeriesId
()))
{
log
.
warn
(
"#NFT声明查询:藏品SKU无效或已声明[skuId={},skuType={},unbox={},upchain={},seriesId={}]"
,
skuId
,
skuType
,
unbox
,
upchain
,
mgtGoodsSkuInfoVo
.
getSeriesId
());
return
ResponseDto
.
success
(
String
.
format
(
"藏品SKU无效或已声明[skuId:%s]"
,
skuId
));
}
try
{
GoblinGoodsSkuInfoVo
mgtGoodsSkuInfoVo
=
goblinMongoUtils
.
getGoodsSkuInfoVo
(
skuId
);
if
(
null
==
mgtGoodsSkuInfoVo
)
{
log
.
warn
(
"#NFT声明查询:藏品SKU不存在[skuId={}]"
,
skuId
);
return
ResponseDto
.
success
(
String
.
format
(
"藏品SKU不存在[skuId:%s]"
,
skuId
));
}
int
skuType
=
mgtGoodsSkuInfoVo
.
getSkuType
(),
upchain
=
mgtGoodsSkuInfoVo
.
getUpchain
();
String
unbox
=
mgtGoodsSkuInfoVo
.
getUnbox
();
// 非数字藏品 || 盲盒 || 非声明中 || 已有声明系列ID
if
(
1
!=
skuType
||
!
"0"
.
equals
(
unbox
)
||
9
!=
upchain
||
StringUtils
.
isNotEmpty
(
mgtGoodsSkuInfoVo
.
getSeriesId
()))
{
log
.
warn
(
"#NFT声明查询:藏品SKU无效或已声明[skuId={},skuType={},unbox={},upchain={},seriesId={}]"
,
skuId
,
skuType
,
unbox
,
upchain
,
mgtGoodsSkuInfoVo
.
getSeriesId
());
return
ResponseDto
.
success
(
String
.
format
(
"藏品SKU无效或已声明[skuId:%s]"
,
skuId
));
}
GalaxyArtSeriesClaimResultQueryRespDto
resultQueryRespDto
=
this
.
queryNftSeriesClaimResult
(
skuId
,
mgtGoodsSkuInfoVo
.
getRouteType
());
if
(
null
==
resultQueryRespDto
)
{
return
ResponseDto
.
failure
(
String
.
format
(
"藏品声明查询失败[skuId:%s]"
,
skuId
));
// 声明查询失败,重新入队处理
}
GalaxyArtSeriesClaimResultQueryRespDto
resultQueryRespDto
=
this
.
queryNftSeriesClaimResult
(
skuId
,
mgtGoodsSkuInfoVo
.
getRouteType
());
if
(
null
==
resultQueryRespDto
)
{
queueUtils
.
sendMsgByRedis
(
MQConst
.
GoblinQueue
.
BIZ_ARTWORK_CLQ
.
getKey
(),
skuId
);
return
ResponseDto
.
failure
(
String
.
format
(
"藏品声明查询失败[skuId:%s]"
,
skuId
));
// 声明查询失败,重新入队处理
}
String
seriesId
=
resultQueryRespDto
.
getSeriesId
();
String
txHash
=
resultQueryRespDto
.
getTxHash
();
String
nftHash
=
resultQueryRespDto
.
getNftHash
();
String
chainTimestamp
=
resultQueryRespDto
.
getChainTimestamp
();
String
seriesId
=
resultQueryRespDto
.
getSeriesId
();
String
txHash
=
resultQueryRespDto
.
getTxHash
();
String
nftHash
=
resultQueryRespDto
.
getNftHash
();
String
chainTimestamp
=
resultQueryRespDto
.
getChainTimestamp
();
LocalDateTime
now
=
LocalDateTime
.
now
();
mongoTemplate
.
getCollection
(
GoblinGoodsSkuInfoVo
.
class
.
getSimpleName
()).
updateOne
(
Query
.
query
(
Criteria
.
where
(
"skuId"
).
is
(
skuId
).
and
(
"delFlg"
).
is
(
"0"
)).
getQueryObject
(),
Update
.
update
(
"upchain"
,
1
).
set
(
"seriesId"
,
seriesId
).
set
(
"seriesHash"
,
txHash
).
set
(
"nftHash"
,
nftHash
).
set
(
"declareAt"
,
chainTimestamp
).
getUpdateObject
()
);
goblinRedisUtils
.
del
(
GoblinRedisConst
.
BASIC_GOODS_SKU
.
concat
(
skuId
));
LocalDateTime
now
=
LocalDateTime
.
now
();
mongoTemplate
.
getCollection
(
GoblinGoodsSkuInfoVo
.
class
.
getSimpleName
()).
updateOne
(
Query
.
query
(
Criteria
.
where
(
"skuId"
).
is
(
skuId
).
and
(
"delFlg"
).
is
(
"0"
)).
getQueryObject
(),
Update
.
update
(
"upchain"
,
1
).
set
(
"seriesId"
,
seriesId
).
set
(
"seriesHash"
,
txHash
).
set
(
"nftHash"
,
nftHash
).
set
(
"declareAt"
,
chainTimestamp
).
getUpdateObject
()
);
goblinRedisUtils
.
del
(
GoblinRedisConst
.
BASIC_GOODS_SKU
.
concat
(
skuId
));
// Mysql持久化
HashMap
<
String
,
String
>
sqlUpdateMap
=
CollectionUtil
.
mapStringString
();
LinkedList
<
String
>
toMqSqls
=
CollectionUtil
.
linkedListString
();
toMqSqls
.
add
(
SQL_UPDATE_GOODS_SKU_NFT
);
LinkedList
<
Object
[]>
updateGoodsSkuNftObjs
=
CollectionUtil
.
linkedListObjectArr
();
updateGoodsSkuNftObjs
.
add
(
new
Object
[]{
1
,
seriesId
,
txHash
,
nftHash
,
chainTimestamp
,
now
,
skuId
});
// Mysql持久化
HashMap
<
String
,
String
>
sqlUpdateMap
=
CollectionUtil
.
mapStringString
();
LinkedList
<
String
>
toMqSqls
=
CollectionUtil
.
linkedListString
();
toMqSqls
.
add
(
SQL_UPDATE_GOODS_SKU_NFT
);
LinkedList
<
Object
[]>
updateGoodsSkuNftObjs
=
CollectionUtil
.
linkedListObjectArr
();
updateGoodsSkuNftObjs
.
add
(
new
Object
[]{
1
,
seriesId
,
txHash
,
nftHash
,
chainTimestamp
,
now
,
skuId
});
sqlUpdateMap
.
put
(
MQConst
.
QUEUE_MESSAGE_KEY
,
SqlMapping
.
gets
(
toMqSqls
,
updateGoodsSkuNftObjs
));
stringRedisTemplate
.
opsForStream
().
add
(
StreamRecords
.
mapBacked
(
sqlUpdateMap
).
withStreamKey
(
MQConst
.
GoblinQueue
.
SQL_GOODS
.
getKey
()));
sqlUpdateMap
.
put
(
MQConst
.
QUEUE_MESSAGE_KEY
,
SqlMapping
.
gets
(
toMqSqls
,
updateGoodsSkuNftObjs
));
stringRedisTemplate
.
opsForStream
().
add
(
StreamRecords
.
mapBacked
(
sqlUpdateMap
).
withStreamKey
(
MQConst
.
GoblinQueue
.
SQL_GOODS
.
getKey
()));
}
catch
(
Exception
e
)
{
log
.
error
(
"Ex.NFT声明查询:处理异常[skuId={}]"
,
skuId
,
e
);
queueUtils
.
sendMsgByRedis
(
MQConst
.
GoblinQueue
.
BIZ_ARTWORK_CLQ
.
getKey
(),
skuId
);
return
ResponseDto
.
failure
(
String
.
format
(
"藏品声明查询异常[skuId:%s]"
,
skuId
));
// 声明查询失败,重新入队处理
}
return
ResponseDto
.
success
();
}
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/inner/GoblinQueBizArtworkUplService.java
View file @
cbc252a7
...
...
@@ -77,7 +77,6 @@ public class GoblinQueBizArtworkUplService {
galaxyNftUploadReqDto
.
setRouterType
(
mgtGoodsSkuInfoVo
.
getRouteType
());
GalaxyNftUploadRespDto
galaxyNftUploadRespDto
=
this
.
uploadNftMaterial
(
galaxyNftUploadReqDto
);
if
(
null
==
galaxyNftUploadRespDto
)
{
log
.
warn
(
"#NFT素材上传:处理失败[skuId={}]"
,
skuId
);
queueUtils
.
sendMsgByRedis
(
MQConst
.
GoblinQueue
.
BIZ_ARTWORK_UPL
.
getKey
(),
skuId
);
return
ResponseDto
.
failure
(
String
.
format
(
"藏品上传失败[skuId:%s]"
,
skuId
));
// 上传失败,重新入队处理
}
...
...
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