forked from github/dataease
Merge pull request #3704 from dataease/pr@dev@perf_disused_data_clean
perf(系统): 每天00:00:00定时清理废弃数据
This commit is contained in:
commit
1429653e35
@ -1,6 +1,8 @@
|
||||
package io.dataease.job.sechedule;
|
||||
|
||||
import com.fit2cloud.quartz.anno.QuartzScheduled;
|
||||
import io.dataease.commons.utils.LogUtil;
|
||||
import io.dataease.service.CleaningRebotService;
|
||||
import io.dataease.service.datasource.DatasourceService;
|
||||
import io.dataease.service.dataset.DataSetTableService;
|
||||
import io.dataease.service.kettle.KettleService;
|
||||
@ -17,6 +19,9 @@ public class Schedular {
|
||||
@Resource
|
||||
private KettleService kettleService;
|
||||
|
||||
@Resource
|
||||
private CleaningRebotService cleaningRebotService;
|
||||
|
||||
@QuartzScheduled(cron = "0 0/3 * * * ?")
|
||||
public void updateDatasetTableStatus() {
|
||||
dataSetTableService.updateDatasetTableStatus();
|
||||
@ -32,4 +37,10 @@ public class Schedular {
|
||||
kettleService.updateKettleStatus();
|
||||
}
|
||||
|
||||
@QuartzScheduled(cron = "0 0 0 ? * *")
|
||||
public void cheanDisusedData() {
|
||||
LogUtil.info("start execute clean task...");
|
||||
cleaningRebotService.execute();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.dataease.service;
|
||||
|
||||
import io.dataease.ext.CleaningRebotMapper;
|
||||
import io.dataease.service.message.SysMsgService;
|
||||
import io.dataease.service.sys.log.LogService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -20,6 +21,9 @@ public class CleaningRebotService {
|
||||
@Resource
|
||||
private LogService logService;
|
||||
|
||||
@Resource
|
||||
private SysMsgService sysMsgService;
|
||||
|
||||
public void execute() {
|
||||
int floatDept = 0;
|
||||
do {
|
||||
@ -38,5 +42,6 @@ public class CleaningRebotService {
|
||||
cleaningRebotMapper.delFloatingCreatorLinkMapping();
|
||||
}
|
||||
logService.cleanDisusedLog();
|
||||
sysMsgService.cleanDisusedMsg();
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +55,13 @@ public class SysMsgService {
|
||||
@Autowired
|
||||
private SystemParameterService systemParameterService;
|
||||
|
||||
public void cleanDisusedMsg() {
|
||||
Long overTime = overTime();
|
||||
SysMsgExample example = new SysMsgExample();
|
||||
example.createCriteria().andCreateTimeLessThan(overTime);
|
||||
sysMsgMapper.deleteByExample(example);
|
||||
}
|
||||
|
||||
public List<MsgGridDto> queryGrid(Long userId, MsgRequest msgRequest, List<Long> typeIds, Long startTime) {
|
||||
String orderClause = " create_time desc";
|
||||
SysMsgExample example = new SysMsgExample();
|
||||
|
Loading…
Reference in New Issue
Block a user