options:将配置提取到外部

This commit is contained in:
hardstylewyl 2025-04-03 15:59:16 +08:00
parent 69aa048ae9
commit b62527f337
2 changed files with 10 additions and 2 deletions

View File

@ -263,6 +263,7 @@ public sealed class WarningNotifyAggregator : ITransientDependency
private List<NotifyConfig> BuildNotifyConfigs(List<WarningNotifyTaskEntity> needNotifyTasks) private List<NotifyConfig> BuildNotifyConfigs(List<WarningNotifyTaskEntity> needNotifyTasks)
{ {
var systemId = _optionsMonitor.CurrentValue.MiddleSystemId;
var result = new List<NotifyConfig>(); var result = new List<NotifyConfig>();
if (needNotifyTasks.Count == 0) return result; if (needNotifyTasks.Count == 0) return result;
@ -302,11 +303,13 @@ public sealed class WarningNotifyAggregator : ITransientDependency
//接收完整预警,命中规则1,通知方式(飞书) ,命中规则2,通知方式(飞书,站内信) //接收完整预警,命中规则1,通知方式(飞书) ,命中规则2,通知方式(飞书,站内信)
//此时聚合后,消息为:总共6条预警消息,其中回传xx条,运输xx条,完整xx条 //此时聚合后,消息为:总共6条预警消息,其中回传xx条,运输xx条,完整xx条
//同时使用飞书和站内信两种方式通知 //同时使用飞书和站内信两种方式通知
result.Add(NotifyConfig.CreateConfig(userId, notifyMessage, new List<int> var config = NotifyConfig.CreateConfig(userId, notifyMessage, new List<int>
{ {
1, 1,
2 2
})); });
config.SystemId = systemId;
result.Add(config);
} }
return result; return result;

View File

@ -2,6 +2,11 @@ namespace SJZY.Track.Application.Options;
public sealed class TrackWarningTaskOptions public sealed class TrackWarningTaskOptions
{ {
/// <summary>
/// 所属子系统id(业务中台id)
/// </summary>
public int MiddleSystemId { get; set; }
/// <summary> 通知任务扫描优先级 </summary> /// <summary> 通知任务扫描优先级 </summary>
public int ScanWarningNotifyTaskLevel { get; set; } public int ScanWarningNotifyTaskLevel { get; set; }