| | |
| | | package cc.mrbird.febs.rabbit.consumer; |
| | | |
| | | import cc.mrbird.febs.mall.dto.OpenPrice; |
| | | import cc.mrbird.febs.mall.service.CJService; |
| | | import cc.mrbird.febs.rabbit.constants.QueueConstants; |
| | | 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 |
| | |
| | | @Component |
| | | public class AgentConsumer { |
| | | |
| | | @RabbitListener(queues = QueueConstants.QUEUE_DEFAULT) |
| | | public void agentReturn(Message message, Channel channel) { |
| | | log.info("消费者:{}", new String(message.getBody())); |
| | | @Autowired |
| | | private CJService cjService; |
| | | |
| | | @RabbitListener(queues = QueueConstants.QUEUE_CHOU_JIANG_TIME) |
| | | public void getChouJiangDelayMsg(String kjNo) { |
| | | |
| | | log.info("收到延时开奖信息消息,编号:{}",kjNo); |
| | | try { |
| | | cjService.getChouJiangDelayMsg(kjNo); |
| | | } catch (Exception e) { |
| | | log.error("延时开奖异常", e); |
| | | // todo 更新表 |
| | | |
| | | } |
| | | } |
| | | |
| | | @RabbitListener(queues = QueueConstants.QUEUE_NO_TIME) |
| | | public void getNoTimeDelayMsg(String kjNo) { |
| | | log.info("收到停止下注消息,编号:{}",kjNo); |
| | | try { |
| | | cjService.getNoTimeDelayMsg(kjNo); |
| | | } catch (Exception e) { |
| | | log.error("停止下注异常", e); |
| | | // todo 更新表 |
| | | |
| | | } |
| | | } |
| | | |
| | | @RabbitListener(queues = QueueConstants.QUEUE_OPEN_PRICE) |
| | | public void getOpenPriceMsg(OpenPrice openPrice) { |
| | | log.info("收到开奖信息:{}, {}", openPrice.getKjNo(), openPrice.getKjNum()); |
| | | try { |
| | | cjService.getOpenPriceMsg(openPrice.getKjNo(), openPrice.getKjNum()); |
| | | } catch (Exception e) { |
| | | log.error("开奖信息异常", e); |
| | | // todo 更新表 |
| | | |
| | | } |
| | | } |
| | | } |