修改 IuserInfo位置

Uat_Study
hang 2022-04-12 15:33:12 +08:00
parent 84588c1b2f
commit d88621f2a9
13 changed files with 51 additions and 23 deletions

View File

@ -14,6 +14,7 @@ using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using IRaCIS.Core.Domain.Share;
using Microsoft.EntityFrameworkCore;
namespace IRaCIS.Core.API.Controllers

View File

@ -21,6 +21,7 @@ using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Application.Service.Inspection.Interface;
using Newtonsoft.Json;
using IRaCIS.Core.Application.Service.Inspection.DTO;
using IRaCIS.Core.Domain.Share;
namespace IRaCIS.Api.Controllers
{

View File

@ -1,18 +1,17 @@
using Autofac;
using Autofac.Extras.DynamicProxy;
using IRaCIS.Application.Interfaces;
using IRaCIS.Application.Services;
using IRaCIS.Core.API.Utility.AOP;
using IRaCIS.Core.Application;
using IRaCIS.Core.Application.AOP;
using IRaCIS.Core.Application.BackGroundJob;
using IRaCIS.Core.Infra.EFCore;
using IRaCIS.Core.Infra.EFCore.AuthUser;
using Microsoft.AspNetCore.Http;
using Panda.DynamicWebApi;
using System;
using System.Linq;
using System.Reflection;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share;
namespace IRaCIS.Core.API
@ -56,7 +55,8 @@ namespace IRaCIS.Core.API
containerBuilder.RegisterAssemblyTypes(infrastructure).AsImplementedInterfaces();
containerBuilder.RegisterType<HttpContextAccessor>().As<IHttpContextAccessor>().SingleInstance();
containerBuilder.RegisterType<UserInfo>().As<IUserInfo>().InstancePerLifetimeScope();
//containerBuilder.RegisterType<Dictionary>().InstancePerLifetimeScope();
containerBuilder.RegisterType<DicomFileStoreHelper>().SingleInstance();

View File

@ -1,5 +1,4 @@
using IRaCIS.Core.Infra.EFCore.AuthUser;
using IRaCIS.Core.Infrastructure;
using IRaCIS.Core.Infrastructure;
using IRaCIS.Core.Infrastructure.Extention;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
@ -9,6 +8,7 @@ using System;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using IRaCIS.Core.Domain.Share;
namespace IRaCIS.Core.API
{

View File

@ -1,7 +1,6 @@
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infra.EFCore.AuthUser;
using Microsoft.Extensions.Options;
namespace IRaCIS.Core.Application.Auth

View File

@ -7,6 +7,7 @@ using Microsoft.Extensions.Localization;
using Panda.DynamicWebApi;
using Panda.DynamicWebApi.Attributes;
using System.Diagnostics.CodeAnalysis;
using IRaCIS.Core.Domain.Share;
namespace IRaCIS.Core.Application
{

View File

@ -1652,7 +1652,7 @@
构造函数注入
</summary>
</member>
<member name="M:IRaCIS.Core.Application.MediatR.Handlers.ConsistencyVerificationHandler.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomStudy},IRaCIS.Core.Infra.EFCore.IUserInfo,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Subject},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SubjectVisit},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSite},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudy},AutoMapper.IMapper)">
<member name="M:IRaCIS.Core.Application.MediatR.Handlers.ConsistencyVerificationHandler.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomStudy},IRaCIS.Core.Domain.Share.IUserInfo,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Subject},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SubjectVisit},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSite},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudy},AutoMapper.IMapper)">
<summary>
构造函数注入
</summary>

View File

@ -38,7 +38,7 @@ public static class ExcelExportHelper
return new FileStreamResult(memoryStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
{
FileDownloadName = $"{exportFileNamePrefix}_{doc.Name.Substring(0,doc.Name.LastIndexOf('.'))}{DateTime.Now.ToString("yyyy-MM-dd:hh:mm:ss")}.xlsx"
FileDownloadName = $"{exportFileNamePrefix}_{doc.Name.Substring(0,doc.Name.LastIndexOf('.'))}——{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx"
};
#endregion

View File

@ -13,6 +13,8 @@ namespace IRaCIS.Application.Services
[HttpPost]
public string Get(testModel testModel)
{
var c = _repository.Where<Dictionary>().Select(t=>t.MappedValue).First();
CultureInfo culture = CultureInfo.CurrentUICulture;
var a = 123;

View File

@ -1,7 +1,6 @@
using System;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
namespace IRaCIS.Core.Infra.EFCore
namespace IRaCIS.Core.Domain.Share
{
/// <summary>
/// 用户信息接口

View File

@ -2,7 +2,7 @@
using IRaCIS.Core.Domain.Share;
using Microsoft.AspNetCore.Http;
namespace IRaCIS.Core.Infra.EFCore.AuthUser
namespace IRaCIS.Core.Domain.Share
{
/// <summary>
/// 用户信息
@ -190,7 +190,7 @@ namespace IRaCIS.Core.Infra.EFCore.AuthUser
{
var lan = _accessor?.HttpContext?.Request?.Headers["Accept-Language"];
if ( !string.IsNullOrEmpty(lan.Value))
if ( lan is not null && !string.IsNullOrEmpty(lan.Value))
{
return lan.Value == "en-US,en;q=0.5".ToString();
}

View File

@ -9,21 +9,26 @@ namespace IRaCIS.Core.Domain.Models
[Table("Dictionary")]
public partial class Dictionary : Entity, IAuditUpdate, IAuditAdd
{
private readonly IUserInfo _userInfo;
public List<DoctorDictionary> DoctorDicRelationList { get; set; } = new List<DoctorDictionary>();
//常规调用
public Dictionary()
{
}
public Dictionary(IUserInfo userInfo )
{
_userInfo = userInfo;
}
[StringLength(50)]
public string KeyName { get; set; } = string.Empty;
[StringLength(100)]
[Column("Value")]
public string Value { get; set; } = string.Empty;
[StringLength(100)]
[Column("ValueCN")]
public string ValueCN { get; set; } = string.Empty;
@ -59,5 +64,16 @@ namespace IRaCIS.Core.Domain.Models
[ForeignKey("ParentId")]
public Dictionary Parent { get; set; }
[StringLength(50)]
public string KeyName { get; set; } = string.Empty;
//测试
[NotMapped]
public string MappedValue => _userInfo.IsEn_Us ? Value : ValueCN;
}
}

View File

@ -8,6 +8,8 @@ using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using System.Reflection;
using IRaCIS.Core.Domain.Share;
using UserTypeGroup = IRaCIS.Core.Domain.Models.UserTypeGroup;
namespace IRaCIS.Core.Infra.EFCore
{
@ -25,6 +27,8 @@ namespace IRaCIS.Core.Infra.EFCore
_userInfo = userInfo;
//_configuration = configuration;
}
//比数据库上下文构造函数先执行 不能构造函数注入的方式使用配置文件
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
@ -52,8 +56,13 @@ namespace IRaCIS.Core.Infra.EFCore
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<TrialSiteSurvey>()
.HasQueryFilter(t => t.IsDeleted == false);
//modelBuilder.Entity<Dictionary>().Ignore(t => t.MappedValue);
//modelBuilder.Entity<Dictionary>().Property(t => t.MappedValue).HasComputedColumnSql(_userInfo.IsEn_Us? "[Value]":"[ValueCN]");
//modelBuilder.Entity<Dictionary>().Property(t => t.MappedValue).HasColumnName(_userInfo.IsEn_Us ? "Value" : "ValueCN").UsePropertyAccessMode(PropertyAccessMode.Property);
//modelBuilder.Entity<TrialSiteSurvey>()
// .HasQueryFilter(t => t.IsDeleted == false);
// 软删除配置
foreach (var entityType in modelBuilder.Model.GetEntityTypes())