新增车辆表及OTA权限与逻辑优化
新增车辆任务与报警表,完善实体与DbContext配置。细化OTA权限校验,增强回传会话IP安全。优化OTA上传与设置面板,调度器支持重启恢复。报警采集逻辑支持历史分段。
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,103 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MiGu.DB.Migrations.Sqlite
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddFleetTables : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "cdm_tasks",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<string>(type: "TEXT", maxLength: 64, nullable: false),
|
||||
task_id = table.Column<string>(type: "TEXT", maxLength: 128, nullable: true),
|
||||
mission_id = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
mission_name = table.Column<string>(type: "TEXT", maxLength: 128, nullable: false),
|
||||
mission_type = table.Column<string>(type: "TEXT", maxLength: 128, nullable: false),
|
||||
src_site_id = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
src_label = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false),
|
||||
dst_site_id = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
dst_label = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false),
|
||||
status = table.Column<string>(type: "TEXT", maxLength: 32, nullable: false),
|
||||
status_code = table.Column<string>(type: "TEXT", maxLength: 32, nullable: false),
|
||||
car_id = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
car_name = table.Column<string>(type: "TEXT", maxLength: 128, nullable: true),
|
||||
priority = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
create_time = table.Column<string>(type: "TEXT", maxLength: 40, nullable: true),
|
||||
start_time = table.Column<string>(type: "TEXT", maxLength: 40, nullable: true),
|
||||
finish_time = table.Column<string>(type: "TEXT", maxLength: 40, nullable: true),
|
||||
stuck_reason = table.Column<string>(type: "TEXT", maxLength: 512, nullable: true),
|
||||
overdue = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||
first_seen_at = table.Column<string>(type: "TEXT", maxLength: 40, nullable: false),
|
||||
last_seen_at = table.Column<string>(type: "TEXT", maxLength: 40, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_cdm_tasks", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "vehicle_alarms",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<string>(type: "TEXT", maxLength: 36, nullable: false),
|
||||
car_id = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
car_name = table.Column<string>(type: "TEXT", maxLength: 128, nullable: false),
|
||||
info = table.Column<string>(type: "text", nullable: false),
|
||||
level = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
status = table.Column<string>(type: "TEXT", maxLength: 16, nullable: false),
|
||||
first_at = table.Column<string>(type: "TEXT", maxLength: 40, nullable: false),
|
||||
last_at = table.Column<string>(type: "TEXT", maxLength: 40, nullable: false),
|
||||
resolved_at = table.Column<string>(type: "TEXT", maxLength: 40, nullable: true),
|
||||
duration_secs = table.Column<long>(type: "INTEGER", nullable: true),
|
||||
acknowledged = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||
acknowledged_at = table.Column<string>(type: "TEXT", maxLength: 40, nullable: true),
|
||||
acknowledged_by = table.Column<string>(type: "TEXT", maxLength: 128, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_vehicle_alarms", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_cdm_tasks_create_time",
|
||||
table: "cdm_tasks",
|
||||
column: "create_time");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_cdm_tasks_status_code",
|
||||
table: "cdm_tasks",
|
||||
column: "status_code");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_vehicle_alarms_car_id_status",
|
||||
table: "vehicle_alarms",
|
||||
columns: new[] { "car_id", "status" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_vehicle_alarms_first_at",
|
||||
table: "vehicle_alarms",
|
||||
column: "first_at");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_vehicle_alarms_status",
|
||||
table: "vehicle_alarms",
|
||||
column: "status");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "cdm_tasks");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "vehicle_alarms");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,202 @@ namespace MiGu.DB.Migrations.Sqlite
|
||||
b.ToTable("user_dashboard_shortcuts", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MiGu.DB.Domains.Fleet.CdmTaskRecord", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<int?>("CarId")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnName("car_id");
|
||||
|
||||
b.Property<string>("CarName")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("car_name");
|
||||
|
||||
b.Property<string>("CreateTime")
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("create_time");
|
||||
|
||||
b.Property<string>("DstLabel")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("dst_label");
|
||||
|
||||
b.Property<int>("DstSiteId")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnName("dst_site_id");
|
||||
|
||||
b.Property<string>("FinishTime")
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("finish_time");
|
||||
|
||||
b.Property<string>("FirstSeenAt")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("first_seen_at");
|
||||
|
||||
b.Property<string>("LastSeenAt")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("last_seen_at");
|
||||
|
||||
b.Property<int>("MissionId")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnName("mission_id");
|
||||
|
||||
b.Property<string>("MissionName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("mission_name");
|
||||
|
||||
b.Property<string>("MissionTypeName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("mission_type");
|
||||
|
||||
b.Property<bool>("Overdue")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnName("overdue");
|
||||
|
||||
b.Property<int>("Priority")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnName("priority");
|
||||
|
||||
b.Property<string>("SrcLabel")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("src_label");
|
||||
|
||||
b.Property<int>("SrcSiteId")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnName("src_site_id");
|
||||
|
||||
b.Property<string>("StartTime")
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("start_time");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<string>("StatusCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("status_code");
|
||||
|
||||
b.Property<string>("StuckReason")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("stuck_reason");
|
||||
|
||||
b.Property<string>("TaskId")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("task_id");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreateTime");
|
||||
|
||||
b.HasIndex("StatusCode");
|
||||
|
||||
b.ToTable("cdm_tasks", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MiGu.DB.Domains.Fleet.VehicleAlarmRecord", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasMaxLength(36)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<bool>("Acknowledged")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnName("acknowledged");
|
||||
|
||||
b.Property<string>("AcknowledgedAt")
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("acknowledged_at");
|
||||
|
||||
b.Property<string>("AcknowledgedBy")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("acknowledged_by");
|
||||
|
||||
b.Property<int>("CarId")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnName("car_id");
|
||||
|
||||
b.Property<string>("CarName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("car_name");
|
||||
|
||||
b.Property<long?>("DurationSecs")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnName("duration_secs");
|
||||
|
||||
b.Property<string>("FirstAt")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("first_at");
|
||||
|
||||
b.Property<string>("Info")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("info");
|
||||
|
||||
b.Property<string>("LastAt")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("last_at");
|
||||
|
||||
b.Property<int>("Level")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnName("level");
|
||||
|
||||
b.Property<string>("ResolvedAt")
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("resolved_at");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(16)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("FirstAt");
|
||||
|
||||
b.HasIndex("Status");
|
||||
|
||||
b.HasIndex("CarId", "Status");
|
||||
|
||||
b.ToTable("vehicle_alarms", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MiGu.DB.Domains.SimpleFields.SimpleField", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
|
||||
Reference in New Issue
Block a user