| | |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | LocalDateTime localDateTime = LocalDateTime.now().minusDays(7); |
| | | long between = ChronoUnit.DAYS.between(LocalDateTime.now(),localDateTime); |
| | | System.err.println(between); |
| | | } |
| | | |
| | | @Scheduled(cron = "0 0 7 * * ?") |
| | | public void taskSivenDay() { |
| | | try { |
| | |
| | | for (AppUser appUser : list) { |
| | | if (appUser.getVipExpireTime()!=null && appUser.getVipExpireTime().isAfter(now)){ |
| | | // 计算两个now和time的天数差 |
| | | long between = ChronoUnit.DAYS.between(appUser.getVipExpireTime(), now); |
| | | if (between<=7){ |
| | | long between = ChronoUnit.DAYS.between(now,appUser.getVipExpireTime()); |
| | | if (between<=7 &&between>=0){ |
| | | NoticeRecord noticeRecord = new NoticeRecord(); |
| | | noticeRecord.setAppUserId(appUser.getId()); |
| | | noticeRecord.setReadStatus(1); |
| | | noticeRecord.setNoticeType(1); |
| | | noticeRecord.setTitle("【会员临期通知】"); |
| | | noticeRecord.setContent("尊敬的心泉疗愈会员你好,你的会员即将在" |
| | | noticeRecord.setContent("尊敬的泉疗愈会员你好,你的会员即将在" |
| | | +appUser.getVipExpireTime().toLocalDate()+"到期,到期后将不再享受会员权益,请及时续费"); |
| | | noticeRecordService.save(noticeRecord); |
| | | } |
| | | } |
| | | AppUserTree one = appUserTreeService.lambdaQuery().eq(AppUserTree::getAppUserId, appUser.getId()) |
| | | .eq(AppUserTree::getSowAgain, 2).one(); |
| | | if(one.getTaskOne()==2||one.getTaskTwo()==2){ |
| | | if(one!=null&&(one.getTaskOne()==2||one.getTaskTwo()==2)){ |
| | | NoticeRecord noticeRecord = new NoticeRecord(); |
| | | noticeRecord.setAppUserId(appUser.getId()); |
| | | noticeRecord.setReadStatus(1); |