This commit is contained in:
zengtao01
2024-10-08 18:42:29 +08:00
parent 3e5b1d7427
commit 1a146ffc12
2 changed files with 10 additions and 0 deletions

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.member.service.refund;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
@ -19,7 +20,10 @@ import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.ORDER_ALREADY_APPLY;
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.REFUND_NOT_EXISTS;
/**
@ -86,6 +90,11 @@ public class RefundServiceImpl implements RefundService {
@Override
public Long createAppRefund(AppRefundSaveReqVO createReqVO) {
// 校验存在
List<RefundDO> refundDOS = refundMapper.selectList(Wrappers.<RefundDO>lambdaQuery().eq(RefundDO::getOrderId, createReqVO.getOrderId()));
if(CollectionUtil.isNotEmpty(refundDOS)){
throw exception(ORDER_ALREADY_APPLY);
}
// 插入
RefundDO refund = BeanUtils.toBean(createReqVO, RefundDO.class);
MemberUserDO memberUserDO = userMapper.selectById(refund.getUserId());