生日提醒重置

This commit is contained in:
wangw 2025-10-17 10:48:37 +08:00
parent a86a2fbdac
commit b67969e032
5 changed files with 21 additions and 5 deletions

View File

@ -12,11 +12,16 @@ public class AAMarketTasks {
//生日有礼奖励发放 //生日有礼奖励发放
@Resource @Resource
private BirthdayGiftTask birthdayGiftTask; private BirthdayGiftTask birthdayGiftTask;
//每天12时0分 0秒 执行 //每天0时0分0秒 执行
@Scheduled(cron = "0 0 12 * * ?") @Scheduled(cron = "0 0 0 * * ?")
public void birthdayGiftTask() { public void birthdayGiftTask() {
birthdayGiftTask.deliver(); birthdayGiftTask.deliver();
} }
//会员生日弹窗提醒重置 每年1月1日
@Scheduled(cron = "0 0 0 1 1 ?")
public void birthdayGiftRemindTask() {
birthdayGiftTask.remind();
}
//优惠券 过期 //优惠券 过期

View File

@ -27,13 +27,20 @@ import java.util.List;
public class BirthdayGiftTask { public class BirthdayGiftTask {
@Resource @Resource
private MkBirthdayGiftService birthdayGiftService; private MkBirthdayGiftService birthdayGiftService;
@DubboReference
private ShopUserService shopUserService;
/** /**
* 生日有礼奖励发放 * 生日有礼奖励发放
* AAMarketTasks 统一调用位置
*/ */
@Scheduled(cron = "0 0 0 * * ?") // @Scheduled(cron = "0 0 0 * * ?")
public void deliver() { public void deliver() {
birthdayGiftService.deliver(); birthdayGiftService.deliver();
} }
public void remind() {
shopUserService.update(new ShopUser().setBirthDayRemind(0), new QueryWrapper()
.isNotNull(ShopUser::getBirthDay).eq(ShopUser::getBirthDayRemind, 1));
}
} }

View File

@ -60,7 +60,7 @@ public class ShopUser implements Serializable {
/** /**
* 会员生日提醒 * 会员生日提醒
*/ */
private String birthDayRemind; private Integer birthDayRemind;
/** /**
* 0- 1男 * 0- 1男

View File

@ -32,7 +32,7 @@ public class MkBirthdayGiftConfig implements Serializable {
private String userType; private String userType;
/** /**
* 提前天数 负数 * 提前天数
*/ */
private Integer deliverTime; private Integer deliverTime;
/** /**

View File

@ -270,6 +270,7 @@ public class MkBirthdayGiftServiceImpl extends ServiceImpl<MkBirthdayGiftMapper,
} }
// 如果生日在范围内返回优惠券列表 // 如果生日在范围内返回优惠券列表
if (isInRange) { if (isInRange) {
shopUserService.updateById(new ShopUser().setId(shopUser.getId()).setBirthDayRemind(1));
return buildCouponList(config); return buildCouponList(config);
} }
} catch (Exception e) { } catch (Exception e) {
@ -282,6 +283,7 @@ public class MkBirthdayGiftServiceImpl extends ServiceImpl<MkBirthdayGiftMapper,
// 判断当前月份是否等于用户生日月份 // 判断当前月份是否等于用户生日月份
if (current.getMonthValue() == thisYearBirthday.getMonthValue() if (current.getMonthValue() == thisYearBirthday.getMonthValue()
&& (current.isEqual(thisYearBirthday) || current.isBefore(thisYearBirthday))) { && (current.isEqual(thisYearBirthday) || current.isBefore(thisYearBirthday))) {
shopUserService.updateById(new ShopUser().setId(shopUser.getId()).setBirthDayRemind(1));
return buildCouponList(config); return buildCouponList(config);
} }
} }
@ -318,4 +320,6 @@ public class MkBirthdayGiftServiceImpl extends ServiceImpl<MkBirthdayGiftMapper,
} }
return resultList; return resultList;
} }
} }