Uat_Study
parent
039b478261
commit
e2ad22437f
|
@ -49,6 +49,31 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
public ArbitrationRule ArbitrationRule { get; set; }
|
public ArbitrationRule ArbitrationRule { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum NeedSynchronize
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 需要
|
||||||
|
/// </summary>
|
||||||
|
Need=0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 不需要
|
||||||
|
/// </summary>
|
||||||
|
NotNeed = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 裁判不相等
|
||||||
|
/// </summary>
|
||||||
|
JudgeNotEqual=2,
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SynchronizeCriterionInDto
|
||||||
|
{
|
||||||
|
[NotDefault]
|
||||||
|
public Guid TrialId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
public class VerifyeCriterionNeedSynchronizeInDto
|
public class VerifyeCriterionNeedSynchronizeInDto
|
||||||
{
|
{
|
||||||
[NotDefault]
|
[NotDefault]
|
||||||
|
|
|
@ -104,43 +104,70 @@ namespace IRaCIS.Application.Services
|
||||||
/// <param name="inDto"></param>
|
/// <param name="inDto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<bool> VerifyeCriterionNeedSynchronize(VerifyeCriterionNeedSynchronizeInDto inDto)
|
public async Task<NeedSynchronize> VerifyeCriterionNeedSynchronize(VerifyeCriterionNeedSynchronizeInDto inDto)
|
||||||
{
|
{
|
||||||
var trialCriterion = await _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == inDto.TrialId&&x.IsConfirm).FirstOrDefaultAsync();
|
var trialCriterion = await _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == inDto.TrialId&&x.IsConfirm).FirstOrDefaultAsync();
|
||||||
if (trialCriterion == null)
|
if (trialCriterion == null)
|
||||||
{
|
{
|
||||||
return false;
|
return NeedSynchronize.NotNeed;
|
||||||
}
|
}
|
||||||
if (trialCriterion.ReadingQuestionCriterionSystemId != null)
|
if (trialCriterion.ReadingQuestionCriterionSystemId != null)
|
||||||
{
|
{
|
||||||
var systemCriterion = await _readingQuestionCriterionSystemRepository.Where(x => x.Id == trialCriterion.ReadingQuestionCriterionSystemId).FirstNotNullAsync();
|
var systemCriterion = await _readingQuestionCriterionSystemRepository.Where(x => x.Id == trialCriterion.ReadingQuestionCriterionSystemId).FirstNotNullAsync();
|
||||||
if (systemCriterion.ConfirmTime > trialCriterion.SynchronizeTime)
|
if (systemCriterion.ConfirmTime > trialCriterion.SynchronizeTime)
|
||||||
{
|
{
|
||||||
await SynchronizeCriterion(trialCriterion.Id);
|
|
||||||
return true;
|
var systemQuestionList = await _readingQuestionSystemRepository.Where(x => x.IsJudgeQuestion && x.ReadingQuestionCriterionSystemId == trialCriterion.ReadingQuestionCriterionSystemId).ToListAsync();
|
||||||
|
var trialQuestionList = await _readingQuestionTrialRepository.Where(x => x.IsJudgeQuestion && x.ReadingQuestionCriterionTrialId == trialCriterion.Id).ToListAsync();
|
||||||
|
if (systemQuestionList.Count() != trialQuestionList.Count())
|
||||||
|
{
|
||||||
|
return NeedSynchronize.JudgeNotEqual;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var item in trialQuestionList)
|
||||||
|
{
|
||||||
|
var systemQuestion= systemQuestionList.Where(x=>x.Id== (item.ReadingQuestionSystemId??default(Guid))).FirstOrDefault();
|
||||||
|
if (systemQuestion == null)
|
||||||
|
{
|
||||||
|
return NeedSynchronize.JudgeNotEqual;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (systemQuestion.TypeValue != item.TypeValue)
|
||||||
|
{
|
||||||
|
return NeedSynchronize.JudgeNotEqual;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return NeedSynchronize.Need;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return NeedSynchronize.NotNeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return NeedSynchronize.NotNeed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 同步标准到项目新(2022-08-10)
|
/// 同步标准到项目新(2022-08-10)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="trialCriterionId"></param>
|
/// <param name="inDto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task SynchronizeCriterion(Guid trialCriterionId)
|
public async Task SynchronizeCriterion(SynchronizeCriterionInDto inDto)
|
||||||
{
|
{
|
||||||
var trialCriterion = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == trialCriterionId).FirstNotNullAsync();
|
var trialCriterion = await _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == inDto.TrialId&&x.IsConfirm).AsNoTracking().FirstOrDefaultAsync();
|
||||||
if(trialCriterion.ReadingQuestionCriterionSystemId!=null)
|
|
||||||
|
if (trialCriterion != null)
|
||||||
|
{
|
||||||
|
if (trialCriterion.ReadingQuestionCriterionSystemId != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
// 将系统里面的问题转为项目问题
|
// 将系统里面的问题转为项目问题
|
||||||
|
@ -148,11 +175,11 @@ namespace IRaCIS.Application.Services
|
||||||
.ProjectTo<ReadingQuestionTrial>(_mapper.ConfigurationProvider).ToListAsync();
|
.ProjectTo<ReadingQuestionTrial>(_mapper.ConfigurationProvider).ToListAsync();
|
||||||
newTrialQuestionList.ForEach(x => {
|
newTrialQuestionList.ForEach(x => {
|
||||||
x.Id = NewId.NextGuid();
|
x.Id = NewId.NextGuid();
|
||||||
x.ReadingQuestionCriterionTrialId = trialCriterionId;
|
x.ReadingQuestionCriterionTrialId = trialCriterion.Id;
|
||||||
x.TrialId = trialCriterion.TrialId;
|
x.TrialId = trialCriterion.TrialId;
|
||||||
});
|
});
|
||||||
var copeNewQuestionList = newTrialQuestionList.Clone();
|
var copeNewQuestionList = newTrialQuestionList.Clone();
|
||||||
var trialQuestionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialCriterionId).ToListAsync();
|
var trialQuestionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialCriterion.Id).ToListAsync();
|
||||||
|
|
||||||
var needAddDatas = new List<ReadingQuestionTrial>();
|
var needAddDatas = new List<ReadingQuestionTrial>();
|
||||||
|
|
||||||
|
@ -166,13 +193,13 @@ namespace IRaCIS.Application.Services
|
||||||
var systemData = _mapper.Map<ReadingQuestionSystem>(x);
|
var systemData = _mapper.Map<ReadingQuestionSystem>(x);
|
||||||
var newData = _mapper.Map(systemData, firstQuestion);
|
var newData = _mapper.Map(systemData, firstQuestion);
|
||||||
newData.Id = x.Id;
|
newData.Id = x.Id;
|
||||||
newData.ReadingQuestionSystemId= x.ReadingQuestionSystemId;
|
newData.ReadingQuestionSystemId = x.ReadingQuestionSystemId;
|
||||||
question = newData.Clone();
|
question = newData.Clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (question.ParentId != null)
|
if (question.ParentId != null)
|
||||||
{
|
{
|
||||||
question.ParentId = copeNewQuestionList.Where(y =>x.ParentId==y.ReadingQuestionSystemId ).Select(y => y.Id).FirstOrDefault();
|
question.ParentId = copeNewQuestionList.Where(y => x.ParentId == y.ReadingQuestionSystemId).Select(y => y.Id).FirstOrDefault();
|
||||||
}
|
}
|
||||||
if (question.RelevanceId != null)
|
if (question.RelevanceId != null)
|
||||||
{
|
{
|
||||||
|
@ -182,9 +209,9 @@ namespace IRaCIS.Application.Services
|
||||||
needAddDatas.Add(question);
|
needAddDatas.Add(question);
|
||||||
};
|
};
|
||||||
|
|
||||||
await _readingQuestionTrialRepository.BatchDeleteNoTrackingAsync(x => x.ReadingQuestionCriterionTrialId == trialCriterionId);
|
await _readingQuestionTrialRepository.BatchDeleteNoTrackingAsync(x => x.ReadingQuestionCriterionTrialId == trialCriterion.Id);
|
||||||
await _readingQuestionTrialRepository.AddRangeAsync(needAddDatas);
|
await _readingQuestionTrialRepository.AddRangeAsync(needAddDatas);
|
||||||
await _readingQuestionCriterionTrialRepository.UpdatePartialFromQueryAsync(trialCriterionId, x => new ReadingQuestionCriterionTrial()
|
await _readingQuestionCriterionTrialRepository.UpdatePartialFromQueryAsync(trialCriterion.Id, x => new ReadingQuestionCriterionTrial()
|
||||||
{
|
{
|
||||||
SynchronizeTime = DateTime.Now
|
SynchronizeTime = DateTime.Now
|
||||||
});
|
});
|
||||||
|
@ -192,6 +219,8 @@ namespace IRaCIS.Application.Services
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取项目裁判信息
|
/// 获取项目裁判信息
|
||||||
|
|
Loading…
Reference in New Issue