From b1b868f25b956989a9c317c773d13e21b48d25bd Mon Sep 17 00:00:00 2001 From: winter Date: Fri, 13 May 2022 16:04:37 +0800 Subject: [PATCH] fix bug --- .../service/impl/WxCouponChannelServiceImpl.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java index ce872cb3a..bbe91c526 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java @@ -711,19 +711,19 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { //释放渠道库存 WxCouponChannel couponChannel = wxCouponChannelMapper.selectById(record.getId(), record.getTenantId()); if(null == couponChannel.getChannelStock()){ - throw new MallinkException(ErrorCode.REMAIN_BACK_FAIL.getCode(),"暂无可释放库存"); + throw new MallinkException(ErrorCode.REMAIN_BACK_FAIL.getCode(),"库存已经释放,无需再次操作."); } - int num = wxCouponChannelMapper.clearChannelStock(record.getId(), record.getTenantId()); if (num == 0) { throw new MallinkException(ErrorCode.REMAIN_BACK_FAIL); } - - //减掉券库存 - int num1 = wxCouponMapper.backInventory(record.getCouponId(), record.getTenantId(), couponChannel.getChannelStock()); - if (num1 == 0) { - throw new MallinkException(ErrorCode.REMAIN_BACK_FAIL); - } + if (couponChannel.getChannelStock() > 0 ) { + //减掉券库存 + int num1 = wxCouponMapper.backInventory(record.getCouponId(), record.getTenantId(), couponChannel.getChannelStock()); + if (num1 == 0) { + throw new MallinkException(ErrorCode.REMAIN_BACK_FAIL); + } + } } @Override