修改
This commit is contained in:
@@ -917,6 +917,15 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
/// </summary>
|
||||
public Guid VisitTaskId { get; set; }
|
||||
}
|
||||
|
||||
public class TableQuestionData
|
||||
{
|
||||
public Guid TableQuestionId { get; set; }
|
||||
|
||||
public int Count { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class SubmitTableQuestionInDto
|
||||
{
|
||||
public Guid QuestionId { get; set; }
|
||||
|
||||
@@ -1887,7 +1887,21 @@ namespace IRaCIS.Application.Services
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> SubmitTableQuestion(SubmitTableQuestionInDto inDto)
|
||||
{
|
||||
|
||||
|
||||
var tableQuestionIds = inDto.AnswerList.Select(x => x.TableQuestionId).ToList();
|
||||
|
||||
var tableQuestionIdGroup = tableQuestionIds.GroupBy(x => new { TableQuestionId = x }).Select(x => new TableQuestionData
|
||||
{
|
||||
TableQuestionId = x.Key.TableQuestionId,
|
||||
Count = x.Count()
|
||||
}).ToList();
|
||||
|
||||
if (tableQuestionIdGroup.Any(x => x.Count > 1))
|
||||
{
|
||||
throw new BusinessValidationFailedException($"相同问题传入两次!");
|
||||
}
|
||||
|
||||
var questions = await _readingTableQuestionTrialRepository.Where(x => tableQuestionIds.Contains(x.Id) && x.MaxRowCount != null && x.MaxRowCount != 0).ToListAsync();
|
||||
|
||||
foreach (var item in questions)
|
||||
|
||||
Reference in New Issue
Block a user