peng
4 天以前 14b3dd223d4a148a4ca681a5c542901dfe74f029
framework/src/main/java/cn/lili/modules/lmk/service/impl/StoreCouponServiceImpl.java
@@ -159,7 +159,7 @@
    public Result addStoreCoupon(StoreCouponForm storeCoupon) {
        StoreCoupon entity = StoreCouponForm.getEntityByForm(storeCoupon, null);
        entity.setStatus(StoreCouponStausEnum.ENABLE.name());
        entity.setCouponClaimNum(storeCoupon.getCouponNum());
        entity.setCouponClaimNum(0);
        entity.setGenerateStatus(GenerateCouponStausEnum.NOT_GENERATE.name());
        Coupon coupon = couponService.getById(entity.getCouponId());
        Integer publishNum = coupon.getPublishNum();
@@ -212,6 +212,13 @@
                        redissonLock.unlock();
                    }
                }
                @Override
                public void afterCompletion(int status) {
                    // 确保即使在事务回滚的情况下也能释放锁
                    if (redissonLock.isHeldByCurrentThread()) {
                        redissonLock.unlock();
                    }
                }
            });
        }
    }