package com.jeequan.jeepay.pay.mq;

import com.jeequan.jeepay.components.mq.model.PushSpeakerMQ;
import com.jeequan.jeepay.pay.service.payorderpush.impl.PushSpeakerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 接收MQ消息
 * 业务： 新订单提醒 通知
 * @author zx
 * @date 2021/01/04 15:25
 */
@Slf4j
@Component
public class PushSpeakerMQReceiver implements PushSpeakerMQ.IMQReceiver {

    @Autowired private PushSpeakerService pushSpeakerService;

    @Override
    public void receive(PushSpeakerMQ.MsgPayload payload) {

        log.info("接收支付成功云喇叭播报MQ, msg={}", payload.toString());

        String orderId = payload.getOrderId();
        Byte orderType = payload.getOrderType();

        // 云喇叭播报
        pushSpeakerService.send(orderId, orderType);

        log.info("云喇叭播报业务结束。");

    }


}
