From 0c28a4d4a60075cb6ba58347b5e57cb17f98d79d Mon Sep 17 00:00:00 2001 From: Administrator <15274802129@163.com> Date: Tue, 30 Sep 2025 11:58:48 +0800 Subject: [PATCH] feat(rabbitmq): 更新消息队列路由配置 --- src/main/java/cc/mrbird/febs/rabbit/consumer/AgentConsumer.java | 253 ++++++++++++++++++++++++++----------------------- 1 files changed, 134 insertions(+), 119 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 bc97182..5c9b061 100644 --- a/src/main/java/cc/mrbird/febs/rabbit/consumer/AgentConsumer.java +++ b/src/main/java/cc/mrbird/febs/rabbit/consumer/AgentConsumer.java @@ -1,5 +1,6 @@ package cc.mrbird.febs.rabbit.consumer; +import cc.mrbird.febs.ai.service.AiKnowledgeFileService; import cc.mrbird.febs.mall.service.*; import cc.mrbird.febs.rabbit.constants.QueueConstants; import cc.mrbird.febs.rabbit.enumerates.RabbitQueueEnum; @@ -9,6 +10,7 @@ import org.springframework.amqp.core.Message; import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.stereotype.Component; import java.util.Date; @@ -19,6 +21,7 @@ **/ @Slf4j @Component +//@ConditionalOnProperty(prefix = "system", name = "job", havingValue = "true") public class AgentConsumer { @Autowired @@ -32,130 +35,142 @@ private IMemberProfitService memberProfitService; @Autowired private HappyActivityService happyActivityService; - - @RabbitListener(queues = QueueConstants.QUEUE_DEFAULT) - public void agentReturn(Message message, Channel channel) { - log.info("消费者:{}", new String(message.getBody())); - } - - @RabbitListener(queues = QueueConstants.CLOTHES_ORDER_CANCEL_DELAY) - public void orderCancelDelayClothes(String id) { - try { - apiClothesOrderService.orderCancelDelayClothes(Long.parseLong(id)); - } catch (Exception e) { - log.error("订单超时支付异常", e); - } - } - - @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.ORDER_COUPON) - public void getOrderCoupon(Long orderId) { - log.info("收到使用优惠卷消息:{}", orderId); - try { - memberProfitService.getOrderCoupon(orderId); - } catch (Exception e) { - log.error("使用优惠卷异常:", e); - } - } - @Autowired - private IVipCommonService vipCommonService; + private AiKnowledgeFileService aiKnowledgeFileService; - @RabbitListener(queues = QueueConstants.GET_SCORE_MSG) - public void getScoreMsg(Long orderId) { - log.info("收到积分消息:{}", orderId); - try { - vipCommonService.getScore(orderId); - } catch (Exception e) { - log.error("获取积分消息异常", e); - } - } +// @RabbitListener(queues = QueueConstants.QUEUE_DEFAULT) +// public void agentReturn(Message message, Channel channel) { +// log.info("消费者:{}", new String(message.getBody())); +// } +// +// @RabbitListener(queues = QueueConstants.CLOTHES_ORDER_CANCEL_DELAY) +// public void orderCancelDelayClothes(String id) { +// try { +// apiClothesOrderService.orderCancelDelayClothes(Long.parseLong(id)); +// } catch (Exception e) { +// log.error("订单超时支付异常", e); +// } +// } +// +// @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.ORDER_COUPON) +// public void getOrderCoupon(Long orderId) { +// log.info("收到使用优惠卷消息:{}", orderId); +// try { +// memberProfitService.getOrderCoupon(orderId); +// } catch (Exception e) { +// log.error("使用优惠卷异常:", e); +// } +// } +// +// @Autowired +// private IVipCommonService vipCommonService; +// +// @RabbitListener(queues = QueueConstants.GET_SCORE_MSG) +// public void getScoreMsg(Long orderId) { +// log.info("收到积分消息:{}", orderId); +// try { +// vipCommonService.getScore(orderId); +// } catch (Exception e) { +// log.error("获取积分消息异常", e); +// } +// } +// +// @RabbitListener(queues = QueueConstants.VIP_LEVEL_UP) +// public void vipLevelUp(Long orderId) { +// log.info("收到会员升级消息:{}", orderId); +// try { +// vipCommonService.levelUp(orderId); +// } catch (Exception e) { +// log.error("会员升级消息异常", e); +// } +// } +// +// @RabbitListener(queues = QueueConstants.SALE_LEVEL_UP) +// public void saleLevelUp(Long orderId) { +// log.info("收到团长升级:{}", orderId); +// try { +// vipCommonService.saleLevelUp(orderId); +// } catch (Exception e) { +// log.error("团长升级消息异常", e); +// } +// } +// +// @RabbitListener(queues = QueueConstants.ACTIVITY_ORDER_ITEM_CHECK) +// public void checkActivityItem(Long orderId) { +// log.info("收到核销活动门票:{}", orderId); +// try { +// happyActivityService.checkActivityItem(orderId); +// } catch (Exception e) { +// log.error("核销活动门票异常", e); +// } +// } +// +// @RabbitListener(queues = QueueConstants.CLOTHES_ADD_LIKE) +// public void getAddLike(Long socialId) { +// log.info("点赞:{}", socialId); +// try { +// happyActivityService.getAddLike(socialId); +// } catch (Exception e) { +// log.error("点赞异常", e); +// } +// } +// +// @RabbitListener(queues = QueueConstants.CLOTHES_ADD_COLLECT) +// public void getAddCollect(Long socialId) { +// log.info("收藏:{}", socialId); +// try { +// happyActivityService.getAddCollect(socialId); +// } catch (Exception e) { +// log.error("收藏异常", e); +// } +// } - @RabbitListener(queues = QueueConstants.VIP_LEVEL_UP) - public void vipLevelUp(Long orderId) { - log.info("收到会员升级消息:{}", orderId); + @RabbitListener(queues = QueueConstants.KNOWLEDGE_ADD_ALI) + public void getAddKnowledge(String id) { + log.info("知识库:{}", id); try { - vipCommonService.levelUp(orderId); + aiKnowledgeFileService.getAddKnowledge(id); } catch (Exception e) { - log.error("会员升级消息异常", e); - } - } - - @RabbitListener(queues = QueueConstants.SALE_LEVEL_UP) - public void saleLevelUp(Long orderId) { - log.info("收到团长升级:{}", orderId); - try { - vipCommonService.saleLevelUp(orderId); - } catch (Exception e) { - log.error("团长升级消息异常", e); - } - } - - @RabbitListener(queues = QueueConstants.ACTIVITY_ORDER_ITEM_CHECK) - public void checkActivityItem(Long orderId) { - log.info("收到核销活动门票:{}", orderId); - try { - happyActivityService.checkActivityItem(orderId); - } catch (Exception e) { - log.error("核销活动门票异常", e); - } - } - - @RabbitListener(queues = QueueConstants.CLOTHES_ADD_LIKE) - public void getAddLike(Long socialId) { - log.info("点赞:{}", socialId); - try { - happyActivityService.getAddLike(socialId); - } catch (Exception e) { - log.error("点赞异常", e); - } - } - - @RabbitListener(queues = QueueConstants.CLOTHES_ADD_COLLECT) - public void getAddCollect(Long socialId) { - log.info("收藏:{}", socialId); - try { - happyActivityService.getAddCollect(socialId); - } catch (Exception e) { - log.error("收藏异常", e); + log.error("知识库异常", e); } } } -- Gitblit v1.9.1