This commit is contained in:
磷叶 2025-01-25 18:03:00 +08:00
parent e6c6f8c406
commit e897418fa2
2 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,15 @@
package com.ruoyi.ss.bonusRefund.service;
import java.util.List;
import com.ruoyi.ss.bonus.domain.Bonus;
import com.ruoyi.ss.bonusRefund.domain.BonusRefund;
public interface BonusRefundConverter {
/**
* 转换为退款记录
*/
List<BonusRefund> toPo(List<Bonus> bonusList);
}

View File

@ -0,0 +1,34 @@
package com.ruoyi.ss.bonusRefund.service.impl;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.ss.bonus.domain.Bonus;
import com.ruoyi.ss.bonusRefund.domain.BonusRefund;
import com.ruoyi.ss.bonusRefund.service.BonusRefundConverter;
@Service
public class BonusRefundConverterImpl implements BonusRefundConverter {
@Override
public List<BonusRefund> toPo(List<Bonus> refundList) {
if (CollectionUtils.isEmptyElement(refundList)) {
return Collections.emptyList();
}
List<BonusRefund> result = new ArrayList<>();
for (Bonus refund : refundList) {
BonusRefund po = new BonusRefund();
po.setBonusId(refund.getId());
po.setRefundAmount(refund.getRefundAmount());
result.add(po);
}
return result;
}
}