Skip to content

Commit

Permalink
Merge pull request dataease#3704 from dataease/pr@dev@perf_disused_da…
Browse files Browse the repository at this point in the history
…ta_clean

perf(系统): 每天00:00:00定时清理废弃数据
  • Loading branch information
dataeaseShu authored Nov 10, 2022
2 parents 62531a8 + 17c42f7 commit 1429653
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
11 changes: 11 additions & 0 deletions backend/src/main/java/io/dataease/job/sechedule/Schedular.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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();
Expand All @@ -32,4 +37,10 @@ public void updateKettleStatus() {
kettleService.updateKettleStatus();
}

@QuartzScheduled(cron = "0 0 0 ? * *")
public void cheanDisusedData() {
LogUtil.info("start execute clean task...");
cleaningRebotService.execute();
}

}
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -20,6 +21,9 @@ public class CleaningRebotService {
@Resource
private LogService logService;

@Resource
private SysMsgService sysMsgService;

public void execute() {
int floatDept = 0;
do {
Expand All @@ -38,5 +42,6 @@ public void execute() {
cleaningRebotMapper.delFloatingCreatorLinkMapping();
}
logService.cleanDisusedLog();
sysMsgService.cleanDisusedMsg();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 1429653

Please sign in to comment.