From c7abcc153e205fb75ddb8514d049719d3f89d605 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Tue, 12 Mar 2024 14:05:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessFilter/ProjectExceptionFilter.cs | 4 +++- .../ReadingImageTask/ReadingImageTaskService.cs | 6 +++--- .../ReadingImageTask/ReadingTaskQuestionService.cs | 2 +- .../Exception/BusinessValidationFailedException.cs | 13 +++++++++---- .../_IRaCIS/Output/ApiResponseCodeEnum.cs | 1 + 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/IRaCIS.Core.Application/BusinessFilter/ProjectExceptionFilter.cs b/IRaCIS.Core.Application/BusinessFilter/ProjectExceptionFilter.cs index 2948ee64f..5638e52ea 100644 --- a/IRaCIS.Core.Application/BusinessFilter/ProjectExceptionFilter.cs +++ b/IRaCIS.Core.Application/BusinessFilter/ProjectExceptionFilter.cs @@ -32,7 +32,9 @@ namespace IRaCIS.Core.Application.Filter if (context.Exception.GetType() == typeof(BusinessValidationFailedException)) { - context.Result = new JsonResult(ResponseOutput.NotOk(context.Exception.Message,ApiResponseCodeEnum.BusinessValidationFailed)); + var error = context.Exception as BusinessValidationFailedException; + + context.Result = new JsonResult(ResponseOutput.NotOk(context.Exception.Message, error!.Code)); } else if(context.Exception.GetType() == typeof(QueryBusinessObjectNotExistException)) { diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index 8ee67f3ea..3451ebb15 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -2600,7 +2600,7 @@ namespace IRaCIS.Application.Services if (currentSubject == null) { - throw new BusinessValidationFailedException(_localizer["ReadingImage_TaskFinish"]); + throw new BusinessValidationFailedException(_localizer["ReadingImage_TaskFinish"], ApiResponseCodeEnum.CloseCurrentWindows); } task = currentSubject.UnReadCanReadTaskList.Select(x => new GetReadingTaskDto() @@ -2627,7 +2627,7 @@ namespace IRaCIS.Application.Services var count = await query.CountAsync(); if (count == 0) { - throw new BusinessValidationFailedException(_localizer["ReadingImage_TaskFinish"]); + throw new BusinessValidationFailedException(_localizer["ReadingImage_TaskFinish"], ApiResponseCodeEnum.CloseCurrentWindows); } Random random = new Random(); var skipcount = 0; @@ -2653,7 +2653,7 @@ namespace IRaCIS.Application.Services if (task == null) { - throw new BusinessValidationFailedException(_localizer["ReadingImage_TaskFinish"]); + throw new BusinessValidationFailedException(_localizer["ReadingImage_TaskFinish"], ApiResponseCodeEnum.CloseCurrentWindows); } if (task.SubjectCode.IsNullOrEmpty()) diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingTaskQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingTaskQuestionService.cs index 82a62dead..241ea07c2 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingTaskQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingTaskQuestionService.cs @@ -285,7 +285,7 @@ namespace IRaCIS.Application.Services //qusetionList = qusetionList.Where(x => x.ParentId == null).ToList(); - groupList = qusetionList.Where(x => x.Type == ReadingQestionType.Group || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList(); + groupList = qusetionList.Where(x => x.Type == ReadingQestionType.Group ).ToList(); groupList.ForEach(x => { this.FindSystemChildQuestion(x, qusetionList, tableQuestionList); diff --git a/IRaCIS.Core.Infrastructure/_IRaCIS/Exception/BusinessValidationFailedException.cs b/IRaCIS.Core.Infrastructure/_IRaCIS/Exception/BusinessValidationFailedException.cs index ccda66221..cbe9ec767 100644 --- a/IRaCIS.Core.Infrastructure/_IRaCIS/Exception/BusinessValidationFailedException.cs +++ b/IRaCIS.Core.Infrastructure/_IRaCIS/Exception/BusinessValidationFailedException.cs @@ -1,17 +1,22 @@ -using System; +using IRaCIS.Core.Infrastructure.Extention; +using System; namespace IRaCIS.Core.Infrastructure { public class BusinessValidationFailedException : Exception { - public BusinessValidationFailedException() + public ApiResponseCodeEnum Code { get; set; } + + public BusinessValidationFailedException() { } - public BusinessValidationFailedException( string message) : base(message) + public BusinessValidationFailedException(string message, ApiResponseCodeEnum code = ApiResponseCodeEnum.BusinessValidationFailed) : base(message) { - } + Code = code; + + } } } diff --git a/IRaCIS.Core.Infrastructure/_IRaCIS/Output/ApiResponseCodeEnum.cs b/IRaCIS.Core.Infrastructure/_IRaCIS/Output/ApiResponseCodeEnum.cs index 0fb88dff2..f96a2d6ba 100644 --- a/IRaCIS.Core.Infrastructure/_IRaCIS/Output/ApiResponseCodeEnum.cs +++ b/IRaCIS.Core.Infrastructure/_IRaCIS/Output/ApiResponseCodeEnum.cs @@ -30,6 +30,7 @@ namespace IRaCIS.Core.Infrastructure.Extention NeedTips = 5, + CloseCurrentWindows=6,