package cn.newfeifan.mall.module.distri.mq.consumer.topupconsumptionpoints.topupconsumptionpoints;

import cn.newfeifan.mall.module.distri.service.usertopupconsumptionpointsorder.UserTopUpConsumptionPointsOrderService;
import cn.newfeifan.mall.module.pay.dal.dataobject.order.PayOrderDO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@Slf4j
public class TopUpConsumptionPointsConsumer {

    @Resource
    private UserTopUpConsumptionPointsOrderService userTopUpConsumptionPointsOrderService;

    @EventListener
    public void onMessage(PayOrderDO payOrderDO) {
        //修改订单状态，并计算权益
        userTopUpConsumptionPointsOrderService.topUpConsumptionPoints(payOrderDO);
    }
}
