46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
using System.Text.Json.Serialization;
|
|
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
|
|
|
namespace SJZY.Track.Application.Services.Warning.Signals;
|
|
|
|
/// <summary>
|
|
/// 预警信号,目前只是操作轨迹时产生
|
|
/// 未来可以通过扩展类型+扩展字段的形式增加更多种预警触发源
|
|
/// </summary>
|
|
public readonly struct WarningSignal
|
|
{
|
|
public WarningSignalType Type { get; }
|
|
|
|
public int OrderId { get; }
|
|
public string EsId { get; }
|
|
public int TrackStatusId { get; }
|
|
public int TrackContentId { get; }
|
|
|
|
// public string OrderNo { get; set; }
|
|
// public int OrderType { get; set; }
|
|
// public int SubSystemId { get; set; }
|
|
|
|
[JsonConstructor]
|
|
public WarningSignal(WarningSignalType type, int orderId, string esId, int trackStatusId, int trackContentId)
|
|
{
|
|
Type = type;
|
|
OrderId = orderId;
|
|
EsId = esId;
|
|
TrackStatusId = trackStatusId;
|
|
TrackContentId = trackContentId;
|
|
}
|
|
|
|
public static List<WarningSignal> FromTrack(List<TrackDetailsIndex> tracks, WarningSignalType type)
|
|
{
|
|
return tracks
|
|
.Select(x => new WarningSignal(
|
|
type,
|
|
x.OrderId,
|
|
x.Id,
|
|
x.TrackStatusId,
|
|
x.TrackContentId
|
|
))
|
|
.ToList();
|
|
}
|
|
}
|