add: 定时删除设备报警记录中超十五天
This commit is contained in:
@@ -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 "";
|
||||
}
|
||||
|
||||
@@ -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("已将设备报警记录中超过十五天的删除成功");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user