fix(用例评审): 编辑用例评审时出现的问题
This commit is contained in:
parent
ddf1e7a5bf
commit
d370a5bb7b
|
@ -4,14 +4,13 @@
|
|||
|
||||
<select id="list" resultType="io.metersphere.track.dto.TestCaseReviewDTO"
|
||||
parameterType="io.metersphere.track.request.testreview.QueryCaseReviewRequest">
|
||||
select distinct test_case_review.id, test_case_review.name, user.name as creator, test_case_review.status,
|
||||
select distinct test_case_review.id, test_case_review.name, test_case_review.creator, test_case_review.status,
|
||||
test_case_review.create_time, test_case_review.update_time, test_case_review.end_time,
|
||||
test_case_review.description
|
||||
from test_case_review, project, test_case_review_project, user
|
||||
from test_case_review, project, test_case_review_project
|
||||
<where>
|
||||
test_case_review.id = test_case_review_project.review_id
|
||||
and test_case_review_project.project_id = project.id
|
||||
and user.id = test_case_review.creator
|
||||
<if test="request.name != null">
|
||||
and test_case_review.name like CONCAT('%', #{request.name},'%')
|
||||
</if>
|
||||
|
|
|
@ -351,33 +351,36 @@ public class TestCaseReviewService {
|
|||
}
|
||||
});
|
||||
|
||||
testReviews.forEach(testReview -> {
|
||||
List<TestReviewCaseDTO> testCases = testCaseMap.get(testReview.getId());
|
||||
if (!CollectionUtils.isEmpty(testReviews)) {
|
||||
testReviews.forEach(testReview -> {
|
||||
List<TestReviewCaseDTO> testCases = testCaseMap.get(testReview.getId());
|
||||
|
||||
TestCaseReviewUsersExample testCaseReviewUsersExample = new TestCaseReviewUsersExample();
|
||||
testCaseReviewUsersExample.createCriteria().andReviewIdEqualTo(testReview.getId());
|
||||
List<String> userIds = testCaseReviewUsersMapper.selectByExample(testCaseReviewUsersExample)
|
||||
.stream().map(TestCaseReviewUsers::getUserId).collect(Collectors.toList());
|
||||
String reviewName = getReviewName(userIds);
|
||||
testReview.setReviewerName(reviewName);
|
||||
TestCaseReviewUsersExample testCaseReviewUsersExample = new TestCaseReviewUsersExample();
|
||||
testCaseReviewUsersExample.createCriteria().andReviewIdEqualTo(testReview.getId());
|
||||
List<String> userIds = testCaseReviewUsersMapper.selectByExample(testCaseReviewUsersExample)
|
||||
.stream().map(TestCaseReviewUsers::getUserId).collect(Collectors.toList());
|
||||
String reviewName = getReviewName(userIds);
|
||||
testReview.setReviewerName(reviewName);
|
||||
|
||||
User u = userMapper.selectByPrimaryKey(testReview.getCreator());
|
||||
testReview.setCreator(u.getName());
|
||||
|
||||
testReview.setReviewed(0);
|
||||
testReview.setTotal(0);
|
||||
if (testCases != null) {
|
||||
testReview.setTotal(testCases.size());
|
||||
testCases.forEach(testCase -> {
|
||||
if (!StringUtils.equals(testCase.getStatus(), TestPlanTestCaseStatus.Prepare.name())
|
||||
&& !StringUtils.equals(testCase.getStatus(), TestPlanTestCaseStatus.Underway.name())) {
|
||||
testReview.setReviewed(testReview.getReviewed() + 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
testReview.setTestRate(MathUtils.getPercentWithDecimal(testReview.getTotal() == 0 ? 0 : testReview.getReviewed() * 1.0 / testReview.getTotal()));
|
||||
});
|
||||
User u = userMapper.selectByPrimaryKey(testReview.getCreator());
|
||||
if (u != null) {
|
||||
testReview.setCreator(u.getName());
|
||||
}
|
||||
|
||||
testReview.setReviewed(0);
|
||||
testReview.setTotal(0);
|
||||
if (testCases != null) {
|
||||
testReview.setTotal(testCases.size());
|
||||
testCases.forEach(testCase -> {
|
||||
if (!StringUtils.equals(testCase.getStatus(), TestPlanTestCaseStatus.Prepare.name())
|
||||
&& !StringUtils.equals(testCase.getStatus(), TestPlanTestCaseStatus.Underway.name())) {
|
||||
testReview.setReviewed(testReview.getReviewed() + 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
testReview.setTestRate(MathUtils.getPercentWithDecimal(testReview.getTotal() == 0 ? 0 : testReview.getReviewed() * 1.0 / testReview.getTotal()));
|
||||
});
|
||||
}
|
||||
return testReviews;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue