查询修改

IRC_NewDev
he 2024-03-12 14:05:14 +08:00
parent 2fe0851786
commit c7abcc153e
5 changed files with 17 additions and 9 deletions

View File

@ -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))
{

View File

@ -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())

View File

@ -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);

View File

@ -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;
}
}
}

View File

@ -30,6 +30,7 @@ namespace IRaCIS.Core.Infrastructure.Extention
NeedTips = 5,
CloseCurrentWindows=6,