
package com.tmerclub.cloud.product.listener;

import com.tmerclub.cloud.common.product.vo.StockBillLogVO;
import com.tmerclub.cloud.common.rocketmq.config.RocketMqConstant;
import com.tmerclub.cloud.product.service.StockBillLogService;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 入库操作监听
 *
 * @author tmerclub
 */
@Component
@RocketMQMessageListener(topic = RocketMqConstant.STOCK_BILL_LOG_PURCHASE_STORAGE_TOPIC, consumerGroup = RocketMqConstant.STOCK_BILL_LOG_PURCHASE_STORAGE_TOPIC)
public class StockBillLogStockBillLogConsumerConsumer implements RocketMQListener<StockBillLogVO> {

    @Autowired
    private StockBillLogService stockBillLogService;

    /**
     * 入库操作
     */
    @Override
    public void onMessage(StockBillLogVO message) {
        // 仅保存库存记录
        message.setChangeStock(false);
        stockBillLogService.saveInfo(message);
    }
}
