package com.xcong.excoin.rabbit.consumer; import com.rabbitmq.client.Channel; import com.xcong.excoin.configurations.RabbitMqConfig; import com.xcong.excoin.modules.yunding.service.XchProfitService; 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.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.stereotype.Component; @Slf4j @Component @ConditionalOnProperty(prefix = "app", name = "yunding-consumer", havingValue = "true") public class YunDingConsumer { @Autowired private XchProfitService xchProfitService; @RabbitListener(queues = RabbitMqConfig.QUEUE_XCH_USDT_PRIFIT) public void xchUsdtProfit(Message message, Channel channel) { String content = new String(message.getBody()); log.info("USDT返利 : {}", content); xchProfitService.usdtProfitDistributorByOrderId(Long.parseLong(content)); } @RabbitListener(queues = RabbitMqConfig.QUEUE_XCH_AUTO_AGENT) public void xchAutoAgent(Message message, Channel channel) { String content = new String(message.getBody()); log.info("自动升级代理消息 : {}", content); try { xchProfitService.autoBeAgent(Long.parseLong(content)); } catch (Exception e) { log.info("错误",e); } } }