Commit d5c1a2ff9f356dfe7dde4d15af21441dedd83072
1 parent
09aa6b25
【缺陷修复】商城:订单取消收回优惠券失败导致管理员确认退款不成功的问题
Showing
2 changed files
with
4 additions
and
3 deletions
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponServiceImpl.java
| ... | ... | @@ -22,6 +22,7 @@ import cn.iocoder.yudao.module.promotion.enums.coupon.CouponTemplateValidityType |
| 22 | 22 | import jakarta.annotation.Resource; |
| 23 | 23 | import lombok.extern.slf4j.Slf4j; |
| 24 | 24 | import org.springframework.stereotype.Service; |
| 25 | +import org.springframework.transaction.annotation.Propagation; | |
| 25 | 26 | import org.springframework.transaction.annotation.Transactional; |
| 26 | 27 | import org.springframework.validation.annotation.Validated; |
| 27 | 28 | |
| ... | ... | @@ -176,7 +177,7 @@ public class CouponServiceImpl implements CouponService { |
| 176 | 177 | * @param couponId 模版编号 |
| 177 | 178 | * @param userId 用户编号 |
| 178 | 179 | */ |
| 179 | - @Transactional(rollbackFor = Exception.class) | |
| 180 | + @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW) // 每次调用开启一个新的事务 | |
| 180 | 181 | public void invalidateCoupon(Long couponId, Long userId) { |
| 181 | 182 | // 1.1 校验优惠券 |
| 182 | 183 | CouponDO coupon = couponMapper.selectByIdAndUserId(couponId, userId); | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/aftersale/AfterSaleServiceImpl.java
| ... | ... | @@ -36,6 +36,7 @@ import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties |
| 36 | 36 | import cn.iocoder.yudao.module.trade.service.delivery.DeliveryExpressService; |
| 37 | 37 | import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService; |
| 38 | 38 | import cn.iocoder.yudao.module.trade.service.order.TradeOrderUpdateService; |
| 39 | +import jakarta.annotation.Resource; | |
| 39 | 40 | import lombok.extern.slf4j.Slf4j; |
| 40 | 41 | import org.springframework.context.annotation.Lazy; |
| 41 | 42 | import org.springframework.stereotype.Service; |
| ... | ... | @@ -44,7 +45,6 @@ import org.springframework.transaction.support.TransactionSynchronization; |
| 44 | 45 | import org.springframework.transaction.support.TransactionSynchronizationManager; |
| 45 | 46 | import org.springframework.validation.annotation.Validated; |
| 46 | 47 | |
| 47 | -import jakarta.annotation.Resource; | |
| 48 | 48 | import java.time.LocalDateTime; |
| 49 | 49 | |
| 50 | 50 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| ... | ... | @@ -386,7 +386,7 @@ public class AfterSaleServiceImpl implements AfterSaleService { |
| 386 | 386 | public void afterCommit() { |
| 387 | 387 | // 创建退款单 |
| 388 | 388 | PayRefundCreateReqDTO createReqDTO = AfterSaleConvert.INSTANCE.convert(userIp, afterSale, tradeOrderProperties) |
| 389 | - .setReason(StrUtil.format("退款【{}】", afterSale.getSpuName()));; | |
| 389 | + .setReason(StrUtil.format("退款【{}】", afterSale.getSpuName())); | |
| 390 | 390 | Long payRefundId = payRefundApi.createRefund(createReqDTO); |
| 391 | 391 | // 更新售后单的退款单号 |
| 392 | 392 | tradeAfterSaleMapper.updateById(new AfterSaleDO().setId(afterSale.getId()).setPayRefundId(payRefundId)); | ... | ... |