package com.jeequan.jeepay.pay.mq;

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

    @Autowired private PushWxMpTemplateMsgService pushWxMpMessageService;

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

        log.info("接收支付成功微信公众号提醒通知MQ, msg={}", payload.toString());

        try {
            // 微信公众号消息提醒
            pushWxMpMessageService.send(payload.getPayOrderId(),payload.getNoticeType());

            log.info("微信公众号提醒业务结束。");

        }catch (Exception e) {
            log.error("微信公众号提醒异常" + e.getMessage());
        }
    }


}
