| | |
| | | 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.mall.dto.OpenPrice; |
| | | import cc.mrbird.febs.mall.service.CJService; |
| | | 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; |
| | |
| | | public class AgentConsumer { |
| | | |
| | | @Autowired |
| | | private IApiMallOrderInfoService orderInfoService; |
| | | @Autowired |
| | | private IAgentService agentService; |
| | | @Autowired |
| | | private IMemberProfitService memberProfitService; |
| | | private CJService cjService; |
| | | |
| | | @RabbitListener(queues = QueueConstants.QUEUE_DEFAULT) |
| | | public void agentReturn(Message message, Channel channel) { |
| | | log.info("消费者:{}", new String(message.getBody())); |
| | | } |
| | | @RabbitListener(queues = QueueConstants.QUEUE_CHOU_JIANG_TIME) |
| | | public void getChouJiangDelayMsg(String kjNo) { |
| | | |
| | | @RabbitListener(queues = "hlm_queue_order_delay") |
| | | public void orderCancelDelay(String id) { |
| | | log.info("收到延时开奖信息消息,编号:{}",kjNo); |
| | | try { |
| | | orderInfoService.autoCancelOrder(Long.parseLong(id)); |
| | | cjService.getChouJiangDelayMsg(kjNo); |
| | | } 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.PERK_MONEY) |
| | | public void perkMoneyConsumer(String id) { |
| | | log.info("收到补贴消息:{}", id); |
| | | try { |
| | | agentService.perkMoneyConsumer(Long.parseLong(id)); |
| | | } catch (Exception e) { |
| | | log.error("用户补贴异常", e); |
| | | log.error("延时开奖异常", e); |
| | | // todo 更新表 |
| | | |
| | | } |
| | | } |
| | | |
| | | @RabbitListener(queues = QueueConstants.FORCE_VOUCHER_SALE) |
| | | public void forceVoucherSaleConsumer(String price) { |
| | | log.info("收到强制卖出消息,价格:{}",price); |
| | | @RabbitListener(queues = QueueConstants.QUEUE_NO_TIME) |
| | | public void getNoTimeDelayMsg(String kjNo) { |
| | | log.info("收到停止下注消息,编号:{}",kjNo); |
| | | try { |
| | | memberProfitService.selaHalfVoucher(price); |
| | | cjService.getNoTimeDelayMsg(kjNo); |
| | | } catch (Exception e) { |
| | | log.error("强制卖出异常", 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 更新表 |
| | | |
| | | } |