- 基础资料 / 批量导入
选民名单导入
Excel 首行必须依次为:选民编号、姓名、行政区划代码。系统先预校验,逐行错误清零后才可确认写入。
+ 基础资料 / 批量导入
选民登记
可导入具名选民名单;如身份信息不能上传,则按辖区登记未具名的补充人数。汇总人数不会创建个人选民资料,也不能作为线上投票资格或防重复投票依据。
@if (Model.Message is not null) { @Model.Message
}
+ 不含身份信息的汇总登记
填写后将覆盖该辖区此前的汇总数,并记录操作审计。若同一辖区也已导入具名名单,请只填写未具名的补充人数,避免重复统计。
@if (Model.AggregateRegistrations.Count > 0) { | 行政区划 | 未具名补充人数 | 原因 | 更新时间(UTC) |
@foreach (var row in Model.AggregateRegistrations) { | @row.RegionCode @row.RegionName | @row.RegisteredCount | @row.Reason | @row.UpdatedAtUtc.ToString("u") |
}
}
@if (Model.Preview is not null) { 预校验结果
可导入 @Model.Preview.ValidCount 行;错误 @Model.Preview.ErrorCount 行。
| 行号 | 选民编号 | 姓名 | 行政区划 | 结果 |
@foreach (var row in Model.Preview.Rows) { | @row.RowNumber | @row.VoterNumber | @row.DisplayName | @row.RegionCode | @(row.Error ?? "通过") |
}
}
diff --git a/src/ElectionSystem.Api/Pages/Admin/VoterImport.cshtml.cs b/src/ElectionSystem.Api/Pages/Admin/VoterImport.cshtml.cs
index a22cfe7..6585f86 100644
--- a/src/ElectionSystem.Api/Pages/Admin/VoterImport.cshtml.cs
+++ b/src/ElectionSystem.Api/Pages/Admin/VoterImport.cshtml.cs
@@ -3,23 +3,55 @@ using ElectionSystem.Api.Modules.Voters;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
+using Microsoft.EntityFrameworkCore;
namespace ElectionSystem.Api.Pages.Admin;
[Authorize]
-public sealed class VoterImportModel(VoterImportService importService) : PageModel
+public sealed class VoterImportModel(VoterImportService importService, VoterRegistrationAggregateService aggregateService, ElectionSystem.Api.Infrastructure.Persistence.ElectionDbContext dbContext, RegionScopeService scopeService) : PageModel
{
public VoterImportPreview? Preview { get; private set; }
public string? Message { get; private set; }
+ public IReadOnlyList