Uat_Study
he 2022-09-29 14:06:55 +08:00
parent df1c894d0f
commit e8eee81af0
2 changed files with 45 additions and 27 deletions

View File

@ -660,6 +660,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public List<GlobalQuestionInfo> BeforeQuestionList { get; set; }
public List<GlobalQuestionInfo> AgreeOrNot { get; set; }
public List<GlobalQuestionInfo> AfterQuestionList { get; set; }
}

View File

@ -1158,11 +1158,25 @@ namespace IRaCIS.Application.Services
}).ToList();
List<GetGlobalQuestionType> questionTypes = new List<GetGlobalQuestionType>()
x.AgreeOrNot = new List<GlobalQuestionInfo>()
{
new GetGlobalQuestionType (){GlobalAnswerType=GlobalAnswerType.Reason,QuestionName="原因" },
new GetGlobalQuestionType (){GlobalAnswerType=GlobalAnswerType.AgreeOrNot,QuestionName="是否同意访视结果" },
new GlobalQuestionInfo()
{
Answer = globalReadingQuestion.Where(y => y.TaskId == x.VisitTaskId && y.GlobalAnswerType == GlobalAnswerType.AgreeOrNot).Select(x => x.Answer).FirstOrDefault() ?? String.Empty,
QuestionName = "是否同意访视结果",
Type = "input",
GlobalAnswerType=GlobalAnswerType.AgreeOrNot,
}
};
List<GetGlobalQuestionType> questionTypes = new List<GetGlobalQuestionType>()
{
new GetGlobalQuestionType (){GlobalAnswerType=GlobalAnswerType.UpdateType,QuestionName="评估更新类型" },
new GetGlobalQuestionType (){GlobalAnswerType=GlobalAnswerType.Reason,QuestionName="原因" },
//new GetGlobalQuestionType (){GlobalAnswerType=GlobalAnswerType.AgreeOrNot,QuestionName="是否同意访视结果" },
};
@ -2129,34 +2143,36 @@ namespace IRaCIS.Application.Services
throw new BusinessValidationFailedException($"相同问题传入两次!");
}
var questionInfo = await _readingQuestionTrialRepository.Where(x => x.Id == inDto.QuestionId).FirstNotNullAsync();
if (questionInfo.MaxQuestionCount!=null)
if (inDto.RowIndex % 1 == 0)
{
if (questionInfo.MaxQuestionCount <
(
(await _readingTableAnswerRowInfoRepository.Where(x => x.RowIndex != inDto.RowIndex && ((x.RowIndex % 1) == 0) && x.VisitTaskId == inDto.VisitTaskId
&& x.QuestionId == inDto.QuestionId
).CountAsync()) + 1))
var questionInfo = await _readingQuestionTrialRepository.Where(x => x.Id == inDto.QuestionId).FirstNotNullAsync();
if (questionInfo.MaxQuestionCount != null)
{
throw new BusinessValidationFailedException($"当前提交问题最大问题数为{questionInfo.MaxQuestionCount}");
if (questionInfo.MaxQuestionCount <
(
(await _readingTableAnswerRowInfoRepository.Where(x => x.RowIndex != inDto.RowIndex && ((x.RowIndex % 1) == 0) && x.VisitTaskId == inDto.VisitTaskId
&& x.QuestionId == inDto.QuestionId
).CountAsync()) + 1))
{
throw new BusinessValidationFailedException($"当前提交问题最大问题数为{questionInfo.MaxQuestionCount}");
}
}
var tableQuestions = await _readingTableQuestionTrialRepository.Where(x => tableQuestionIds.Contains(x.Id) && x.MaxRowCount != null && x.MaxRowCount != 0).ToListAsync();
foreach (var item in tableQuestions)
{
var answer = inDto.AnswerList.Where(x => x.TableQuestionId == item.Id).Select(x => x.Answer).FirstOrDefault();
var rowCount = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.TableQuestionId == item.Id && ((x.RowIndex % 1) == 0) && x.Answer == answer && x.RowIndex != inDto.RowIndex).CountAsync();
if (rowCount > item.MaxRowCount.Value - 1)
{
throw new BusinessValidationFailedException($"问题{item.QuestionName}最大相同问题数为{item.MaxRowCount.Value},当前已存在{rowCount}条!");
}
}
}
var tableQuestions = await _readingTableQuestionTrialRepository.Where(x => tableQuestionIds.Contains(x.Id) && x.MaxRowCount != null && x.MaxRowCount != 0).ToListAsync();
foreach (var item in tableQuestions)
{
var answer = inDto.AnswerList.Where(x => x.TableQuestionId == item.Id).Select(x => x.Answer).FirstOrDefault();
var rowCount = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.TableQuestionId == item.Id&& ((x.RowIndex % 1) == 0) && x.Answer == answer && x.RowIndex != inDto.RowIndex).CountAsync();
if (rowCount > item.MaxRowCount.Value - 1)
{
throw new BusinessValidationFailedException($"问题{item.QuestionName}最大相同问题数为{item.MaxRowCount.Value},当前已存在{rowCount}条!");
}
}
var isCurrentTaskAddList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId && x.TrialId == inDto.TrialId && x.RowIndex == inDto.RowIndex).Select(x => x.IsCurrentTaskAdd).ToListAsync();
bool isCurrentTaskAdd = true;
if (isCurrentTaskAddList.Count() > 0)