From 8dceb015ec8bd9642297d757e73936af84f4aaf1 Mon Sep 17 00:00:00 2001 From: mitao <2763622819@qq.com> Date: 星期三, 14 八月 2024 18:32:19 +0800 Subject: [PATCH] 修改bug --- ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderAuctionBondServiceImpl.java | 46 +++++++++++++++++++++++----------------------- 1 files changed, 23 insertions(+), 23 deletions(-) diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderAuctionBondServiceImpl.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderAuctionBondServiceImpl.java index 34bc269..bb02da9 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderAuctionBondServiceImpl.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderAuctionBondServiceImpl.java @@ -29,8 +29,6 @@ import java.util.List; import java.util.Map; import java.util.Objects; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import java.util.stream.Collectors; import javax.annotation.Resource; import lombok.extern.slf4j.Slf4j; @@ -64,7 +62,7 @@ @Override public R<T> getOrderAuctionBond(OrderAuctionBondDTO orderAuctionBondDTO) { - + log.info("getOrderAuctionBond:{}", orderAuctionBondDTO); LambdaQueryWrapper<OrderAuctionBond> wrapper = Wrappers.lambdaQuery(); if (orderAuctionBondDTO.getUserList().size()>0){ wrapper.notIn(OrderAuctionBond::getMemberId, orderAuctionBondDTO.getUserList()); @@ -78,28 +76,30 @@ wrapper1.eq(Paylog::getOutTradeNo, orderAuctionBond.getOrderNo()); wrapper1.last("limit 1"); Paylog paylog = iPaylogService.getOne(wrapper1); - if (paylog.getPayType() == 1) {//支付宝 - boolean bo = paylogServiceImpl.refundForAlipay(paylog.getOutTradeNo(), paylog.getTradeNo(), orderAuctionBond.getBond().doubleValue()); - if (!bo) { - return R.fail("支付宝退款失败!"); + log.info("paylog:{}", paylog); + if (Objects.nonNull(paylog)) { + if (paylog.getPayType() == 1) {// 支付宝 + boolean bo = paylogServiceImpl.refundForAlipay(paylog.getOutTradeNo(), + paylog.getTradeNo(), orderAuctionBond.getBond().doubleValue()); + if (!bo) { + return R.fail("支付宝退款失败!"); + } + } else {// 微信 + String refundMoney = SinataUtil.doubleRetainTwo(paylog.getPayMoney() * 100d); + Integer refundFee = Integer.parseInt( + refundMoney.substring(0, refundMoney.length() - 3)); + String money = SinataUtil.doubleRetainTwo(paylog.getPayMoney() * 100d); + Integer totalFee = Integer.parseInt(money.substring(0, money.length() - 3)); + refundFee = Integer.parseInt(money.substring(0, money.length() - 3)); + String refundNo = OrderUtil.getOrderNoForPrefix("R"); + boolean bo = paylogServiceImpl.refundForWxpay(4, paylog.getTradeNo(), + paylog.getOutTradeNo(), refundNo, totalFee, refundFee, "2"); + if (!bo) { + return R.fail("微信退款失败!"); + } } - } else {//微信 - String refundMoney = SinataUtil.doubleRetainTwo(paylog.getPayMoney() * 100d); - Integer refundFee = Integer.parseInt(refundMoney.substring(0, refundMoney.length() - 3)); - String money = SinataUtil.doubleRetainTwo(paylog.getPayMoney() * 100d); - Integer totalFee = Integer.parseInt(money.substring(0, money.length() - 3)); - refundFee = Integer.parseInt(money.substring(0, money.length() - 3)); - - String regEx = "[^0-9]"; - Pattern p = Pattern.compile(regEx); - Matcher m = p.matcher(paylog.getOutTradeNo()); - String ma = m.replaceAll("").trim(); - boolean bo = paylogServiceImpl.refundForWxpay(4, paylog.getTradeNo(), paylog.getOutTradeNo(), "R" + ma, totalFee, refundFee, "2"); - if (!bo) { - return R.fail("微信退款失败!"); - } + orderAuctionBond.setBoundStatus(BondStatusEnum.REFUNDED); } - orderAuctionBond.setBoundStatus(BondStatusEnum.REFUNDED); } this.updateBatchById(orderAuctionBondList); return R.ok(); -- Gitblit v1.7.1