From c8b658df0004f9698f20d7017703e0901fcf8b15 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Wed, 26 Jul 2023 13:00:57 +0800
Subject: [PATCH] 短信认证
---
src/main/java/cc/mrbird/febs/rabbit/consumer/AgentConsumer.java | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 103 insertions(+), 0 deletions(-)
diff --git a/src/main/java/cc/mrbird/febs/rabbit/consumer/AgentConsumer.java b/src/main/java/cc/mrbird/febs/rabbit/consumer/AgentConsumer.java
index 79f201f..2c420a4 100644
--- a/src/main/java/cc/mrbird/febs/rabbit/consumer/AgentConsumer.java
+++ b/src/main/java/cc/mrbird/febs/rabbit/consumer/AgentConsumer.java
@@ -1,11 +1,18 @@
package cc.mrbird.febs.rabbit.consumer;
+import cc.mrbird.febs.mall.service.IAgentService;
+import cc.mrbird.febs.mall.service.IApiMallOrderInfoService;
+import cc.mrbird.febs.mall.service.IMemberProfitService;
import cc.mrbird.febs.rabbit.constants.QueueConstants;
+import cc.mrbird.febs.rabbit.enumerates.RabbitQueueEnum;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+
+import java.util.Date;
/**
* @author wzy
@@ -15,8 +22,104 @@
@Component
public class AgentConsumer {
+ @Autowired
+ private IApiMallOrderInfoService orderInfoService;
+ @Autowired
+ private IAgentService agentService;
+ @Autowired
+ private IMemberProfitService memberProfitService;
+
@RabbitListener(queues = QueueConstants.QUEUE_DEFAULT)
public void agentReturn(Message message, Channel channel) {
log.info("消费者:{}", new String(message.getBody()));
}
+
+ @RabbitListener(queues = "queue_order_delay_qay")
+ public void orderCancelDelay(String id) {
+ try {
+ orderInfoService.autoCancelOrder(Long.parseLong(id));
+ } catch (Exception e) {
+ log.error("订单超时支付异常", e);
+ }
+ }
+
+ @RabbitListener(queues = QueueConstants.AGENT_AUTO_LEVEL_UP)
+ public void agentAutoLevelUp(String id) {
+ log.info("收到代理自动升级消息:{}", id);
+ try {
+ agentService.autoUpAgentLevel(Long.parseLong(id));
+ } catch (Exception e) {
+ log.error("代理自动升级异常", e);
+ }
+ }
+
+ @RabbitListener(queues = QueueConstants.AGENT_RETURN_MONEY)
+ public void agentReturnMoney(String orderId) {
+ log.info("收到返利消息:{}", orderId);
+ try {
+ agentService.returnMoneyToAgent(Long.parseLong(orderId));
+ } catch (Exception e) {
+ log.error("返利异常", e);
+ }
+ }
+
+ @RabbitListener(queues = QueueConstants.ORDER_RETURN_MONEY)
+ public void orderReturnMoney(String orderId) {
+ log.info("收到订单返利消息:{}", orderId);
+ try {
+ memberProfitService.dynamicProfit(Long.parseLong(orderId));
+ } catch (Exception e) {
+ log.error("订单返利异常:", e);
+ }
+ }
+
+ @RabbitListener(queues = QueueConstants.YWG_MEMBER_SUB)
+ public void getMemberSubMsg(String memberOpenId) {
+ log.info("收到新增用户关注:{}", memberOpenId);
+ try {
+ agentService.addMember(memberOpenId);
+ } catch (Exception e) {
+ log.error("新增用户关注异常:", e);
+ }
+ }
+
+ @RabbitListener(queues = QueueConstants.YWG_MEMBER_SUB_SCAN)
+ public void getMemberSubScanMsg(String str) {
+ log.info("收到新增用户扫码:{}", str);
+ try {
+ agentService.addMemberScan(str);
+ } catch (Exception e) {
+ log.error("收到新增用户扫码:", e);
+ }
+ }
+
+ @RabbitListener(queues = QueueConstants.YWG_MEMBER_INFO)
+ public void getMemberInfoMsg(String str) {
+ log.info("收到用户信息:{}", str);
+ try {
+ agentService.updateMemberInfo(str);
+ } catch (Exception e) {
+ log.error("收到用户信息:", e);
+ }
+ }
+
+ @RabbitListener(queues = QueueConstants.YWG_ORDER_GET)
+ public void orderGetMsg(String str) {
+ log.info("支付后同意验证:{}", str);
+ try {
+ agentService.orderGetMsg(str);
+ } catch (Exception e) {
+ log.error("支付后同意验证:", e);
+ }
+ }
+
+ @RabbitListener(queues = QueueConstants.YWG_ROLL_SEND)
+ public void rollSendMsg(Long orderId) {
+ log.info("支付后生成我的课程或者我的民宿卷:{}", orderId);
+ try {
+ agentService.rollSendMsg(orderId);
+ } catch (Exception e) {
+ log.error("支付后生成我的课程或者我的民宿卷:", e);
+ }
+ }
}
--
Gitblit v1.9.1