diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs
index 71cc026e0..761d0e58e 100644
--- a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs
+++ b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs
@@ -445,8 +445,14 @@ namespace IRaCIS.Application.Services
///
///
///
- private void VerifyCalculateRelation(List relationList,Guid QuestionId,Guid originalId)
+ private void VerifyCalculateRelation(List relationList,Guid QuestionId,Guid originalId,int count=1)
{
+ // 防止有脏数据 循环验证 最多10000次
+ if (count >= 10000)
+ {
+ throw new BusinessValidationFailedException("计算依赖循环了!");
+ }
+
var relation = relationList.Where(x=>x.CalculateQuestionList.Any(y=>y.QuestionId== QuestionId||y.TableQuestionId==QuestionId)).ToList();
if (relation.Select(x => x.QuestionId).ToList().Contains(originalId))
@@ -460,7 +466,7 @@ namespace IRaCIS.Application.Services
relation.ForEach(x =>
{
- VerifyCalculateRelation(relationList, x.QuestionId, originalId);
+ VerifyCalculateRelation(relationList, x.QuestionId, originalId,count++);
});
}