From d00158fa3866374e8f10f61a569c057c8dcb2809 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 5 Jul 2023 10:33:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 19 +++++++++++++++++++ .../Service/Management/UserLogService.cs | 3 +-- .../Service/Management/UserService.cs | 14 +++++++------- IRaCIS.Core.Domain/Management/UserLog.cs | 5 +++-- 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 2da86bd79..8ec9ae1cf 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -1148,6 +1148,11 @@ 获取登陆用户的系统通知列表 只是过滤了用户类型 和已经发布的 + + + UserLogService + + 验证CRC 是否已提交 已提交 就不允许进行任何操作,如果是IQC 那么还验证是否是当前任务领取人 @@ -8191,6 +8196,15 @@ SystemNoticeAddOrEdit 列表查询参数模型 + + UserLogView 列表视图模型 + + + UserLogQuery 列表查询参数模型 + + + UserLogAddOrEdit 列表查询参数模型 + 靶病灶是否为IUPD或者ICPD @@ -9019,6 +9033,11 @@ ISystemNoticeService + + + IUserLogService + + ISubjectCriteriaEvaluationService diff --git a/IRaCIS.Core.Application/Service/Management/UserLogService.cs b/IRaCIS.Core.Application/Service/Management/UserLogService.cs index b1233aaad..58080018f 100644 --- a/IRaCIS.Core.Application/Service/Management/UserLogService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserLogService.cs @@ -33,13 +33,12 @@ namespace IRaCIS.Core.Application.Service var userLogQueryable = _userLogRepository - .WhereIf(inQuery.TrialId != null, t => t.CreateUser.UserTrials.Any(c => c.TrialId == inQuery.TrialId && c.UserId == t.CreateUserId)) + .WhereIf(inQuery.TrialId != null, t => t.LoginUser.UserTrials.Any(c => c.TrialId == inQuery.TrialId && c.UserId == t.CreateUserId)) .WhereIf(inQuery.OptType!=null ,t=>t.OptType==inQuery.OptType) .WhereIf(inQuery.BeginDate != null, t => t.CreateTime >= inQuery.BeginDate) .WhereIf(inQuery.EndDate != null, t => t.CreateTime <= inQuery.EndDate) .WhereIf(!string.IsNullOrEmpty(inQuery.LoginName) , t => t.LoginName.Contains(inQuery.LoginName) ) .WhereIf(!string.IsNullOrEmpty(inQuery.IP), t => t.IP.Contains(inQuery.IP)) - .WhereIf(!string.IsNullOrEmpty(inQuery.LoginName), t => t.LoginName.Contains(inQuery.LoginName)) .ProjectTo(_mapper.ConfigurationProvider); var pageList = await userLogQueryable.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? "Id" : inQuery.SortField,inQuery.Asc); diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index db3c324d9..3f307dc72 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -295,7 +295,7 @@ namespace IRaCIS.Application.Services IsFirstAdd = true }); - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, CreateUserId = _userInfo.Id, LoginName = _userInfo.UserName, IsSuccess = true, OptType = UserOptType.AdminResetPassword }, true); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, LoginName = _userInfo.UserName, IsSuccess = true, OptType = UserOptType.AdminResetPassword }, true); return ResponseOutput.Ok(); } @@ -407,7 +407,7 @@ namespace IRaCIS.Application.Services IsFirstAdd = false }); - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, CreateUserId = _userInfo.Id, LoginName =string.Empty,LoginPassword=newPwd, IsSuccess = true, OptType = UserOptType.ModifyPassword }, true); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, LoginName =string.Empty,LoginPassword=newPwd, IsSuccess = true, OptType = UserOptType.ModifyPassword }, true); return ResponseOutput.Result(success); @@ -443,7 +443,7 @@ namespace IRaCIS.Application.Services IsFirstAdd = false }); - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, CreateUserId = _userInfo.Id, LoginName = _userInfo.UserName, IsSuccess = true, OptType = UserOptType.ModifyPassword }, true); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, LoginName = _userInfo.UserName, IsSuccess = true, OptType = UserOptType.ModifyPassword }, true); return ResponseOutput.Result(success); @@ -647,7 +647,7 @@ namespace IRaCIS.Application.Services if (failCount >= maxFailures) { - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, CreateUserId = Guid.Empty, LoginName = userName,LoginPassword=password, IsSuccess = false, OptType = UserOptType.AccountLocked }, true); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = Guid.Empty, LoginName = userName,LoginPassword=password, IsSuccess = false, OptType = UserOptType.AccountLocked }, true); throw new BusinessValidationFailedException($"密码连续错误{maxFailures}次,当前账号已被限制登录,请等待 {lockoutMinutes} 分钟后再试。"); } @@ -682,7 +682,7 @@ namespace IRaCIS.Application.Services failCount++; _cache.Set(cacheKey, failCount, TimeSpan.FromMinutes(lockoutMinutes)); - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, CreateUserId = Guid.Empty, LoginName = userName, LoginPassword = password, IsSuccess = false, OptType = UserOptType.AccountOrPasswordError }, true); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = Guid.Empty, LoginName = userName, LoginPassword = password, IsSuccess = false, OptType = UserOptType.AccountOrPasswordError }, true); return ResponseOutput.NotOk(_localizer["User_CheckNameOrPw"], new LoginReturnDTO()); @@ -700,7 +700,7 @@ namespace IRaCIS.Application.Services //登录成功 清除缓存 _cache.Set(cacheKey, 0, TimeSpan.FromMinutes(lockoutMinutes)); - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, CreateUserId = loginUser.Id, LoginName = userName, IsSuccess = true, OptType = UserOptType.Login }, true); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = loginUser.Id, LoginName = userName, IsSuccess = true, OptType = UserOptType.Login }, true); userLoginReturnModel.BasicInfo = loginUser; @@ -715,7 +715,7 @@ namespace IRaCIS.Application.Services public async Task LoginOut(Guid userId,string loginName) { - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, CreateUserId = userId, LoginName = loginName, IsSuccess = true, OptType = UserOptType.LoginOut },true); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = userId, LoginName = loginName, IsSuccess = true, OptType = UserOptType.LoginOut },true); return ResponseOutput.Ok(); } diff --git a/IRaCIS.Core.Domain/Management/UserLog.cs b/IRaCIS.Core.Domain/Management/UserLog.cs index 0c78d92d0..0c46befd2 100644 --- a/IRaCIS.Core.Domain/Management/UserLog.cs +++ b/IRaCIS.Core.Domain/Management/UserLog.cs @@ -34,13 +34,14 @@ namespace IRaCIS.Core.Domain.Models public UserOptType OptType { get; set; } - public string LoginPassword { get; set; } + public string LoginPassword { get; set; } = string.Empty; public bool IsSuccess { get; set; } + public Guid? LoginUserId { get;set; } [JsonIgnore] - public User CreateUser { get; set; } + public User LoginUser { get; set; } }