Merge branch 'Test_HIR_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_HIR_Net8
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
93a6bee01b
|
|
@ -75,10 +75,10 @@
|
|||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="ConfigMapFileProvider" Version="2.0.1" />
|
||||
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.14" />
|
||||
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.20" />
|
||||
<PackageReference Include="Hangfire.Dashboard.BasicAuthorization" Version="1.0.2" />
|
||||
<PackageReference Include="Hangfire.InMemory" Version="1.0.0" />
|
||||
<PackageReference Include="Hangfire.SqlServer" Version="1.8.14" />
|
||||
<PackageReference Include="Hangfire.SqlServer" Version="1.8.20" />
|
||||
<PackageReference Include="Invio.Extensions.Authentication.JwtBearer" Version="2.0.1" />
|
||||
<PackageReference Include="LogDashboard" Version="1.4.8" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.10" />
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@
|
|||
<PackageReference Include="AWSSDK.S3" Version="3.7.405" />
|
||||
<PackageReference Include="DocX" Version="3.0.1" />
|
||||
<PackageReference Include="FreeSpire.Doc" Version="12.2.0" />
|
||||
<PackageReference Include="Hangfire.Core" Version="1.8.14" />
|
||||
<PackageReference Include="ExcelDataReader" Version="3.7.0" />
|
||||
<PackageReference Include="ExcelDataReader.DataSet" Version="3.7.0" />
|
||||
<PackageReference Include="DistributedLock.Redis" Version="1.0.3" />
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ namespace IRaCIS.Core.Application.Service
|
|||
Task AdminResetPwdSendEmailAsync(Guid userId, string pwdNotMd5 = "123456");
|
||||
|
||||
|
||||
Task UserFeedBackMail(Guid feedBackId);
|
||||
}
|
||||
|
||||
public class MailVerificationService(IRepository<VerificationCode> _verificationCodeRepository,
|
||||
|
|
@ -421,154 +420,5 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
|
||||
//用户反馈邮件
|
||||
|
||||
public async Task UserFeedBackMail(Guid feedBackId)
|
||||
{
|
||||
var feedBack = await _userFeedBackRepository.Where(t => t.Id == feedBackId).Include(t => t.CreateUserRole).ThenInclude(t => t.UserTypeRole).FirstNotNullAsync();
|
||||
|
||||
var messageToSend = new MimeMessage();
|
||||
//发件地址
|
||||
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
|
||||
|
||||
var isHaveTrialId = feedBack.TrialId != null;
|
||||
|
||||
var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
|
||||
|
||||
var emialScenario = feedBack.VisitTaskId != null ? EmailBusinessScenario.IRImageError : (feedBack.SubjectVisitId != null ? EmailBusinessScenario.TrialSubjectVisitFeedBack : (feedBack.TrialId != null ? EmailBusinessScenario.TrialFeedBack : EmailBusinessScenario.SysFeedBack));
|
||||
|
||||
var emailConfigInfo = await GetEmailConfigInfoAsync(emialScenario);
|
||||
|
||||
var userTypeEnumList = emailConfigInfo.EmailNoticeUserTypeList.Where(t => t.EmailUserType == EmailUserType.To).Select(t => t.UserType).ToList();
|
||||
|
||||
var emailList = await _userRoleRepository.Where(t => userTypeEnumList.Contains(t.UserTypeEnum) &&
|
||||
(isHaveTrialId ? t.UserTrials.Any(t => t.TrialId == feedBack.TrialId) : true)).Select(t => new { t.EMail, t.UserTypeEnum, t.FullName }).ToListAsync();
|
||||
|
||||
|
||||
foreach (var email in emailList)
|
||||
{
|
||||
messageToSend.To.Add(new MailboxAddress(email.FullName, email.EMail));
|
||||
}
|
||||
|
||||
var userNames = string.Join(',', emailList.Select(t => t.FullName));
|
||||
|
||||
//影像阅片反馈 pm
|
||||
if (feedBack.VisitTaskId != null)
|
||||
{
|
||||
|
||||
var emailType = await _dictionaryRepository.Where(t => t.Parent.Code == "Email_BusinessScenario" && t.ParentId != null && t.Code == ((int)EmailBusinessScenario.IRImageError).ToString()).Select(t => _userInfo.IsEn_Us ? t.Value : t.ValueCN).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
var info = await _visitTaskRepository.Where(t => t.Id == feedBack.VisitTaskId).Select(t => new { t.Trial.ResearchProgramNo, t.Trial.TrialCode, SubejctCode = t.Subject.Code, t.SourceSubjectVisit.VisitName }).FirstNotNullAsync();
|
||||
|
||||
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
|
||||
{
|
||||
var topicStr = string.Format(input.topicStr, info.ResearchProgramNo, info.SubejctCode, info.VisitName);
|
||||
|
||||
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
|
||||
userNames,
|
||||
info.TrialCode,
|
||||
info.SubejctCode,
|
||||
info.VisitName,
|
||||
feedBack.CreateUserRole.UserTypeRole.UserTypeShortName,
|
||||
feedBack.CreateUserRole.FullName,
|
||||
emailType,
|
||||
feedBack.QuestionDescription,
|
||||
_systemEmailConfig.SiteUrl
|
||||
);
|
||||
|
||||
return (topicStr, htmlBodyStr);
|
||||
};
|
||||
|
||||
|
||||
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.IRImageError, messageToSend, emailConfigFunc);
|
||||
|
||||
}
|
||||
else if (feedBack.SubjectVisitId != null)
|
||||
{
|
||||
var emailType = await _dictionaryRepository.Where(t => t.Parent.Code == "Email_BusinessScenario" && t.ParentId != null && t.Code == ((int)EmailBusinessScenario.TrialSubjectVisitFeedBack).ToString()).Select(t => _userInfo.IsEn_Us ? t.Value : t.ValueCN).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
var info = await _subjectVisitRepository.Where(t => t.Id == feedBack.SubjectVisitId).Select(t => new { t.Trial.ResearchProgramNo, t.Trial.TrialCode, SubejctCode = t.Subject.Code, t.VisitName }).FirstNotNullAsync();
|
||||
|
||||
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
|
||||
{
|
||||
var topicStr = string.Format(input.topicStr, info.ResearchProgramNo, info.SubejctCode, info.VisitName);
|
||||
|
||||
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
|
||||
userNames,
|
||||
info.TrialCode,
|
||||
info.SubejctCode,
|
||||
info.VisitName,
|
||||
feedBack.CreateUserRole.UserTypeRole.UserTypeShortName,
|
||||
feedBack.CreateUserRole.FullName,
|
||||
emailType,
|
||||
feedBack.QuestionDescription,
|
||||
_systemEmailConfig.SiteUrl
|
||||
);
|
||||
|
||||
return (topicStr, htmlBodyStr);
|
||||
};
|
||||
|
||||
|
||||
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.TrialSubjectVisitFeedBack, messageToSend, emailConfigFunc);
|
||||
}
|
||||
//项目相关的反馈 pm admin
|
||||
else if (feedBack.TrialId != null)
|
||||
{
|
||||
|
||||
var emailType = await _dictionaryRepository.Where(t => t.Parent.Code == "Email_BusinessScenario" && t.ParentId != null && t.Code == ((int)EmailBusinessScenario.TrialFeedBack).ToString()).Select(t => _userInfo.IsEn_Us ? t.Value : t.ValueCN).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
var info = await _trialRepository.Where(t => t.Id == feedBack.TrialId).Select(t => new { t.ResearchProgramNo, t.TrialCode }).FirstNotNullAsync();
|
||||
|
||||
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
|
||||
{
|
||||
var topicStr = string.Format(input.topicStr, info.ResearchProgramNo);
|
||||
|
||||
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
|
||||
userNames,
|
||||
info.TrialCode,
|
||||
feedBack.CreateUserRole.UserTypeRole.UserTypeShortName,
|
||||
feedBack.CreateUserRole.FullName,
|
||||
emailType,
|
||||
feedBack.QuestionDescription,
|
||||
_systemEmailConfig.SiteUrl
|
||||
);
|
||||
|
||||
return (topicStr, htmlBodyStr);
|
||||
};
|
||||
|
||||
|
||||
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.TrialFeedBack, messageToSend, emailConfigFunc);
|
||||
|
||||
}
|
||||
//项目无关的反馈 admin
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
|
||||
{
|
||||
var topicStr = string.Format(input.topicStr);
|
||||
|
||||
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
|
||||
userNames,
|
||||
feedBack.CreateUserRole.UserTypeRole.UserTypeShortName,
|
||||
feedBack.CreateUserRole.FullName,
|
||||
feedBack.QuestionDescription,
|
||||
_systemEmailConfig.SiteUrl
|
||||
);
|
||||
|
||||
return (topicStr, htmlBodyStr);
|
||||
};
|
||||
|
||||
|
||||
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.SysFeedBack, messageToSend, emailConfigFunc);
|
||||
}
|
||||
|
||||
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
//任务反馈的添加更新都需要发送邮件,其他的是添加的时候发送
|
||||
if (addOrEditUserFeedBack.VisitTaskId != null || addOrEditUserFeedBack.Id == null)
|
||||
{
|
||||
await mailService.UserFeedBackMail(entity.Id);
|
||||
//await mailService.UserFeedBackMail(entity.Id);
|
||||
}
|
||||
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
|
|
|
|||
|
|
@ -944,7 +944,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
await _fusionCache.RemoveAsync(CacheKeys.UserToken(identityUserId));
|
||||
|
||||
var userName = await _userRoleRepository.Where(t => t.Id == userRoleId).Select(t => t.IdentityUser.UserName).FirstOrDefaultAsync();
|
||||
var userName = await _userRoleRepository.Where(t => t.Id == userRoleId).Select(t => t.UserName).FirstOrDefaultAsync();
|
||||
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = identityUserId, ActionUserName = userName, OptType = UserOptType.LoginOut }, true);
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
.ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName))
|
||||
.ForMember(d => d.UserId, u => u.MapFrom(s => s.Id))
|
||||
.ForMember(d => d.TrialId, u => u.MapFrom(s => trialId))
|
||||
.ForMember(d => d.IsSelect, u => u.MapFrom(t => t.UserTrials.Any(t => t.TrialId == trialId)));
|
||||
.ForMember(d => d.IsSelect, u => u.MapFrom(t => t.UserRoleTrials.Any(t => t.TrialId == trialId)));
|
||||
|
||||
|
||||
CreateMap<Site, SiteSelectDTO>()
|
||||
|
|
|
|||
|
|
@ -109,6 +109,15 @@ public abstract class BaseFullAuditEntity : Entity, IAuditUpdate, IAuditAdd
|
|||
[JsonIgnore]
|
||||
public UserRole CreateUserRole { get; set; }
|
||||
}
|
||||
|
||||
public abstract class BaseFullAuditEntityNoNavigat : Entity, IAuditUpdate, IAuditAdd
|
||||
{
|
||||
public Guid CreateUserId { get; set; }
|
||||
public DateTime CreateTime { get; set; }
|
||||
public Guid UpdateUserId { get; set; }
|
||||
public DateTime UpdateTime { get; set; }
|
||||
}
|
||||
|
||||
public abstract class BaseFullDeleteAuditEntity : Entity, IAuditUpdate, IAuditAdd, ISoftDelete
|
||||
{
|
||||
public Guid? DeleteUserId { get; set; }
|
||||
|
|
|
|||
|
|
@ -40,14 +40,14 @@ namespace IRaCIS.Core.Domain.Models
|
|||
|
||||
[Comment("后台 - 系统真实账户表")]
|
||||
[Table("IdentityUser")]
|
||||
public class IdentityUser : BaseFullAuditEntity
|
||||
public class IdentityUser : BaseFullAuditEntityNoNavigat
|
||||
{
|
||||
|
||||
[JsonIgnore]
|
||||
public List<TrialIdentityUser> UserTrialList { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public List<UserRole> UserRoleList { get; set; } = new List<UserRole>();
|
||||
public List<UserRole> UserRoleList { get; set; }
|
||||
|
||||
|
||||
[Projectable]
|
||||
|
|
|
|||
|
|
@ -5,16 +5,17 @@ namespace IRaCIS.Core.Domain.Models;
|
|||
|
||||
[Comment("后台 - 系统账户")]
|
||||
[Table("User")]
|
||||
public class UserRole : BaseFullAuditEntity
|
||||
public class UserRole : BaseFullAuditEntityNoNavigat
|
||||
{
|
||||
#region 导航属性
|
||||
|
||||
//[ForeignKey("IdentityUserId")]
|
||||
[JsonIgnore]
|
||||
public IdentityUser IdentityUser { get; set; }
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
public List<TrialUserRole> UserRoleTrials { get; set; } = new List<TrialUserRole>();
|
||||
public List<TrialUserRole> UserRoleTrials { get; set; }
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
|
|
@ -22,9 +23,6 @@ public class UserRole : BaseFullAuditEntity
|
|||
public UserType UserTypeRole { get; set; }
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
public List<TrialUserRole> UserTrials { get; set; } = new List<TrialUserRole>();
|
||||
|
||||
[JsonIgnore]
|
||||
public List<VisitTask> VisitTaskList { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -11,9 +11,6 @@ public class UserType : Entity
|
|||
[JsonIgnore]
|
||||
public List<UserTypeGroup> UserTypeGroupList { get; set; }
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
public List<UserRole> UserList { get; set; }
|
||||
#endregion
|
||||
public UserTypeEnum UserTypeEnum { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -373,7 +373,6 @@ public class IRaCISDBContext : DbContext
|
|||
public virtual DbSet<VerificationCode> VerificationCodes { get; set; }
|
||||
public virtual DbSet<Menu> MenuFunctions { get; set; }
|
||||
public virtual DbSet<UserTypeMenu> UserTypeMenuFunction { get; set; }
|
||||
public virtual DbSet<UserRole> Users { get; set; }
|
||||
public virtual DbSet<UserType> UserType { get; set; }
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,8 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
|
|||
//User 和VisitTask 存在一对多的关系 这里不显式配置就报错,why?
|
||||
builder.HasMany(t => t.VisitTaskList).WithOne(t => t.DoctorUser).HasForeignKey(t => t.DoctorUserId);
|
||||
|
||||
//builder.HasOne(t => t.Doctor).WithOne(t => t.User);
|
||||
//builder.HasOne(t => t.IdentityUser).WithMany(t => t.UserRoleList).HasForeignKey(t => t.IdentityUserId);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -71,19 +72,18 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
|
|||
}
|
||||
}
|
||||
|
||||
public class IdentityUserConfigration : IEntityTypeConfiguration<IdentityUser>
|
||||
{
|
||||
//当一个实体,针对同一个类,有两个一对一导航属性,但是是不同的外键,一个外键是一对一,一个是一对多,那么需要显示配置一对多的关系
|
||||
public void Configure(EntityTypeBuilder<IdentityUser> builder)
|
||||
{
|
||||
builder.HasMany(s => s.UserRoleList)
|
||||
.WithOne(t => t.IdentityUser)
|
||||
.HasForeignKey(s => s.IdentityUserId);
|
||||
//public class IdentityUserConfigration : IEntityTypeConfiguration<IdentityUser>
|
||||
//{
|
||||
// //当一个实体,针对同一个类,有两个一对一导航属性,但是是不同的外键,一个外键是一对一,一个是一对多,那么需要显示配置一对多的关系
|
||||
// public void Configure(EntityTypeBuilder<IdentityUser> builder)
|
||||
// {
|
||||
// builder.HasMany(s => s.UserRoleList)
|
||||
// .WithOne(t=>t.IdentityUser)
|
||||
// .HasForeignKey(s => s.IdentityUserId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
public class TrialIdentityUserConfigration : IEntityTypeConfiguration<TrialIdentityUser>
|
||||
|
|
|
|||
|
|
@ -21,21 +21,22 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="EFCore.BulkExtensions" Version="8.1.1" />
|
||||
<PackageReference Include="EFCore.BulkExtensions" Version="8.1.3" />
|
||||
<PackageReference Include="EntityFrameworkCore.Triggered" Version="3.2.2" />
|
||||
<PackageReference Include="EntityFrameworkCore.Projectables" Version="3.0.4" />
|
||||
<PackageReference Include="EntityFrameworkCore.Exceptions.SqlServer" Version="8.1.3" />
|
||||
<PackageReference Include="MassTransit" Version="8.3.0" />
|
||||
<PackageReference Include="MassTransit.EntityFrameworkCore" Version="8.3.0" />
|
||||
<PackageReference Include="MassTransit.Hangfire" Version="8.3.0" />
|
||||
<PackageReference Include="MassTransit" Version="8.4.0" />
|
||||
<PackageReference Include="MassTransit.EntityFrameworkCore" Version="8.4.0" />
|
||||
<PackageReference Include="MassTransit.Hangfire" Version="8.4.0" />
|
||||
<PackageReference Include="Hangfire.Core" Version="1.8.18" />
|
||||
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="8.0.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.19" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.19">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.10">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.19">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="8.0.10" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.19" />
|
||||
<PackageReference Include="SharpCompress" Version="0.38.0" />
|
||||
<PackageReference Include="SharpZipLib" Version="1.4.2" />
|
||||
<PackageReference Include="BouncyCastle.Cryptography" Version="2.4.0" />
|
||||
|
|
|
|||
|
|
@ -50,10 +50,10 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Fluid.Core" Version="2.11.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="8.0.10" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.19" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="8.0.19" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.11" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.19">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
|
|
|||
Loading…
Reference in New Issue