From 5cef56f9b48f21740d7f8033ec670ad02e58ef11 Mon Sep 17 00:00:00 2001 From: xhxu Date: Fri, 5 May 2023 17:59:18 +0800 Subject: [PATCH] =?UTF-8?q?//=E5=94=AE=E5=8D=96=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WxCouponServiceImpl.java | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java index 59483a9b8..eaa963992 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -1303,14 +1303,9 @@ public class WxCouponServiceImpl implements WxCouponService { logger.error("总库存数要大于等于可用库存数"); return new ResultData(ErrorCode.COUPON_STOCK_ERR.getCode(), "总库存数要大于等于可用库存数"); } - if(wxCoupon.getInventory() < wxCoupon.getRemainInventory()) { - // 总库存数要大于等于可用库存数 - logger.error("总库存数要大于等于可用库存数"); - return new ResultData(ErrorCode.COUPON_STOCK_ERR.getCode(), "总库存数要大于等于可用库存数"); - } if(wxCoupon.getInventory() <= oldCoupon.getInventory() - oldCoupon.getRemainInventory()) { // 库存可增, 可减, 但是要保证,总库存数要大于已售卖数 - logger.error("总库存数要大于等于可用库存数"); + logger.error("总库存数要大于已售卖数"); return new ResultData(ErrorCode.COUPON_STOCK_ERR.getCode(), "总库存数要大于已售卖数"); } @@ -1371,14 +1366,15 @@ public class WxCouponServiceImpl implements WxCouponService { throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "数据库更新数量错误"); } - // 5. 更新coupon channel 有效期 - if(wxCoupon.getValidType().equals(EnumCouponValidType.BETWEEN_TWO_TIME.getCode())) { - WxCouponChannel couponChannel = new WxCouponChannel(); - couponChannel.updateTenantInfo(wxCoupon); - couponChannel.setCouponId(wxCoupon.getId()); - couponChannel.setEndTime(wxCoupon.getValidEndDate()); - wxCouponChannelMapper.updateEndTimeByCouponId(couponChannel); - } + // 5. 更新coupon channel 有效期 todo 延期只延有效期, 不管售卖期 +// if(oldCoupon.getSoldStartTime() == null && oldCoupon.getSoldEndTime() == null +// && wxCoupon.getValidType().equals(EnumCouponValidType.BETWEEN_TWO_TIME.getCode())) { +// WxCouponChannel couponChannel = new WxCouponChannel(); +// couponChannel.updateTenantInfo(wxCoupon); +// couponChannel.setCouponId(wxCoupon.getId()); +// couponChannel.setEndTime(wxCoupon.getValidEndDate()); +// wxCouponChannelMapper.updateEndTimeByCouponId(couponChannel); +// } // 免审修改 try{