package com.ruoyi.ss.dividendRefund.service.impl;

import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.ss.dividendDetail.domain.DividendDetailVO;
import com.ruoyi.ss.dividendRefund.domain.DividendRefund;
import com.ruoyi.ss.dividendRefund.service.DividendRefundConverter;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

@Service
public class DividendRefundConverterImpl implements DividendRefundConverter {

    @Override
    public List<DividendRefund> toPo(List<DividendDetailVO> refundList) {
        if (CollectionUtils.isEmptyElement(refundList)) {
            return Collections.emptyList();
        }

        List<DividendRefund> result = new ArrayList<>();
        for (DividendDetailVO refund : refundList) {
            DividendRefund po = new DividendRefund();
            po.setBonusId(refund.getId());
            po.setRefundAmount(refund.getRefundAmount());
            result.add(po);
        }

        return result;
    }

}
