Compare commits
No commits in common. "b0d17b0466116f6c2b6c804946202fa0732d4a67" and "289811e0e6a445d80df3d53384c6eda502bbe64c" have entirely different histories.
b0d17b0466
...
289811e0e6
|
|
@ -207,7 +207,7 @@ app.UseExceptionHandler(o => { });
|
||||||
app.UseIRacisHostStaticFileStore(env);
|
app.UseIRacisHostStaticFileStore(env);
|
||||||
|
|
||||||
//本地化
|
//本地化
|
||||||
await app.UseLocalization(app.Services);
|
app.UseLocalization(app.Services);
|
||||||
|
|
||||||
app.UseForwardedHeaders();
|
app.UseForwardedHeaders();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,18 @@
|
||||||
using IRaCIS.Core.Application.Helper;
|
using IRaCIS.Core.Domain.Share;
|
||||||
using IRaCIS.Core.Domain.Models;
|
|
||||||
using IRaCIS.Core.Domain.Share;
|
|
||||||
using IRaCIS.Core.Infra.EFCore;
|
|
||||||
using IRaCIS.Core.Infrastructure.Extention;
|
using IRaCIS.Core.Infrastructure.Extention;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Localization;
|
using Microsoft.Extensions.Localization;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace IRaCIS.Core.API
|
namespace IRaCIS.Core.API
|
||||||
{
|
{
|
||||||
public static class LocalizationConfig
|
public static class LocalizationConfig
|
||||||
{
|
{
|
||||||
|
|
||||||
public static async Task UseLocalization(this IApplicationBuilder app,IServiceProvider serviceProvider)
|
public static void UseLocalization(this IApplicationBuilder app,IServiceProvider serviceProvider)
|
||||||
{
|
{
|
||||||
var supportedCultures = new List<CultureInfo>
|
var supportedCultures = new List<CultureInfo>
|
||||||
{
|
{
|
||||||
|
|
@ -44,24 +38,6 @@ namespace IRaCIS.Core.API
|
||||||
//设置国际化I18n
|
//设置国际化I18n
|
||||||
var localizer = serviceProvider.GetRequiredService<IStringLocalizer>();
|
var localizer = serviceProvider.GetRequiredService<IStringLocalizer>();
|
||||||
I18n.SetLocalizer(localizer);
|
I18n.SetLocalizer(localizer);
|
||||||
|
|
||||||
//初始化国际化
|
|
||||||
|
|
||||||
var _internationalizationRepository = serviceProvider.GetRequiredService<IRepository<Internationalization>>();
|
|
||||||
|
|
||||||
//查询数据库的数据
|
|
||||||
var toJsonList = await _internationalizationRepository.Where(t => t.InternationalizationType == 1).Select(t => new IRCGlobalInfoDTO()
|
|
||||||
{
|
|
||||||
Code = t.Code,
|
|
||||||
Value = t.Value,
|
|
||||||
ValueCN = t.ValueCN,
|
|
||||||
Description = t.Description
|
|
||||||
}).ToListAsync();
|
|
||||||
|
|
||||||
|
|
||||||
await InternationalizationHelper.BatchAddJsonKeyValueAsync(toJsonList);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
using IRaCIS.Core.Domain.BaseModel;
|
using IRaCIS.Core.Domain.BaseModel;
|
||||||
using MassTransit;
|
using MassTransit;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace IRaCIS.Core.API
|
namespace IRaCIS.Core.API
|
||||||
{
|
{
|
||||||
|
|
@ -31,13 +30,12 @@ namespace IRaCIS.Core.API
|
||||||
// 自动扫描程序集中的消费者并进行注册
|
// 自动扫描程序集中的消费者并进行注册
|
||||||
cfg.AddConsumers(typeof(UserSiteSurveySubmitedEventConsumer).Assembly);
|
cfg.AddConsumers(typeof(UserSiteSurveySubmitedEventConsumer).Assembly);
|
||||||
|
|
||||||
|
//// 注册消费者
|
||||||
|
//cfg.AddConsumer<AddSubjectTriggerConsumer>(); // 替换为你的消费者类
|
||||||
//Uri schedulerEndpoint = new Uri("queue:scheduler");
|
//cfg.AddConsumer<AddSubjectTriggerConsumer2>();
|
||||||
//cfg.AddMessageScheduler(schedulerEndpoint);
|
|
||||||
|
|
||||||
cfg.AddPublishMessageScheduler();
|
cfg.AddPublishMessageScheduler();
|
||||||
cfg.AddHangfireConsumers();
|
//cfg.AddHangfireConsumers();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -47,11 +45,8 @@ namespace IRaCIS.Core.API
|
||||||
//https://github.com/MassTransit/Sample-Hangfire/blob/master/src/Sample.Hangfire.Console/Program.cs
|
//https://github.com/MassTransit/Sample-Hangfire/blob/master/src/Sample.Hangfire.Console/Program.cs
|
||||||
cfg.UsePublishMessageScheduler();
|
cfg.UsePublishMessageScheduler();
|
||||||
|
|
||||||
//cfg.UseMessageScheduler(schedulerEndpoint);
|
|
||||||
|
|
||||||
|
|
||||||
//使用 Hangfire 进行消息调度
|
//使用 Hangfire 进行消息调度
|
||||||
//cfg.UseHangfireScheduler();
|
cfg.UseHangfireScheduler();
|
||||||
|
|
||||||
cfg.UseConsumeFilter(typeof(CultureInfoFilter<>), context,
|
cfg.UseConsumeFilter(typeof(CultureInfoFilter<>), context,
|
||||||
x => x.Include(type => type.IsAssignableTo(typeof(DomainEvent))));
|
x => x.Include(type => type.IsAssignableTo(typeof(DomainEvent))));
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
using Hangfire;
|
using Hangfire;
|
||||||
using Hangfire.Storage;
|
using Hangfire.Storage;
|
||||||
using IRaCIS.Core.Application.Helper;
|
using IRaCIS.Core.Application.Helper;
|
||||||
using IRaCIS.Core.Application.MassTransit.Consumer;
|
|
||||||
using IRaCIS.Core.Domain.Models;
|
using IRaCIS.Core.Domain.Models;
|
||||||
using IRaCIS.Core.Domain.Share;
|
using IRaCIS.Core.Domain.Share;
|
||||||
using MassTransit;
|
using MassTransit;
|
||||||
using MassTransit.Mediator;
|
|
||||||
using MassTransit.Scheduling;
|
using MassTransit.Scheduling;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
|
@ -20,8 +18,7 @@ namespace IRaCIS.Core.Application.Service.BackGroundJob
|
||||||
public class IRaCISCHangfireJob(ILogger<IRaCISCHangfireJob> _logger,
|
public class IRaCISCHangfireJob(ILogger<IRaCISCHangfireJob> _logger,
|
||||||
IRepository<Internationalization> _internationalizationRepository,
|
IRepository<Internationalization> _internationalizationRepository,
|
||||||
IRepository<TrialEmailNoticeConfig> _trialEmailNoticeConfigRepository,
|
IRepository<TrialEmailNoticeConfig> _trialEmailNoticeConfigRepository,
|
||||||
IMessageScheduler _iMessageScheduler,
|
IMessageScheduler _IMessageScheduler
|
||||||
IBus _bus
|
|
||||||
) : IIRaCISHangfireJob
|
) : IIRaCISHangfireJob
|
||||||
{
|
{
|
||||||
public static string JsonFileFolder = Path.Combine(AppContext.BaseDirectory, StaticData.Folder.Resources);
|
public static string JsonFileFolder = Path.Combine(AppContext.BaseDirectory, StaticData.Folder.Resources);
|
||||||
|
|
@ -31,7 +28,19 @@ namespace IRaCIS.Core.Application.Service.BackGroundJob
|
||||||
{
|
{
|
||||||
_logger.LogInformation("项目启动 hangfire 任务初始化 执行开始~");
|
_logger.LogInformation("项目启动 hangfire 任务初始化 执行开始~");
|
||||||
|
|
||||||
|
//初始化国际化
|
||||||
|
|
||||||
|
//查询数据库的数据
|
||||||
|
var toJsonList = await _internationalizationRepository.Where(t => t.InternationalizationType == 1).Select(t => new IRCGlobalInfoDTO()
|
||||||
|
{
|
||||||
|
Code = t.Code,
|
||||||
|
Value = t.Value,
|
||||||
|
ValueCN = t.ValueCN,
|
||||||
|
Description = t.Description
|
||||||
|
}).ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
|
await InternationalizationHelper.BatchAddJsonKeyValueAsync(toJsonList);
|
||||||
|
|
||||||
//创建邮件定时任务
|
//创建邮件定时任务
|
||||||
await InitSysAndTrialCronJobAsync();
|
await InitSysAndTrialCronJobAsync();
|
||||||
|
|
@ -71,9 +80,7 @@ namespace IRaCIS.Core.Application.Service.BackGroundJob
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//var schedulerEndpoint = await _bus.GetSendEndpoint(new Uri("queue:hangfire"));
|
|
||||||
//await schedulerEndpoint.ScheduleRecurringSend<QCImageQuestionSchedule>(new Uri("queue:mt-message-queue"), new QCImageQuestionSchedule() { ScheduleId = jobId, CronExpression = "0 0/1 * 1/1 * ? *" }, new PollExternalSystem { });
|
|
||||||
//await schedulerEndpoint.ScheduleRecurringSend<QCImageQuestionSchedule>(new Uri("queue:hangfire"), new QCImageQuestionSchedule() { ScheduleId = jobId + jobId, CronExpression = "0 0/1 * 1/1 * ? *" }, new PollExternalSystem { });
|
|
||||||
|
|
||||||
|
|
||||||
HangfireJobHelper.AddOrUpdateTrialCronJob(jobId, task.TrialId, task.BusinessScenarioEnum, task.EmailCron);
|
HangfireJobHelper.AddOrUpdateTrialCronJob(jobId, task.TrialId, task.BusinessScenarioEnum, task.EmailCron);
|
||||||
|
|
@ -81,7 +88,7 @@ namespace IRaCIS.Core.Application.Service.BackGroundJob
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PollExternalSystem { }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12902,14 +12902,14 @@
|
||||||
加急的医学反馈任务 通知MIM
|
加急的医学反馈任务 通知MIM
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.MassTransit.Consumer.UrgentMedicalReviewAddedEventConsumer.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.User},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TaskMedicalReview},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SubjectVisit},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.VisitTask},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Dictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailNoticeConfig},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig})">
|
<member name="M:IRaCIS.Core.Application.MassTransit.Consumer.UrgentMedicalReviewAddedEventConsumer.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.User},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TaskMedicalReview},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.VisitTask},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Dictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailNoticeConfig},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig})">
|
||||||
<summary>
|
<summary>
|
||||||
加急的医学反馈任务 通知MIM
|
加急的医学反馈任务 通知MIM
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.MassTransit.Consumer.UrgentMedicalReviewAddedEventConsumer.Consume(MassTransit.ConsumeContext{IRaCIS.Core.Domain.UrgentMedicalReviewAddedEvent})">
|
<member name="M:IRaCIS.Core.Application.MassTransit.Consumer.UrgentMedicalReviewAddedEventConsumer.Consume(MassTransit.ConsumeContext{IRaCIS.Core.Domain.UrgentMedicalReviewAddedEvent})">
|
||||||
<summary>
|
<summary>
|
||||||
加急的医学反馈任务 通知MIM (026,027)
|
加急的医学反馈任务 通知MIM
|
||||||
</summary>
|
</summary>
|
||||||
<param name="context"></param>
|
<param name="context"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ public class TestMasstransitService : BaseService
|
||||||
await _mediatorScoped.Publish(new MasstransiTestCommand { value = "message at " + DateTime.Now.ToString() });
|
await _mediatorScoped.Publish(new MasstransiTestCommand { value = "message at " + DateTime.Now.ToString() });
|
||||||
|
|
||||||
|
|
||||||
await _scheduler.SchedulePublish(DateTime.Now.AddSeconds(10), new MasstransiTestCommand() { value = "message at " + DateTime.Now.ToString() });
|
//await _scheduler.SchedulePublish(DateTime.Now.AddSeconds(10), new MasstransitHangfireTest() { value = "message at " + DateTime.Now.ToString() });
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
return ResponseOutput.Ok();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using IRaCIS.Core.Application.MassTransit.Command;
|
using MassTransit;
|
||||||
using MassTransit;
|
|
||||||
using MassTransit.Scheduling;
|
using MassTransit.Scheduling;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
@ -23,9 +22,9 @@ public abstract class IRCRecurringSchedule :
|
||||||
public string TimeZoneId { get; protected set; }
|
public string TimeZoneId { get; protected set; }
|
||||||
public DateTimeOffset StartTime { get; protected set; }
|
public DateTimeOffset StartTime { get; protected set; }
|
||||||
public DateTimeOffset? EndTime { get; protected set; }
|
public DateTimeOffset? EndTime { get; protected set; }
|
||||||
public string ScheduleId { get; set; }
|
public string ScheduleId { get; private set; }
|
||||||
public string ScheduleGroup { get; private set; }
|
public string ScheduleGroup { get; private set; }
|
||||||
public string CronExpression { get; set; }
|
public string CronExpression { get; protected set; }
|
||||||
public string Description { get; protected set; }
|
public string Description { get; protected set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,15 +53,4 @@ public class ImageQCSchedule : IRCRecurringSchedule
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class QCImageQuestionScheduleConsumer : IConsumer<QCImageQuestionSchedule>
|
|
||||||
{
|
|
||||||
public Task Consume(ConsumeContext<QCImageQuestionSchedule> context)
|
|
||||||
{
|
|
||||||
Console.WriteLine(DateTime.Now);
|
|
||||||
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ steps:
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
- Test_IRC_Net8—_SCP_Disable
|
- Test_IRC_Net8
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue