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