数据删除策略定时任务
This commit is contained in:
parent
d66484f149
commit
20f62a7ddb
@ -34,6 +34,10 @@
|
|||||||
<groupId>com.inspur</groupId>
|
<groupId>com.inspur</groupId>
|
||||||
<artifactId>tzipc-common</artifactId>
|
<artifactId>tzipc-common</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.inspur</groupId>
|
||||||
|
<artifactId>tzipc-system</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -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());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user