| @@ -209,18 +209,18 @@ public interface WxCouponService { | |||||
| * 库存减少 | * 库存减少 | ||||
| * | * | ||||
| * @param id 券ID | * @param id 券ID | ||||
| * @param remainInventory 当前库存 | |||||
| * @param number 减少数量 | * @param number 减少数量 | ||||
| * @param remainInventory 当前库存 | |||||
| */ | */ | ||||
| void reduceRemainInventory(Long id, Integer remainInventory, Integer number); | |||||
| void reduceRemainInventory(Long id, Integer number, Integer remainInventory); | |||||
| /** | /** | ||||
| * 库存退回 | * 库存退回 | ||||
| * | * | ||||
| * @param id 券ID | * @param id 券ID | ||||
| * @param remainInventory 当前库存 | |||||
| * @param number 回退数量 | * @param number 回退数量 | ||||
| * @param remainInventory 当前库存 | |||||
| */ | */ | ||||
| void backRemainInventory(Long id, Integer remainInventory, Integer number); | |||||
| void backRemainInventory(Long id, Integer number, Integer remainInventory); | |||||
| } | } | ||||
| @@ -179,7 +179,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||||
| } | } | ||||
| //更新库存 | //更新库存 | ||||
| wxCouponService.reduceRemainInventory(wxCouponOfDb.getId(), wxCouponOfDb.getRemainInventory(), merchantLnventory); | |||||
| wxCouponService.reduceRemainInventory(wxCouponOfDb.getId(), merchantLnventory, wxCouponOfDb.getRemainInventory()); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -208,7 +208,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||||
| } | } | ||||
| //退回coupon库存 | //退回coupon库存 | ||||
| if(merchantRemain!=0) { | if(merchantRemain!=0) { | ||||
| wxCouponService.backRemainInventory(queryById.getId(), wxCouponOfDb.getRemainInventory(), merchantRemain); | |||||
| wxCouponService.backRemainInventory(queryById.getId(), merchantRemain, wxCouponOfDb.getRemainInventory()); | |||||
| } | } | ||||
| } | } | ||||
| wxCouponSendMapper.updateById(record); | wxCouponSendMapper.updateById(record); | ||||
| @@ -668,7 +668,7 @@ import java.util.stream.Collectors; | |||||
| @Override | @Override | ||||
| @Transactional(isolation= Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | @Transactional(isolation= Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | ||||
| public void reduceRemainInventory(Long id, Integer remainInventory, Integer number) { | |||||
| public void reduceRemainInventory(Long id, Integer number, Integer remainInventory) { | |||||
| int num = wxCouponMapper.reduceInventory(id, number, remainInventory); | int num = wxCouponMapper.reduceInventory(id, number, remainInventory); | ||||
| if (num == 0) { | if (num == 0) { | ||||
| throw new MallinkException(ErrorCode.ORDER_SAVE_ERR); | throw new MallinkException(ErrorCode.ORDER_SAVE_ERR); | ||||
| @@ -677,7 +677,7 @@ import java.util.stream.Collectors; | |||||
| @Override | @Override | ||||
| @Transactional(isolation= Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | @Transactional(isolation= Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | ||||
| public void backRemainInventory(Long id, Integer remainInventory, Integer number) { | |||||
| public void backRemainInventory(Long id, Integer number, Integer remainInventory) { | |||||
| int num = wxCouponMapper.backInventory(id, number, remainInventory); | int num = wxCouponMapper.backInventory(id, number, remainInventory); | ||||
| if (num == 0) { | if (num == 0) { | ||||
| throw new MallinkException(ErrorCode.REMAIN_BACK_FAIL); | throw new MallinkException(ErrorCode.REMAIN_BACK_FAIL); | ||||
| @@ -513,7 +513,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| } | } | ||||
| try { | try { | ||||
| wxCouponMapper.backInventory(coupon.getId(), coupon.getRemainInventory(), 1); | |||||
| wxCouponMapper.backInventory(coupon.getId(), 1, coupon.getRemainInventory()); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("数据库更新失败,库存+1失败, e:" + e.getMessage()); | logger.error("数据库更新失败,库存+1失败, e:" + e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "库存恢复失败"); | throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "库存恢复失败"); | ||||