Compare commits

...

5 Commits

Author SHA1 Message Date
he 85a303171c 修改
continuous-integration/drone/push Build is passing Details
2024-07-17 10:52:54 +08:00
he 4026eca656 修改 2024-07-17 10:52:20 +08:00
he 74aec46a94 返回值修改 2024-07-17 10:52:02 +08:00
he 49e21a6342 加返回参数 2024-07-17 10:51:58 +08:00
he 0e0dd0c7d3 跳过阅片修改 2024-07-17 10:51:26 +08:00
2 changed files with 55 additions and 6 deletions

View File

@ -37,7 +37,7 @@ namespace IRaCIS.Core.Application.Contracts
Task<List<GetManualListOutDto>> GetManualList(GetManualListInDto inDto);
Task ResetReadingRestTime(Guid? userId);
Task<bool> ResetReadingRestTime(Guid? userId);
Task<List<GetReadingPastResultListOutDto>> GetReadingPastResultList(GetReadingPastResultListInDto inDto);

View File

@ -22,6 +22,8 @@ using AutoMapper.QueryableExtensions;
using IRaCIS.Application.Contracts;
using IRaCIS.Core.Domain.Models;
using Microsoft.Extensions.Options;
using System.Linq;
using NPOI.SS.Formula.Functions;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
namespace IRaCIS.Application.Services
@ -2705,6 +2707,31 @@ namespace IRaCIS.Application.Services
}
/// <summary>
/// 设置跳过阅片的缓存
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<bool> SetSkipReadingCache(SetSkipReadingCacheInDto inDto )
{
var clearSkipReadingCacheKey = _userInfo.Id.ToString() + "SkipReadingCache";
var clearSkipReadingCache = _provider.Get<string>(clearSkipReadingCacheKey).Value;
if (clearSkipReadingCache == null|| clearSkipReadingCache==string.Empty)
{
List<Guid> cacheIds = new List<Guid>();
cacheIds.Add(inDto.VisitTaskId);
_provider.Set(clearSkipReadingCacheKey, JsonConvert.SerializeObject(cacheIds), TimeSpan.FromHours(24));
}
else
{
List<Guid>? cacheIds=JsonConvert.DeserializeObject<List<Guid>>(clearSkipReadingCache);
cacheIds.Add(inDto.VisitTaskId);
_provider.Set(clearSkipReadingCacheKey, JsonConvert.SerializeObject(cacheIds), TimeSpan.FromHours(24));
}
return true;
}
/// <summary>
@ -2770,14 +2797,20 @@ namespace IRaCIS.Application.Services
var subjectIndex = subjectTaskList.Where(x => x.SubjectId == inDto.SubjectId && x.SubjectCode == inDto.SubjectCode).Select(x => x.Index).FirstOrDefault();
var currentSubject = subjectTaskList.Where(x => x.Index >= subjectIndex && !x.ExistReadingApply).OrderBy(x => x.Index).FirstOrDefault();
var currentSubject = subjectTaskList.Where(x => x.Index >= subjectIndex && !x.ExistReadingApply)
// 排除跳过的
.Where(x=> x.UnReadCanReadTaskList.Select(y => y.Id).Intersect(cacheSkipIds).Count()==0)
.OrderBy(x => x.Index).FirstOrDefault();
if (currentSubject == null)
{
throw new BusinessValidationFailedException(_localizer["ReadingImage_TaskFinish"], ApiResponseCodeEnum.CloseCurrentWindows);
}
task = currentSubject.UnReadCanReadTaskList.Select(x => new GetReadingTaskDto()
task = currentSubject.UnReadCanReadTaskList
.Select(x => new GetReadingTaskDto()
{
ReadingCategory = x.ReadingCategory,
SubjectCode = currentSubject.SubjectCode,
@ -2806,12 +2839,25 @@ namespace IRaCIS.Application.Services
})).CurrentPageData;
if (subjectTaskList.Count() == 0)
{
throw new BusinessValidationFailedException(_localizer["ReadingImage_TaskFinish"], ApiResponseCodeEnum.CloseCurrentWindows);
}
var taskList = subjectTaskList.FirstOrDefault()!.UnReadCanReadTaskList;
// 排除跳过的
List<Guid> remainingItems = taskList.Select(x => x.Id).Except(cacheSkipIds).ToList();
taskList = taskList.Where(x => remainingItems.Contains(x.Id)).ToList();
if (taskList.Count() == 0)
{
throw new BusinessValidationFailedException(_localizer["ReadingImage_TaskFinish"], ApiResponseCodeEnum.CloseCurrentWindows);
}
Random random = new Random();
//返回的范围是 0- taskList.Count-1
@ -2995,12 +3041,12 @@ namespace IRaCIS.Application.Services
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task VerifyReadingRestTime()
public async Task<bool> VerifyReadingRestTime()
{
var userTypeEnum = (UserTypeEnum)_userInfo.UserTypeEnumInt;
if (userTypeEnum != UserTypeEnum.IndependentReviewer)
{
return;
return true;
}
var startReadingTimeKey = _userInfo.Id.ToString() + "StartReadingTime";
var startRestTimeKey = _userInfo.Id.ToString() + "StartRestTime";
@ -3045,6 +3091,8 @@ namespace IRaCIS.Application.Services
#endregion
}
return true;
}
/// <summary>
@ -3052,7 +3100,7 @@ namespace IRaCIS.Application.Services
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task ResetReadingRestTime(Guid? userID)
public async Task<bool> ResetReadingRestTime(Guid? userID)
{
if (userID == null)
{
@ -3079,6 +3127,7 @@ namespace IRaCIS.Application.Services
{
_provider.Set(startReadingTimeKey, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48));
}
return true;
}
/// <summary>