diff --git a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseReviewTestCaseMapper.java b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseReviewTestCaseMapper.java index 36b9edbef3..7fd45ec367 100644 --- a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseReviewTestCaseMapper.java +++ b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseReviewTestCaseMapper.java @@ -1,17 +1,17 @@ package io.metersphere.base.mapper.ext; -import io.metersphere.base.domain.TestCase; import io.metersphere.base.domain.TestCaseReviewTestCase; import org.apache.ibatis.annotations.Param; import java.util.List; public interface ExtTestCaseReviewTestCaseMapper { - List getTestCaseWithNodeInfo(@Param("reviewId") String reviewId); List getCaseStatusByReviewIds(@Param("reviewIds") List reviewIds); List selectForReviewChange(@Param("reviewId") String reviewId); List selectForReReview(@Param("caseId") String caseId); + + List selectForReviewerChange(@Param("reviewId") String reviewId); } diff --git a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseReviewTestCaseMapper.xml b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseReviewTestCaseMapper.xml index b2fe0ed791..b0dfcd3868 100644 --- a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseReviewTestCaseMapper.xml +++ b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseReviewTestCaseMapper.xml @@ -1,12 +1,6 @@ - select id, case_id, status, review_id from test_case_review_test_case - where review_id = #{reviewId} and (status = 'Pass' or status = 'UnPass' or status = 'Underway'); + where review_id = #{reviewId} and is_del = 0 and (status = 'Pass' or status = 'UnPass' or status = 'Underway'); + diff --git a/test-track/backend/src/main/java/io/metersphere/service/TestCaseReviewService.java b/test-track/backend/src/main/java/io/metersphere/service/TestCaseReviewService.java index b6869ac19b..d2e9ef8b64 100644 --- a/test-track/backend/src/main/java/io/metersphere/service/TestCaseReviewService.java +++ b/test-track/backend/src/main/java/io/metersphere/service/TestCaseReviewService.java @@ -149,6 +149,10 @@ public class TestCaseReviewService { return list; } + /** + * 计算评审的通过率和用例总数 + * @param list + */ private void calcReviewRate(List list) { List reviewIds = list.stream() .map(TestCaseReviewDTO::getId) @@ -338,7 +342,7 @@ public class TestCaseReviewService { testCaseReviewTestCaseUsersExample.createCriteria().andReviewIdEqualTo(id); testCaseReviewTestCaseUsersMapper.deleteByExample(testCaseReviewTestCaseUsersExample); - List testCaseReviewTestCases = testReviewTestCaseService.selectForReviewChange(id); + List testCaseReviewTestCases = testReviewTestCaseService.selectForReviewerChange(id); if (CollectionUtils.isNotEmpty(testCaseReviewTestCases)) { testCaseReviewTestCases.forEach(review -> { @@ -353,8 +357,11 @@ public class TestCaseReviewService { } for (TestCaseReviewTestCase reviewTestCase : testCaseReviewTestCases) { - // 重新计算评审状态 - testReviewTestCaseService.reCalcReviewCaseStatus(testCaseReview.getReviewPassRule(), reviewTestCase); + if (StringUtils.equalsAny(reviewTestCase.getStatus(), + TestReviewCaseStatus.Pass.name(), TestReviewCaseStatus.UnPass.name(), TestReviewCaseStatus.Underway.name())) { + // 重新计算评审状态 + testReviewTestCaseService.reCalcReviewCaseStatus(testCaseReview.getReviewPassRule(), reviewTestCase); + } } } } diff --git a/test-track/backend/src/main/java/io/metersphere/service/TestReviewTestCaseService.java b/test-track/backend/src/main/java/io/metersphere/service/TestReviewTestCaseService.java index 783cd7f496..6187ca8aaf 100644 --- a/test-track/backend/src/main/java/io/metersphere/service/TestReviewTestCaseService.java +++ b/test-track/backend/src/main/java/io/metersphere/service/TestReviewTestCaseService.java @@ -736,4 +736,8 @@ public class TestReviewTestCaseService { } } } + + public List selectForReviewerChange(String reviewId) { + return extTestCaseReviewTestCaseMapper.selectForReviewerChange(reviewId); + } }