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

@ -96,6 +96,7 @@ public interface ErrorCodeConstants {
ErrorCode DINING_PLATES_ALREADY = new ErrorCode(1_007_902_003, "餐盘已存在");
ErrorCode REFUND_NOT_EXISTS = new ErrorCode(1_007_903_001, "退款审核不存在");
ErrorCode ORDER_ALREADY_APPLY = new ErrorCode(1_007_903_002, "订单已申请退款");
ErrorCode STORE_GOODS_NOT_EXISTS = new ErrorCode(1_007_904_001, "商品不存在");

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());