From d566298e51c6d3da29a1ec2bd26884d9ae90655a Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Wed, 29 Jun 2022 11:33:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Reading/Dto/ReadingQuestionViewModel.cs | 4 ++++ .../Service/Reading/ReadingQuestionService.cs | 10 ++++++++++ IRaCIS.Core.Application/Service/Reading/_MapConfig.cs | 8 +++++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs index 47426b3dd..a13375691 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs @@ -175,6 +175,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public string ParentQuestionName { get; set; } + public int ParentQuestionShowOrder { get; set; } + /// /// 是否是裁判问题 /// @@ -235,6 +237,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public string ParentQuestionName { get; set; } + public int ParentQuestionShowOrder { get; set; } + /// /// 类型值 diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs index bece44e0e..ca7174ffe 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs @@ -392,6 +392,11 @@ namespace IRaCIS.Application.Services throw new BusinessValidationFailedException("当前问题在项目"+ string.Join(',', trialNames) + "设置了裁判标准了,修改失败"); } } + + if (await _readingQuestionSystemRepository.AnyAsync(x => x.Id != indto.Id && x.ShowOrder == indto.ShowOrder)) + { + throw new BusinessValidationFailedException("问题编号重复"); + } var entity = await _readingQuestionSystemRepository.InsertOrUpdateAsync(indto, true); return ResponseOutput.Ok(entity.Id.ToString()); } @@ -698,6 +703,11 @@ namespace IRaCIS.Application.Services throw new BusinessValidationFailedException("当前问题已经设置了裁判标准了,修改失败"); } } + + if (await _readingQuestionTrialRepository.AnyAsync(x => x.Id != indto.Id && x.ShowOrder == indto.ShowOrder)) + { + throw new BusinessValidationFailedException("问题编号重复"); + } var entity = await _readingQuestionTrialRepository.InsertOrUpdateAsync(indto, true); return ResponseOutput.Ok(entity.Id.ToString()); } diff --git a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs index ae79a5a58..cabf20880 100644 --- a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs @@ -59,7 +59,8 @@ namespace IRaCIS.Core.Application.Service CreateMap(); CreateMap() - .ForMember(d => d.ParentQuestionName, u => u.MapFrom(s => s.ParentReadingQuestionSystem==null?string.Empty: s.ParentReadingQuestionSystem.QuestionName)); + .ForMember(d => d.ParentQuestionName, u => u.MapFrom(s => s.ParentReadingQuestionSystem==null?string.Empty: s.ParentReadingQuestionSystem.QuestionName)) + .ForMember(d => d.ParentQuestionShowOrder, u => u.MapFrom(s => s.ParentReadingQuestionSystem == null ? 0 : s.ParentReadingQuestionSystem.ShowOrder)); CreateMap(); @@ -69,8 +70,9 @@ namespace IRaCIS.Core.Application.Service CreateMap(); CreateMap() - .ForMember(d => d.ParentQuestionName, u => u.MapFrom(s => s.ParentReadingQuestionTrial == null ? string.Empty : s.ParentReadingQuestionTrial.QuestionName)); ; - #endregion + .ForMember(d => d.ParentQuestionName, u => u.MapFrom(s => s.ParentReadingQuestionTrial == null ? string.Empty : s.ParentReadingQuestionTrial.QuestionName)) + .ForMember(d => d.ParentQuestionShowOrder, u => u.MapFrom(s => s.ParentReadingQuestionTrial == null ? 0 : s.ParentReadingQuestionTrial.ShowOrder)); + #endregion #region IR阅片 CreateMap()