From 322f8c5d4fa3f4a2ecf5554c9fa54e6e5779daa5 Mon Sep 17 00:00:00 2001 From: yanps Date: Fri, 8 Dec 2023 14:06:53 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E5=AE=9A=E6=97=B6=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E6=8A=A5=E8=AD=A6=E8=AE=B0=E5=BD=95=E4=B8=AD?= =?UTF-8?q?=E8=B6=85=E5=8D=81=E4=BA=94=E5=A4=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lnsh_station/LnshStationDeviceDriver.java | 1 + .../quartz/task/DeleteDeviceErrorLog.java | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 acs/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/DeleteDeviceErrorLog.java diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/lnsh_station/LnshStationDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/lnsh_station/LnshStationDeviceDriver.java index f598606..4e5c04a 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/lnsh_station/LnshStationDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/lnsh_station/LnshStationDeviceDriver.java @@ -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 ""; } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/DeleteDeviceErrorLog.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/DeleteDeviceErrorLog.java new file mode 100644 index 0000000..93949be --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/DeleteDeviceErrorLog.java @@ -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("已将设备报警记录中超过十五天的删除成功"); + } + +}