Commit b1ad2f8176c74589075ef0fc0e14c7eb6affb67f
1 parent
ac50b4b1
【缺陷修复】商城:拼团取消已支付的订单时,缺少 ip 和状态检查不正确
Showing
1 changed file
with
5 additions
and
3 deletions
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; |
| 4 | 4 | import cn.hutool.core.date.LocalDateTimeUtil; |
| 5 | 5 | import cn.hutool.core.lang.Assert; |
| 6 | 6 | import cn.hutool.core.map.MapUtil; |
| 7 | +import cn.hutool.core.net.NetUtil; | |
| 7 | 8 | import cn.hutool.core.util.ObjUtil; |
| 8 | 9 | import cn.hutool.core.util.ObjectUtil; |
| 9 | 10 | import cn.hutool.core.util.RandomUtil; |
| ... | ... | @@ -888,8 +889,8 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { |
| 888 | 889 | if (!order.getPayStatus()) { |
| 889 | 890 | throw exception(ORDER_CANCEL_PAID_FAIL, "已支付"); |
| 890 | 891 | } |
| 891 | - // 1.3 校验订单是否已退款 | |
| 892 | - if (ObjUtil.equal(TradeOrderRefundStatusEnum.NONE.getStatus(), order.getRefundStatus())) { | |
| 892 | + // 1.3 校验订单是否未退款 | |
| 893 | + if (ObjUtil.notEqual(TradeOrderRefundStatusEnum.NONE.getStatus(), order.getRefundStatus())) { | |
| 893 | 894 | throw exception(ORDER_CANCEL_PAID_FAIL, "未退款"); |
| 894 | 895 | } |
| 895 | 896 | |
| ... | ... | @@ -897,7 +898,8 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { |
| 897 | 898 | cancelOrder0(order, TradeOrderCancelTypeEnum.COMBINATION_CLOSE); |
| 898 | 899 | // 2.2 创建退款单 |
| 899 | 900 | payRefundApi.createRefund(new PayRefundCreateReqDTO() |
| 900 | - .setAppKey(tradeOrderProperties.getPayAppKey()).setUserIp(getClientIP()) // 支付应用 | |
| 901 | + .setAppKey(tradeOrderProperties.getPayAppKey()) // 支付应用 | |
| 902 | + .setUserIp(NetUtil.getLocalhostStr()) // 使用本机 IP,因为是服务器发起退款的 | |
| 901 | 903 | .setMerchantOrderId(String.valueOf(order.getId())) // 支付单号 |
| 902 | 904 | .setMerchantRefundId(String.valueOf(order.getId())) |
| 903 | 905 | .setReason(TradeOrderCancelTypeEnum.COMBINATION_CLOSE.getName()).setPrice(order.getPayPrice())); // 价格信息 | ... | ... |