diff --git a/IRaCIS.Core.API/Controllers/ExtraController.cs b/IRaCIS.Core.API/Controllers/ExtraController.cs index fb245ad1c..80a114def 100644 --- a/IRaCIS.Core.API/Controllers/ExtraController.cs +++ b/IRaCIS.Core.API/Controllers/ExtraController.cs @@ -136,7 +136,7 @@ namespace IRaCIS.Api.Controllers var loginReturn = new LoginReturnDTO() { BasicInfo = basicInfo }; - loginReturn.JWTStr = _tokenService.GetToken(new UserTokenInfo() { UserRoleId = basicInfo.IdentityUserId }); + loginReturn.JWTStr = _tokenService.GetToken(new UserTokenInfo() { IdentityUserId = basicInfo.IdentityUserId }); // 创建一个 CookieOptions 对象,用于设置 Cookie 的属性 diff --git a/IRaCIS.Core.Application/Service/Common/MailService.cs b/IRaCIS.Core.Application/Service/Common/MailService.cs index c8a639fb4..e3baad780 100644 --- a/IRaCIS.Core.Application/Service/Common/MailService.cs +++ b/IRaCIS.Core.Application/Service/Common/MailService.cs @@ -281,7 +281,7 @@ namespace IRaCIS.Core.Application.Service //---[来自展影IRC] 关于创建账户的提醒 - var token = _tokenService.GetToken(new UserTokenInfo() { UserRoleId = sysUserInfo.Id }); + var token = _tokenService.GetToken(new UserTokenInfo() { IdentityUserId = sysUserInfo.Id }); await _identityUserRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new IdentityUser() { EmailToken = token }); @@ -507,7 +507,7 @@ namespace IRaCIS.Core.Application.Service // $"[来自展影IRC] [{trialInfo.ResearchProgramNo}]邀请信"; - var token = _tokenService.GetToken(new UserTokenInfo() { UserRoleId = sysUserInfo.Id }); + var token = _tokenService.GetToken(new UserTokenInfo() { IdentityUserId = sysUserInfo.Id }); if (sysUserInfo.IsFirstAdd) { diff --git a/IRaCIS.Core.Application/Service/Management/DTO/UserLogViewModel.cs b/IRaCIS.Core.Application/Service/Management/DTO/UserLogViewModel.cs index f48d548c6..bfad70938 100644 --- a/IRaCIS.Core.Application/Service/Management/DTO/UserLogViewModel.cs +++ b/IRaCIS.Core.Application/Service/Management/DTO/UserLogViewModel.cs @@ -17,7 +17,6 @@ namespace IRaCIS.Core.Application.ViewModel public string? ActionUserName { get; set; } - public UserTypeEnum? ActionUserTypeEnum { get; set; } public DateTime CreateTime { get; set; } public Guid CreateUserId { get; set; } @@ -25,8 +24,6 @@ namespace IRaCIS.Core.Application.ViewModel public string TargetIdentityUserName { get; set; } - public UserTypeEnum? OptUserTypeEnum { get; set; } - public string JsonObj { get; set; } public string IPRegion { get; set; } diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index 658fa0855..e14cb3801 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -908,13 +908,12 @@ namespace IRaCIS.Core.Application.Service var userLogQueryable = _userLogRepository.AsQueryable().IgnoreQueryFilters() - .WhereIf(inQuery.TrialId != null, t => t.CreateUserRole.UserRoleTrials.Any(c => c.TrialId == inQuery.TrialId && (c.UserId == t.LoginUserId || c.UserId == t.OptUserId))) + .WhereIf(inQuery.TrialId != null, t => t.ActionIdentityUser.UserTrialList.Any(c => c.TrialId == inQuery.TrialId)) .WhereIf(trialCreateTime != null, t => t.CreateTime >= trialCreateTime) .WhereIf(inQuery.OptType != null, t => t.OptType == inQuery.OptType) - .WhereIf(inQuery.UserId != null, t => t.LoginUserId == inQuery.UserId) .WhereIf(inQuery.BeginDate != null, t => t.CreateTime >= inQuery.BeginDate) .WhereIf(inQuery.EndDate != null, t => t.CreateTime <= inQuery.EndDate) - .WhereIf(!string.IsNullOrEmpty(inQuery.LoginUserName), t => t.CreateUserRole.UserName.Contains(inQuery.LoginUserName!)) + .WhereIf(!string.IsNullOrEmpty(inQuery.LoginUserName), t => t.ActionUserName.Contains(inQuery.LoginUserName!)) .WhereIf(!string.IsNullOrEmpty(inQuery.LoginFaildName), t => t.LoginFaildName.Contains(inQuery.LoginFaildName!)) .WhereIf(!string.IsNullOrEmpty(inQuery.IP), t => t.IP.Contains(inQuery.IP!)) .WhereIf(inQuery.LoginUserTypeEnum != null, t => t.CreateUserRole.UserTypeEnum == inQuery.LoginUserTypeEnum) diff --git a/IRaCIS.Core.Application/Service/Management/_MapConfig.cs b/IRaCIS.Core.Application/Service/Management/_MapConfig.cs index a40188231..a06bade30 100644 --- a/IRaCIS.Core.Application/Service/Management/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Management/_MapConfig.cs @@ -123,8 +123,7 @@ namespace IRaCIS.Core.Application.Service CreateMap() - .ForMember(d => d.TargetIdentityUserName, c => c.MapFrom(t => t.TargetIdentityUser.UserName)) - .ForMember(d => d.ActionUserTypeEnum, c => c.MapFrom(t => t.CreateUserRole.UserTypeEnum)); + .ForMember(d => d.TargetIdentityUserName, c => c.MapFrom(t => t.TargetIdentityUser.UserName)); CreateMap() diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 558d14198..3a4852d10 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -251,7 +251,7 @@ namespace IRaCIS.Core.Application.Contracts result.ReviewStatus = info.ReviewStatus; } - result.Token = _tokenService.GetToken(new UserTokenInfo() { UserRoleId = Guid.NewGuid() }); + result.Token = _tokenService.GetToken(new UserTokenInfo() { IdentityUserId = Guid.NewGuid() }); } } diff --git a/IRaCIS.Core.Domain/Management/User.cs b/IRaCIS.Core.Domain/Management/User.cs index 526d7846e..cb8e7f51f 100644 --- a/IRaCIS.Core.Domain/Management/User.cs +++ b/IRaCIS.Core.Domain/Management/User.cs @@ -115,6 +115,10 @@ public class UserRole : BaseFullAuditEntity [Table("IdentityUser")] public class IdentityUser: BaseFullAuditEntity { + [JsonIgnore] + public List UserTrialList { get; set; } + + [JsonIgnore] public List UserRoleList { get; set; } = new List(); [Projectable] diff --git a/IRaCIS.Core.Domain/Management/UserLog.cs b/IRaCIS.Core.Domain/Management/UserLog.cs index 5bdc2ef35..c225a6fd6 100644 --- a/IRaCIS.Core.Domain/Management/UserLog.cs +++ b/IRaCIS.Core.Domain/Management/UserLog.cs @@ -10,6 +10,10 @@ public class UserLog : BaseAddAuditEntity [JsonIgnore] public IdentityUser TargetIdentityUser { get; set; } + + [JsonIgnore] + public IdentityUser ActionIdentityUser { get; set; } + #endregion public string IP { get; set; } = string.Empty;