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
010d8799
Commit
010d8799
authored
Jul 03, 2021
by
xiaoyu
Browse files
mq优化
parent
a4ed4566
Changes
36
Hide whitespace changes
Inline
Side-by-side
jeepay-core/src/main/java/com/jeequan/jeepay/core/constants/CS.java
View file @
010d8799
...
...
@@ -148,12 +148,15 @@ public class CS {
/** 清除商户登录用户信息 **/
String
QUEUE_MODIFY_MCH_USER_REMOVE
=
"queue.modify.mch.user.remove"
;
/** 用于activemq 发布订阅模式交换机**/
String
FANOUT_MODIFY_SYS_CONFIG
=
"fanout.modify.sys.config"
;
}
/** RabbitMQ交换机类型 **/
public
static
final
String
TOPIC_EXCHANGE
=
"topicExchange"
;
public
static
final
String
DIRECT_EXCHANGE
=
"directExchange"
;
public
static
final
String
DELAYED_EXCHANGE
=
"delayedExchange"
;
// 延迟交换机
public
static
final
String
FANOUT_EXCHANGE_SYS_CONFIG
=
"fanoutExchangeSysConfig"
;
/** 切换MQ的类型 **/
public
static
class
MQTYPE
{
public
static
final
String
ACTIVE_MQ
=
"activeMQ"
;
...
...
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/config/SysConfigController.java
View file @
010d8799
...
...
@@ -22,7 +22,7 @@ import com.jeequan.jeepay.core.constants.ApiCodeEnum;
import
com.jeequan.jeepay.core.entity.SysConfig
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mgr.mq.service.MqServiceImpl
;
import
com.jeequan.jeepay.mgr.mq.service.MqSe
ndSe
rviceImpl
;
import
com.jeequan.jeepay.service.impl.SysConfigService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -49,7 +49,7 @@ import java.util.Map;
public
class
SysConfigController
extends
CommonCtrl
{
@Autowired
private
SysConfigService
sysConfigService
;
@Autowired
private
MqServiceImpl
mqService
;
@Autowired
private
MqSe
ndSe
rviceImpl
mqSe
ndSe
rvice
Impl
;
/**
...
...
@@ -84,7 +84,7 @@ public class SysConfigController extends CommonCtrl {
int
update
=
sysConfigService
.
updateByConfigKey
(
updateMap
);
if
(
update
<=
0
)
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYSTEM_ERROR
,
"更新失败"
);
mqService
.
sendModifySysConfig
(
groupKey
);
mqSe
ndSe
rvice
Impl
.
sendModifySysConfig
(
groupKey
);
return
ApiRes
.
ok
();
}
...
...
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/isv/IsvInfoController.java
View file @
010d8799
...
...
@@ -23,7 +23,7 @@ import com.jeequan.jeepay.core.constants.ApiCodeEnum;
import
com.jeequan.jeepay.core.entity.IsvInfo
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mgr.mq.service.MqServiceImpl
;
import
com.jeequan.jeepay.mgr.mq.service.MqSe
ndSe
rviceImpl
;
import
com.jeequan.jeepay.service.impl.IsvInfoService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -45,7 +45,7 @@ import org.springframework.web.bind.annotation.RestController;
public
class
IsvInfoController
extends
CommonCtrl
{
@Autowired
private
IsvInfoService
isvInfoService
;
@Autowired
private
MqServiceImpl
mqServiceImpl
;
@Autowired
private
MqSe
ndSe
rviceImpl
mqSe
ndSe
rviceImpl
;
/**
* @author: pangxiaoyu
...
...
@@ -95,7 +95,7 @@ public class IsvInfoController extends CommonCtrl {
@RequestMapping
(
value
=
"/{isvNo}"
,
method
=
RequestMethod
.
DELETE
)
public
ApiRes
delete
(
@PathVariable
(
"isvNo"
)
String
isvNo
)
{
isvInfoService
.
removeByIsvNo
(
isvNo
);
mqServiceImpl
.
sendModifyIsvInfo
(
isvNo
);
// 推送mq到目前节点进行更新数据
mqSe
ndSe
rviceImpl
.
sendModifyIsvInfo
(
isvNo
);
// 推送mq到目前节点进行更新数据
return
ApiRes
.
ok
();
}
...
...
@@ -111,7 +111,7 @@ public class IsvInfoController extends CommonCtrl {
IsvInfo
isvInfo
=
getObject
(
IsvInfo
.
class
);
isvInfo
.
setIsvNo
(
isvNo
);
boolean
result
=
isvInfoService
.
updateById
(
isvInfo
);
mqServiceImpl
.
sendModifyIsvInfo
(
isvNo
);
// 推送mq到目前节点进行更新数据
mqSe
ndSe
rviceImpl
.
sendModifyIsvInfo
(
isvNo
);
// 推送mq到目前节点进行更新数据
if
(!
result
)
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_UPDATE
);
return
ApiRes
.
ok
();
}
...
...
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/isv/IsvPayInterfaceConfigController.java
View file @
010d8799
...
...
@@ -22,7 +22,7 @@ import com.jeequan.jeepay.core.entity.PayInterfaceConfig;
import
com.jeequan.jeepay.core.entity.PayInterfaceDefine
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mgr.mq.service.MqServiceImpl
;
import
com.jeequan.jeepay.mgr.mq.service.MqSe
ndSe
rviceImpl
;
import
com.jeequan.jeepay.service.impl.PayInterfaceConfigService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
...
...
@@ -43,7 +43,7 @@ import java.util.List;
public
class
IsvPayInterfaceConfigController
extends
CommonCtrl
{
@Autowired
private
PayInterfaceConfigService
payInterfaceConfigService
;
@Autowired
private
MqServiceImpl
mqServiceImpl
;
@Autowired
private
MqSe
ndSe
rviceImpl
mqSe
ndSe
rviceImpl
;
/**
* @Author: ZhuXiao
...
...
@@ -114,7 +114,7 @@ public class IsvPayInterfaceConfigController extends CommonCtrl {
if
(!
result
)
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYSTEM_ERROR
,
"配置失败"
);
}
mqServiceImpl
.
sendModifyIsvInfo
(
infoId
);
// 推送mq到目前节点进行更新数据
mqSe
ndSe
rviceImpl
.
sendModifyIsvInfo
(
infoId
);
// 推送mq到目前节点进行更新数据
return
ApiRes
.
ok
();
}
...
...
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/merchant/MchAppController.java
View file @
010d8799
...
...
@@ -23,7 +23,7 @@ import com.jeequan.jeepay.core.constants.ApiCodeEnum;
import
com.jeequan.jeepay.core.entity.MchApp
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mgr.mq.service.MqServiceImpl
;
import
com.jeequan.jeepay.mgr.mq.service.MqSe
ndSe
rviceImpl
;
import
com.jeequan.jeepay.service.impl.MchAppService
;
import
com.jeequan.jeepay.service.impl.MchInfoService
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -44,7 +44,7 @@ public class MchAppController extends CommonCtrl {
@Autowired
private
MchInfoService
mchInfoService
;
@Autowired
private
MchAppService
mchAppService
;
@Autowired
private
MqServiceImpl
mqServiceImpl
;
@Autowired
private
MqSe
ndSe
rviceImpl
mqSe
ndSe
rviceImpl
;
/**
* @Author: ZhuXiao
...
...
@@ -122,7 +122,7 @@ public class MchAppController extends CommonCtrl {
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_UPDATE
);
}
// 推送修改应用消息
mqServiceImpl
.
sendModifyMchApp
(
mchApp
.
getMchNo
(),
mchApp
.
getAppId
());
mqSe
ndSe
rviceImpl
.
sendModifyMchApp
(
mchApp
.
getMchNo
(),
mchApp
.
getAppId
());
return
ApiRes
.
ok
();
}
...
...
@@ -140,7 +140,7 @@ public class MchAppController extends CommonCtrl {
mchAppService
.
removeByAppId
(
appId
);
// 推送mq到目前节点进行更新数据
mqServiceImpl
.
sendModifyMchApp
(
mchApp
.
getMchNo
(),
appId
);
mqSe
ndSe
rviceImpl
.
sendModifyMchApp
(
mchApp
.
getMchNo
(),
appId
);
return
ApiRes
.
ok
();
}
...
...
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/merchant/MchInfoController.java
View file @
010d8799
...
...
@@ -26,7 +26,7 @@ import com.jeequan.jeepay.core.entity.MchInfo;
import
com.jeequan.jeepay.core.entity.SysUser
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mgr.mq.service.MqServiceImpl
;
import
com.jeequan.jeepay.mgr.mq.service.MqSe
ndSe
rviceImpl
;
import
com.jeequan.jeepay.service.impl.MchInfoService
;
import
com.jeequan.jeepay.service.impl.SysUserAuthService
;
import
com.jeequan.jeepay.service.impl.SysUserService
;
...
...
@@ -56,7 +56,7 @@ public class MchInfoController extends CommonCtrl {
@Autowired
private
MchInfoService
mchInfoService
;
@Autowired
private
SysUserService
sysUserService
;
@Autowired
private
SysUserAuthService
sysUserAuthService
;
@Autowired
private
MqServiceImpl
mqServiceImpl
;
@Autowired
private
MqSe
ndSe
rviceImpl
mqSe
ndSe
rviceImpl
;
/**
* @author: pangxiaoyu
...
...
@@ -113,9 +113,9 @@ public class MchInfoController extends CommonCtrl {
public
ApiRes
delete
(
@PathVariable
(
"mchNo"
)
String
mchNo
)
{
List
<
Long
>
userIdList
=
mchInfoService
.
removeByMchNo
(
mchNo
);
// 推送mq删除redis用户缓存
mqServiceImpl
.
sendUserRemove
(
userIdList
);
mqSe
ndSe
rviceImpl
.
sendUserRemove
(
userIdList
);
// 推送mq到目前节点进行更新数据
mqServiceImpl
.
sendModifyMchInfo
(
mchNo
);
mqSe
ndSe
rviceImpl
.
sendModifyMchInfo
(
mchNo
);
return
ApiRes
.
ok
();
}
...
...
@@ -161,7 +161,7 @@ public class MchInfoController extends CommonCtrl {
// 推送mq删除redis用户认证信息
if
(!
removeCacheUserIdList
.
isEmpty
())
{
mqServiceImpl
.
sendUserRemove
(
removeCacheUserIdList
);
mqSe
ndSe
rviceImpl
.
sendUserRemove
(
removeCacheUserIdList
);
}
//更新商户信息
...
...
@@ -170,7 +170,7 @@ public class MchInfoController extends CommonCtrl {
}
// 推送mq到目前节点进行更新数据
mqServiceImpl
.
sendModifyMchInfo
(
mchNo
);
mqSe
ndSe
rviceImpl
.
sendModifyMchInfo
(
mchNo
);
return
ApiRes
.
ok
();
}
...
...
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/merchant/MchPayInterfaceConfigController.java
View file @
010d8799
...
...
@@ -23,7 +23,7 @@ import com.jeequan.jeepay.core.entity.PayInterfaceConfig;
import
com.jeequan.jeepay.core.entity.PayInterfaceDefine
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mgr.mq.service.MqServiceImpl
;
import
com.jeequan.jeepay.mgr.mq.service.MqSe
ndSe
rviceImpl
;
import
com.jeequan.jeepay.service.impl.MchAppService
;
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
MqServiceImpl
mqServiceImpl
;
@Autowired
private
MqSe
ndSe
rviceImpl
mqSe
ndSe
rviceImpl
;
@Autowired
private
MchAppService
mchAppService
;
/**
...
...
@@ -124,7 +124,7 @@ public class MchPayInterfaceConfigController extends CommonCtrl {
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYSTEM_ERROR
,
"配置失败"
);
}
mqServiceImpl
.
sendModifyMchApp
(
mchApp
.
getMchNo
(),
infoId
);
// 推送mq到目前节点进行更新数据
mqSe
ndSe
rviceImpl
.
sendModifyMchApp
(
mchApp
.
getMchNo
(),
infoId
);
// 推送mq到目前节点进行更新数据
return
ApiRes
.
ok
();
}
...
...
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/order/MchNotifyController.java
View file @
010d8799
...
...
@@ -23,7 +23,7 @@ import com.jeequan.jeepay.core.entity.MchNotifyRecord;
import
com.jeequan.jeepay.core.exception.BizException
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mgr.mq.service.MqServiceImpl
;
import
com.jeequan.jeepay.mgr.mq.service.MqSe
ndSe
rviceImpl
;
import
com.jeequan.jeepay.service.impl.MchNotifyRecordService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -45,7 +45,7 @@ import org.springframework.web.bind.annotation.RestController;
public
class
MchNotifyController
extends
CommonCtrl
{
@Autowired
private
MchNotifyRecordService
mchNotifyService
;
@Autowired
private
MqServiceImpl
mqServiceImpl
;
@Autowired
private
MqSe
ndSe
rviceImpl
mqSe
ndSe
rviceImpl
;
/**
* @author: pangxiaoyu
...
...
@@ -106,7 +106,7 @@ public class MchNotifyController extends CommonCtrl {
mchNotifyService
.
getBaseMapper
().
updateIngAndAddNotifyCountLimit
(
notifyId
);
//调起MQ重发
mqServiceImpl
.
sendPayOrderNotify
(
notifyId
+
""
);
mqSe
ndSe
rviceImpl
.
sendPayOrderNotify
(
notifyId
+
""
);
return
ApiRes
.
ok
(
mchNotify
);
}
...
...
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/service/MqServiceImpl.java
→
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/service/MqSe
ndSe
rviceImpl.java
View file @
010d8799
...
...
@@ -30,7 +30,7 @@ import java.util.Collection;
*/
@Slf4j
@Service
public
class
MqServiceImpl
{
public
class
MqSe
ndSe
rviceImpl
{
@Autowired
private
MqMchUserRemoveService
mqMchUserRemoveService
;
@Autowired
private
MqPayOrderNotifyService
mqPayOrderNotifyService
;
...
...
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/topic/RabbitMqConfig.java
View file @
010d8799
...
...
@@ -17,6 +17,7 @@ package com.jeequan.jeepay.mgr.mq.topic;
import
com.jeequan.jeepay.core.constants.CS
;
import
org.springframework.amqp.core.*
;
import
org.springframework.amqp.rabbit.annotation.EnableRabbit
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
...
...
@@ -31,6 +32,7 @@ import org.springframework.context.annotation.Profile;
*/
@Profile
(
CS
.
MQTYPE
.
RABBIT_MQ
)
@Configuration
@EnableRabbit
public
class
RabbitMqConfig
{
@Bean
(
"modifyIsvInfo"
)
...
...
@@ -48,10 +50,9 @@ public class RabbitMqConfig {
@Bean
(
"modifySysConfig"
)
public
Queue
modifySysConfig
()
{
return
new
Queue
(
CS
.
MQ
.
TOPIC
_MODIFY_SYS_CONFIG
,
true
);
return
new
Queue
(
CS
.
MQ
.
FANOUT
_MODIFY_SYS_CONFIG
,
true
);
}
@Bean
(
"payOrderMchNotify"
)
public
Queue
payOrderMchNotify
()
{
return
new
Queue
(
CS
.
MQ
.
QUEUE_PAYORDER_MCH_NOTIFY
,
true
);
...
...
@@ -62,10 +63,10 @@ public class RabbitMqConfig {
return
new
Queue
(
CS
.
MQ
.
QUEUE_MODIFY_MCH_USER_REMOVE
,
true
);
}
//
Topic
交换机 起名:
topic
Exchange
@Bean
(
"
topic
Exchange"
)
Topic
Exchange
topic
Exchange
()
{
return
new
Topic
Exchange
(
CS
.
TOPIC
_EXCHANGE
,
true
,
false
);
//
Fanout
交换机 起名:
fanout
Exchange
@Bean
(
"
fanout
Exchange"
)
Fanout
Exchange
fanout
Exchange
()
{
return
new
Fanout
Exchange
(
CS
.
FANOUT
_EXCHANGE
_SYS_CONFIG
,
true
,
false
);
}
//交换机 起名:directExchange
...
...
@@ -74,29 +75,28 @@ public class RabbitMqConfig {
return
new
DirectExchange
(
CS
.
DIRECT_EXCHANGE
,
true
,
false
);
}
//绑定 将队列和交换机绑定, 并设置用于匹配键:TOPIC_MODIFY_ISV_INFO
@Bean
Binding
bindingIsvInfo
(
@Qualifier
(
"modifyIsvInfo"
)
Queue
modifyIsvInfo
,
@Qualifier
(
"
topic
Exchange"
)
Topic
Exchange
topic
Exchange
)
{
return
BindingBuilder
.
bind
(
modifyIsvInfo
).
to
(
topic
Exchange
).
with
(
CS
.
MQ
.
TOPIC_MODIFY_ISV_INFO
);
Binding
bindingIsvInfo
(
@Qualifier
(
"modifyIsvInfo"
)
Queue
modifyIsvInfo
,
@Qualifier
(
"
direct
Exchange"
)
Direct
Exchange
direct
Exchange
)
{
return
BindingBuilder
.
bind
(
modifyIsvInfo
).
to
(
direct
Exchange
).
with
(
CS
.
MQ
.
TOPIC_MODIFY_ISV_INFO
);
}
//绑定 将队列和交换机绑定, 并设置用于匹配键:TOPIC_MODIFY_MCH_APP
@Bean
Binding
bindingMchApp
(
@Qualifier
(
"modifyMchApp"
)
Queue
modifyMchApp
,
@Qualifier
(
"
topic
Exchange"
)
Topic
Exchange
topic
Exchange
)
{
return
BindingBuilder
.
bind
(
modifyMchApp
).
to
(
topic
Exchange
).
with
(
CS
.
MQ
.
TOPIC_MODIFY_MCH_APP
);
Binding
bindingMchApp
(
@Qualifier
(
"modifyMchApp"
)
Queue
modifyMchApp
,
@Qualifier
(
"
direct
Exchange"
)
Direct
Exchange
direct
Exchange
)
{
return
BindingBuilder
.
bind
(
modifyMchApp
).
to
(
direct
Exchange
).
with
(
CS
.
MQ
.
TOPIC_MODIFY_MCH_APP
);
}
//绑定 将队列和交换机绑定, 并设置用于匹配键:TOPIC_MODIFY_MCH_INFO
@Bean
Binding
bindingMchInfo
(
@Qualifier
(
"modifyMchInfo"
)
Queue
modifyMchInfo
,
@Qualifier
(
"
topic
Exchange"
)
Topic
Exchange
topic
Exchange
)
{
return
BindingBuilder
.
bind
(
modifyMchInfo
).
to
(
topic
Exchange
).
with
(
CS
.
MQ
.
TOPIC_MODIFY_MCH_INFO
);
Binding
bindingMchInfo
(
@Qualifier
(
"modifyMchInfo"
)
Queue
modifyMchInfo
,
@Qualifier
(
"
direct
Exchange"
)
Direct
Exchange
direct
Exchange
)
{
return
BindingBuilder
.
bind
(
modifyMchInfo
).
to
(
direct
Exchange
).
with
(
CS
.
MQ
.
TOPIC_MODIFY_MCH_INFO
);
}
//绑定 将队列和交换机绑定
, 并设置用于匹配键:TOPIC_MODIFY_SYS_CONFIG
//绑定 将队列和交换机绑定
@Bean
Binding
bindingSysConfig
(
@Qualifier
(
"modifySysConfig"
)
Queue
modifySysConfig
,
@Qualifier
(
"topicExchange"
)
TopicExchange
topic
Exchange
)
{
return
BindingBuilder
.
bind
(
modifySysConfig
).
to
(
topic
Exchange
)
.
with
(
CS
.
MQ
.
TOPIC_MODIFY_SYS_CONFIG
)
;
Binding
bindingSysConfig
(
Queue
modifySysConfig
,
FanoutExchange
fanout
Exchange
)
{
return
BindingBuilder
.
bind
(
modifySysConfig
).
to
(
fanout
Exchange
);
}
//绑定 将队列和交换机绑定, 并设置用于匹配键:QUEUE_PAYORDER_MCH_NOTIFY
...
...
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/topic/RabbitMq
Topic
4ModifyIsvInfo.java
→
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/topic/RabbitMq
Direct
4ModifyIsvInfo.java
View file @
010d8799
...
...
@@ -17,12 +17,9 @@ 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
;
/**
...
...
@@ -34,13 +31,13 @@ import org.springframework.stereotype.Component;
*/
@Component
@Profile
(
CS
.
MQTYPE
.
RABBIT_MQ
)
public
class
RabbitMq
Topic
4ModifyIsvInfo
extends
MqModifyIsvInfoService
{
public
class
RabbitMq
Direct
4ModifyIsvInfo
extends
MqModifyIsvInfoService
{
@Autowired
private
RabbitTemplate
rabbitTemplate
;
@Override
public
void
send
(
String
msg
)
{
rabbitTemplate
.
convertAndSend
(
CS
.
TOPIC
_EXCHANGE
,
CS
.
MQ
.
TOPIC_MODIFY_ISV_INFO
,
msg
);
rabbitTemplate
.
convertAndSend
(
CS
.
DIRECT
_EXCHANGE
,
CS
.
MQ
.
TOPIC_MODIFY_ISV_INFO
,
msg
);
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/topic/RabbitMq
Topic
4ModifyMchApp.java
→
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/topic/RabbitMq
Direct
4ModifyMchApp.java
View file @
010d8799
...
...
@@ -19,12 +19,9 @@ 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
;
/**
...
...
@@ -36,7 +33,7 @@ import org.springframework.stereotype.Component;
*/
@Component
@Profile
(
CS
.
MQTYPE
.
RABBIT_MQ
)
public
class
RabbitMq
Topic
4ModifyMchApp
extends
MqModifyMchAppService
{
public
class
RabbitMq
Direct
4ModifyMchApp
extends
MqModifyMchAppService
{
@Autowired
private
RabbitTemplate
rabbitTemplate
;
...
...
@@ -45,7 +42,7 @@ public class RabbitMqTopic4ModifyMchApp extends MqModifyMchAppService {
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
());
rabbitTemplate
.
convertAndSend
(
CS
.
DIRECT
_EXCHANGE
,
CS
.
MQ
.
TOPIC_MODIFY_
MCH_APP
,
jsonObject
.
toString
());
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/topic/RabbitMq
Topic
4ModifyMchInfo.java
→
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/topic/RabbitMq
Direct
4ModifyMchInfo.java
View file @
010d8799
...
...
@@ -31,14 +31,14 @@ import org.springframework.stereotype.Component;
*/
@Component
@Profile
(
CS
.
MQTYPE
.
RABBIT_MQ
)
public
class
RabbitMq
Topic
4ModifyMchInfo
extends
MqModifyMchInfoService
{
public
class
RabbitMq
Direct
4ModifyMchInfo
extends
MqModifyMchInfoService
{
@Autowired
private
RabbitTemplate
rabbitTemplate
;
/** 推送消息到各个节点 **/
@Override
public
void
send
(
String
mchNo
)
{
rabbitTemplate
.
convertAndSend
(
CS
.
TOPIC
_EXCHANGE
,
CS
.
MQ
.
TOPIC_MODIFY_MCH_INFO
,
mchNo
);
rabbitTemplate
.
convertAndSend
(
CS
.
DIRECT
_EXCHANGE
,
CS
.
MQ
.
TOPIC_MODIFY_MCH_INFO
,
mchNo
);
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/topic/RabbitMq
Topic
4ModifySysConfig.java
→
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/topic/RabbitMq
Direct
4ModifySysConfig.java
View file @
010d8799
...
...
@@ -16,15 +16,16 @@
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.core.AmqpTemplate
;
import
org.springframework.amqp.rabbit.annotation.Exchange
;
import
org.springframework.amqp.rabbit.annotation.Queue
;
import
org.springframework.amqp.rabbit.annotation.QueueBinding
;
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
;
/**
...
...
@@ -37,15 +38,14 @@ import org.springframework.stereotype.Component;
@Slf4j
@Component
@Profile
(
CS
.
MQTYPE
.
RABBIT_MQ
)
public
class
RabbitMq
Topic
4ModifySysConfig
extends
MqModifySysConfigService
{
public
class
RabbitMq
Direct
4ModifySysConfig
extends
MqModifySysConfigService
{
@Autowired
private
Rabbit
Template
rabbitTemplate
;
@Autowired
private
Amqp
Template
rabbitTemplate
;
@Autowired
private
SysConfigService
sysConfigService
;
/** 接收 更新系统配置项的消息 **/
@RabbitListener
(
queues
=
CS
.
MQ
.
TOPIC_MODIFY_SYS_CONFIG
)
@RabbitListener
(
bindings
=
{
@QueueBinding
(
value
=
@Queue
(),
exchange
=
@Exchange
(
name
=
CS
.
FANOUT_EXCHANGE_SYS_CONFIG
,
type
=
"fanout"
))}
)
public
void
receive
(
String
msg
)
{
log
.
info
(
"成功接收更新系统配置的订阅通知, msg={}"
,
msg
);
sysConfigService
.
initDBConfig
(
msg
);
log
.
info
(
"系统配置静态属性已重置"
);
...
...
@@ -54,7 +54,7 @@ public class RabbitMqTopic4ModifySysConfig extends MqModifySysConfigService {
/** 推送消息到各个节点 **/
@Override
public
void
send
(
String
msg
)
{
rabbitTemplate
.
convertAndSend
(
CS
.
TOPIC
_EXCHANGE
,
CS
.
MQ
.
TOPIC
_MODIFY_SYS_CONFIG
,
msg
);
this
.
rabbitTemplate
.
convertAndSend
(
CS
.
FANOUT
_EXCHANGE
_SYS_CONFIG
,
CS
.
MQ
.
FANOUT
_MODIFY_SYS_CONFIG
,
msg
);
}
}
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/ctrl/merchant/MchAppController.java
View file @
010d8799
...
...
@@ -24,7 +24,7 @@ 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.service.MqServiceImpl
;
import
com.jeequan.jeepay.mch.mq.service.MqSe
ndSe
rviceImpl
;
import
com.jeequan.jeepay.service.impl.MchAppService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -43,7 +43,7 @@ import org.springframework.web.bind.annotation.*;
public
class
MchAppController
extends
CommonCtrl
{
@Autowired
private
MchAppService
mchAppService
;
@Autowired
private
MqServiceImpl
mqService
;
@Autowired
private
MqSe
ndSe
rviceImpl
mqSe
ndSe
rvice
Impl
;
/**
* @Author: ZhuXiao
...
...
@@ -125,7 +125,7 @@ public class MchAppController extends CommonCtrl {
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_UPDATE
);
}
// 推送修改应用消息
mqService
.
sendModifyMchApp
(
getCurrentMchNo
(),
mchApp
.
getAppId
());
mqSe
ndSe
rvice
Impl
.
sendModifyMchApp
(
getCurrentMchNo
(),
mchApp
.
getAppId
());
return
ApiRes
.
ok
();
}
...
...
@@ -147,7 +147,7 @@ public class MchAppController extends CommonCtrl {
mchAppService
.
removeByAppId
(
appId
);
// 推送mq到目前节点进行更新数据
mqService
.
sendModifyMchApp
(
getCurrentMchNo
(),
appId
);
mqSe
ndSe
rvice
Impl
.
sendModifyMchApp
(
getCurrentMchNo
(),
appId
);
return
ApiRes
.
ok
();
}
...
...
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/ctrl/merchant/MchPayInterfaceConfigController.java
View file @
010d8799
...
...
@@ -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.service.MqServiceImpl
;
import
com.jeequan.jeepay.mch.mq.service.MqSe
ndSe
rviceImpl
;
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
MqServiceImpl
mqService
;
@Autowired
private
MqSe
ndSe
rviceImpl
mqSe
ndSe
rvice
Impl
;
@Autowired
private
MchInfoService
mchInfoService
;
/**
...
...
@@ -125,7 +125,7 @@ public class MchPayInterfaceConfigController extends CommonCtrl {
throw
new
BizException
(
"配置失败"
);
}
mqService
.
sendModifyMchApp
(
getCurrentMchNo
(),
infoId
);
// 推送mq到目前节点进行更新数据
mqSe
ndSe
rvice
Impl
.
sendModifyMchApp
(
getCurrentMchNo
(),
infoId
);
// 推送mq到目前节点进行更新数据
return
ApiRes
.
ok
();
}
...
...
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/queue/MqQueue4ModifyMchUserRemove.java
View file @
010d8799
...
...
@@ -15,18 +15,15 @@
*/
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
com.jeequan.jeepay.mch.mq.service.MqReceiveServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.activemq.command.ActiveMQQueue
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Profile
;
import
org.springframework.jms.annotation.JmsListener
;
import
org.springframework.stereotype.Component
;
import
java.util.Collection
;
import
java.util.List
;
/**
* 商户用户登录信息清除
*
...
...
@@ -39,6 +36,9 @@ import java.util.List;
@Profile
(
CS
.
MQTYPE
.
ACTIVE_MQ
)
public
class
MqQueue4ModifyMchUserRemove
extends
ActiveMQQueue
{
@Autowired
private
MqReceiveServiceImpl
mqReceiveServiceImpl
;
public
MqQueue4ModifyMchUserRemove
(){
super
(
CS
.
MQ
.
QUEUE_MODIFY_MCH_USER_REMOVE
);
}
...
...
@@ -50,27 +50,7 @@ public class MqQueue4ModifyMchUserRemove extends ActiveMQQueue {
*/
@JmsListener
(
destination
=
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
(
"无权限登录用户信息已清除"
);
mqReceiveServiceImpl
.
mchUserRemove
(
userIdStr
);
}
...
...
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/queue/RabbitMq4ModifyMchUserRemove.java
0 → 100644
View file @
010d8799
/*
* 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.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.mch.mq.service.MqReceiveServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.amqp.rabbit.annotation.RabbitListener
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Profile
;
import
org.springframework.stereotype.Component
;
/**
* 商户用户登录信息清除
*
* @author pangxiaoyu
* @site https://www.jeepay.vip
* @date 2021-04-27 15:50
*/
@Slf4j
@Component
@Profile
(
CS
.
MQTYPE
.
RABBIT_MQ
)
public
class
RabbitMq4ModifyMchUserRemove
{
@Autowired
private
MqReceiveServiceImpl
mqReceiveServiceImpl
;
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:17
* @describe: 接收 商户用户登录信息清除消息
*/
@RabbitListener
(
queues
=
CS
.
MQ
.
QUEUE_MODIFY_MCH_USER_REMOVE
)
public
void
receive
(
String
userIdStr
)
{
mqReceiveServiceImpl
.
mchUserRemove
(
userIdStr
);
}
}
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/
queue/RabbitMqQueue4ModifyMchUserRemove
.java
→
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/
service/MqReceiveServiceImpl
.java
View file @
010d8799
...
...
@@ -13,39 +13,33 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.mch.mq.
queu
e
;
package
com.jeequan.jeepay.mch.mq.
servic
e
;
import
com.alibaba.fastjson.JSONArray
;
import
com.jeequan.jeepay.core.cache.RedisUtil
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.service.impl.SysConfigService
;
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
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Collection
;
import
java.util.List
;
/**
*
商户用户登录信息清除
*
处理公共接收消息方法
*
* @author
pang
xiaoyu
* @author xiaoyu
* @site https://www.jeepay.vip
* @date 2021
-04-27 15:5
0
* @date 2021
/6/25 17:1
0
*/
@Slf4j
@Component
@Profile
(
CS
.
MQTYPE
.
RABBIT_MQ
)
public
class
RabbitMqQueue4ModifyMchUserRemove
{
@Service
public
class
MqReceiveServiceImpl
{
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:17
* @describe: 接收 商户用户登录信息清除消息
*/
@RabbitListener
(
queues
=
CS
.
MQ
.
QUEUE_MODIFY_MCH_USER_REMOVE
)
public
void
receive
(
String
userIdStr
)
{
@Autowired
private
SysConfigService
sysConfigService
;
public
void
mchUserRemove
(
String
userIdStr
)
{
log
.
info
(
"成功接收删除商户用户登录的订阅通知, msg={}"
,
userIdStr
);
// 字符串转List<Long>
List
<
Long
>
userIdList
=
JSONArray
.
parseArray
(
userIdStr
,
Long
.
class
);
...
...
@@ -68,4 +62,9 @@ public class RabbitMqQueue4ModifyMchUserRemove {
log
.
info
(
"无权限登录用户信息已清除"
);
}
public
void
initDbConfig
(
String
msg
)
{
log
.
info
(
"成功接收更新系统配置的订阅通知, msg={}"
,
msg
);
sysConfigService
.
initDBConfig
(
msg
);
log
.
info
(
"系统配置静态属性已重置"
);
}
}
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/service/MqServiceImpl.java
→
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/service/MqSe
ndSe
rviceImpl.java
View file @
010d8799
...
...
@@ -28,7 +28,7 @@ import org.springframework.stereotype.Service;
*/
@Slf4j
@Service
public
class
MqServiceImpl
{
public
class
MqSe
ndSe
rviceImpl
{
@Autowired
private
MqModifyMchAppService
mqModifyMchAppService
;
...
...
Prev
1
2
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