定时推送优化!

This commit is contained in:
易焱 2019-06-14 19:02:06 +08:00
parent 792c246dec
commit 27f360947d
2 changed files with 7 additions and 2 deletions

View File

@ -26,7 +26,7 @@ public class TblTmpPushRemind {
@TableId(value = "device_id", type = IdType.NONE) @TableId(value = "device_id", type = IdType.NONE)
private Integer deviceId; private Integer deviceId;
@TableId(value = "device_id", type = IdType.NONE) @TableId(value = "user_id", type = IdType.NONE)
private Integer userId; private Integer userId;
private String phoneNumber; private String phoneNumber;

View File

@ -3,6 +3,7 @@ package com.ifish7.tasks.job.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.ifish7.tasks.business.device.entity.TblDevice; import com.ifish7.tasks.business.device.entity.TblDevice;
import com.ifish7.tasks.business.device.entity.TblDeviceHeaterDetail; import com.ifish7.tasks.business.device.entity.TblDeviceHeaterDetail;
import com.ifish7.tasks.business.device.entity.TblDeviceUser; import com.ifish7.tasks.business.device.entity.TblDeviceUser;
@ -58,6 +59,7 @@ public class RemindJobImpl implements RemindJob {
private final String pushContent = "【换水提醒】您的水族箱\"%s\"需要换水啦~您可以在水箱设置中更改提醒设置"; private final String pushContent = "【换水提醒】您的水族箱\"%s\"需要换水啦~您可以在水箱设置中更改提醒设置";
@Scheduled(cron = "0 0 10 * * ?") @Scheduled(cron = "0 0 10 * * ?")
@Override @Override
public void commDeviceChangeWater() { public void commDeviceChangeWater() {
@ -80,7 +82,10 @@ public class RemindJobImpl implements RemindJob {
Instant instant = nextRemindDate.toInstant(); Instant instant = nextRemindDate.toInstant();
ZoneId zoneId = ZoneId.systemDefault(); ZoneId zoneId = ZoneId.systemDefault();
tblTmpPushRemind.setRemindDate(instant.atZone(zoneId).toLocalDate()); tblTmpPushRemind.setRemindDate(instant.atZone(zoneId).toLocalDate());
tmpPushRemindService.saveOrUpdate(tblTmpPushRemind); boolean update = tmpPushRemindService.update(tblTmpPushRemind, new UpdateWrapper<TblTmpPushRemind>()
.eq("device_id", tblTmpPushRemind.getDeviceId())
.eq("user_id", tblTmpPushRemind.getUserId()));
log.info("update : " + update);
} }
} }