xiaoyong931011
2023-05-15 98cac7c25374d43b0039dc62e2042adf16883635
src/main/java/cc/mrbird/febs/rabbit/consumer/AgentConsumer.java
@@ -2,6 +2,7 @@
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;
@@ -25,13 +26,15 @@
    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 = QueueConstants.QUEUE_DEFAULT)
//    public void agentReturn(Message message, Channel channel) {
//        log.info("消费者:{}", new String(message.getBody()));
//    }
    @RabbitListener(queues = "queue_order_delay")
    @RabbitListener(queues = "queue_h_order_delay")
    public void orderCancelDelay(String id) {
        try {
            orderInfoService.autoCancelOrder(Long.parseLong(id));
@@ -40,7 +43,7 @@
        }
    }
//    @RabbitListener(queues = QueueConstants.AGENT_AUTO_LEVEL_UP)
    @RabbitListener(queues = QueueConstants.AGENT_AUTO_LEVEL_UP)
    public void agentAutoLevelUp(String id) {
        log.info("收到代理自动升级消息:{}", id);
        try {
@@ -53,10 +56,20 @@
    @RabbitListener(queues = QueueConstants.AGENT_RETURN_MONEY)
    public void agentReturnMoney(String orderId) {
        log.info("收到返利消息:{}", orderId);
        try{
        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);
//        }
//    }
}