From c269b2382a27d9b10dee69906c711c9748d20a3d Mon Sep 17 00:00:00 2001 From: Jianguo-Genius Date: Mon, 24 Jun 2024 18:17:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E7=BB=84?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E6=97=B6?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E8=87=AA=E5=8A=A8=E6=9B=B4=E6=96=B0=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plan/service/TestPlanService.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanService.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanService.java index a286d1df16..9ce78df2a9 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanService.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanService.java @@ -320,6 +320,7 @@ public class TestPlanService extends TestPlanBaseUtilsService { public TestPlan update(TestPlanUpdateRequest request, String userId, String requestUrl, String requestMethod) { this.checkTestPlanNotArchived(request.getId()); TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getId()); + String testPlanGroup = testPlan.getGroupId(); if (!ObjectUtils.allNull(request.getName(), request.getModuleId(), request.getTags(), request.getPlannedEndTime(), request.getPlannedStartTime(), request.getDescription(), request.getGroupId())) { TestPlan updateTestPlan = new TestPlan(); updateTestPlan.setId(request.getId()); @@ -364,6 +365,10 @@ public class TestPlanService extends TestPlanBaseUtilsService { testPlanConfig.setPassThreshold(request.getPassThreshold()); testPlanConfigMapper.updateByPrimaryKeySelective(testPlanConfig); } + + if (!StringUtils.equalsIgnoreCase(testPlanGroup, TestPlanConstants.TEST_PLAN_DEFAULT_GROUP_ID)) { + this.updateTestPlanGroupStatus(testPlanGroup); + } testPlanLogService.saveUpdateLog(testPlan, testPlanMapper.selectByPrimaryKey(request.getId()), testPlan.getProjectId(), userId, requestUrl, requestMethod); return testPlan; } @@ -824,6 +829,17 @@ public class TestPlanService extends TestPlanBaseUtilsService { } public void refreshTestPlanStatus(String testPlanId) { + TestPlan testPlan = testPlanMapper.selectByPrimaryKey(testPlanId); + if (StringUtils.equalsIgnoreCase(testPlan.getType(), TestPlanConstants.TEST_PLAN_TYPE_PLAN)) { + this.updateTestPlanStatus(testPlanId); + } else { + if (!StringUtils.equalsIgnoreCase(testPlan.getGroupId(), TestPlanConstants.TEST_PLAN_DEFAULT_GROUP_ID)) { + this.updateTestPlanGroupStatus(testPlan.getGroupId()); + } + } + } + + private void updateTestPlanStatus(String testPlanId) { Map caseExecResultCount = new HashMap<>(); Map beansOfType = applicationContext.getBeansOfType(TestPlanResourceService.class); beansOfType.forEach((k, v) -> {