已完成管理后台第三批 ASP.NET Core 10 迁移:批量报名号申领与审批。

原生接口:
GET /api/admin/candidate-account-batches
POST /api/admin/candidate-account-batches
PATCH /api/admin/candidate-account-batches/{batchId}
实现包含:
校级管理员按班级提交名额
可配置多级审批流与待办负载分配
当前处理人及管理员层级校验
审批通过、退回和重复审批保护
终审时原子生成考生账号、报名号、初始密码和待补录资料
生成账号兼容现有 PBKDF2 登录及首次强制改密
This commit is contained in:
2026-07-23 08:19:48 +08:00 Unverified
parent 875e59b6ce
commit f7c34247fd
13 changed files with 567 additions and 28 deletions
@@ -25,23 +25,33 @@ public static class NativeAdminReadEndpoints
endpoints.MapGet("/api/admin/exams", (HttpContext context, IAdminReadService service, CancellationToken cancellationToken) =>
Execute(context, service.GetExamsAsync(Token(context), cancellationToken)));
if (!options.NativeOrganizationWritesEnabled) return endpoints;
endpoints.MapPost("/api/admin/schools", (HttpContext context, JsonObject body, IAdminOrganizationService service, CancellationToken cancellationToken) =>
Execute(context, service.CreateSchoolAsync(Token(context), body, cancellationToken)));
endpoints.MapPatch("/api/admin/schools/{schoolId}", (HttpContext context, string schoolId, JsonObject body, IAdminOrganizationService service, CancellationToken cancellationToken) =>
Execute(context, service.UpdateSchoolAsync(Token(context), schoolId, body, cancellationToken)));
endpoints.MapPost("/api/admin/classes", (HttpContext context, JsonObject body, IAdminOrganizationService service, CancellationToken cancellationToken) =>
Execute(context, service.CreateClassAsync(Token(context), body, cancellationToken)));
endpoints.MapPatch("/api/admin/classes/{classId}", (HttpContext context, string classId, JsonObject body, IAdminOrganizationService service, CancellationToken cancellationToken) =>
Execute(context, service.UpdateClassAsync(Token(context), classId, body, cancellationToken)));
endpoints.MapPost("/api/admin/admins", (HttpContext context, JsonObject body, IAdminOrganizationService service, CancellationToken cancellationToken) =>
Execute(context, service.CreateAdminAsync(Token(context), body, cancellationToken)));
endpoints.MapPatch("/api/admin/admins/{adminId}", (HttpContext context, string adminId, JsonObject body, IAdminOrganizationService service, CancellationToken cancellationToken) =>
Execute(context, service.UpdateAdminAsync(Token(context), adminId, body, cancellationToken)));
endpoints.MapPost("/api/admin/admins/{adminId}/reset-password", (HttpContext context, string adminId, IAdminOrganizationService service, CancellationToken cancellationToken) =>
Execute(context, service.ResetAdminPasswordAsync(Token(context), adminId, cancellationToken)));
endpoints.MapPut("/api/admin/settings/self-registration", (HttpContext context, JsonObject body, IAdminOrganizationService service, CancellationToken cancellationToken) =>
Execute(context, service.UpdateSelfRegistrationAsync(Token(context), body, cancellationToken)));
if (options.NativeOrganizationWritesEnabled)
{
endpoints.MapPost("/api/admin/schools", (HttpContext context, JsonObject body, IAdminOrganizationService service, CancellationToken cancellationToken) =>
Execute(context, service.CreateSchoolAsync(Token(context), body, cancellationToken)));
endpoints.MapPatch("/api/admin/schools/{schoolId}", (HttpContext context, string schoolId, JsonObject body, IAdminOrganizationService service, CancellationToken cancellationToken) =>
Execute(context, service.UpdateSchoolAsync(Token(context), schoolId, body, cancellationToken)));
endpoints.MapPost("/api/admin/classes", (HttpContext context, JsonObject body, IAdminOrganizationService service, CancellationToken cancellationToken) =>
Execute(context, service.CreateClassAsync(Token(context), body, cancellationToken)));
endpoints.MapPatch("/api/admin/classes/{classId}", (HttpContext context, string classId, JsonObject body, IAdminOrganizationService service, CancellationToken cancellationToken) =>
Execute(context, service.UpdateClassAsync(Token(context), classId, body, cancellationToken)));
endpoints.MapPost("/api/admin/admins", (HttpContext context, JsonObject body, IAdminOrganizationService service, CancellationToken cancellationToken) =>
Execute(context, service.CreateAdminAsync(Token(context), body, cancellationToken)));
endpoints.MapPatch("/api/admin/admins/{adminId}", (HttpContext context, string adminId, JsonObject body, IAdminOrganizationService service, CancellationToken cancellationToken) =>
Execute(context, service.UpdateAdminAsync(Token(context), adminId, body, cancellationToken)));
endpoints.MapPost("/api/admin/admins/{adminId}/reset-password", (HttpContext context, string adminId, IAdminOrganizationService service, CancellationToken cancellationToken) =>
Execute(context, service.ResetAdminPasswordAsync(Token(context), adminId, cancellationToken)));
endpoints.MapPut("/api/admin/settings/self-registration", (HttpContext context, JsonObject body, IAdminOrganizationService service, CancellationToken cancellationToken) =>
Execute(context, service.UpdateSelfRegistrationAsync(Token(context), body, cancellationToken)));
}
if (!options.NativeAccountBatchesEnabled) return endpoints;
endpoints.MapGet("/api/admin/candidate-account-batches", (HttpContext context, IAdminAccountBatchService service, CancellationToken cancellationToken) =>
Execute(context, service.GetAsync(Token(context), cancellationToken)));
endpoints.MapPost("/api/admin/candidate-account-batches", (HttpContext context, JsonObject body, IAdminAccountBatchService service, CancellationToken cancellationToken) =>
Execute(context, service.SubmitAsync(Token(context), body, cancellationToken)));
endpoints.MapPatch("/api/admin/candidate-account-batches/{batchId}", (HttpContext context, string batchId, JsonObject body, IAdminAccountBatchService service, CancellationToken cancellationToken) =>
Execute(context, service.ReviewAsync(Token(context), batchId, body, cancellationToken)));
return endpoints;
}
+6 -1
View File
@@ -46,7 +46,8 @@ var adminMigrationOptions = AdminMigrationOptions.FromEnvironment(
builder.Configuration.GetValue<bool>("AdminMigration:NativeReadsEnabled"),
authenticationOptions.NativeEnabled,
authenticationOptions.SharesLegacySessions,
builder.Configuration.GetValue<bool>("AdminMigration:NativeOrganizationWritesEnabled"));
builder.Configuration.GetValue<bool>("AdminMigration:NativeOrganizationWritesEnabled"),
builder.Configuration.GetValue<bool>("AdminMigration:NativeAccountBatchesEnabled"));
builder.Services.AddEisInfrastructure(
DatabaseOptions.FromEnvironment(applicationRoot, builder.Environment.IsProduction()),
DocumentVerificationOptions.FromEnvironment(builder.Environment.IsProduction()),
@@ -102,6 +103,7 @@ app.MapGet("/health/migration", async (LegacyApiProxy proxy, CancellationToken c
{
nativeReadsEnabled = adminMigrationOptions.NativeReadsEnabled,
nativeOrganizationWritesEnabled = adminMigrationOptions.NativeOrganizationWritesEnabled,
nativeAccountBatchesEnabled = adminMigrationOptions.NativeAccountBatchesEnabled,
nativeRoutes = (adminMigrationOptions.NativeReadsEnabled
? new[] { "GET context", "GET dashboard", "GET schools", "GET school-organization", "GET admins", "GET exams" }
: [])
@@ -112,6 +114,9 @@ app.MapGet("/health/migration", async (LegacyApiProxy proxy, CancellationToken c
"POST admin password reset", "PUT self-registration setting"
}
: [])
.Concat(adminMigrationOptions.NativeAccountBatchesEnabled
? new[] { "GET/POST/PATCH candidate-account-batches" }
: [])
.ToArray()
},
features = MigrationFeatureCatalog.Current(authenticationOptions.NativeEnabled, candidateMigrationOptions.NativeEnabled)
+2 -1
View File
@@ -11,7 +11,8 @@
},
"AdminMigration": {
"NativeReadsEnabled": false,
"NativeOrganizationWritesEnabled": false
"NativeOrganizationWritesEnabled": false,
"NativeAccountBatchesEnabled": false
},
"Logging": {
"LogLevel": {