From ba72ce62ed1b8000289032ee87bcede930634990 Mon Sep 17 00:00:00 2001
From: he <10978375@qq.com>
Date: Wed, 10 Aug 2022 16:19:12 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../IRaCIS.Core.Application.xml | 7 +++
.../Service/Reading/ReadingQuestionService.cs | 59 +++++++++++++++++++
.../Service/Reading/_MapConfig.cs | 9 +++
.../TrialSiteUser/DTO/TrialConfigDTO.cs | 11 ++++
.../Service/TrialSiteUser/_MapConfig.cs | 4 +-
5 files changed, 89 insertions(+), 1 deletion(-)
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 85cf6ad3d..8b3f5abae 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -6305,6 +6305,13 @@
+
+
+ 同步标准到项目新(2022-08-10)
+
+
+
+
获取项目裁判信息
diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs
index 11dec7d86..b4a0949d6 100644
--- a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs
+++ b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs
@@ -97,6 +97,65 @@ namespace IRaCIS.Application.Services
return ResponseOutput.Ok(result);
}
+
+
+ ///
+ /// 同步标准到项目新(2022-08-10)
+ ///
+ ///
+ ///
+ public async Task SynchronizeCriterion(Guid trialCriterionId)
+ {
+ var trialCriterion = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == trialCriterionId).FirstNotNullAsync();
+ if(trialCriterion.ReadingQuestionCriterionSystemId!=null)
+ {
+
+ // 将系统里面的问题转为项目问题
+ var newTrialQuestionList = await _readingQuestionSystemRepository.Where(x => x.ReadingQuestionCriterionSystemId == trialCriterion.ReadingQuestionCriterionSystemId)
+ .ProjectTo(_mapper.ConfigurationProvider).ToListAsync();
+ newTrialQuestionList.ForEach(x => {
+ x.Id = NewId.NextGuid();
+ x.ReadingQuestionCriterionTrialId = trialCriterionId;
+ x.TrialId = trialCriterion.TrialId;
+ });
+ var copeNewQuestionList = newTrialQuestionList.Clone();
+ var trialQuestionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialCriterionId).ToListAsync();
+
+ var needAddDatas = new List();
+
+ foreach (var x in newTrialQuestionList)
+ {
+ var question = x.Clone();
+
+ var firstQuestion = trialQuestionList.Where(y => y.ReadingQuestionSystemId == x.ReadingQuestionSystemId).FirstOrDefault();
+ if (firstQuestion != null)
+ {
+ var systemData = _mapper.Map(x);
+ var newData = _mapper.Map(systemData, firstQuestion);
+ newData.Id = x.Id;
+ newData.ReadingQuestionSystemId= x.ReadingQuestionSystemId;
+ question = newData.Clone();
+ }
+
+ if (question.ParentId != null)
+ {
+ question.ParentId = copeNewQuestionList.Where(y =>x.ParentId==y.ReadingQuestionSystemId ).Select(y => y.Id).FirstOrDefault();
+ }
+ if (question.RelevanceId != null)
+ {
+ question.RelevanceId = copeNewQuestionList.Where(y => x.RelevanceId == y.ReadingQuestionSystemId).Select(y => y.Id).FirstOrDefault();
+ }
+
+ needAddDatas.Add(question);
+ };
+
+ await _readingQuestionTrialRepository.BatchDeleteNoTrackingAsync(x => x.ReadingQuestionCriterionTrialId == trialCriterionId);
+ await _readingQuestionTrialRepository.AddRangeAsync(needAddDatas);
+ await _readingQuestionTrialRepository.SaveChangesAsync();
+ }
+ }
+
+
///
/// 获取项目裁判信息
///
diff --git a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs
index 9681a287b..03965230a 100644
--- a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs
+++ b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs
@@ -54,6 +54,15 @@ namespace IRaCIS.Core.Application.Service
CreateMap();
+
+ CreateMap();
+
+ CreateMap()
+ .ForMember(d => d.ReadingQuestionSystemId, u => u.MapFrom(s => s.Id));
+
+
+
+
CreateMap();
CreateMap()
.ForMember(d => d.QuestionCount, u => u.MapFrom(s => s.ReadingQuestionSystemList.Count()))
diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs
index 307e4302f..d1de31ea8 100644
--- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs
+++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs
@@ -544,6 +544,17 @@ namespace IRaCIS.Core.Application.Contracts
///
public JudgeTypeEnum JudgeType { get; set; }
+
+ ///
+ /// 关联Value
+ ///
+ public string RelevanceValue { get; set; } = string.Empty;
+
+ public int? RelevanceShowOrder { get; set; }
+
+
+ public int? ParentQuestionShowOrder { get; set; }
+
}
public class TrialJudgeQuestion
diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs
index 300b4837d..43b138197 100644
--- a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs
+++ b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs
@@ -234,7 +234,9 @@ namespace IRaCIS.Core.Application.Service
CreateMap()
.ForMember(t => t.PageName, u => u.MapFrom(c => c.ReadingCriterionPage.PageName))
- .ForMember(t => t.ParentQuestionName, u => u.MapFrom(c => c.ParentReadingQuestionTrial.QuestionName));
+ .ForMember(t => t.ParentQuestionName, u => u.MapFrom(c => c.ParentReadingQuestionTrial.QuestionName))
+ .ForMember(t => t.RelevanceShowOrder, u => u.MapFrom(c => c.RelevanceReadingQuestionTrial.ShowOrder))
+ .ForMember(t => t.ParentQuestionShowOrder, u => u.MapFrom(c => c.ParentReadingQuestionTrial.ShowOrder));