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
0ba6b3bd
Commit
0ba6b3bd
authored
Jul 04, 2021
by
xiaoyu
Browse files
MQ整体优化
parent
010d8799
Changes
59
Hide whitespace changes
Inline
Side-by-side
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/service/MqPayOrderNotifyService.java
deleted
100644 → 0
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.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/MqSendServiceImpl.java
deleted
100644 → 0
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.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
MqSendServiceImpl
{
@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/MqTopic4ModifyIsvInfo.java
deleted
100644 → 0
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.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
;
/*
* 更改ISV信息
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 17:10
*/
@Slf4j
@Component
@Profile
(
CS
.
MQTYPE
.
ACTIVE_MQ
)
public
class
MqTopic4ModifyIsvInfo
extends
MqModifyIsvInfoService
{
@Autowired
private
JmsTemplate
jmsTemplate
;
@Bean
(
"activeModifyIsvInfo"
)
public
ActiveMQTopic
mqTopic4ModifyIsvInfo
(){
return
new
ActiveMQTopic
(
CS
.
MQ
.
TOPIC_MODIFY_ISV_INFO
);
}
@Lazy
@Autowired
@Qualifier
(
"activeModifyIsvInfo"
)
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/MqTopic4ModifyMchInfo.java
deleted
100644 → 0
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.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
;
/*
* 更改商户信息
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 17:10
*/
@Slf4j
@Component
@Profile
(
CS
.
MQTYPE
.
ACTIVE_MQ
)
public
class
MqTopic4ModifyMchInfo
extends
MqModifyMchInfoService
{
@Autowired
private
JmsTemplate
jmsTemplate
;
@Bean
(
"activeModifyMchInfo"
)
public
ActiveMQTopic
mqTopic4ModifyMchInfo
(){
return
new
ActiveMQTopic
(
CS
.
MQ
.
TOPIC_MODIFY_MCH_INFO
);
}
@Lazy
@Autowired
@Qualifier
(
"activeModifyMchInfo"
)
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/RabbitMqDirect4ModifyIsvInfo.java
deleted
100644 → 0
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.mgr.mq.topic
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.mgr.mq.service.MqModifyIsvInfoService
;
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
RabbitMqDirect4ModifyIsvInfo
extends
MqModifyIsvInfoService
{
@Autowired
private
RabbitTemplate
rabbitTemplate
;
@Override
public
void
send
(
String
msg
)
{
rabbitTemplate
.
convertAndSend
(
CS
.
DIRECT_EXCHANGE
,
CS
.
MQ
.
TOPIC_MODIFY_ISV_INFO
,
msg
);
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/topic/RabbitMqDirect4ModifyMchApp.java
deleted
100644 → 0
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.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
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
RabbitMqDirect4ModifyMchApp
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
.
DIRECT_EXCHANGE
,
CS
.
MQ
.
TOPIC_MODIFY_MCH_APP
,
jsonObject
.
toString
());
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/topic/RabbitMqDirect4ModifyMchInfo.java
deleted
100644 → 0
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.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
RabbitMqDirect4ModifyMchInfo
extends
MqModifyMchInfoService
{
@Autowired
private
RabbitTemplate
rabbitTemplate
;
/** 推送消息到各个节点 **/
@Override
public
void
send
(
String
mchNo
)
{
rabbitTemplate
.
convertAndSend
(
CS
.
DIRECT_EXCHANGE
,
CS
.
MQ
.
TOPIC_MODIFY_MCH_INFO
,
mchNo
);
}
}
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/ctrl/merchant/MchAppController.java
View file @
0ba6b3bd
...
...
@@ -16,15 +16,18 @@
package
com.jeequan.jeepay.mch.ctrl.merchant
;
import
cn.hutool.core.util.IdUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.jeequan.jeepay.core.aop.MethodLog
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.constants.CS
;
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.core.mq.MqCommonService
;
import
com.jeequan.jeepay.core.utils.JsonKit
;
import
com.jeequan.jeepay.mch.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mch.mq.service.MqSendServiceImpl
;
import
com.jeequan.jeepay.service.impl.MchAppService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -43,7 +46,7 @@ import org.springframework.web.bind.annotation.*;
public
class
MchAppController
extends
CommonCtrl
{
@Autowired
private
MchAppService
mchAppService
;
@Autowired
private
Mq
Send
Service
Impl
mqSend
Service
Impl
;
@Autowired
private
Mq
Common
Service
mqCommon
Service
;
/**
* @Author: ZhuXiao
...
...
@@ -125,7 +128,9 @@ public class MchAppController extends CommonCtrl {
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_UPDATE
);
}
// 推送修改应用消息
mqSendServiceImpl
.
sendModifyMchApp
(
getCurrentMchNo
(),
mchApp
.
getAppId
());
JSONObject
jsonObject
=
JsonKit
.
newJson
(
"mchNo"
,
mchApp
.
getMchNo
());
jsonObject
.
put
(
"appId"
,
appId
);
mqCommonService
.
send
(
jsonObject
.
toJSONString
(),
CS
.
MQ
.
MQ_TYPE_MODIFY_MCH_APP
);
return
ApiRes
.
ok
();
}
...
...
@@ -147,7 +152,9 @@ public class MchAppController extends CommonCtrl {
mchAppService
.
removeByAppId
(
appId
);
// 推送mq到目前节点进行更新数据
mqSendServiceImpl
.
sendModifyMchApp
(
getCurrentMchNo
(),
appId
);
JSONObject
jsonObject
=
JsonKit
.
newJson
(
"mchNo"
,
mchApp
.
getMchNo
());
jsonObject
.
put
(
"appId"
,
appId
);
mqCommonService
.
send
(
jsonObject
.
toJSONString
(),
CS
.
MQ
.
MQ_TYPE_MODIFY_MCH_APP
);
return
ApiRes
.
ok
();
}
...
...
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/ctrl/merchant/MchPayInterfaceConfigController.java
View file @
0ba6b3bd
...
...
@@ -15,6 +15,7 @@
*/
package
com.jeequan.jeepay.mch.ctrl.merchant
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jeequan.jeepay.core.aop.MethodLog
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.core.entity.MchInfo
;
...
...
@@ -22,8 +23,9 @@ import com.jeequan.jeepay.core.entity.PayInterfaceConfig;
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.core.mq.MqCommonService
;
import
com.jeequan.jeepay.core.utils.JsonKit
;
import
com.jeequan.jeepay.mch.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mch.mq.service.MqSendServiceImpl
;
import
com.jeequan.jeepay.service.impl.MchInfoService
;
import
com.jeequan.jeepay.service.impl.PayInterfaceConfigService
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -45,8 +47,8 @@ import java.util.List;
public
class
MchPayInterfaceConfigController
extends
CommonCtrl
{
@Autowired
private
PayInterfaceConfigService
payInterfaceConfigService
;
@Autowired
private
MqSendServiceImpl
mqSendServiceImpl
;
@Autowired
private
MchInfoService
mchInfoService
;
@Autowired
private
MqCommonService
mqCommonService
;
/**
* @Author: ZhuXiao
...
...
@@ -124,8 +126,9 @@ public class MchPayInterfaceConfigController extends CommonCtrl {
if
(!
result
)
{
throw
new
BizException
(
"配置失败"
);
}
mqSendServiceImpl
.
sendModifyMchApp
(
getCurrentMchNo
(),
infoId
);
// 推送mq到目前节点进行更新数据
JSONObject
jsonObject
=
JsonKit
.
newJson
(
"mchNo"
,
getCurrentMchNo
());
jsonObject
.
put
(
"appId"
,
infoId
);
mqCommonService
.
send
(
jsonObject
.
toJSONString
(),
CS
.
MQ
.
MQ_TYPE_MODIFY_MCH_APP
);
return
ApiRes
.
ok
();
}
...
...
jeepay-m
anager
/src/main/java/com/jeequan/jeepay/m
gr
/mq/
topic/MqTopic4ModifyMchApp
.java
→
jeepay-m
erchant
/src/main/java/com/jeequan/jeepay/m
ch
/mq/
ActiveMqSend
.java
View file @
0ba6b3bd
...
...
@@ -13,12 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.m
gr
.mq
.topic
;
package
com.jeequan.jeepay.m
ch
.mq
;
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
com.jeequan.jeepay.core.mq.MqCommonService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.activemq.command.ActiveMQTopic
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -39,26 +37,36 @@ import org.springframework.stereotype.Component;
@Slf4j
@Component
@Profile
(
CS
.
MQTYPE
.
ACTIVE_MQ
)
public
class
MqTopic4ModifyMchApp
extends
MqModifyMchApp
Service
{
public
class
ActiveMqSend
extends
MqCommon
Service
{
@Autowired
private
JmsTemplate
jmsTemplate
;
@Bean
(
"activeModifyMchApp"
)
@Bean
(
"activeM
qSendM
odifyMchApp"
)
public
ActiveMQTopic
mqTopic4ModifyMchApp
(){
return
new
ActiveMQTopic
(
CS
.
MQ
.
TOPIC_MODIFY_MCH_APP
);
}
@Lazy
@Autowired
@Qualifier
(
"activeModifyMchApp"
)
@Qualifier
(
"activeM
qSendM
odifyMchApp"
)
private
ActiveMQTopic
mqTopic4ModifyMchApp
;
/** 推送消息到各个节点 **/
@Override
public
void
send
(
String
mchNo
,
String
appId
)
{
JSONObject
jsonObject
=
JsonKit
.
newJson
(
"mchNo"
,
mchNo
);
jsonObject
.
put
(
"appId"
,
appId
);
this
.
jmsTemplate
.
convertAndSend
(
mqTopic4ModifyMchApp
,
jsonObject
.
toString
());
public
void
send
(
String
msg
,
String
sendType
)
{
if
(
sendType
.
equals
(
CS
.
MQ
.
MQ_TYPE_MODIFY_MCH_APP
))
{
// 商户应用修改
topicModifyMchApp
(
msg
);
}
}
@Override
public
void
send
(
String
msg
,
long
delay
,
String
sendType
)
{
}
/** 发送商户应用修改信息 **/
public
void
topicModifyMchApp
(
String
msg
)
{
this
.
jmsTemplate
.
convertAndSend
(
mqTopic4ModifyMchApp
,
msg
);
}
}
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/
topic/
RabbitMq
Direct4ModifyMchApp
.java
→
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/RabbitMq
Send
.java
View file @
0ba6b3bd
...
...
@@ -13,18 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.mch.mq
.topic
;
package
com.jeequan.jeepay.mch.mq
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.core.utils.JsonKit
;
import
com.jeequan.jeepay.mch.mq.service.MqModifyMchAppService
;
import
com.jeequan.jeepay.core.mq.MqCommonService
;
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
;
/**
...
...
@@ -37,17 +33,25 @@ import org.springframework.stereotype.Component;
@Slf4j
@Component
@Profile
(
CS
.
MQTYPE
.
RABBIT_MQ
)
public
class
RabbitMq
Direct4ModifyMchApp
extends
MqModifyMchApp
Service
{
public
class
RabbitMq
Send
extends
MqCommon
Service
{
@Autowired
private
RabbitTemplate
rabbitTemplate
;
/** 推送消息
到各个节点
**/
/** 推送消息 **/
@Override
public
void
send
(
String
mchNo
,
String
appId
)
{
JSONObject
jsonObject
=
JsonKit
.
newJson
(
"mchNo"
,
mchNo
);
jsonObject
.
put
(
"appId"
,
appId
);
public
void
send
(
String
msg
,
String
sendType
)
{
if
(
sendType
.
equals
(
CS
.
MQ
.
MQ_TYPE_MODIFY_MCH_APP
))
{
// 商户应用修改
directModifyMchApp
(
msg
);
}
}
@Override
public
void
send
(
String
msg
,
long
delay
,
String
sendType
)
{
rabbitTemplate
.
convertAndSend
(
CS
.
DIRECT_EXCHANGE
,
CS
.
MQ
.
TOPIC_MODIFY_MCH_APP
,
jsonObject
.
toString
());
}
/** 发送商户应用修改信息 **/
public
void
directModifyMchApp
(
String
msg
)
{
rabbitTemplate
.
convertAndSend
(
CS
.
DIRECT_EXCHANGE
,
CS
.
MQ
.
TOPIC_MODIFY_MCH_APP
,
msg
);
}
}
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/queue/MqQueue4ModifyMchUserRemove.java
→
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/
activemq/
queue/MqQueue4ModifyMchUserRemove.java
View file @
0ba6b3bd
...
...
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.mch.mq.queue
;
package
com.jeequan.jeepay.mch.mq.
activemq.
queue
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.mch.mq.
servic
e.MqReceiveServiceImpl
;
import
com.jeequan.jeepay.mch.mq.
receiv
e.MqReceiveServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.activemq.command.ActiveMQQueue
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -36,8 +36,7 @@ import org.springframework.stereotype.Component;
@Profile
(
CS
.
MQTYPE
.
ACTIVE_MQ
)
public
class
MqQueue4ModifyMchUserRemove
extends
ActiveMQQueue
{
@Autowired
private
MqReceiveServiceImpl
mqReceiveServiceImpl
;
@Autowired
private
MqReceiveServiceImpl
mqReceiveServiceImpl
;
public
MqQueue4ModifyMchUserRemove
(){
super
(
CS
.
MQ
.
QUEUE_MODIFY_MCH_USER_REMOVE
);
...
...
@@ -53,6 +52,4 @@ public class MqQueue4ModifyMchUserRemove extends ActiveMQQueue {
mqReceiveServiceImpl
.
mchUserRemove
(
userIdStr
);
}
}
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/topic/MqTopic4ModifySysConfig.java
→
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/
activemq/
topic/MqTopic4ModifySysConfig.java
View file @
0ba6b3bd
...
...
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.mch.mq.topic
;
package
com.jeequan.jeepay.mch.mq.
activemq.
topic
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.mch.mq.
servic
e.MqReceiveServiceImpl
;
import
com.jeequan.jeepay.mch.mq.
receiv
e.MqReceiveServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.activemq.command.ActiveMQTopic
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -49,6 +49,4 @@ public class MqTopic4ModifySysConfig extends ActiveMQTopic{
mqReceiveServiceImpl
.
initDbConfig
(
msg
);
}
}
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/
topic
/JMSConfig.java
→
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/
config
/JMSConfig.java
View file @
0ba6b3bd
...
...
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.mch.mq.
topic
;
package
com.jeequan.jeepay.mch.mq.
config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.jms.config.DefaultJmsListenerContainerFactory
;
...
...
jeepay-m
anager
/src/main/java/com/jeequan/jeepay/m
gr
/mq/
queue/MqQueue4PayOrderMchNotify
.java
→
jeepay-m
erchant
/src/main/java/com/jeequan/jeepay/m
ch
/mq/
config/RabbitMqConfig
.java
View file @
0ba6b3bd
...
...
@@ -13,51 +13,47 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.m
gr
.mq.
queue
;
package
com.jeequan.jeepay.m
ch
.mq.
config
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.mgr.mq.service.MqPayOrderNotifyService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.activemq.command.ActiveMQQueue
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.amqp.core.Binding
;
import
org.springframework.amqp.core.BindingBuilder
;
import
org.springframework.amqp.core.DirectExchange
;
import
org.springframework.amqp.core.Queue
;
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.
Lazy
;
import
org.springframework.context.annotation.
Configuration
;
import
org.springframework.context.annotation.Profile
;
import
org.springframework.jms.core.JmsTemplate
;
import
org.springframework.stereotype.Component
;
import
javax.jms.Queue
;
/**
*
商户订单回调MQ通知
*
* @author
terrfly
* @site https://www.jeepay.vip
* @date 2021/6/2
1
1
8:03
*/
@
Slf4j
@Co
mponent
@
Profile
(
CS
.
MQTYPE
.
ACTIVE_MQ
)
public
class
MqQueue4PayOrderMchNotify
extends
MqPayOrderNotifyService
{
*
RabbitMq
* 队列交换机注册
* @author
xiaoyu
* @site https://www.jeepay.vip
* @date 2021/6/2
5
1
7:10
*/
@
Profile
(
CS
.
MQTYPE
.
RABBIT_MQ
)
@Co
nfiguration
@
EnableRabbit
public
class
RabbitMqConfig
{
@Autowired
private
JmsTemplate
jmsTemplate
;
@Bean
(
"
activePayOrderMchNotify
"
)
public
Queue
m
qQueue4PayOrderMchNotify
(){
return
new
ActiveMQ
Queue
(
CS
.
MQ
.
QUEUE_PAYORDER_MCH_NOTIFY
);
@Bean
(
"
modifyMchApp
"
)
public
Queue
m
odifyMchApp
()
{
return
new
Queue
(
CS
.
MQ
.
TOPIC_MODIFY_MCH_APP
,
true
);
}
@Lazy
@
Autowired
@Qualifier
(
"activePayOrderMchNotify"
)
private
Queue
mqQueue4PayOrderMchNotify
;
//交换机 起名:directExchange
@
Bean
(
"directExchange"
)
DirectExchange
directExchange
()
{
return
new
DirectExchange
(
CS
.
DIRECT_EXCHANGE
,
true
,
false
)
;
}
/
** 发送MQ消息 **/
@
Override
public
void
send
(
String
msg
)
{
this
.
jmsTemplate
.
convertAndSend
(
mqQueue4PayOrderMchNotify
,
msg
);
/
/绑定 将队列和交换机绑定, 并设置用于匹配键:TOPIC_MODIFY_MCH_APP
@
Bean
Binding
bindingMchApp
(
@Qualifier
(
"modifyMchApp"
)
Queue
modifyMchApp
,
@Qualifier
(
"directExchange"
)
DirectExchange
directExchange
)
{
return
BindingBuilder
.
bind
(
modifyMchApp
).
to
(
directExchange
).
with
(
CS
.
MQ
.
TOPIC_MODIFY_MCH_APP
);
}
}
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/
queue
/RabbitMq4ModifyMchUserRemove.java
→
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/
rabbitmq
/RabbitMq4ModifyMchUserRemove.java
View file @
0ba6b3bd
...
...
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.mch.mq.
queue
;
package
com.jeequan.jeepay.mch.mq.
rabbitmq
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.mch.mq.
servic
e.MqReceiveServiceImpl
;
import
com.jeequan.jeepay.mch.mq.
receiv
e.MqReceiveServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.amqp.rabbit.annotation.RabbitListener
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -35,8 +35,7 @@ import org.springframework.stereotype.Component;
@Profile
(
CS
.
MQTYPE
.
RABBIT_MQ
)
public
class
RabbitMq4ModifyMchUserRemove
{
@Autowired
private
MqReceiveServiceImpl
mqReceiveServiceImpl
;
@Autowired
private
MqReceiveServiceImpl
mqReceiveServiceImpl
;
/**
* @author: pangxiaoyu
...
...
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/
topic
/RabbitMqDirect4ModifySysConfig.java
→
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/
rabbitmq
/RabbitMqDirect4ModifySysConfig.java
View file @
0ba6b3bd
...
...
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.mch.mq.
topic
;
package
com.jeequan.jeepay.mch.mq.
rabbitmq
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.mch.mq.
servic
e.MqReceiveServiceImpl
;
import
com.jeequan.jeepay.mch.mq.
receiv
e.MqReceiveServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.amqp.rabbit.annotation.Exchange
;
import
org.springframework.amqp.rabbit.annotation.Queue
;
...
...
@@ -45,7 +45,4 @@ public class RabbitMqDirect4ModifySysConfig {
public
void
receive
(
String
msg
)
{
mqReceiveServiceImpl
.
initDbConfig
(
msg
);
}
}
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/
servic
e/MqReceiveServiceImpl.java
→
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/
receiv
e/MqReceiveServiceImpl.java
View file @
0ba6b3bd
...
...
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.mch.mq.
servic
e
;
package
com.jeequan.jeepay.mch.mq.
receiv
e
;
import
com.alibaba.fastjson.JSONArray
;
import
com.jeequan.jeepay.core.cache.RedisUtil
;
...
...
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/service/MqModifyMchAppService.java
deleted
100644 → 0
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.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
);
}
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/service/MqSendServiceImpl.java
deleted
100644 → 0
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.service
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
/**
* mq消息中转
*
* @author xiaoyu
* @site https://www.jeepay.vip
* @date 2021/6/25 17:10
*/
@Slf4j
@Service
public
class
MqSendServiceImpl
{
@Autowired
private
MqModifyMchAppService
mqModifyMchAppService
;
public
void
sendModifyMchApp
(
String
mchNo
,
String
appId
){
mqModifyMchAppService
.
send
(
mchNo
,
appId
);
}
}
Prev
1
2
3
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