Просмотр исходного кода

//update ref

release_toaliyun_real
xhxu 4 лет назад
Родитель
Сommit
40477d8a66
2 измененных файлов: 10 добавлений и 1 удалений
  1. +9
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java
  2. +1
    -1
      mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml

+ 9
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java Просмотреть файл

@@ -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);


+ 1
- 1
mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml Просмотреть файл

@@ -346,7 +346,7 @@
</update>
<update id="setChannelStock">
update wx_coupon_channel SET channel_stock = #{number} where id = #{id} and tenant_id =#{tenantId} and channel_stock is not null
update wx_coupon_channel SET channel_stock = #{number} where id = #{id} and tenant_id =#{tenantId} and (channel_stock is null or channel_stock = 0)
</update>
<update id="clearChannelStock">


Загрузка…
Отмена
Сохранить