|
|
@@ -45,17 +45,22 @@ public class LifeDiscountCouponUserServiceImpl extends ServiceImpl<LifeDiscountC
|
|
|
Instant instant = now.toInstant();
|
|
|
ZoneId zoneId = ZoneId.systemDefault();
|
|
|
LocalDate localNow = instant.atZone(zoneId).toLocalDate();
|
|
|
- int startResult = localNow.compareTo(lifeDiscountCoupon.getStartDate());
|
|
|
+ int startResult = localNow.compareTo(lifeDiscountCoupon.getBeginGetDate());
|
|
|
if (startResult < 0) {
|
|
|
return R.fail("该优惠劵活动时间未开始");
|
|
|
}
|
|
|
+ int getStatus = lifeDiscountCoupon.getGetStatus();
|
|
|
+ if (getStatus == 0) {
|
|
|
+ return R.fail("该优惠劵已经关闭领取");
|
|
|
+ }
|
|
|
+
|
|
|
//判断领取数量
|
|
|
for (int i = 0; i < receiveQuantity; i++) {
|
|
|
LifeDiscountCouponUser lifeDiscountCouponUser = new LifeDiscountCouponUser();
|
|
|
BeanUtils.copyProperties(lifeDiscountCouponUserDto, lifeDiscountCouponUser);
|
|
|
lifeDiscountCouponUser.setReceiveTime(new Date());
|
|
|
//存入过期时间
|
|
|
- lifeDiscountCouponUser.setExpirationTime(lifeDiscountCoupon.getEndDate());
|
|
|
+ lifeDiscountCouponUser.setExpirationTime(lifeDiscountCoupon.getValidDate());
|
|
|
//存入状态 待使用:0
|
|
|
lifeDiscountCouponUser.setStatus(Integer.parseInt(DiscountCouponEnum.WAITING_USED.getValue()));
|
|
|
lifeDiscountCouponUserMapper.insert(lifeDiscountCouponUser);
|
|
|
@@ -64,7 +69,6 @@ public class LifeDiscountCouponUserServiceImpl extends ServiceImpl<LifeDiscountC
|
|
|
lifeDiscountCoupon.setSingleQty(lifeDiscountCoupon.getSingleQty() - receiveQuantity);
|
|
|
lifeDiscountCouponMapper.updateById(lifeDiscountCoupon);
|
|
|
} catch (BeansException e) {
|
|
|
- e.printStackTrace();
|
|
|
log.error("LifeDiscountCouponController.receiveCoupon ERROR Msg=" + e.getMessage());
|
|
|
return R.fail("领取失败");
|
|
|
}
|