
package com.tmerclub.cloud.payment.listener;

import com.tmerclub.cloud.api.payment.vo.SplitRuleVO;
import com.tmerclub.cloud.common.rocketmq.config.RocketMqConstant;
import com.tmerclub.cloud.payment.service.PayInfoService;
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;

import java.util.List;

/**
 * 平台转账
 *
 * @author lhd
 */
@Component
@RocketMQMessageListener(topic = RocketMqConstant.PLATFORM_TRANSFER_TOPIC, consumerGroup = RocketMqConstant.PLATFORM_TRANSFER_TOPIC)
public class PlatformTransferConsumer implements RocketMQListener<List<SplitRuleVO>> {

    @Autowired
    private PayInfoService payInfoService;

    /**
     * 平台转账
     */
    @Override
    public void onMessage(List<SplitRuleVO> splitRuleList) {
        for (SplitRuleVO splitRuleVO : splitRuleList) {
            payInfoService.platformTransfer(splitRuleVO);
        }

    }
}
