fix(接口测试): 修复设置系统保留变更记录条数为立刻生效的缺陷

--bug=1038144 --user=王孝刚 【接口测试】定义-API/CASE-预览-变更历史-在系统参数处设置完条数未生效
https://www.tapd.cn/55049933/s/1484496
This commit is contained in:
wxg0103 2024-03-30 13:42:19 +08:00 committed by Craftsman
parent 8d3d470b1a
commit 28ca4251dd
1 changed files with 14 additions and 9 deletions

View File

@ -3,22 +3,20 @@ package io.metersphere.system.service;
import io.metersphere.sdk.constants.HttpMethodConstants; import io.metersphere.sdk.constants.HttpMethodConstants;
import io.metersphere.sdk.constants.OperationLogConstants; import io.metersphere.sdk.constants.OperationLogConstants;
import io.metersphere.sdk.constants.ParamConstants; import io.metersphere.sdk.constants.ParamConstants;
import io.metersphere.sdk.exception.MSException;
import io.metersphere.sdk.util.*;
import io.metersphere.system.domain.SystemParameter;
import io.metersphere.system.domain.SystemParameterExample;
import io.metersphere.system.dto.sdk.BaseCleanConfigDTO; import io.metersphere.system.dto.sdk.BaseCleanConfigDTO;
import io.metersphere.system.dto.sdk.BaseSystemConfigDTO; import io.metersphere.system.dto.sdk.BaseSystemConfigDTO;
import io.metersphere.system.dto.sdk.EMailInfoDto; import io.metersphere.system.dto.sdk.EMailInfoDto;
import io.metersphere.system.log.dto.LogDTO; import io.metersphere.system.job.CleanHistoryJob;
import io.metersphere.sdk.exception.MSException;
import io.metersphere.system.log.constants.OperationLogModule; import io.metersphere.system.log.constants.OperationLogModule;
import io.metersphere.system.log.constants.OperationLogType; import io.metersphere.system.log.constants.OperationLogType;
import io.metersphere.system.log.dto.LogDTO;
import io.metersphere.system.mapper.BaseSystemParameterMapper; import io.metersphere.system.mapper.BaseSystemParameterMapper;
import io.metersphere.system.notice.sender.impl.MailNoticeSender;
import io.metersphere.sdk.util.EncryptUtils;
import io.metersphere.sdk.util.JSON;
import io.metersphere.sdk.util.LogUtils;
import io.metersphere.sdk.util.Translator;
import io.metersphere.system.domain.SystemParameter;
import io.metersphere.system.domain.SystemParameterExample;
import io.metersphere.system.mapper.SystemParameterMapper; import io.metersphere.system.mapper.SystemParameterMapper;
import io.metersphere.system.notice.sender.impl.MailNoticeSender;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import jakarta.mail.internet.InternetAddress; import jakarta.mail.internet.InternetAddress;
import jakarta.mail.internet.MimeMessage; import jakarta.mail.internet.MimeMessage;
@ -285,6 +283,13 @@ public class SystemParameterService {
} else { } else {
systemParameterMapper.insert(parameter); systemParameterMapper.insert(parameter);
} }
if (StringUtils.equals(parameter.getParamKey(), ParamConstants.CleanConfig.OPERATION_HISTORY.getValue())) {
// 清理历史记录
CleanHistoryJob bean = CommonBeanFactory.getBean(CleanHistoryJob.class);
if (bean != null) {
bean.cleanupLog();
}
}
}); });
} }