质控自动任务跳过,增加缓存跳过当前任务
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
ea781dcd38
commit
53134ee4d2
|
|
@ -71,6 +71,7 @@ public static class CacheKeys
|
||||||
public static string TrialDataStoreType(Guid trialId) => $"TrialDataStoreType:{trialId}";
|
public static string TrialDataStoreType(Guid trialId) => $"TrialDataStoreType:{trialId}";
|
||||||
|
|
||||||
|
|
||||||
|
public static string UserQCSkipTask(Guid userId) => $"UserSKipQCTask:{userId}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class CacheHelper
|
public static class CacheHelper
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ using IRaCIS.Core.Domain.Share;
|
||||||
using IRaCIS.Core.Infrastructure;
|
using IRaCIS.Core.Infrastructure;
|
||||||
using Medallion.Threading;
|
using Medallion.Threading;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Org.BouncyCastle.Asn1.Cmp;
|
using Org.BouncyCastle.Asn1.Cmp;
|
||||||
|
|
@ -1297,6 +1298,21 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
|
|
||||||
var isDistinguishType = trialConfig.IsIQCAutoNextTask && trialConfig.IsIQCAutoTaskDistinguishType;
|
var isDistinguishType = trialConfig.IsIQCAutoNextTask && trialConfig.IsIQCAutoTaskDistinguishType;
|
||||||
|
|
||||||
|
if (inDto.IsSkipCurrentVisit)
|
||||||
|
{
|
||||||
|
string cacheKey = CacheKeys.UserQCSkipTask(_userInfo.UserRoleId);
|
||||||
|
|
||||||
|
// 获取当前缓存中的访视Id集合(如果没有则创建空集合)
|
||||||
|
var skippedVisits = await _fusionCache.GetOrDefaultAsync<List<Guid>>(cacheKey, new List<Guid>());
|
||||||
|
|
||||||
|
// 如果当前访视Id不在集合中,则添加
|
||||||
|
if (!skippedVisits.Contains(inDto.SubjectVisitId))
|
||||||
|
{
|
||||||
|
skippedVisits.Add(inDto.SubjectVisitId);
|
||||||
|
await _fusionCache.SetAsync(cacheKey, skippedVisits, TimeSpan.FromMinutes(60));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isDistinguishType == false)
|
if (isDistinguishType == false)
|
||||||
{
|
{
|
||||||
//不区分任务类型,也要按照当前任务类型给,没找到,按照默认规则给任务 无质疑 普通质控任务
|
//不区分任务类型,也要按照当前任务类型给,没找到,按照默认规则给任务 无质疑 普通质控任务
|
||||||
|
|
@ -1351,10 +1367,13 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
.Select(t => new { t.IsUrgent, SubjectCode = t.Subject.Code, t.SubjectId, SubjectVisitId = t.Id, t.VisitNum, IshaveQCChallenge = t.QCChallengeList.Any(), t.SecondReviewState })
|
.Select(t => new { t.IsUrgent, SubjectCode = t.Subject.Code, t.SubjectId, SubjectVisitId = t.Id, t.VisitNum, IshaveQCChallenge = t.QCChallengeList.Any(), t.SecondReviewState })
|
||||||
.OrderBy(t => t.IshaveQCChallenge).ThenBy(t => t.SecondReviewState).ThenBy(x => x.IsUrgent).ThenBy(x => x.SubjectCode).ThenBy(x => x.VisitNum).ToListAsync();
|
.OrderBy(t => t.IshaveQCChallenge).ThenBy(t => t.SecondReviewState).ThenBy(x => x.IsUrgent).ThenBy(x => x.SubjectCode).ThenBy(x => x.VisitNum).ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
|
// 获取当前缓存中的访视Id集合(如果没有则创建空集合)
|
||||||
|
var skippedVisits = await _fusionCache.GetOrDefaultAsync<List<Guid>>(CacheKeys.UserQCSkipTask(_userInfo.UserRoleId), new List<Guid>() { inDto.SubjectVisitId });
|
||||||
//跳过当前访视
|
//跳过当前访视
|
||||||
if (inDto.IsSkipCurrentVisit)
|
if (inDto.IsSkipCurrentVisit)
|
||||||
{
|
{
|
||||||
currentActionList = currentActionList.Where(t => t.SubjectVisitId != inDto.SubjectVisitId).ToList();
|
currentActionList = currentActionList.Where(t => !skippedVisits.Contains(t.SubjectVisitId)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentActionList.Count() > 0)
|
if (currentActionList.Count() > 0)
|
||||||
|
|
@ -1405,7 +1424,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
//跳过当前访视
|
//跳过当前访视
|
||||||
if (inDto.IsSkipCurrentVisit)
|
if (inDto.IsSkipCurrentVisit)
|
||||||
{
|
{
|
||||||
visitList = visitList.Where(t => t.SubjectVisitId != inDto.SubjectVisitId).ToList();
|
visitList = visitList.Where(t => !skippedVisits.Contains(t.SubjectVisitId)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
var subjectVisit = visitList.FirstOrDefault();
|
var subjectVisit = visitList.FirstOrDefault();
|
||||||
|
|
@ -1448,7 +1467,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
//跳过当前访视
|
//跳过当前访视
|
||||||
if (inDto.IsSkipCurrentVisit)
|
if (inDto.IsSkipCurrentVisit)
|
||||||
{
|
{
|
||||||
visitList = visitList.Where(t => t.SubjectVisitId != inDto.SubjectVisitId).ToList();
|
visitList = visitList.Where(t => !skippedVisits.Contains(t.SubjectVisitId)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
subjectVisit = visitList.FirstOrDefault();
|
subjectVisit = visitList.FirstOrDefault();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue