|
|
|
@@ -676,6 +676,11 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { |
|
|
|
@Transactional(isolation= Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) |
|
|
|
public void setChannelStock(WxCouponChannel record,Integer number) { |
|
|
|
//设置渠道库存, |
|
|
|
WxCouponChannel couponChannel = wxCouponChannelMapper.selectById(record.getId(), record.getTenantId()); |
|
|
|
if(null != couponChannel.getChannelStock() || couponChannel.getChannelStock().intValue() != 0){ |
|
|
|
throw new MallinkException(ErrorCode.REMAIN_BACK_FAIL.getCode(),"请先释放原有库存"); |
|
|
|
} |
|
|
|
|
|
|
|
int num = wxCouponChannelMapper.setChannelStock(record.getId(), record.getTenantId(), number); |
|
|
|
if (num == 0) { |
|
|
|
throw new MallinkException(ErrorCode.REMAIN_BACK_FAIL); |
|
|
|
@@ -693,6 +698,10 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { |
|
|
|
public void releaseChannelStock(WxCouponChannel record) { |
|
|
|
//释放渠道库存 |
|
|
|
WxCouponChannel couponChannel = wxCouponChannelMapper.selectById(record.getId(), record.getTenantId()); |
|
|
|
if(null == couponChannel.getChannelStock()){ |
|
|
|
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); |
|
|
|
|