Authored by 匡佳华

增加优惠券过期校验

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