事件增加文化属性
continuous-integration/drone/push Build is passing Details

IRC_NewDev
hang 2024-10-11 17:03:02 +08:00
parent 971c4dcf9e
commit ed61419a6a
3 changed files with 25 additions and 10 deletions

View File

@ -22,6 +22,7 @@ using Microsoft.Extensions.Options;
using MiniExcelLibs;
using NPOI.SS.Formula.Functions;
using NPOI.XWPF.UserModel;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Text;
using Tea;
@ -178,7 +179,16 @@ namespace IRaCIS.Core.Application.Service
}
public async Task<IResponseOutput> TestMasstransitHangfire([FromServices] IMessageScheduler _scheduler)
{
await _scheduler.SchedulePublish(DateTime.Now.AddSeconds(10), new MasstransitHangfireTest() { value = "message at " + DateTime.Now.ToString() });
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
var aa = CultureInfo.CurrentCulture.Name;
CultureInfo.CurrentCulture = new CultureInfo(StaticData.CultureInfo.en_US);
var bb = CultureInfo.CurrentCulture.Name;
var isEn_US2 = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
//await _scheduler.SchedulePublish(DateTime.Now.AddSeconds(10), new MasstransitHangfireTest() { value = "message at " + DateTime.Now.ToString() });
return ResponseOutput.Ok();
}

View File

@ -1,6 +1,7 @@
using IRaCIS.Core.Domain.Models;
using MassTransit;
using System.ComponentModel;
using System.Globalization;
namespace IRaCIS.Core.Domain.BaseModel;
@ -22,6 +23,8 @@ public abstract class DomainEvent
/// 在事件产生多少s后开始消费该事件
/// </summary>
public int DelaySeconds{ get; set; }
public string CultureInfoName { get; set; } = CultureInfo.CurrentCulture.Name;
}
/// <summary>

View File

@ -50,7 +50,7 @@ public static class DBContext_Ext
}
//添加进记录
eventStoreList.AddRange(trialSiteSurvey.DomainEvents.Select(t => new EventStoreRecord() { Id = t.EventId, EventType = t.GetType().AssemblyQualifiedName, EventData = t.ToJsonStr() }));
eventStoreList.AddRange(GetStoreEvents(trialSiteSurvey.DomainEvents));
}
@ -86,10 +86,8 @@ public static class DBContext_Ext
subjectVisit.AddDomainEvent(new CheckStateChangedToAuditEvent() { SubjectVisitId = subjectVisit.Id });
}
//添加进记录
eventStoreList.AddRange(subjectVisit.DomainEvents.Select(t => new EventStoreRecord() { Id = t.EventId, EventType = t.GetType().AssemblyQualifiedName, EventData = t.ToJsonStr() }));
eventStoreList.AddRange(GetStoreEvents(subjectVisit.DomainEvents));
}
}
@ -117,7 +115,7 @@ public static class DBContext_Ext
}
//添加进记录
eventStoreList.AddRange(qCChallengeDialog.DomainEvents.Select(t => new EventStoreRecord() { Id = t.EventId, EventType = t.GetType().AssemblyQualifiedName, EventData = t.ToJsonStr() }));
eventStoreList.AddRange(GetStoreEvents(qCChallengeDialog.DomainEvents));
}
}
@ -143,7 +141,7 @@ public static class DBContext_Ext
}
//添加进记录
eventStoreList.AddRange(checkChallengeDialog.DomainEvents.Select(t => new EventStoreRecord() { Id = t.EventId, EventType = t.GetType().AssemblyQualifiedName, EventData = t.ToJsonStr() }));
eventStoreList.AddRange(GetStoreEvents(checkChallengeDialog.DomainEvents));
}
}
@ -180,7 +178,7 @@ public static class DBContext_Ext
taskMedicalReview.AddDomainEvent(new UrgentMedicalReviewAddedEvent() { MedicalReviewId = taskMedicalReview.Id, VisitTaskId = taskMedicalReview.VisitTaskId });
//添加进记录
eventStoreList.AddRange(taskMedicalReview.DomainEvents.Select(t => new EventStoreRecord() { Id = t.EventId, EventType = t.GetType().AssemblyQualifiedName, EventData = t.ToJsonStr() }));
eventStoreList.AddRange(GetStoreEvents(taskMedicalReview.DomainEvents));
}
}
}
@ -221,7 +219,7 @@ public static class DBContext_Ext
}
//添加进记录
eventStoreList.AddRange(readingMedicalReviewDialog.DomainEvents.Select(t => new EventStoreRecord() { Id = t.EventId, EventType = t.GetType().AssemblyQualifiedName, EventData = t.ToJsonStr() }));
eventStoreList.AddRange(GetStoreEvents(readingMedicalReviewDialog.DomainEvents));
}
}
@ -259,7 +257,7 @@ public static class DBContext_Ext
visitTask.AddDomainEvent(new UrgentIRApplyedReReading() { VisitTaskId = visitTask.Id });
//添加进记录
eventStoreList.AddRange(visitTask.DomainEvents.Select(t => new EventStoreRecord() { Id = t.EventId, EventType = t.GetType().AssemblyQualifiedName, EventData = t.ToJsonStr() }));
eventStoreList.AddRange(GetStoreEvents(visitTask.DomainEvents));
}
}
@ -270,6 +268,10 @@ public static class DBContext_Ext
dbContext.EventStoreRecord.AddRange(eventStoreList);
}
private static List<EventStoreRecord> GetStoreEvents(IReadOnlyCollection<DomainEvent> domainEvents)
{
return domainEvents.Select(t => new EventStoreRecord() { Id = t.EventId, EventType = t.GetType().AssemblyQualifiedName, EventData = t.ToJsonStr() }).ToList();
}
public class EnrollmentConfirmAndPD
{
public bool IsEnrollmentConfirm { get; set; }