修改一版
parent
8f228dc679
commit
319cc7faf3
|
@ -1867,6 +1867,41 @@
|
|||
问题名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.TrialQuestion.ParentId">
|
||||
<summary>
|
||||
父问题ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.TrialQuestion.ReadingQuestionCriterionTrialId">
|
||||
<summary>
|
||||
项目标准Id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.TrialQuestion.ReadingQuestionSystemId">
|
||||
<summary>
|
||||
系统问题ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.TrialQuestion.SystemParentId">
|
||||
<summary>
|
||||
系统标准的ParentId
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.TrialQuestion.AnswerGroup">
|
||||
<summary>
|
||||
答案分组
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.TrialQuestion.AnswerCombination">
|
||||
<summary>
|
||||
答案组合
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.TrialQuestion.JudgeType">
|
||||
<summary>
|
||||
裁判类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.AddOrUpdateReadingQuestionSystemInDto.GroupName">
|
||||
<summary>
|
||||
分组
|
||||
|
@ -4624,7 +4659,14 @@
|
|||
</member>
|
||||
<member name="M:IRaCIS.Application.Services.ReadingQuestionService.UpdateTrialCriterion(System.Guid)">
|
||||
<summary>
|
||||
更改项目标准
|
||||
更改项目标准(老)
|
||||
</summary>
|
||||
<param name="systemCriterionId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Application.Services.ReadingQuestionService.SynchronizeSystemCriterion(System.Guid)">
|
||||
<summary>
|
||||
更改项目标准(新)
|
||||
</summary>
|
||||
<param name="systemCriterionId"></param>
|
||||
<returns></returns>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
|
@ -348,6 +349,45 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
public string QuestionName { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class TrialQuestion
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 父问题ID
|
||||
/// </summary>
|
||||
public Guid? ParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 项目标准Id
|
||||
/// </summary>
|
||||
public Guid ReadingQuestionCriterionTrialId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 系统问题ID
|
||||
/// </summary>
|
||||
public Guid? ReadingQuestionSystemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 系统标准的ParentId
|
||||
/// </summary>
|
||||
public Guid? SystemParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 答案分组
|
||||
/// </summary>
|
||||
public string AnswerGroup { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 答案组合
|
||||
/// </summary>
|
||||
public string AnswerCombination { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 裁判类型
|
||||
/// </summary>
|
||||
public JudgeTypeEnum JudgeType { get; set; }
|
||||
}
|
||||
public class AddOrUpdateReadingQuestionSystemInDto
|
||||
{
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
if (inDto.IsCompleteConfig)
|
||||
{
|
||||
await UpdateTrialCriterion(inDto.Id);
|
||||
await SynchronizeSystemCriterion(inDto.Id);
|
||||
}else
|
||||
{
|
||||
await _readingQuestionCriterionTrialRepository.BatchUpdateNoTrackingAsync(x=>x.ReadingQuestionCriterionSystemId== inDto.Id, x => new ReadingQuestionCriterionTrial()
|
||||
|
@ -174,7 +174,7 @@ namespace IRaCIS.Application.Services
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更改项目标准
|
||||
/// 更改项目标准(老)
|
||||
/// </summary>
|
||||
/// <param name="systemCriterionId"></param>
|
||||
/// <returns></returns>
|
||||
|
@ -201,6 +201,105 @@ namespace IRaCIS.Application.Services
|
|||
await _readingQuestionTrialRepository.AddRangeAsync(needAddQuestionList);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 更改项目标准(新)
|
||||
/// </summary>
|
||||
/// <param name="systemCriterionId"></param>
|
||||
/// <returns></returns>
|
||||
private async Task SynchronizeSystemCriterion(Guid systemCriterionId)
|
||||
{
|
||||
var systemCriterion = await _readingQuestionCriterionSystemRepository.FirstOrDefaultAsync(x=>x.Id== systemCriterionId);
|
||||
|
||||
var trialCriterionList = await _readingQuestionCriterionTrialRepository.Where(x => x.ReadingQuestionCriterionSystemId == systemCriterionId).Select(x => new {
|
||||
x.Id,
|
||||
x.TrialId,
|
||||
}).ToListAsync();
|
||||
|
||||
var trialCriterionIds= trialCriterionList.Select(x => x.Id).ToList();
|
||||
var systemQuestionList = await _readingQuestionSystemRepository.Where(x => x.ReadingQuestionCriterionSystemId == systemCriterionId).ToListAsync();
|
||||
var trialQuestions = await _readingQuestionTrialRepository.Where(x => trialCriterionIds.Contains(x.ReadingQuestionCriterionTrialId)).Select(x => new TrialQuestion
|
||||
{
|
||||
AnswerCombination = x.AnswerCombination,
|
||||
AnswerGroup = x.AnswerGroup,
|
||||
Id = x.Id,
|
||||
JudgeType = x.JudgeType,
|
||||
ParentId = x.ParentId,
|
||||
ReadingQuestionCriterionTrialId = x.ReadingQuestionCriterionTrialId,
|
||||
ReadingQuestionSystemId = x.ReadingQuestionSystemId,
|
||||
SystemParentId = x.SystemParentId
|
||||
}).ToListAsync();
|
||||
|
||||
List<ReadingQuestionTrial> trialQuestionList = new List<ReadingQuestionTrial>();
|
||||
foreach (var item in trialCriterionList)
|
||||
{
|
||||
|
||||
var thistrialQuestions = trialQuestions.Where(x => x.ReadingQuestionCriterionTrialId == item.Id).ToList();
|
||||
|
||||
var query = systemQuestionList.GroupJoin(thistrialQuestions, a => a.Id, b => b.ReadingQuestionSystemId, (a, b) => new
|
||||
{
|
||||
a,
|
||||
trialQuestion = b
|
||||
}).SelectMany(a => a.trialQuestion, (m, n) => new ReadingQuestionTrial
|
||||
{
|
||||
Id=n.Id,
|
||||
|
||||
});
|
||||
var needAddQuestionList = systemQuestionList.GroupJoin(thistrialQuestions, a => a.Id, b => b.ReadingQuestionSystemId, (x, y) => new { system = x, trial = y })
|
||||
.SelectMany(
|
||||
a => a.trial.DefaultIfEmpty(),
|
||||
(c,d) => new ReadingQuestionTrial
|
||||
{
|
||||
Id=(c.trial.FirstOrDefault()?.Id)??NewId.NextGuid(),
|
||||
ShowOrder=c.system.ShowOrder,
|
||||
SystemParentId=c.system.ParentId,
|
||||
ReadingQuestionSystemId=c.system.Id,
|
||||
AnswerCombination = (c.trial.FirstOrDefault()?.AnswerCombination)??string.Empty,
|
||||
AnswerGroup= (c.trial.FirstOrDefault()?.AnswerGroup) ?? string.Empty,
|
||||
GroupName=c.system.GroupName,
|
||||
IsEnable=c.system.IsEnable,
|
||||
IsJudgeQuestion=c.system.IsJudgeQuestion,
|
||||
IsRequired=c.system.IsRequired,
|
||||
JudgeType = (c.trial.FirstOrDefault()?.JudgeType)??JudgeTypeEnum.None,
|
||||
ParentId = c.trial.FirstOrDefault()?.ParentId,
|
||||
ParentTriggerValue=c.system.ParentTriggerValue,
|
||||
QuestionName=c.system.QuestionName,
|
||||
ReadingQuestionCriterionTrialId = item.Id,
|
||||
Remark=c.system.Remark,
|
||||
TrialId=item.TrialId,
|
||||
Type=c.system.Type,
|
||||
TypeValue=c.system.TypeValue,
|
||||
}).ToList();
|
||||
var copydata = needAddQuestionList.Clone();
|
||||
needAddQuestionList.ForEach(x =>
|
||||
{
|
||||
if (x.SystemParentId == null)
|
||||
{
|
||||
x.ParentId = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
x.ParentId = copydata.FirstOrDefault(y => y.ReadingQuestionSystemId == x.SystemParentId).Id;
|
||||
}
|
||||
});
|
||||
|
||||
trialQuestionList.AddRange(needAddQuestionList);
|
||||
}
|
||||
await _readingQuestionTrialRepository.BatchDeleteNoTrackingAsync(x => trialCriterionIds.Contains(x.ReadingQuestionCriterionTrialId));
|
||||
await _readingQuestionCriterionTrialRepository.BatchUpdateNoTrackingAsync(x => trialCriterionIds.Contains(x.Id), x => new ReadingQuestionCriterionTrial()
|
||||
{
|
||||
IsEnable = systemCriterion.IsEnable,
|
||||
CriterionName = systemCriterion.CriterionName,
|
||||
ShowOrder = systemCriterion.ShowOrder,
|
||||
IsCompleteConfig = systemCriterion.IsCompleteConfig,
|
||||
|
||||
});
|
||||
|
||||
await _readingQuestionTrialRepository.AddRangeAsync(trialQuestionList);
|
||||
await _readingQuestionTrialRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加系统qc问题标准
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue