diff --git a/tzipc-server/tzipc-quartz/pom.xml b/tzipc-server/tzipc-quartz/pom.xml index f42c085..31c5138 100644 --- a/tzipc-server/tzipc-quartz/pom.xml +++ b/tzipc-server/tzipc-quartz/pom.xml @@ -34,6 +34,10 @@ com.inspur tzipc-common + + com.inspur + tzipc-system + diff --git a/tzipc-server/tzipc-quartz/src/main/java/com/inspur/quartz/task/ExpDataDeletionTask.java b/tzipc-server/tzipc-quartz/src/main/java/com/inspur/quartz/task/ExpDataDeletionTask.java new file mode 100644 index 0000000..03a59ce --- /dev/null +++ b/tzipc-server/tzipc-quartz/src/main/java/com/inspur/quartz/task/ExpDataDeletionTask.java @@ -0,0 +1,24 @@ +package com.inspur.quartz.task; + +import com.inspur.common.utils.spring.SpringUtils; +import com.inspur.ipc.utils.IpcConstant; +import com.inspur.system.service.influx.InfluxDBService; +import org.springframework.stereotype.Component; +import java.time.LocalDate; + +@Component("expDataDeletionTask") +public class ExpDataDeletionTask { + + public void deleteExpDataByDate(Integer params) + { + System.out.println("执行有参方法:" + params); + InfluxDBService i = SpringUtils.getBean(InfluxDBService.class); + StringBuffer sql1 = new StringBuffer(""); + StringBuffer sql2 = new StringBuffer(""); + sql1.append("SELECT * FROM ").append(IpcConstant.PLC_MEASUREMENT).append(" where isAlarm = '0' and time < '").append(LocalDate.now().toString()).append("T00:00:00Z' -8h -").append(params.toString()).append("d"); + sql2.append("SELECT * FROM ").append(IpcConstant.SENSOR_MEASUREMENT).append(" where isAlarm = '0' and time < '").append(LocalDate.now().toString()).append("T00:00:00Z' -8h -").append(params.toString()).append("d"); + + i.query(sql1.toString()); + i.query(sql2.toString()); + } +}