Commit b642fd7a by 吕明尚

修改抽奖赠送优惠券

parent 1b0a503b
......@@ -76,7 +76,7 @@ public interface ISConsumerCouponService extends IService<SConsumerCoupon>
SConsumerCoupon give(SConsumerCoupon sConsumerCoupon);
public Integer give(Long consumerId, Long couponId, Integer giveDay);
public SConsumerCoupon give(Long consumerId, Long couponId, Integer giveDay);
SConsumerCoupon queryById(Long couponId);
......
......@@ -529,7 +529,15 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
newSConsumerCoupon.setSourceType(SourceTypeEnum.GIVE.getCode());
newSConsumerCoupon.setPlatformType(sCoupon.getPlatformType());
newSConsumerCoupon.setStartDate(sCoupon.getStartDate());
newSConsumerCoupon.setEndDate(DateUtils.addDays(new Date(), sCoupon.getExpirationNumber()));
if (ObjectUtils.isEmpty(sCoupon.getExpirationNumber())) {
newSConsumerCoupon.setEndDate(sCoupon.getEndDate());
} else {
if (DateUtils.addDays(new Date(), sCoupon.getExpirationNumber()).getTime() < sCoupon.getEndDate().getTime()) {
newSConsumerCoupon.setEndDate(DateUtils.addDays(new Date(), sCoupon.getExpirationNumber()));
} else {
newSConsumerCoupon.setEndDate(sCoupon.getEndDate());
}
}
newSConsumerCoupon.setRemark(sCoupon.getRemark());
newSConsumerCoupon.setCreateTime(new Date());
int insert = baseMapper.insert(newSConsumerCoupon);
......@@ -542,7 +550,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
}
@Override
public Integer give(Long consumerId, Long couponId, Integer giveDay) {
public SConsumerCoupon give(Long consumerId, Long couponId, Integer giveDay) {
SCoupon sCoupon = sCouponService.selectSCouponById(couponId);
//创建优惠卷领取记录
SConsumerCoupon newSConsumerCoupon = new SConsumerCoupon();
......@@ -571,7 +579,8 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
newSConsumerCoupon.setEndDate(DateUtils.addDays(new Date(), giveDay));
newSConsumerCoupon.setRemark(sCoupon.getRemark());
newSConsumerCoupon.setCreateTime(new Date());
return baseMapper.insert(newSConsumerCoupon);
baseMapper.insert(newSConsumerCoupon);
return newSConsumerCoupon;
}
......
......@@ -152,7 +152,7 @@ public class WheelGameServiceImpl extends ServiceImpl<WheelGameMapper, WheelGame
SConsumerCoupon sConsumerCoupon = new SConsumerCoupon();
sConsumerCoupon.setConsumerId(user.getId());
sConsumerCoupon.setCouponId(prize.getCouponId());
SConsumerCoupon give = sConsumerCouponService.give(sConsumerCoupon);
SConsumerCoupon give = sConsumerCouponService.give(user.getId(), prize.getCouponId(), 30);
log.setIsHit(YesNoEnum.yes.getIndex());
log.setIsSend(YesNoEnum.yes.getIndex());
log.setHitPrize(prize.getPrizeName() + ":" + give.getName());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment