|
|
@@ -116,15 +116,18 @@ public class EnNotifyServiceImpl implements EnNotifyService {
|
|
|
// .formatted(kymCache.getStationName(monitorLog.getStationId()), kymCache.getShortId(monitorLog.getSn())), false);
|
|
|
} else {
|
|
|
// 先删除离线设备队列的记录,再删除离线超时队列中的记录
|
|
|
- redisTemplate.opsForZSet().remove(RedisKeys.OFFLINE, connectorStatusInfo.getConnectorId());
|
|
|
+ var isDelete = redisTemplate.opsForZSet().remove(RedisKeys.OFFLINE, connectorStatusInfo.getConnectorId());
|
|
|
var exist = redisTemplate.opsForSet().remove(RedisKeys.OFFLINE_EXPIRED, connectorStatusInfo.getConnectorId());
|
|
|
- // 更新设备监控表
|
|
|
- monitorLogService.lambdaUpdate()
|
|
|
- .eq(MonitorLog::getSn, connectorStatusInfo.getConnectorId())
|
|
|
- .eq(MonitorLog::getIsRecover, MonitorLog.IS_RECOVER_未恢复) // 未恢复的记录
|
|
|
- .set(MonitorLog::getRecoverTime, LocalDateTime.now())
|
|
|
- .set(MonitorLog::getIsRecover, MonitorLog.IS_RECOVER_已恢复) // 设置为已恢复
|
|
|
- .update();
|
|
|
+ if ((isDelete != null && isDelete > 0) || (exist != null && exist > 0)) {
|
|
|
+ // 更新设备监控表
|
|
|
+ monitorLogService.lambdaUpdate()
|
|
|
+ .eq(MonitorLog::getSn, connectorStatusInfo.getConnectorId())
|
|
|
+ .eq(MonitorLog::getIsRecover, MonitorLog.IS_RECOVER_未恢复) // 未恢复的记录
|
|
|
+ .set(MonitorLog::getRecoverTime, LocalDateTime.now())
|
|
|
+ .set(MonitorLog::getIsRecover, MonitorLog.IS_RECOVER_已恢复) // 设置为已恢复
|
|
|
+ .update();
|
|
|
+ }
|
|
|
+
|
|
|
if (exist != null && exist > 0) {
|
|
|
MailUtil.send(notifyEmail, "【设备上线通知】", "站点:%s,设备%s恢复上线"
|
|
|
.formatted(kymCache.getStationNameByConnectorId(connectorStatusInfo.getConnectorId()), kymCache.getShortId(connectorStatusInfo.getConnectorId())), false);
|