feat: 增加一个同步日志保留时间
This commit is contained in:
parent
23e0200ce7
commit
5a1451be55
@ -112,6 +112,7 @@ public interface ParamConstants {
|
|||||||
MSG_TIME_OUT("basic.msgTimeOut"),
|
MSG_TIME_OUT("basic.msgTimeOut"),
|
||||||
|
|
||||||
LOG_TIME_OUT("basic.logTimeOut"),
|
LOG_TIME_OUT("basic.logTimeOut"),
|
||||||
|
DS_SYNC_LOG_TIME_OUT("basic.dsSyncLogTimeOut"),
|
||||||
DS_CHECK_INTERVAL("basic.dsCheckInterval"),
|
DS_CHECK_INTERVAL("basic.dsCheckInterval"),
|
||||||
DS_CHECK_INTERVAL_TYPE("basic.dsCheckIntervalType"),
|
DS_CHECK_INTERVAL_TYPE("basic.dsCheckIntervalType"),
|
||||||
DEFAULT_LOGIN_TYPE("basic.loginType"),
|
DEFAULT_LOGIN_TYPE("basic.loginType"),
|
||||||
|
|||||||
@ -15,6 +15,8 @@ public class BasicInfo extends LoginLimitInfo implements Serializable {
|
|||||||
private String msgTimeOut;
|
private String msgTimeOut;
|
||||||
@ApiModelProperty("日志保留时间")
|
@ApiModelProperty("日志保留时间")
|
||||||
private String logTimeOut;
|
private String logTimeOut;
|
||||||
|
@ApiModelProperty("数据同步日志保留时间")
|
||||||
|
private String dsSyncLogTimeOut;
|
||||||
@ApiModelProperty("显示首页")
|
@ApiModelProperty("显示首页")
|
||||||
private String openHomePage;
|
private String openHomePage;
|
||||||
@ApiModelProperty("默认登录方式")
|
@ApiModelProperty("默认登录方式")
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package io.dataease.service;
|
package io.dataease.service;
|
||||||
|
|
||||||
import io.dataease.ext.CleaningRebotMapper;
|
import io.dataease.ext.CleaningRebotMapper;
|
||||||
|
import io.dataease.service.dataset.DataSetTableTaskLogService;
|
||||||
import io.dataease.service.message.SysMsgService;
|
import io.dataease.service.message.SysMsgService;
|
||||||
import io.dataease.service.sys.log.LogService;
|
import io.dataease.service.sys.log.LogService;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@ -23,6 +24,8 @@ public class CleaningRebotService {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private SysMsgService sysMsgService;
|
private SysMsgService sysMsgService;
|
||||||
|
@Resource
|
||||||
|
private DataSetTableTaskLogService dataSetTableTaskLogService;
|
||||||
|
|
||||||
public void execute() {
|
public void execute() {
|
||||||
int floatDept = 0;
|
int floatDept = 0;
|
||||||
@ -43,5 +46,6 @@ public class CleaningRebotService {
|
|||||||
}
|
}
|
||||||
logService.cleanDisusedLog();
|
logService.cleanDisusedLog();
|
||||||
sysMsgService.cleanDisusedMsg();
|
sysMsgService.cleanDisusedMsg();
|
||||||
|
dataSetTableTaskLogService.cleanLog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package io.dataease.service.dataset;
|
package io.dataease.service.dataset;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import io.dataease.commons.constants.ParamConstants;
|
||||||
import io.dataease.commons.utils.AuthUtils;
|
import io.dataease.commons.utils.AuthUtils;
|
||||||
import io.dataease.commons.utils.ServletUtils;
|
import io.dataease.commons.utils.ServletUtils;
|
||||||
import io.dataease.controller.dataset.request.DataSetTaskInstanceGridRequest;
|
import io.dataease.controller.dataset.request.DataSetTaskInstanceGridRequest;
|
||||||
@ -13,6 +14,7 @@ import io.dataease.plugins.common.base.domain.DatasetTableTaskLog;
|
|||||||
import io.dataease.plugins.common.base.domain.DatasetTableTaskLogExample;
|
import io.dataease.plugins.common.base.domain.DatasetTableTaskLogExample;
|
||||||
import io.dataease.plugins.common.base.mapper.DatasetTableTaskLogMapper;
|
import io.dataease.plugins.common.base.mapper.DatasetTableTaskLogMapper;
|
||||||
import io.dataease.plugins.common.base.mapper.DatasetTableTaskMapper;
|
import io.dataease.plugins.common.base.mapper.DatasetTableTaskMapper;
|
||||||
|
import io.dataease.service.system.SystemParameterService;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.poi.hssf.usermodel.HSSFCell;
|
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||||
@ -29,6 +31,7 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -46,6 +49,8 @@ public class DataSetTableTaskLogService {
|
|||||||
private ExtDataSetTaskMapper extDataSetTaskMapper;
|
private ExtDataSetTaskMapper extDataSetTaskMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private DatasetTableTaskMapper datasetTableTaskMapper;
|
private DatasetTableTaskMapper datasetTableTaskMapper;
|
||||||
|
@Resource
|
||||||
|
private SystemParameterService systemParameterService;
|
||||||
|
|
||||||
public DatasetTableTaskLog save(DatasetTableTaskLog datasetTableTaskLog, Boolean hasTask) {
|
public DatasetTableTaskLog save(DatasetTableTaskLog datasetTableTaskLog, Boolean hasTask) {
|
||||||
if (hasTask && datasetTableTaskMapper.selectByPrimaryKey(datasetTableTaskLog.getTaskId()) == null) {
|
if (hasTask && datasetTableTaskMapper.selectByPrimaryKey(datasetTableTaskLog.getTaskId()) == null) {
|
||||||
@ -210,5 +215,23 @@ public class DataSetTableTaskLogService {
|
|||||||
return example;
|
return example;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final String LOG_RETENTION = "30";
|
||||||
|
|
||||||
|
public void cleanLog() {
|
||||||
|
String value = systemParameterService.getValue(ParamConstants.BASIC.DS_SYNC_LOG_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();
|
||||||
|
DatasetTableTaskLogExample example = new DatasetTableTaskLogExample();
|
||||||
|
example.createCriteria().andCreateTimeLessThan(timeInMillis);
|
||||||
|
datasetTableTaskLogMapper.deleteByExample(example);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -82,6 +82,9 @@ public class SystemParameterService {
|
|||||||
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.LOG_TIME_OUT.getValue())) {
|
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.LOG_TIME_OUT.getValue())) {
|
||||||
result.setLogTimeOut(param.getParamValue());
|
result.setLogTimeOut(param.getParamValue());
|
||||||
}
|
}
|
||||||
|
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.DS_SYNC_LOG_TIME_OUT.getValue())) {
|
||||||
|
result.setDsSyncLogTimeOut(param.getParamValue());
|
||||||
|
}
|
||||||
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.DEFAULT_LOGIN_TYPE.getValue())) {
|
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.DEFAULT_LOGIN_TYPE.getValue())) {
|
||||||
String paramValue = param.getParamValue();
|
String paramValue = param.getParamValue();
|
||||||
result.setLoginType(StringUtils.isNotBlank(paramValue) ? Integer.parseInt(paramValue) : 0);
|
result.setLoginType(StringUtils.isNotBlank(paramValue) ? Integer.parseInt(paramValue) : 0);
|
||||||
|
|||||||
@ -890,6 +890,7 @@ export default {
|
|||||||
request_timeout: 'Request timeout',
|
request_timeout: 'Request timeout',
|
||||||
message_retention_time: 'Message retention time',
|
message_retention_time: 'Message retention time',
|
||||||
log_retention_time: 'Log retention time',
|
log_retention_time: 'Log retention time',
|
||||||
|
ds_sync_log_retention_time: 'Data sync log retention time',
|
||||||
ds_check_time: 'Data source detection interval',
|
ds_check_time: 'Data source detection interval',
|
||||||
test_mail_recipient: 'Used only as a test mail recipient',
|
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',
|
to_enable_tsl: 'If the SMTP port is 587, you usually need to enable TSL',
|
||||||
|
|||||||
@ -889,6 +889,7 @@ export default {
|
|||||||
request_timeout: '請求超時時間',
|
request_timeout: '請求超時時間',
|
||||||
message_retention_time: '消息保留時間',
|
message_retention_time: '消息保留時間',
|
||||||
log_retention_time: '日誌保留時間',
|
log_retention_time: '日誌保留時間',
|
||||||
|
ds_sync_log_retention_time: '数据同步日誌保留時間',
|
||||||
ds_check_time: '數據源檢測時間間隔',
|
ds_check_time: '數據源檢測時間間隔',
|
||||||
test_mail_recipient: '僅用來作為測試郵件收件人',
|
test_mail_recipient: '僅用來作為測試郵件收件人',
|
||||||
to_enable_tsl: '如果SMTP埠是587,通常需要啟用TSL',
|
to_enable_tsl: '如果SMTP埠是587,通常需要啟用TSL',
|
||||||
|
|||||||
@ -888,6 +888,7 @@ export default {
|
|||||||
request_timeout: '请求超时时间',
|
request_timeout: '请求超时时间',
|
||||||
message_retention_time: '消息保留时间',
|
message_retention_time: '消息保留时间',
|
||||||
log_retention_time: '日志保留时间',
|
log_retention_time: '日志保留时间',
|
||||||
|
ds_sync_log_retention_time: '数据同步日志保留时间',
|
||||||
ds_check_time: '数据源检测时间间隔',
|
ds_check_time: '数据源检测时间间隔',
|
||||||
test_mail_recipient: '仅用来作为测试邮件收件人',
|
test_mail_recipient: '仅用来作为测试邮件收件人',
|
||||||
to_enable_tsl: '如果SMTP端口是587,通常需要启用TSL',
|
to_enable_tsl: '如果SMTP端口是587,通常需要启用TSL',
|
||||||
|
|||||||
@ -84,6 +84,18 @@
|
|||||||
>{{ $t('components.day') }}</template></el-input>
|
>{{ $t('components.day') }}</template></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item
|
||||||
|
:label="$t('system_parameter_setting.ds_sync_log_retention_time')"
|
||||||
|
prop="logTimeOut"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="formInline.dsSyncLogTimeOut"
|
||||||
|
: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-item :label="$t('system_parameter_setting.ds_check_time')">
|
||||||
<el-form
|
<el-form
|
||||||
:inline="true"
|
:inline="true"
|
||||||
@ -284,6 +296,13 @@ export default {
|
|||||||
trigger: 'blur'
|
trigger: 'blur'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
dsSyncLogTimeOut: [
|
||||||
|
{
|
||||||
|
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: [
|
limitTimes: [
|
||||||
|
|
||||||
{ validator: this.validateNumber, trigger: 'blur' }
|
{ validator: this.validateNumber, trigger: 'blur' }
|
||||||
@ -404,6 +423,12 @@ export default {
|
|||||||
type: 'text',
|
type: 'text',
|
||||||
sort: 2
|
sort: 2
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
paramKey: 'basic.dsSyncLogTimeOut',
|
||||||
|
paramValue: this.formInline.dsSyncLogTimeOut,
|
||||||
|
type: 'text',
|
||||||
|
sort: 2
|
||||||
|
},
|
||||||
{
|
{
|
||||||
paramKey: 'basic.loginType',
|
paramKey: 'basic.loginType',
|
||||||
paramValue: this.formInline.loginType,
|
paramValue: this.formInline.loginType,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user