任务答案数量验证
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using DocumentFormat.OpenXml;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
using IRaCIS.Core.Application.Helper.OtherTool;
|
||||
using IRaCIS.Core.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.Service.ImageAndDoc;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
@@ -10,6 +11,7 @@ using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using MassTransit;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
@@ -68,6 +70,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
IGeneralCalculateService _generalCalculateService,
|
||||
IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository,
|
||||
IRepository<TaskStudy> _taskStudyRepository,
|
||||
IConfiguration _config,
|
||||
IDownloadAndUploadService _downloadAndUploadService,
|
||||
ITrialEmailNoticeConfigService _trialEmailNoticeConfigService,
|
||||
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer, IFusionCache _fusionCache) : BaseService, IReadingImageTaskService
|
||||
@@ -3426,6 +3429,18 @@ namespace IRaCIS.Core.Application.Service
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> VerifyVisitTaskQuestions(VerifyVisitTaskQuestionsInDto inDto)
|
||||
{
|
||||
//// 验证一个问题不能有多个答案
|
||||
//bool hasDuplicate = await _readingTaskQuestionAnswerRepository
|
||||
// .Where(x => x.VisitTaskId == inDto.VisitTaskId)
|
||||
// .GroupBy(x => x.ReadingQuestionTrialId)
|
||||
// .AnyAsync(g => g.Count() > 1);
|
||||
|
||||
//if (hasDuplicate)
|
||||
//{
|
||||
// return ResponseOutput.NotOk(_localizer["ReadingImage_BackImageNotExist"]);
|
||||
//}
|
||||
|
||||
|
||||
//验证后处理影像必须传
|
||||
if (_visitTaskRepository.Any(t => t.Id == inDto.VisitTaskId && t.TrialReadingCriterion.ImageUploadEnum != ReadingImageUpload.None))
|
||||
{
|
||||
|
||||
+60
-8
@@ -1,5 +1,6 @@
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Filter;
|
||||
using IRaCIS.Core.Application.Helper.OtherTool;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
@@ -7,6 +8,7 @@ using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using MassTransit;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
@@ -676,7 +678,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
JudgeDifferenceType = x.Key.JudgeDifferenceType,
|
||||
TaskAnswerList = x.Select(y => y.Answer).ToList(),
|
||||
}).ToList();
|
||||
noteEqual = noteEqual || ComputeJudgeResult(groupTasks);
|
||||
noteEqual = noteEqual || ComputeJudgeResult(groupTasks, visitTask.Id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -708,7 +710,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
JudgeDifferenceType = x.Key.JudgeDifferenceType,
|
||||
TaskAnswerList = x.Select(y => y.Answer).ToList(),
|
||||
}).ToList();
|
||||
noteEqual = ComputeJudgeResult(groupTasks);
|
||||
noteEqual = ComputeJudgeResult(groupTasks, visitTask.Id);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -757,7 +759,8 @@ namespace IRaCIS.Core.Application.Service
|
||||
JudgeDifferenceValue = x.Key.JudgeDifferenceValue,
|
||||
JudgeDifferenceType = x.Key.JudgeDifferenceType,
|
||||
}).ToList();
|
||||
noteEqual = noteEqual || ComputeJudgeResult(globalGroupTasks);
|
||||
|
||||
noteEqual = noteEqual || ComputeJudgeResult(globalGroupTasks, visitTask.Id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -819,7 +822,8 @@ namespace IRaCIS.Core.Application.Service
|
||||
JudgeDifferenceType = x.Key.JudgeDifferenceType,
|
||||
TaskAnswerList = x.Select(y => y.Answer).ToList(),
|
||||
}).ToList();
|
||||
noteEqual = noteEqual || ComputeJudgeResult(globalGroupTasks);
|
||||
|
||||
noteEqual = noteEqual || ComputeJudgeResult(globalGroupTasks, visitTask.Id);
|
||||
}
|
||||
|
||||
|
||||
@@ -922,12 +926,60 @@ namespace IRaCIS.Core.Application.Service
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 发送微信通知
|
||||
/// </summary>
|
||||
/// <param name="visiTaskId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task SendWeComNotifier(Guid visiTaskId,string msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool isOpenWeComNotice = _config.GetValue<bool>("WeComNoticeConfig:IsOpenWeComNotice");
|
||||
|
||||
if (isOpenWeComNotice)
|
||||
{
|
||||
string webhook = _config["WeComNoticeConfig:WebhookUrl"] ?? string.Empty;
|
||||
|
||||
var uri = new Uri(_config["SystemEmailSendConfig:SiteUrl"]);
|
||||
var baseUrl = uri.GetLeftPart(UriPartial.Authority);
|
||||
|
||||
var userList = _config.GetSection("WeComNoticeConfig:APINoticeUserList").Get<string[]>();
|
||||
|
||||
|
||||
|
||||
// 🔔 异步告警(不要阻塞请求)
|
||||
_ = WeComNotifier.SendAlertAsync(
|
||||
webhook: webhook,
|
||||
alert: new WeComAlert
|
||||
{
|
||||
Env = baseUrl,
|
||||
UserName = msg,
|
||||
Api = "",
|
||||
Message = $"异常信息:{msg}",
|
||||
Stack = string.Empty,
|
||||
AtUsers = userList ?? []
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Logger.Error($"MassTransit里发送企业微信出现错误:{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 计算返回的结果 为True表示不相等
|
||||
/// </summary>
|
||||
/// <param name="groupTasks"></param>
|
||||
/// <returns></returns>
|
||||
private bool ComputeJudgeResult(List<GroupTaskAnswerDto> groupTasks)
|
||||
private bool ComputeJudgeResult(List<GroupTaskAnswerDto> groupTasks,Guid visiTaskId)
|
||||
{
|
||||
var noteEqual = false;
|
||||
foreach (var item in groupTasks)
|
||||
@@ -935,12 +987,12 @@ namespace IRaCIS.Core.Application.Service
|
||||
// 裁判问题可以不必填
|
||||
if(item.TaskAnswerList.Count()==0)
|
||||
{
|
||||
break;
|
||||
_ = SendWeComNotifier(visiTaskId, "两个阅片任务的答案等于0");
|
||||
}
|
||||
else if (item.TaskAnswerList.Count() != 2)
|
||||
{
|
||||
noteEqual = true;
|
||||
break;
|
||||
// 发送微信通知
|
||||
_ = SendWeComNotifier(visiTaskId, "两个阅片任务的答案不等于2");
|
||||
}
|
||||
else if (noteEqual)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user