fix: 攀枝花东区-缴费处理mag-app

This commit is contained in:
2025-05-19 20:46:10 +08:00
parent 6bef534d7d
commit 57fdd2c63d
112 changed files with 5439 additions and 532 deletions
@@ -1,56 +1,56 @@
package com.yida.data.system.configure;
import com.yida.data.system.collect.RedisLogCollect;
import com.yida.data.system.service.LogService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import cc.mrbird.febs.common.redis.service.RedisService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* 日志收集启动类
*
* @author ZYJ
* @date 2021/1/18
*/
@Component
@Order(100)
@Slf4j
@RequiredArgsConstructor
public class CollectLogStartBean implements InitializingBean {
private final RedisService redisService;
private final LogService logService;
/**
* 配置启动后拉取日志数据
*
* @author ZYJ
* @date 2021/1/18 9:23
*/
@Override
public void afterPropertiesSet() {
try {
//调用拉取日志方法
logServerStart();
} catch (Exception e) {
log.error("启动日志收集服务失败: {}", e.getMessage(), e);
}
}
/**
* 启动redis拉取数据类
*
* @author ZYJ
* @date 2021/1/18 10:21
*/
private void logServerStart() {
RedisLogCollect redisLogCollect = new RedisLogCollect(redisService, logService);
redisLogCollect.redisServerStart();
}
}
//package com.yida.data.system.configure;
//
//import com.yida.data.system.collect.RedisLogCollect;
//import com.yida.data.system.service.LogService;
//
//import org.springframework.beans.factory.InitializingBean;
//import org.springframework.core.annotation.Order;
//import org.springframework.stereotype.Component;
//
//import cc.mrbird.febs.common.redis.service.RedisService;
//import lombok.RequiredArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//
///**
// * 日志收集启动类
// *
// * @author ZYJ
// * @date 2021/1/18
// */
//@Component
//@Order(100)
//@Slf4j
//@RequiredArgsConstructor
//public class CollectLogStartBean implements InitializingBean {
//
// private final RedisService redisService;
//
// private final LogService logService;
//
// /**
// * 配置启动后拉取日志数据
// *
// * @author ZYJ
// * @date 2021/1/18 9:23
// */
// @Override
// public void afterPropertiesSet() {
// try {
// //调用拉取日志方法
// logServerStart();
// } catch (Exception e) {
// log.error("启动日志收集服务失败: {}", e.getMessage(), e);
// }
// }
//
// /**
// * 启动redis拉取数据类
// *
// * @author ZYJ
// * @date 2021/1/18 10:21
// */
// private void logServerStart() {
// RedisLogCollect redisLogCollect = new RedisLogCollect(redisService, logService);
// redisLogCollect.redisServerStart();
// }
//}
@@ -1,62 +1,62 @@
package com.yida.data.system.configure;
import com.yida.data.rabbit.constant.RabbitConstant;
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.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class RabbitConfig {
/**
* 微信公众号扫描事件回调交换机
*
* @return
*/
@Bean
public DirectExchange wxPublicQrExchange() {
return new DirectExchange(RabbitConstant.WXPUBLIC_QR_EXCHANGE);
}
/**
* 区域后台绑定接收消息队列队列
*
* @return
*/
@Bean
public Queue agentReceiveMsgQueue() {
return new Queue(RabbitConstant.AGENT_RECEIVE_MSG_QUEUE, true);
}
/**
* 区域后台绑定接收消息绑定
*/
@Bean
public Binding agentReceiveMsgBinding(@Qualifier("agentReceiveMsgQueue") Queue queue,
@Qualifier("wxPublicQrExchange") DirectExchange exchange) {
return BindingBuilder.bind(queue).to(exchange).with(RabbitConstant.AGENT_RECEIVE_MSG_KEY);
}
/**
* 区域后台绑定接收消息队列队列
*
* @return
*/
@Bean
public Queue visitorInviteCodeQueue() {
return new Queue(RabbitConstant.VISITOR_INVITE_CODE_QUEUE, true);
}
/**
* 区域后台绑定接收消息绑定
*/
@Bean
public Binding visitorInviteCodeBinding(@Qualifier("visitorInviteCodeQueue") Queue queue,
@Qualifier("wxPublicQrExchange") DirectExchange exchange) {
return BindingBuilder.bind(queue).to(exchange).with(RabbitConstant.VISITOR_INVITE_CODE_KEY);
}
}
//package com.yida.data.system.configure;
//
//import com.yida.data.rabbit.constant.RabbitConstant;
//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.beans.factory.annotation.Qualifier;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//@Configuration
//public class RabbitConfig {
//
// /**
// * 微信公众号扫描事件回调交换机
// *
// * @return
// */
// @Bean
// public DirectExchange wxPublicQrExchange() {
// return new DirectExchange(RabbitConstant.WXPUBLIC_QR_EXCHANGE);
// }
//
// /**
// * 区域后台绑定接收消息队列队列
// *
// * @return
// */
// @Bean
// public Queue agentReceiveMsgQueue() {
// return new Queue(RabbitConstant.AGENT_RECEIVE_MSG_QUEUE, true);
// }
//
// /**
// * 区域后台绑定接收消息绑定
// */
// @Bean
// public Binding agentReceiveMsgBinding(@Qualifier("agentReceiveMsgQueue") Queue queue,
// @Qualifier("wxPublicQrExchange") DirectExchange exchange) {
// return BindingBuilder.bind(queue).to(exchange).with(RabbitConstant.AGENT_RECEIVE_MSG_KEY);
// }
//
// /**
// * 区域后台绑定接收消息队列队列
// *
// * @return
// */
// @Bean
// public Queue visitorInviteCodeQueue() {
// return new Queue(RabbitConstant.VISITOR_INVITE_CODE_QUEUE, true);
// }
//
// /**
// * 区域后台绑定接收消息绑定
// */
// @Bean
// public Binding visitorInviteCodeBinding(@Qualifier("visitorInviteCodeQueue") Queue queue,
// @Qualifier("wxPublicQrExchange") DirectExchange exchange) {
// return BindingBuilder.bind(queue).to(exchange).with(RabbitConstant.VISITOR_INVITE_CODE_KEY);
// }
//}
@@ -1,46 +1,46 @@
package com.yida.data.system.configure;
import com.rabbitmq.client.Channel;
import com.yida.data.common.core.entity.WxPublicQr;
import com.yida.data.rabbit.constant.RabbitConstant;
import com.yida.data.system.service.EduAgentWxPublicReceiverService;
import java.io.IOException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
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.stereotype.Component;
@Slf4j
@Component
@RequiredArgsConstructor
public class SysRabbitReceiver {
private final EduAgentWxPublicReceiverService eduAgentWxPublicReceiverService;
/**
* 区域后台消息接收者
*
* @param wxPublicQr
* @param channel
* @param message
*/
@RabbitListener(bindings = @QueueBinding(
value = @Queue(RabbitConstant.AGENT_RECEIVE_MSG_QUEUE),
exchange = @Exchange(RabbitConstant.TELEPHONE_EXCHANGE)
))
public void receiveAgentReceiver(WxPublicQr wxPublicQr, Channel channel, Message message) throws IOException {
boolean success = true;
try {
eduAgentWxPublicReceiverService.wxPublicQrCall(wxPublicQr);
} catch (Exception e) {
success = false;
log.error("消费消息失败", e);
} finally {
channel.basicAck(message.getMessageProperties().getDeliveryTag(), success);
}
}
}
//package com.yida.data.system.configure;
//
//import com.rabbitmq.client.Channel;
//import com.yida.data.common.core.entity.WxPublicQr;
//import com.yida.data.rabbit.constant.RabbitConstant;
//import com.yida.data.system.service.EduAgentWxPublicReceiverService;
//import java.io.IOException;
//import lombok.RequiredArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.amqp.core.Message;
//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.stereotype.Component;
//
//@Slf4j
//@Component
//@RequiredArgsConstructor
//public class SysRabbitReceiver {
//
// private final EduAgentWxPublicReceiverService eduAgentWxPublicReceiverService;
//
// /**
// * 区域后台消息接收者
// *
// * @param wxPublicQr
// * @param channel
// * @param message
// */
// @RabbitListener(bindings = @QueueBinding(
// value = @Queue(RabbitConstant.AGENT_RECEIVE_MSG_QUEUE),
// exchange = @Exchange(RabbitConstant.TELEPHONE_EXCHANGE)
// ))
// public void receiveAgentReceiver(WxPublicQr wxPublicQr, Channel channel, Message message) throws IOException {
// boolean success = true;
// try {
// eduAgentWxPublicReceiverService.wxPublicQrCall(wxPublicQr);
// } catch (Exception e) {
// success = false;
// log.error("消费消息失败", e);
// } finally {
// channel.basicAck(message.getMessageProperties().getDeliveryTag(), success);
// }
// }
//}
@@ -24,7 +24,6 @@ import com.yida.data.common.core.entity.system.*;
import com.yida.data.common.core.entity.system.enums.RoleEnum;
import com.yida.data.common.core.exception.FebsException;
import com.yida.data.common.core.utils.*;
import com.yida.data.rabbit.util.RabbitUtil;
import com.yida.data.system.dto.MenuForUserDTO;
import com.yida.data.system.dto.SchoolAdminAccountSaveDTO;
import com.yida.data.system.dto.SchoolAdminAccountSelectPageDTO;
@@ -65,7 +64,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, SystemUser> impleme
private final RedisService redisService;
private final EduAppAccountService eduAppAccountService;
private final EduYidaAppMapper eduYidaAppMapper;
private final RabbitUtil rabbitUtil;
private final static String AUTH_CLIENT_ID = "febs";
@Lazy
@@ -10,7 +10,6 @@ import com.yida.data.common.core.entity.system.EduDeptWxPublic;
import com.yida.data.common.core.entity.system.enums.DeptTypeEnum;
import com.yida.data.common.core.utils.WxPublicUtil;
import com.yida.data.rabbit.constant.RabbitConstant;
import com.yida.data.rabbit.util.RabbitUtil;
import com.yida.data.system.aes.WXBizMsgCrypt;
import com.yida.data.system.mapper.DeptMapper;
import com.yida.data.system.mapper.EduAgentWxPublicReceiverMapper;
@@ -42,20 +41,19 @@ public class WxPublicServiceImpl implements WxPublicService {
private final EduDeptWxPublicMapper eduDeptWxPublicMapper;
private final DeptMapper deptMapper;
private final RabbitUtil rabbitUtil;
private final WxPublicUtil wxPublicUtil;
private final RedisService redisService;
@Override
public String get(String signature, String timestamp, String nonce, String echostr, String appId) {
EduDeptWxPublic sysWxPublic = eduDeptWxPublicMapper.selectOne(Wrappers.<EduDeptWxPublic>lambdaQuery()
.eq(EduDeptWxPublic::getAppId, appId));
.eq(EduDeptWxPublic::getAppId, appId));
List<String> strings = Arrays.asList(timestamp, nonce, sysWxPublic.getToken());
String str = strings.stream().sorted().collect(Collectors.joining());
String encodeStr = SecureUtil.sha1(str);
log.info("singature:[{}],time:[{}],nonce:[{}],token:[{}],encode:[{}],str:[{}]",
signature, timestamp,
nonce, sysWxPublic.getToken(), encodeStr, str);
signature, timestamp,
nonce, sysWxPublic.getToken(), encodeStr, str);
if (signature.equals(encodeStr)) {
return echostr;
} else {
@@ -66,9 +64,9 @@ public class WxPublicServiceImpl implements WxPublicService {
@Override
public void post(String signature, String timestamp, String nonce, String body, String appId) {
EduDeptWxPublic wxPublic = eduDeptWxPublicMapper.selectOne(Wrappers.<EduDeptWxPublic>lambdaQuery()
.eq(EduDeptWxPublic::getAppId, appId));
.eq(EduDeptWxPublic::getAppId, appId));
WXBizMsgCrypt wxcpt = new WXBizMsgCrypt(wxPublic.getToken(), wxPublic.getAesKey(),
wxPublic.getAppId());
wxPublic.getAppId());
log.info("signature:[{}],timestamp:[{}],nonce:[{}]body:[{}]", signature, timestamp, nonce, body);
String msg = wxcpt.DecryptMsg(signature, timestamp, nonce, body);
log.info("msg:{}", msg);
@@ -131,7 +129,7 @@ public class WxPublicServiceImpl implements WxPublicService {
break;
}
if (msgKey != null) {
rabbitUtil.convertAndSendMsg(RabbitConstant.WXPUBLIC_QR_EXCHANGE, msgKey, wxPublicQr);
// rabbitUtil.convertAndSendMsg(RabbitConstant.WXPUBLIC_QR_EXCHANGE, msgKey, wxPublicQr);
}
}
}