package com.jeequan.jeepay.pay.mq;

import com.jeequan.jeepay.components.mq.model.PushPrinterMQ;
import com.jeequan.jeepay.pay.service.payorderpush.impl.PushPrinterService;
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 PushPrinterMQReceiver implements PushPrinterMQ.IMQReceiver {

    @Autowired private PushPrinterService pushPrinterService;

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

        log.info("接收支付成功云打印MQ, msg={}", payload.toString());

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

        // 云打印
        pushPrinterService.send(orderId, orderType);

        log.info("云打印业务结束。");

    }


}
