diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionExecResultService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionExecResultService.java index 4f4825d432..ef5e4fab57 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionExecResultService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionExecResultService.java @@ -273,9 +273,12 @@ public class ApiDefinitionExecResultService { // 更新用例最后执行结果 caseWithBLOBs.setLastResultId(reportId); caseWithBLOBs.setStatus(status); - if (status.equals("success")) { + if (status.equals(APITestStatus.Success.name())) { caseWithBLOBs.setToBeUpdated(false); } + if (status.equals(APITestStatus.Error.name())) { + caseWithBLOBs.setToBeUpdated(true); + } caseWithBLOBs.setUpdateTime(System.currentTimeMillis()); apiTestCaseMapper.updateByPrimaryKey(caseWithBLOBs); diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java index a9f903f42d..5293cd02a7 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -1013,25 +1013,7 @@ public class ApiDefinitionService { } if (apiDefinition.getToBeUpdated() != null) { - ApiSyncCaseRequest apiSyncCaseRequest = new ApiSyncCaseRequest(); - ApiDefinitionSyncService apiDefinitionSyncService = CommonBeanFactory.getBean(ApiDefinitionSyncService.class); - if (apiDefinitionSyncService != null) { - apiSyncCaseRequest = apiDefinitionSyncService.getApiSyncCaseRequest(apiDefinition.getProjectId()); - } - if (apiSyncCaseRequest.getUnRun() != null && apiSyncCaseRequest.getUnRun() && apiTestCaseWithBLOBs.getStatus() != null && !apiTestCaseWithBLOBs.getStatus().equalsIgnoreCase("Trash") - && !apiTestCaseWithBLOBs.getStatus().equalsIgnoreCase("success") && !apiTestCaseWithBLOBs.getStatus().equalsIgnoreCase("error") - && !apiTestCaseWithBLOBs.getStatus().equalsIgnoreCase("Running") && !apiTestCaseWithBLOBs.getStatus().equalsIgnoreCase("errorReportResult") - && !apiTestCaseWithBLOBs.getStatus().equalsIgnoreCase("STOP")) { - - apiTestCaseWithBLOBs.setToBeUpdated(true); - - } else if (apiSyncCaseRequest.getRunError() != null && apiSyncCaseRequest.getRunError() && apiTestCaseWithBLOBs.getStatus() != null - && !apiTestCaseWithBLOBs.getStatus().equalsIgnoreCase("Trash") - && apiTestCaseWithBLOBs.getStatus().equalsIgnoreCase("error")) { - apiTestCaseWithBLOBs.setToBeUpdated(true); - } else { - apiTestCaseWithBLOBs.setToBeUpdated(false); - } + apiTestCaseWithBLOBs.setToBeUpdated(apiDefinition.getToBeUpdated()); } if (apiDefinition.getToBeUpdateTime() != null) { apiTestCaseWithBLOBs.setToBeUpdateTime(apiDefinition.getToBeUpdateTime()); diff --git a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java index b0271bc000..ebc11fe7c9 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java @@ -865,20 +865,7 @@ public class ApiTestCaseService { String requestStr = JSON.toJSONString(req); apiTestCase.setRequest(requestStr); if (toBeUpdated != null) { - if (apiSyncCaseRequest.getUnRun() != null && apiSyncCaseRequest.getUnRun() && apiTestCase.getStatus() != null && !apiTestCase.getStatus().equalsIgnoreCase("Trash") - && !apiTestCase.getStatus().equalsIgnoreCase("success") && !apiTestCase.getStatus().equalsIgnoreCase("error") - && !apiTestCase.getStatus().equalsIgnoreCase("Running") && !apiTestCase.getStatus().equalsIgnoreCase("errorReportResult") - && !apiTestCase.getStatus().equalsIgnoreCase("STOP")) { - - apiTestCase.setToBeUpdated(true); - - } else if (apiSyncCaseRequest.getRunError() != null && apiSyncCaseRequest.getRunError() && apiTestCase.getStatus() != null && !apiTestCase.getStatus().equalsIgnoreCase("Trash") - && apiTestCase.getStatus().equalsIgnoreCase("error")) { - apiTestCase.setToBeUpdated(true); - } else { - apiTestCase.setToBeUpdated(false); - } - + apiTestCase.setToBeUpdated(toBeUpdated); if (toBeUpdated) { apiTestCase.setToBeUpdateTime(System.currentTimeMillis()); } diff --git a/backend/src/main/java/io/metersphere/base/domain/ApiTestCase.java b/backend/src/main/java/io/metersphere/base/domain/ApiTestCase.java index 80357e4cd2..cac8f90330 100644 --- a/backend/src/main/java/io/metersphere/base/domain/ApiTestCase.java +++ b/backend/src/main/java/io/metersphere/base/domain/ApiTestCase.java @@ -1,8 +1,9 @@ package io.metersphere.base.domain; -import java.io.Serializable; import lombok.Data; +import java.io.Serializable; + @Data public class ApiTestCase implements Serializable { private String id; diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml index 673229e4b6..13acf35ae0 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml @@ -503,10 +503,10 @@ and (t1.status is null or t1.status != 'Trash') - and t1.to_be_updated = #{request.toBeUpdated} + and ( t1.to_be_updated = #{request.toBeUpdated} or t1.status = 'error') - and (t1.to_be_update_time >= #{request.toBeUpdateTime}) + and (t1.to_be_update_time >= #{request.toBeUpdateTime} or t1.status = 'error') diff --git a/frontend/src/business/components/project/menu/appmanage/AppManage.vue b/frontend/src/business/components/project/menu/appmanage/AppManage.vue index d23f5d7abc..b6457e3d2f 100644 --- a/frontend/src/business/components/project/menu/appmanage/AppManage.vue +++ b/frontend/src/business/components/project/menu/appmanage/AppManage.vue @@ -230,15 +230,15 @@ {{ $t('api_test.request.body') }} - {{ $t('commons.track') + $t('commons.setting') }} - - {{ $t('project.code_segment.result') + ":" }} - - {{ $t('schedule.event_failed') }} - {{ $t('api_test.home_page.detail_card.unexecute') }} - - - + 取 消 @@ -410,8 +410,8 @@ export default { query: true, rest: true, body: true, - runError: true, - unRun: true + runError: false, + unRun: false } } this.apiSyncCaseRequest.protocol = true;