代码提交
parent
e46640f603
commit
5ff59c6321
|
@ -9644,6 +9644,13 @@
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
|
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:IRaCIS.Application.Services.ReadingQuestionService.SynchronizeSystemCriterionQuestion(IRaCIS.Core.Application.Service.Reading.Dto.SynchronizeSystemCriterionInDto)">
|
||||||
|
<summary>
|
||||||
|
同步系统标准
|
||||||
|
</summary>
|
||||||
|
<param name="inDto"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:IRaCIS.Application.Services.ReadingQuestionService.SynchronizeCriterion(IRaCIS.Core.Application.Service.Reading.Dto.SynchronizeCriterionInDto)">
|
<member name="M:IRaCIS.Application.Services.ReadingQuestionService.SynchronizeCriterion(IRaCIS.Core.Application.Service.Reading.Dto.SynchronizeCriterionInDto)">
|
||||||
<summary>
|
<summary>
|
||||||
同步标准到项目新(2022-08-10)
|
同步标准到项目新(2022-08-10)
|
||||||
|
|
|
@ -565,6 +565,14 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
{
|
{
|
||||||
public Guid OriginalId { get; set; }
|
public Guid OriginalId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class SynchronizeSystemCriterionInDto
|
||||||
|
{
|
||||||
|
public Guid FromSystemCriterionId { get; set; }
|
||||||
|
public Guid ToSystemCriterionId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
public class SynchronizeCriterionInDto
|
public class SynchronizeCriterionInDto
|
||||||
{
|
{
|
||||||
[NotDefault]
|
[NotDefault]
|
||||||
|
|
|
@ -827,6 +827,94 @@ namespace IRaCIS.Application.Services
|
||||||
return ResponseOutput.Ok();
|
return ResponseOutput.Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 同步系统标准
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inDto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task SynchronizeSystemCriterionQuestion(SynchronizeSystemCriterionInDto inDto)
|
||||||
|
{
|
||||||
|
// 先找到项目系统问题Id和项目问题Id的对应关系
|
||||||
|
var questionRelation = _readingQuestionSystemRepository.Where(x => x.ReadingQuestionCriterionSystemId == inDto.FromSystemCriterionId).ToDictionary(
|
||||||
|
x => x.Id,
|
||||||
|
x => NewId.NextGuid()
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
var newQuestionList = await _readingQuestionSystemRepository.Where(x => x.ReadingQuestionCriterionSystemId == inDto.FromSystemCriterionId).ProjectTo<AddOrUpdateReadingQuestionSystemInDto>(_mapper.ConfigurationProvider).ToListAsync();
|
||||||
|
var copyNewQuestionList = newQuestionList.Clone();
|
||||||
|
|
||||||
|
var needAddDatas = new List<ReadingQuestionSystem>();
|
||||||
|
|
||||||
|
foreach (var x in newQuestionList)
|
||||||
|
{
|
||||||
|
var question = x.Clone();
|
||||||
|
question.ReadingQuestionCriterionSystemId = inDto.ToSystemCriterionId;
|
||||||
|
question.Id = questionRelation[question.Id.Value];
|
||||||
|
if (question.ParentId != null)
|
||||||
|
{
|
||||||
|
question.ParentId = questionRelation[question.ParentId ?? default(Guid)];
|
||||||
|
}
|
||||||
|
if (question.GroupId != null)
|
||||||
|
{
|
||||||
|
question.GroupId = questionRelation[question.GroupId ?? default(Guid)];
|
||||||
|
}
|
||||||
|
if (question.RelevanceId != null)
|
||||||
|
{
|
||||||
|
question.RelevanceId = questionRelation[question.RelevanceId ?? default(Guid)];
|
||||||
|
}
|
||||||
|
needAddDatas.Add(_mapper.Map<ReadingQuestionSystem>(question));
|
||||||
|
};
|
||||||
|
|
||||||
|
await _readingQuestionSystemRepository.BatchDeleteNoTrackingAsync(x => x.ReadingQuestionCriterionSystemId == inDto.ToSystemCriterionId);
|
||||||
|
await _readingQuestionSystemRepository.AddRangeAsync(needAddDatas);
|
||||||
|
|
||||||
|
|
||||||
|
var tableQuestionRelation = _readingTableQuestionSystemRepository.Where(x => x.SystemCriterionId == inDto.FromSystemCriterionId).ToDictionary(
|
||||||
|
x => x.Id,
|
||||||
|
x => NewId.NextGuid()
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
var newtableQuestion =await _readingTableQuestionSystemRepository.Where(x => x.SystemCriterionId == inDto.FromSystemCriterionId).ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
|
var copyNewTableQuestionList = newtableQuestion.Clone();
|
||||||
|
|
||||||
|
var needAddTableDatas = new List<ReadingTableQuestionSystem>();
|
||||||
|
foreach (var x in newtableQuestion)
|
||||||
|
{
|
||||||
|
var tableQuestion = x.Clone();
|
||||||
|
|
||||||
|
|
||||||
|
tableQuestion.SystemCriterionId = inDto.ToSystemCriterionId;
|
||||||
|
tableQuestion.Id = tableQuestionRelation[tableQuestion.Id];
|
||||||
|
tableQuestion.ReadingQuestionId = questionRelation[tableQuestion.ReadingQuestionId];
|
||||||
|
if (tableQuestion.ParentId != null)
|
||||||
|
{
|
||||||
|
tableQuestion.ParentId = tableQuestionRelation[tableQuestion.ParentId.Value];
|
||||||
|
}
|
||||||
|
if (tableQuestion.RelevanceId != null)
|
||||||
|
{
|
||||||
|
tableQuestion.RelevanceId = tableQuestionRelation[tableQuestion.RelevanceId.Value]; ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tableQuestion.DependParentId != null)
|
||||||
|
{
|
||||||
|
tableQuestion.DependParentId = tableQuestionRelation[tableQuestion.DependParentId.Value]; ;
|
||||||
|
}
|
||||||
|
|
||||||
|
needAddTableDatas.Add(tableQuestion);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
await _readingTableQuestionSystemRepository.BatchDeleteNoTrackingAsync(x => x.SystemCriterionId == inDto.ToSystemCriterionId);
|
||||||
|
await _readingTableQuestionSystemRepository.AddRangeAsync(needAddTableDatas);
|
||||||
|
await _readingTableQuestionSystemRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 同步标准到项目新(2022-08-10)
|
/// 同步标准到项目新(2022-08-10)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -169,10 +169,10 @@ namespace IRaCIS.Core.Application.Service
|
||||||
CreateMap<AddOrUpdateReadingQuestionCriterionSystemInDto, ReadingQuestionCriterionSystem>();
|
CreateMap<AddOrUpdateReadingQuestionCriterionSystemInDto, ReadingQuestionCriterionSystem>();
|
||||||
CreateMap<ReadingQuestionCriterionSystem, ReadingQuestionCriterionSystemView>()
|
CreateMap<ReadingQuestionCriterionSystem, ReadingQuestionCriterionSystemView>()
|
||||||
.ForMember(d => d.QuestionCount, u => u.MapFrom(s => s.ReadingQuestionSystemList.Count()));
|
.ForMember(d => d.QuestionCount, u => u.MapFrom(s => s.ReadingQuestionSystemList.Count()));
|
||||||
//.ForMember(d => d.IsEnable, u => u.MapFrom(s => s.Dictionary.IsEnable))
|
//.ForMember(d => d.IsEnable, u => u.MapFrom(s => s.Dictionary.IsEnable))
|
||||||
//.ForMember(d => d.ShowOrder, u => u.MapFrom(s => s.Dictionary.ShowOrder));
|
//.ForMember(d => d.ShowOrder, u => u.MapFrom(s => s.Dictionary.ShowOrder));
|
||||||
|
|
||||||
|
|
||||||
|
CreateMap<ReadingQuestionSystem, AddOrUpdateReadingQuestionSystemInDto>();
|
||||||
CreateMap<AddOrUpdateReadingQuestionSystemInDto, ReadingQuestionSystem>();
|
CreateMap<AddOrUpdateReadingQuestionSystemInDto, ReadingQuestionSystem>();
|
||||||
CreateMap<ReadingQuestionSystem, ReadingQuestionSystemView>()
|
CreateMap<ReadingQuestionSystem, ReadingQuestionSystemView>()
|
||||||
.ForMember(d => d.GroupName, u => u.MapFrom(s => s.GroupInfo==null?s.GroupName:s.GroupInfo.GroupName))
|
.ForMember(d => d.GroupName, u => u.MapFrom(s => s.GroupInfo==null?s.GroupName:s.GroupInfo.GroupName))
|
||||||
|
|
Loading…
Reference in New Issue