fix_用例评审_关注人报错 --bug=1007510 --user=王孝刚 【测试跟踪】编辑用例评审报错 https://www.tapd.cn/55049933/s/1059880

This commit is contained in:
wxg0103 2021-10-27 16:07:42 +08:00 committed by 刘瑞斌
parent 23a0745cb4
commit 9242700b93
2 changed files with 23 additions and 20 deletions

View File

@ -266,13 +266,12 @@ public class TestCaseReviewService {
private void editCaseRevieweFollow(SaveTestCaseReviewRequest testCaseReview) {
// 要更新的follows
List<String> follows = testCaseReview.getFollowIds();
if (CollectionUtils.isNotEmpty(follows)) {
String id = testCaseReview.getId();
TestCaseReviewFollowExample testCaseReviewfollowExample = new TestCaseReviewFollowExample();
testCaseReviewfollowExample.createCriteria().andReviewIdEqualTo(id);
List<TestCaseReviewFollow> testCaseReviewFollows = testCaseReviewFollowMapper.selectByExample(testCaseReviewfollowExample);
List<String> dbReviewIds = testCaseReviewFollows.stream().map(TestCaseReviewFollow::getFollowId).collect(Collectors.toList());
follows.forEach(followId -> {
if (!dbReviewIds.contains(followId)) {
TestCaseReviewFollow caseReviewFollow = new TestCaseReviewFollow();
@ -281,10 +280,15 @@ public class TestCaseReviewService {
testCaseReviewFollowMapper.insertSelective(caseReviewFollow);
}
});
TestCaseReviewFollowExample example = new TestCaseReviewFollowExample();
example.createCriteria().andReviewIdEqualTo(id).andFollowIdNotIn(follows);
testCaseReviewFollowMapper.deleteByExample(example);
}else {
TestCaseReviewFollowExample example = new TestCaseReviewFollowExample();
example.createCriteria().andReviewIdEqualTo(testCaseReview.getId());
testCaseReviewFollowMapper.deleteByExample(example);
}
}
private void checkCaseReviewExist(TestCaseReview testCaseReview) {

View File

@ -255,7 +255,6 @@ public class TestPlanService {
}
}
List<String> follows = request.getFollows();
if (!CollectionUtils.isEmpty(follows)) {
if (StringUtils.isNotBlank(request.getId())) {
testPlanFollowService.deleteTestPlanFollowByPlanId(request.getId());
for (String follow : follows) {
@ -265,7 +264,7 @@ public class TestPlanService {
testPlanFollowService.insert(testPlanFollow);
}
}
}
return this.editTestPlan(request);
}