Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Jeepay
Commits
81c94049
Commit
81c94049
authored
Jun 28, 2021
by
xiaoyu
Browse files
增加RabbitMQ兼容
parent
7d78af1a
Changes
65
Hide whitespace changes
Inline
Side-by-side
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/service/MqModifySysConfigService.java
0 → 100644
View file @
81c94049
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.mgr.mq.service
;
/**
* mq消息中转抽象类
*
* @author xiaoyu
* @site https://www.jeepay.vip
* @date 2021/6/25 17:10
*/
public
abstract
class
MqModifySysConfigService
{
public
abstract
void
send
(
String
msg
);
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/service/MqPayOrderNotifyService.java
0 → 100644
View file @
81c94049
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.mgr.mq.service
;
/**
* mq消息中转抽象类
*
* @author xiaoyu
* @site https://www.jeepay.vip
* @date 2021/6/25 17:10
*/
public
abstract
class
MqPayOrderNotifyService
{
public
abstract
void
send
(
String
msg
);
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/service/MqServiceImpl.java
0 → 100644
View file @
81c94049
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.mgr.mq.service
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Collection
;
/**
* mq消息中转
*
* @author xiaoyu
* @site https://www.jeepay.vip
* @date 2021/6/25 17:10
*/
@Slf4j
@Service
public
class
MqServiceImpl
{
@Autowired
private
MqMchUserRemoveService
mqMchUserRemoveService
;
@Autowired
private
MqPayOrderNotifyService
mqPayOrderNotifyService
;
@Autowired
private
MqModifyIsvInfoService
mqModifyIsvInfoService
;
@Autowired
private
MqModifyMchInfoService
mqModifyMchInfoService
;
@Autowired
private
MqModifyMchAppService
mqModifyMchAppService
;
@Autowired
private
MqModifySysConfigService
mqModifySysConfigService
;
/** 删除商户用户信息 **/
public
void
sendUserRemove
(
Collection
<
Long
>
userIdList
){
mqMchUserRemoveService
.
send
(
userIdList
);
}
/** 订单回调信息 **/
public
void
sendPayOrderNotify
(
String
msg
){
mqPayOrderNotifyService
.
send
(
msg
);
}
/** 服务商修改推送 **/
public
void
sendModifyIsvInfo
(
String
msg
){
mqModifyIsvInfoService
.
send
(
msg
);
}
/** 商户修改推送 **/
public
void
sendModifyMchInfo
(
String
msg
){
mqModifyMchInfoService
.
send
(
msg
);
}
/** 商户应用修改推送 **/
public
void
sendModifyMchApp
(
String
mchNo
,
String
appId
){
mqModifyMchAppService
.
send
(
mchNo
,
appId
);
}
/** 系统配置修改推送 **/
public
void
sendModifySysConfig
(
String
msg
){
mqModifySysConfigService
.
send
(
msg
);
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/topic/JMSConfig.java
View file @
81c94049
...
...
@@ -15,7 +15,9 @@
*/
package
com.jeequan.jeepay.mgr.mq.topic
;
import
com.jeequan.jeepay.core.constants.CS
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Profile
;
import
org.springframework.jms.config.DefaultJmsListenerContainerFactory
;
import
org.springframework.jms.config.JmsListenerContainerFactory
;
import
org.springframework.stereotype.Component
;
...
...
@@ -30,6 +32,7 @@ import javax.jms.ConnectionFactory;
* @date 2021/6/8 17:10
*/
@Component
@Profile
(
CS
.
MQTYPE
.
ACTIVE_MQ
)
public
class
JMSConfig
{
/** 新增jmsListenerContainer, 用于接收topic类型的消息 **/
...
...
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/topic/MqTopic4ModifyIsvInfo.java
View file @
81c94049
...
...
@@ -16,9 +16,14 @@
package
com.jeequan.jeepay.mgr.mq.topic
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.mgr.mq.service.MqModifyIsvInfoService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.activemq.command.ActiveMQTopic
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.context.annotation.Profile
;
import
org.springframework.jms.core.JmsTemplate
;
import
org.springframework.stereotype.Component
;
...
...
@@ -31,17 +36,24 @@ import org.springframework.stereotype.Component;
*/
@Slf4j
@Component
public
class
MqTopic4ModifyIsvInfo
extends
ActiveMQTopic
{
@Profile
(
CS
.
MQTYPE
.
ACTIVE_MQ
)
public
class
MqTopic4ModifyIsvInfo
extends
MqModifyIsvInfoService
{
@Autowired
private
JmsTemplate
jmsTemplate
;
public
MqTopic4ModifyIsvInfo
(){
super
(
CS
.
MQ
.
TOPIC_MODIFY_ISV_INFO
);
@Bean
(
"modifyIsvInfo"
)
public
ActiveMQTopic
mqTopic4ModifyIsvInfo
(){
return
new
ActiveMQTopic
(
CS
.
MQ
.
TOPIC_MODIFY_ISV_INFO
);
}
/** 推送消息到各个节点 **/
public
void
push
(
String
isvNo
)
{
this
.
jmsTemplate
.
convertAndSend
(
this
,
isvNo
);
@Lazy
@Autowired
@Qualifier
(
"modifyIsvInfo"
)
private
ActiveMQTopic
mqTopic4ModifyIsvInfo
;
@Override
public
void
send
(
String
msg
)
{
this
.
jmsTemplate
.
convertAndSend
(
mqTopic4ModifyIsvInfo
,
msg
);
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/topic/MqTopic4ModifyMchApp.java
View file @
81c94049
...
...
@@ -18,9 +18,14 @@ package com.jeequan.jeepay.mgr.mq.topic;
import
com.alibaba.fastjson.JSONObject
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.core.utils.JsonKit
;
import
com.jeequan.jeepay.mgr.mq.service.MqModifyMchAppService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.activemq.command.ActiveMQTopic
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.context.annotation.Profile
;
import
org.springframework.jms.core.JmsTemplate
;
import
org.springframework.stereotype.Component
;
...
...
@@ -33,20 +38,27 @@ import org.springframework.stereotype.Component;
*/
@Slf4j
@Component
public
class
MqTopic4ModifyMchApp
extends
ActiveMQTopic
{
@Profile
(
CS
.
MQTYPE
.
ACTIVE_MQ
)
public
class
MqTopic4ModifyMchApp
extends
MqModifyMchAppService
{
@Autowired
private
JmsTemplate
jmsTemplate
;
public
MqTopic4ModifyMchApp
(){
super
(
CS
.
MQ
.
TOPIC_MODIFY_MCH_APP
);
@Bean
(
"modifyMchApp"
)
public
ActiveMQTopic
mqTopic4ModifyMchApp
(){
return
new
ActiveMQTopic
(
CS
.
MQ
.
TOPIC_MODIFY_MCH_APP
);
}
@Lazy
@Autowired
@Qualifier
(
"modifyMchApp"
)
private
ActiveMQTopic
mqTopic4ModifyMchApp
;
/** 推送消息到各个节点 **/
public
void
push
(
String
mchNo
,
String
appId
)
{
@Override
public
void
send
(
String
mchNo
,
String
appId
)
{
JSONObject
jsonObject
=
JsonKit
.
newJson
(
"mchNo"
,
mchNo
);
jsonObject
.
put
(
"appId"
,
appId
);
this
.
jmsTemplate
.
convertAndSend
(
this
,
jsonObject
.
toString
());
this
.
jmsTemplate
.
convertAndSend
(
mqTopic4ModifyMchApp
,
jsonObject
.
toString
());
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/topic/MqTopic4ModifyMchInfo.java
View file @
81c94049
...
...
@@ -16,9 +16,14 @@
package
com.jeequan.jeepay.mgr.mq.topic
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.mgr.mq.service.MqModifyMchInfoService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.activemq.command.ActiveMQTopic
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.context.annotation.Profile
;
import
org.springframework.jms.core.JmsTemplate
;
import
org.springframework.stereotype.Component
;
...
...
@@ -31,20 +36,23 @@ import org.springframework.stereotype.Component;
*/
@Slf4j
@Component
public
class
MqTopic4ModifyMchInfo
extends
ActiveMQTopic
{
@Profile
(
CS
.
MQTYPE
.
ACTIVE_MQ
)
public
class
MqTopic4ModifyMchInfo
extends
MqModifyMchInfoService
{
@Autowired
private
JmsTemplate
jmsTemplate
;
public
MqTopic4ModifyMchInfo
(){
super
(
CS
.
MQ
.
TOPIC_MODIFY_MCH_INFO
);
@Bean
(
"modifyMchInfo"
)
public
ActiveMQTopic
mqTopic4ModifyMchInfo
(){
return
new
ActiveMQTopic
(
CS
.
MQ
.
TOPIC_MODIFY_MCH_INFO
);
}
/** 推送消息到各个节点 **/
public
void
push
(
String
mchNo
)
{
this
.
jmsTemplate
.
convertAndSend
(
this
,
mchNo
);
}
@Lazy
@Autowired
@Qualifier
(
"modifyMchInfo"
)
private
ActiveMQTopic
mqTopic4ModifyMchInfo
;
@Override
public
void
send
(
String
mchNo
)
{
this
.
jmsTemplate
.
convertAndSend
(
mqTopic4ModifyMchInfo
,
mchNo
);
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/topic/MqTopic4ModifySysConfig.java
View file @
81c94049
...
...
@@ -16,10 +16,15 @@
package
com.jeequan.jeepay.mgr.mq.topic
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.mgr.mq.service.MqModifySysConfigService
;
import
com.jeequan.jeepay.service.impl.SysConfigService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.activemq.command.ActiveMQTopic
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.context.annotation.Profile
;
import
org.springframework.jms.annotation.JmsListener
;
import
org.springframework.jms.core.JmsTemplate
;
import
org.springframework.stereotype.Component
;
...
...
@@ -33,15 +38,22 @@ import org.springframework.stereotype.Component;
*/
@Slf4j
@Component
public
class
MqTopic4ModifySysConfig
extends
ActiveMQTopic
{
@Profile
(
CS
.
MQTYPE
.
ACTIVE_MQ
)
public
class
MqTopic4ModifySysConfig
extends
MqModifySysConfigService
{
@Autowired
private
JmsTemplate
jmsTemplate
;
@Autowired
private
SysConfigService
sysConfigService
;
public
MqTopic4ModifySysConfig
(){
super
(
CS
.
MQ
.
TOPIC_MODIFY_SYS_CONFIG
);
@Bean
(
"modifySysConfig"
)
public
ActiveMQTopic
mqTopic4ModifySysConfig
(){
return
new
ActiveMQTopic
(
CS
.
MQ
.
TOPIC_MODIFY_SYS_CONFIG
);
}
@Lazy
@Autowired
@Qualifier
(
"modifySysConfig"
)
private
ActiveMQTopic
mqTopic4ModifySysConfig
;
/** 接收 更新系统配置项的消息 **/
@JmsListener
(
destination
=
CS
.
MQ
.
TOPIC_MODIFY_SYS_CONFIG
,
containerFactory
=
"jmsListenerContainer"
)
public
void
receive
(
String
msg
)
{
...
...
@@ -52,8 +64,9 @@ public class MqTopic4ModifySysConfig extends ActiveMQTopic{
}
/** 推送消息到各个节点 **/
public
void
push
(
String
msg
)
{
this
.
jmsTemplate
.
convertAndSend
(
this
,
msg
);
@Override
public
void
send
(
String
msg
)
{
this
.
jmsTemplate
.
convertAndSend
(
mqTopic4ModifySysConfig
,
msg
);
}
...
...
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/topic/RabbitMqConfig.java
0 → 100644
View file @
81c94049
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.mgr.mq.topic
;
import
com.jeequan.jeepay.core.constants.CS
;
import
org.springframework.amqp.core.*
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Profile
;
/**
* RabbitMq
* 队列交换机注册
* @author xiaoyu
* @site https://www.jeepay.vip
* @date 2021/6/25 17:10
*/
@Profile
(
CS
.
MQTYPE
.
RABBIT_MQ
)
@Configuration
public
class
RabbitMqConfig
{
@Bean
(
"modifyIsvInfo"
)
public
Queue
modifyIsvInfo
()
{
return
new
Queue
(
CS
.
MQ
.
TOPIC_MODIFY_ISV_INFO
,
true
);
}
@Bean
(
"modifyMchApp"
)
public
Queue
modifyMchApp
()
{
return
new
Queue
(
CS
.
MQ
.
TOPIC_MODIFY_MCH_APP
,
true
);
}
@Bean
(
"modifyMchInfo"
)
public
Queue
modifyMchInfo
()
{
return
new
Queue
(
CS
.
MQ
.
TOPIC_MODIFY_MCH_INFO
,
true
);
}
@Bean
(
"modifySysConfig"
)
public
Queue
modifySysConfig
()
{
return
new
Queue
(
CS
.
MQ
.
TOPIC_MODIFY_SYS_CONFIG
,
true
);
}
@Bean
(
"payOrderMchNotify"
)
public
Queue
payOrderMchNotify
()
{
return
new
Queue
(
CS
.
MQ
.
QUEUE_PAYORDER_MCH_NOTIFY
,
true
);
}
@Bean
(
"mchUserRemove"
)
public
Queue
mchUserRemove
()
{
return
new
Queue
(
CS
.
MQ
.
QUEUE_MODIFY_MCH_USER_REMOVE
,
true
);
}
//Topic交换机 起名:topicExchange
@Bean
(
"topicExchange"
)
TopicExchange
topicExchange
()
{
return
new
TopicExchange
(
CS
.
TOPIC_EXCHANGE
,
true
,
false
);
}
//交换机 起名:directExchange
@Bean
(
"directExchange"
)
DirectExchange
directExchange
()
{
return
new
DirectExchange
(
CS
.
DIRECT_EXCHANGE
,
true
,
false
);
}
//绑定 将队列和交换机绑定, 并设置用于匹配键:TOPIC_MODIFY_ISV_INFO
@Bean
Binding
bindingIsvInfo
(
@Qualifier
(
"modifyIsvInfo"
)
Queue
modifyIsvInfo
,
@Qualifier
(
"topicExchange"
)
TopicExchange
topicExchange
)
{
return
BindingBuilder
.
bind
(
modifyIsvInfo
).
to
(
topicExchange
).
with
(
CS
.
MQ
.
TOPIC_MODIFY_ISV_INFO
);
}
//绑定 将队列和交换机绑定, 并设置用于匹配键:TOPIC_MODIFY_MCH_APP
@Bean
Binding
bindingMchApp
(
@Qualifier
(
"modifyMchApp"
)
Queue
modifyMchApp
,
@Qualifier
(
"topicExchange"
)
TopicExchange
topicExchange
)
{
return
BindingBuilder
.
bind
(
modifyMchApp
).
to
(
topicExchange
).
with
(
CS
.
MQ
.
TOPIC_MODIFY_MCH_APP
);
}
//绑定 将队列和交换机绑定, 并设置用于匹配键:TOPIC_MODIFY_MCH_INFO
@Bean
Binding
bindingMchInfo
(
@Qualifier
(
"modifyMchInfo"
)
Queue
modifyMchInfo
,
@Qualifier
(
"topicExchange"
)
TopicExchange
topicExchange
)
{
return
BindingBuilder
.
bind
(
modifyMchInfo
).
to
(
topicExchange
).
with
(
CS
.
MQ
.
TOPIC_MODIFY_MCH_INFO
);
}
//绑定 将队列和交换机绑定, 并设置用于匹配键:TOPIC_MODIFY_SYS_CONFIG
@Bean
Binding
bindingSysConfig
(
@Qualifier
(
"modifySysConfig"
)
Queue
modifySysConfig
,
@Qualifier
(
"topicExchange"
)
TopicExchange
topicExchange
)
{
return
BindingBuilder
.
bind
(
modifySysConfig
).
to
(
topicExchange
).
with
(
CS
.
MQ
.
TOPIC_MODIFY_SYS_CONFIG
);
}
//绑定 将队列和交换机绑定, 并设置用于匹配键:QUEUE_PAYORDER_MCH_NOTIFY
@Bean
Binding
bindingPayOrderMchNotify
(
@Qualifier
(
"payOrderMchNotify"
)
Queue
payOrderMchNotify
,
@Qualifier
(
"directExchange"
)
DirectExchange
directExchange
)
{
return
BindingBuilder
.
bind
(
payOrderMchNotify
).
to
(
directExchange
).
with
(
CS
.
MQ
.
QUEUE_PAYORDER_MCH_NOTIFY
);
}
//绑定 将队列和交换机绑定, 并设置用于匹配键:QUEUE_MODIFY_MCH_USER_REMOVE
@Bean
Binding
bindingMchUserRemove
(
@Qualifier
(
"mchUserRemove"
)
Queue
mchUserRemove
,
@Qualifier
(
"directExchange"
)
DirectExchange
directExchange
)
{
return
BindingBuilder
.
bind
(
mchUserRemove
).
to
(
directExchange
).
with
(
CS
.
MQ
.
QUEUE_MODIFY_MCH_USER_REMOVE
);
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/topic/RabbitMqTopic4ModifyIsvInfo.java
0 → 100644
View file @
81c94049
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.mgr.mq.topic
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.mgr.mq.service.MqModifyIsvInfoService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.activemq.command.ActiveMQTopic
;
import
org.springframework.amqp.rabbit.core.RabbitTemplate
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Profile
;
import
org.springframework.jms.core.JmsTemplate
;
import
org.springframework.stereotype.Component
;
/**
* RabbitMq
* 服务商信息修改推送
* @author xiaoyu
* @site https://www.jeepay.vip
* @date 2021/6/25 17:10
*/
@Component
@Profile
(
CS
.
MQTYPE
.
RABBIT_MQ
)
public
class
RabbitMqTopic4ModifyIsvInfo
extends
MqModifyIsvInfoService
{
@Autowired
private
RabbitTemplate
rabbitTemplate
;
@Override
public
void
send
(
String
msg
)
{
rabbitTemplate
.
convertAndSend
(
CS
.
TOPIC_EXCHANGE
,
CS
.
MQ
.
TOPIC_MODIFY_ISV_INFO
,
msg
);
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/topic/RabbitMqTopic4ModifyMchApp.java
0 → 100644
View file @
81c94049
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.mgr.mq.topic
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.core.utils.JsonKit
;
import
com.jeequan.jeepay.mgr.mq.service.MqModifyMchAppService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.activemq.command.ActiveMQTopic
;
import
org.springframework.amqp.rabbit.core.RabbitTemplate
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Profile
;
import
org.springframework.jms.core.JmsTemplate
;
import
org.springframework.stereotype.Component
;
/**
* RabbitMq
* 商户应用修改推送
* @author xiaoyu
* @site https://www.jeepay.vip
* @date 2021/6/25 17:10
*/
@Component
@Profile
(
CS
.
MQTYPE
.
RABBIT_MQ
)
public
class
RabbitMqTopic4ModifyMchApp
extends
MqModifyMchAppService
{
@Autowired
private
RabbitTemplate
rabbitTemplate
;
/** 推送消息到各个节点 **/
@Override
public
void
send
(
String
mchNo
,
String
appId
)
{
JSONObject
jsonObject
=
JsonKit
.
newJson
(
"mchNo"
,
mchNo
);
jsonObject
.
put
(
"appId"
,
appId
);
rabbitTemplate
.
convertAndSend
(
CS
.
TOPIC_EXCHANGE
,
CS
.
MQ
.
TOPIC_MODIFY_ISV_INFO
,
jsonObject
.
toString
());
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/topic/RabbitMqTopic4ModifyMchInfo.java
0 → 100644
View file @
81c94049
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.mgr.mq.topic
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.mgr.mq.service.MqModifyMchInfoService
;
import
org.springframework.amqp.rabbit.core.RabbitTemplate
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Profile
;
import
org.springframework.stereotype.Component
;
/**
* RabbitMq
* 商户信息修改推送
* @author xiaoyu
* @site https://www.jeepay.vip
* @date 2021/6/25 17:10
*/
@Component
@Profile
(
CS
.
MQTYPE
.
RABBIT_MQ
)
public
class
RabbitMqTopic4ModifyMchInfo
extends
MqModifyMchInfoService
{
@Autowired
private
RabbitTemplate
rabbitTemplate
;
/** 推送消息到各个节点 **/
@Override
public
void
send
(
String
mchNo
)
{
rabbitTemplate
.
convertAndSend
(
CS
.
TOPIC_EXCHANGE
,
CS
.
MQ
.
TOPIC_MODIFY_MCH_INFO
,
mchNo
);
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/topic/RabbitMqTopic4ModifySysConfig.java
0 → 100644
View file @
81c94049
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.mgr.mq.topic
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.mgr.mq.service.MqModifyMchInfoService
;
import
com.jeequan.jeepay.mgr.mq.service.MqModifySysConfigService
;
import
com.jeequan.jeepay.service.impl.SysConfigService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.amqp.rabbit.annotation.RabbitListener
;
import
org.springframework.amqp.rabbit.core.RabbitTemplate
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Profile
;
import
org.springframework.jms.annotation.JmsListener
;
import
org.springframework.stereotype.Component
;
/**
* RabbitMq
* 系统信息修改推送
* @author xiaoyu
* @site https://www.jeepay.vip
* @date 2021/6/25 17:10
*/
@Slf4j
@Component
@Profile
(
CS
.
MQTYPE
.
RABBIT_MQ
)
public
class
RabbitMqTopic4ModifySysConfig
extends
MqModifySysConfigService
{
@Autowired
private
RabbitTemplate
rabbitTemplate
;
@Autowired
private
SysConfigService
sysConfigService
;
/** 接收 更新系统配置项的消息 **/
@RabbitListener
(
queues
=
CS
.
MQ
.
TOPIC_MODIFY_SYS_CONFIG
)
public
void
receive
(
String
msg
)
{
log
.
info
(
"成功接收更新系统配置的订阅通知, msg={}"
,
msg
);
sysConfigService
.
initDBConfig
(
msg
);
log
.
info
(
"系统配置静态属性已重置"
);
}
/** 推送消息到各个节点 **/
@Override
public
void
send
(
String
msg
)
{
rabbitTemplate
.
convertAndSend
(
CS
.
TOPIC_EXCHANGE
,
CS
.
MQ
.
TOPIC_MODIFY_SYS_CONFIG
,
msg
);
}
}
jeepay-manager/src/main/resources/application.yml
View file @
81c94049
...
...
@@ -51,8 +51,8 @@ spring:
database
:
1
#1库:运营平台 #2库:商户系统 #3库:支付网关
password
:
#activeMQ配置
activemq
:
broker-url
:
tcp://localhost:61616
#连接地址
#
activemq:
#
broker-url: tcp://localhost:61616 #连接地址
#日志配置参数。
# 当存在logback-spring.xml文件时: 该配置将引进到logback配置, springboot配置不生效。
...
...
jeepay-merchant/pom.xml
View file @
81c94049
...
...
@@ -89,6 +89,12 @@
<artifactId>
spring-boot-starter-activemq
</artifactId>
</dependency>
<!-- 添加对rabbitMQ的支持 -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-amqp
</artifactId>
</dependency>
<!-- 引入 jeepay-sdk-java -->
<dependency>
<groupId>
com.jeequan
</groupId>
...
...
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/ctrl/merchant/MchAppController.java
View file @
81c94049
...
...
@@ -24,9 +24,8 @@ import com.jeequan.jeepay.core.entity.MchApp;
import
com.jeequan.jeepay.core.exception.BizException
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mch.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mch.mq.
top
ic.Mq
Topic4ModifyMchApp
;
import
com.jeequan.jeepay.mch.mq.
serv
ic
e
.Mq
ServiceImpl
;
import
com.jeequan.jeepay.service.impl.MchAppService
;
import
com.jeequan.jeepay.service.impl.MchInfoService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
...
...
@@ -44,7 +43,7 @@ import org.springframework.web.bind.annotation.*;
public
class
MchAppController
extends
CommonCtrl
{
@Autowired
private
MchAppService
mchAppService
;
@Autowired
private
Mq
Topic4ModifyMchApp
mqTopic4ModifyMchApp
;
@Autowired
private
Mq
ServiceImpl
mqService
;
/**
* @Author: ZhuXiao
...
...
@@ -126,7 +125,7 @@ public class MchAppController extends CommonCtrl {
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_UPDATE
);
}
// 推送修改应用消息
mq
Topic4
ModifyMchApp
.
push
(
getCurrentMchNo
(),
mchApp
.
getAppId
());
mq
Service
.
send
ModifyMchApp
(
getCurrentMchNo
(),
mchApp
.
getAppId
());
return
ApiRes
.
ok
();
}
...
...
@@ -148,7 +147,7 @@ public class MchAppController extends CommonCtrl {
mchAppService
.
removeByAppId
(
appId
);
// 推送mq到目前节点进行更新数据
mq
Topic4
ModifyMchApp
.
push
(
getCurrentMchNo
(),
appId
);
mq
Service
.
send
ModifyMchApp
(
getCurrentMchNo
(),
appId
);
return
ApiRes
.
ok
();
}
...
...
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/ctrl/merchant/MchPayInterfaceConfigController.java
View file @
81c94049
...
...
@@ -23,7 +23,7 @@ import com.jeequan.jeepay.core.entity.PayInterfaceDefine;
import
com.jeequan.jeepay.core.exception.BizException
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mch.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mch.mq.
top
ic.Mq
Topic4ModifyMchApp
;
import
com.jeequan.jeepay.mch.mq.
serv
ic
e
.Mq
ServiceImpl
;
import
com.jeequan.jeepay.service.impl.MchInfoService
;
import
com.jeequan.jeepay.service.impl.PayInterfaceConfigService
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -45,7 +45,7 @@ import java.util.List;
public
class
MchPayInterfaceConfigController
extends
CommonCtrl
{
@Autowired
private
PayInterfaceConfigService
payInterfaceConfigService
;
@Autowired
private
Mq
Topic4ModifyMchApp
mqTopic4ModifyMchApp
;
@Autowired
private
Mq
ServiceImpl
mqService
;
@Autowired
private
MchInfoService
mchInfoService
;
/**
...
...
@@ -125,7 +125,7 @@ public class MchPayInterfaceConfigController extends CommonCtrl {
throw
new
BizException
(
"配置失败"
);
}
mq
Topic4
ModifyMchApp
.
push
(
getCurrentMchNo
(),
infoId
);
// 推送mq到目前节点进行更新数据
mq
Service
.
send
ModifyMchApp
(
getCurrentMchNo
(),
infoId
);
// 推送mq到目前节点进行更新数据
return
ApiRes
.
ok
();
}
...
...
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/queue/MqQueue4ModifyMchUserRemove.java
View file @
81c94049
...
...
@@ -20,16 +20,15 @@ import com.jeequan.jeepay.core.cache.RedisUtil;
import
com.jeequan.jeepay.core.constants.CS
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.activemq.command.ActiveMQQueue
;
import
org.springframework.context.annotation.Profile
;
import
org.springframework.jms.annotation.JmsListener
;
import
org.springframework.stereotype.Component
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
*
更新商户配置mq
*
商户用户登录信息清除
*
* @author pangxiaoyu
* @site https://www.jeepay.vip
...
...
@@ -37,6 +36,7 @@ import java.util.stream.Collectors;
*/
@Slf4j
@Component
@Profile
(
CS
.
MQTYPE
.
ACTIVE_MQ
)
public
class
MqQueue4ModifyMchUserRemove
extends
ActiveMQQueue
{
public
MqQueue4ModifyMchUserRemove
(){
...
...
@@ -46,7 +46,7 @@ public class MqQueue4ModifyMchUserRemove extends ActiveMQQueue {
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:17
* @describe: 接收
更新系统配置项的
消息
* @describe: 接收
商户用户登录信息清除
消息
*/
@JmsListener
(
destination
=
CS
.
MQ
.
QUEUE_MODIFY_MCH_USER_REMOVE
)
public
void
receive
(
String
userIdStr
)
{
...
...
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/queue/RabbitMqQueue4ModifyMchUserRemove.java
0 → 100644
View file @
81c94049
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.mch.mq.queue
;
import
com.alibaba.fastjson.JSONArray
;
import
com.jeequan.jeepay.core.cache.RedisUtil
;
import
com.jeequan.jeepay.core.constants.CS
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.amqp.rabbit.annotation.RabbitHandler
;
import
org.springframework.amqp.rabbit.annotation.RabbitListener
;
import
org.springframework.context.annotation.Profile
;
import
org.springframework.stereotype.Component
;
import
java.util.Collection
;
import
java.util.List
;
/**
* 商户用户登录信息清除
*
* @author pangxiaoyu
* @site https://www.jeepay.vip
* @date 2021-04-27 15:50
*/
@Slf4j
@Component
@Profile
(
CS
.
MQTYPE
.
RABBIT_MQ
)
public
class
RabbitMqQueue4ModifyMchUserRemove
{
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:17
* @describe: 接收 商户用户登录信息清除消息
*/
@RabbitListener
(
queues
=
CS
.
MQ
.
QUEUE_MODIFY_MCH_USER_REMOVE
)
public
void
receive
(
String
userIdStr
)
{
log
.
info
(
"成功接收删除商户用户登录的订阅通知, msg={}"
,
userIdStr
);
// 字符串转List<Long>
List
<
Long
>
userIdList
=
JSONArray
.
parseArray
(
userIdStr
,
Long
.
class
);
// 删除redis用户缓存
if
(
userIdList
==
null
||
userIdList
.
isEmpty
()){
log
.
info
(
"用户ID为空"
);
return
;
}
for
(
Long
sysUserId
:
userIdList
)
{
Collection
<
String
>
cacheKeyList
=
RedisUtil
.
keys
(
CS
.
getCacheKeyToken
(
sysUserId
,
"*"
));
if
(
cacheKeyList
==
null
||
cacheKeyList
.
isEmpty
()){
continue
;
}
for
(
String
cacheKey
:
cacheKeyList
)
{
// 删除用户Redis信息
RedisUtil
.
del
(
cacheKey
);
continue
;
}
}
log
.
info
(
"无权限登录用户信息已清除"
);
}
}
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/service/MqModifyMchAppService.java
0 → 100644
View file @
81c94049
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.mch.mq.service
;
/**
* mq消息中转抽象类
*
* @author xiaoyu
* @site https://www.jeepay.vip
* @date 2021/6/25 17:10
*/
public
abstract
class
MqModifyMchAppService
{
public
abstract
void
send
(
String
mchNo
,
String
appId
);
}
Prev
1
2
3
4
Next
Write
Preview
Supports
Markdown
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