From 9adfc0c5aa084bc61807ce43badf8b9f48b588c3 Mon Sep 17 00:00:00 2001 From: Cui Zhi Feng <7426394+wuxixiaocui@user.noreply.gitee.com> Date: 星期四, 05 九月 2024 17:16:16 +0800 Subject: [PATCH] Merge branch 'master' into master-v2 --- src/main/java/com/mzl/flower/service/payment/UserPaymentV3Service.java | 29 ++++++++++++++++++++++++++++- 1 files changed, 28 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/mzl/flower/service/payment/UserPaymentV3Service.java b/src/main/java/com/mzl/flower/service/payment/UserPaymentV3Service.java index f9ae5d7..d77abfb 100644 --- a/src/main/java/com/mzl/flower/service/payment/UserPaymentV3Service.java +++ b/src/main/java/com/mzl/flower/service/payment/UserPaymentV3Service.java @@ -15,7 +15,9 @@ import com.mzl.flower.mapper.payment.*; import com.mzl.flower.mapper.system.UserWechatMapper; import com.mzl.flower.service.BaseService; +import com.mzl.flower.service.coupon.CouponRecordService; import com.mzl.flower.service.flower.FlowerService; +import com.mzl.flower.service.point.PointGoodsService; import com.mzl.flower.utils.UUIDGenerator; import com.wechat.pay.java.core.notification.NotificationParser; import com.wechat.pay.java.core.notification.RequestParam; @@ -103,6 +105,15 @@ @Autowired private OrderRefundMapper orderRefundMapper; + + @Autowired + private OrderPointGoodsMapper orderPointGoodsMapper; + + @Autowired + private PointGoodsService pointGoodsService; + + @Autowired + private CouponRecordService couponRecordService; /** * 微信预支付 @@ -439,8 +450,24 @@ } private void releasePrepayLock(Order order){ - log.info("恢复库存: " + order); + log.info("恢复库存 积分商品兑换券 优惠券: " + order); revertFlowerStock(order.getId()); + + //恢复积分商品兑换券 + revertPointGoodsRecord(order.getId()); + + //恢复优惠券 + couponRecordService.cancelCouponUsage(order.getId()); + } + + private void revertPointGoodsRecord(String orderId){ + List<OrderPointGoods> ls = orderPointGoodsMapper.selectList(new QueryWrapper<OrderPointGoods>() + .eq("order_id", orderId)); + if(ls != null && ls.size() > 0){ + for(OrderPointGoods pg : ls){ + pointGoodsService.revertExchangeGoods(pg.getGoodsRecordId()); + } + } } public Map payAgain(String orderId){ -- Gitblit v1.9.3