diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/provider/CaseReviewCaseProvider.java b/backend/services/case-management/src/main/java/io/metersphere/functional/provider/CaseReviewCaseProvider.java index bf739695f7..7859fcc9bf 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/provider/CaseReviewCaseProvider.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/provider/CaseReviewCaseProvider.java @@ -328,11 +328,19 @@ public class CaseReviewCaseProvider implements BaseCaseProvider { List reviewIds = deletedCaseReviewFunctionalCases.stream().map(CaseReviewFunctionalCase::getReviewId).distinct().toList(); //获取与选中case无关的关联关系 List caseReviewFunctionalCases = extCaseReviewFunctionalCaseMapper.getListExcludes(reviewIds, caseIdList, false); - Map> reviewIdMap = caseReviewFunctionalCases.stream().collect(Collectors.groupingBy(CaseReviewFunctionalCase::getReviewId)); - reviewIdMap.forEach((reviewId, caseReviewFunctionalCaseList) -> { - Map caseCountMap = getCaseCountMap(caseReviewFunctionalCaseList); - updateCaseReview(reviewId, caseReviewFunctionalCaseList.size(), caseCountMap, paramMap.get(CaseEvent.Param.USER_ID).toString()); - }); + if (CollectionUtils.isEmpty(caseReviewFunctionalCases)) { + for (String reviewId : reviewIds) { + Map caseCountMap = getCaseCountMap(caseReviewFunctionalCases); + updateCaseReview(reviewId, caseReviewFunctionalCases.size(), caseCountMap, paramMap.get(CaseEvent.Param.USER_ID).toString()); + } + } else { + Map> reviewIdMap = caseReviewFunctionalCases.stream().collect(Collectors.groupingBy(CaseReviewFunctionalCase::getReviewId)); + reviewIdMap.forEach((reviewId, caseReviewFunctionalCaseList) -> { + Map caseCountMap = getCaseCountMap(caseReviewFunctionalCaseList); + updateCaseReview(reviewId, caseReviewFunctionalCaseList.size(), caseCountMap, paramMap.get(CaseEvent.Param.USER_ID).toString()); + }); + } + return false; }