This commit is contained in:
biss committed 2026-08-11 21:14:12 +08:00
1 parent 02fcf9ae8f
commit e5afe60a11
8 files changed
+256 -65

No files matched your search

@@ -4,6 +4,7 @@ using Jiaowu.Api.Domain.Identity;
using Jiaowu.Api.Infrastructure.Auth;
using Jiaowu.Api.Infrastructure.Excel;
using Jiaowu.Api.Infrastructure.Persistence;
using Jiaowu.Api.Infrastructure.OfficialDocuments;
using Jiaowu.Api.Infrastructure.Timetables;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -17,7 +18,8 @@ namespace Jiaowu.Api.Controllers;
public sealed class TimetableManagementController(
AppDbContext db,
TimetableDataService timetableDataService,
ICurrentUserDataScope currentUserDataScope) : ControllerBase
ICurrentUserDataScope currentUserDataScope,
OfficialDocumentOptions officialDocumentOptions) : ControllerBase
{
private const string ManagementRoles =
SystemRoles.SuperAdmin + "," +
@@ -239,7 +241,7 @@ public sealed class TimetableManagementController(
}
var fileName = $"课表批量导出-{FileName(timetables[0].Term.Name)}.pdf";
return File(TimetablePdfExporter.Create(timetables), "application/pdf", fileName);
return File(TimetablePdfExporter.Create(timetables, officialDocumentOptions.FontPath), "application/pdf", fileName);
}
[HttpPost("display-links/export.xlsx")]
@@ -297,7 +299,7 @@ public sealed class TimetableManagementController(
private ActionResult PdfFile(TimetableData timetable) =>
File(
TimetablePdfExporter.Create(timetable),
TimetablePdfExporter.Create(timetable, officialDocumentOptions.FontPath),
"application/pdf",
$"{FileName(timetable.Subject.Name)}-{FileName(timetable.Term.Name)}-课表.pdf");
}
@@ -5,6 +5,7 @@ using Jiaowu.Api.Domain.Identity;
using Jiaowu.Api.Infrastructure.Caching;
using Jiaowu.Api.Infrastructure.Excel;
using Jiaowu.Api.Infrastructure.Persistence;
using Jiaowu.Api.Infrastructure.OfficialDocuments;
using Jiaowu.Api.Infrastructure.Timetables;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -18,7 +19,8 @@ public sealed class TimetablesController(
AppDbContext db,
TimetableDataService timetableDataService,
PersonalCalendarService personalCalendarService,
IAppCache cache) : ControllerBase
IAppCache cache,
OfficialDocumentOptions officialDocumentOptions) : ControllerBase
{
[HttpGet("options")]
[AllowAnonymous]
@@ -517,7 +519,7 @@ public sealed class TimetablesController(
{
var fileName =
$"{SafeFileName(result.Subject.Name)}-{SafeFileName(result.Term.Name)}-课表.pdf";
return File(TimetablePdfExporter.Create(result), "application/pdf", fileName);
return File(TimetablePdfExporter.Create(result, officialDocumentOptions.FontPath), "application/pdf", fileName);
}
private static string SafeFileName(string value)