学生可在“学籍管理 → 电子成绩单与证明”申请成绩单或学籍证明。
服务端根据登录账号绑定本人档案,不接受学生 ID,无法代他人申请。 成绩单仅包含正式发布成绩;无已发布成绩时明确提示。 同类型、同用途 5 分钟内重复申请复用已有有效凭证。 申请后即时生成 PDF,可在本人凭证列表下载、二维码验真。 管理员的下载记录、失效、重签能力保持不变。
This commit is contained in:
+4579
File diff suppressed because it is too large
Load Diff
+156
@@ -0,0 +1,156 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Jiaowu.Api.Infrastructure.Persistence.Migrations.MySql
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class OfficialDocuments : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "OfficialDocuments",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false),
|
||||
DocumentNumber = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false),
|
||||
VerificationCodeHash = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false),
|
||||
Type = table.Column<int>(type: "int", nullable: false),
|
||||
Status = table.Column<int>(type: "int", nullable: false),
|
||||
StudentId = table.Column<Guid>(type: "char(36)", nullable: false),
|
||||
IssuedByUserId = table.Column<Guid>(type: "char(36)", nullable: false),
|
||||
IssuedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
Purpose = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true),
|
||||
SnapshotJson = table.Column<string>(type: "longtext", nullable: false),
|
||||
PdfContent = table.Column<byte[]>(type: "longblob", nullable: false),
|
||||
PdfSha256 = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false),
|
||||
InvalidatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
InvalidatedByUserId = table.Column<Guid>(type: "char(36)", nullable: true),
|
||||
InvalidationReason = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: true),
|
||||
ReissuedFromDocumentId = table.Column<Guid>(type: "char(36)", nullable: true),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
UpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_OfficialDocuments", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_OfficialDocuments_AspNetUsers_InvalidatedByUserId",
|
||||
column: x => x.InvalidatedByUserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_OfficialDocuments_AspNetUsers_IssuedByUserId",
|
||||
column: x => x.IssuedByUserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_OfficialDocuments_OfficialDocuments_ReissuedFromDocumentId",
|
||||
column: x => x.ReissuedFromDocumentId,
|
||||
principalTable: "OfficialDocuments",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_OfficialDocuments_Students_StudentId",
|
||||
column: x => x.StudentId,
|
||||
principalTable: "Students",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
})
|
||||
.Annotation("MySQL:Charset", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "OfficialDocumentDownloads",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false),
|
||||
OfficialDocumentId = table.Column<Guid>(type: "char(36)", nullable: false),
|
||||
DownloadedByUserId = table.Column<Guid>(type: "char(36)", nullable: false),
|
||||
IpAddress = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true),
|
||||
UserAgent = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: true),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
UpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_OfficialDocumentDownloads", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_OfficialDocumentDownloads_AspNetUsers_DownloadedByUserId",
|
||||
column: x => x.DownloadedByUserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_OfficialDocumentDownloads_OfficialDocuments_OfficialDocument~",
|
||||
column: x => x.OfficialDocumentId,
|
||||
principalTable: "OfficialDocuments",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySQL:Charset", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OfficialDocumentDownloads_DownloadedByUserId_CreatedAt",
|
||||
table: "OfficialDocumentDownloads",
|
||||
columns: new[] { "DownloadedByUserId", "CreatedAt" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OfficialDocumentDownloads_OfficialDocumentId_CreatedAt",
|
||||
table: "OfficialDocumentDownloads",
|
||||
columns: new[] { "OfficialDocumentId", "CreatedAt" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OfficialDocuments_DocumentNumber",
|
||||
table: "OfficialDocuments",
|
||||
column: "DocumentNumber",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OfficialDocuments_InvalidatedByUserId",
|
||||
table: "OfficialDocuments",
|
||||
column: "InvalidatedByUserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OfficialDocuments_IssuedByUserId",
|
||||
table: "OfficialDocuments",
|
||||
column: "IssuedByUserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OfficialDocuments_ReissuedFromDocumentId",
|
||||
table: "OfficialDocuments",
|
||||
column: "ReissuedFromDocumentId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OfficialDocuments_Status_IssuedAt",
|
||||
table: "OfficialDocuments",
|
||||
columns: new[] { "Status", "IssuedAt" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OfficialDocuments_StudentId_IssuedAt",
|
||||
table: "OfficialDocuments",
|
||||
columns: new[] { "StudentId", "IssuedAt" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OfficialDocuments_VerificationCodeHash",
|
||||
table: "OfficialDocuments",
|
||||
column: "VerificationCodeHash",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "OfficialDocumentDownloads");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "OfficialDocuments");
|
||||
}
|
||||
}
|
||||
}
|
||||
+181
@@ -2251,6 +2251,130 @@ namespace Jiaowu.Api.Infrastructure.Persistence.Migrations.MySql
|
||||
b.ToTable("Notifications");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Jiaowu.Api.Domain.Academic.OfficialDocument", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("DocumentNumber")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<DateTime?>("InvalidatedAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<Guid?>("InvalidatedByUserId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("InvalidationReason")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.Property<DateTime>("IssuedAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<Guid>("IssuedByUserId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<byte[]>("PdfContent")
|
||||
.IsRequired()
|
||||
.HasColumnType("longblob");
|
||||
|
||||
b.Property<string>("PdfSha256")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("varchar(64)");
|
||||
|
||||
b.Property<string>("Purpose")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<Guid?>("ReissuedFromDocumentId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("SnapshotJson")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid>("StudentId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("VerificationCodeHash")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("varchar(64)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DocumentNumber")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("InvalidatedByUserId");
|
||||
|
||||
b.HasIndex("IssuedByUserId");
|
||||
|
||||
b.HasIndex("ReissuedFromDocumentId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("VerificationCodeHash")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("Status", "IssuedAt");
|
||||
|
||||
b.HasIndex("StudentId", "IssuedAt");
|
||||
|
||||
b.ToTable("OfficialDocuments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Jiaowu.Api.Domain.Academic.OfficialDocumentDownload", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<Guid>("DownloadedByUserId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("IpAddress")
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("varchar(64)");
|
||||
|
||||
b.Property<Guid>("OfficialDocumentId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("UserAgent")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DownloadedByUserId", "CreatedAt");
|
||||
|
||||
b.HasIndex("OfficialDocumentId", "CreatedAt");
|
||||
|
||||
b.ToTable("OfficialDocumentDownloads");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Jiaowu.Api.Domain.Academic.ScheduleEntry", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@@ -3952,6 +4076,58 @@ namespace Jiaowu.Api.Infrastructure.Persistence.Migrations.MySql
|
||||
b.Navigation("Teacher");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Jiaowu.Api.Domain.Academic.OfficialDocument", b =>
|
||||
{
|
||||
b.HasOne("Jiaowu.Api.Domain.Identity.ApplicationUser", "InvalidatedByUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("InvalidatedByUserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("Jiaowu.Api.Domain.Identity.ApplicationUser", "IssuedByUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("IssuedByUserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Jiaowu.Api.Domain.Academic.OfficialDocument", "ReissuedFromDocument")
|
||||
.WithMany()
|
||||
.HasForeignKey("ReissuedFromDocumentId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("Jiaowu.Api.Domain.Academic.Student", "Student")
|
||||
.WithMany()
|
||||
.HasForeignKey("StudentId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("InvalidatedByUser");
|
||||
|
||||
b.Navigation("IssuedByUser");
|
||||
|
||||
b.Navigation("ReissuedFromDocument");
|
||||
|
||||
b.Navigation("Student");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Jiaowu.Api.Domain.Academic.OfficialDocumentDownload", b =>
|
||||
{
|
||||
b.HasOne("Jiaowu.Api.Domain.Identity.ApplicationUser", "DownloadedByUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("DownloadedByUserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Jiaowu.Api.Domain.Academic.OfficialDocument", "OfficialDocument")
|
||||
.WithMany("Downloads")
|
||||
.HasForeignKey("OfficialDocumentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("DownloadedByUser");
|
||||
|
||||
b.Navigation("OfficialDocument");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Jiaowu.Api.Domain.Academic.ScheduleEntry", b =>
|
||||
{
|
||||
b.HasOne("Jiaowu.Api.Domain.Academic.Classroom", "Classroom")
|
||||
@@ -4373,6 +4549,11 @@ namespace Jiaowu.Api.Infrastructure.Persistence.Migrations.MySql
|
||||
b.Navigation("Invigilators");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Jiaowu.Api.Domain.Academic.OfficialDocument", b =>
|
||||
{
|
||||
b.Navigation("Downloads");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Jiaowu.Api.Domain.Academic.SchedulePlan", b =>
|
||||
{
|
||||
b.Navigation("Entries");
|
||||
|
||||
Reference in New Issue
Block a user