From f84e8e00f8205b958769d6785bc68148f65c6e90 Mon Sep 17 00:00:00 2001 From: AgAngle <1323481023@qq.com> Date: Wed, 22 May 2024 10:57:13 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E5=AF=BC=E5=85=A5=E6=9B=B4=E6=96=B0=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=A7=A6=E5=8F=91=E9=87=8D=E6=96=B0=E6=8F=90=E5=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1037128 --user=陈建星 【测试跟踪】github#29396,【用例评审状态】本地用例“导入更新”后评审状态不会从“通过”变成“重新提审” https://www.tapd.cn/55049933/s/1518134 --- .../metersphere/service/TestCaseService.java | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java b/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java index 2e51fda764..c26b4159fa 100644 --- a/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java +++ b/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java @@ -494,18 +494,30 @@ public class TestCaseService { * 如果启用重新提审,并且前置条件或步骤发生变化,则触发重新提审 */ private void reReviewTestReviewTestCase(TestCaseWithBLOBs originCase, TestCaseWithBLOBs testCase) { - ProjectConfig config = baseProjectApplicationService.getProjectConfig(testCase.getProjectId()); - Boolean reReview = config.getReReview(); - if (BooleanUtils.isTrue(reReview) && originCase != null) { + boolean enAbleReReview = isEnAbleReReview(testCase.getProjectId()); + reReviewTestReviewTestCase(originCase, testCase, enAbleReReview); + } + + private void reReviewTestReviewTestCase(TestCaseWithBLOBs originCase, TestCaseWithBLOBs testCase, boolean enAbleReReview) { + if (enAbleReReview && originCase != null) { if (!StringUtils.equals(originCase.getPrerequisite(), testCase.getPrerequisite()) // 前置条件添加发生变化 - || !StringUtils.equals(originCase.getSteps(), testCase.getSteps()) // 步骤发生变化 - || !StringUtils.equals(originCase.getStepDescription(), testCase.getStepDescription()) - || !StringUtils.equals(originCase.getExpectedResult(), testCase.getExpectedResult())) { + || (!StringUtils.equals(originCase.getSteps(), testCase.getSteps()) + && !StringUtils.isAllBlank(originCase.getSteps(), testCase.getSteps())) // 这里null和空字符看作相等 + || (!StringUtils.equals(originCase.getStepDescription(), testCase.getStepDescription()) + && !StringUtils.isAllBlank(originCase.getStepDescription(), testCase.getStepDescription())) + || (!StringUtils.equals(originCase.getExpectedResult(), testCase.getExpectedResult()) + && !StringUtils.isAllBlank(originCase.getExpectedResult(), testCase.getExpectedResult()))) { testReviewTestCaseService.reReviewByCaseId(testCase.getId()); } } } + private boolean isEnAbleReReview(String projectId) { + ProjectConfig config = baseProjectApplicationService.getProjectConfig(projectId); + Boolean reReview = config.getReReview(); + return BooleanUtils.isTrue(reReview); + } + /** * 判断azure devops用例关联的需求是否发生变更,若发生变更,则重新建立需求与缺陷的关联关系 * @@ -1436,6 +1448,7 @@ public class TestCaseService { try { if (!testCases.isEmpty()) { + boolean enAbleReReview = isEnAbleReReview(request.getProjectId()); testCases.forEach(testCase -> { testCase.setUpdateTime(System.currentTimeMillis()); testCase.setNodeId(nodePathMap.get(testCase.getNodePath())); @@ -1447,6 +1460,7 @@ public class TestCaseService { } // 选了版本就更新到对应的版本 if (dbCase.getVersionId().equals(request.getVersionId())) { + reReviewTestReviewTestCase(testCaseMapper.selectByPrimaryKey(testCase.getId()), testCase, enAbleReReview); mapper.updateByPrimaryKeySelective(testCase); // 先删除