
package com.tmerclub.cloud.supplier.listener;

import com.tmerclub.cloud.api.multishop.bo.OrderChangeShopWalletAmountBO;
import com.tmerclub.cloud.common.rocketmq.config.RocketMqConstant;
import com.tmerclub.cloud.supplier.service.SupplierWalletService;
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 lhd
 */
@Component
@RocketMQMessageListener(topic = RocketMqConstant.ORDER_REFUND_SUCCESS_SETTLEMENT_SUPPLIER_TOPIC, consumerGroup = RocketMqConstant.ORDER_REFUND_SUCCESS_SETTLEMENT_SUPPLIER_TOPIC)
public class OrderRefundSettlementSupplierConsumer implements RocketMQListener<OrderChangeShopWalletAmountBO> {

    @Autowired
    private SupplierWalletService supplierWalletService;

    /**
     * 订单部分退款导致订单关闭 商家结算操作
     */
    @Override
    public void onMessage(OrderChangeShopWalletAmountBO orderChangeSupplierWalletAmountBO) {
        supplierWalletService.settlementSupplierAmountByRefund(orderChangeSupplierWalletAmountBO);
    }
}
