退单金额校验问题

This commit is contained in:
2025-03-06 16:25:45 +08:00
parent c42b5ee77d
commit ad408e0656

View File

@@ -164,6 +164,7 @@ public class PayServiceImpl implements PayService {
@Override @Override
@Transactional @Transactional
public CzgResult<Object> vipPayOrder(OrderPayParamDTO payParam) { public CzgResult<Object> vipPayOrder(OrderPayParamDTO payParam) {
AssertUtil.isNull(payParam.getCheckOrderPay().getUserId(), "会员支付,订单用户不能为空");
OrderInfo orderInfo = checkPay(payParam.getCheckOrderPay()); OrderInfo orderInfo = checkPay(payParam.getCheckOrderPay());
ShopUser shopUser = new ShopUser(); ShopUser shopUser = new ShopUser();
if ("scanCode".equals(payParam.getPayType())) { if ("scanCode".equals(payParam.getPayType())) {
@@ -503,7 +504,7 @@ public class PayServiceImpl implements PayService {
} }
if (isPay) { if (isPay) {
orderInfo.setRefundAmount(orderInfo.getRefundAmount().add(param.getRefundAmount())); orderInfo.setRefundAmount(orderInfo.getRefundAmount().add(param.getRefundAmount()));
if (orderInfo.getRefundAmount().compareTo(orderInfo.getPayAmount()) < 0) { if (orderInfo.getRefundAmount().compareTo(orderInfo.getPayAmount()) > 0) {
throw new ValidateException("退单失败,可退金额不足"); throw new ValidateException("退单失败,可退金额不足");
} }
} }