时间显示格式修改
parent
ca94b33d7c
commit
c29cb37f8e
|
@ -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);
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@ namespace IRaCIS.Core.API
|
|||
|
||||
options.AddInterceptors(new QueryWithNoLockDbCommandInterceptor());
|
||||
|
||||
options.UseProjectables();
|
||||
|
||||
options.AddInterceptors(new AuditingInterceptor(configuration.GetSection("ConnectionStrings:RemoteNew").Value));
|
||||
|
||||
});
|
||||
|
|
|
@ -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}毫秒";
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Trial>(trialAddModel);
|
||||
//trial.Id = NewId.NextGuid();
|
||||
var yearStr = DateTime.Now.Year.ToString();
|
||||
|
||||
trial.Code = currentYearMaxCodeNext;
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace IRaCIS.Application.Services
|
|||
public string Get(testModel testModel)
|
||||
{
|
||||
|
||||
var d = _repository.Where<User>(/*t=>t.FullName.Contains("cc")*/).Select(t => t.FullName).FirstOrDefault();
|
||||
var d = _repository.Where<User>(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;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using MassTransit;
|
||||
|
||||
namespace IRaCIS.Core.Domain.Models
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<PackageReference Include="EntityFrameworkCore.Projectables.Abstractions" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.4" />
|
||||
<PackageReference Include="NewId" Version="3.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -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}";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue