opt:删除任务定时器更新
This commit is contained in:
@@ -1,11 +1,15 @@
|
|||||||
package org.nl.wms.autotask;
|
package org.nl.wms.autotask;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateField;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.modules.wql.core.bean.WQLObject;
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
import org.nl.system.service.param.ISysParamService;
|
import org.nl.system.service.param.ISysParamService;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自动清除日志(操作日志、异常日志)数据
|
* 自动清除日志(操作日志、异常日志)数据
|
||||||
*/
|
*/
|
||||||
@@ -16,14 +20,25 @@ public class CleanLog {
|
|||||||
private final ISysParamService paramService;
|
private final ISysParamService paramService;
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
//delete from sys_log where DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL 30 day)) limit 10;
|
|
||||||
WQLObject logTab = WQLObject.getWQLObject("sys_log");
|
|
||||||
WQLObject sys_interface_log = WQLObject.getWQLObject("sys_interface_log");
|
|
||||||
int days = Integer.parseInt(paramService.findByCode("log_day").getValue());
|
|
||||||
logTab.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day))");
|
|
||||||
sys_interface_log.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day))");
|
|
||||||
|
|
||||||
log.info("自动清理日志执行成功...!");
|
//清理90天以前的任务记录
|
||||||
|
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||||
|
int days = Integer.parseInt(paramService.findByCode("task_day").getValue());
|
||||||
|
|
||||||
|
|
||||||
|
Date todayDate = DateUtil.offset(DateUtil.date(), DateField.DAY_OF_MONTH,-days);
|
||||||
|
String beforeDate = DateUtil.format(todayDate, "yyyy-MM-dd HH:mm:ss");
|
||||||
|
taskTab.delete("create_time <='" + beforeDate + "'");
|
||||||
|
|
||||||
|
|
||||||
|
//清空库存变动记录表
|
||||||
|
WQLObject ivtFlowTab = WQLObject.getWQLObject("ST_IVT_StructIvtFlow");
|
||||||
|
ivtFlowTab.delete("1=1");
|
||||||
|
//清空库区日表
|
||||||
|
WQLObject wql_IOSectDaily = WQLObject.getWQLObject("ST_IVT_IOStorDaily");
|
||||||
|
wql_IOSectDaily.delete("1=1");
|
||||||
|
|
||||||
|
log.info("自动清理任务执行成功...!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user