| @@ -1303,14 +1303,9 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| logger.error("总库存数要大于等于可用库存数"); | logger.error("总库存数要大于等于可用库存数"); | ||||
| return new ResultData(ErrorCode.COUPON_STOCK_ERR.getCode(), "总库存数要大于等于可用库存数"); | 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()) { | if(wxCoupon.getInventory() <= oldCoupon.getInventory() - oldCoupon.getRemainInventory()) { | ||||
| // 库存可增, 可减, 但是要保证,总库存数要大于已售卖数 | // 库存可增, 可减, 但是要保证,总库存数要大于已售卖数 | ||||
| logger.error("总库存数要大于等于可用库存数"); | |||||
| logger.error("总库存数要大于已售卖数"); | |||||
| return new ResultData(ErrorCode.COUPON_STOCK_ERR.getCode(), "总库存数要大于已售卖数"); | return new ResultData(ErrorCode.COUPON_STOCK_ERR.getCode(), "总库存数要大于已售卖数"); | ||||
| } | } | ||||
| @@ -1371,14 +1366,15 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "数据库更新数量错误"); | 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{ | try{ | ||||