package com.jeequan.jeepay.pay.mq;

import com.jeequan.jeepay.components.mq.model.PayOrderMarketMQ;
import com.jeequan.jeepay.pay.service.PayOrderMarketReissueService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * TODO
 * 订单营销活动消费类
 * @author crystal
 * @date 2024/1/29 16:10
 */

@Slf4j
@Component
public class PayOrderMarketMQReceiver implements PayOrderMarketMQ.IMQReceiver {

    @Autowired
    private PayOrderMarketReissueService payOrderMarketReissueService;

    @Override
    public void receive(PayOrderMarketMQ.MsgPayload payload) {
        try {
            log.info("接收订单营销转账通知MQ, msg={}", payload.toString());
            payOrderMarketReissueService.transferReissue(payload.getTransferId(), payload.getType());
        }catch (Exception e) {
            log.error(e.getMessage(), e);
        }
    }
}
