Преглед изворни кода

[库存][修改]:库存只能同增,同减

release_toaliyun_real
Stormeye Wu пре 7 година
родитељ
комит
8aca8f63e0
1 измењених фајлова са 12 додато и 0 уклоњено
  1. +12
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java

+ 12
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java Прегледај датотеку

@@ -293,6 +293,18 @@ public class WxCouponServiceImpl implements WxCouponService {
wxCouponMapper.insertSelective(record); wxCouponMapper.insertSelective(record);


} else { } else {
if(record.getInventory() != null && record.getRemainInventory() != null) {
// 库存修改检查
WxCoupon oldCoupon = wxCouponMapper.selectByPrimaryKey(record.getId());
if(oldCoupon.getRemainInventory() == record.getRemainInventory()) {
// 库存未变, 不更新库存
record.setRemainInventory(null);
record.setInventory(null);
} else {
// 库存增加,要同时增加, 库存减少,要同时减少
record.setInventory(oldCoupon.getInventory() + record.getRemainInventory() - oldCoupon.getRemainInventory());
}
}
if (merchantParamList != null && merchantParamList.size() > 0) { if (merchantParamList != null && merchantParamList.size() > 0) {
WxCouponMerchant cmParam = new WxCouponMerchant(); WxCouponMerchant cmParam = new WxCouponMerchant();
cmParam.setProductId(record.getId()); cmParam.setProductId(record.getId());


Loading…
Откажи
Сачувај