fix(测试跟踪): 修改评审人,重新提审的用例不显示评审人

--bug=1023021 --user=陈建星 【测试跟踪】用例评审编辑弹框中修改评审人后,重新提审状态的用例不显示评审人 https://www.tapd.cn/55049933/s/1335433
This commit is contained in:
chenjianxing 2023-02-15 11:45:54 +08:00 committed by jianxing
parent 2da4a32952
commit 5e7dea02bf
4 changed files with 23 additions and 13 deletions

View File

@ -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<TestCase> getTestCaseWithNodeInfo(@Param("reviewId") String reviewId);
List<TestCaseReviewTestCase> getCaseStatusByReviewIds(@Param("reviewIds") List<String> reviewIds);
List<TestCaseReviewTestCase> selectForReviewChange(@Param("reviewId") String reviewId);
List<TestCaseReviewTestCase> selectForReReview(@Param("caseId") String caseId);
List<TestCaseReviewTestCase> selectForReviewerChange(@Param("reviewId") String reviewId);
}

View File

@ -1,12 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.ext.ExtTestCaseReviewTestCaseMapper">
<select id="getTestCaseWithNodeInfo" resultType="io.metersphere.base.domain.TestCase">
select DISTINCT tc.project_id, tc.node_id
from test_case_review_test_case tcrtc
join test_case tc on tcrtc.case_id = tc.id
where tcrtc.review_id = #{reviewId}
</select>
<select id="getCaseStatusByReviewIds" resultType="io.metersphere.base.domain.TestCaseReviewTestCase">
select tcrtc.id, tcrtc.status, tcrtc.review_id
from test_case_review_test_case tcrtc
@ -18,11 +12,16 @@
<select id="selectForReviewChange" resultType="io.metersphere.base.domain.TestCaseReviewTestCase">
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');
</select>
<select id="selectForReReview" resultType="io.metersphere.base.domain.TestCaseReviewTestCase">
select id, case_id, status, review_id
from test_case_review_test_case
where case_id = #{caseId} and (status = 'Pass' or status = 'UnPass' or status = 'Underway');
where case_id = #{caseId} and is_del = 0 (status = 'Pass' or status = 'UnPass' or status = 'Underway');
</select>
<select id="selectForReviewerChange" resultType="io.metersphere.base.domain.TestCaseReviewTestCase">
select id, case_id, status, review_id
from test_case_review_test_case
where review_id = #{reviewId} and is_del = 0;
</select>
</mapper>

View File

@ -149,6 +149,10 @@ public class TestCaseReviewService {
return list;
}
/**
* 计算评审的通过率和用例总数
* @param list
*/
private void calcReviewRate(List<TestCaseReviewDTO> list) {
List<String> reviewIds = list.stream()
.map(TestCaseReviewDTO::getId)
@ -338,7 +342,7 @@ public class TestCaseReviewService {
testCaseReviewTestCaseUsersExample.createCriteria().andReviewIdEqualTo(id);
testCaseReviewTestCaseUsersMapper.deleteByExample(testCaseReviewTestCaseUsersExample);
List<TestCaseReviewTestCase> testCaseReviewTestCases = testReviewTestCaseService.selectForReviewChange(id);
List<TestCaseReviewTestCase> 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);
}
}
}
}

View File

@ -736,4 +736,8 @@ public class TestReviewTestCaseService {
}
}
}
public List<TestCaseReviewTestCase> selectForReviewerChange(String reviewId) {
return extTestCaseReviewTestCaseMapper.selectForReviewerChange(reviewId);
}
}