fix: 基础参数中增加后台导出文件保留时间配置项
This commit is contained in:
parent
8dbf0cc954
commit
8a9bcd7919
@ -113,6 +113,7 @@ public interface ParamConstants {
|
||||
|
||||
LOG_TIME_OUT("basic.logTimeOut"),
|
||||
DS_SYNC_LOG_TIME_OUT("basic.dsSyncLogTimeOut"),
|
||||
EXPORT_FILE_TIME_OUT("basic.exportFileTimeOut"),
|
||||
DS_CHECK_INTERVAL("basic.dsCheckInterval"),
|
||||
DS_CHECK_INTERVAL_TYPE("basic.dsCheckIntervalType"),
|
||||
DEFAULT_LOGIN_TYPE("basic.loginType"),
|
||||
|
||||
@ -17,6 +17,8 @@ public class BasicInfo extends LoginLimitInfo implements Serializable {
|
||||
private String logTimeOut;
|
||||
@ApiModelProperty("数据同步日志保留时间")
|
||||
private String dsSyncLogTimeOut;
|
||||
@ApiModelProperty("后台导出文件保留时间")
|
||||
private String exportFileTimeOut;
|
||||
@ApiModelProperty("显示首页")
|
||||
private String openHomePage;
|
||||
@ApiModelProperty("默认登录方式")
|
||||
|
||||
@ -2,6 +2,7 @@ package io.dataease.service;
|
||||
|
||||
import io.dataease.ext.CleaningRebotMapper;
|
||||
import io.dataease.service.dataset.DataSetTableTaskLogService;
|
||||
import io.dataease.service.exportCenter.ExportCenterService;
|
||||
import io.dataease.service.message.SysMsgService;
|
||||
import io.dataease.service.sys.log.LogService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@ -27,6 +28,8 @@ public class CleaningRebotService {
|
||||
@Resource
|
||||
private DataSetTableTaskLogService dataSetTableTaskLogService;
|
||||
|
||||
@Resource
|
||||
private ExportCenterService exportCenterService;
|
||||
public void execute() {
|
||||
int floatDept = 0;
|
||||
do {
|
||||
@ -47,5 +50,6 @@ public class CleaningRebotService {
|
||||
logService.cleanDisusedLog();
|
||||
sysMsgService.cleanDisusedMsg();
|
||||
dataSetTableTaskLogService.cleanLog();
|
||||
exportCenterService.cleanLog();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
package io.dataease.service.exportCenter;
|
||||
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.google.gson.Gson;
|
||||
import io.dataease.commons.constants.ParamConstants;
|
||||
import io.dataease.commons.constants.SysLogConstants;
|
||||
import io.dataease.commons.utils.*;
|
||||
import io.dataease.controller.request.chart.ChartExtRequest;
|
||||
@ -39,6 +38,7 @@ import io.dataease.service.dataset.*;
|
||||
import io.dataease.service.datasource.DatasourceService;
|
||||
import io.dataease.service.engine.EngineService;
|
||||
import io.dataease.service.panel.PanelGroupService;
|
||||
import io.dataease.service.system.SystemParameterService;
|
||||
import io.dataease.websocket.entity.WsMessage;
|
||||
import io.dataease.websocket.service.WsService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@ -72,6 +72,8 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class ExportCenterService {
|
||||
|
||||
@Resource
|
||||
private SystemParameterService systemParameterService;
|
||||
@Resource
|
||||
private ChartViewMapper chartViewMapper;
|
||||
@Resource
|
||||
@ -1329,7 +1331,27 @@ public class ExportCenterService {
|
||||
map.put("data", jsonArray);
|
||||
return map;
|
||||
}
|
||||
private static final String LOG_RETENTION = "30";
|
||||
|
||||
public void cleanLog() {
|
||||
String value = systemParameterService.getValue(ParamConstants.BASIC.EXPORT_FILE_TIME_OUT.getValue());
|
||||
value = StringUtils.isBlank(value) ? LOG_RETENTION : value;
|
||||
int logRetention = Integer.parseInt(value);
|
||||
Calendar instance = Calendar.getInstance();
|
||||
Calendar startInstance = (Calendar) instance.clone();
|
||||
startInstance.add(Calendar.DATE, -logRetention);
|
||||
startInstance.set(Calendar.HOUR_OF_DAY, 0);
|
||||
startInstance.set(Calendar.MINUTE, 0);
|
||||
startInstance.set(Calendar.SECOND, 0);
|
||||
startInstance.set(Calendar.MILLISECOND, -1);
|
||||
long timeInMillis = startInstance.getTimeInMillis();
|
||||
ExportTaskExample exportTaskExample = new ExportTaskExample();
|
||||
ExportTaskExample.Criteria criteria = exportTaskExample.createCriteria();
|
||||
criteria.andExportTimeLessThan(timeInMillis);
|
||||
exportTaskMapper.selectByExample(exportTaskExample).forEach(exportTask -> {
|
||||
delete(exportTask.getId());
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -87,6 +87,9 @@ public class SystemParameterService {
|
||||
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.DS_SYNC_LOG_TIME_OUT.getValue())) {
|
||||
result.setDsSyncLogTimeOut(param.getParamValue());
|
||||
}
|
||||
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.EXPORT_FILE_TIME_OUT.getValue())) {
|
||||
result.setExportFileTimeOut(param.getParamValue());
|
||||
}
|
||||
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.DEFAULT_LOGIN_TYPE.getValue())) {
|
||||
String paramValue = param.getParamValue();
|
||||
result.setLoginType(StringUtils.isNotBlank(paramValue) ? Integer.parseInt(paramValue) : 0);
|
||||
|
||||
@ -1081,6 +1081,7 @@ export default {
|
||||
message_retention_time: 'Message retention time',
|
||||
log_retention_time: 'Log retention time',
|
||||
ds_sync_log_retention_time: 'Data sync log retention time',
|
||||
export_file_retention_time: 'Export file retention time',
|
||||
ds_check_time: 'Data source detection interval',
|
||||
test_mail_recipient: 'Used only as a test mail recipient',
|
||||
to_enable_tsl: 'If the SMTP port is 587, you usually need to enable TSL',
|
||||
|
||||
@ -1081,6 +1081,7 @@ export default {
|
||||
message_retention_time: '消息保留時間',
|
||||
log_retention_time: '日誌保留時間',
|
||||
ds_sync_log_retention_time: '數據同步日誌保留時間',
|
||||
export_file_retention_time: '导出文件保留時間',
|
||||
ds_check_time: '數據源檢測時間間隔',
|
||||
test_mail_recipient: '僅用來作為測試郵件收件人',
|
||||
to_enable_tsl: '如果SMTP埠是587,通常需要啟用TSL',
|
||||
|
||||
@ -1076,6 +1076,7 @@ export default {
|
||||
message_retention_time: '消息保留时间',
|
||||
log_retention_time: '日志保留时间',
|
||||
ds_sync_log_retention_time: '数据同步日志保留时间',
|
||||
export_file_retention_time: '后台导出文件保留时间',
|
||||
ds_check_time: '数据源检测时间间隔',
|
||||
test_mail_recipient: '仅用来作为测试邮件收件人',
|
||||
to_enable_tsl: '如果SMTP端口是587,通常需要启用TSL',
|
||||
|
||||
@ -96,6 +96,18 @@
|
||||
>{{ $t('components.day') }}</template></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item
|
||||
:label="$t('system_parameter_setting.export_file_retention_time')"
|
||||
prop="exportFileTimeOut"
|
||||
>
|
||||
<el-input
|
||||
v-model="formInline.exportFileTimeOut"
|
||||
:placeholder="$t('system_parameter_setting.empty_msg')"
|
||||
><template
|
||||
slot="append"
|
||||
>{{ $t('components.day') }}</template></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('system_parameter_setting.ds_check_time')">
|
||||
<el-form
|
||||
:inline="true"
|
||||
@ -303,6 +315,13 @@ export default {
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
exportFileTimeOut: [
|
||||
{
|
||||
pattern: '^([1-9]|[1-9][0-9]|[1-2][0-9][0-9]|3[0-5][0-9]|36[0-5])$',
|
||||
message: this.$t('system_parameter_setting.msg_error'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
limitTimes: [
|
||||
|
||||
{ validator: this.validateNumber, trigger: 'blur' }
|
||||
@ -430,6 +449,12 @@ export default {
|
||||
type: 'text',
|
||||
sort: 2
|
||||
},
|
||||
{
|
||||
paramKey: 'basic.exportFileTimeOut',
|
||||
paramValue: this.formInline.exportFileTimeOut,
|
||||
type: 'text',
|
||||
sort: 2
|
||||
},
|
||||
{
|
||||
paramKey: 'basic.loginType',
|
||||
paramValue: this.formInline.loginType,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user