From b1ad2f8176c74589075ef0fc0e14c7eb6affb67f Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 27 Oct 2024 20:00:00 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=BC=BA=E9=99=B7=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E3=80=91=E5=95=86=E5=9F=8E=EF=BC=9A=E6=8B=BC=E5=9B=A2=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E5=B7=B2=E6=94=AF=E4=BB=98=E7=9A=84=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E7=BC=BA=E5=B0=91=20ip=20=E5=92=8C=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=A3=80=E6=9F=A5=E4=B8=8D=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../trade/service/order/TradeOrderUpdateServiceImpl.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java index caf789cd84..deacdf189c 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java @@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.map.MapUtil; +import cn.hutool.core.net.NetUtil; import cn.hutool.core.util.ObjUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.RandomUtil; @@ -888,8 +889,8 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { if (!order.getPayStatus()) { throw exception(ORDER_CANCEL_PAID_FAIL, "已支付"); } - // 1.3 校验订单是否已退款 - if (ObjUtil.equal(TradeOrderRefundStatusEnum.NONE.getStatus(), order.getRefundStatus())) { + // 1.3 校验订单是否未退款 + if (ObjUtil.notEqual(TradeOrderRefundStatusEnum.NONE.getStatus(), order.getRefundStatus())) { throw exception(ORDER_CANCEL_PAID_FAIL, "未退款"); } @@ -897,7 +898,8 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { cancelOrder0(order, TradeOrderCancelTypeEnum.COMBINATION_CLOSE); // 2.2 创建退款单 payRefundApi.createRefund(new PayRefundCreateReqDTO() - .setAppKey(tradeOrderProperties.getPayAppKey()).setUserIp(getClientIP()) // 支付应用 + .setAppKey(tradeOrderProperties.getPayAppKey()) // 支付应用 + .setUserIp(NetUtil.getLocalhostStr()) // 使用本机 IP,因为是服务器发起退款的 .setMerchantOrderId(String.valueOf(order.getId())) // 支付单号 .setMerchantRefundId(String.valueOf(order.getId())) .setReason(TradeOrderCancelTypeEnum.COMBINATION_CLOSE.getName()).setPrice(order.getPayPrice())); // 价格信息