代码更新
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package org.nl.modules.quartz.task;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -9,20 +11,16 @@ import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AutoDelLogTask {
|
||||
|
||||
public void run () {
|
||||
public void run() {
|
||||
WQLObject logTab = WQLObject.getWQLObject("sys_log");
|
||||
|
||||
String delete_time= SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("LOG_DELETE_TIME").getValue();
|
||||
JSONArray jsonArray = WQL.getWO("SYS_LOGS01").addParam("flag", "1").process().getResultJSONArray(0);
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject json = jsonArray.getJSONObject(i);
|
||||
if (Long.parseLong(delete_time) < json.getLong("create_time")) {
|
||||
logTab.delete(json);
|
||||
}
|
||||
}
|
||||
String perNum = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("AUTO_DELETE_LOG").getValue();
|
||||
logTab.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + Integer.valueOf(perNum) + " day))");
|
||||
log.info("自动清理日志执行成功...!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,9 +118,10 @@ public class ExecutionJob extends QuartzJobBean {
|
||||
EmailVo emailVo = taskAlarm(quartzJob, ThrowableUtil.getStackTrace(e));
|
||||
emailService.send(emailVo, emailService.find());
|
||||
}
|
||||
} finally {
|
||||
log.info(logDto.toString());
|
||||
quartzLogRepository.save(logDto);
|
||||
} finally {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user