| | |
| | | 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(); |
| | |
| | | redissonLock.unlock(); |
| | | } |
| | | } |
| | | @Override |
| | | public void afterCompletion(int status) { |
| | | // 确保即使在事务回滚的情况下也能释放锁 |
| | | if (redissonLock.isHeldByCurrentThread()) { |
| | | redissonLock.unlock(); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |