12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using Quartz;
- using System;
- using System.Linq;
- using System.Threading.Tasks;
- using ToolLibrary.LogHelper;
- using Yunda.ISAS.DataMonitoringServer.WebSocket.Model;
- using YunDa.ISAS.Redis.Entities.AlarmCategory;
- namespace Yunda.ISAS.DataMonitoringServer.TimeWorkers
- {
- /// <summary>
- /// 报警队列推送
- /// </summary>
- [DisallowConcurrentExecution]
- public class AlarmQueueTimeJob : IJob
- {
- public async Task Execute(IJobExecutionContext context)
- {
-
- try
- {
- var list =await TimeWorkService._redisDataRepository.AlarmListRedis.HashSetGetAllAsync(nameof(AlarmListRedis));
- if (list != null && list.Count > 0)
- {
- var orders = list.OrderByDescending(t => DateTime.Parse(t.AlarmDateTime));
- //.OrderBy(t => t.IsClear)
- //.ThenBy(t => t.DMAlarmCategory.Level);
- var msg = new DataMonitorMessageModel()
- {
- MessageType = MessgeTypeEnum.AlarmQueue,
- Content = orders,
- GroupType = GroupTypeEnum.All
- };
- TimeWorkService._webSocketServer.SendMsg(msg);
- }
- }
- catch (System.Exception ex)
- {
- Log4Helper.Error(this.GetType(), "报警队列推送", ex);
- }
- }
- }
- }
|