Authored by 匡佳华

增加优惠券过期校验

@@ -287,8 +287,12 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{ @@ -287,8 +287,12 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{
287 LOGGER.info("sendCoupon failed with coupon isn't exist or isn't valid, token is {}", couponToken); 287 LOGGER.info("sendCoupon failed with coupon isn't exist or isn't valid, token is {}", couponToken);
288 return new ApiResponse(201, "优惠券未在使用中!", null); 288 return new ApiResponse(201, "优惠券未在使用中!", null);
289 } 289 }
  290 + if(coupon.getEndTime() < DateUtil.getCurrentTimeSecond()){
  291 + LOGGER.info("sendCoupon failed with coupon is expire, couponToken is {}", couponToken);
  292 + return new ApiResponse(201, "该券已过期 !" , null);
  293 + }
290 int availableNum = coupon.getCouponNum() - coupon.getSendNum(); 294 int availableNum = coupon.getCouponNum() - coupon.getSendNum();
291 - if(uidSet.size() > coupon.getCouponNum()){ 295 + if(uidSet.size() > availableNum){
292 LOGGER.info("sendCoupon failed with couponNum isn't enough, uidSize is {}, availableCouponNum is {}", uidSet.size(), availableNum); 296 LOGGER.info("sendCoupon failed with couponNum isn't enough, uidSize is {}, availableCouponNum is {}", uidSet.size(), availableNum);
293 return new ApiResponse(201, "uid数量大于当前券可用数量:"+ availableNum + "!" , null); 297 return new ApiResponse(201, "uid数量大于当前券可用数量:"+ availableNum + "!" , null);
294 } 298 }