时间显示格式修改

Uat_Study
hang 2022-04-21 08:56:26 +08:00
parent ca94b33d7c
commit c29cb37f8e
9 changed files with 58 additions and 26 deletions

View File

@ -1,19 +1,14 @@
using System; using System;
using System.Linq;
using Autofac.Extensions.DependencyInjection; using Autofac.Extensions.DependencyInjection;
using Dicom.Imaging;
using EasyCaching.Core;
using IRaCIS.Core.Domain.Models;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using IRaCIS.Core.Infra.EFCore;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Serilog; using Serilog;
using System.Collections.Generic;
using IRaCIS.Core.Domain.Share;
using MediatR; using MediatR;
using IRaCIS.Core.Application.MediatR.Handlers; using IRaCIS.Core.Application.MediatR.Handlers;
using System.Threading.Tasks; using System.Threading.Tasks;
using MassTransit;
using MassTransit.NewIdProviders;
namespace IRaCIS.Core.API namespace IRaCIS.Core.API
{ {
@ -43,6 +38,27 @@ namespace IRaCIS.Core.API
}) })
.Build(); .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 //// Serilog
SerilogExtension.AddSerilogSetup(environment, host.Services); SerilogExtension.AddSerilogSetup(environment, host.Services);

View File

@ -22,6 +22,8 @@ namespace IRaCIS.Core.API
options.AddInterceptors(new QueryWithNoLockDbCommandInterceptor()); options.AddInterceptors(new QueryWithNoLockDbCommandInterceptor());
options.UseProjectables();
options.AddInterceptors(new AuditingInterceptor(configuration.GetSection("ConnectionStrings:RemoteNew").Value)); options.AddInterceptors(new AuditingInterceptor(configuration.GetSection("ConnectionStrings:RemoteNew").Value));
}); });

View File

@ -67,23 +67,23 @@ namespace IRaCIS.Core.Application.Contracts
var uploadTimeSpan = UploadFinishedTime - UploadStartTime; var uploadTimeSpan = UploadFinishedTime - UploadStartTime;
return $" {uploadTimeSpan.Hours}:{uploadTimeSpan.Minutes}:{uploadTimeSpan.Seconds}.{uploadTimeSpan.Milliseconds}";
if (uploadTimeSpan.Seconds == 0 && uploadTimeSpan.Minutes==0 && uploadTimeSpan.Hours == 0) //if (uploadTimeSpan.Seconds == 0 && uploadTimeSpan.Minutes==0 && uploadTimeSpan.Hours == 0)
{ //{
return $"{uploadTimeSpan.Milliseconds}毫秒"; // return $"{uploadTimeSpan.Milliseconds}毫秒";
} //}
else if (uploadTimeSpan.Minutes == 0 && uploadTimeSpan.Hours == 0) //else if (uploadTimeSpan.Minutes == 0 && uploadTimeSpan.Hours == 0)
{ //{
return $"{uploadTimeSpan.Seconds}秒"; // return $"{uploadTimeSpan.Seconds}秒";
} //}
else if (uploadTimeSpan.Hours == 0) //else if (uploadTimeSpan.Hours == 0)
{ //{
return $"{uploadTimeSpan.Minutes} 分钟 {uploadTimeSpan.Seconds} 秒"; // return $"{uploadTimeSpan.Minutes} 分钟 {uploadTimeSpan.Seconds} 秒";
} //}
else //else
{ //{
return $" {uploadTimeSpan.Hours} 小时 {uploadTimeSpan.Minutes} 分钟 {uploadTimeSpan.Seconds} 秒 {uploadTimeSpan.Milliseconds}毫秒"; // return $" {uploadTimeSpan.Hours} 小时 {uploadTimeSpan.Minutes} 分钟 {uploadTimeSpan.Seconds} 秒 {uploadTimeSpan.Milliseconds}毫秒";
} //}
} }
} }

View File

@ -4,6 +4,7 @@ using IRaCIS.Core.Domain.Share;
using EasyCaching.Core; using EasyCaching.Core;
using IRaCIS.Core.Application.Filter; using IRaCIS.Core.Application.Filter;
using IRaCIS.Core.Infra.EFCore; using IRaCIS.Core.Infra.EFCore;
using MassTransit;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Panda.DynamicWebApi.Attributes; 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 test = _trialRepository.Where(t => t.CreateTime.Year == DateTime.Now.Year + 1).Select(t => t.Code).DefaultIfEmpty(1).ToList();
var trial = _mapper.Map<Trial>(trialAddModel); var trial = _mapper.Map<Trial>(trialAddModel);
//trial.Id = NewId.NextGuid();
var yearStr = DateTime.Now.Year.ToString(); var yearStr = DateTime.Now.Year.ToString();
trial.Code = currentYearMaxCodeNext; trial.Code = currentYearMaxCodeNext;

View File

@ -23,7 +23,7 @@ namespace IRaCIS.Application.Services
public string Get(testModel testModel) 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(); var c = _dicRepository.Where(t => t.ParentId != null).Select(t => t.MappedValue).First();
CultureInfo culture = CultureInfo.CurrentUICulture; CultureInfo culture = CultureInfo.CurrentUICulture;

View File

@ -1,6 +1,7 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using MassTransit;
namespace IRaCIS.Core.Domain.Models namespace IRaCIS.Core.Domain.Models
{ {

View File

@ -13,6 +13,7 @@
<PackageReference Include="EntityFrameworkCore.Projectables.Abstractions" Version="2.1.1" /> <PackageReference Include="EntityFrameworkCore.Projectables.Abstractions" Version="2.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.4" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.4" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.4" />
<PackageReference Include="NewId" Version="3.0.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -69,6 +69,8 @@ namespace IRaCIS.Core.Domain.Models
public bool IsFirstAdd { get; set; } = true; public bool IsFirstAdd { get; set; } = true;
[Projectable] public string FullName => $"{LastName} / {FirstName}"; [Projectable] public string FullName => LastName + " / " + FirstName;
//[Projectable] public string FullName => $"{LastName} / {FirstName}";
} }
} }

View File

@ -10,6 +10,7 @@ using Microsoft.EntityFrameworkCore.ChangeTracking;
using System.Reflection; using System.Reflection;
using EntityFramework.Exceptions.SqlServer; using EntityFramework.Exceptions.SqlServer;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using MassTransit;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using UserTypeGroup = IRaCIS.Core.Domain.Models.UserTypeGroup; using UserTypeGroup = IRaCIS.Core.Domain.Models.UserTypeGroup;
@ -359,6 +360,13 @@ namespace IRaCIS.Core.Infra.EFCore
break; break;
//添加的时候,更新审计字段也赋值 //添加的时候,更新审计字段也赋值
case EntityState.Added: 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 (t.Entity is IAuditAdd addEntity)
{ {
if (addEntity.CreateTime == default(DateTime)) if (addEntity.CreateTime == default(DateTime))