记得上下班打卡 | 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
964f6ddb
Commit
964f6ddb
authored
Mar 30, 2022
by
anjiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合并nft消费端到kylin
parent
af36347c
Changes
28
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
50 additions
and
1345 deletions
+50
-1345
GalaxyNftOrderBo.java
...com/liquidnet/service/galaxy/dto/bo/GalaxyNftOrderBo.java
+25
-0
GalaxyNftOrderVo.java
...quidnet/service/galaxy/dto/vo/mongo/GalaxyNftOrderVo.java
+25
-0
pom.xml
...ce-consumer-all/liquidnet-service-consumer-galaxy/pom.xml
+0
-64
ServiceConsumerGalaxyApplication.java
...m/liquidnet/service/ServiceConsumerGalaxyApplication.java
+0
-41
ConsumerJsonNftPublishAndBuyConfig.java
...mer/galaxy/config/ConsumerJsonNftPublishAndBuyConfig.java
+0
-54
ConsumerSqlNftOrderInfoConfig.java
...consumer/galaxy/config/ConsumerSqlNftOrderInfoConfig.java
+0
-54
ConsumerSqlNftTradeInfoConfig.java
...consumer/galaxy/config/ConsumerSqlNftTradeInfoConfig.java
+0
-54
ConsumerSqlSeriesInfoConfig.java
...e/consumer/galaxy/config/ConsumerSqlSeriesInfoConfig.java
+0
-54
ConsumerSqlUserInfoConfig.java
...ice/consumer/galaxy/config/ConsumerSqlUserInfoConfig.java
+0
-54
AbstractJsonRedisReceiver.java
...e/consumer/galaxy/receiver/AbstractJsonRedisReceiver.java
+0
-69
AbstractSqlRedisReceiver.java
...ce/consumer/galaxy/receiver/AbstractSqlRedisReceiver.java
+0
-70
JsonRedisJsonNftPublishAndBuyReceiver.java
...alaxy/receiver/JsonRedisJsonNftPublishAndBuyReceiver.java
+0
-20
SqlRedisSqlNftOrderInfoReceiver.java
...umer/galaxy/receiver/SqlRedisSqlNftOrderInfoReceiver.java
+0
-20
SqlRedisSqlNftTradeInfoReceiver.java
...umer/galaxy/receiver/SqlRedisSqlNftTradeInfoReceiver.java
+0
-20
SqlRedisSqlSeriesInfoReceiver.java
...nsumer/galaxy/receiver/SqlRedisSqlSeriesInfoReceiver.java
+0
-20
SqlRedisSqlUserInfoReceiver.java
...consumer/galaxy/receiver/SqlRedisSqlUserInfoReceiver.java
+0
-20
IBaseDao.java
...m/liquidnet/service/consumer/galaxy/service/IBaseDao.java
+0
-40
BaseDao.java
...quidnet/service/consumer/galaxy/service/impl/BaseDao.java
+0
-116
ConsumerJsonNftPublishAndBuyProcessor.java
...vice/processor/ConsumerJsonNftPublishAndBuyProcessor.java
+0
-250
ConsumerPayProcessor.java
...nsumer/galaxy/service/processor/ConsumerPayProcessor.java
+0
-61
ConsumerRefundProcessor.java
...mer/galaxy/service/processor/ConsumerRefundProcessor.java
+0
-28
DataUtils.java
...om/liquidnet/service/consumer/galaxy/utils/DataUtils.java
+0
-114
QueueUtil.java
...om/liquidnet/service/consumer/galaxy/utils/QueueUtil.java
+0
-53
bootstrap-dev.yml
...vice-consumer-galaxy/src/main/resources/bootstrap-dev.yml
+0
-15
bootstrap-prod.yml
...ice-consumer-galaxy/src/main/resources/bootstrap-prod.yml
+0
-14
bootstrap-service-consumer-galaxy.yml
.../src/main/resources/bootstrap-service-consumer-galaxy.yml
+0
-17
bootstrap-test.yml
...ice-consumer-galaxy/src/main/resources/bootstrap-test.yml
+0
-18
bootstrap.yml
...-service-consumer-galaxy/src/main/resources/bootstrap.yml
+0
-5
No files found.
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/dto/bo/GalaxyNftOrderBo.java
View file @
964f6ddb
...
...
@@ -58,11 +58,36 @@ public class GalaxyNftOrderBo implements Serializable,Cloneable {
*/
private
String
nftPublishTaskId
;
/**
* nft发行时间
*/
private
String
nftPublishChainTimestamp
;
/**
* nft发行状态
*/
private
String
nftPublishStatus
;
/**
* nft发行交易hash
*/
private
String
nftPublishTradeHash
;
/**
* nft购买任务id
* @return
*/
private
String
nftBuyTaskId
;
/**
* nft购买时间
*/
private
String
nftBuyChainTimestamp
;
/**
* nft购买状态
*/
private
String
nftBuyStatus
;
/**
* nft购买交易hash
*/
private
String
nftBuyTradeHash
;
/**
* nft购买支付任务ID
...
...
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/dto/vo/mongo/GalaxyNftOrderVo.java
View file @
964f6ddb
...
...
@@ -58,11 +58,36 @@ public class GalaxyNftOrderVo implements Serializable,Cloneable {
*/
private
String
nftPublishTaskId
;
/**
* nft发行时间
*/
private
String
nftPublishChainTimestamp
;
/**
* nft发行状态
*/
private
String
nftPublishStatus
;
/**
* nft发行交易hash
*/
private
String
nftPublishTradeHash
;
/**
* nft购买任务id
* @return
*/
private
String
nftBuyTaskId
;
/**
* nft购买时间
*/
private
String
nftBuyChainTimestamp
;
/**
* nft购买状态
*/
private
String
nftBuyStatus
;
/**
* nft购买交易hash
*/
private
String
nftBuyTradeHash
;
/**
* nft购买支付任务ID
...
...
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/pom.xml
deleted
100644 → 0
View file @
af36347c
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
liquidnet-service-consumer-all
</artifactId>
<groupId>
com.liquidnet
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
liquidnet-service-consumer-galaxy
</artifactId>
<properties>
<maven.compiler.source>
8
</maven.compiler.source>
<maven.compiler.target>
8
</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-mongodb
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
com.liquidnet
</groupId>
<artifactId>
liquidnet-common-cache-redis
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.liquidnet
</groupId>
<artifactId>
liquidnet-common-third-zxlnft
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.liquidnet
</groupId>
<artifactId>
liquidnet-common-third-antchain
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.liquidnet
</groupId>
<artifactId>
liquidnet-service-galaxy-api
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugins>
<resources>
<resource>
<directory>
src/main/resources
</directory>
<filtering>
true
</filtering>
</resource>
</resources>
</build>
</project>
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/java/com/liquidnet/service/ServiceConsumerGalaxyApplication.java
deleted
100644 → 0
View file @
af36347c
package
com
.
liquidnet
.
service
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.core.env.Environment
;
import
java.net.InetAddress
;
import
java.util.Arrays
;
@Slf4j
@SpringBootApplication
(
scanBasePackages
=
{
"com.liquidnet"
})
public
class
ServiceConsumerGalaxyApplication
implements
CommandLineRunner
{
@Autowired
private
Environment
environment
;
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
ServiceConsumerGalaxyApplication
.
class
,
args
);
}
@Override
public
void
run
(
String
...
strings
)
{
try
{
log
.
info
(
"\n----------------------------------------------------------\n\t"
+
"Application '{}' is running! Access URLs:\n\t"
+
"Local: \t\thttp://127.0.0.1:{}\n\t"
+
"External: \thttp://{}:{}{}/doc.html\n\t"
+
"Profile(s): \t{}\n----------------------------------------------------------"
,
environment
.
getProperty
(
"spring.application.name"
),
environment
.
getProperty
(
"server.port"
),
InetAddress
.
getLocalHost
().
getHostAddress
(),
environment
.
getProperty
(
"server.port"
),
environment
.
getProperty
(
"server.servlet.context-path"
),
Arrays
.
toString
(
environment
.
getActiveProfiles
()));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/java/com/liquidnet/service/consumer/galaxy/config/ConsumerJsonNftPublishAndBuyConfig.java
deleted
100644 → 0
View file @
af36347c
package
com
.
liquidnet
.
service
.
consumer
.
galaxy
.
config
;
import
com.liquidnet.common.cache.redis.config.RedisStreamConfig
;
import
com.liquidnet.service.base.constant.MQConst
;
import
com.liquidnet.service.consumer.galaxy.receiver.JsonRedisJsonNftPublishAndBuyReceiver
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.redis.connection.RedisConnectionFactory
;
import
org.springframework.data.redis.connection.stream.Consumer
;
import
org.springframework.data.redis.connection.stream.MapRecord
;
import
org.springframework.data.redis.connection.stream.ReadOffset
;
import
org.springframework.data.redis.connection.stream.StreamOffset
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.data.redis.stream.StreamMessageListenerContainer
;
import
org.springframework.data.redis.stream.Subscription
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: 区块链nft订单相关
* @class: ConsumerSqlNftOrderInfoConfig
* @Package com.liquidnet.service.consumer.galaxy.config
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/3/25 14:45
*/
@Configuration
public
class
ConsumerJsonNftPublishAndBuyConfig
extends
RedisStreamConfig
{
@Autowired
private
JsonRedisJsonNftPublishAndBuyReceiver
jsonNftPublishAndBuyReceiver
;
@Autowired
StringRedisTemplate
stringRedisTemplate
;
@Bean
public
List
<
Subscription
>
subscriptionJsonNftPublishAndBuy
(
RedisConnectionFactory
factory
)
{
List
<
Subscription
>
subscriptionList
=
new
ArrayList
<>();
MQConst
.
GalaxyQueue
stream
=
MQConst
.
GalaxyQueue
.
JSON_NFT_PUBLISH_AND_BUY
;
this
.
initStream
(
stringRedisTemplate
,
stream
.
getKey
(),
stream
.
getGroup
());
for
(
int
i
=
0
;
i
<
20
;
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
()),
jsonNftPublishAndBuyReceiver
));
listenerContainer
.
start
();
}
return
subscriptionList
;
}
}
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/java/com/liquidnet/service/consumer/galaxy/config/ConsumerSqlNftOrderInfoConfig.java
deleted
100644 → 0
View file @
af36347c
package
com
.
liquidnet
.
service
.
consumer
.
galaxy
.
config
;
import
com.liquidnet.common.cache.redis.config.RedisStreamConfig
;
import
com.liquidnet.service.base.constant.MQConst
;
import
com.liquidnet.service.consumer.galaxy.receiver.SqlRedisSqlSeriesInfoReceiver
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.redis.connection.RedisConnectionFactory
;
import
org.springframework.data.redis.connection.stream.Consumer
;
import
org.springframework.data.redis.connection.stream.MapRecord
;
import
org.springframework.data.redis.connection.stream.ReadOffset
;
import
org.springframework.data.redis.connection.stream.StreamOffset
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.data.redis.stream.StreamMessageListenerContainer
;
import
org.springframework.data.redis.stream.Subscription
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: 区块链nft订单相关
* @class: ConsumerSqlNftOrderInfoConfig
* @Package com.liquidnet.service.consumer.galaxy.config
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/3/25 14:45
*/
@Configuration
public
class
ConsumerSqlNftOrderInfoConfig
extends
RedisStreamConfig
{
@Autowired
private
SqlRedisSqlSeriesInfoReceiver
sqlSeriesInfoReceiver
;
@Autowired
StringRedisTemplate
stringRedisTemplate
;
@Bean
public
List
<
Subscription
>
subscriptionSqlNftOrderInfo
(
RedisConnectionFactory
factory
)
{
List
<
Subscription
>
subscriptionList
=
new
ArrayList
<>();
MQConst
.
GalaxyQueue
stream
=
MQConst
.
GalaxyQueue
.
SQL_NFT_ORDER_INFO
;
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
()),
sqlSeriesInfoReceiver
));
listenerContainer
.
start
();
}
return
subscriptionList
;
}
}
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/java/com/liquidnet/service/consumer/galaxy/config/ConsumerSqlNftTradeInfoConfig.java
deleted
100644 → 0
View file @
af36347c
package
com
.
liquidnet
.
service
.
consumer
.
galaxy
.
config
;
import
com.liquidnet.common.cache.redis.config.RedisStreamConfig
;
import
com.liquidnet.service.base.constant.MQConst
;
import
com.liquidnet.service.consumer.galaxy.receiver.SqlRedisSqlSeriesInfoReceiver
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.redis.connection.RedisConnectionFactory
;
import
org.springframework.data.redis.connection.stream.Consumer
;
import
org.springframework.data.redis.connection.stream.MapRecord
;
import
org.springframework.data.redis.connection.stream.ReadOffset
;
import
org.springframework.data.redis.connection.stream.StreamOffset
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.data.redis.stream.StreamMessageListenerContainer
;
import
org.springframework.data.redis.stream.Subscription
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: 区块链nft交易相关
* @class: ConsumerSqlNftTradeInfoConfig
* @Package com.liquidnet.service.consumer.galaxy.config
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/3/25 14:45
*/
@Configuration
public
class
ConsumerSqlNftTradeInfoConfig
extends
RedisStreamConfig
{
@Autowired
private
SqlRedisSqlSeriesInfoReceiver
sqlSeriesInfoReceiver
;
@Autowired
StringRedisTemplate
stringRedisTemplate
;
@Bean
public
List
<
Subscription
>
subscriptionSqlNftTradeInfo
(
RedisConnectionFactory
factory
)
{
List
<
Subscription
>
subscriptionList
=
new
ArrayList
<>();
MQConst
.
GalaxyQueue
stream
=
MQConst
.
GalaxyQueue
.
SQL_NFT_TRADE_INFO
;
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
()),
sqlSeriesInfoReceiver
));
listenerContainer
.
start
();
}
return
subscriptionList
;
}
}
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/java/com/liquidnet/service/consumer/galaxy/config/ConsumerSqlSeriesInfoConfig.java
deleted
100644 → 0
View file @
af36347c
package
com
.
liquidnet
.
service
.
consumer
.
galaxy
.
config
;
import
com.liquidnet.common.cache.redis.config.RedisStreamConfig
;
import
com.liquidnet.service.base.constant.MQConst
;
import
com.liquidnet.service.consumer.galaxy.receiver.SqlRedisSqlSeriesInfoReceiver
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.redis.connection.RedisConnectionFactory
;
import
org.springframework.data.redis.connection.stream.Consumer
;
import
org.springframework.data.redis.connection.stream.MapRecord
;
import
org.springframework.data.redis.connection.stream.ReadOffset
;
import
org.springframework.data.redis.connection.stream.StreamOffset
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.data.redis.stream.StreamMessageListenerContainer
;
import
org.springframework.data.redis.stream.Subscription
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: 区块链系列信息
* @class: ConsumerSqlSeriesInfoConfig
* @Package com.liquidnet.service.consumer.galaxy.config
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/3/25 14:45
*/
@Configuration
public
class
ConsumerSqlSeriesInfoConfig
extends
RedisStreamConfig
{
@Autowired
private
SqlRedisSqlSeriesInfoReceiver
sqlSeriesInfoReceiver
;
@Autowired
StringRedisTemplate
stringRedisTemplate
;
@Bean
public
List
<
Subscription
>
subscriptionSqlSeriesInfo
(
RedisConnectionFactory
factory
)
{
List
<
Subscription
>
subscriptionList
=
new
ArrayList
<>();
MQConst
.
GalaxyQueue
stream
=
MQConst
.
GalaxyQueue
.
SQL_SERIES_INFO
;
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
()),
sqlSeriesInfoReceiver
));
listenerContainer
.
start
();
}
return
subscriptionList
;
}
}
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/java/com/liquidnet/service/consumer/galaxy/config/ConsumerSqlUserInfoConfig.java
deleted
100644 → 0
View file @
af36347c
package
com
.
liquidnet
.
service
.
consumer
.
galaxy
.
config
;
import
com.liquidnet.common.cache.redis.config.RedisStreamConfig
;
import
com.liquidnet.service.base.constant.MQConst
;
import
com.liquidnet.service.consumer.galaxy.receiver.SqlRedisSqlUserInfoReceiver
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.redis.connection.RedisConnectionFactory
;
import
org.springframework.data.redis.connection.stream.Consumer
;
import
org.springframework.data.redis.connection.stream.MapRecord
;
import
org.springframework.data.redis.connection.stream.ReadOffset
;
import
org.springframework.data.redis.connection.stream.StreamOffset
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.data.redis.stream.StreamMessageListenerContainer
;
import
org.springframework.data.redis.stream.Subscription
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: 区块链用户注册
* @class: ConsumerSqlUserInfoConfig
* @Package com.liquidnet.service.consumer.dragon.config
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/3/22 14:45
*/
@Configuration
public
class
ConsumerSqlUserInfoConfig
extends
RedisStreamConfig
{
@Autowired
private
SqlRedisSqlUserInfoReceiver
sqlUserInfoReceiver
;
@Autowired
StringRedisTemplate
stringRedisTemplate
;
@Bean
public
List
<
Subscription
>
subscriptionSqlUserInfo
(
RedisConnectionFactory
factory
)
{
List
<
Subscription
>
subscriptionList
=
new
ArrayList
<>();
MQConst
.
GalaxyQueue
stream
=
MQConst
.
GalaxyQueue
.
SQL_USER_INFO
;
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
()),
sqlUserInfoReceiver
));
listenerContainer
.
start
();
}
return
subscriptionList
;
}
}
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/java/com/liquidnet/service/consumer/galaxy/receiver/AbstractJsonRedisReceiver.java
deleted
100644 → 0
View file @
af36347c
package
com
.
liquidnet
.
service
.
consumer
.
galaxy
.
receiver
;
import
com.liquidnet.commons.lang.util.CollectionUtil
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.service.consumer.galaxy.service.processor.ConsumerJsonNftPublishAndBuyProcessor
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyNftPublishAndBuyReqDto
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.connection.stream.MapRecord
;
import
org.springframework.data.redis.connection.stream.StreamRecords
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.data.redis.stream.StreamListener
;
import
java.util.HashMap
;
@Slf4j
public
abstract
class
AbstractJsonRedisReceiver
implements
StreamListener
<
String
,
MapRecord
<
String
,
String
,
String
>>
{
@Autowired
StringRedisTemplate
stringRedisTemplate
;
@Autowired
private
ConsumerJsonNftPublishAndBuyProcessor
jsonNftPublishAndBuyProcessor
;
@Override
public
void
onMessage
(
MapRecord
<
String
,
String
,
String
>
message
)
{
String
redisStreamKey
=
this
.
getRedisStreamKey
();
log
.
debug
(
"CONSUMER MSG[streamKey:{},messageId:{},stream:{},body:{}]"
,
redisStreamKey
,
message
.
getId
(),
message
.
getStream
(),
message
.
getValue
());
boolean
result
=
this
.
consumerMessageHandler
(
message
.
getValue
().
get
(
"message"
));
log
.
info
(
"CONSUMER MSG RESULT:{} ==> [{}]MESSAGE_ID:{}"
,
result
,
redisStreamKey
,
message
.
getId
());
try
{
stringRedisTemplate
.
opsForStream
().
acknowledge
(
getRedisStreamGroup
(),
message
);
}
catch
(
Exception
e
)
{
log
.
error
(
"#CONSUMER MSG EX_ACK ==> [{}]RESULT:{},MESSAGE:{}"
,
redisStreamKey
,
result
,
message
.
getValue
(),
e
);
}
try
{
stringRedisTemplate
.
opsForStream
().
delete
(
redisStreamKey
,
message
.
getId
());
}
catch
(
Exception
e
)
{
log
.
error
(
"#CONSUMER MSG EX_DEL ==> [{}]RESULT:{},MESSAGE:{}"
,
redisStreamKey
,
result
,
message
.
getValue
(),
e
);
}
}
private
boolean
consumerMessageHandler
(
String
msg
)
{
boolean
aBoolean
=
false
;
try
{
GalaxyNftPublishAndBuyReqDto
textMessage
=
JsonUtils
.
fromJson
(
msg
,
GalaxyNftPublishAndBuyReqDto
.
class
);
if
(
textMessage
==
null
)
{
aBoolean
=
true
;
}
else
{
//执行计数
jsonNftPublishAndBuyProcessor
.
nftPublishAndBuy
(
textMessage
);
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
;
}
protected
abstract
String
getRedisStreamKey
();
protected
abstract
String
getRedisStreamGroup
();
}
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/java/com/liquidnet/service/consumer/galaxy/receiver/AbstractSqlRedisReceiver.java
deleted
100644 → 0
View file @
af36347c
package
com
.
liquidnet
.
service
.
consumer
.
galaxy
.
receiver
;
import
com.liquidnet.commons.lang.util.CollectionUtil
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.service.base.SqlMapping
;
import
com.liquidnet.service.consumer.galaxy.service.IBaseDao
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.connection.stream.MapRecord
;
import
org.springframework.data.redis.connection.stream.StreamRecords
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.data.redis.stream.StreamListener
;
import
java.util.HashMap
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: AbstractRedisReceiver
* @Package com.liquidnet.service.consumer.dragon.receiver
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/7/22 20:28
*/
@Slf4j
public
abstract
class
AbstractSqlRedisReceiver
implements
StreamListener
<
String
,
MapRecord
<
String
,
String
,
String
>>
{
@Autowired
private
IBaseDao
baseDao
;
@Autowired
StringRedisTemplate
stringRedisTemplate
;
@Override
public
void
onMessage
(
MapRecord
<
String
,
String
,
String
>
message
)
{
String
redisStreamKey
=
this
.
getRedisStreamKey
();
log
.
debug
(
"CONSUMER MSG[streamKey:{},messageId:{},stream:{},body:{}]"
,
redisStreamKey
,
message
.
getId
(),
message
.
getStream
(),
message
.
getValue
());
boolean
result
=
this
.
consumerMessageHandler
(
message
.
getValue
().
get
(
"message"
));
log
.
info
(
"CONSUMER MSG RESULT:{} ==> [{}]MESSAGE_ID:{}"
,
result
,
redisStreamKey
,
message
.
getId
());
try
{
stringRedisTemplate
.
opsForStream
().
acknowledge
(
getRedisStreamGroup
(),
message
);
}
catch
(
Exception
e
)
{
log
.
error
(
"#CONSUMER MSG EX_ACK ==> [{}]RESULT:{},MESSAGE:{}"
,
this
.
getRedisStreamKey
(),
result
,
message
.
getValue
(),
e
);
}
try
{
stringRedisTemplate
.
opsForStream
().
delete
(
this
.
getRedisStreamKey
(),
message
.
getId
());
}
catch
(
Exception
e
)
{
log
.
error
(
"#CONSUMER MSG EX_DEL ==> [{}]RESULT:{},MESSAGE:{}"
,
this
.
getRedisStreamKey
(),
result
,
message
.
getValue
(),
e
);
}
}
private
boolean
consumerMessageHandler
(
String
msg
)
{
boolean
aBoolean
=
false
;
try
{
SqlMapping
.
SqlMessage
sqlMessage
=
JsonUtils
.
fromJson
(
msg
,
SqlMapping
.
SqlMessage
.
class
);
aBoolean
=
null
==
sqlMessage
||
baseDao
.
batchSqls
(
sqlMessage
.
getSqls
(),
sqlMessage
.
getArgs
());
}
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
;
}
protected
abstract
String
getRedisStreamKey
();
protected
abstract
String
getRedisStreamGroup
();
}
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/java/com/liquidnet/service/consumer/galaxy/receiver/JsonRedisJsonNftPublishAndBuyReceiver.java
deleted
100644 → 0
View file @
af36347c
package
com
.
liquidnet
.
service
.
consumer
.
galaxy
.
receiver
;
import
com.liquidnet.service.base.constant.MQConst
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
@Slf4j
@Component
public
class
JsonRedisJsonNftPublishAndBuyReceiver
extends
AbstractJsonRedisReceiver
{
@Override
protected
String
getRedisStreamKey
()
{
return
MQConst
.
GalaxyQueue
.
JSON_NFT_PUBLISH_AND_BUY
.
getKey
();
}
@Override
protected
String
getRedisStreamGroup
()
{
return
MQConst
.
GalaxyQueue
.
JSON_NFT_PUBLISH_AND_BUY
.
getGroup
();
}
}
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/java/com/liquidnet/service/consumer/galaxy/receiver/SqlRedisSqlNftOrderInfoReceiver.java
deleted
100644 → 0
View file @
af36347c
package
com
.
liquidnet
.
service
.
consumer
.
galaxy
.
receiver
;
import
com.liquidnet.service.base.constant.MQConst
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
@Slf4j
@Component
public
class
SqlRedisSqlNftOrderInfoReceiver
extends
AbstractSqlRedisReceiver
{
@Override
protected
String
getRedisStreamKey
()
{
return
MQConst
.
GalaxyQueue
.
SQL_NFT_ORDER_INFO
.
getKey
();
}
@Override
protected
String
getRedisStreamGroup
()
{
return
MQConst
.
GalaxyQueue
.
SQL_NFT_ORDER_INFO
.
getGroup
();
}
}
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/java/com/liquidnet/service/consumer/galaxy/receiver/SqlRedisSqlNftTradeInfoReceiver.java
deleted
100644 → 0
View file @
af36347c
package
com
.
liquidnet
.
service
.
consumer
.
galaxy
.
receiver
;
import
com.liquidnet.service.base.constant.MQConst
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
@Slf4j
@Component
public
class
SqlRedisSqlNftTradeInfoReceiver
extends
AbstractSqlRedisReceiver
{
@Override
protected
String
getRedisStreamKey
()
{
return
MQConst
.
GalaxyQueue
.
SQL_NFT_TRADE_INFO
.
getKey
();
}
@Override
protected
String
getRedisStreamGroup
()
{
return
MQConst
.
GalaxyQueue
.
SQL_NFT_TRADE_INFO
.
getGroup
();
}
}
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/java/com/liquidnet/service/consumer/galaxy/receiver/SqlRedisSqlSeriesInfoReceiver.java
deleted
100644 → 0
View file @
af36347c
package
com
.
liquidnet
.
service
.
consumer
.
galaxy
.
receiver
;
import
com.liquidnet.service.base.constant.MQConst
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
@Slf4j
@Component
public
class
SqlRedisSqlSeriesInfoReceiver
extends
AbstractSqlRedisReceiver
{
@Override
protected
String
getRedisStreamKey
()
{
return
MQConst
.
GalaxyQueue
.
SQL_SERIES_INFO
.
getKey
();
}
@Override
protected
String
getRedisStreamGroup
()
{
return
MQConst
.
GalaxyQueue
.
SQL_SERIES_INFO
.
getGroup
();
}
}
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/java/com/liquidnet/service/consumer/galaxy/receiver/SqlRedisSqlUserInfoReceiver.java
deleted
100644 → 0
View file @
af36347c
package
com
.
liquidnet
.
service
.
consumer
.
galaxy
.
receiver
;
import
com.liquidnet.service.base.constant.MQConst
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
@Slf4j
@Component
public
class
SqlRedisSqlUserInfoReceiver
extends
AbstractSqlRedisReceiver
{
@Override
protected
String
getRedisStreamKey
()
{
return
MQConst
.
GalaxyQueue
.
SQL_USER_INFO
.
getKey
();
}
@Override
protected
String
getRedisStreamGroup
()
{
return
MQConst
.
GalaxyQueue
.
SQL_USER_INFO
.
getGroup
();
}
}
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/java/com/liquidnet/service/consumer/galaxy/service/IBaseDao.java
deleted
100644 → 0
View file @
af36347c
package
com
.
liquidnet
.
service
.
consumer
.
galaxy
.
service
;
import
java.util.LinkedList
;
public
interface
IBaseDao
{
/**
* 批量执行sql
*
* @param sql
* @param values
* @return
*/
Boolean
batchSql
(
String
sql
,
LinkedList
<
Object
[]>
values
);
/**
* 批量执行不定量sql
*
* @param sql
* @param values
* @return
*/
Boolean
batchSqls
(
LinkedList
<
String
>
sql
,
LinkedList
<
Object
[]>...
values
);
/**
* 执行sql语句 无 参数
*
* @param sql
* @return
*/
Boolean
batchSqlNoArgs
(
LinkedList
<
String
>
sql
);
/**
* xs 新增一条记录且返回主键Id
*
* @param sql 新增待执行sql
* @param param 参数
* @return 主键ID
*/
int
insertSqlAndReturnKeyId
(
final
String
sql
,
final
Object
[]
param
);
}
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/java/com/liquidnet/service/consumer/galaxy/service/impl/BaseDao.java
deleted
100644 → 0
View file @
af36347c
package
com
.
liquidnet
.
service
.
consumer
.
galaxy
.
service
.
impl
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.service.consumer.galaxy.service.IBaseDao
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.jdbc.datasource.DataSourceTransactionManager
;
import
org.springframework.jdbc.support.GeneratedKeyHolder
;
import
org.springframework.jdbc.support.KeyHolder
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.support.TransactionCallback
;
import
org.springframework.transaction.support.TransactionTemplate
;
import
javax.annotation.Resource
;
import
java.sql.PreparedStatement
;
import
java.sql.Statement
;
import
java.util.LinkedList
;
@Service
public
class
BaseDao
implements
IBaseDao
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
BaseDao
.
class
);
@Resource
public
JdbcTemplate
jdbcTemplate
;
@Resource
(
name
=
"transactionManager"
)
public
DataSourceTransactionManager
transactionManager
;
@Override
public
Boolean
batchSql
(
final
String
sql
,
final
LinkedList
<
Object
[]>
values
)
{
TransactionCallback
<
Boolean
>
callback
=
transactionStatus
->
{
if
(
values
.
size
()
>
0
)
{
int
[]
ints
=
jdbcTemplate
.
batchUpdate
(
sql
,
values
);
}
return
true
;
};
try
{
TransactionTemplate
tt
=
new
TransactionTemplate
(
transactionManager
);
return
tt
.
execute
(
callback
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"###\nSQL.Preparing:{}\nParameters:{}"
,
JsonUtils
.
toJson
(
sql
),
JsonUtils
.
toJson
(
values
),
ex
);
return
false
;
}
}
@Override
public
Boolean
batchSqls
(
final
LinkedList
<
String
>
sql
,
final
LinkedList
<
Object
[]>...
values
)
{
try
{
TransactionCallback
<
Boolean
>
callback
=
transactionStatus
->
{
int
i
=
0
;
for
(
LinkedList
<
Object
[]>
o
:
values
)
{
if
(
sql
.
size
()
<
i
+
1
)
{
break
;
}
if
(!
o
.
isEmpty
())
{
jdbcTemplate
.
batchUpdate
(
sql
.
get
(
i
),
o
);
}
i
++;
}
return
true
;
};
TransactionTemplate
tt
=
new
TransactionTemplate
(
transactionManager
);
return
tt
.
execute
(
callback
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"###Error.Sqls:{}\nParameters:{},Ex:{}"
,
JsonUtils
.
toJson
(
sql
),
JsonUtils
.
toJson
(
values
),
ex
.
getMessage
());
return
false
;
}
}
@Override
public
Boolean
batchSqlNoArgs
(
final
LinkedList
<
String
>
sql
)
{
try
{
TransactionCallback
<
Boolean
>
callback
=
transactionStatus
->
{
for
(
String
o
:
sql
)
{
jdbcTemplate
.
execute
(
o
);
}
return
true
;
};
TransactionTemplate
tt
=
new
TransactionTemplate
(
transactionManager
);
return
tt
.
execute
(
callback
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"###Error.Sqls:{}\nParameters:{},Ex:{}"
,
sql
);
return
false
;
}
}
/**
* xs 新增一条记录且返回主键Id
*
* @param sql 新增待执行sql
* @param param 参数
* @return 主键ID
*/
public
int
insertSqlAndReturnKeyId
(
final
String
sql
,
final
Object
[]
param
)
{
final
String
innersql
=
sql
;
final
Object
[]
innerO
=
param
;
KeyHolder
keyHolder
=
new
GeneratedKeyHolder
();
try
{
jdbcTemplate
.
update
(
con
->
{
PreparedStatement
ps
=
con
.
prepareStatement
(
innersql
,
Statement
.
RETURN_GENERATED_KEYS
);
for
(
int
i
=
0
;
i
<
innerO
.
length
;
i
++)
{
ps
.
setObject
(
i
+
1
,
innerO
[
i
]);
}
return
ps
;
},
keyHolder
);
}
catch
(
Exception
e
)
{
log
.
error
(
"###\nSQL.Preparing:{}\nParameters:{}"
,
sql
,
JsonUtils
.
toJson
(
param
),
e
);
}
return
keyHolder
.
getKey
().
intValue
();
}
}
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/java/com/liquidnet/service/consumer/galaxy/service/processor/ConsumerJsonNftPublishAndBuyProcessor.java
deleted
100644 → 0
View file @
af36347c
This diff is collapsed.
Click to expand it.
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/java/com/liquidnet/service/consumer/galaxy/service/processor/ConsumerPayProcessor.java
deleted
100644 → 0
View file @
af36347c
//package com.liquidnet.service.consumer.dragon.service.processor;
//
//import com.liquidnet.commons.lang.util.JsonUtils;
//import com.liquidnet.service.base.SqlMapping;
//import com.liquidnet.service.consumer.dragon.service.IBaseDao;
//import com.rabbitmq.client.Channel;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.amqp.core.Message;
//import org.springframework.amqp.core.MessageProperties;
//import org.springframework.data.redis.connection.stream.MapRecord;
//import org.springframework.data.redis.stream.StreamListener;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//import java.io.IOException;
//
///**
// * @author AnJiabin <anjiabin@zhengzai.tv>
// * @version V1.0
// * @Description: TODO
// * @class: ConsumerPayProcessor
// * @Package com.liquidnet.service.consumer.dragon.service.processor
// * @Copyright: LightNet @ Copyright (c) 2021
// * @date 2021/7/8 10:59
// */
//@Slf4j
//@Component
//public class ConsumerPayProcessor implements StreamListener<String, MapRecord<String, String, String>> {
// @Resource
// IBaseDao baseDao;
// @Override
// public void onMessage(MapRecord<String, String, String> message) {
// log.info("接受到来自redis PAY 的消息");
// System.out.println("message id "+message.getId());
// System.out.println("stream "+message.getStream());
// System.out.println("body "+message.getValue());
// }
//
//
// private void consumerSqlDaoHandler(Message msg, Channel channel) {
// MessageProperties properties = msg.getMessageProperties();
// String consumerQueue = properties.getConsumerQueue();
// long deliveryTag = properties.getDeliveryTag();
// log.info("CONSUMER SQL ==> [consumerQueue:{},deliveryTag:{}]", consumerQueue, deliveryTag);
// SqlMapping.SqlMessage sqlMessage = JsonUtils.fromJson(new String(msg.getBody()), SqlMapping.SqlMessage.class);
// log.debug("CONSUMER SQL ==> Preparing:{}", JsonUtils.toJson(sqlMessage.getSqls()));
// log.debug("CONSUMER SQL ==> Parameters:{}", JsonUtils.toJson(sqlMessage.getArgs()));
// try {
// Boolean rstBatchSqls = baseDao.batchSqls(sqlMessage.getSqls(), sqlMessage.getArgs());
// log.debug("CONSUMER SQL result of execution:{}", rstBatchSqls);
// if (rstBatchSqls) {
// channel.basicAck(deliveryTag, false);
// } else {
// log.warn("###CONSUMER SQL[consumerQueue:{},deliveryTag={},sqlMessage:{}]", consumerQueue, deliveryTag, JsonUtils.toJson(sqlMessage));
// channel.basicAck(deliveryTag, false);
// }
// } catch (IOException e) {
// log.error("CONSUMER SQL[consumerQueue:{},deliveryTag:{},sqlMessage:{}]", consumerQueue, deliveryTag, JsonUtils.toJson(sqlMessage), e);
// }
// }
//}
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/java/com/liquidnet/service/consumer/galaxy/service/processor/ConsumerRefundProcessor.java
deleted
100644 → 0
View file @
af36347c
package
com
.
liquidnet
.
service
.
consumer
.
galaxy
.
service
.
processor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.data.redis.connection.stream.MapRecord
;
import
org.springframework.data.redis.stream.StreamListener
;
import
org.springframework.stereotype.Component
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: ConsumerRefundProcessor
* @Package com.liquidnet.service.consumer.dragon.service.processor
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2021/7/8 10:59
*/
@Slf4j
@Component
public
class
ConsumerRefundProcessor
implements
StreamListener
<
String
,
MapRecord
<
String
,
String
,
String
>>
{
@Override
public
void
onMessage
(
MapRecord
<
String
,
String
,
String
>
message
)
{
log
.
info
(
"接受到来自redis REFUND 的消息"
);
System
.
out
.
println
(
"message id "
+
message
.
getId
());
System
.
out
.
println
(
"stream "
+
message
.
getStream
());
System
.
out
.
println
(
"body "
+
message
.
getValue
());
}
}
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/java/com/liquidnet/service/consumer/galaxy/utils/DataUtils.java
deleted
100644 → 0
View file @
af36347c
package
com
.
liquidnet
.
service
.
consumer
.
galaxy
.
utils
;
import
com.liquidnet.common.cache.redis.util.RedisUtil
;
import
com.liquidnet.commons.lang.util.BeanUtil
;
import
com.liquidnet.commons.lang.util.DateUtil
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.service.base.SqlMapping
;
import
com.liquidnet.service.base.constant.MQConst
;
import
com.liquidnet.service.galaxy.constant.GalaxyConstant
;
import
com.liquidnet.service.galaxy.dto.bo.GalaxyNftOrderBo
;
import
com.liquidnet.service.galaxy.dto.bo.GalaxySeriesNftInfoBo
;
import
com.liquidnet.service.galaxy.dto.bo.GalaxyUserInfoBo
;
import
com.liquidnet.service.galaxy.dto.vo.mongo.GalaxyNftOrderVo
;
import
com.liquidnet.service.galaxy.dto.vo.mongo.GalaxySeriesNftInfoVo
;
import
com.liquidnet.service.galaxy.dto.vo.mongo.GalaxyUserInfoVo
;
import
com.mongodb.client.result.UpdateResult
;
import
lombok.extern.slf4j.Slf4j
;
import
org.bson.Document
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Update
;
import
org.springframework.stereotype.Component
;
import
java.time.LocalDateTime
;
@Slf4j
@Component
public
class
DataUtils
{
@Autowired
private
RedisUtil
redisUtil
;
@Autowired
private
MongoTemplate
mongoTemplate
;
@Autowired
private
QueueUtil
queueUtil
;
private
long
keyExpireTime
=
3600
*
24
*
30
;
public
GalaxyUserInfoBo
getGalaxyUserInfo
(
String
routerType
,
String
userId
)
{
Object
obj
=
redisUtil
.
get
(
GalaxyConstant
.
REDIS_KEY_GALAXY_USER
.
concat
(
routerType
).
concat
(
":"
)
+
userId
);
if
(
obj
!=
null
){
return
(
GalaxyUserInfoBo
)
obj
;
}
else
{
GalaxyUserInfoVo
userInfoVo
=
mongoTemplate
.
findOne
(
Query
.
query
(
Criteria
.
where
(
"userId"
).
is
(
userId
)),
GalaxyUserInfoVo
.
class
,
GalaxyUserInfoVo
.
class
.
getSimpleName
());
if
(
userInfoVo
==
null
)
{
return
null
;
}
GalaxyUserInfoBo
userInfoBo
=
GalaxyUserInfoBo
.
getNew
();
BeanUtil
.
copy
(
userInfoVo
,
userInfoBo
);
redisUtil
.
set
(
GalaxyConstant
.
REDIS_KEY_GALAXY_USER
.
concat
(
routerType
).
concat
(
":"
)
+
userId
,
userInfoBo
);
return
userInfoBo
;
}
}
public
GalaxyNftOrderBo
getNftOrderBo
(
String
routerType
,
String
nftOrderPayId
)
{
Object
obj
=
redisUtil
.
get
(
GalaxyConstant
.
REDIS_KEY_GALAXY_TRADE
.
concat
(
routerType
).
concat
(
":"
)
+
nftOrderPayId
);
if
(
obj
!=
null
){
return
(
GalaxyNftOrderBo
)
obj
;
}
else
{
GalaxyNftOrderVo
nftOrderVo
=
mongoTemplate
.
findOne
(
Query
.
query
(
Criteria
.
where
(
"nftOrderPayId"
).
is
(
nftOrderPayId
)),
GalaxyNftOrderVo
.
class
,
GalaxyNftOrderVo
.
class
.
getSimpleName
());
if
(
nftOrderVo
==
null
)
{
return
null
;
}
GalaxyNftOrderBo
nftOrderBo
=
GalaxyNftOrderBo
.
getNew
();
BeanUtil
.
copy
(
nftOrderVo
,
nftOrderBo
);
redisUtil
.
set
(
GalaxyConstant
.
REDIS_KEY_GALAXY_TRADE
.
concat
(
routerType
).
concat
(
":"
)
+
nftOrderPayId
,
nftOrderBo
);
return
nftOrderBo
;
}
}
public
GalaxySeriesNftInfoBo
getSeriesNftInfoBo
(
String
routerType
,
String
skuId
)
{
Object
obj
=
redisUtil
.
get
(
GalaxyConstant
.
REDIS_KEY_GALAXY_SERIES_NFT
.
concat
(
routerType
).
concat
(
":"
)
+
skuId
);
if
(
obj
!=
null
){
return
(
GalaxySeriesNftInfoBo
)
obj
;
}
else
{
GalaxySeriesNftInfoVo
seriesNftInfoVo
=
mongoTemplate
.
findOne
(
Query
.
query
(
Criteria
.
where
(
"skuId"
).
is
(
skuId
)),
GalaxySeriesNftInfoVo
.
class
,
GalaxySeriesNftInfoVo
.
class
.
getSimpleName
());
if
(
seriesNftInfoVo
==
null
)
{
return
null
;
}
GalaxySeriesNftInfoBo
seriesNftInfoBo
=
GalaxySeriesNftInfoBo
.
getNew
();
BeanUtil
.
copy
(
seriesNftInfoVo
,
seriesNftInfoBo
);
redisUtil
.
set
(
GalaxyConstant
.
REDIS_KEY_GALAXY_SERIES_NFT
.
concat
(
routerType
).
concat
(
":"
)
+
skuId
,
seriesNftInfoBo
);
return
seriesNftInfoBo
;
}
}
public
void
updateNftOrderBuyTaskId
(
String
routerType
,
String
nftOrderPayId
,
GalaxyNftOrderBo
nftOrderBo
)
{
redisUtil
.
set
(
GalaxyConstant
.
REDIS_KEY_GALAXY_TRADE
.
concat
(
routerType
).
concat
(
":"
)
+
nftOrderPayId
,
nftOrderBo
,
keyExpireTime
);
Query
query
=
Query
.
query
(
Criteria
.
where
(
"nftOrderPayId"
).
is
(
nftOrderPayId
));
Update
update
=
Update
.
fromDocument
(
Document
.
parse
(
JsonUtils
.
toJson
(
nftOrderBo
)));
update
.
set
(
"nftBuyTaskId"
,
nftOrderBo
.
getNftBuyTaskId
());
String
nowTimeStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
LocalDateTime
.
now
());
update
.
set
(
"updatedAt"
,
nowTimeStr
);
UpdateResult
result
=
mongoTemplate
.
updateFirst
(
query
,
update
,
GalaxyNftOrderVo
.
class
,
GalaxyNftOrderVo
.
class
.
getSimpleName
());
log
.
info
(
"updateNftOrderInfo result:{}"
,
result
.
toString
());
try
{
queueUtil
.
sendMySqlRedis
(
SqlMapping
.
get
(
"galaxy_nft_order_info.updateNftBuyTaskId"
),
new
Object
[]{
nftOrderBo
.
getNftBuyTaskId
(),
LocalDateTime
.
now
(),
nftOrderBo
.
getNftOrderPayId
()}
,
MQConst
.
GalaxyQueue
.
SQL_NFT_TRADE_INFO
.
getKey
()
);
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
(),
e
);
log
.
error
(
"#setNftTradeInfo error ==> MESSAGE:{}"
,
e
.
getMessage
());
}
}
}
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/java/com/liquidnet/service/consumer/galaxy/utils/QueueUtil.java
deleted
100644 → 0
View file @
af36347c
package
com
.
liquidnet
.
service
.
consumer
.
galaxy
.
utils
;
import
com.liquidnet.service.base.SqlMapping
;
import
com.liquidnet.service.galaxy.utils.ObjectUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.connection.stream.MapRecord
;
import
org.springframework.data.redis.connection.stream.StreamRecords
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.LinkedList
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: QueueUtil
* @Package com.liquidnet.service.galaxy.utils
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/3/25 15:35
*/
@Component
public
class
QueueUtil
{
@Autowired
StringRedisTemplate
stringRedisTemplate
;
/**
* 给 REDIS 队列发送消息 数据库相关
*
* @param sql sql语句
* @param data 需要操作的数据
* @return
*/
public
boolean
sendMySqlRedis
(
String
sql
,
Object
[]
data
,
String
redisKey
)
{
try
{
LinkedList
<
String
>
sqls
=
ObjectUtil
.
cloneLinkedListStr
();
sqls
.
add
(
sql
);
LinkedList
<
Object
[]>
sqlsData
=
ObjectUtil
.
cloneLinkedListObj
();
sqlsData
.
add
(
data
);
String
sqlData
=
SqlMapping
.
gets
(
sqls
,
sqlsData
);
HashMap
<
String
,
String
>
map
=
ObjectUtil
.
cloneHashMapStringAndString
();
map
.
put
(
"message"
,
sqlData
);
MapRecord
<
String
,
String
,
String
>
record
=
StreamRecords
.
mapBacked
(
map
).
withStreamKey
(
redisKey
);
stringRedisTemplate
.
opsForStream
().
add
(
record
);
return
true
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
false
;
}
}
}
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/resources/bootstrap-dev.yml
deleted
100644 → 0
View file @
af36347c
# begin-dev-这里是配置信息基本值
liquidnet
:
cloudConfig
:
profile
:
dev
security
:
username
:
user
password
:
user123
eureka
:
host
:
172.17.192.42:7001
# host: 127.0.0.1:7001
# end-dev-这里是配置信息基本值
spring
:
profiles
:
include
:
service-consumer-galaxy
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/resources/bootstrap-prod.yml
deleted
100644 → 0
View file @
af36347c
# begin-prod-这里是配置信息基本值
liquidnet
:
cloudConfig
:
profile
:
prod
security
:
username
:
user
password
:
user123
eureka
:
host
:
172.17.207.189:7001
# end-prod-这里是配置信息基本值
spring
:
profiles
:
include
:
service-consumer-galaxy
\ No newline at end of file
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/resources/bootstrap-service-consumer-galaxy.yml
deleted
100644 → 0
View file @
af36347c
#eurekaServer配置
eureka
:
client
:
register-with-eureka
:
true
fetch-registry
:
true
serviceUrl
:
defaultZone
:
http://${liquidnet.security.username}:${liquidnet.security.password}@${liquidnet.eureka.host}/eureka-server/eureka
#configServer配置
spring
:
cloud
:
config
:
# uri: http://39.106.122.201:7002/support-config
profile
:
${liquidnet.cloudConfig.profile}
name
:
${spring.application.name}
#默认为spring.application.name
discovery
:
enabled
:
true
service-id
:
liquidnet-support-config
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/resources/bootstrap-test.yml
deleted
100644 → 0
View file @
af36347c
# begin-test-这里是配置信息基本值
liquidnet
:
cloudConfig
:
profile
:
test
security
:
username
:
user
password
:
user123
eureka
:
host
:
172.17.207.177:7001
#instance:
# prefer-ip-address: true
#host: eureka-test-0.eureka-test-svc.zhengzai-test:7001/eureka-server/eureka,eureka-test-1.eureka-test-svc.zhengzai-test:7001/eureka-server/eureka,eureka-test-2.eureka-test-svc.zhengzai-test:7001/eureka-server/eureka
#host: 192.168.193.41:7001
# end-test-这里是配置信息基本值
spring
:
profiles
:
include
:
service-consumer-galaxy
\ No newline at end of file
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-galaxy/src/main/resources/bootstrap.yml
deleted
100644 → 0
View file @
af36347c
spring
:
application
:
name
:
liquidnet-service-consumer-galaxy
profiles
:
active
:
dev
\ No newline at end of file
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