diff --git a/api-test/backend/src/main/java/io/metersphere/commons/utils/mock/MockApiUtils.java b/api-test/backend/src/main/java/io/metersphere/commons/utils/mock/MockApiUtils.java index ed7bcc604b..db602c47a1 100644 --- a/api-test/backend/src/main/java/io/metersphere/commons/utils/mock/MockApiUtils.java +++ b/api-test/backend/src/main/java/io/metersphere/commons/utils/mock/MockApiUtils.java @@ -103,7 +103,7 @@ public class MockApiUtils { } else if (StringUtils.equalsIgnoreCase(type, "XML")) { if (bodyObj.has("raw")) { String xmlStr = bodyObj.optString("raw"); - xmlStr = xmlStr.replaceAll("\r","").replaceAll("\n",""); + xmlStr = xmlStr.replaceAll("\r", "").replaceAll("\n", ""); JSONObject matchObj = XMLUtil.xmlStringToJSONObject(xmlStr); returnJson = matchObj; } @@ -360,7 +360,10 @@ public class MockApiUtils { bodyParams = new JSONArray(); bodyParams.put(paramJson); } else { - bodyParams.put(((JSONObject) paramJson)); + JSONArray oldArray = returnParams.getBodyParams(); + if (!JsonStructUtils.checkJsonArrayCompliance(oldArray, ((JSONObject) paramJson))) { + bodyParams.put(((JSONObject) paramJson)); + } } returnParams.setBodyParams(bodyParams); } diff --git a/api-test/backend/src/main/java/io/metersphere/controller/home/ApiHomeController.java b/api-test/backend/src/main/java/io/metersphere/controller/home/ApiHomeController.java index 6054a66855..a41ccbc835 100644 --- a/api-test/backend/src/main/java/io/metersphere/controller/home/ApiHomeController.java +++ b/api-test/backend/src/main/java/io/metersphere/controller/home/ApiHomeController.java @@ -79,7 +79,7 @@ public class ApiHomeController { long effectiveApiCount = apiDefinitionService.countEffectiveByProjectId(projectId, versionId); long apiHasCase = apiDefinitionService.countApiByProjectIdAndHasCase(projectId, versionId); List apiNoCaseList = apiDefinitionService.selectEffectiveIdByProjectIdAndHaveNotCase(projectId, versionId); - Map> scenarioUrlList = apiAutomationService.selectScenarioUseUrlByProjectId(projectId, versionId); + Map> scenarioUrlList = apiAutomationService.selectScenarioUseUrlByProjectId(projectId, null); int apiInScenario = apiAutomationService.getApiIdInScenario(projectId, scenarioUrlList, apiNoCaseList).size(); if (effectiveApiCount == 0) { @@ -185,7 +185,6 @@ public class ApiHomeController { apiCountResult.setCoveredCount(coveredDTO.covered); apiCountResult.setNotCoveredCount(coveredDTO.notCovered); apiCountResult.setApiCoveredRate(coveredDTO.rateOfCovered); - return apiCountResult; } diff --git a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionService.java b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionService.java index 06a90ef2d9..8f5f81b960 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionService.java @@ -1669,9 +1669,11 @@ public class ApiDefinitionService { } else { ApiDefinitionExample example = new ApiDefinitionExample(); ApiDefinitionExample.Criteria criteria = example.createCriteria(); - criteria.andProjectIdEqualTo(projectId).andStatusNotEqualTo("Trash").andLatestEqualTo(true); + criteria.andProjectIdEqualTo(projectId).andStatusNotEqualTo("Trash"); if (StringUtils.isNotBlank(versionId)) { criteria.andVersionIdEqualTo(versionId); + } else { + criteria.andLatestEqualTo(true); } return apiDefinitionMapper.countByExample(example); } diff --git a/api-test/frontend/src/business/home/components/table/ScheduleTaskList.vue b/api-test/frontend/src/business/home/components/table/ScheduleTaskList.vue index e10a801cc4..d17e5a7a4b 100644 --- a/api-test/frontend/src/business/home/components/table/ScheduleTaskList.vue +++ b/api-test/frontend/src/business/home/components/table/ScheduleTaskList.vue @@ -123,6 +123,7 @@ export default { tableData: [], currentPage: 1, pageSize: 5, + versionId: '', total: 0, condition: { filters: {}, @@ -143,10 +144,13 @@ export default { } }, search(versionId) { + if (versionId) { + this.versionId = versionId; + } let projectId = getCurrentProjectID(); this.loading = true; this.loadError = false; - this.result = getRunningTask(projectId, versionId, this.currentPage, this.pageSize) + this.result = getRunningTask(projectId, this.versionId, this.currentPage, this.pageSize) .then((response) => { this.total = response.data.itemCount; this.tableData = response.data.listObject; diff --git a/api-test/frontend/src/business/home/components/table/UpdatedApiList.vue b/api-test/frontend/src/business/home/components/table/UpdatedApiList.vue index 3a4c816a51..c08a384667 100644 --- a/api-test/frontend/src/business/home/components/table/UpdatedApiList.vue +++ b/api-test/frontend/src/business/home/components/table/UpdatedApiList.vue @@ -156,12 +156,14 @@ export default { } }, search(versionId) { - this.versionId = versionId; + if (versionId) { + this.versionId = versionId; + } let projectId = getCurrentProjectID(); this.loading = true; this.loadError = false; - this.result = definitionWeekList(projectId, versionId, this.currentPage, this.pageSize) + this.result = definitionWeekList(projectId, this.versionId, this.currentPage, this.pageSize) .then((response) => { this.total = response.data.itemCount; this.tableData = response.data.listObject;