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

[减库存还是不对][修改]:恢复之前版本, 减多了,广场方控制一下

release_toaliyun_real
Stormeye Wu пре 6 година
родитељ
комит
a1f41a598c
2 измењених фајлова са 9 додато и 3 уклоњено
  1. +7
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java
  2. +2
    -2
      mallinkService/src/main/resources/mapper/WxCouponMapper.xml

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

@@ -531,7 +531,13 @@ public class WxOrderServiceImpl implements WxOrderService {
}

try {
wxCouponMapper.backInventory(coupon.getId(), 1, coupon.getRemainInventory());
int num = wxCouponMapper.backInventory(coupon.getId(), 1, coupon.getRemainInventory());
if (num <= 0) {
// 解锁
redisLock.unlock(couponIdStr, timeStr);
logger.error("此券加库存失败, couponId: " + couponIdStr);
throw new MallinkException(ErrorCode.ORDER_IS_FAIL);
}
} catch (Exception e) {
logger.error("数据库更新失败,库存+1失败, e:" + e.getMessage());
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "库存恢复失败");


+ 2
- 2
mallinkService/src/main/resources/mapper/WxCouponMapper.xml Прегледај датотеку

@@ -526,11 +526,11 @@
</select>

<update id="reduceInventory">
update wx_coupon SET remain_inventory = remain_inventory - #{number} where id = #{id} and remain_inventory= #{remainInventory}
update wx_coupon SET remain_inventory = remain_inventory - #{number} where id = #{id} and remain_inventory - #{number} >= 0
</update>

<update id="backInventory">
update wx_coupon SET remain_inventory = remain_inventory + #{number} where id = #{id} and remain_inventory= #{remainInventory}
update wx_coupon SET remain_inventory = remain_inventory + #{number} where id = #{id} and remain_inventory + #{number} <= #{inventory}
</update>

<update id="offExpiriedCouponByValidDate">


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