diff --git a/IRaCIS.Core.API/_PipelineExtensions/Serilog/SerilogHelper.cs b/IRaCIS.Core.API/_PipelineExtensions/Serilog/SerilogHelper.cs index 9be804fbf..3e4c2aa59 100644 --- a/IRaCIS.Core.API/_PipelineExtensions/Serilog/SerilogHelper.cs +++ b/IRaCIS.Core.API/_PipelineExtensions/Serilog/SerilogHelper.cs @@ -20,18 +20,20 @@ namespace IRaCIS.Core.API // Set all the common properties available for every request diagnosticContext.Set("Host", request.Host); + diagnosticContext.Set("Protocol", request.Protocol); + diagnosticContext.Set("Scheme", request.Scheme); + + #region old 未用 //这种获取的Ip不准 配置服务才行 //diagnosticContext.Set("RequestIP", httpContext.Connection.RemoteIpAddress.ToString()); //这种方式可以,但是serilog提供了 就不用了 //diagnosticContext.Set("TestIP", httpContext.GetUserIp()); - diagnosticContext.Set("Protocol", request.Protocol); - diagnosticContext.Set("Scheme", request.Scheme); - //这种方式不行 读取的body为空字符串 必须在中间件中读取 //diagnosticContext.Set("RequestBody", await ReadRequestBody(httpContext.Request)); //diagnosticContext.Set("RequestBody", RequestPayload); + #endregion // Only set it if available. You're not sending sensitive data in a querystring right?! if (request.QueryString.HasValue) diff --git a/IRaCIS.Core.API/_ServiceExtensions/NewtonsoftJson/NewtonsoftJsonSetup.cs b/IRaCIS.Core.API/_ServiceExtensions/NewtonsoftJson/NewtonsoftJsonSetup.cs index c23963a5d..9671fffca 100644 --- a/IRaCIS.Core.API/_ServiceExtensions/NewtonsoftJson/NewtonsoftJsonSetup.cs +++ b/IRaCIS.Core.API/_ServiceExtensions/NewtonsoftJson/NewtonsoftJsonSetup.cs @@ -31,11 +31,9 @@ namespace IRaCIS.Core.API options.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind; - //options.SerializerSettings.Converters.Add(new JSONCustomDateConverter()) ; options.SerializerSettings.Converters.Add(services.BuildServiceProvider().GetService()); - //options.SerializerSettings.Converters.Add(services.BuildServiceProvider().GetService()); //IsoDateTimeConverter diff --git a/IRaCIS.Core.API/_ServiceExtensions/Serilog/HttpContextEnricher.cs b/IRaCIS.Core.API/_ServiceExtensions/Serilog/HttpContextEnricher.cs index 330cbc0a0..afbbf681d 100644 --- a/IRaCIS.Core.API/_ServiceExtensions/Serilog/HttpContextEnricher.cs +++ b/IRaCIS.Core.API/_ServiceExtensions/Serilog/HttpContextEnricher.cs @@ -31,13 +31,13 @@ namespace IRaCIS.Core.API logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("LocalIP", httpContext.Connection.LocalIpAddress.MapToIPv4().ToString())); + logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("TokenUserRealName", httpContext?.User?.FindFirst(ClaimAttributes.RealName)?.Value)); + logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("TokenUserType", httpContext?.User?.FindFirst(JwtIRaCISClaimType.UserTypeShortName)?.Value)); + //这样读取没用 //logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("RequestBody", await ReadRequestBody(httpContext.Request))); //logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("RequestIP", IPHelper.GetIP(httpContext.Request) )); - logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("TokenUserRealName", httpContext?.User?.FindFirst(ClaimAttributes.RealName)?.Value)); - logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("TokenUserType", httpContext?.User?.FindFirst(JwtIRaCISClaimType.UserTypeShortName)?.Value)); - //logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("Referer", httpContext.Request.Headers["Referer"].ToString())); //logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("request_path", httpContext.Request.Path)); //logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("request_method", httpContext.Request.Method)); diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs index 971d487e8..9edffb891 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs @@ -787,10 +787,11 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc private VerifyStudyUploadResult VerifyStudyUpload(string studyInstanceUid, Guid trialId, Guid currentSubjectVisitId, Guid SubjectId) { + var cacheUserId = _fusionCache.TryGet(CacheKeys.TrialStudyUidUploading(trialId, studyInstanceUid)); + var result = new VerifyStudyUploadResult(); - if (_fusionCache.GetOrDefault(CacheKeys.TrialStudyUidUploading(trialId, studyInstanceUid)) != _userInfo.Id - && _fusionCache.GetOrDefault(CacheKeys.TrialStudyUidUploading(trialId, studyInstanceUid)) != Guid.Empty) + if (cacheUserId.GetValueOrDefault() != _userInfo.Id && cacheUserId.HasValue) { result.AllowUpload = false; diff --git a/IRaCIS.Core.Application/Service/QC/QCCommon.cs b/IRaCIS.Core.Application/Service/QC/QCCommon.cs index 6378bde70..554cc9362 100644 --- a/IRaCIS.Core.Application/Service/QC/QCCommon.cs +++ b/IRaCIS.Core.Application/Service/QC/QCCommon.cs @@ -8,12 +8,12 @@ namespace IRaCIS.Core.Application.Service public class QCCommon: BaseService { - + /// /// 验证CRC 是否已提交 已提交 就不允许进行任何操作,如果是IQC 那么还验证是否是当前任务领取人 /// - /// + /// /// /// ///