From 5bdc2dfefb6e82e4db7d09be69b014d2f78993e6 Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Wed, 10 Aug 2022 17:03: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 --- .../Reading/Dto/ReadingQuestionViewModel.cs | 4 ++ .../Service/Reading/ReadingQuestionService.cs | 39 ++++++++++++++++++- .../Reading/ReadingQuestionCriterionSystem.cs | 5 +++ .../Reading/ReadingQuestionCriterionTrial.cs | 7 +++- 4 files changed, 53 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs index bf800cacb..5204fd502 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs @@ -49,6 +49,10 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public ArbitrationRule ArbitrationRule { get; set; } } + public class VerifyeCriterionNeedSynchronizeInDto + { + public Guid TrialCriterionId { get; set; } + } public class GetTrialJudgyInfoInDto { [NotDefault] diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs index b4a0949d6..cb53d2263 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs @@ -98,6 +98,33 @@ namespace IRaCIS.Application.Services } + /// + /// 验证是否要同步标准 + /// + /// + /// + [HttpPost] + public async Task VerifyeCriterionNeedSynchronize(VerifyeCriterionNeedSynchronizeInDto inDto) + { + var trialCriterion = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialCriterionId).FirstNotNullAsync(); + if (trialCriterion.ReadingQuestionCriterionSystemId != null) + { + var systemCriterion = await _readingQuestionCriterionSystemRepository.Where(x => x.Id == trialCriterion.ReadingQuestionCriterionSystemId).FirstNotNullAsync(); + if (systemCriterion.ConfirmTime > trialCriterion.SynchronizeTime) + { + return true; + } + else + { + return false; + } + + } + else + { + return false; + } + } /// /// 同步标准到项目新(2022-08-10) @@ -151,6 +178,10 @@ namespace IRaCIS.Application.Services await _readingQuestionTrialRepository.BatchDeleteNoTrackingAsync(x => x.ReadingQuestionCriterionTrialId == trialCriterionId); await _readingQuestionTrialRepository.AddRangeAsync(needAddDatas); + await _readingQuestionCriterionTrialRepository.UpdatePartialFromQueryAsync(trialCriterionId, x => new ReadingQuestionCriterionTrial() + { + SynchronizeTime = DateTime.Now + }); await _readingQuestionTrialRepository.SaveChangesAsync(); } } @@ -282,7 +313,13 @@ namespace IRaCIS.Application.Services if (inDto.IsCompleteConfig) { await SynchronizeSystemCriterion(inDto.Id); - }else + + await _readingQuestionCriterionSystemRepository.UpdatePartialFromQueryAsync(inDto.Id, x => new ReadingQuestionCriterionSystem() + { + ConfirmTime = DateTime.Now + }) ; + } + else { await _readingQuestionCriterionTrialRepository.BatchUpdateNoTrackingAsync(x=>x.ReadingQuestionCriterionSystemId== inDto.Id, x => new ReadingQuestionCriterionTrial() { diff --git a/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionSystem.cs b/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionSystem.cs index ff48094de..00d0baacd 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionSystem.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionSystem.cs @@ -44,6 +44,11 @@ namespace IRaCIS.Core.Domain.Models /// public DateTime CreateTime { get; set; } + /// + /// 确认时间 + /// + public DateTime ConfirmTime { get; set; } + /// /// 创建人 /// diff --git a/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionTrial.cs b/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionTrial.cs index 5c8a06cd8..5f6f20339 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionTrial.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionTrial.cs @@ -87,7 +87,12 @@ namespace IRaCIS.Core.Domain.Models /// /// 是否显示详情 /// - public bool IsShowDetail { get; set; } + public bool IsShowDetail { get; set; } + + /// + /// 同步时间 + /// + public DateTime SynchronizeTime { get; set; } /// /// 项目