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 eacb8c1ad7..adb9ba8727 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 @@ -369,7 +369,7 @@ public class ApiDefinitionService { //计算全部用例 definitionList = this.selectEffectiveIdByProjectId(request.getProjectId()); } - + if (CollectionUtils.isNotEmpty(definitionList)) { //如果查询条件中有未覆盖/已覆盖, 则需要解析出没有用例的接口中,有多少是符合场景覆盖规律的。然后将这些接口的id作为查询参数 Map> scenarioUrlList = apiAutomationService.selectScenarioUseUrlByProjectId(request.getProjectId()); @@ -1862,11 +1862,13 @@ public class ApiDefinitionService { String tags = apiDefinition.getTags(); if (StringUtils.isBlank(tags) || BooleanUtils.isFalse(request.isAppendTag())) { apiDefinition.setTags(JSON.toJSONString(request.getTagList())); + apiDefinition.setUpdateTime(System.currentTimeMillis()); } else { try { List list = JSON.parseArray(tags, String.class); list.addAll(request.getTagList()); apiDefinition.setTags(JSON.toJSONString(list)); + apiDefinition.setUpdateTime(System.currentTimeMillis()); } catch (Exception e) { LogUtil.error("batch edit tags error."); LogUtil.error(e, e.getMessage()); diff --git a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiTestCaseService.java b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiTestCaseService.java index 296b10ed29..0086cb800b 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiTestCaseService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiTestCaseService.java @@ -2,56 +2,23 @@ package io.metersphere.service.definition; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; -import io.metersphere.api.dto.ApiCaseEditRequest; -import io.metersphere.api.dto.ApiCaseRelevanceRequest; -import io.metersphere.api.dto.ApiCountChartResult; -import io.metersphere.api.dto.ApiCountRequest; -import io.metersphere.api.dto.DeleteCheckResult; +import io.metersphere.api.dto.*; import io.metersphere.api.dto.automation.ApiScenarioDTO; import io.metersphere.api.dto.automation.ApiScenarioRequest; import io.metersphere.api.dto.datacount.ApiDataCountResult; import io.metersphere.api.dto.datacount.response.ExecuteResultCountDTO; -import io.metersphere.api.dto.definition.ApiTestBatchRequest; -import io.metersphere.api.dto.definition.ApiTestCaseDTO; -import io.metersphere.api.dto.definition.ApiTestCaseInfo; -import io.metersphere.api.dto.definition.ApiTestCaseRequest; -import io.metersphere.api.dto.definition.ApiTestCaseResult; -import io.metersphere.api.dto.definition.SaveApiTestCaseRequest; +import io.metersphere.api.dto.definition.*; import io.metersphere.api.dto.definition.request.ElementUtil; import io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy; import io.metersphere.base.domain.*; -import io.metersphere.service.ext.ExtFileAssociationService; -import io.metersphere.service.plan.TestPlanApiCaseService; -import io.metersphere.service.scenario.ApiScenarioReferenceIdService; -import io.metersphere.base.mapper.ApiDefinitionExecResultMapper; -import io.metersphere.base.mapper.ApiDefinitionMapper; -import io.metersphere.base.mapper.ApiScenarioReferenceIdMapper; -import io.metersphere.base.mapper.ApiTestCaseFollowMapper; -import io.metersphere.base.mapper.ApiTestCaseMapper; -import io.metersphere.base.mapper.ApiTestEnvironmentMapper; -import io.metersphere.base.mapper.ProjectApplicationMapper; -import io.metersphere.base.mapper.ext.BaseProjectVersionMapper; -import io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper; -import io.metersphere.base.mapper.ext.ExtApiDefinitionMapper; -import io.metersphere.base.mapper.ext.ExtApiScenarioMapper; -import io.metersphere.base.mapper.ext.ExtApiTestCaseMapper; -import io.metersphere.commons.constants.CommonConstants; -import io.metersphere.commons.constants.ElementConstants; -import io.metersphere.commons.constants.MsTestElementConstants; -import io.metersphere.commons.constants.ProjectApplicationType; -import io.metersphere.commons.constants.ReportTriggerMode; -import io.metersphere.commons.constants.RequestTypeConstants; +import io.metersphere.base.mapper.*; +import io.metersphere.base.mapper.ext.*; +import io.metersphere.commons.constants.*; import io.metersphere.commons.enums.ApiReportStatus; import io.metersphere.commons.enums.ApiTestDataStatus; import io.metersphere.commons.enums.FileAssociationTypeEnums; import io.metersphere.commons.exception.MSException; -import io.metersphere.commons.utils.BeanUtils; -import io.metersphere.commons.utils.CommonBeanFactory; -import io.metersphere.commons.utils.DateUtils; -import io.metersphere.commons.utils.FileUtils; -import io.metersphere.commons.utils.JSON; -import io.metersphere.commons.utils.LogUtil; -import io.metersphere.commons.utils.SessionUtils; +import io.metersphere.commons.utils.*; import io.metersphere.dto.ParamsDTO; import io.metersphere.i18n.Translator; import io.metersphere.log.utils.ReflexObjectUtil; @@ -63,7 +30,9 @@ import io.metersphere.request.OrderRequest; import io.metersphere.request.ResetOrderRequest; import io.metersphere.service.BaseUserService; import io.metersphere.service.ServiceUtils; -import io.metersphere.commons.utils.JSONUtil; +import io.metersphere.service.ext.ExtFileAssociationService; +import io.metersphere.service.plan.TestPlanApiCaseService; +import io.metersphere.service.scenario.ApiScenarioReferenceIdService; import io.metersphere.xpack.api.service.ApiCaseBatchSyncService; import io.metersphere.xpack.api.service.ApiTestCaseSyncService; import org.apache.commons.beanutils.BeanComparator; @@ -83,15 +52,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.io.File; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; +import java.util.*; import java.util.stream.Collectors; import static io.metersphere.commons.utils.ShareUtil.getTimeMills; @@ -750,11 +711,13 @@ public class ApiTestCaseService { String tags = apiTestCase.getTags(); if (StringUtils.isBlank(tags) || BooleanUtils.isFalse(request.isAppendTag())) { apiTestCase.setTags(JSON.toJSONString(request.getTagList())); + apiTestCase.setUpdateTime(System.currentTimeMillis()); } else { try { List list = JSON.parseArray(tags, String.class); list.addAll(request.getTagList()); apiTestCase.setTags(JSON.toJSONString(list)); + apiTestCase.setUpdateTime(System.currentTimeMillis()); } catch (Exception e) { LogUtil.error("batch edit tags error."); LogUtil.error(e, e.getMessage()); diff --git a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java index f1facc0315..12c9163c44 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java @@ -1132,11 +1132,13 @@ public class ApiScenarioService { String tags = apiScenario.getTags(); if (StringUtils.isBlank(tags) || BooleanUtils.isFalse(request.isAppendTag())) { apiScenario.setTags(JSON.toJSONString(request.getTagList())); + apiScenario.setUpdateTime(System.currentTimeMillis()); } else { try { List list = JSON.parseArray(tags, String.class); list.addAll(request.getTagList()); apiScenario.setTags(JSON.toJSONString(list)); + apiScenario.setUpdateTime(System.currentTimeMillis()); } catch (Exception e) { LogUtil.error("batch edit tags error."); LogUtil.error(e, e.getMessage()); diff --git a/api-test/frontend/src/api/api-test-case.js b/api-test/frontend/src/api/api-test-case.js index 3aa4b59d10..c816bae1d5 100644 --- a/api-test/frontend/src/api/api-test-case.js +++ b/api-test/frontend/src/api/api-test-case.js @@ -2,7 +2,7 @@ import {fileUpload} from "@/api/base-network"; import {get, post} from "metersphere-frontend/src/plugins/request" export function editApiTestCaseOrder(request) { - return get('/api/testcase/sort', request); + return post('/api/testcase/sort', request); } export function getCaseById(id) { diff --git a/api-test/frontend/src/api/definition.js b/api-test/frontend/src/api/definition.js index 0670752bbe..9ca9edb2da 100644 --- a/api-test/frontend/src/api/definition.js +++ b/api-test/frontend/src/api/definition.js @@ -10,7 +10,7 @@ export function getRelationshipApi(id, relationshipType) { } export function editApiDefinitionOrder(request) { - return get('/api/definition/sort', request); + return post('/api/definition/sort', request); } export function getDefinitionById(id) { diff --git a/api-test/frontend/src/business/definition/ApiDefinition.vue b/api-test/frontend/src/business/definition/ApiDefinition.vue index 5c966d7ab1..154414cad2 100644 --- a/api-test/frontend/src/business/definition/ApiDefinition.vue +++ b/api-test/frontend/src/business/definition/ApiDefinition.vue @@ -188,7 +188,7 @@ /> -
+
import {createDefinitionEnv, getDefinitionById, getDefinitionEnv} from "@/api/definition"; import {getProjectConfig} from "@/api/project"; -import {getApiModuleByProjectIdAndProtocol, getApiModules, trashCount} from "@/api/definition-module"; +import {getApiModuleByProjectIdAndProtocol, trashCount} from "@/api/definition-module"; import MsApiList from './components/list/ApiList'; import MsContainer from "metersphere-frontend/src/components/MsContainer"; import MsMainContainer from "metersphere-frontend/src/components/MsMainContainer"; @@ -804,7 +804,7 @@ export default { if (selectParamArr.length === 2) { let scenarioId = selectParamArr[1]; if (dataType === 'api') { - getDefinitionById( scenarioId).then((response) => { + getDefinitionById(scenarioId).then((response) => { this.defaultProtocol = response.data.protocol; this.editApi(response.data); });