| @@ -711,19 +711,19 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| //释放渠道库存 | //释放渠道库存 | ||||
| WxCouponChannel couponChannel = wxCouponChannelMapper.selectById(record.getId(), record.getTenantId()); | WxCouponChannel couponChannel = wxCouponChannelMapper.selectById(record.getId(), record.getTenantId()); | ||||
| if(null == couponChannel.getChannelStock()){ | 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()); | int num = wxCouponChannelMapper.clearChannelStock(record.getId(), record.getTenantId()); | ||||
| if (num == 0) { | if (num == 0) { | ||||
| throw new MallinkException(ErrorCode.REMAIN_BACK_FAIL); | 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 | @Override | ||||