|
@@ -43,7 +43,7 @@ public class CouponServiceImpl implements CouponService {
|
|
|
Coupon coupon = new Coupon();
|
|
Coupon coupon = new Coupon();
|
|
|
BeanUtils.copyProperties(universalCouponDTO, coupon);
|
|
BeanUtils.copyProperties(universalCouponDTO, coupon);
|
|
|
// 网站优惠活动生成的优惠券一定是对所有用户、所有课程均有效的
|
|
// 网站优惠活动生成的优惠券一定是对所有用户、所有课程均有效的
|
|
|
- coupon.setUserId(-1);
|
|
|
|
|
|
|
+ coupon.setValidUserId(-1);
|
|
|
coupon.setCourseId(-1);
|
|
coupon.setCourseId(-1);
|
|
|
coupon.setEffective(true);
|
|
coupon.setEffective(true);
|
|
|
if(CouponValidator.isInvalid(coupon))
|
|
if(CouponValidator.isInvalid(coupon))
|
|
@@ -58,7 +58,7 @@ public class CouponServiceImpl implements CouponService {
|
|
|
Coupon coupon = new Coupon();
|
|
Coupon coupon = new Coupon();
|
|
|
BeanUtils.copyProperties(courseCouponDTO, coupon);
|
|
BeanUtils.copyProperties(courseCouponDTO, coupon);
|
|
|
// 课程优惠活动生成的优惠券是对所有用户均有效的
|
|
// 课程优惠活动生成的优惠券是对所有用户均有效的
|
|
|
- coupon.setUserId(-1);
|
|
|
|
|
|
|
+ coupon.setValidUserId(-1);
|
|
|
coupon.setEffective(true);
|
|
coupon.setEffective(true);
|
|
|
if(CouponValidator.isInvalid(coupon) || coupon.getCourseId() == -1)
|
|
if(CouponValidator.isInvalid(coupon) || coupon.getCourseId() == -1)
|
|
|
return new ResultVO<>(Constant.REQUEST_FAIL, "优惠信息填写有误!");
|
|
return new ResultVO<>(Constant.REQUEST_FAIL, "优惠信息填写有误!");
|
|
@@ -73,7 +73,7 @@ public class CouponServiceImpl implements CouponService {
|
|
|
BeanUtils.copyProperties(userCouponDTO, coupon);
|
|
BeanUtils.copyProperties(userCouponDTO, coupon);
|
|
|
coupon.setEffective(true);
|
|
coupon.setEffective(true);
|
|
|
// 用户定制化优惠活动生成的优惠券仅对某个用户有效
|
|
// 用户定制化优惠活动生成的优惠券仅对某个用户有效
|
|
|
- if(CouponValidator.isInvalid(coupon) || coupon.getUserId() == -1)
|
|
|
|
|
|
|
+ if(CouponValidator.isInvalid(coupon) || coupon.getValidUserId() == -1)
|
|
|
return new ResultVO<>(Constant.REQUEST_FAIL, "优惠信息填写有误!");
|
|
return new ResultVO<>(Constant.REQUEST_FAIL, "优惠信息填写有误!");
|
|
|
if(couponMapper.insert(coupon) > 0)
|
|
if(couponMapper.insert(coupon) > 0)
|
|
|
return new ResultVO<>(Constant.REQUEST_SUCCESS, "用户优惠券发放成功", new CouponVO(coupon));
|
|
return new ResultVO<>(Constant.REQUEST_SUCCESS, "用户优惠券发放成功", new CouponVO(coupon));
|