diff --git a/IRaCIS.Core.API/Program.cs b/IRaCIS.Core.API/Program.cs index 278a1dd45..590c672f8 100644 --- a/IRaCIS.Core.API/Program.cs +++ b/IRaCIS.Core.API/Program.cs @@ -1,19 +1,14 @@ using System; -using System.Linq; using Autofac.Extensions.DependencyInjection; -using Dicom.Imaging; -using EasyCaching.Core; -using IRaCIS.Core.Domain.Models; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; -using IRaCIS.Core.Infra.EFCore; using Microsoft.Extensions.Configuration; using Serilog; -using System.Collections.Generic; -using IRaCIS.Core.Domain.Share; using MediatR; using IRaCIS.Core.Application.MediatR.Handlers; using System.Threading.Tasks; +using MassTransit; +using MassTransit.NewIdProviders; namespace IRaCIS.Core.API { @@ -43,6 +38,27 @@ namespace IRaCIS.Core.API }) .Build(); + #region Id Generate long类型 + + + //// 创建 IdGeneratorOptions 对象,请在构造函数中输入 WorkerId: + //var options = new IdGeneratorOptions(1); + ////options.WorkerIdBitLength = 10; + + //YitIdHelper.SetIdGenerator(options); + + //var newId = YitIdHelper.NextId(); + + #endregion + + NewId.SetProcessIdProvider(new CurrentProcessIdProvider()); + + for (int i= 0; i < 10;i++ ) + { + Console.WriteLine(NewId.NextGuid()); + } + + //// Serilog SerilogExtension.AddSerilogSetup(environment, host.Services); diff --git a/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs b/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs index f9c75ef1d..c0002f379 100644 --- a/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs +++ b/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs @@ -22,6 +22,8 @@ namespace IRaCIS.Core.API options.AddInterceptors(new QueryWithNoLockDbCommandInterceptor()); + options.UseProjectables(); + options.AddInterceptors(new AuditingInterceptor(configuration.GetSection("ConnectionStrings:RemoteNew").Value)); }); diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs index 30ddfe927..d36cbd9a7 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs @@ -67,23 +67,23 @@ namespace IRaCIS.Core.Application.Contracts var uploadTimeSpan = UploadFinishedTime - UploadStartTime; - - if (uploadTimeSpan.Seconds == 0 && uploadTimeSpan.Minutes==0 && uploadTimeSpan.Hours == 0) - { - return $"{uploadTimeSpan.Milliseconds}姣"; - } - else if (uploadTimeSpan.Minutes == 0 && uploadTimeSpan.Hours == 0) - { - return $"{uploadTimeSpan.Seconds}绉"; - } - else if (uploadTimeSpan.Hours == 0) - { - return $"{uploadTimeSpan.Minutes} 鍒嗛挓 {uploadTimeSpan.Seconds} 绉"; - } - else - { - return $" {uploadTimeSpan.Hours} 灏忔椂 {uploadTimeSpan.Minutes} 鍒嗛挓 {uploadTimeSpan.Seconds} 绉 {uploadTimeSpan.Milliseconds}姣"; - } + return $" {uploadTimeSpan.Hours}:{uploadTimeSpan.Minutes}:{uploadTimeSpan.Seconds}.{uploadTimeSpan.Milliseconds}"; + //if (uploadTimeSpan.Seconds == 0 && uploadTimeSpan.Minutes==0 && uploadTimeSpan.Hours == 0) + //{ + // return $"{uploadTimeSpan.Milliseconds}姣"; + //} + //else if (uploadTimeSpan.Minutes == 0 && uploadTimeSpan.Hours == 0) + //{ + // return $"{uploadTimeSpan.Seconds}绉"; + //} + //else if (uploadTimeSpan.Hours == 0) + //{ + // return $"{uploadTimeSpan.Minutes} 鍒嗛挓 {uploadTimeSpan.Seconds} 绉"; + //} + //else + //{ + // return $" {uploadTimeSpan.Hours} 灏忔椂 {uploadTimeSpan.Minutes} 鍒嗛挓 {uploadTimeSpan.Seconds} 绉 {uploadTimeSpan.Milliseconds}姣"; + //} } } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs index bfb18ce21..5ea307176 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs @@ -4,6 +4,7 @@ using IRaCIS.Core.Domain.Share; using EasyCaching.Core; using IRaCIS.Core.Application.Filter; using IRaCIS.Core.Infra.EFCore; +using MassTransit; using Microsoft.AspNetCore.Mvc; using Panda.DynamicWebApi.Attributes; @@ -151,6 +152,7 @@ namespace IRaCIS.Application.Services //var test = _trialRepository.Where(t => t.CreateTime.Year == DateTime.Now.Year + 1).Select(t => t.Code).DefaultIfEmpty(1).ToList(); var trial = _mapper.Map(trialAddModel); + //trial.Id = NewId.NextGuid(); var yearStr = DateTime.Now.Year.ToString(); trial.Code = currentYearMaxCodeNext; diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs index 3c4970d34..e2e6ca3ae 100644 --- a/IRaCIS.Core.Application/TestService.cs +++ b/IRaCIS.Core.Application/TestService.cs @@ -23,7 +23,7 @@ namespace IRaCIS.Application.Services public string Get(testModel testModel) { - var d = _repository.Where(/*t=>t.FullName.Contains("cc")*/).Select(t => t.FullName).FirstOrDefault(); + var d = _repository.Where(t => t.FullName.Contains("cc")).Select(t => t.FullName).FirstOrDefault(); var c = _dicRepository.Where(t => t.ParentId != null).Select(t => t.MappedValue).First(); CultureInfo culture = CultureInfo.CurrentUICulture; diff --git a/IRaCIS.Core.Domain/BaseModel/Entity.cs b/IRaCIS.Core.Domain/BaseModel/Entity.cs index b8e9a1e68..d5477d8ca 100644 --- a/IRaCIS.Core.Domain/BaseModel/Entity.cs +++ b/IRaCIS.Core.Domain/BaseModel/Entity.cs @@ -1,6 +1,7 @@ 锘縰sing System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using MassTransit; namespace IRaCIS.Core.Domain.Models { diff --git a/IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj b/IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj index 3e5b27478..630ffbb14 100644 --- a/IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj +++ b/IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj @@ -13,6 +13,7 @@ + diff --git a/IRaCIS.Core.Domain/Management/User.cs b/IRaCIS.Core.Domain/Management/User.cs index aa5140839..d6c9be6ef 100644 --- a/IRaCIS.Core.Domain/Management/User.cs +++ b/IRaCIS.Core.Domain/Management/User.cs @@ -69,6 +69,8 @@ namespace IRaCIS.Core.Domain.Models public bool IsFirstAdd { get; set; } = true; - [Projectable] public string FullName => $"{LastName} / {FirstName}"; + [Projectable] public string FullName => LastName + " / " + FirstName; + + //[Projectable] public string FullName => $"{LastName} / {FirstName}"; } } diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 172006f70..b25f0ae29 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -10,6 +10,7 @@ using Microsoft.EntityFrameworkCore.ChangeTracking; using System.Reflection; using EntityFramework.Exceptions.SqlServer; using IRaCIS.Core.Domain.Share; +using MassTransit; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using UserTypeGroup = IRaCIS.Core.Domain.Models.UserTypeGroup; @@ -359,6 +360,13 @@ namespace IRaCIS.Core.Infra.EFCore break; //娣诲姞鐨勬椂鍊欙紝鏇存柊瀹¤瀛楁涔熻祴鍊 case EntityState.Added: + + // 浠撳偍娣诲姞鏃 灏辨湁id浜 + if (t.Entity is Entity entity && entity.Id == Guid.Empty) + { + entity.Id = NewId.NextGuid(); + } + if (t.Entity is IAuditAdd addEntity) { if (addEntity.CreateTime == default(DateTime))