add: 定时删除设备报警记录中超十五天

This commit is contained in:
yanps
2023-12-08 14:06:53 +08:00
parent e5588a2288
commit 322f8c5d4f
2 changed files with 30 additions and 0 deletions

View File

@@ -346,6 +346,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + ".";
}
@Override
public String toString() {
return "";
}

View File

@@ -0,0 +1,29 @@
package org.nl.system.service.quartz.task;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.history.domain.AcsDeviceErrorLog;
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
/**
* 定时删除设备报警记录
*/
@Slf4j
@Component
public class DeleteDeviceErrorLog {
@Autowired
private DeviceErrorLogServiceImpl errorLogServer;
public void run(){
log.info("开始删除设备报警记录");
errorLogServer.remove(Wrappers.lambdaQuery(AcsDeviceErrorLog.class)
.lt(AcsDeviceErrorLog::getError_time, LocalDateTime.now().minusDays(15)));
log.info("已将设备报警记录中超过十五天的删除成功");
}
}