Merge branch 'master' of http://192.168.1.2:8033/IRaCIS_Core_Api
						commit
						49749b3f59
					
				| 
						 | 
				
			
			@ -86,6 +86,8 @@
 | 
			
		|||
    <PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="6.0.1" />
 | 
			
		||||
    <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.0" />
 | 
			
		||||
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.10" />
 | 
			
		||||
    <PackageReference Include="Quartz.Extensions.DependencyInjection" Version="3.6.2" />
 | 
			
		||||
    <PackageReference Include="Quartz.Extensions.Hosting" Version="3.6.2" />
 | 
			
		||||
    <PackageReference Include="Serilog.AspNetCore" Version="6.0.1" />
 | 
			
		||||
    <PackageReference Include="Serilog.Enrichers.ClientInfo" Version="1.2.0" />
 | 
			
		||||
    <PackageReference Include="Serilog.Sinks.Email" Version="2.4.0" />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -114,7 +114,7 @@ namespace IRaCIS.Core.API
 | 
			
		|||
            //services.AddDistributedMemoryCache();
 | 
			
		||||
 | 
			
		||||
            // hangfire  定时任务框架  有界面,更友好~
 | 
			
		||||
            services.AddhangfireSetup(_configuration);
 | 
			
		||||
            //services.AddhangfireSetup(_configuration);
 | 
			
		||||
            //  QuartZ 定时任务框架  使用了hangfire 暂时不用,后续需要可以打开,已经配好
 | 
			
		||||
            services.AddQuartZSetup(_configuration);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -181,7 +181,7 @@ namespace IRaCIS.Core.API
 | 
			
		|||
            app.UseLogDashboard("/LogDashboard");
 | 
			
		||||
 | 
			
		||||
            //hangfire
 | 
			
		||||
            app.UseHangfireConfig(env);
 | 
			
		||||
            //app.UseHangfireConfig(env);
 | 
			
		||||
 | 
			
		||||
            ////暂时废弃
 | 
			
		||||
            //app.UseHttpReports();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,8 @@
 | 
			
		|||
 | 
			
		||||
using IRaCIS.Application.Services.BackGroundJob;
 | 
			
		||||
using Microsoft.Extensions.Configuration;
 | 
			
		||||
using Microsoft.Extensions.DependencyInjection;
 | 
			
		||||
using Quartz;
 | 
			
		||||
 | 
			
		||||
namespace IRaCIS.Core.API
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -8,37 +10,35 @@ namespace IRaCIS.Core.API
 | 
			
		|||
    {
 | 
			
		||||
        public static void AddQuartZSetup(this IServiceCollection services, IConfiguration configuration)
 | 
			
		||||
        {
 | 
			
		||||
            //services.AddTransient<CacheTrialStatusQuartZJob>();
 | 
			
		||||
            services.AddTransient<CacheTrialStatusQuartZJob>();
 | 
			
		||||
 | 
			
		||||
            //services.AddQuartz(q =>
 | 
			
		||||
            //{
 | 
			
		||||
            //    // base quartz scheduler, job and trigger configuration
 | 
			
		||||
            services.AddQuartz(q =>
 | 
			
		||||
            {
 | 
			
		||||
                // base quartz scheduler, job and trigger configuration
 | 
			
		||||
 | 
			
		||||
            //    // as of 3.3.2 this also injects scoped services (like EF DbContext) without problems
 | 
			
		||||
            //    q.UseMicrosoftDependencyInjectionJobFactory();
 | 
			
		||||
                // as of 3.3.2 this also injects scoped services (like EF DbContext) without problems
 | 
			
		||||
                q.UseMicrosoftDependencyInjectionJobFactory();
 | 
			
		||||
 | 
			
		||||
            //    // 基本Quartz调度器、作业和触发器配置
 | 
			
		||||
            //    var jobKey = new JobKey("RegularTrialWork", "regularWorkGroup");
 | 
			
		||||
            //    q.AddJob<CacheTrialStatusQuartZJob>(jobKey, j => j
 | 
			
		||||
            //        .WithDescription("Trial regular work")
 | 
			
		||||
            //    );
 | 
			
		||||
            //    q.AddTrigger(t => t
 | 
			
		||||
            //        .WithIdentity("TrialStatusTrigger")
 | 
			
		||||
            //        .ForJob(jobKey)
 | 
			
		||||
            //        //.StartNow()
 | 
			
		||||
            //        //.WithSimpleSchedule(x => x.WithInterval(TimeSpan.FromSeconds(15))//开始秒数 15s
 | 
			
		||||
            //        //    .RepeatForever())//持续工作
 | 
			
		||||
            //        .WithCronSchedule("0 0 0/2 * * ?")//每小时执行一次
 | 
			
		||||
            //        .WithDescription("My regular trial work trigger")
 | 
			
		||||
            //    );
 | 
			
		||||
            //});
 | 
			
		||||
                // 基本Quartz调度器、作业和触发器配置
 | 
			
		||||
                var jobKey = new JobKey("RegularTrialWork", "regularWorkGroup");
 | 
			
		||||
                q.AddJob<CacheTrialStatusQuartZJob>(jobKey, j => j
 | 
			
		||||
                    .WithDescription("Trial regular work")
 | 
			
		||||
                );
 | 
			
		||||
                q.AddTrigger(t => t
 | 
			
		||||
                    .WithIdentity("TrialStatusTrigger")
 | 
			
		||||
                    .ForJob(jobKey)
 | 
			
		||||
                    
 | 
			
		||||
            //// ASP.NET Core hosting
 | 
			
		||||
            //services.AddQuartzServer(options =>
 | 
			
		||||
            //{
 | 
			
		||||
            //    // when shutting down we want jobs to complete gracefully
 | 
			
		||||
            //    options.WaitForJobsToComplete = true;
 | 
			
		||||
            //});
 | 
			
		||||
                    .WithCronSchedule("0 0 * * * ?")
 | 
			
		||||
                    .WithDescription("My regular trial work trigger")
 | 
			
		||||
                );
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            // ASP.NET Core hosting
 | 
			
		||||
            services.AddQuartzHostedService(options =>
 | 
			
		||||
            {
 | 
			
		||||
                // when shutting down we want jobs to complete gracefully
 | 
			
		||||
                options.WaitForJobsToComplete = true;
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,6 +7,7 @@ using IRaCIS.Core.Infra.EFCore;
 | 
			
		|||
using IRaCIS.Core.Domain.Models;
 | 
			
		||||
using Microsoft.Extensions.Logging;
 | 
			
		||||
using Quartz;
 | 
			
		||||
using IRaCIS.Core.Domain.Share;
 | 
			
		||||
 | 
			
		||||
namespace IRaCIS.Application.Services.BackGroundJob
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -17,24 +18,25 @@ namespace IRaCIS.Application.Services.BackGroundJob
 | 
			
		|||
        private readonly IRepository<Trial> _trialRepository;
 | 
			
		||||
        private readonly IEasyCachingProvider _provider;
 | 
			
		||||
        private readonly ILogger<CacheTrialStatusQuartZJob> _logger;
 | 
			
		||||
        private readonly IRepository<SystemAnonymization> _systemAnonymizationRepository;
 | 
			
		||||
 | 
			
		||||
        public CacheTrialStatusQuartZJob(IRepository<Trial> trialRepository, IEasyCachingProvider provider,ILogger<CacheTrialStatusQuartZJob> logger)
 | 
			
		||||
        public CacheTrialStatusQuartZJob(IRepository<Trial> trialRepository, IEasyCachingProvider provider,ILogger<CacheTrialStatusQuartZJob> logger, IRepository<SystemAnonymization> systemAnonymizationRepository)
 | 
			
		||||
        {
 | 
			
		||||
            _trialRepository = trialRepository;
 | 
			
		||||
            _provider = provider;
 | 
			
		||||
            _logger = logger;
 | 
			
		||||
            _systemAnonymizationRepository = systemAnonymizationRepository;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public Task Execute(IJobExecutionContext context)
 | 
			
		||||
        public async Task Execute(IJobExecutionContext context)
 | 
			
		||||
        
 | 
			
		||||
        {
 | 
			
		||||
            _logger.LogInformation($"开始执行QuartZ定时任务作业");
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                var list = _trialRepository.Select(t => new { TrialId = t.Id, TrialStatusStr = t.TrialStatusStr })
 | 
			
		||||
                    .ToList();
 | 
			
		||||
                await MemoryCacheTrialStatus();
 | 
			
		||||
 | 
			
		||||
                list.ForEach(t => _provider.Set(t.TrialId.ToString(), t.TrialStatusStr, TimeSpan.FromDays(1)));
 | 
			
		||||
                await MemoryCacheAnonymizeData();
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception e)
 | 
			
		||||
| 
						 | 
				
			
			@ -42,10 +44,28 @@ namespace IRaCIS.Application.Services.BackGroundJob
 | 
			
		|||
                _logger.LogError($" 查询和缓存过程出现异常"+e.Message);
 | 
			
		||||
            }
 | 
			
		||||
            _logger.LogInformation("QuartZ定时任务作业结束");
 | 
			
		||||
            return Task.CompletedTask;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        public async Task MemoryCacheTrialStatus()
 | 
			
		||||
        {
 | 
			
		||||
            var list = await _trialRepository.Select(t => new { TrialId = t.Id, TrialStatusStr = t.TrialStatusStr })
 | 
			
		||||
                  .ToListAsync();
 | 
			
		||||
 | 
			
		||||
            list.ForEach(t => _provider.Set(t.TrialId.ToString(), t.TrialStatusStr, TimeSpan.FromDays(7)));
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public async Task MemoryCacheAnonymizeData()
 | 
			
		||||
        {
 | 
			
		||||
            var systemAnonymizationList = await _systemAnonymizationRepository.Where(t => t.IsEnable).ToListAsync();
 | 
			
		||||
 | 
			
		||||
            _provider.Set(StaticData.Anonymize.Anonymize_AddFixedFiled, systemAnonymizationList.Where(t => t.IsAdd && t.IsFixed).ToList(), TimeSpan.FromDays(7));
 | 
			
		||||
            _provider.Set(StaticData.Anonymize.Anonymize_AddIRCInfoFiled, systemAnonymizationList.Where(t => t.IsAdd && t.IsFixed == false).ToList(), TimeSpan.FromDays(7));
 | 
			
		||||
            _provider.Set(StaticData.Anonymize.Anonymize_FixedField, systemAnonymizationList.Where(t => t.IsAdd == false && t.IsFixed).ToList(), TimeSpan.FromDays(7));
 | 
			
		||||
            _provider.Set(StaticData.Anonymize.Anonymize_IRCInfoField, systemAnonymizationList.Where(t => t.IsAdd == false && t.IsFixed == false).ToList(), TimeSpan.FromDays(7));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -680,6 +680,11 @@
 | 
			
		|||
            InternationalizationService
 | 
			
		||||
            </summary>	
 | 
			
		||||
        </member>
 | 
			
		||||
        <member name="T:IRaCIS.Core.Application.Service.PublishLogService">
 | 
			
		||||
            <summary>
 | 
			
		||||
            PublishLogService
 | 
			
		||||
            </summary>	
 | 
			
		||||
        </member>
 | 
			
		||||
        <member name="T:IRaCIS.Core.Application.Service.TrialEmailNoticeConfigService">
 | 
			
		||||
            <summary>
 | 
			
		||||
            TrialEmailNoticeConfigService
 | 
			
		||||
| 
						 | 
				
			
			@ -2663,6 +2668,16 @@
 | 
			
		|||
            <param name="inDto"></param>
 | 
			
		||||
            <returns></returns>
 | 
			
		||||
        </member>
 | 
			
		||||
        <member name="P:IRaCIS.Core.Application.Service.Reading.Dto.SubmitClinicalFormInDto.VisitId">
 | 
			
		||||
            <summary>
 | 
			
		||||
            VisitId
 | 
			
		||||
            </summary>
 | 
			
		||||
        </member>
 | 
			
		||||
        <member name="P:IRaCIS.Core.Application.Service.Reading.Dto.SubmitClinicalFormInDto.ReadingId">
 | 
			
		||||
            <summary>
 | 
			
		||||
            VisitId
 | 
			
		||||
            </summary>
 | 
			
		||||
        </member>
 | 
			
		||||
        <member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ClinicalDataTrialSetAddOrEdit.IsApply">
 | 
			
		||||
            <summary>
 | 
			
		||||
            是否应用
 | 
			
		||||
| 
						 | 
				
			
			@ -7975,6 +7990,15 @@
 | 
			
		|||
        <member name="T:IRaCIS.Core.Application.ViewModel.InternationalizationAddOrEdit">
 | 
			
		||||
            <summary> InternationalizationAddOrEdit  列表查询参数模型</summary>
 | 
			
		||||
        </member>
 | 
			
		||||
        <member name="T:IRaCIS.Core.Application.ViewModel.PublishLogView">
 | 
			
		||||
            <summary> PublishLogView  列表视图模型 </summary>
 | 
			
		||||
        </member>
 | 
			
		||||
        <member name="T:IRaCIS.Core.Application.ViewModel.PublishLogQuery">
 | 
			
		||||
            <summary>PublishLogQuery  列表查询参数模型</summary>
 | 
			
		||||
        </member>
 | 
			
		||||
        <member name="T:IRaCIS.Core.Application.ViewModel.PublishLogAddOrEdit">
 | 
			
		||||
            <summary> PublishLogAddOrEdit  列表查询参数模型</summary>
 | 
			
		||||
        </member>
 | 
			
		||||
        <member name="T:IRaCIS.Core.Application.ViewModel.TrialEmailNoticeConfigView">
 | 
			
		||||
            <summary> TrialEmailNoticeConfigView  列表视图模型 </summary>
 | 
			
		||||
        </member>
 | 
			
		||||
| 
						 | 
				
			
			@ -8840,6 +8864,11 @@
 | 
			
		|||
            IInternationalizationService
 | 
			
		||||
            </summary>	
 | 
			
		||||
        </member>
 | 
			
		||||
        <member name="T:IRaCIS.Core.Application.Interfaces.IPublishLogService">
 | 
			
		||||
            <summary>
 | 
			
		||||
            IPublishLogService
 | 
			
		||||
            </summary>	
 | 
			
		||||
        </member>
 | 
			
		||||
        <member name="T:IRaCIS.Core.Application.Interfaces.ITrialEmailNoticeConfigService">
 | 
			
		||||
            <summary>
 | 
			
		||||
            ITrialEmailNoticeConfigService
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,7 +23,7 @@ namespace IRaCIS.Core.Application.ViewModel
 | 
			
		|||
    public class InternationalizationQuery : PageInput
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        public string? FolderPath { get; set; }
 | 
			
		||||
        public string? Description { get; set; }
 | 
			
		||||
        public string? Code { get; set; }
 | 
			
		||||
        public string? Value { get; set; }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -36,7 +36,7 @@ namespace IRaCIS.Core.Application.ViewModel
 | 
			
		|||
    {
 | 
			
		||||
        public Guid? Id { get; set; }
 | 
			
		||||
        public int State { get; set; }
 | 
			
		||||
        public string FolderPath { get; set; }
 | 
			
		||||
        public string Description { get; set; }
 | 
			
		||||
        public string Code { get; set; }
 | 
			
		||||
        public string Value { get; set; }
 | 
			
		||||
        public string ValueCN { get; set; }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,14 +24,15 @@ namespace IRaCIS.Core.Application.Service
 | 
			
		|||
            _internationalizationRepository = internationalizationRepository;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [HttpPost]
 | 
			
		||||
        public async Task<PageOutput<InternationalizationView>> GetInternationalizationList(InternationalizationQuery inQuery)
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
            var internationalizationQueryable =_internationalizationRepository
 | 
			
		||||
                .WhereIf(inQuery.FolderPath!=null,t=>t.FolderPath.Contains(inQuery.FolderPath))
 | 
			
		||||
                .WhereIf(inQuery.Code != null, t => t.FolderPath.Contains(inQuery.Code))
 | 
			
		||||
                .WhereIf(inQuery.Value != null, t => t.FolderPath.Contains(inQuery.Value))
 | 
			
		||||
                 .WhereIf(inQuery.ValueCN != null, t => t.FolderPath.Contains(inQuery.ValueCN))
 | 
			
		||||
                .WhereIf(inQuery.Description!=null,t=>t.Description.Contains(inQuery.Description))
 | 
			
		||||
                .WhereIf(inQuery.Code != null, t => t.Code.Contains(inQuery.Code))
 | 
			
		||||
                .WhereIf(inQuery.Value != null, t => t.Value.Contains(inQuery.Value))
 | 
			
		||||
                 .WhereIf(inQuery.ValueCN != null, t => t.ValueCN.Contains(inQuery.ValueCN))
 | 
			
		||||
             .ProjectTo<InternationalizationView>(_mapper.ConfigurationProvider);
 | 
			
		||||
 | 
			
		||||
            var pageList = await internationalizationQueryable
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,6 +26,7 @@ namespace IRaCIS.Core.Application.Service
 | 
			
		|||
            _publishLogRepository = publishLogRepository;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [HttpPost]
 | 
			
		||||
        public async Task<PageOutput<PublishLogView>> GetPublishLogList(PublishLogQuery inQuery)
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -43,6 +44,13 @@ namespace IRaCIS.Core.Application.Service
 | 
			
		|||
 | 
			
		||||
        public async Task<IResponseOutput> AddOrUpdatePublishLog(PublishLogAddOrEdit addOrEditPublishLog)
 | 
			
		||||
        {
 | 
			
		||||
            Version version;
 | 
			
		||||
 | 
			
		||||
            if (!Version.TryParse(addOrEditPublishLog.Version, out version))
 | 
			
		||||
            {
 | 
			
		||||
                return ResponseOutput.NotOk("版本号不符合要求");
 | 
			
		||||
            }
 | 
			
		||||
                     
 | 
			
		||||
            var verifyExp1 = new EntityVerifyExp<PublishLog>()
 | 
			
		||||
            {
 | 
			
		||||
                VerifyExp = u => u.Version == addOrEditPublishLog.Version ,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,7 +33,7 @@ namespace IRaCIS.Core.Domain.Models
 | 
			
		|||
		public int State { get; set; }
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
		public string FolderPath { get; set; }
 | 
			
		||||
		public string Description { get; set; }
 | 
			
		||||
 | 
			
		||||
		public string Code { get; set; }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue