feat(项目设置): 定时清理系统报告

--story=1004891 --user=lyh
定时清理系统报告&日志
https://www.tapd.cn/55049933/s/1089749
This commit is contained in:
shiziyuan9527 2021-12-28 19:01:52 +08:00 committed by shiziyuan9527
parent 4d617a7b4a
commit f83465d901
16 changed files with 1029 additions and 133 deletions

View File

@ -692,4 +692,14 @@ public class ApiScenarioReportService {
}
return status;
}
public void cleanUpReport(long time, String projectId) {
ApiScenarioReportExample example = new ApiScenarioReportExample();
example.createCriteria().andCreateTimeLessThan(time).andProjectIdEqualTo(projectId);
List<ApiScenarioReport> apiScenarioReports = apiScenarioReportMapper.selectByExample(example);
List<String> ids = apiScenarioReports.stream().map(ApiScenarioReport::getId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(ids)) {
deleteByIds(ids);
}
}
}

View File

@ -45,15 +45,27 @@ public class Project implements Serializable {
private String azureFilterId;
private Boolean versionEnable;
private String apiQuick;
private Boolean casePublic;
private String platform;
private Boolean thirdPartTemplate;
private Boolean casePublic;
private Boolean versionEnable;
private String apiQuick;
private Boolean cleanTrackReport;
private String cleanTrackReportExpr;
private Boolean cleanApiReport;
private String cleanApiReportExpr;
private Boolean cleanLoadReport;
private String cleanLoadReportExpr;
private static final long serialVersionUID = 1L;
}

View File

@ -1434,63 +1434,133 @@ public class ProjectExample {
return (Criteria) this;
}
public Criteria andVersionEnableIsNull() {
addCriterion("version_enable is null");
public Criteria andApiQuickIsNull() {
addCriterion("api_quick is null");
return (Criteria) this;
}
public Criteria andVersionEnableIsNotNull() {
addCriterion("version_enable is not null");
public Criteria andApiQuickIsNotNull() {
addCriterion("api_quick is not null");
return (Criteria) this;
}
public Criteria andVersionEnableEqualTo(Boolean value) {
addCriterion("version_enable =", value, "versionEnable");
public Criteria andApiQuickEqualTo(String value) {
addCriterion("api_quick =", value, "apiQuick");
return (Criteria) this;
}
public Criteria andVersionEnableNotEqualTo(Boolean value) {
addCriterion("version_enable <>", value, "versionEnable");
public Criteria andApiQuickNotEqualTo(String value) {
addCriterion("api_quick <>", value, "apiQuick");
return (Criteria) this;
}
public Criteria andVersionEnableGreaterThan(Boolean value) {
addCriterion("version_enable >", value, "versionEnable");
public Criteria andApiQuickGreaterThan(String value) {
addCriterion("api_quick >", value, "apiQuick");
return (Criteria) this;
}
public Criteria andVersionEnableGreaterThanOrEqualTo(Boolean value) {
addCriterion("version_enable >=", value, "versionEnable");
public Criteria andApiQuickGreaterThanOrEqualTo(String value) {
addCriterion("api_quick >=", value, "apiQuick");
return (Criteria) this;
}
public Criteria andVersionEnableLessThan(Boolean value) {
addCriterion("version_enable <", value, "versionEnable");
public Criteria andApiQuickLessThan(String value) {
addCriterion("api_quick <", value, "apiQuick");
return (Criteria) this;
}
public Criteria andVersionEnableLessThanOrEqualTo(Boolean value) {
addCriterion("version_enable <=", value, "versionEnable");
public Criteria andApiQuickLessThanOrEqualTo(String value) {
addCriterion("api_quick <=", value, "apiQuick");
return (Criteria) this;
}
public Criteria andVersionEnableIn(List<Boolean> values) {
addCriterion("version_enable in", values, "versionEnable");
public Criteria andApiQuickLike(String value) {
addCriterion("api_quick like", value, "apiQuick");
return (Criteria) this;
}
public Criteria andVersionEnableNotIn(List<Boolean> values) {
addCriterion("version_enable not in", values, "versionEnable");
public Criteria andApiQuickNotLike(String value) {
addCriterion("api_quick not like", value, "apiQuick");
return (Criteria) this;
}
public Criteria andVersionEnableBetween(Boolean value1, Boolean value2) {
addCriterion("version_enable between", value1, value2, "versionEnable");
public Criteria andApiQuickIn(List<String> values) {
addCriterion("api_quick in", values, "apiQuick");
return (Criteria) this;
}
public Criteria andVersionEnableNotBetween(Boolean value1, Boolean value2) {
addCriterion("version_enable not between", value1, value2, "versionEnable");
public Criteria andApiQuickNotIn(List<String> values) {
addCriterion("api_quick not in", values, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickBetween(String value1, String value2) {
addCriterion("api_quick between", value1, value2, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickNotBetween(String value1, String value2) {
addCriterion("api_quick not between", value1, value2, "apiQuick");
return (Criteria) this;
}
public Criteria andCasePublicIsNull() {
addCriterion("case_public is null");
return (Criteria) this;
}
public Criteria andCasePublicIsNotNull() {
addCriterion("case_public is not null");
return (Criteria) this;
}
public Criteria andCasePublicEqualTo(Boolean value) {
addCriterion("case_public =", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicNotEqualTo(Boolean value) {
addCriterion("case_public <>", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicGreaterThan(Boolean value) {
addCriterion("case_public >", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicGreaterThanOrEqualTo(Boolean value) {
addCriterion("case_public >=", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicLessThan(Boolean value) {
addCriterion("case_public <", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicLessThanOrEqualTo(Boolean value) {
addCriterion("case_public <=", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicIn(List<Boolean> values) {
addCriterion("case_public in", values, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicNotIn(List<Boolean> values) {
addCriterion("case_public not in", values, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicBetween(Boolean value1, Boolean value2) {
addCriterion("case_public between", value1, value2, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicNotBetween(Boolean value1, Boolean value2) {
addCriterion("case_public not between", value1, value2, "casePublic");
return (Criteria) this;
}
@ -1624,133 +1694,453 @@ public class ProjectExample {
return (Criteria) this;
}
public Criteria andCasePublicIsNull() {
addCriterion("case_public is null");
public Criteria andVersionEnableIsNull() {
addCriterion("version_enable is null");
return (Criteria) this;
}
public Criteria andCasePublicIsNotNull() {
addCriterion("case_public is not null");
public Criteria andVersionEnableIsNotNull() {
addCriterion("version_enable is not null");
return (Criteria) this;
}
public Criteria andCasePublicEqualTo(Boolean value) {
addCriterion("case_public =", value, "casePublic");
public Criteria andVersionEnableEqualTo(Boolean value) {
addCriterion("version_enable =", value, "versionEnable");
return (Criteria) this;
}
public Criteria andCasePublicNotEqualTo(Boolean value) {
addCriterion("case_public <>", value, "casePublic");
public Criteria andVersionEnableNotEqualTo(Boolean value) {
addCriterion("version_enable <>", value, "versionEnable");
return (Criteria) this;
}
public Criteria andCasePublicGreaterThan(Boolean value) {
addCriterion("case_public >", value, "casePublic");
public Criteria andVersionEnableGreaterThan(Boolean value) {
addCriterion("version_enable >", value, "versionEnable");
return (Criteria) this;
}
public Criteria andCasePublicGreaterThanOrEqualTo(Boolean value) {
addCriterion("case_public >=", value, "casePublic");
public Criteria andVersionEnableGreaterThanOrEqualTo(Boolean value) {
addCriterion("version_enable >=", value, "versionEnable");
return (Criteria) this;
}
public Criteria andCasePublicLessThan(Boolean value) {
addCriterion("case_public <", value, "casePublic");
public Criteria andVersionEnableLessThan(Boolean value) {
addCriterion("version_enable <", value, "versionEnable");
return (Criteria) this;
}
public Criteria andCasePublicLessThanOrEqualTo(Boolean value) {
addCriterion("case_public <=", value, "casePublic");
public Criteria andVersionEnableLessThanOrEqualTo(Boolean value) {
addCriterion("version_enable <=", value, "versionEnable");
return (Criteria) this;
}
public Criteria andCasePublicIn(List<Boolean> values) {
addCriterion("case_public in", values, "casePublic");
public Criteria andVersionEnableIn(List<Boolean> values) {
addCriterion("version_enable in", values, "versionEnable");
return (Criteria) this;
}
public Criteria andCasePublicNotIn(List<Boolean> values) {
addCriterion("case_public not in", values, "casePublic");
public Criteria andVersionEnableNotIn(List<Boolean> values) {
addCriterion("version_enable not in", values, "versionEnable");
return (Criteria) this;
}
public Criteria andCasePublicBetween(Boolean value1, Boolean value2) {
addCriterion("case_public between", value1, value2, "casePublic");
public Criteria andVersionEnableBetween(Boolean value1, Boolean value2) {
addCriterion("version_enable between", value1, value2, "versionEnable");
return (Criteria) this;
}
public Criteria andCasePublicNotBetween(Boolean value1, Boolean value2) {
addCriterion("case_public not between", value1, value2, "casePublic");
public Criteria andVersionEnableNotBetween(Boolean value1, Boolean value2) {
addCriterion("version_enable not between", value1, value2, "versionEnable");
return (Criteria) this;
}
public Criteria andApiQuickIsNull() {
addCriterion("api_quick is null");
public Criteria andCleanTrackReportIsNull() {
addCriterion("clean_track_report is null");
return (Criteria) this;
}
public Criteria andApiQuickIsNotNull() {
addCriterion("api_quick is not null");
public Criteria andCleanTrackReportIsNotNull() {
addCriterion("clean_track_report is not null");
return (Criteria) this;
}
public Criteria andApiQuickEqualTo(String value) {
addCriterion("api_quick =", value, "apiQuick");
public Criteria andCleanTrackReportEqualTo(Boolean value) {
addCriterion("clean_track_report =", value, "cleanTrackReport");
return (Criteria) this;
}
public Criteria andApiQuickNotEqualTo(String value) {
addCriterion("api_quick <>", value, "apiQuick");
public Criteria andCleanTrackReportNotEqualTo(Boolean value) {
addCriterion("clean_track_report <>", value, "cleanTrackReport");
return (Criteria) this;
}
public Criteria andApiQuickGreaterThan(String value) {
addCriterion("api_quick >", value, "apiQuick");
public Criteria andCleanTrackReportGreaterThan(Boolean value) {
addCriterion("clean_track_report >", value, "cleanTrackReport");
return (Criteria) this;
}
public Criteria andApiQuickGreaterThanOrEqualTo(String value) {
addCriterion("api_quick >=", value, "apiQuick");
public Criteria andCleanTrackReportGreaterThanOrEqualTo(Boolean value) {
addCriterion("clean_track_report >=", value, "cleanTrackReport");
return (Criteria) this;
}
public Criteria andApiQuickLessThan(String value) {
addCriterion("api_quick <", value, "apiQuick");
public Criteria andCleanTrackReportLessThan(Boolean value) {
addCriterion("clean_track_report <", value, "cleanTrackReport");
return (Criteria) this;
}
public Criteria andApiQuickLessThanOrEqualTo(String value) {
addCriterion("api_quick <=", value, "apiQuick");
public Criteria andCleanTrackReportLessThanOrEqualTo(Boolean value) {
addCriterion("clean_track_report <=", value, "cleanTrackReport");
return (Criteria) this;
}
public Criteria andApiQuickLike(String value) {
addCriterion("api_quick like", value, "apiQuick");
public Criteria andCleanTrackReportIn(List<Boolean> values) {
addCriterion("clean_track_report in", values, "cleanTrackReport");
return (Criteria) this;
}
public Criteria andApiQuickNotLike(String value) {
addCriterion("api_quick not like", value, "apiQuick");
public Criteria andCleanTrackReportNotIn(List<Boolean> values) {
addCriterion("clean_track_report not in", values, "cleanTrackReport");
return (Criteria) this;
}
public Criteria andApiQuickIn(List<String> values) {
addCriterion("api_quick in", values, "apiQuick");
public Criteria andCleanTrackReportBetween(Boolean value1, Boolean value2) {
addCriterion("clean_track_report between", value1, value2, "cleanTrackReport");
return (Criteria) this;
}
public Criteria andApiQuickNotIn(List<String> values) {
addCriterion("api_quick not in", values, "apiQuick");
public Criteria andCleanTrackReportNotBetween(Boolean value1, Boolean value2) {
addCriterion("clean_track_report not between", value1, value2, "cleanTrackReport");
return (Criteria) this;
}
public Criteria andApiQuickBetween(String value1, String value2) {
addCriterion("api_quick between", value1, value2, "apiQuick");
public Criteria andCleanTrackReportExprIsNull() {
addCriterion("clean_track_report_expr is null");
return (Criteria) this;
}
public Criteria andApiQuickNotBetween(String value1, String value2) {
addCriterion("api_quick not between", value1, value2, "apiQuick");
public Criteria andCleanTrackReportExprIsNotNull() {
addCriterion("clean_track_report_expr is not null");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprEqualTo(String value) {
addCriterion("clean_track_report_expr =", value, "cleanTrackReportExpr");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprNotEqualTo(String value) {
addCriterion("clean_track_report_expr <>", value, "cleanTrackReportExpr");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprGreaterThan(String value) {
addCriterion("clean_track_report_expr >", value, "cleanTrackReportExpr");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprGreaterThanOrEqualTo(String value) {
addCriterion("clean_track_report_expr >=", value, "cleanTrackReportExpr");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprLessThan(String value) {
addCriterion("clean_track_report_expr <", value, "cleanTrackReportExpr");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprLessThanOrEqualTo(String value) {
addCriterion("clean_track_report_expr <=", value, "cleanTrackReportExpr");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprLike(String value) {
addCriterion("clean_track_report_expr like", value, "cleanTrackReportExpr");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprNotLike(String value) {
addCriterion("clean_track_report_expr not like", value, "cleanTrackReportExpr");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprIn(List<String> values) {
addCriterion("clean_track_report_expr in", values, "cleanTrackReportExpr");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprNotIn(List<String> values) {
addCriterion("clean_track_report_expr not in", values, "cleanTrackReportExpr");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprBetween(String value1, String value2) {
addCriterion("clean_track_report_expr between", value1, value2, "cleanTrackReportExpr");
return (Criteria) this;
}
public Criteria andCleanTrackReportExprNotBetween(String value1, String value2) {
addCriterion("clean_track_report_expr not between", value1, value2, "cleanTrackReportExpr");
return (Criteria) this;
}
public Criteria andCleanApiReportIsNull() {
addCriterion("clean_api_report is null");
return (Criteria) this;
}
public Criteria andCleanApiReportIsNotNull() {
addCriterion("clean_api_report is not null");
return (Criteria) this;
}
public Criteria andCleanApiReportEqualTo(Boolean value) {
addCriterion("clean_api_report =", value, "cleanApiReport");
return (Criteria) this;
}
public Criteria andCleanApiReportNotEqualTo(Boolean value) {
addCriterion("clean_api_report <>", value, "cleanApiReport");
return (Criteria) this;
}
public Criteria andCleanApiReportGreaterThan(Boolean value) {
addCriterion("clean_api_report >", value, "cleanApiReport");
return (Criteria) this;
}
public Criteria andCleanApiReportGreaterThanOrEqualTo(Boolean value) {
addCriterion("clean_api_report >=", value, "cleanApiReport");
return (Criteria) this;
}
public Criteria andCleanApiReportLessThan(Boolean value) {
addCriterion("clean_api_report <", value, "cleanApiReport");
return (Criteria) this;
}
public Criteria andCleanApiReportLessThanOrEqualTo(Boolean value) {
addCriterion("clean_api_report <=", value, "cleanApiReport");
return (Criteria) this;
}
public Criteria andCleanApiReportIn(List<Boolean> values) {
addCriterion("clean_api_report in", values, "cleanApiReport");
return (Criteria) this;
}
public Criteria andCleanApiReportNotIn(List<Boolean> values) {
addCriterion("clean_api_report not in", values, "cleanApiReport");
return (Criteria) this;
}
public Criteria andCleanApiReportBetween(Boolean value1, Boolean value2) {
addCriterion("clean_api_report between", value1, value2, "cleanApiReport");
return (Criteria) this;
}
public Criteria andCleanApiReportNotBetween(Boolean value1, Boolean value2) {
addCriterion("clean_api_report not between", value1, value2, "cleanApiReport");
return (Criteria) this;
}
public Criteria andCleanApiReportExprIsNull() {
addCriterion("clean_api_report_expr is null");
return (Criteria) this;
}
public Criteria andCleanApiReportExprIsNotNull() {
addCriterion("clean_api_report_expr is not null");
return (Criteria) this;
}
public Criteria andCleanApiReportExprEqualTo(String value) {
addCriterion("clean_api_report_expr =", value, "cleanApiReportExpr");
return (Criteria) this;
}
public Criteria andCleanApiReportExprNotEqualTo(String value) {
addCriterion("clean_api_report_expr <>", value, "cleanApiReportExpr");
return (Criteria) this;
}
public Criteria andCleanApiReportExprGreaterThan(String value) {
addCriterion("clean_api_report_expr >", value, "cleanApiReportExpr");
return (Criteria) this;
}
public Criteria andCleanApiReportExprGreaterThanOrEqualTo(String value) {
addCriterion("clean_api_report_expr >=", value, "cleanApiReportExpr");
return (Criteria) this;
}
public Criteria andCleanApiReportExprLessThan(String value) {
addCriterion("clean_api_report_expr <", value, "cleanApiReportExpr");
return (Criteria) this;
}
public Criteria andCleanApiReportExprLessThanOrEqualTo(String value) {
addCriterion("clean_api_report_expr <=", value, "cleanApiReportExpr");
return (Criteria) this;
}
public Criteria andCleanApiReportExprLike(String value) {
addCriterion("clean_api_report_expr like", value, "cleanApiReportExpr");
return (Criteria) this;
}
public Criteria andCleanApiReportExprNotLike(String value) {
addCriterion("clean_api_report_expr not like", value, "cleanApiReportExpr");
return (Criteria) this;
}
public Criteria andCleanApiReportExprIn(List<String> values) {
addCriterion("clean_api_report_expr in", values, "cleanApiReportExpr");
return (Criteria) this;
}
public Criteria andCleanApiReportExprNotIn(List<String> values) {
addCriterion("clean_api_report_expr not in", values, "cleanApiReportExpr");
return (Criteria) this;
}
public Criteria andCleanApiReportExprBetween(String value1, String value2) {
addCriterion("clean_api_report_expr between", value1, value2, "cleanApiReportExpr");
return (Criteria) this;
}
public Criteria andCleanApiReportExprNotBetween(String value1, String value2) {
addCriterion("clean_api_report_expr not between", value1, value2, "cleanApiReportExpr");
return (Criteria) this;
}
public Criteria andCleanLoadReportIsNull() {
addCriterion("clean_load_report is null");
return (Criteria) this;
}
public Criteria andCleanLoadReportIsNotNull() {
addCriterion("clean_load_report is not null");
return (Criteria) this;
}
public Criteria andCleanLoadReportEqualTo(Boolean value) {
addCriterion("clean_load_report =", value, "cleanLoadReport");
return (Criteria) this;
}
public Criteria andCleanLoadReportNotEqualTo(Boolean value) {
addCriterion("clean_load_report <>", value, "cleanLoadReport");
return (Criteria) this;
}
public Criteria andCleanLoadReportGreaterThan(Boolean value) {
addCriterion("clean_load_report >", value, "cleanLoadReport");
return (Criteria) this;
}
public Criteria andCleanLoadReportGreaterThanOrEqualTo(Boolean value) {
addCriterion("clean_load_report >=", value, "cleanLoadReport");
return (Criteria) this;
}
public Criteria andCleanLoadReportLessThan(Boolean value) {
addCriterion("clean_load_report <", value, "cleanLoadReport");
return (Criteria) this;
}
public Criteria andCleanLoadReportLessThanOrEqualTo(Boolean value) {
addCriterion("clean_load_report <=", value, "cleanLoadReport");
return (Criteria) this;
}
public Criteria andCleanLoadReportIn(List<Boolean> values) {
addCriterion("clean_load_report in", values, "cleanLoadReport");
return (Criteria) this;
}
public Criteria andCleanLoadReportNotIn(List<Boolean> values) {
addCriterion("clean_load_report not in", values, "cleanLoadReport");
return (Criteria) this;
}
public Criteria andCleanLoadReportBetween(Boolean value1, Boolean value2) {
addCriterion("clean_load_report between", value1, value2, "cleanLoadReport");
return (Criteria) this;
}
public Criteria andCleanLoadReportNotBetween(Boolean value1, Boolean value2) {
addCriterion("clean_load_report not between", value1, value2, "cleanLoadReport");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprIsNull() {
addCriterion("clean_load_report_expr is null");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprIsNotNull() {
addCriterion("clean_load_report_expr is not null");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprEqualTo(String value) {
addCriterion("clean_load_report_expr =", value, "cleanLoadReportExpr");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprNotEqualTo(String value) {
addCriterion("clean_load_report_expr <>", value, "cleanLoadReportExpr");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprGreaterThan(String value) {
addCriterion("clean_load_report_expr >", value, "cleanLoadReportExpr");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprGreaterThanOrEqualTo(String value) {
addCriterion("clean_load_report_expr >=", value, "cleanLoadReportExpr");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprLessThan(String value) {
addCriterion("clean_load_report_expr <", value, "cleanLoadReportExpr");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprLessThanOrEqualTo(String value) {
addCriterion("clean_load_report_expr <=", value, "cleanLoadReportExpr");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprLike(String value) {
addCriterion("clean_load_report_expr like", value, "cleanLoadReportExpr");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprNotLike(String value) {
addCriterion("clean_load_report_expr not like", value, "cleanLoadReportExpr");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprIn(List<String> values) {
addCriterion("clean_load_report_expr in", values, "cleanLoadReportExpr");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprNotIn(List<String> values) {
addCriterion("clean_load_report_expr not in", values, "cleanLoadReportExpr");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprBetween(String value1, String value2) {
addCriterion("clean_load_report_expr between", value1, value2, "cleanLoadReportExpr");
return (Criteria) this;
}
public Criteria andCleanLoadReportExprNotBetween(String value1, String value2) {
addCriterion("clean_load_report_expr not between", value1, value2, "cleanLoadReportExpr");
return (Criteria) this;
}
}

View File

@ -22,11 +22,17 @@
<result column="mock_tcp_port" jdbcType="INTEGER" property="mockTcpPort" />
<result column="is_mock_tcp_open" jdbcType="BIT" property="isMockTcpOpen" />
<result column="azure_filter_id" jdbcType="VARCHAR" property="azureFilterId" />
<result column="version_enable" jdbcType="BIT" property="versionEnable" />
<result column="api_quick" jdbcType="VARCHAR" property="apiQuick" />
<result column="case_public" jdbcType="BIT" property="casePublic" />
<result column="platform" jdbcType="VARCHAR" property="platform" />
<result column="third_part_template" jdbcType="BIT" property="thirdPartTemplate" />
<result column="case_public" jdbcType="BIT" property="casePublic" />
<result column="api_quick" jdbcType="VARCHAR" property="apiQuick" />
<result column="version_enable" jdbcType="BIT" property="versionEnable" />
<result column="clean_track_report" jdbcType="BIT" property="cleanTrackReport" />
<result column="clean_track_report_expr" jdbcType="VARCHAR" property="cleanTrackReportExpr" />
<result column="clean_api_report" jdbcType="BIT" property="cleanApiReport" />
<result column="clean_api_report_expr" jdbcType="VARCHAR" property="cleanApiReportExpr" />
<result column="clean_load_report" jdbcType="BIT" property="cleanLoadReport" />
<result column="clean_load_report_expr" jdbcType="VARCHAR" property="cleanLoadReportExpr" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -90,7 +96,9 @@
id, workspace_id, `name`, description, create_time, update_time, tapd_id, jira_key,
zentao_id, azure_devops_id, `repeatable`, case_template_id, issue_template_id, custom_num,
scenario_custom_num, create_user, system_id, mock_tcp_port, is_mock_tcp_open, azure_filter_id,
version_enable, platform, third_part_template, case_public, api_quick
api_quick, case_public, platform, third_part_template, version_enable, clean_track_report,
clean_track_report_expr, clean_api_report, clean_api_report_expr, clean_load_report,
clean_load_report_expr
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ProjectExample" resultMap="BaseResultMap">
select
@ -129,18 +137,22 @@
azure_devops_id, `repeatable`, case_template_id,
issue_template_id, custom_num, scenario_custom_num,
create_user, system_id, mock_tcp_port,
is_mock_tcp_open, azure_filter_id, version_enable,
platform, third_part_template, case_public,
api_quick)
is_mock_tcp_open, azure_filter_id, api_quick,
case_public, platform, third_part_template,
version_enable, clean_track_report, clean_track_report_expr,
clean_api_report, clean_api_report_expr, clean_load_report,
clean_load_report_expr)
values (#{id,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{tapdId,jdbcType=VARCHAR}, #{jiraKey,jdbcType=VARCHAR}, #{zentaoId,jdbcType=VARCHAR},
#{azureDevopsId,jdbcType=VARCHAR}, #{repeatable,jdbcType=BIT}, #{caseTemplateId,jdbcType=VARCHAR},
#{issueTemplateId,jdbcType=VARCHAR}, #{customNum,jdbcType=BIT}, #{scenarioCustomNum,jdbcType=BIT},
#{createUser,jdbcType=VARCHAR}, #{systemId,jdbcType=VARCHAR}, #{mockTcpPort,jdbcType=INTEGER},
#{isMockTcpOpen,jdbcType=BIT}, #{azureFilterId,jdbcType=VARCHAR}, #{versionEnable,jdbcType=BIT},
#{platform,jdbcType=VARCHAR}, #{thirdPartTemplate,jdbcType=BIT}, #{casePublic,jdbcType=BIT},
#{apiQuick,jdbcType=VARCHAR})
#{isMockTcpOpen,jdbcType=BIT}, #{azureFilterId,jdbcType=VARCHAR}, #{apiQuick,jdbcType=VARCHAR},
#{casePublic,jdbcType=BIT}, #{platform,jdbcType=VARCHAR}, #{thirdPartTemplate,jdbcType=BIT},
#{versionEnable,jdbcType=BIT}, #{cleanTrackReport,jdbcType=BIT}, #{cleanTrackReportExpr,jdbcType=VARCHAR},
#{cleanApiReport,jdbcType=BIT}, #{cleanApiReportExpr,jdbcType=VARCHAR}, #{cleanLoadReport,jdbcType=BIT},
#{cleanLoadReportExpr,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.Project">
insert into project
@ -205,8 +217,11 @@
<if test="azureFilterId != null">
azure_filter_id,
</if>
<if test="versionEnable != null">
version_enable,
<if test="apiQuick != null">
api_quick,
</if>
<if test="casePublic != null">
case_public,
</if>
<if test="platform != null">
platform,
@ -214,11 +229,26 @@
<if test="thirdPartTemplate != null">
third_part_template,
</if>
<if test="casePublic != null">
case_public,
<if test="versionEnable != null">
version_enable,
</if>
<if test="apiQuick != null">
api_quick,
<if test="cleanTrackReport != null">
clean_track_report,
</if>
<if test="cleanTrackReportExpr != null">
clean_track_report_expr,
</if>
<if test="cleanApiReport != null">
clean_api_report,
</if>
<if test="cleanApiReportExpr != null">
clean_api_report_expr,
</if>
<if test="cleanLoadReport != null">
clean_load_report,
</if>
<if test="cleanLoadReportExpr != null">
clean_load_report_expr,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
@ -282,8 +312,11 @@
<if test="azureFilterId != null">
#{azureFilterId,jdbcType=VARCHAR},
</if>
<if test="versionEnable != null">
#{versionEnable,jdbcType=BIT},
<if test="apiQuick != null">
#{apiQuick,jdbcType=VARCHAR},
</if>
<if test="casePublic != null">
#{casePublic,jdbcType=BIT},
</if>
<if test="platform != null">
#{platform,jdbcType=VARCHAR},
@ -291,11 +324,26 @@
<if test="thirdPartTemplate != null">
#{thirdPartTemplate,jdbcType=BIT},
</if>
<if test="casePublic != null">
#{casePublic,jdbcType=BIT},
<if test="versionEnable != null">
#{versionEnable,jdbcType=BIT},
</if>
<if test="apiQuick != null">
#{apiQuick,jdbcType=VARCHAR},
<if test="cleanTrackReport != null">
#{cleanTrackReport,jdbcType=BIT},
</if>
<if test="cleanTrackReportExpr != null">
#{cleanTrackReportExpr,jdbcType=VARCHAR},
</if>
<if test="cleanApiReport != null">
#{cleanApiReport,jdbcType=BIT},
</if>
<if test="cleanApiReportExpr != null">
#{cleanApiReportExpr,jdbcType=VARCHAR},
</if>
<if test="cleanLoadReport != null">
#{cleanLoadReport,jdbcType=BIT},
</if>
<if test="cleanLoadReportExpr != null">
#{cleanLoadReportExpr,jdbcType=VARCHAR},
</if>
</trim>
</insert>
@ -368,8 +416,11 @@
<if test="record.azureFilterId != null">
azure_filter_id = #{record.azureFilterId,jdbcType=VARCHAR},
</if>
<if test="record.versionEnable != null">
version_enable = #{record.versionEnable,jdbcType=BIT},
<if test="record.apiQuick != null">
api_quick = #{record.apiQuick,jdbcType=VARCHAR},
</if>
<if test="record.casePublic != null">
case_public = #{record.casePublic,jdbcType=BIT},
</if>
<if test="record.platform != null">
platform = #{record.platform,jdbcType=VARCHAR},
@ -377,11 +428,26 @@
<if test="record.thirdPartTemplate != null">
third_part_template = #{record.thirdPartTemplate,jdbcType=BIT},
</if>
<if test="record.casePublic != null">
case_public = #{record.casePublic,jdbcType=BIT},
<if test="record.versionEnable != null">
version_enable = #{record.versionEnable,jdbcType=BIT},
</if>
<if test="record.apiQuick != null">
api_quick = #{record.apiQuick,jdbcType=VARCHAR},
<if test="record.cleanTrackReport != null">
clean_track_report = #{record.cleanTrackReport,jdbcType=BIT},
</if>
<if test="record.cleanTrackReportExpr != null">
clean_track_report_expr = #{record.cleanTrackReportExpr,jdbcType=VARCHAR},
</if>
<if test="record.cleanApiReport != null">
clean_api_report = #{record.cleanApiReport,jdbcType=BIT},
</if>
<if test="record.cleanApiReportExpr != null">
clean_api_report_expr = #{record.cleanApiReportExpr,jdbcType=VARCHAR},
</if>
<if test="record.cleanLoadReport != null">
clean_load_report = #{record.cleanLoadReport,jdbcType=BIT},
</if>
<if test="record.cleanLoadReportExpr != null">
clean_load_report_expr = #{record.cleanLoadReportExpr,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
@ -410,11 +476,17 @@
mock_tcp_port = #{record.mockTcpPort,jdbcType=INTEGER},
is_mock_tcp_open = #{record.isMockTcpOpen,jdbcType=BIT},
azure_filter_id = #{record.azureFilterId,jdbcType=VARCHAR},
version_enable = #{record.versionEnable,jdbcType=BIT},
api_quick = #{record.apiQuick,jdbcType=VARCHAR},
case_public = #{record.casePublic,jdbcType=BIT},
platform = #{record.platform,jdbcType=VARCHAR},
third_part_template = #{record.thirdPartTemplate,jdbcType=BIT},
case_public = #{record.casePublic,jdbcType=BIT},
api_quick = #{record.apiQuick,jdbcType=VARCHAR}
version_enable = #{record.versionEnable,jdbcType=BIT},
clean_track_report = #{record.cleanTrackReport,jdbcType=BIT},
clean_track_report_expr = #{record.cleanTrackReportExpr,jdbcType=VARCHAR},
clean_api_report = #{record.cleanApiReport,jdbcType=BIT},
clean_api_report_expr = #{record.cleanApiReportExpr,jdbcType=VARCHAR},
clean_load_report = #{record.cleanLoadReport,jdbcType=BIT},
clean_load_report_expr = #{record.cleanLoadReportExpr,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -479,8 +551,11 @@
<if test="azureFilterId != null">
azure_filter_id = #{azureFilterId,jdbcType=VARCHAR},
</if>
<if test="versionEnable != null">
version_enable = #{versionEnable,jdbcType=BIT},
<if test="apiQuick != null">
api_quick = #{apiQuick,jdbcType=VARCHAR},
</if>
<if test="casePublic != null">
case_public = #{casePublic,jdbcType=BIT},
</if>
<if test="platform != null">
platform = #{platform,jdbcType=VARCHAR},
@ -488,11 +563,26 @@
<if test="thirdPartTemplate != null">
third_part_template = #{thirdPartTemplate,jdbcType=BIT},
</if>
<if test="casePublic != null">
case_public = #{casePublic,jdbcType=BIT},
<if test="versionEnable != null">
version_enable = #{versionEnable,jdbcType=BIT},
</if>
<if test="apiQuick != null">
api_quick = #{apiQuick,jdbcType=VARCHAR},
<if test="cleanTrackReport != null">
clean_track_report = #{cleanTrackReport,jdbcType=BIT},
</if>
<if test="cleanTrackReportExpr != null">
clean_track_report_expr = #{cleanTrackReportExpr,jdbcType=VARCHAR},
</if>
<if test="cleanApiReport != null">
clean_api_report = #{cleanApiReport,jdbcType=BIT},
</if>
<if test="cleanApiReportExpr != null">
clean_api_report_expr = #{cleanApiReportExpr,jdbcType=VARCHAR},
</if>
<if test="cleanLoadReport != null">
clean_load_report = #{cleanLoadReport,jdbcType=BIT},
</if>
<if test="cleanLoadReportExpr != null">
clean_load_report_expr = #{cleanLoadReportExpr,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
@ -518,11 +608,17 @@
mock_tcp_port = #{mockTcpPort,jdbcType=INTEGER},
is_mock_tcp_open = #{isMockTcpOpen,jdbcType=BIT},
azure_filter_id = #{azureFilterId,jdbcType=VARCHAR},
version_enable = #{versionEnable,jdbcType=BIT},
api_quick = #{apiQuick,jdbcType=VARCHAR},
case_public = #{casePublic,jdbcType=BIT},
platform = #{platform,jdbcType=VARCHAR},
third_part_template = #{thirdPartTemplate,jdbcType=BIT},
case_public = #{casePublic,jdbcType=BIT},
api_quick = #{apiQuick,jdbcType=VARCHAR}
version_enable = #{versionEnable,jdbcType=BIT},
clean_track_report = #{cleanTrackReport,jdbcType=BIT},
clean_track_report_expr = #{cleanTrackReportExpr,jdbcType=VARCHAR},
clean_api_report = #{cleanApiReport,jdbcType=BIT},
clean_api_report_expr = #{cleanApiReportExpr,jdbcType=VARCHAR},
clean_load_report = #{cleanLoadReport,jdbcType=BIT},
clean_load_report_expr = #{cleanLoadReportExpr,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -2,5 +2,5 @@ package io.metersphere.commons.constants;
public enum ScheduleGroup {
API_TEST, PERFORMANCE_TEST, API_SCENARIO_TEST, TEST_PLAN_TEST, SWAGGER_IMPORT, ISSUE_SYNC,
SCHEDULE_SEND_REPORT
SCHEDULE_SEND_REPORT, CLEAN_UP_REPORT
}

View File

@ -0,0 +1,113 @@
package io.metersphere.job.sechedule;
import io.metersphere.base.domain.Project;
import io.metersphere.commons.constants.ScheduleGroup;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.DateUtils;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.service.ProjectService;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.quartz.JobExecutionContext;
import org.quartz.JobKey;
import org.quartz.TriggerKey;
import java.time.LocalDate;
import java.time.ZoneId;
/**
* @author lyh
*/
public class CleanUpReportJob extends MsScheduleJob {
private final ProjectService projectService;
private static final String UNIT_DAY = "D";
private static final String UNIT_MONTH = "M";
private static final String UNIT_YEAR = "Y";
LocalDate localDate;
public CleanUpReportJob() {
projectService = CommonBeanFactory.getBean(ProjectService.class);
localDate = LocalDate.now();
}
@Override
void businessExecute(JobExecutionContext context) {
Project project = projectService.getProjectById(resourceId);
Boolean cleanTrackReport = project.getCleanTrackReport();
Boolean cleanApiReport = project.getCleanApiReport();
Boolean cleanLoadReport = project.getCleanLoadReport();
try {
if (BooleanUtils.isTrue(cleanTrackReport)) {
this.cleanUpTrackReport(project.getCleanTrackReportExpr());
}
if (BooleanUtils.isTrue(cleanApiReport)) {
this.cleanUpApiReport(project.getCleanApiReportExpr());
}
if (BooleanUtils.isTrue(cleanLoadReport)) {
this.cleanUpLoadReport(project.getCleanLoadReportExpr());
}
} catch (Exception e) {
LogUtil.error(e);
}
}
public static JobKey getJobKey(String projectId) {
return new JobKey(projectId, ScheduleGroup.CLEAN_UP_REPORT.name());
}
public static TriggerKey getTriggerKey(String projectId) {
return new TriggerKey(projectId, ScheduleGroup.CLEAN_UP_REPORT.name());
}
private void cleanUpTrackReport(String expr) {
long time = getCleanDate(expr);
if (time == 0) {
return;
}
LogUtil.info("clean up track plan report before: " + DateUtils.getTimeString(time));
projectService.cleanUpTrackReport(time, resourceId);
}
private void cleanUpApiReport(String expr) {
long time = getCleanDate(expr);
if (time == 0) {
return;
}
LogUtil.info("clean up api report before: " + DateUtils.getTimeString(time));
projectService.cleanUpApiReport(time, resourceId);
}
private void cleanUpLoadReport(String expr) {
long time = getCleanDate(expr);
if (time == 0) {
return;
}
LogUtil.info("clean up load report before: " + DateUtils.getTimeString(time));
projectService.cleanUpLoadReport(time, resourceId);
}
private long getCleanDate(String expr) {
LocalDate date = null;
long timeMills = 0;
if (StringUtils.isNotBlank(expr)) {
try {
String unit = expr.substring(expr.length() - 1);
int quantity = Integer.parseInt(expr.substring(0, expr.length() - 1));
if (StringUtils.equals(unit, UNIT_DAY)) {
date = localDate.minusDays(quantity);
} else if (StringUtils.equals(unit, UNIT_MONTH)) {
date = localDate.minusMonths(quantity);
} else if (StringUtils.equals(unit, UNIT_YEAR)) {
date = localDate.minusYears(quantity);
}
} catch (Exception e) {
LogUtil.error(e);
LogUtil.error("clean up job. get clean date error. project : " + resourceId);
}
}
if (date != null) {
timeMills = date.atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli();
}
return timeMills;
}
}

View File

@ -447,4 +447,14 @@ public class PerformanceReportService {
}
return loadTestReportWithBLOBs.getAdvancedConfiguration();
}
public void cleanUpReport(long time, String projectId) {
LoadTestReportExample example = new LoadTestReportExample();
example.createCriteria().andCreateTimeLessThan(time).andProjectIdEqualTo(projectId);
List<LoadTestReport> loadTestReports = loadTestReportMapper.selectByExample(example);
List<String> ids = loadTestReports.stream().map(LoadTestReport::getId).collect(Collectors.toList());
DeleteReportRequest request = new DeleteReportRequest();
request.setIds(ids);
deleteReportBatch(request);
}
}

View File

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import io.metersphere.api.dto.DeleteAPITestRequest;
import io.metersphere.api.dto.QueryAPITestRequest;
import io.metersphere.api.service.APITestService;
import io.metersphere.api.service.ApiScenarioReportService;
import io.metersphere.api.service.ApiTestDelService;
import io.metersphere.api.service.ApiTestEnvironmentService;
import io.metersphere.api.tcp.TCPPool;
@ -14,6 +15,8 @@ import io.metersphere.base.mapper.ext.ExtProjectVersionMapper;
import io.metersphere.base.mapper.ext.ExtUserGroupMapper;
import io.metersphere.base.mapper.ext.ExtUserMapper;
import io.metersphere.commons.constants.IssuesManagePlatform;
import io.metersphere.commons.constants.ScheduleGroup;
import io.metersphere.commons.constants.ScheduleType;
import io.metersphere.commons.constants.UserGroupConstants;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.CommonBeanFactory;
@ -21,9 +24,11 @@ import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.ProjectRequest;
import io.metersphere.controller.request.ScheduleRequest;
import io.metersphere.dto.ProjectDTO;
import io.metersphere.dto.WorkspaceMemberDTO;
import io.metersphere.i18n.Translator;
import io.metersphere.job.sechedule.CleanUpReportJob;
import io.metersphere.log.utils.ReflexObjectUtil;
import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
@ -34,6 +39,7 @@ import io.metersphere.performance.service.PerformanceReportService;
import io.metersphere.performance.service.PerformanceTestService;
import io.metersphere.track.service.TestCaseService;
import io.metersphere.track.service.TestPlanProjectService;
import io.metersphere.track.service.TestPlanReportService;
import io.metersphere.track.service.TestPlanService;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
@ -97,6 +103,11 @@ public class ProjectService {
private EnvironmentGroupProjectService environmentGroupProjectService;
@Resource
private ExtProjectVersionMapper extProjectVersionMapper;
@Lazy
@Resource
private TestPlanReportService testPlanReportService;
@Resource
private ApiScenarioReportService apiScenarioReportService;
public Project addProject(Project project) {
if (StringUtils.isBlank(project.getName())) {
@ -329,6 +340,7 @@ public class ProjectService {
testCaseService.updateTestCaseCustomNumByProjectId(project.getId());
}
projectMapper.updateByPrimaryKeySelective(project);
addOrUpdateCleanUpSchedule(project);
//检查Mock环境是否需要同步更新
ApiTestEnvironmentService apiTestEnvironmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);
@ -341,6 +353,48 @@ public class ProjectService {
}
}
public void addOrUpdateCleanUpSchedule(Project project) {
Boolean cleanTrackReport = project.getCleanTrackReport();
Boolean cleanApiReport = project.getCleanApiReport();
Boolean cleanLoadReport = project.getCleanLoadReport();
// 未设置则不更新定时任务
if (cleanTrackReport == null && cleanApiReport == null && cleanLoadReport == null) {
return;
}
String projectId = project.getId();
Boolean enable = BooleanUtils.isTrue(cleanTrackReport) ||
BooleanUtils.isTrue(cleanApiReport) ||
BooleanUtils.isTrue(cleanLoadReport);
Schedule schedule = scheduleService.getScheduleByResource(projectId, ScheduleGroup.CLEAN_UP_REPORT.name());
if (schedule != null && StringUtils.isNotBlank(schedule.getId())) {
schedule.setEnable(enable);
scheduleService.editSchedule(schedule);
scheduleService.addOrUpdateCronJob(schedule,
CleanUpReportJob.getJobKey(projectId),
CleanUpReportJob.getTriggerKey(projectId),
CleanUpReportJob.class);
} else {
ScheduleRequest request = new ScheduleRequest();
request.setName("Clean Report Job");
request.setResourceId(projectId);
request.setKey(projectId);
request.setProjectId(projectId);
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
request.setEnable(enable);
request.setUserId(SessionUtils.getUserId());
request.setGroup(ScheduleGroup.CLEAN_UP_REPORT.name());
request.setType(ScheduleType.CRON.name());
// 每天凌晨2点执行清理任务
request.setValue("0 0 2 * * ?");
request.setJob(CleanUpReportJob.class.getName());
scheduleService.addSchedule(request);
scheduleService.addOrUpdateCronJob(request,
CleanUpReportJob.getJobKey(projectId),
CleanUpReportJob.getTriggerKey(projectId),
CleanUpReportJob.class);
}
}
private boolean isMockTcpPortIsInRange(int port) {
boolean inRange = false;
if (StringUtils.isNotEmpty(this.tcpMockPorts)) {
@ -774,4 +828,25 @@ public class ProjectService {
public boolean isVersionEnable(String projectId) {
return extProjectVersionMapper.isVersionEnable(projectId);
}
public void cleanUpTrackReport(long time, String projectId) {
if (StringUtils.isBlank(projectId)) {
return;
}
testPlanReportService.cleanUpReport(time, projectId);
}
public void cleanUpApiReport(long time, String projectId) {
if (StringUtils.isBlank(projectId)) {
return;
}
apiScenarioReportService.cleanUpReport(time, projectId);
}
public void cleanUpLoadReport(long time, String projectId) {
if (StringUtils.isBlank(projectId)) {
return;
}
performanceReportService.cleanUpReport(time, projectId);
}
}

View File

@ -1285,4 +1285,20 @@ public class TestPlanReportService {
}
TestPlanReportExecuteCatch.remove(planReportId);
}
public void cleanUpReport(long time, String projectId) {
TestPlanExample testPlanExample = new TestPlanExample();
testPlanExample.createCriteria().andProjectIdEqualTo(projectId);
List<TestPlan> testPlans = testPlanMapper.selectByExample(testPlanExample);
List<String> testPlanIds = testPlans.stream().map(TestPlan::getId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(testPlanIds)) {
TestPlanReportExample example = new TestPlanReportExample();
example.createCriteria().andCreateTimeLessThan(time).andTestPlanIdIn(testPlanIds);
List<TestPlanReport> testPlanReports = testPlanReportMapper.selectByExample(example);
List<String> ids = testPlanReports.stream().map(TestPlanReport::getId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(ids)) {
delete(ids);
}
}
}
}

View File

@ -153,3 +153,22 @@ SET version_id = project_version.id;
UPDATE api_scenario_report
INNER JOIN project_version ON project_version.project_id = api_scenario_report.project_id
SET version_id = project_version.id;
alter table project
add clean_track_report tinyint(1) default 0 null;
alter table project
add clean_track_report_expr varchar(50) null;
alter table project
add clean_api_report tinyint(1) default 0 null;
alter table project
add clean_api_report_expr varchar(50) null;
alter table project
add clean_load_report tinyint(1) default 0 null;
alter table project
add clean_load_report_expr varchar(50) null;

View File

@ -26,6 +26,8 @@
<el-switch v-model="form.customNum" @change="chooseChange"></el-switch>
</template>
</app-manage-item>
<timing-item ref="trackTimingItem" :choose.sync="form.cleanTrackReport" :expr.sync="form.cleanTrackReportExpr"
@chooseChange="chooseChange" :title="$t('project.timing_clean_plan_report')"/>
</el-row>
</el-tab-pane>
@ -56,6 +58,8 @@
<el-switch v-model="form.isMockTcpOpen" @change="chooseChange"></el-switch>
</template>
</app-manage-item>
<timing-item ref="apiTimingItem" :choose.sync="form.cleanApiReport" :expr.sync="form.cleanApiReportExpr"
@chooseChange="chooseChange" :title="$t('project.timing_clean_api_report')"/>
</el-row>
</el-col>
<el-col :span="8" :offset="4">
@ -81,10 +85,14 @@
</el-row>
</el-tab-pane>
<el-tab-pane :label="$t('commons.performance')" name="performance" :disabled="true">
<el-tab-pane :label="$t('commons.performance')" name="performance">
<el-row style="margin-top: 10px">
<span style="font-weight:bold">{{ this.$t('commons.enable_settings') }}</span>
</el-row>
<el-row style="margin-top: 15px">
<timing-item ref="loadTimingItem" :choose.sync="form.cleanLoadReport" :expr.sync="form.cleanLoadReportExpr"
@chooseChange="chooseChange" :title="$t('project.timing_clean_load_report')"/>
</el-row>
</el-tab-pane>
</el-tabs>
@ -106,11 +114,13 @@ import {
getCurrentWorkspaceId,
hasLicense,
} from "@/common/js/utils";
import AppManageItem from "@/business/components/settings/common/AppManageItem";
import AppManageItem from "@/business/components/project/menu/appmanage/AppManageItem";
import TimingItem from "@/business/components/project/menu/appmanage/TimingItem";
export default {
name: "appManage",
components: {
TimingItem,
AppManageItem,
MsMainContainer,
MsContainer
@ -118,10 +128,20 @@ export default {
data() {
return {
activeName: 'test_track',
form: {},
form: {
cleanTrackReport: false,
cleanTrackReportExpr: "",
cleanApiReport: false,
cleanApiReportExpr: "",
cleanLoadReport: false,
cleanLoadReportExpr: ""
},
count: 0,
isXpack: false,
result: {}
result: {},
quantity: "",
unit: "",
choose: false
};
},
created() {

View File

@ -72,7 +72,7 @@ export default {
.item_outer {
border-radius: 2px;
width: 580px;
height: 40px;
height: 35px;
border: 1px solid #DCDFE6;
padding-bottom: 15px;
}
@ -82,20 +82,20 @@ export default {
}
.item_prepend {
margin-top: 8px;
margin-top: 6px;
}
.item_prepend_lh {
line-height: 40px;
line-height: 35px;
}
.item_middle {
line-height: 55px;
line-height: 50px;
}
.item_append {
position: absolute;
line-height: 55px;
line-height: 50px;
right: 20px;
}

View File

@ -0,0 +1,120 @@
<template>
<app-manage-item :title="title" :append-span="4" :middle-span="10" :prepend-span="10">
<template #middle>
<span class="timing_name">{{ $t('project.keep_recent') }}</span>
<el-select v-model="selfQuantity" placeholder=" " size="mini"
class="timing_select" :disabled="selfChoose">
<el-option
v-for="item in quantityOptions"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
<el-select v-model="selfUnit" placeholder=" " size="mini"
class="timing_select" :disabled="selfChoose">
<el-option
v-for="item in unitOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<span class="timing_name" style="margin-left: 3px;">{{ $t('commons.report') }}</span>
</template>
<template #append>
<el-switch v-model="selfChoose" @change="chooseChange"></el-switch>
</template>
</app-manage-item>
</template>
<script>
import AppManageItem from "@/business/components/project/menu/appmanage/AppManageItem";
export default {
name: "TimingItem",
components: {
AppManageItem
},
props: {
choose: {
type: Boolean,
default() {
return false;
}
},
expr: {
type: String,
default() {
return "";
}
},
title: {
type: String,
default() {
return "";
}
}
},
watch: {
expr(val) {
this.parseExpr(val);
},
choose(val) {
this.selfChoose = val;
}
},
data() {
return {
selfQuantity: "",
selfUnit: "",
selfChoose: this.choose,
selfExpr: this.expr,
quantityOptions: [
"1", "2", "3", "4", "5", "6", "7", "8", "9",
"10", "11", "12", "13", "14",
"15", "16", "17", "18", "19",
"20", "21", "22", "23", "24",
"25", "26", "27", "28", "29",
"30", "31",
],
unitOptions: [
{value: "D", label: "天"},
{value: "M", label: "月"},
{value: "Y", label: "年"},
]
}
},
methods: {
chooseChange(val) {
if (val && (!this.selfQuantity || !this.selfUnit)) {
this.$warning(this.$t('project.please_select_cleaning_time'));
this.selfChoose = false;
return false;
}
this.$emit("update:choose", val);
this.$emit("update:expr", this.selfQuantity + this.selfUnit);
this.$emit("chooseChange");
},
parseExpr(expr) {
if (!expr) {
return;
}
// 1D 1M 1Y
this.selfUnit = expr.substring(expr.length - 1);
this.selfQuantity = expr.substring(0, expr.length - 1);
}
}
}
</script>
<style scoped>
.timing_name {
color: var(--primary_color);
}
.timing_select {
width: 60px;
margin-left: 3px;
}
</style>

View File

@ -771,7 +771,12 @@ export default {
latest: 'Latest',
set_latest: 'Latest',
delete_tip: 'This version has been associated with system resources. Deleting it will cause the version information lost',
}
},
timing_clean_plan_report: "Regularly clean up test report",
timing_clean_api_report: "Regularly clean up api report",
timing_clean_load_report: "Regularly clean up performance report",
keep_recent: "Keep recent",
please_select_cleaning_time: "please select cleaning time"
},
member: {
create: 'Create',

View File

@ -775,7 +775,12 @@ export default {
latest: '最新版',
set_latest: '设置为最新版本',
delete_tip: '此版本已经关联系统资源,删除会导致无法查询到版本信息',
}
},
timing_clean_plan_report: "定时清理测试计划报告",
timing_clean_api_report: "定时清理接口测试报告",
timing_clean_load_report: "定时清理性能测试报告",
keep_recent: "保留最近",
please_select_cleaning_time: "请选择清理时间!"
},
member: {
create: '添加成员',

View File

@ -775,7 +775,12 @@ export default {
latest: '最新版',
set_latest: '設置為最新版本',
delete_tip: '此版本已經關聯繫統資源,刪除會導致無法查詢到版本信息',
}
},
timing_clean_plan_report: "定時清理測試計劃報告",
timing_clean_api_report: "定時清理接口測試報告",
timing_clean_load_report: "定時清理性能測試報告",
keep_recent: "保留最近",
please_select_cleaning_time: "請選擇清理時間!"
},
member: {
create: '添加成員',