fix: 退款修改退款订单状态

This commit is contained in:
张松
2024-11-12 17:32:11 +08:00
parent 9c5b5882e3
commit 405024b685
2 changed files with 13 additions and 3 deletions

View File

@@ -422,6 +422,10 @@ public class TbPayServiceImpl implements TbPayService {
throw new BadRequestException("用户不存在"); throw new BadRequestException("用户不存在");
} }
if (user.getAmount().compareTo(BigDecimal.ZERO) <= 0) {
throw new BadRequestException("余额不足");
}
shopUserMapper.update(null, new LambdaUpdateWrapper<TbShopUser>() shopUserMapper.update(null, new LambdaUpdateWrapper<TbShopUser>()
.eq(TbShopUser::getId, user.getId()) .eq(TbShopUser::getId, user.getId())
.apply(StrUtil.format("amount-{}>=0", payMount.doubleValue())) .apply(StrUtil.format("amount-{}>=0", payMount.doubleValue()))

View File

@@ -652,9 +652,15 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
log.warn("订单信息不存在: {}", payOrderId); log.warn("订单信息不存在: {}", payOrderId);
return; return;
} }
orderInfo.setStatus("refund"); TbOrderInfo returnOrder = orderInfoMapper.selectOne(new LambdaQueryWrapper<TbOrderInfo>()
orderInfo.setPaidTime(cn.hutool.core.date.DateUtil.current()); .eq(TbOrderInfo::getSource, orderInfo.getId()));
orderInfoMapper.updateById(orderInfo); if (returnOrder == null) {
log.warn("订单信息不存在: {}", payOrderId);
return;
}
returnOrder.setStatus("refund");
returnOrder.setPaidTime(cn.hutool.core.date.DateUtil.current());
orderInfoMapper.updateById(returnOrder);
} }
} }