Uat_Study
he 2022-08-18 09:30:57 +08:00
parent 681c0fd02e
commit 041efdb831
7 changed files with 88 additions and 6 deletions

View File

@ -96,6 +96,12 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public Guid? DependParentId { get; set; }
/// <summary>
/// 系统标准Id
/// </summary>
public Guid SystemCriterionId { get; set; }
}
@ -157,6 +163,10 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
}
public class ReadingTrialTableQuestionData : ReadingTableQuestionTrial
{
public Guid OriginalId { get; set; }
}
public class SynchronizeCriterionInDto
{
[NotDefault]

View File

@ -13,5 +13,7 @@ namespace IRaCIS.Core.Application.Contracts
{
Task<IResponseOutput> SetSystemCriterionDisable(Guid dictionaryId, Guid? parentId);
Task SynchronizeCriterion(SynchronizeCriterionInDto inDto);
}
}

View File

@ -316,6 +316,9 @@ namespace IRaCIS.Application.Services
question.RelevanceId = copeNewQuestionList.Where(y => x.RelevanceId == y.ReadingQuestionSystemId).Select(y => y.Id).FirstOrDefault();
}
needAddDatas.Add(question);
};
@ -327,7 +330,50 @@ namespace IRaCIS.Application.Services
});
//var trial
#region 表格问题
var newTrialTableQuestionList = await _readingTableQuestionSystemRepository.Where(x => x.SystemCriterionId == trialCriterion.ReadingQuestionCriterionSystemId)
.ProjectTo<ReadingTrialTableQuestionData>(_mapper.ConfigurationProvider).ToListAsync();
var copenewTrialTableQuestionList = newTrialTableQuestionList.Clone();
var needAddTableDatas = new List<ReadingTrialTableQuestionData>();
foreach (var x in newTrialTableQuestionList)
{
var tableQuestion = x.Clone();
tableQuestion.TrialId = inDto.TrialId;
tableQuestion.TrialCriterionId = trialCriterion.Id;
tableQuestion.Id = NewId.NextGuid();
if (tableQuestion.ParentId != null)
{
tableQuestion.ParentId = copenewTrialTableQuestionList.Where(y => x.ParentId == y.OriginalId).Select(y => y.Id).FirstOrDefault();
}
if (tableQuestion.RelevanceId != null)
{
tableQuestion.RelevanceId = copenewTrialTableQuestionList.Where(y => x.RelevanceId == y.OriginalId).Select(y => y.Id).FirstOrDefault();
}
if (tableQuestion.DependParentId != null)
{
tableQuestion.DependParentId = copenewTrialTableQuestionList.Where(y => x.DependParentId == y.OriginalId).Select(y => y.Id).FirstOrDefault();
}
needAddTableDatas.Add(tableQuestion);
}
await _readingTableQuestionTrialRepository.BatchDeleteNoTrackingAsync(x => x.TrialCriterionId == trialCriterion.Id);
await _readingTableQuestionTrialRepository.AddRangeAsync(needAddTableDatas);
#endregion
await _readingQuestionTrialRepository.SaveChangesAsync();
}
}
@ -781,10 +827,12 @@ namespace IRaCIS.Application.Services
Id = NewId.NextGuid(),
};
List<ReadingQuestionSystem> systemQuestionList = x.ReadingQuestionSystemList.Clone();
List<ReadingQuestionTrial> readingQuestionTrialList = new List<ReadingQuestionTrial>();
SetChildParentQuestion(criterion.Id, trialId, systemQuestionList, readingQuestionTrialList);
// 同步问题暂时注释
//List<ReadingQuestionTrial> readingQuestionTrialList = new List<ReadingQuestionTrial>();
//SetChildParentQuestion(criterion.Id, trialId, systemQuestionList, readingQuestionTrialList);
needAddCriterionList.Add(criterion);
needAddQuestionList.AddRange(readingQuestionTrialList);
//needAddQuestionList.AddRange(readingQuestionTrialList);
});
await _readingQuestionCriterionTrialRepository.AddRangeAsync(needAddCriterionList);
await _readingQuestionTrialRepository.AddRangeAsync(needAddQuestionList);

View File

@ -63,6 +63,9 @@ namespace IRaCIS.Core.Application.Service
.ForMember(d => d.ReadingQuestionSystemId, u => u.MapFrom(s => s.Id));
CreateMap<ReadingTableQuestionTrial, ReadingTrialTableQuestionData>()
.ForMember(d => d.OriginalId, u => u.MapFrom(s => s.Id));
CreateMap<AddOrUpdateReadingQuestionCriterionSystemInDto, ReadingQuestionCriterionSystem>();

View File

@ -244,11 +244,19 @@ namespace IRaCIS.Core.Application
if (trialCriterion.SynchronizeOriginalTime == null && trialCriterion.ReadingQuestionCriterionSystemId != null)
{
// 同步器官
await _iOrganInfoService.SynchronizeSystemOrganToTrial(new SynchronizeSystemOrganToTrialInDto()
{
TrialId = inDto.TrialId,
SystemCriterionId = trialCriterion.ReadingQuestionCriterionSystemId
});
// 同步问题
await iReadingQuestionService.SynchronizeCriterion(new SynchronizeCriterionInDto()
{
TrialId = inDto.TrialId
});
}
};

View File

@ -122,6 +122,11 @@ namespace IRaCIS.Core.Domain.Models
/// </summary>
public TableQuestionType TableQuestionType { get; set; }
/// <summary>
/// 系统标准Id
/// </summary>
public Guid SystemCriterionId { get; set; }
}

View File

@ -125,6 +125,12 @@ namespace IRaCIS.Core.Domain.Models
/// </summary>
public int IsDepend { get; set; }
/// <summary>
/// 项目标准Id
/// </summary>
public Guid TrialCriterionId { get; set; }
}