From aa60cb4822d7c9a08981b55ae4f458305f48ccb9 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 26 Dec 2024 15:23:12 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/IRaCIS.Core.Application.xml | 7 +++++++ .../Service/Management/DTO/UserLogViewModel.cs | 2 +- .../Triggers/AfterSaveTrigger/UserLogAfterTrigger.cs | 2 +- IRaCIS.Core.Domain/Management/UserLog.cs | 3 +-- IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs | 9 --------- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 2b47e6139..f634ecdaa 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -12033,6 +12033,13 @@ + + + 删除表格问题标记 + + + + 保存表格问题标记 diff --git a/IRaCIS.Core.Application/Service/Management/DTO/UserLogViewModel.cs b/IRaCIS.Core.Application/Service/Management/DTO/UserLogViewModel.cs index 5220efd63..f48d548c6 100644 --- a/IRaCIS.Core.Application/Service/Management/DTO/UserLogViewModel.cs +++ b/IRaCIS.Core.Application/Service/Management/DTO/UserLogViewModel.cs @@ -27,7 +27,7 @@ namespace IRaCIS.Core.Application.ViewModel public UserTypeEnum? OptUserTypeEnum { get; set; } - public UserLogJsonObj JsonObj { get; set; } + public string JsonObj { get; set; } public string IPRegion { get; set; } } diff --git a/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/UserLogAfterTrigger.cs b/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/UserLogAfterTrigger.cs index e19a3012a..faf76a78d 100644 --- a/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/UserLogAfterTrigger.cs +++ b/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/UserLogAfterTrigger.cs @@ -41,7 +41,7 @@ namespace IRaCIS.Core.Application.Triggers.AfterSaveTrigger }).FirstOrDefaultAsync(); - userlog.JsonObj = obj; + userlog.JsonObj = obj.ToJsonStr(); await _identityUserRepository.SaveChangesAsync(); } diff --git a/IRaCIS.Core.Domain/Management/UserLog.cs b/IRaCIS.Core.Domain/Management/UserLog.cs index 34f74b227..5bdc2ef35 100644 --- a/IRaCIS.Core.Domain/Management/UserLog.cs +++ b/IRaCIS.Core.Domain/Management/UserLog.cs @@ -27,7 +27,7 @@ public class UserLog : BaseAddAuditEntity public string ActionUserName { get; set; } [MaxLength] - public UserLogJsonObj JsonObj { get; set; } + public string JsonObj { get; set; } [Comment("被操作的对象 admin 修改张三信息 张三是被操作对象")] @@ -66,7 +66,6 @@ public class UserLogJsonObj public string DepartmentName { get; set; } - [NotMapped] public List UserRoleList { get; set; } } diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 634c11474..0bebe6d0a 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -63,15 +63,6 @@ public class IRaCISDBContext : DbContext protected override void OnModelCreating(ModelBuilder modelBuilder) { - modelBuilder.Entity(entity => - { - entity.OwnsOne(x => x.JsonObj, ownedNavigationBuilder => - { - ownedNavigationBuilder.ToJson(); - }); - - }); - modelBuilder.Entity(entity => { // 使用部分加密值转换器,前 2 个字符不加密,方便模糊搜索 From 96e1f84c8c049316fe8fb7ef95dceab1335c4d4c Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 26 Dec 2024 15:37:48 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Management/_MapConfig.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/Management/_MapConfig.cs b/IRaCIS.Core.Application/Service/Management/_MapConfig.cs index 2758b4f1d..a40188231 100644 --- a/IRaCIS.Core.Application/Service/Management/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Management/_MapConfig.cs @@ -162,7 +162,7 @@ namespace IRaCIS.Core.Application.Service CreateMap(); - CreateMap(); + CreateMap().ReverseMap(); CreateMap(); From b8d5ed2bb743f35cb187bf8d8c0f923221e0419d Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 26 Dec 2024 15:44:51 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=86=E7=A0=81bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Management/UserService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index 310e5b761..be2913ec9 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -435,7 +435,7 @@ namespace IRaCIS.Core.Application.Service if (!string.IsNullOrEmpty(editPwModel.NewUserName)) { - await VerifyUserNameAsync(_userInfo.UserRoleId, editPwModel.NewUserName); + await VerifyUserNameAsync(_userInfo.IdentityUserId, editPwModel.NewUserName); await _identityUserRepository.BatchUpdateNoTrackingAsync(t => t.Id == _userInfo.IdentityUserId, u => new IdentityUser() { From b40bfe26c540f95fe5b52195900f60985970084b Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 26 Dec 2024 15:53:14 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9E=9A=E4=B8=BE?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Domain.Share/Reading/ImageFilterState.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/IRaCIS.Core.Domain.Share/Reading/ImageFilterState.cs b/IRaCIS.Core.Domain.Share/Reading/ImageFilterState.cs index 748343ada..ad1f1e60b 100644 --- a/IRaCIS.Core.Domain.Share/Reading/ImageFilterState.cs +++ b/IRaCIS.Core.Domain.Share/Reading/ImageFilterState.cs @@ -15,7 +15,7 @@ public enum UserOptType Login = 1, [Description("选择登录角色")] - LoginSelectRole =11, + LoginSelectRole =18, [Description("更新用户角色")] UpdateUserRole =15, @@ -44,8 +44,6 @@ public enum UserOptType //admin 重置密码 ResetPassword = 9, - DeleteUser = 10, - UpdateUser = 11, MFALogin = 12, From 32e3153434a5918b349bad2bfaac47b92b3276ea Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 26 Dec 2024 16:03:51 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E7=A6=81=E7=94=A8bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Management/UserService.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index be2913ec9..658fa0855 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -556,6 +556,7 @@ namespace IRaCIS.Core.Application.Service addRole.UserTypeEnum = role.UserTypeEnum; addRole.UserTypeId = role.UserTypeId; + addRole.IsUserRoleDisabled = role.IsUserRoleDisabled; addRoleList.Add(addRole); } @@ -685,6 +686,7 @@ namespace IRaCIS.Core.Application.Service addRole.IdentityUserId = user.Id; addRole.UserTypeEnum = role.UserTypeEnum; addRole.UserTypeId = role.UserTypeId; + addRole.IsUserRoleDisabled = role.IsUserRoleDisabled; user.UserRoleList.Add(addRole); } From e0779ab2957ec0914e741247b36cabbd239de08f Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 26 Dec 2024 16:23:30 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=8F=91=E9=82=AE=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/Controllers/ExtraController.cs | 2 +- IRaCIS.Core.Application/Service/Common/MailService.cs | 4 ++-- .../Service/Management/DTO/UserLogViewModel.cs | 3 --- IRaCIS.Core.Application/Service/Management/UserService.cs | 5 ++--- IRaCIS.Core.Application/Service/Management/_MapConfig.cs | 3 +-- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 2 +- IRaCIS.Core.Domain/Management/User.cs | 4 ++++ IRaCIS.Core.Domain/Management/UserLog.cs | 4 ++++ 8 files changed, 15 insertions(+), 12 deletions(-) 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; From 6b9feca8656f0170be67d95d6b6af226dbe76c3f Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 26 Dec 2024 16:48:20 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Management/DTO/UserLogViewModel.cs | 1 + .../Service/Management/UserService.cs | 2 +- .../Service/Management/_MapConfig.cs | 1 + .../AfterSaveTrigger/UserLogAfterTrigger.cs | 13 +++++++++++-- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Management/DTO/UserLogViewModel.cs b/IRaCIS.Core.Application/Service/Management/DTO/UserLogViewModel.cs index bfad70938..5858be3db 100644 --- a/IRaCIS.Core.Application/Service/Management/DTO/UserLogViewModel.cs +++ b/IRaCIS.Core.Application/Service/Management/DTO/UserLogViewModel.cs @@ -17,6 +17,7 @@ namespace IRaCIS.Core.Application.ViewModel public string? ActionUserName { get; set; } + public string ActionUserRoleShortName { get; set; } public DateTime CreateTime { get; set; } public Guid CreateUserId { get; set; } diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index e14cb3801..60822a9d9 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -1130,7 +1130,7 @@ namespace IRaCIS.Core.Application.Service IsZhiZhun = t.IdentityUser.IsZhiZhun, FullName = t.IdentityUser.FullName, PermissionStr = t.UserTypeRole.PermissionStr, - UserName = t.UserName, + UserName = t.IdentityUser.UserName, UserTypeShortName = t.UserTypeRole.UserTypeShortName, }).FirstOrDefaultAsync(); diff --git a/IRaCIS.Core.Application/Service/Management/_MapConfig.cs b/IRaCIS.Core.Application/Service/Management/_MapConfig.cs index a06bade30..47a4784be 100644 --- a/IRaCIS.Core.Application/Service/Management/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Management/_MapConfig.cs @@ -123,6 +123,7 @@ namespace IRaCIS.Core.Application.Service CreateMap() + .ForMember(d => d.ActionUserRoleShortName, c => c.MapFrom(t => t.CreateUserRole.UserTypeRole.UserTypeShortName)) .ForMember(d => d.TargetIdentityUserName, c => c.MapFrom(t => t.TargetIdentityUser.UserName)); diff --git a/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/UserLogAfterTrigger.cs b/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/UserLogAfterTrigger.cs index faf76a78d..ce19b7e24 100644 --- a/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/UserLogAfterTrigger.cs +++ b/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/UserLogAfterTrigger.cs @@ -41,11 +41,20 @@ namespace IRaCIS.Core.Application.Triggers.AfterSaveTrigger }).FirstOrDefaultAsync(); - userlog.JsonObj = obj.ToJsonStr(); - await _identityUserRepository.SaveChangesAsync(); + + userlog.JsonObj = obj.ToJsonStr(); + } + if (userlog.ActionIdentityUserId != null && userlog.ActionUserName.IsNullOrWhiteSpace()) + { + userlog.ActionUserName = await _identityUserRepository.Where(t => t.Id == userlog.ActionIdentityUserId).Select(t => t.UserName).FirstOrDefaultAsync(); + } + + await _identityUserRepository.SaveChangesAsync(); + + } } } From 39616448b8403c73f19426d77772b0dead0b0eeb Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 26 Dec 2024 17:07:31 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=86=85=E9=83=A8?= =?UTF-8?q?=E4=BA=BA=E5=91=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Management/UserService.cs | 2 -- .../TrialSiteUser/TrialMaintenanceService.cs | 27 +++++++++++++------ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index 60822a9d9..72fa8af47 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -1140,8 +1140,6 @@ namespace IRaCIS.Core.Application.Service { var jwt = _tokenService.GetToken(userTokenInfo); - - return jwt; } else diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs index f16fa9675..140cdf627 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs @@ -4,6 +4,7 @@ using IRaCIS.Application.Interfaces; using IRaCIS.Core.Application.Contracts.DTO; using IRaCIS.Core.Application.Filter; using IRaCIS.Core.Domain.Share; +using MassTransit.Serialization; using Microsoft.AspNetCore.Mvc; namespace IRaCIS.Core.Application.Service @@ -174,23 +175,33 @@ namespace IRaCIS.Core.Application.Service //[Authorize(Policy = IRaCISPolicy.PM_APM)] public async Task AddTrialUsers(TrialUserAddCommand[] userTrialCommands) { - foreach (var item in userTrialCommands.GroupBy(t => t.IdentityUserId)) { var currentUserRoleList = item.ToList(); var first = currentUserRoleList.FirstOrDefault(); - var currentUser = new TrialIdentityUser() + var findTrialuser = await _trialIdentityUserRepository.Where(t => t.TrialId == first.TrialId && t.IdentityUserId == item.Key, true).Include(t => t.TrialUserRoleList).FirstOrDefaultAsync(); + + if (findTrialuser == null) { - TrialId = first.TrialId, - IdentityUserId = item.Key, - JoinTime = DateTime.Now, - TrialUserRoleList = currentUserRoleList.Select(t => new TrialUserRole() { UserId = t.UserId, TrialId = t.TrialId }).ToList() - }; + var currentUser = new TrialIdentityUser() + { + TrialId = first.TrialId, + IdentityUserId = item.Key, + JoinTime = DateTime.Now, + TrialUserRoleList = currentUserRoleList.Select(t => new TrialUserRole() { UserId = t.UserId, TrialId = t.TrialId }).ToList() + }; + + + await _trialIdentityUserRepository.AddAsync(currentUser); + } + else + { + findTrialuser.TrialUserRoleList.AddRange(currentUserRoleList.Select(t => new TrialUserRole() { UserId = t.UserId, TrialId = t.TrialId, TrialUserId = findTrialuser.Id }).ToList()); + } - await _trialIdentityUserRepository.AddAsync(currentUser); var success = await _trialIdentityUserRepository.SaveChangesAsync(); From 6e83891139f25bd8ee0f687fd9970c7c6198c319 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 26 Dec 2024 17:10:18 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A8=BD=E6=9F=A5?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Inspection/FrontAuditConfigService.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs index c36602cb3..c7d3b6981 100644 --- a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs @@ -389,8 +389,6 @@ namespace IRaCIS.Core.Application.Service objectLsit.Add(newNamepDic); } - - await AddJsonObjectToDic(relationParentInspection.Id, relationParentInspection.ObjectRelationParentId, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit); await AddJsonObjectToDic(relationParentInspection.Id, relationParentInspection.ObjectRelationParentId2, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit); await AddJsonObjectToDic(relationParentInspection.Id, relationParentInspection.ObjectRelationParentId3, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit); @@ -401,7 +399,7 @@ namespace IRaCIS.Core.Application.Service //用户的数据稽查没有 临时处理 - var userObj = await _userRoleRepository.Where(t => t.Id == objectRelationParentId).Select(t => new { UserRealName = t.FullName, t.Phone, t.UserName, UserType = t.UserTypeRole.UserTypeShortName, t.EMail, t.OrganizationName }).FirstOrDefaultAsync(); + var userObj = await _userRoleRepository.Where(t => t.Id == objectRelationParentId).Select(t => new { UserRealName = t.IdentityUser.FullName, t.IdentityUser.Phone, t.IdentityUser.UserName, UserType = t.UserTypeRole.UserTypeShortName, t.IdentityUser.EMail, t.IdentityUser.OrganizationName }).FirstOrDefaultAsync(); if (userObj != null) {