生日提醒重置
This commit is contained in:
parent
a86a2fbdac
commit
b67969e032
|
|
@ -12,11 +12,16 @@ public class AAMarketTasks {
|
|||
//生日有礼奖励发放
|
||||
@Resource
|
||||
private BirthdayGiftTask birthdayGiftTask;
|
||||
//每天12时0分 0秒 执行
|
||||
@Scheduled(cron = "0 0 12 * * ?")
|
||||
//每天0时0分0秒 执行
|
||||
@Scheduled(cron = "0 0 0 * * ?")
|
||||
public void birthdayGiftTask() {
|
||||
birthdayGiftTask.deliver();
|
||||
}
|
||||
//会员生日弹窗提醒重置 每年1月1日
|
||||
@Scheduled(cron = "0 0 0 1 1 ?")
|
||||
public void birthdayGiftRemindTask() {
|
||||
birthdayGiftTask.remind();
|
||||
}
|
||||
|
||||
|
||||
//优惠券 过期
|
||||
|
|
|
|||
|
|
@ -27,13 +27,20 @@ import java.util.List;
|
|||
public class BirthdayGiftTask {
|
||||
@Resource
|
||||
private MkBirthdayGiftService birthdayGiftService;
|
||||
@DubboReference
|
||||
private ShopUserService shopUserService;
|
||||
|
||||
/**
|
||||
* 生日有礼奖励发放
|
||||
* AAMarketTasks 统一调用位置
|
||||
*/
|
||||
@Scheduled(cron = "0 0 0 * * ?")
|
||||
// @Scheduled(cron = "0 0 0 * * ?")
|
||||
public void deliver() {
|
||||
birthdayGiftService.deliver();
|
||||
}
|
||||
|
||||
public void remind() {
|
||||
shopUserService.update(new ShopUser().setBirthDayRemind(0), new QueryWrapper()
|
||||
.isNotNull(ShopUser::getBirthDay).eq(ShopUser::getBirthDayRemind, 1));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class ShopUser implements Serializable {
|
|||
/**
|
||||
* 会员生日提醒
|
||||
*/
|
||||
private String birthDayRemind;
|
||||
private Integer birthDayRemind;
|
||||
|
||||
/**
|
||||
* 0-女 1男
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class MkBirthdayGiftConfig implements Serializable {
|
|||
private String userType;
|
||||
|
||||
/**
|
||||
* 提前天数 负数
|
||||
* 提前天数
|
||||
*/
|
||||
private Integer deliverTime;
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -270,6 +270,7 @@ public class MkBirthdayGiftServiceImpl extends ServiceImpl<MkBirthdayGiftMapper,
|
|||
}
|
||||
// 如果生日在范围内,返回优惠券列表
|
||||
if (isInRange) {
|
||||
shopUserService.updateById(new ShopUser().setId(shopUser.getId()).setBirthDayRemind(1));
|
||||
return buildCouponList(config);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
@ -282,6 +283,7 @@ public class MkBirthdayGiftServiceImpl extends ServiceImpl<MkBirthdayGiftMapper,
|
|||
// 判断当前月份是否等于用户生日月份
|
||||
if (current.getMonthValue() == thisYearBirthday.getMonthValue()
|
||||
&& (current.isEqual(thisYearBirthday) || current.isBefore(thisYearBirthday))) {
|
||||
shopUserService.updateById(new ShopUser().setId(shopUser.getId()).setBirthDayRemind(1));
|
||||
return buildCouponList(config);
|
||||
}
|
||||
}
|
||||
|
|
@ -318,4 +320,6 @@ public class MkBirthdayGiftServiceImpl extends ServiceImpl<MkBirthdayGiftMapper,
|
|||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue