Uat_Study
parent
a39052d750
commit
0957d0b1a0
|
@ -7,6 +7,37 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace IRaCIS.Core.Application.Contracts
|
namespace IRaCIS.Core.Application.Contracts
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class QCQuestionViewInDto
|
||||||
|
{
|
||||||
|
public Guid? TrialId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class QCQuestionView
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public string QuestionName { get; set; } = String.Empty;
|
||||||
|
public bool IsRequired { get; set; }
|
||||||
|
public bool IsEnable { get; set; }
|
||||||
|
public string Type { get; set; } = String.Empty;
|
||||||
|
public string ParentTriggerValue { get; set; }
|
||||||
|
public Guid? ParentId { get; set; }
|
||||||
|
public string TypeValue { get; set; } = String.Empty;
|
||||||
|
public int ShowOrder { get; set; }
|
||||||
|
|
||||||
|
public int? ParentShowOrder { get; set; }
|
||||||
|
public Guid CreateUserId { get; set; }
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
public DateTime UpdateTime { get; set; }
|
||||||
|
public Guid UpdateUserId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public List<QCQuestionView> ChildList=new List<QCQuestionView>();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary> QCQuestionConfigureView 列表视图模型 </summary>
|
/// <summary> QCQuestionConfigureView 列表视图模型 </summary>
|
||||||
public class QCQuestionConfigureView
|
public class QCQuestionConfigureView
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,13 +16,15 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
public class QCQuestionConfigureService : BaseService, IQCQuestionService
|
public class QCQuestionConfigureService : BaseService, IQCQuestionService
|
||||||
{
|
{
|
||||||
private readonly IRepository<QCQuestion> _qcQuestionRepository;
|
private readonly IRepository<QCQuestion> _qcQuestionRepository;
|
||||||
|
private readonly IRepository<TrialQCQuestion> _trialQCQuestionRepository;
|
||||||
|
|
||||||
public QCQuestionConfigureService(IRepository<QCQuestion> qcQuestionRepository)
|
public QCQuestionConfigureService(IRepository<QCQuestion> qcQuestionRepository,
|
||||||
|
IRepository<TrialQCQuestion> trialQCQuestionRepository
|
||||||
|
|
||||||
|
)
|
||||||
{
|
{
|
||||||
_qcQuestionRepository = qcQuestionRepository;
|
_qcQuestionRepository = qcQuestionRepository;
|
||||||
|
this._trialQCQuestionRepository = trialQCQuestionRepository;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,7 +41,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
var initList = await _qcQuestionRepository
|
var initList = await _qcQuestionRepository
|
||||||
.WhereIf(trialQCQuestionFilterSelect.TypeArray.Count() > 0, t => trialQCQuestionFilterSelect.TypeArray.Contains(t.Type))
|
.WhereIf(trialQCQuestionFilterSelect.TypeArray.Count() > 0, t => trialQCQuestionFilterSelect.TypeArray.Contains(t.Type))
|
||||||
|
.WhereIf(trialQCQuestionFilterSelect.Id != null, t => t.Id != trialQCQuestionFilterSelect.Id && t.ParentId != trialQCQuestionFilterSelect.Id)
|
||||||
.OrderBy(t => t.ShowOrder).Select(x => new TrialQCQuestionSelect() {
|
.OrderBy(t => t.ShowOrder).Select(x => new TrialQCQuestionSelect() {
|
||||||
ShowOrder = x.ShowOrder,
|
ShowOrder = x.ShowOrder,
|
||||||
Id = x.Id,
|
Id = x.Id,
|
||||||
|
@ -118,5 +120,53 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取问题预览
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inDto"></param>
|
||||||
|
/// <remarks>
|
||||||
|
/// 传TrialId为获取项目的
|
||||||
|
/// 不传为获取系统的
|
||||||
|
/// </remarks>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<List<QCQuestionView>> GetQuestionView(QCQuestionViewInDto inDto)
|
||||||
|
{
|
||||||
|
var question = new List<QCQuestionView>();
|
||||||
|
if (inDto.TrialId== null)
|
||||||
|
{
|
||||||
|
question = await _trialQCQuestionRepository.Where(x => x.TrialId == inDto.TrialId).OrderBy(x => x.ShowOrder).ProjectTo<QCQuestionView>(_mapper.ConfigurationProvider).ToListAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
question=await _qcQuestionRepository.AsQueryable().OrderBy(x => x.ShowOrder).ProjectTo<QCQuestionView>(_mapper.ConfigurationProvider).ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var result = question.Where(x => x.ParentId == null).ToList();
|
||||||
|
result.ForEach(x => {
|
||||||
|
GetQuestionChild(x, question);
|
||||||
|
});
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void GetQuestionChild(QCQuestionView parent, List<QCQuestionView> dataList)
|
||||||
|
{
|
||||||
|
parent.ChildList = dataList.Where(x => x.ParentId == parent.Id).ToList();
|
||||||
|
|
||||||
|
if (parent.ChildList.Count != 0)
|
||||||
|
{
|
||||||
|
parent.ChildList.ForEach(x =>
|
||||||
|
{
|
||||||
|
GetQuestionChild(x, dataList);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
var initList = await _trialQcQuestionRepository.Where(t => t.TrialId == trialQCQuestionFilterSelect.TrialId)
|
var initList = await _trialQcQuestionRepository.Where(t => t.TrialId == trialQCQuestionFilterSelect.TrialId)
|
||||||
.WhereIf(trialQCQuestionFilterSelect.TypeArray.Count() > 0, t => trialQCQuestionFilterSelect.TypeArray.Contains(t.Type))
|
.WhereIf(trialQCQuestionFilterSelect.TypeArray.Count() > 0, t => trialQCQuestionFilterSelect.TypeArray.Contains(t.Type))
|
||||||
//.WhereIf(trialQCQuestionFilterSelect.Id != null, t => t.Id != trialQCQuestionFilterSelect.Id /*&& t.ParentId != trialQCQuestionFilterSelect.Id*/)
|
.WhereIf(trialQCQuestionFilterSelect.Id != null, t => t.Id != trialQCQuestionFilterSelect.Id && t.ParentId != trialQCQuestionFilterSelect.Id)
|
||||||
.OrderBy(t => t.ShowOrder).ProjectTo<TrialQCQuestionSelect>(_mapper.ConfigurationProvider).ToListAsync();
|
.OrderBy(t => t.ShowOrder).ProjectTo<TrialQCQuestionSelect>(_mapper.ConfigurationProvider).ToListAsync();
|
||||||
|
|
||||||
//父亲的序号肯定要比自己小
|
//父亲的序号肯定要比自己小
|
||||||
|
|
|
@ -61,6 +61,9 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
CreateMap<TrialQCQuestion, TrialQCQuestionSelect>();
|
CreateMap<TrialQCQuestion, TrialQCQuestionSelect>();
|
||||||
|
|
||||||
|
CreateMap<TrialQCQuestion, QCQuestionView>();
|
||||||
|
CreateMap<QCQuestion, QCQuestionView>();
|
||||||
|
|
||||||
|
|
||||||
CreateMap<QCQuestion, QCQuestionConfigureView>()
|
CreateMap<QCQuestion, QCQuestionConfigureView>()
|
||||||
.ForMember(d => d.ParentShowOrder, u => u.MapFrom(s => s.ParentQuestion.ShowOrder)); ;
|
.ForMember(d => d.ParentShowOrder, u => u.MapFrom(s => s.ParentQuestion.ShowOrder)); ;
|
||||||
|
|
Loading…
Reference in New Issue