定时推送优化!

This commit is contained in:
易焱 2019-06-13 18:11:03 +08:00
parent 65dbdf7948
commit 792c246dec
1 changed files with 14 additions and 10 deletions

View File

@ -67,19 +67,23 @@ public class RemindJobImpl implements RemindJob {
.eq(TblTmpPushRemind::getRemindDate, LocalDate.now())); .eq(TblTmpPushRemind::getRemindDate, LocalDate.now()));
final PushList pushList = new PushList(); final PushList pushList = new PushList();
list.forEach(tblTmpPushRemind -> { list.forEach(tblTmpPushRemind -> {
//查询出设备对应的名称 List<TblDeviceUser> deviceUsers = deviceUserService.list(new QueryWrapper<TblDeviceUser>().lambda()
TblDeviceUser deviceUser = deviceUserService.getOne(new QueryWrapper<TblDeviceUser>().lambda()
.eq(TblDeviceUser::getDeviceId, tblTmpPushRemind.getDeviceId()) .eq(TblDeviceUser::getDeviceId, tblTmpPushRemind.getDeviceId())
.eq(TblDeviceUser::getUserId, tblTmpPushRemind.getUserId())); .eq(TblDeviceUser::getUserId, tblTmpPushRemind.getUserId()));
if (deviceUser != null) { if (deviceUsers.size() > 0) {
setPushList(pushList, deviceUser); //查询出设备对应的名称
//更新换水提醒下次时间 TblDeviceUser deviceUser = deviceUsers.get(0);
Date nextRemindDate = nextRemindDate(tblTmpPushRemind.getRemindCycle()); if (deviceUser != null) {
Instant instant = nextRemindDate.toInstant(); setPushList(pushList, deviceUser);
ZoneId zoneId = ZoneId.systemDefault(); //更新换水提醒下次时间
tblTmpPushRemind.setRemindDate(instant.atZone(zoneId).toLocalDate()); Date nextRemindDate = nextRemindDate(tblTmpPushRemind.getRemindCycle());
tmpPushRemindService.saveOrUpdate(tblTmpPushRemind); Instant instant = nextRemindDate.toInstant();
ZoneId zoneId = ZoneId.systemDefault();
tblTmpPushRemind.setRemindDate(instant.atZone(zoneId).toLocalDate());
tmpPushRemindService.saveOrUpdate(tblTmpPushRemind);
}
} }
}); });
log.info("RemindJobImpl - commDeviceChangeWater --> end"); log.info("RemindJobImpl - commDeviceChangeWater --> end");
} }