track/src/SJZY.Track.Domain/Dtos/Forewarning/GetWarningNotifiesVo.cs

131 lines
3.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Text;
using NUglify.Helpers;
using SJZY.Track.Domain.Enums;
namespace SJZY.Track.Domain.Dtos.Forewarning;
public class GetWarningNotifiesVo
{
/// <summary>
/// 规则 id
/// </summary>
public int RuleId { get; set; }
/// <summary>
/// 预警名称
/// </summary>
public string WarningName { get; set; } = null!;
/// <summary>
/// 时效(小时)
/// </summary>
public float TotalTimeSpan { get; set; }
/// <summary>
/// 提醒的时间(小时)
/// </summary>
public float WarnTimeSpan { get; set; }
/// <summary>
/// 提醒次数
/// </summary>
public int WarnCount { get; set; }
/// <summary>
/// 起始轨迹状态(冗余)
/// </summary>
public string StartTrackStatus { get; set; } = null!;
/// <summary>
/// 终止轨迹状态(冗余)
/// </summary>
public string EndTrackStatus { get; set; } = null!;
/// <summary>
/// 货物类型
/// </summary>
public string? CargoType { get; set; }
/// <summary>
/// 月份
/// </summary>
public string? Months { get; set; }
/// <summary>
/// 区域
/// </summary>
public string? AreaName { get; set; }
/// <summary>
/// 是否中转
/// </summary>
public bool? IsTransit { get; set; }
/// <summary>
/// 起运港口
/// </summary>
public string? LeavePort { get; set; }
/// <summary>
/// 产品编码
/// </summary>
public string? ProductCode { get; set; }
/// <summary>
/// 通知方式
/// </summary>
public NotifyMode NotifyMode { get; set; }
/// <summary>
/// 通知模板
/// </summary>
public string NotifyTemplate { get; set; } = null!;
/// <summary>
/// 通知人
/// </summary>
public int NotifyUserId { get; set; }
/// <summary>
/// 因素类型排序
/// </summary>
public string FactorTypeSort { get; set; } = null!;
public override string ToString()
{
// {起飞-落地+普货+1/2/3/4+美国 时效9,预警时效7,次数3}
var res = new StringBuilder();
res.Append('{');
res.Append($"{StartTrackStatus}-{EndTrackStatus}");
FactorTypeSort.Split(",").Select(Enum.Parse<RuleFactorType>).ForEach(factorType =>
{
switch (factorType)
{
case RuleFactorType.CargoType:
res.Append($"+{CargoType}");
break;
case RuleFactorType.Months:
res.Append($"+{Months}");
break;
case RuleFactorType.Area:
res.Append($"+{AreaName}");
break;
case RuleFactorType.IsTransit:
res.Append($"+{(IsTransit?? false? "中转":"直飞")}");
break;
case RuleFactorType.LeavePort:
res.Append($"+{LeavePort}");
break;
case RuleFactorType.ProductCode:
res.Append($"+{ProductCode}");
break;
default:
throw new ArgumentOutOfRangeException(nameof(factorType), factorType, null);
}
});
res.Append($" 时效{TotalTimeSpan},预警时效{WarnTimeSpan},次数{WarnCount}}}");
return res.ToString();
}
}