feat(platform): 部署配置向导 + 地图管理,地图编辑器接入统一存取与 AI 助手
- 配置向导:登录按 deployment 画像引导平台选型(导航方式/模块/场景),未完成则路由守卫强制进入 /wizard;选型驱动菜单按需裁剪,并联动 SimpleLite 写 plugins/active-scenes.json + 透传 --scenes 选择性加载导航场景插件 - 地图管理页:服务器地图列表/使用/重命名/删除、地图合并、多地图连接管理 - 地图编辑器:项目存取改为存入地图管理统一目录(同名替换确认),支持 ?map=/?new= 进入,新增右侧可停靠 AI 助手面板 - 集成 PTL 拣选模块;新增车队分配面板(运维总览/筛选联动) - SimpleLiteBuildSync 同步运行时依赖 DLL;重新构建前端静态资源 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -5,7 +5,7 @@ namespace MiGu.Server.Configs;
|
||||
|
||||
/// <summary>
|
||||
/// 配置中心存储(内存 + JSON 文件持久化占位)。
|
||||
/// 14 个 section 对应 ARCHITECTURE.md §9 的 13+1 维度。
|
||||
/// 前 14 个 section 对应 ARCHITECTURE.md §9 的 13+1 维度;外加 deployment —— 登录后「配置向导」的部署画像。
|
||||
/// 真实落地时由 SimpleShared.Persistence 接入 EF Core,并配合 YARP 下发至 SimpleLite。
|
||||
/// </summary>
|
||||
public sealed class ConfigStore
|
||||
@@ -13,7 +13,8 @@ public sealed class ConfigStore
|
||||
public static readonly string[] AllSections =
|
||||
{
|
||||
"system", "integrations", "routing", "vehicle", "charge", "task",
|
||||
"traffic", "auth", "device", "fleet", "scenario", "location", "ops", "widget"
|
||||
"traffic", "auth", "device", "fleet", "scenario", "location", "ops", "widget",
|
||||
"deployment"
|
||||
};
|
||||
|
||||
public sealed record Envelope(string Section, int Version, DateTimeOffset UpdatedAt, object Payload);
|
||||
@@ -67,6 +68,46 @@ public sealed class ConfigStore
|
||||
|
||||
public IEnumerable<Envelope> List() => AllSections.Select(Get);
|
||||
|
||||
/// <summary>
|
||||
/// 强类型读取部署画像(<c>deployment</c> section)。兼容 Payload 为 <see cref="DeploymentProfile"/>(默认值场景)
|
||||
/// 或 <see cref="JsonElement"/>(已持久化场景)两种形态,并把 null 列表/空字符串规整为安全默认值,
|
||||
/// 供 AuthController(NeedsWizard)/ WizardController / Launcher 直接使用。
|
||||
/// </summary>
|
||||
public DeploymentProfile GetDeployment()
|
||||
{
|
||||
var env = Get("deployment");
|
||||
var dp = env.Payload switch
|
||||
{
|
||||
DeploymentProfile d => d,
|
||||
JsonElement el => SafeDeserializeDeployment(el),
|
||||
_ => DeploymentProfile.Default()
|
||||
};
|
||||
return new DeploymentProfile(
|
||||
dp.Configured,
|
||||
string.IsNullOrWhiteSpace(dp.PlatformType) ? "standard" : dp.PlatformType,
|
||||
dp.Modules ?? new List<string>(),
|
||||
dp.NavigationKinds ?? new List<string>(),
|
||||
dp.Scenarios ?? new List<string>(),
|
||||
dp.UpdatedBy ?? "");
|
||||
}
|
||||
|
||||
/// <summary>以强类型保存部署画像(统一经 <see cref="Put"/> 走版本/持久化/camelCase 序列化)。</summary>
|
||||
public Envelope PutDeployment(DeploymentProfile profile)
|
||||
{
|
||||
var el = JsonSerializer.SerializeToElement(profile, _jsonOpts);
|
||||
return Put("deployment", el);
|
||||
}
|
||||
|
||||
private DeploymentProfile SafeDeserializeDeployment(JsonElement el)
|
||||
{
|
||||
try { return el.Deserialize<DeploymentProfile>(_jsonOpts) ?? DeploymentProfile.Default(); }
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "反序列化 deployment 失败,回退默认值");
|
||||
return DeploymentProfile.Default();
|
||||
}
|
||||
}
|
||||
|
||||
private static object JsonElementToObject(JsonElement el)
|
||||
{
|
||||
// 简化:直接保留 JsonElement,让 STJ 在响应时再原样写回
|
||||
@@ -126,6 +167,7 @@ public sealed class ConfigStore
|
||||
"location" => LocationManagement.Default(),
|
||||
"ops" => OpsConfig.Default(),
|
||||
"widget" => CustomWidgetConfig.Default(),
|
||||
"deployment" => DeploymentProfile.Default(),
|
||||
_ => new { }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user