Commit cf2a0c61 authored by dingzhiwei's avatar dingzhiwei
Browse files

Merge branch 'dev'

parents 387e9627 0ec9d1c0
...@@ -11,10 +11,25 @@ spring: ...@@ -11,10 +11,25 @@ spring:
host: 127.0.0.1 host: 127.0.0.1
port: 6379 port: 6379
password: password:
# 注意:以下MQ配置需注意【如需使用activeMQ则需将rabbitMQ配置注释即可】
profiles:
include:
- activeMQ
# - rabbitMQ # 需要安装延迟队列插件:https://www.rabbitmq.com/blog/2015/04/16/scheduling-messages-with-rabbitmq/
#activeMQ配置 #activeMQ配置
activemq: activemq:
broker-url: tcp://localhost:61616 #连接地址 broker-url: tcp://localhost:61616 #连接地址
#rabbitmq配置
# rabbitmq:
# addresses: 127.0.0.1:5672
# username: guest
# password: guest
# dynamic: true
# virtual-host: /
#日志配置参数。 #日志配置参数。
# 当存在logback-spring.xml文件时: 该配置将引进到logback配置, springboot配置不生效。 # 当存在logback-spring.xml文件时: 该配置将引进到logback配置, springboot配置不生效。
# 不存在logback-spring.xml 文件时, 使用springboot的配置, 同样可用。 # 不存在logback-spring.xml 文件时, 使用springboot的配置, 同样可用。
......
...@@ -22,10 +22,25 @@ spring: ...@@ -22,10 +22,25 @@ spring:
host: 127.0.0.1 host: 127.0.0.1
port: 6379 port: 6379
password: password:
# 注意:以下MQ配置需注意【如需使用activeMQ则需将rabbitMQ配置注释即可】
profiles:
include:
- activeMQ
# - rabbitMQ # 需要安装延迟队列插件:https://www.rabbitmq.com/blog/2015/04/16/scheduling-messages-with-rabbitmq/
#activeMQ配置 #activeMQ配置
activemq: activemq:
broker-url: tcp://localhost:61616 #连接地址 broker-url: tcp://localhost:61616 #连接地址
#rabbitmq配置
rabbitmq:
addresses: 127.0.0.1:5672
username: guest
password: guest
dynamic: true
virtual-host: /
#日志配置参数。 #日志配置参数。
# 当存在logback-spring.xml文件时: 该配置将引进到logback配置, springboot配置不生效。 # 当存在logback-spring.xml文件时: 该配置将引进到logback配置, springboot配置不生效。
# 不存在logback-spring.xml 文件时, 使用springboot的配置, 同样可用。 # 不存在logback-spring.xml 文件时, 使用springboot的配置, 同样可用。
......
...@@ -22,10 +22,25 @@ spring: ...@@ -22,10 +22,25 @@ spring:
host: 127.0.0.1 host: 127.0.0.1
port: 6379 port: 6379
password: password:
# 注意:以下MQ配置需注意【如需使用activeMQ则需将rabbitMQ配置注释即可】
profiles:
include:
- activeMQ
# - rabbitMQ # 需要安装延迟队列插件:https://www.rabbitmq.com/blog/2015/04/16/scheduling-messages-with-rabbitmq/
#activeMQ配置 #activeMQ配置
activemq: activemq:
broker-url: tcp://localhost:61616 #连接地址 broker-url: tcp://localhost:61616 #连接地址
#rabbitmq配置
rabbitmq:
addresses: 127.0.0.1:5672
username: guest
password: guest
dynamic: true
virtual-host: /
#日志配置参数。 #日志配置参数。
# 当存在logback-spring.xml文件时: 该配置将引进到logback配置, springboot配置不生效。 # 当存在logback-spring.xml文件时: 该配置将引进到logback配置, springboot配置不生效。
# 不存在logback-spring.xml 文件时, 使用springboot的配置, 同样可用。 # 不存在logback-spring.xml 文件时, 使用springboot的配置, 同样可用。
......
...@@ -22,10 +22,25 @@ spring: ...@@ -22,10 +22,25 @@ spring:
host: 127.0.0.1 host: 127.0.0.1
port: 6379 port: 6379
password: password:
# 注意:以下MQ配置需注意【如需使用activeMQ则需将rabbitMQ配置注释即可】
profiles:
include:
- activeMQ
# - rabbitMQ # 需要安装延迟队列插件:https://www.rabbitmq.com/blog/2015/04/16/scheduling-messages-with-rabbitmq/
#activeMQ配置 #activeMQ配置
activemq: activemq:
broker-url: tcp://localhost:61616 #连接地址 broker-url: tcp://localhost:61616 #连接地址
#rabbitmq配置
rabbitmq:
addresses: 127.0.0.1:5672
username: guest
password: guest
dynamic: true
virtual-host: /
#日志配置参数。 #日志配置参数。
# 当存在logback-spring.xml文件时: 该配置将引进到logback配置, springboot配置不生效。 # 当存在logback-spring.xml文件时: 该配置将引进到logback配置, springboot配置不生效。
# 不存在logback-spring.xml 文件时, 使用springboot的配置, 同样可用。 # 不存在logback-spring.xml 文件时, 使用springboot的配置, 同样可用。
......
# ##### 表结构及初始化数据SQL #####
# * 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.
#
##### ↓↓↓↓↓↓↓↓↓↓ 表结构DDL ↓↓↓↓↓↓↓↓↓↓ #####
-- RBAC设计思路: [用户] 1<->N [角色] 1<->N [权限] -- RBAC设计思路: [用户] 1<->N [角色] 1<->N [权限]
......
#
# * 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.
#
##### 增量发布SQL ##### ##### 增量发布SQL #####
## -- ++++ [v1.1.0] ===> [v1.1.1] ++++ ## -- ++++ [v1.1.0] ===> [v1.1.1] ++++
......
...@@ -26,6 +26,9 @@ import org.springframework.web.context.request.RequestAttributes; ...@@ -26,6 +26,9 @@ import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
...@@ -46,6 +49,30 @@ public class RequestKitBean { ...@@ -46,6 +49,30 @@ public class RequestKitBean {
/** reqContext对象中的key: 转换好的json对象 */ /** reqContext对象中的key: 转换好的json对象 */
private static final String REQ_CONTEXT_KEY_PARAMJSON = "REQ_CONTEXT_KEY_PARAMJSON"; private static final String REQ_CONTEXT_KEY_PARAMJSON = "REQ_CONTEXT_KEY_PARAMJSON";
/** JSON 格式通过请求主体(BODY)传输 获取参数 **/
public String getReqParamFromBody() {
String body = "";
if(isConvertJSON()){
try {
String str;
while((str = request.getReader().readLine()) != null){
body += str;
}
return body;
} catch (Exception e) {
log.error("请求参数转换异常! params=[{}]", body);
throw new BizException(ApiCodeEnum.PARAMS_ERROR, "转换异常");
}
}else {
return body;
}
}
/**request.getParameter 获取参数 并转换为JSON格式 **/ /**request.getParameter 获取参数 并转换为JSON格式 **/
public JSONObject reqParam2JSON() { public JSONObject reqParam2JSON() {
......
...@@ -148,8 +148,29 @@ public class CS { ...@@ -148,8 +148,29 @@ public class CS {
/** 清除商户登录用户信息 **/ /** 清除商户登录用户信息 **/
String QUEUE_MODIFY_MCH_USER_REMOVE = "queue.modify.mch.user.remove"; String QUEUE_MODIFY_MCH_USER_REMOVE = "queue.modify.mch.user.remove";
/** 用于activemq 发布订阅模式交换机**/
String FANOUT_MODIFY_SYS_CONFIG = "fanout.modify.sys.config";
/** MQ消息类型 **/
String MQ_TYPE_MODIFY_MCH_APP = "modify.mch.app";
String MQ_TYPE_MODIFY_ISV_INFO = "modify.isv.info";
String MQ_TYPE_MODIFY_MCH_INFO = "modify.mch.info";
String MQ_TYPE_MODIFY_SYS_CONFIG = "modify.sys.config";
String MQ_TYPE_CHANNEL_ORDER_QUERY = "channel.order.query";
String MQ_TYPE_PAY_ORDER_MCH_NOTIFY = "pay.order.mch.notify";
String MQ_TYPE_MCH_LOGIN_USER_REMOVE = "mch.login.user.remove";
} }
/** RabbitMQ交换机类型 **/
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";
public static final String RABBIT_MQ = "rabbitMQ";
}
//菜单类型 //菜单类型
public interface ENT_TYPE{ public interface ENT_TYPE{
......
...@@ -13,35 +13,28 @@ ...@@ -13,35 +13,28 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.jeequan.jeepay.mgr.mq.topic; package com.jeequan.jeepay.core.mq;
import com.jeequan.jeepay.core.constants.CS; /**
import lombok.extern.slf4j.Slf4j; * @author xiaoyu
import org.apache.activemq.command.ActiveMQTopic; * @site https://www.jeepay.vip
import org.springframework.beans.factory.annotation.Autowired; * @date 2021/6/25 17:10
import org.springframework.jms.core.JmsTemplate; */
import org.springframework.stereotype.Component; public abstract class MqCommonService {
/*
* 更改ISV信息
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 17:10
*/
@Slf4j
@Component
public class MqTopic4ModifyIsvInfo extends ActiveMQTopic{
@Autowired private JmsTemplate jmsTemplate;
public MqTopic4ModifyIsvInfo(){ /**
super(CS.MQ.TOPIC_MODIFY_ISV_INFO); * 消息发送
} * @param msg
* @param sendType
*/
public abstract void send(String msg, String sendType);
/** 推送消息到各个节点 **/ /**
public void push(String isvNo) { * 延迟消息发送
this.jmsTemplate.convertAndSend(this, isvNo); * @param msg
} * @param delay
* @param sendType
*/
public abstract void send(String msg, long delay, String sendType);
} }
...@@ -89,6 +89,12 @@ ...@@ -89,6 +89,12 @@
<artifactId>spring-boot-starter-activemq</artifactId> <artifactId>spring-boot-starter-activemq</artifactId>
</dependency> </dependency>
<!-- 添加对rabbitMQ的支持 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<!-- 引入 jeepay-sdk-java --> <!-- 引入 jeepay-sdk-java -->
<dependency> <dependency>
<groupId>com.jeequan</groupId> <groupId>com.jeequan</groupId>
......
...@@ -19,11 +19,11 @@ import com.alibaba.fastjson.JSONObject; ...@@ -19,11 +19,11 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jeequan.jeepay.core.aop.MethodLog; import com.jeequan.jeepay.core.aop.MethodLog;
import com.jeequan.jeepay.core.constants.ApiCodeEnum; import com.jeequan.jeepay.core.constants.ApiCodeEnum;
import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.core.entity.SysConfig; import com.jeequan.jeepay.core.entity.SysConfig;
import com.jeequan.jeepay.core.utils.StringKit;
import com.jeequan.jeepay.core.model.ApiRes; import com.jeequan.jeepay.core.model.ApiRes;
import com.jeequan.jeepay.core.mq.MqCommonService;
import com.jeequan.jeepay.mgr.ctrl.CommonCtrl; import com.jeequan.jeepay.mgr.ctrl.CommonCtrl;
import com.jeequan.jeepay.mgr.mq.topic.MqTopic4ModifySysConfig;
import com.jeequan.jeepay.service.impl.SysConfigService; import com.jeequan.jeepay.service.impl.SysConfigService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -34,7 +34,6 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -34,7 +34,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -51,7 +50,7 @@ import java.util.Map; ...@@ -51,7 +50,7 @@ import java.util.Map;
public class SysConfigController extends CommonCtrl { public class SysConfigController extends CommonCtrl {
@Autowired private SysConfigService sysConfigService; @Autowired private SysConfigService sysConfigService;
@Autowired private MqTopic4ModifySysConfig mqTopic4ModifySysConfig; @Autowired private MqCommonService mqCommonService;
/** /**
...@@ -86,7 +85,7 @@ public class SysConfigController extends CommonCtrl { ...@@ -86,7 +85,7 @@ public class SysConfigController extends CommonCtrl {
int update = sysConfigService.updateByConfigKey(updateMap); int update = sysConfigService.updateByConfigKey(updateMap);
if(update <= 0) return ApiRes.fail(ApiCodeEnum.SYSTEM_ERROR, "更新失败"); if(update <= 0) return ApiRes.fail(ApiCodeEnum.SYSTEM_ERROR, "更新失败");
mqTopic4ModifySysConfig.push(groupKey); mqCommonService.send(groupKey, CS.MQ.MQ_TYPE_MODIFY_SYS_CONFIG);
return ApiRes.ok(); return ApiRes.ok();
} }
......
...@@ -20,10 +20,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -20,10 +20,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jeequan.jeepay.core.aop.MethodLog; import com.jeequan.jeepay.core.aop.MethodLog;
import com.jeequan.jeepay.core.constants.ApiCodeEnum; import com.jeequan.jeepay.core.constants.ApiCodeEnum;
import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.core.entity.IsvInfo; import com.jeequan.jeepay.core.entity.IsvInfo;
import com.jeequan.jeepay.core.model.ApiRes; import com.jeequan.jeepay.core.model.ApiRes;
import com.jeequan.jeepay.core.mq.MqCommonService;
import com.jeequan.jeepay.mgr.ctrl.CommonCtrl; import com.jeequan.jeepay.mgr.ctrl.CommonCtrl;
import com.jeequan.jeepay.mgr.mq.topic.MqTopic4ModifyIsvInfo;
import com.jeequan.jeepay.service.impl.IsvInfoService; import com.jeequan.jeepay.service.impl.IsvInfoService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -45,7 +46,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -45,7 +46,7 @@ import org.springframework.web.bind.annotation.RestController;
public class IsvInfoController extends CommonCtrl { public class IsvInfoController extends CommonCtrl {
@Autowired private IsvInfoService isvInfoService; @Autowired private IsvInfoService isvInfoService;
@Autowired private MqTopic4ModifyIsvInfo mqTopic4ModifyIsvInfo; @Autowired private MqCommonService mqCommonService;
/** /**
* @author: pangxiaoyu * @author: pangxiaoyu
...@@ -95,7 +96,7 @@ public class IsvInfoController extends CommonCtrl { ...@@ -95,7 +96,7 @@ public class IsvInfoController extends CommonCtrl {
@RequestMapping(value="/{isvNo}", method = RequestMethod.DELETE) @RequestMapping(value="/{isvNo}", method = RequestMethod.DELETE)
public ApiRes delete(@PathVariable("isvNo") String isvNo) { public ApiRes delete(@PathVariable("isvNo") String isvNo) {
isvInfoService.removeByIsvNo(isvNo); isvInfoService.removeByIsvNo(isvNo);
mqTopic4ModifyIsvInfo.push(isvNo); // 推送mq到目前节点进行更新数据 mqCommonService.send(isvNo, CS.MQ.MQ_TYPE_MODIFY_ISV_INFO); // 推送mq到目前节点进行更新数据
return ApiRes.ok(); return ApiRes.ok();
} }
...@@ -111,7 +112,7 @@ public class IsvInfoController extends CommonCtrl { ...@@ -111,7 +112,7 @@ public class IsvInfoController extends CommonCtrl {
IsvInfo isvInfo = getObject(IsvInfo.class); IsvInfo isvInfo = getObject(IsvInfo.class);
isvInfo.setIsvNo(isvNo); isvInfo.setIsvNo(isvNo);
boolean result = isvInfoService.updateById(isvInfo); boolean result = isvInfoService.updateById(isvInfo);
mqTopic4ModifyIsvInfo.push(isvNo); // 推送mq到目前节点进行更新数据 mqCommonService.send(isvNo, CS.MQ.MQ_TYPE_MODIFY_ISV_INFO); // 推送mq到目前节点进行更新数据
if (!result) return ApiRes.fail(ApiCodeEnum.SYS_OPERATION_FAIL_UPDATE); if (!result) return ApiRes.fail(ApiCodeEnum.SYS_OPERATION_FAIL_UPDATE);
return ApiRes.ok(); return ApiRes.ok();
} }
......
...@@ -21,8 +21,8 @@ import com.jeequan.jeepay.core.constants.CS; ...@@ -21,8 +21,8 @@ import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.core.entity.PayInterfaceConfig; import com.jeequan.jeepay.core.entity.PayInterfaceConfig;
import com.jeequan.jeepay.core.entity.PayInterfaceDefine; import com.jeequan.jeepay.core.entity.PayInterfaceDefine;
import com.jeequan.jeepay.core.model.ApiRes; import com.jeequan.jeepay.core.model.ApiRes;
import com.jeequan.jeepay.core.mq.MqCommonService;
import com.jeequan.jeepay.mgr.ctrl.CommonCtrl; import com.jeequan.jeepay.mgr.ctrl.CommonCtrl;
import com.jeequan.jeepay.mgr.mq.topic.MqTopic4ModifyIsvInfo;
import com.jeequan.jeepay.service.impl.PayInterfaceConfigService; import com.jeequan.jeepay.service.impl.PayInterfaceConfigService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
...@@ -43,7 +43,7 @@ import java.util.List; ...@@ -43,7 +43,7 @@ import java.util.List;
public class IsvPayInterfaceConfigController extends CommonCtrl { public class IsvPayInterfaceConfigController extends CommonCtrl {
@Autowired private PayInterfaceConfigService payInterfaceConfigService; @Autowired private PayInterfaceConfigService payInterfaceConfigService;
@Autowired private MqTopic4ModifyIsvInfo mqTopic4ModifyIsvInfo; @Autowired private MqCommonService mqCommonService;
/** /**
* @Author: ZhuXiao * @Author: ZhuXiao
...@@ -114,7 +114,7 @@ public class IsvPayInterfaceConfigController extends CommonCtrl { ...@@ -114,7 +114,7 @@ public class IsvPayInterfaceConfigController extends CommonCtrl {
if (!result) { if (!result) {
return ApiRes.fail(ApiCodeEnum.SYSTEM_ERROR, "配置失败"); return ApiRes.fail(ApiCodeEnum.SYSTEM_ERROR, "配置失败");
} }
mqTopic4ModifyIsvInfo.push(infoId); // 推送mq到目前节点进行更新数据 mqCommonService.send(infoId, CS.MQ.MQ_TYPE_MODIFY_ISV_INFO); // 推送mq到目前节点进行更新数据
return ApiRes.ok(); return ApiRes.ok();
} }
......
...@@ -16,21 +16,19 @@ ...@@ -16,21 +16,19 @@
package com.jeequan.jeepay.mgr.ctrl.merchant; package com.jeequan.jeepay.mgr.ctrl.merchant;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jeequan.jeepay.core.aop.MethodLog; import com.jeequan.jeepay.core.aop.MethodLog;
import com.jeequan.jeepay.core.constants.ApiCodeEnum; 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.entity.MchApp;
import com.jeequan.jeepay.core.entity.MchInfo;
import com.jeequan.jeepay.core.entity.PayOrder;
import com.jeequan.jeepay.core.exception.BizException;
import com.jeequan.jeepay.core.model.ApiRes; 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.mgr.ctrl.CommonCtrl; import com.jeequan.jeepay.mgr.ctrl.CommonCtrl;
import com.jeequan.jeepay.mgr.mq.queue.MqQueue4ModifyMchUserRemove;
import com.jeequan.jeepay.mgr.mq.topic.MqTopic4ModifyMchApp;
import com.jeequan.jeepay.service.impl.MchAppService; import com.jeequan.jeepay.service.impl.MchAppService;
import com.jeequan.jeepay.service.impl.MchInfoService; import com.jeequan.jeepay.service.impl.MchInfoService;
import com.jeequan.jeepay.service.impl.PayOrderService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
...@@ -49,7 +47,7 @@ public class MchAppController extends CommonCtrl { ...@@ -49,7 +47,7 @@ public class MchAppController extends CommonCtrl {
@Autowired private MchInfoService mchInfoService; @Autowired private MchInfoService mchInfoService;
@Autowired private MchAppService mchAppService; @Autowired private MchAppService mchAppService;
@Autowired private MqTopic4ModifyMchApp mqTopic4ModifyMchApp; @Autowired private MqCommonService mqCommonService;
/** /**
* @Author: ZhuXiao * @Author: ZhuXiao
...@@ -127,7 +125,9 @@ public class MchAppController extends CommonCtrl { ...@@ -127,7 +125,9 @@ public class MchAppController extends CommonCtrl {
return ApiRes.fail(ApiCodeEnum.SYS_OPERATION_FAIL_UPDATE); return ApiRes.fail(ApiCodeEnum.SYS_OPERATION_FAIL_UPDATE);
} }
// 推送修改应用消息 // 推送修改应用消息
mqTopic4ModifyMchApp.push(mchApp.getMchNo(), 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(); return ApiRes.ok();
} }
...@@ -145,7 +145,9 @@ public class MchAppController extends CommonCtrl { ...@@ -145,7 +145,9 @@ public class MchAppController extends CommonCtrl {
mchAppService.removeByAppId(appId); mchAppService.removeByAppId(appId);
// 推送mq到目前节点进行更新数据 // 推送mq到目前节点进行更新数据
mqTopic4ModifyMchApp.push(mchApp.getMchNo(), 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(); return ApiRes.ok();
} }
......
...@@ -17,6 +17,7 @@ package com.jeequan.jeepay.mgr.ctrl.merchant; ...@@ -17,6 +17,7 @@ package com.jeequan.jeepay.mgr.ctrl.merchant;
import cn.hutool.core.codec.Base64; import cn.hutool.core.codec.Base64;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jeequan.jeepay.core.aop.MethodLog; import com.jeequan.jeepay.core.aop.MethodLog;
...@@ -25,9 +26,8 @@ import com.jeequan.jeepay.core.constants.CS; ...@@ -25,9 +26,8 @@ import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.core.entity.MchInfo; import com.jeequan.jeepay.core.entity.MchInfo;
import com.jeequan.jeepay.core.entity.SysUser; import com.jeequan.jeepay.core.entity.SysUser;
import com.jeequan.jeepay.core.model.ApiRes; import com.jeequan.jeepay.core.model.ApiRes;
import com.jeequan.jeepay.core.mq.MqCommonService;
import com.jeequan.jeepay.mgr.ctrl.CommonCtrl; import com.jeequan.jeepay.mgr.ctrl.CommonCtrl;
import com.jeequan.jeepay.mgr.mq.queue.MqQueue4ModifyMchUserRemove;
import com.jeequan.jeepay.mgr.mq.topic.MqTopic4ModifyMchInfo;
import com.jeequan.jeepay.service.impl.MchInfoService; import com.jeequan.jeepay.service.impl.MchInfoService;
import com.jeequan.jeepay.service.impl.SysUserAuthService; import com.jeequan.jeepay.service.impl.SysUserAuthService;
import com.jeequan.jeepay.service.impl.SysUserService; import com.jeequan.jeepay.service.impl.SysUserService;
...@@ -39,7 +39,9 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -39,7 +39,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.*; import java.util.HashSet;
import java.util.List;
import java.util.Set;
/** /**
* 商户管理类 * 商户管理类
...@@ -54,9 +56,8 @@ public class MchInfoController extends CommonCtrl { ...@@ -54,9 +56,8 @@ public class MchInfoController extends CommonCtrl {
@Autowired private MchInfoService mchInfoService; @Autowired private MchInfoService mchInfoService;
@Autowired private SysUserService sysUserService; @Autowired private SysUserService sysUserService;
@Autowired private MqTopic4ModifyMchInfo mqTopic4ModifyMchInfo;
@Autowired private MqQueue4ModifyMchUserRemove mqQueue4ModifyMchUserRemove;
@Autowired private SysUserAuthService sysUserAuthService; @Autowired private SysUserAuthService sysUserAuthService;
@Autowired private MqCommonService mqCommonService;
/** /**
* @author: pangxiaoyu * @author: pangxiaoyu
...@@ -113,9 +114,9 @@ public class MchInfoController extends CommonCtrl { ...@@ -113,9 +114,9 @@ public class MchInfoController extends CommonCtrl {
public ApiRes delete(@PathVariable("mchNo") String mchNo) { public ApiRes delete(@PathVariable("mchNo") String mchNo) {
List<Long> userIdList = mchInfoService.removeByMchNo(mchNo); List<Long> userIdList = mchInfoService.removeByMchNo(mchNo);
// 推送mq删除redis用户缓存 // 推送mq删除redis用户缓存
mqQueue4ModifyMchUserRemove.push(userIdList); mqCommonService.send(JSONArray.toJSONString(userIdList), CS.MQ.MQ_TYPE_MCH_LOGIN_USER_REMOVE);
// 推送mq到目前节点进行更新数据 // 推送mq到目前节点进行更新数据
mqTopic4ModifyMchInfo.push(mchNo); mqCommonService.send(mchNo, CS.MQ.MQ_TYPE_MODIFY_MCH_INFO);
return ApiRes.ok(); return ApiRes.ok();
} }
...@@ -161,7 +162,7 @@ public class MchInfoController extends CommonCtrl { ...@@ -161,7 +162,7 @@ public class MchInfoController extends CommonCtrl {
// 推送mq删除redis用户认证信息 // 推送mq删除redis用户认证信息
if (!removeCacheUserIdList.isEmpty()) { if (!removeCacheUserIdList.isEmpty()) {
mqQueue4ModifyMchUserRemove.push(removeCacheUserIdList); mqCommonService.send(JSONArray.toJSONString(removeCacheUserIdList), CS.MQ.MQ_TYPE_MCH_LOGIN_USER_REMOVE);
} }
//更新商户信息 //更新商户信息
...@@ -170,7 +171,7 @@ public class MchInfoController extends CommonCtrl { ...@@ -170,7 +171,7 @@ public class MchInfoController extends CommonCtrl {
} }
// 推送mq到目前节点进行更新数据 // 推送mq到目前节点进行更新数据
mqTopic4ModifyMchInfo.push(mchNo); mqCommonService.send(mchNo, CS.MQ.MQ_TYPE_MODIFY_MCH_INFO);
return ApiRes.ok(); return ApiRes.ok();
} }
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
*/ */
package com.jeequan.jeepay.mgr.ctrl.merchant; package com.jeequan.jeepay.mgr.ctrl.merchant;
import com.alibaba.fastjson.JSONObject;
import com.jeequan.jeepay.core.aop.MethodLog; import com.jeequan.jeepay.core.aop.MethodLog;
import com.jeequan.jeepay.core.constants.ApiCodeEnum; import com.jeequan.jeepay.core.constants.ApiCodeEnum;
import com.jeequan.jeepay.core.constants.CS; import com.jeequan.jeepay.core.constants.CS;
...@@ -22,9 +23,9 @@ import com.jeequan.jeepay.core.entity.MchApp; ...@@ -22,9 +23,9 @@ import com.jeequan.jeepay.core.entity.MchApp;
import com.jeequan.jeepay.core.entity.PayInterfaceConfig; import com.jeequan.jeepay.core.entity.PayInterfaceConfig;
import com.jeequan.jeepay.core.entity.PayInterfaceDefine; import com.jeequan.jeepay.core.entity.PayInterfaceDefine;
import com.jeequan.jeepay.core.model.ApiRes; 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.mgr.ctrl.CommonCtrl; import com.jeequan.jeepay.mgr.ctrl.CommonCtrl;
import com.jeequan.jeepay.mgr.mq.topic.MqTopic4ModifyMchApp;
import com.jeequan.jeepay.mgr.mq.topic.MqTopic4ModifyMchInfo;
import com.jeequan.jeepay.service.impl.MchAppService; import com.jeequan.jeepay.service.impl.MchAppService;
import com.jeequan.jeepay.service.impl.PayInterfaceConfigService; import com.jeequan.jeepay.service.impl.PayInterfaceConfigService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -46,8 +47,8 @@ import java.util.List; ...@@ -46,8 +47,8 @@ import java.util.List;
public class MchPayInterfaceConfigController extends CommonCtrl { public class MchPayInterfaceConfigController extends CommonCtrl {
@Autowired private PayInterfaceConfigService payInterfaceConfigService; @Autowired private PayInterfaceConfigService payInterfaceConfigService;
@Autowired private MqTopic4ModifyMchApp mqTopic4ModifyMchApp;
@Autowired private MchAppService mchAppService; @Autowired private MchAppService mchAppService;
@Autowired private MqCommonService mqCommonService;
/** /**
* @Author: ZhuXiao * @Author: ZhuXiao
...@@ -124,8 +125,9 @@ public class MchPayInterfaceConfigController extends CommonCtrl { ...@@ -124,8 +125,9 @@ public class MchPayInterfaceConfigController extends CommonCtrl {
if (!result) { if (!result) {
return ApiRes.fail(ApiCodeEnum.SYSTEM_ERROR, "配置失败"); return ApiRes.fail(ApiCodeEnum.SYSTEM_ERROR, "配置失败");
} }
JSONObject jsonObject = JsonKit.newJson("mchNo", mchApp.getMchNo());
mqTopic4ModifyMchApp.push(mchApp.getMchNo(), infoId); // 推送mq到目前节点进行更新数据 jsonObject.put("appId", infoId);
mqCommonService.send(jsonObject.toJSONString(), CS.MQ.MQ_TYPE_MODIFY_MCH_APP); // 推送mq到目前节点进行更新数据
return ApiRes.ok(); return ApiRes.ok();
} }
......
...@@ -19,11 +19,12 @@ import com.alibaba.fastjson.JSONObject; ...@@ -19,11 +19,12 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jeequan.jeepay.core.constants.ApiCodeEnum; import com.jeequan.jeepay.core.constants.ApiCodeEnum;
import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.core.entity.MchNotifyRecord; import com.jeequan.jeepay.core.entity.MchNotifyRecord;
import com.jeequan.jeepay.core.exception.BizException; import com.jeequan.jeepay.core.exception.BizException;
import com.jeequan.jeepay.core.model.ApiRes; import com.jeequan.jeepay.core.model.ApiRes;
import com.jeequan.jeepay.core.mq.MqCommonService;
import com.jeequan.jeepay.mgr.ctrl.CommonCtrl; import com.jeequan.jeepay.mgr.ctrl.CommonCtrl;
import com.jeequan.jeepay.mgr.mq.queue.MqQueue4PayOrderMchNotify;
import com.jeequan.jeepay.service.impl.MchNotifyRecordService; import com.jeequan.jeepay.service.impl.MchNotifyRecordService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -45,7 +46,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -45,7 +46,7 @@ import org.springframework.web.bind.annotation.RestController;
public class MchNotifyController extends CommonCtrl { public class MchNotifyController extends CommonCtrl {
@Autowired private MchNotifyRecordService mchNotifyService; @Autowired private MchNotifyRecordService mchNotifyService;
@Autowired private MqQueue4PayOrderMchNotify mqQueue4PayOrderMchNotify; @Autowired private MqCommonService mqCommonService;
/** /**
* @author: pangxiaoyu * @author: pangxiaoyu
...@@ -106,7 +107,7 @@ public class MchNotifyController extends CommonCtrl { ...@@ -106,7 +107,7 @@ public class MchNotifyController extends CommonCtrl {
mchNotifyService.getBaseMapper().updateIngAndAddNotifyCountLimit(notifyId); mchNotifyService.getBaseMapper().updateIngAndAddNotifyCountLimit(notifyId);
//调起MQ重发 //调起MQ重发
mqQueue4PayOrderMchNotify.send(notifyId); mqCommonService.send(notifyId+"", CS.MQ.MQ_TYPE_PAY_ORDER_MCH_NOTIFY);
return ApiRes.ok(mchNotify); return ApiRes.ok(mchNotify);
} }
......
/*
* 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;
import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.core.mq.MqCommonService;
import com.jeequan.jeepay.service.impl.SysConfigService;
import lombok.extern.slf4j.Slf4j;
import org.apache.activemq.command.ActiveMQQueue;
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;
import javax.jms.Queue;
/**
*
* @author pangxiaoyu
* @site https://www.jeepay.vip
* @date 2021-06-07 07:15
*/
@Slf4j
@Component
@Profile(CS.MQTYPE.ACTIVE_MQ)
public class ActiveMqSend extends MqCommonService {
@Autowired private JmsTemplate jmsTemplate;
@Autowired private SysConfigService sysConfigService;
@Bean("activeMqSendModifyMchUserRemove")
public Queue mqQueue4ModifyMchUserRemove(){
return new ActiveMQQueue(CS.MQ.QUEUE_MODIFY_MCH_USER_REMOVE);
}
@Lazy
@Autowired
@Qualifier("activeMqSendModifyMchUserRemove")
private Queue mqQueue4ModifyMchUserRemove;
@Bean("activeMqSendPayOrderMchNotify")
public Queue mqQueue4PayOrderMchNotify(){
return new ActiveMQQueue(CS.MQ.QUEUE_PAYORDER_MCH_NOTIFY);
}
@Lazy
@Autowired
@Qualifier("activeMqSendPayOrderMchNotify")
private Queue mqQueue4PayOrderMchNotify;
@Bean("activeMqSendModifyIsvInfo")
public ActiveMQTopic mqTopic4ModifyIsvInfo(){
return new ActiveMQTopic(CS.MQ.TOPIC_MODIFY_ISV_INFO);
}
@Lazy
@Autowired
@Qualifier("activeMqSendModifyIsvInfo")
private ActiveMQTopic mqTopic4ModifyIsvInfo;
@Bean("activeMqSendModifyMchApp")
public ActiveMQTopic mqTopic4ModifyMchApp(){
return new ActiveMQTopic(CS.MQ.TOPIC_MODIFY_MCH_APP);
}
@Lazy
@Autowired
@Qualifier("activeMqSendModifyMchApp")
private ActiveMQTopic mqTopic4ModifyMchApp;
@Bean("activeMqSendModifyMchInfo")
public ActiveMQTopic mqTopic4ModifyMchInfo(){
return new ActiveMQTopic(CS.MQ.TOPIC_MODIFY_MCH_INFO);
}
@Lazy
@Autowired
@Qualifier("activeMqSendModifyMchInfo")
private ActiveMQTopic mqTopic4ModifyMchInfo;
@Bean("activeMqSendModifySysConfig")
public ActiveMQTopic mqTopic4ModifySysConfig(){
return new ActiveMQTopic(CS.MQ.TOPIC_MODIFY_SYS_CONFIG);
}
@Lazy
@Autowired
@Qualifier("activeMqSendModifySysConfig")
private ActiveMQTopic mqTopic4ModifySysConfig;
@Override
public void send(String msg, String sendType) {
if (sendType.equals(CS.MQ.MQ_TYPE_PAY_ORDER_MCH_NOTIFY)) { // 商户订单回调
queuePayOrderMchNotify(msg);
}else if (sendType.equals(CS.MQ.MQ_TYPE_MODIFY_ISV_INFO)) { // 服务商信息修改
topicModifyIsvInfo(msg);
}else if (sendType.equals(CS.MQ.MQ_TYPE_MODIFY_MCH_APP)) { // 商户应用修改
topicModifyMchApp(msg);
}else if (sendType.equals(CS.MQ.MQ_TYPE_MODIFY_MCH_INFO)) { // 商户信息修改
topicModifyMchInfo(msg);
}else if (sendType.equals(CS.MQ.MQ_TYPE_MODIFY_SYS_CONFIG)) { // 系统配置修改
topicModifySysConfig(msg);
}else if (sendType.equals(CS.MQ.MQ_TYPE_MCH_LOGIN_USER_REMOVE)) { // 商户登录用户清除信息
queueMchLoginUserRemove(msg);
}
}
@Override
public void send(String msg, long delay, String sendType) {
}
/** 发送商户订单回调消息 **/
public void queuePayOrderMchNotify(String msg) {
this.jmsTemplate.convertAndSend(mqQueue4PayOrderMchNotify, msg);
}
/** 发送服务商信息修改消息 **/
public void topicModifyIsvInfo(String msg) {
this.jmsTemplate.convertAndSend(mqTopic4ModifyIsvInfo, msg);
}
/** 发送商户应用修改消息 **/
public void topicModifyMchApp(String msg) {
this.jmsTemplate.convertAndSend(mqTopic4ModifyMchApp, msg);
}
/** 发送商户信息修改消息 **/
public void topicModifyMchInfo(String msg) {
this.jmsTemplate.convertAndSend(mqTopic4ModifyMchInfo, msg);
}
/** 发送系统配置修改消息 **/
public void topicModifySysConfig(String msg) {
this.jmsTemplate.convertAndSend(mqTopic4ModifySysConfig, msg);
}
/** 发送商户登录用户清除信息消息 **/
public void queueMchLoginUserRemove(String msg) { this.jmsTemplate.convertAndSend(mqQueue4ModifyMchUserRemove, msg); }
/** 接收 更新系统配置项的消息 **/
@JmsListener(destination = CS.MQ.TOPIC_MODIFY_SYS_CONFIG, containerFactory = "jmsListenerContainer")
public void receive(String msg) {
log.info("成功接收更新系统配置的订阅通知, msg={}", msg);
sysConfigService.initDBConfig(msg);
log.info("系统配置静态属性已重置");
}
}
/*
* 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;
import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.core.mq.MqCommonService;
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.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
/**
*
* @author pangxiaoyu
* @site https://www.jeepay.vip
* @date 2021-06-07 07:15
*/
@Slf4j
@Component
@Profile(CS.MQTYPE.RABBIT_MQ)
public class RabbitMqSend extends MqCommonService {
@Autowired private AmqpTemplate rabbitTemplate;
@Autowired private SysConfigService sysConfigService;
@Override
public void send(String msg, String sendType) {
if (sendType.equals(CS.MQ.MQ_TYPE_PAY_ORDER_MCH_NOTIFY)) { // 商户订单回调
payOrderMchNotify(msg);
}else if (sendType.equals(CS.MQ.MQ_TYPE_MODIFY_ISV_INFO)) { // 服务商信息修改
directModifyIsvInfo(msg);
}else if (sendType.equals(CS.MQ.MQ_TYPE_MODIFY_MCH_APP)) { // 商户应用修改
directModifyMchApp(msg);
}else if (sendType.equals(CS.MQ.MQ_TYPE_MODIFY_MCH_INFO)) { // 商户信息修改
directModifyMchInfo(msg);
}else if (sendType.equals(CS.MQ.MQ_TYPE_MODIFY_SYS_CONFIG)) { // 系统配置修改
fanoutModifySysConfig(msg);
}else if (sendType.equals(CS.MQ.MQ_TYPE_MCH_LOGIN_USER_REMOVE)) { // 商户登录用户清除信息
directMchLoginUserRemove(msg);
}
}
@Override
public void send(String msg, long delay, String sendType) {
}
/** 发送商户订单回调消息 **/
public void payOrderMchNotify(String msg) {
rabbitTemplate.convertAndSend(CS.MQ.QUEUE_PAYORDER_MCH_NOTIFY, msg);
}
/** 发送服务商信息修改消息 **/
public void directModifyIsvInfo(String msg) {
rabbitTemplate.convertAndSend(CS.DIRECT_EXCHANGE, CS.MQ.TOPIC_MODIFY_ISV_INFO, msg);
}
/** 发送商户应用修改消息 **/
public void directModifyMchApp(String msg) {
rabbitTemplate.convertAndSend(CS.DIRECT_EXCHANGE, CS.MQ.TOPIC_MODIFY_MCH_APP, msg);
}
/** 发送商户信息修改消息 **/
public void directModifyMchInfo(String msg) {
rabbitTemplate.convertAndSend(CS.DIRECT_EXCHANGE, CS.MQ.TOPIC_MODIFY_MCH_INFO, msg);
}
/** 发送系统配置修改消息 **/
public void fanoutModifySysConfig(String msg) {
this.rabbitTemplate.convertAndSend(CS.FANOUT_EXCHANGE_SYS_CONFIG, CS.MQ.FANOUT_MODIFY_SYS_CONFIG, msg);
}
/** 发送商户登录用户清除信息消息 **/
public void directMchLoginUserRemove(String msg) {
this.rabbitTemplate.convertAndSend(CS.DIRECT_EXCHANGE, CS.MQ.QUEUE_MODIFY_MCH_USER_REMOVE, msg);
}
/** 接收 更新系统配置项的消息 **/
@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("系统配置静态属性已重置");
}
}
...@@ -13,9 +13,11 @@ ...@@ -13,9 +13,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.jeequan.jeepay.mgr.mq.topic; package com.jeequan.jeepay.mgr.mq.config;
import com.jeequan.jeepay.core.constants.CS;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Profile;
import org.springframework.jms.config.DefaultJmsListenerContainerFactory; import org.springframework.jms.config.DefaultJmsListenerContainerFactory;
import org.springframework.jms.config.JmsListenerContainerFactory; import org.springframework.jms.config.JmsListenerContainerFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -30,6 +32,7 @@ import javax.jms.ConnectionFactory; ...@@ -30,6 +32,7 @@ import javax.jms.ConnectionFactory;
* @date 2021/6/8 17:10 * @date 2021/6/8 17:10
*/ */
@Component @Component
@Profile(CS.MQTYPE.ACTIVE_MQ)
public class JMSConfig { public class JMSConfig {
/** 新增jmsListenerContainer, 用于接收topic类型的消息 **/ /** 新增jmsListenerContainer, 用于接收topic类型的消息 **/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment