From 9d70d610133f6a194b40c7e0ef42fa659786bc27 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 14 Feb 2025 16:00:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A5=E5=BF=97=EF=BC=8C?= =?UTF-8?q?=E5=92=8C=E7=A8=BD=E6=9F=A5=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Inspection/InspectionService.cs | 4 +- .../AfterSaveTrigger/UserLogAfterTrigger.cs | 47 +++++++++++-------- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs index 96b4c95f1..dc70cec5a 100644 --- a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs @@ -106,7 +106,7 @@ namespace IRaCIS.Core.Application.Service.Inspection //OptType = data.OptType, IP = data.IP, Reason = data.Reason, - IsSign = leftfrontAuditConfig.IsHaveSign && lefttrialSign.SignText!=null&& lefttrialSign.SignText!=string.Empty, + IsSign = leftfrontAuditConfig.IsHaveSign && lefttrialSign.SignText != null && lefttrialSign.SignText != string.Empty, SignId = data.SignId, ParentId = data.ParentId, ChildrenTypeId = data.ChildrenTypeId, @@ -190,7 +190,7 @@ namespace IRaCIS.Core.Application.Service.Inspection .WhereIf(!inQuery.TaskName.IsNullOrEmpty(), x => x.TaskName.Contains(inQuery.TaskName) || x.BlindName.Contains(inQuery.TaskName)) .WhereIf(!inQuery.SubjectInfo.IsNullOrEmpty(), x => x.SubjectCode.Contains(inQuery.SubjectInfo)) - .WhereIf(!inQuery.RoleName.IsNullOrEmpty(), x => x.RoleName.Contains(inQuery.RoleName)) + .WhereIf(!inQuery.RoleName.IsNullOrEmpty(), x => x.RoleName == inQuery.RoleName) //.WhereIf(dto.VisitPlanInfo != null&& dto.VisitPlanInfo!=(decimal) 1.11, x => x.VisitNum == dto.VisitPlanInfo) //.WhereIf(dto.VisitPlanInfo != (decimal)1.11,x=>x.InPlan!=null&& x.InPlan==false) .WhereIf(inQuery.StartTime != null, x => x.CreateTime >= inQuery.StartTime) diff --git a/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/UserLogAfterTrigger.cs b/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/UserLogAfterTrigger.cs index 48c0017e0..fd7a64379 100644 --- a/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/UserLogAfterTrigger.cs +++ b/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/UserLogAfterTrigger.cs @@ -23,31 +23,40 @@ namespace IRaCIS.Core.Application.Triggers.AfterSaveTrigger if (userlog.TargetIdentityUserId != null) { - var obj = await _identityUserRepository.Where(t => t.Id == userlog.TargetIdentityUserId).Select(t => new UserLogJsonObj() + + //判断是否需要记录详情 + + if (userlog.OptType == UserOptType.AddUser || userlog.OptType == UserOptType.UpdateUser || userlog.OptType == UserOptType.UpdateUserRole + || userlog.OptType == UserOptType.AccountEnable || userlog.OptType == UserOptType.AccountLocked) { - DepartmentName = t.DepartmentName, - EMail = t.EMail, - FirstName = t.FirstName, - LastName = t.LastName, - OrganizationName = t.OrganizationName, - Phone = t.Phone, - PositionName = t.PositionName, - Sex = t.Sex, - Status = t.Status, - UserCode = t.UserCode, - UserName = t.UserName, - UserRoleList = t.UserRoleList.Select(t => new UserRoleLogObj() + var obj = await _identityUserRepository.Where(t => t.Id == userlog.TargetIdentityUserId).Select(t => new UserLogJsonObj() { - IsUserRoleDisabled = t.IsUserRoleDisabled, - UserTypeEnum = t.UserTypeEnum, - UserTypeShortName = t.UserTypeRole.UserTypeShortName - }).ToList() + DepartmentName = t.DepartmentName, + EMail = t.EMail, + FirstName = t.FirstName, + LastName = t.LastName, + OrganizationName = t.OrganizationName, + Phone = t.Phone, + PositionName = t.PositionName, + Sex = t.Sex, + Status = t.Status, + UserCode = t.UserCode, + UserName = t.UserName, + UserRoleList = t.UserRoleList.Select(t => new UserRoleLogObj() + { + IsUserRoleDisabled = t.IsUserRoleDisabled, + UserTypeEnum = t.UserTypeEnum, + UserTypeShortName = t.UserTypeRole.UserTypeShortName + }).ToList() - }).FirstOrDefaultAsync(); + }).FirstOrDefaultAsync(); - userlog.JsonObj = obj.ToJsonStr(); + userlog.JsonObj = obj.ToJsonStr(); + } + + }