更新项目配置,新增设备同步模块,优化WebSocket和Swagger配置,增强SCADA系统的免登录接口,支持数据字典项和登录日志的免登录查询与记录。调整Java编译设置,确保更好的开发体验。

This commit is contained in:
geht
2026-04-28 10:23:58 +08:00
parent bbe46dcf2d
commit 142a0bdaba
1013 changed files with 41858 additions and 28 deletions

View File

@@ -0,0 +1,13 @@
using Prism.Events;
namespace YY.Admin.Core.Events;
public sealed class NetworkStatusChangedPayload
{
public bool IsOnline { get; set; }
public DateTime ChangedAt { get; set; }
}
public class NetworkStatusChangedEvent : PubSubEvent<NetworkStatusChangedPayload>
{
}

View File

@@ -0,0 +1,13 @@
using Prism.Events;
namespace YY.Admin.Core.Events;
public sealed class RemoteCommandPayload
{
public string DeviceId { get; set; } = string.Empty;
public string CommandJson { get; set; } = string.Empty;
}
public class RemoteCommandReceivedEvent : PubSubEvent<RemoteCommandPayload>
{
}

View File

@@ -0,0 +1,7 @@
using Prism.Events;
namespace YY.Admin.Core.Events;
public class SyncCompletedEvent : PubSubEvent<string>
{
}

View File

@@ -0,0 +1,25 @@
using SqlSugar;
namespace YY.Admin.Core.Models;
/// <summary>
/// 设备本地状态快照。
/// </summary>
[SugarTable("device_status_snapshot")]
public class DeviceStatus
{
[SugarColumn(IsPrimaryKey = true, Length = 64)]
public string DeviceId { get; set; } = string.Empty;
[SugarColumn(IsNullable = false)]
public bool IsOnline { get; set; }
[SugarColumn(IsNullable = true)]
public DateTime? LastHeartbeatAt { get; set; }
[SugarColumn(ColumnDataType = "TEXT", IsNullable = true)]
public string? StatusJson { get; set; }
[SugarColumn(IsNullable = false)]
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
}

View File

@@ -0,0 +1,43 @@
using SqlSugar;
namespace YY.Admin.Core.Models;
/// <summary>
/// 断联续传消息实体。
/// </summary>
[SugarTable("outbox_messages")]
public class OutboxMessage
{
[SugarColumn(IsPrimaryKey = true, Length = 64)]
public string Id { get; set; } = Guid.NewGuid().ToString("N");
[SugarColumn(Length = 128, IsNullable = false)]
public string AggregateType { get; set; } = string.Empty;
[SugarColumn(Length = 128, IsNullable = false)]
public string AggregateId { get; set; } = string.Empty;
[SugarColumn(Length = 128, IsNullable = false)]
public string EventType { get; set; } = string.Empty;
[SugarColumn(ColumnDataType = "TEXT", IsNullable = false)]
public string Payload { get; set; } = string.Empty;
[SugarColumn(IsNullable = false)]
public int Status { get; set; }
[SugarColumn(IsNullable = false)]
public int RetryCount { get; set; }
[SugarColumn(Length = 2000, IsNullable = true)]
public string? ErrorMessage { get; set; }
[SugarColumn(IsNullable = false)]
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
[SugarColumn(IsNullable = true)]
public DateTime? LastTriedAt { get; set; }
[SugarColumn(IsNullable = true)]
public DateTime? SentAt { get; set; }
}

View File

@@ -0,0 +1,9 @@
namespace YY.Admin.Core.Services;
/// <summary>
/// 通过 RESTSCADA拉取用户并写入本地 jeecg_sys_user供 Outbox 统一线路消费。
/// </summary>
public interface IJeecgUserMirrorPullHandler
{
Task<bool> ExecutePullAsync(CancellationToken cancellationToken = default);
}

View File

@@ -0,0 +1,9 @@
namespace YY.Admin.Core.Services;
/// <summary>
/// 将「需拉取 Jeecg 用户镜像」写入 Outbox断网不丢、联网续传由 Services 侧协调器调用。
/// </summary>
public interface IJeecgUserMirrorPullOutbox
{
Task EnqueuePullAsync(string eventType, string? payloadJson, CancellationToken cancellationToken = default);
}

View File

@@ -0,0 +1,8 @@
namespace YY.Admin.Core.Services;
public interface INetworkMonitor
{
bool IsOnline { get; }
event Action<bool>? StatusChanged;
Task StartAsync(CancellationToken cancellationToken = default);
}

View File

@@ -0,0 +1,13 @@
namespace YY.Admin.Core.Services;
public interface ISignalRService
{
Task ConnectAsync(string token, CancellationToken cancellationToken = default);
/// <summary>
/// 设备同步统一通道STOMP 订阅 /topic/sync/jeecg-users免密或带设备 Token与 Outbox+REST 同属一条规范线路。
/// </summary>
Task ConnectUnifiedDeviceChannelAsync(CancellationToken cancellationToken = default);
Task SendDeviceStatusAsync(object status, CancellationToken cancellationToken = default);
}

View File

@@ -0,0 +1,11 @@
namespace YY.Admin.Core.Sync;
/// <summary>
/// 用户镜像同步在 Outbox 中的聚合类型(与设备批量上报区分,走本地拉取 REST 而非 /sys/sync/batch
/// </summary>
public static class JeecgUserMirrorOutbox
{
public const string AggregateType = "JeecgUserMirror";
public const string EventSignal = "Signal";
public const string EventBoot = "Boot";
}