记得上下班打卡 | 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
6e17fc54
Commit
6e17fc54
authored
Aug 15, 2022
by
anjiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
实现百度链转让-消费
parent
48edea42
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
101 additions
and
0 deletions
+101
-0
ConsumerCommonBizRedisStreamConfig.java
...sumer/base/config/ConsumerCommonBizRedisStreamConfig.java
+25
-0
ConsumerCommonSqlRedisStreamConfig.java
...sumer/base/config/ConsumerCommonSqlRedisStreamConfig.java
+1
-0
ConsumerGalaxyJsonNftTransferReceiver.java
.../base/receiver/ConsumerGalaxyJsonNftTransferReceiver.java
+75
-0
No files found.
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-base/src/main/java/com/liquidnet/service/consumer/base/config/ConsumerCommonBizRedisStreamConfig.java
View file @
6e17fc54
...
...
@@ -36,11 +36,14 @@ public class ConsumerCommonBizRedisStreamConfig extends RedisStreamConfig {
ConsumerGoblinBizArtworkUplReceiver
consumerGoblinBizArtworkUplReceiver
;
@Autowired
ConsumerGoblinBizArtworkClqReceiver
consumerGoblinBizArtworkClqReceiver
;
/*------galaxy------*/
@Autowired
ConsumerGalaxyJsonNftPublishAndBuyReceiver
jsonNftPublishAndBuyReceiver
;
@Autowired
ConsumerGalaxyJsonNftUserRegisterReceiver
jsonNftUserRegisterReceiver
;
@Autowired
ConsumerGalaxyJsonNftTransferReceiver
jsonNftTransferReceiver
;
@Autowired
ConsumerGoblinBizIntegralReceiver
consumerGoblinBizIntegralReceiver
;
/*------sweet------*/
@Autowired
...
...
@@ -177,6 +180,28 @@ public class ConsumerCommonBizRedisStreamConfig extends RedisStreamConfig {
return
subscriptionList
;
}
/**
* Galaxy nft转让
* @param factory
* @return
*/
@Bean
public
List
<
Subscription
>
subscriptionGalaxyJsonNftTransfer
(
RedisConnectionFactory
factory
)
{
List
<
Subscription
>
subscriptionList
=
new
ArrayList
<>();
MQConst
.
GalaxyQueue
stream
=
MQConst
.
GalaxyQueue
.
JSON_NFT_USER_NFT_TRANSFER
;
this
.
initStream
(
stringRedisTemplate
,
stream
.
getKey
(),
stream
.
getGroup
());
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
StreamMessageListenerContainer
<
String
,
MapRecord
<
String
,
String
,
String
>>
listenerContainer
=
this
.
buildStreamMessageListenerContainer
(
factory
);
subscriptionList
.
add
(
listenerContainer
.
receiveAutoAck
(
Consumer
.
from
(
stream
.
getGroup
(),
getConsumerName
(
stream
.
name
()
+
i
)),
StreamOffset
.
create
(
stream
.
getKey
(),
ReadOffset
.
lastConsumed
()),
jsonNftTransferReceiver
));
listenerContainer
.
start
();
}
return
subscriptionList
;
}
@Bean
// 增减积分
public
List
<
Subscription
>
subscriptionGoblinBizIntegral
(
RedisConnectionFactory
factory
)
{
List
<
Subscription
>
subscriptionList
=
new
ArrayList
<>();
...
...
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-base/src/main/java/com/liquidnet/service/consumer/base/config/ConsumerCommonSqlRedisStreamConfig.java
View file @
6e17fc54
...
...
@@ -71,6 +71,7 @@ public class ConsumerCommonSqlRedisStreamConfig extends RedisStreamConfig {
ConsumerSlimeSqlLineReceiver
consumerSlimeSqlLineReceiver
;
@Autowired
ConsumerSlimeSqlPerformanceInsertReceiver
consumerSlimeSqlPerformanceInsertReceiver
;
/*------galaxy------*/
@Autowired
ConsumerGalaxySqlUserInfoReceiver
consumerGalaxySqlUserInfoReceiver
;
@Autowired
...
...
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-base/src/main/java/com/liquidnet/service/consumer/base/receiver/ConsumerGalaxyJsonNftTransferReceiver.java
0 → 100644
View file @
6e17fc54
package
com
.
liquidnet
.
service
.
consumer
.
base
.
receiver
;
import
com.liquidnet.commons.lang.util.CollectionUtil
;
import
com.liquidnet.commons.lang.util.HttpUtil
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.base.constant.MQConst
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyNftTransferReqDto
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyNftTransferRespDto
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.connection.stream.StreamRecords
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
@Slf4j
@Component
public
class
ConsumerGalaxyJsonNftTransferReceiver
extends
AbstractBizRedisReceiver
{
@Value
(
"${liquidnet.service.goblin.url}"
)
private
String
serviceGoblinUrl
;
@Override
protected
boolean
consumerMessageHandler
(
String
msg
)
{
boolean
aBoolean
=
false
;
try
{
GalaxyNftTransferReqDto
textMessage
=
JsonUtils
.
fromJson
(
msg
,
GalaxyNftTransferReqDto
.
class
);
if
(
textMessage
==
null
)
{
aBoolean
=
true
;
}
else
{
//执行计数
ResponseDto
<
GalaxyNftTransferRespDto
>
responseDto
=
this
.
nftTransfer
(
textMessage
);
// if(responseDto.isSuccess()){
aBoolean
=
true
;
// }
}
}
catch
(
Exception
e
)
{
log
.
error
(
"CONSUMER MSG EX_HANDLE ==> [{}]:{}"
,
this
.
getRedisStreamKey
(),
msg
,
e
);
}
finally
{
if
(!
aBoolean
)
{
HashMap
<
String
,
String
>
map
=
CollectionUtil
.
mapStringString
();
map
.
put
(
"message"
,
msg
);
stringRedisTemplate
.
opsForStream
().
add
(
StreamRecords
.
mapBacked
(
map
).
withStreamKey
(
this
.
getRedisStreamKey
()));
}
}
return
aBoolean
;
}
@Override
protected
String
getRedisStreamKey
()
{
return
MQConst
.
GalaxyQueue
.
JSON_NFT_USER_NFT_TRANSFER
.
getKey
();
}
@Override
protected
String
getRedisStreamGroup
()
{
return
MQConst
.
GalaxyQueue
.
JSON_NFT_USER_NFT_TRANSFER
.
getGroup
();
}
/**
* 执行nft转让
* @param reqDto
* @return
*/
private
ResponseDto
<
GalaxyNftTransferRespDto
>
nftTransfer
(
GalaxyNftTransferReqDto
reqDto
)
{
String
postUrl
=
serviceGoblinUrl
+
"/goblin/nftTrade/que/nftTransfer"
;
try
{
String
postRespStr
=
HttpUtil
.
postJson
(
postUrl
,
JsonUtils
.
toJson
(
reqDto
));
ResponseDto
responseDto
=
JsonUtils
.
fromJson
(
postRespStr
,
ResponseDto
.
class
);
return
responseDto
;
}
catch
(
Exception
e
)
{
log
.
error
(
"Ex.NFT转让:请求异常[url={},paramsStr={}],ex:{}"
,
postUrl
,
JsonUtils
.
toJson
(
reqDto
),
e
.
getMessage
());
return
ResponseDto
.
failure
();
}
}
}
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