using System.Text;
using NUglify.Helpers;
using SJZY.Track.Domain.Enums;
namespace SJZY.Track.Domain.Dtos.Forewarning;
public class GetWarningNotifiesVo
{
///
/// 规则 id
///
public int RuleId { get; set; }
///
/// 预警名称
///
public string WarningName { get; set; } = null!;
///
/// 时效(小时)
///
public float TotalTimeSpan { get; set; }
///
/// 提醒的时间(小时)
///
public float WarnTimeSpan { get; set; }
///
/// 提醒次数
///
public int WarnCount { get; set; }
///
/// 起始轨迹状态(冗余)
///
public string StartTrackStatus { get; set; } = null!;
///
/// 终止轨迹状态(冗余)
///
public string EndTrackStatus { get; set; } = null!;
///
/// 货物类型
///
public string? CargoType { get; set; }
///
/// 月份
///
public string? Months { get; set; }
///
/// 区域
///
public string? AreaName { get; set; }
///
/// 是否中转
///
public bool? IsTransit { get; set; }
///
/// 起运港口
///
public string? LeavePort { get; set; }
///
/// 产品编码
///
public string? ProductCode { get; set; }
///
/// 通知方式
///
public NotifyMode NotifyMode { get; set; }
///
/// 通知模板
///
public string NotifyTemplate { get; set; } = null!;
///
/// 通知人
///
public int NotifyUserId { get; set; }
///
/// 因素类型排序
///
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).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();
}
}