diff --git a/YD_Event.Application/Workbench/Dtos/WorkbenchDtos.cs b/YD_Event.Application/Workbench/Dtos/WorkbenchDtos.cs index 540be7d..b273328 100644 --- a/YD_Event.Application/Workbench/Dtos/WorkbenchDtos.cs +++ b/YD_Event.Application/Workbench/Dtos/WorkbenchDtos.cs @@ -447,6 +447,11 @@ public class WorkbenchJudgeScoreDto /// public bool HasPendingCorrection { get; set; } + /// + /// 当前评分单提交的记录画板 PNG 地址 + /// + public string? AnnotationUrl { get; set; } + /// /// 评分单的动态评分项明细快照 /// diff --git a/YD_Event.Application/Workbench/WorkbenchController.cs b/YD_Event.Application/Workbench/WorkbenchController.cs index e40c5c6..99fab53 100644 --- a/YD_Event.Application/Workbench/WorkbenchController.cs +++ b/YD_Event.Application/Workbench/WorkbenchController.cs @@ -24,6 +24,7 @@ public class WorkbenchController : IDynamicApiController private readonly ISqlSugarRepository _entryRepository; private readonly ISqlSugarRepository _assignmentRepository; private readonly ISqlSugarRepository _sheetRepository; + private readonly ISqlSugarRepository _scoreAttachmentRepository; private readonly ISqlSugarRepository _correctionRepository; private readonly ISqlSugarRepository _resultRepository; private readonly ISqlSugarRepository _resultVersionRepository; @@ -50,6 +51,7 @@ public class WorkbenchController : IDynamicApiController ISqlSugarRepository entryRepository, ISqlSugarRepository assignmentRepository, ISqlSugarRepository sheetRepository, + ISqlSugarRepository scoreAttachmentRepository, ISqlSugarRepository correctionRepository, ISqlSugarRepository resultRepository, ISqlSugarRepository resultVersionRepository, @@ -75,6 +77,7 @@ public class WorkbenchController : IDynamicApiController _entryRepository = entryRepository; _assignmentRepository = assignmentRepository; _sheetRepository = sheetRepository; + _scoreAttachmentRepository = scoreAttachmentRepository; _correctionRepository = correctionRepository; _resultRepository = resultRepository; _resultVersionRepository = resultVersionRepository; @@ -380,6 +383,15 @@ public class WorkbenchController : IDynamicApiController // 批量查询当前评分单的动态评分项明细,按评分单分组挂到各裁判评分下 var sheetIds = sheets.Select(s => s.Id).ToList(); + var annotationUrls = sheetIds.Count == 0 + ? new Dictionary() + : (await _scoreAttachmentRepository.AsQueryable() + .Where(a => !a.DeleteMark && sheetIds.Contains(a.ScoreSheetId) + && a.IsCurrent && a.AttachmentType == "score_annotation_png") + .Select(a => new { a.ScoreSheetId, a.FileUrl, a.CreatedTime }) + .ToListAsync()) + .GroupBy(a => a.ScoreSheetId) + .ToDictionary(g => g.Key, g => g.OrderByDescending(a => a.CreatedTime).First().FileUrl); var scoreItems = await _scoreDetailRepository.AsQueryable() .Where(d => !d.DeleteMark && sheetIds.Contains(d.ScoreSheetId)) .OrderBy(d => d.Sort) @@ -434,6 +446,7 @@ public class WorkbenchController : IDynamicApiController IsDisqualified = sheet.IsDisqualified, SubmittedTime = sheet.SubmittedTime, HasPendingCorrection = pendingCorrectionSet.Contains(sheet.Id), + AnnotationUrl = annotationUrls.GetValueOrDefault(sheet.Id), ScoreItems = scoreItems.Where(d => d.ScoreSheetId == sheet.Id).Select(d => new WorkbenchScoreItemDto { ItemCode = d.ItemCode,