From e0ee9abd617e35322932630ff7ee43ba1850381a Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 31 Dec 2024 10:35:03 +0800 Subject: [PATCH 01/18] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=86=85=E9=83=A8?= =?UTF-8?q?=E4=BA=BA=E5=91=98=E9=80=80=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/TrialSiteUser/TrialMaintenanceService.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs index 185c13a10..0b6b8164a 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs @@ -184,7 +184,7 @@ namespace IRaCIS.Core.Application.Service var first = currentUserRoleList.FirstOrDefault(); - var findTrialuser = await _trialIdentityUserRepository.Where(t => t.TrialId == first.TrialId && t.IdentityUserId == item.Key, true).Include(t => t.TrialUserRoleList).FirstOrDefaultAsync(); + var findTrialuser = await _trialIdentityUserRepository.Where(t => t.TrialId == first.TrialId && t.IdentityUserId == item.Key, true, true).Include(t => t.TrialUserRoleList).FirstOrDefaultAsync(); if (findTrialuser == null) { @@ -201,6 +201,13 @@ namespace IRaCIS.Core.Application.Service } else { + if (findTrialuser.IsDeleted = true) + { + findTrialuser.IsDeleted = false; + findTrialuser.JoinTime = DateTime.Now; + findTrialuser.RemoveTime = null; + } + findTrialuser.TrialUserRoleList.AddRange(currentUserRoleList.Select(t => new TrialUserRole() { UserId = t.UserId, TrialId = t.TrialId, TrialUserId = findTrialuser.Id }).ToList()); } From da570f8c5a12134d42decbf84817648cd1d58d88 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 31 Dec 2024 10:41:12 +0800 Subject: [PATCH 02/18] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E4=BA=BA=E5=91=98=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrialSiteUser/TrialExternalUserService.cs | 3 +- .../Service/WorkLoad/EnrollService.cs | 32 +++++++++++++------ 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs index 27f02712a..e49658fbd 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs @@ -323,7 +323,7 @@ namespace IRaCIS.Core.Application.Service return ResponseOutput.NotOk("database dirty data "); } - var findTrialUser = await _trialIdentityUserRepository.Where(t => t.TrialId == trialId && t.IdentityUserId == identityUserId, true).Include(t => t.TrialUserRoleList).ThenInclude(t => t.UserRole).FirstOrDefaultAsync(); + var findTrialUser = await _trialIdentityUserRepository.Where(t => t.TrialId == trialId && t.IdentityUserId == identityUserId, true, true).Include(t => t.TrialUserRoleList).ThenInclude(t => t.UserRole).FirstOrDefaultAsync(); if (findTrialUser == null) { @@ -364,6 +364,7 @@ namespace IRaCIS.Core.Application.Service { findTrialUserRole.IsDeleted = false; findTrialUserRole.DeletedTime = null; + findTrialUserRole.RemoveTime = null; } } diff --git a/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs b/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs index 826936f48..dfa92be9d 100644 --- a/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs +++ b/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs @@ -1,6 +1,7 @@ using DocumentFormat.OpenXml.Vml.Spreadsheet; using IRaCIS.Core.Application.Filter; using IRaCIS.Core.Application.Service.WorkLoad.DTO; +using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Infra.EFCore.Common; using Microsoft.AspNetCore.Mvc; @@ -411,29 +412,42 @@ namespace IRaCIS.Core.Application.Service var (identityUserId, userRoleId) = await _mailVerificationService.DoctorJoinTrialEmail(trialId, intoGroupItem.DoctorId, confirmReviewerCommand.BaseUrl, confirmReviewerCommand.RouteUrl); - var findTrialUser = await _trialIdentityUserRepository.FirstOrDefaultAsync(t => t.IdentityUserId == identityUserId); - //项目中不存在 + var findTrialUser = await _trialIdentityUserRepository.Where(t => t.TrialId == trialId && t.IdentityUserId == identityUserId, true, true).Include(t => t.TrialUserRoleList).ThenInclude(t => t.UserRole).FirstOrDefaultAsync(); + if (findTrialUser == null) { - - await _trialIdentityUserRepository.AddAsync(new TrialIdentityUser() + //没有项目参与人员 + findTrialUser = await _trialIdentityUserRepository.AddAsync(new TrialIdentityUser() { - TrialId = trialId, IdentityUserId = identityUserId, + TrialId = trialId, JoinTime = DateTime.Now, + TrialUserRoleList = new List() { new TrialUserRole() { TrialId = trialId, UserId = userRoleId } } }); - } else { - if (!await _trialUserRoleRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userRoleId, true)) + var findTrialUserRole = findTrialUser.TrialUserRoleList.Where(t => t.UserRole.UserTypeId == userRoleId).FirstOrDefault(); + + if (findTrialUserRole == null) { - await _trialUserRoleRepository.AddAsync(new TrialUserRole() { TrialId = trialId, UserId = userRoleId, TrialUserId = findTrialUser.Id }); + //添加该角色 + findTrialUser.TrialUserRoleList.Add(new TrialUserRole() { TrialUserId = findTrialUser.Id, TrialId = trialId, UserId = userRoleId }); + } + else + { + //如果禁用,那么启用 + if (findTrialUserRole.IsDeleted == true) + { + findTrialUserRole.IsDeleted = false; + findTrialUserRole.DeletedTime = null; + findTrialUserRole.RemoveTime = null; + } + } } - await _userRoleRepository.BatchUpdateNoTrackingAsync(t => t.Id == userRoleId, u => new UserRole() { DoctorId = intoGroupItem.DoctorId }); await _enrollRepository.BatchUpdateNoTrackingAsync(t => t.Id == intoGroupItem.Id, u => new Enroll() { DoctorUserId = userRoleId }); From bfed24028a1e9ed477c3bf7d5c403b310ac7079d Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 31 Dec 2024 11:18:44 +0800 Subject: [PATCH 03/18] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Common/MailService.cs | 19 +++++++++---------- .../SiteSurvey/TrialSiteSurveyService.cs | 12 ++++++++++-- .../TrialSiteUser/TrialExternalUserService.cs | 4 ++-- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Common/MailService.cs b/IRaCIS.Core.Application/Service/Common/MailService.cs index 8d57b1160..6a130b053 100644 --- a/IRaCIS.Core.Application/Service/Common/MailService.cs +++ b/IRaCIS.Core.Application/Service/Common/MailService.cs @@ -30,7 +30,7 @@ namespace IRaCIS.Core.Application.Service Task AdminResetPwdSendEmailAsync(Guid userId, string pwdNotMd5 = "123456"); - Task SiteSurveyUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl); + Task SiteSurveyUserJoinEmail(Guid trialId, Guid userId, string userTypes, string baseUrl, string rootUrl); Task ExternalUserJoinEmail(Guid trialId, Guid userId, string userTypes, string baseUrl, string rootUrl); @@ -301,8 +301,8 @@ namespace IRaCIS.Core.Application.Service var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr), sysUserInfo.FullName, - sysUserInfo.UserName, - string.Join(',', sysUserInfo.UserRoleList.Select(t => t.UserTypeRole.UserTypeShortName)), + sysUserInfo.EMail, + //string.Join(',', sysUserInfo.UserRoleList.Select(t => t.UserTypeRole.UserTypeShortName)), redirectUrl ); @@ -339,7 +339,7 @@ namespace IRaCIS.Core.Application.Service sysUserInfo.FullName, sysUserInfo.UserName, - string.Join(',', sysUserInfo.UserRoleList.Select(t => t.UserTypeRole.UserTypeShortName)), + //string.Join(',', sysUserInfo.UserRoleList.Select(t => t.UserTypeRole.UserTypeShortName)), pwdNotMd5 ); @@ -470,7 +470,7 @@ namespace IRaCIS.Core.Application.Service trialInfo.ExperimentName, trialInfo.ResearchProgramNo, trialInfo.TrialCode, - sysUserInfo.UserName, + sysUserInfo.EMail, userTypes, sysUserInfo.IsFirstAdd ? redirectUrl : baseUrl ); @@ -487,12 +487,11 @@ namespace IRaCIS.Core.Application.Service } //Site调研 用户加入项目 - public async Task SiteSurveyUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl) + public async Task SiteSurveyUserJoinEmail(Guid trialId, Guid userId, string userTypes, string baseUrl, string rootUrl) { var sysUserInfo = (await _identityUserRepository.Where(t => t.Id == userId).FirstOrDefaultAsync()).IfNullThrowException(); - var userTypes = await _userRoleRepository.Where(t => t.IdentityUserId == sysUserInfo.Id).Select(t => t.UserTypeRole.UserTypeShortName).ToListAsync(); var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId); @@ -531,8 +530,8 @@ namespace IRaCIS.Core.Application.Service trialInfo.ExperimentName, trialInfo.ResearchProgramNo, trialInfo.TrialCode, - sysUserInfo.UserName, - string.Join(',', userTypes), + sysUserInfo.EMail, + userTypes, sysUserInfo.IsFirstAdd ? redirectUrl : baseUrl ); @@ -646,7 +645,7 @@ namespace IRaCIS.Core.Application.Service trialInfo.ResearchProgramNo, trialInfo.TrialCode, sysUserInfo.UserName, - userType.UserTypeShortName, + $"{userType.UserTypeShortName} ({userType.UserTypeName})", sysUserInfo.IsFirstAdd ? redirectUrl : baseUrl ); diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 03a1a5fbf..8ded0154e 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -30,6 +30,7 @@ using IdentityModel; using Microsoft.AspNetCore.Components.Routing; using IRaCIS.Core.Application.ViewModel; using Microsoft.AspNetCore.Identity; +using NPOI.SS.Formula.Functions; namespace IRaCIS.Core.Application.Contracts { @@ -991,7 +992,12 @@ namespace IRaCIS.Core.Application.Contracts if (isNeedSendEmail) { - await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, identityUserId, baseUrl, routeUrl); + + var dbUserType = _userTypeRepository.Where(t => userTypeIdList.Contains(t.Id)).ToList(); + + var usertyps = string.Join(',', dbUserType.Select(t => $"{t.UserTypeShortName} ({t.UserTypeName})")); + + await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, identityUserId, usertyps, baseUrl, routeUrl); } var userJoinIdList = item.Select(t => t.Id).ToList(); @@ -1179,7 +1185,9 @@ namespace IRaCIS.Core.Application.Contracts if (isNeedSendEmail) { - await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, identityUserId, baseUrl, routeUrl); + var dbUserType = _userTypeRepository.Where(t => userTypeIdList.Contains(t.Id)).ToList(); + var usertyps = string.Join(',', dbUserType.Select(t => $"{t.UserTypeShortName} ({t.UserTypeName})")); + await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, identityUserId, usertyps, baseUrl, routeUrl); } await _trialSiteUserRoleRepository.SaveChangesAsync(); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs index e49658fbd..7e25fdaf9 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs @@ -314,7 +314,7 @@ namespace IRaCIS.Core.Application.Service var identityUserId = existSysUser.Id; - var userTypeList = await _identityUserRepository.Where(t => t.Id == identityUserId).SelectMany(t => t.UserRoleList).Select(t => new { t.UserTypeId, t.UserTypeRole.UserTypeShortName }).ToListAsync(); + var userTypeList = await _identityUserRepository.Where(t => t.Id == identityUserId).SelectMany(t => t.UserRoleList).Select(t => new { t.UserTypeId, t.UserTypeRole.UserTypeName, t.UserTypeRole.UserTypeShortName }).ToListAsync(); var userHaveUserTypeIdList = userTypeList.Select(t => t.UserTypeId).ToList(); @@ -374,7 +374,7 @@ namespace IRaCIS.Core.Application.Service await _trialIdentityUserRepository.SaveChangesAsync(); - var usertyps = string.Join(',', userTypeList.Where(t => userTypeIdList.Contains(t.UserTypeId)).Select(t => t.UserTypeShortName)); + var usertyps = string.Join(',', userTypeList.Where(t => userTypeIdList.Contains(t.UserTypeId)).Select(t => $"{t.UserTypeShortName} ({t.UserTypeName})")); await _mailVerificationService.ExternalUserJoinEmail(trialId, identityUserId, usertyps, sendEmail.BaseUrl, sendEmail.RouteUrl); From bf2b439ce18c4e32bf378841cfb71469f59ebec2 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 31 Dec 2024 13:12:39 +0800 Subject: [PATCH 04/18] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E7=A6=81=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Common/MailService.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Common/MailService.cs b/IRaCIS.Core.Application/Service/Common/MailService.cs index 6a130b053..a86c5b2a6 100644 --- a/IRaCIS.Core.Application/Service/Common/MailService.cs +++ b/IRaCIS.Core.Application/Service/Common/MailService.cs @@ -595,13 +595,24 @@ namespace IRaCIS.Core.Application.Service - await _userRoleRepository.SaveChangesAsync(); } else { - sysUserInfo = (await _identityUserRepository.Where(t => t.UserRoleList.Any(t => t.DoctorId == doctorId || t.IdentityUser.EMail == doctor.EMail)).Include(t => t.UserRoleList).FirstOrDefaultAsync()).IfNullThrowException(); + sysUserInfo = (await _identityUserRepository.Where(t => t.UserRoleList.Any(t => t.DoctorId == doctorId || t.IdentityUser.EMail == doctor.EMail), true).Include(t => t.UserRoleList).FirstOrDefaultAsync()).IfNullThrowException(); + + //不存在该角色,那么就加入该角色 + if (!sysUserInfo.UserRoleList.Any(t => t.UserTypeId == userType.Id)) + { + sysUserInfo.UserRoleList.Add(new UserRole() { DoctorId = doctorId, UserTypeEnum = UserTypeEnum.IndependentReviewer, UserTypeId = userType.Id }); + } + + sysUserInfo.Status = UserStateEnum.Enable; + } + + //保证能有userRoleId + await _userRoleRepository.SaveChangesAsync(); } From 518ed694fb68d0e605e2a4730421259affa89d67 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 31 Dec 2024 13:28:14 +0800 Subject: [PATCH 05/18] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BA=BA=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 3 -- .../TrialSiteUser/TrialExternalUserService.cs | 9 +++- .../TrialSiteUser/TrialMaintenanceService.cs | 41 +------------------ .../Service/WorkLoad/EnrollService.cs | 13 +++++- 4 files changed, 20 insertions(+), 46 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index ac555c9aa..d828b73ee 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -12913,9 +12913,6 @@ Setting页面 为 site 勾选CRC用户列表 - - 项目参与人员退出 其中IQC退出 回去释放工作量 - 分页获取临床项目列表 默认后台加急状态为3 查所有的 diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs index 7e25fdaf9..3d3064922 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs @@ -346,6 +346,14 @@ namespace IRaCIS.Core.Application.Service { //有该人员 + if (findTrialUser.IsDeleted == true) + { + findTrialUser.IsDeleted = false; + findTrialUser.DeletedTime = null; + findTrialUser.RemoveTime = null; + findTrialUser.JoinTime = DateTime.Now; + } + //是否有该角色 foreach (var userTypeId in userTypeIdList) @@ -364,7 +372,6 @@ namespace IRaCIS.Core.Application.Service { findTrialUserRole.IsDeleted = false; findTrialUserRole.DeletedTime = null; - findTrialUserRole.RemoveTime = null; } } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs index 0b6b8164a..a8d6b7071 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs @@ -204,6 +204,7 @@ namespace IRaCIS.Core.Application.Service if (findTrialuser.IsDeleted = true) { findTrialuser.IsDeleted = false; + findTrialuser.DeletedTime = null; findTrialuser.JoinTime = DateTime.Now; findTrialuser.RemoveTime = null; } @@ -245,45 +246,5 @@ namespace IRaCIS.Core.Application.Service - - - - - - - - /// 项目参与人员退出 其中IQC退出 回去释放工作量 - //[TrialAudit(AuditType.TrialAudit, AuditOptType.DeleteTrailStaff)] - [HttpDelete, Route("{id:guid}/{trialId:guid}/{isDelete:bool}")] - [TrialGlobalLimit("AfterStopCannNotOpt")] - [UnitOfWork] - [Obsolete] - public async Task DeleteMaintenanceUser(Guid id, bool isDelete) - { - - var trialUser = await _trialUseRoleRepository.AsQueryable().IgnoreQueryFilters().FirstOrDefaultAsync(t => t.Id == id); - - if (trialUser == null) return Null404NotFound(trialUser); - - if (await _trialSiteUserRoleRepository.AnyAsync(t => t.UserId == trialUser.UserId && t.TrialId == trialUser.TrialId)) - { - //---人员已加入现场维护 - return ResponseOutput.NotOk(_localizer["TrialMaint_PersonnelJoined"]); - } - - if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IQC && isDelete) - { - await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.CurrentActionUserId == trialUser.UserId && t.TrialId == trialUser.TrialId && t.IsTake, u => new SubjectVisit() { CurrentActionUserId = null, CurrentActionUserExpireTime = null, IsTake = false }); - } - - await _trialUseRoleRepository.BatchUpdateNoTrackingAsync(t => t.Id == id, u => new TrialUserRole() { IsDeleted = isDelete, RemoveTime = isDelete ? DateTime.Now : null }); - - await _trialUseRoleRepository.SaveChangesAsync(); - - return ResponseOutput.Ok(); - } - - - } } diff --git a/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs b/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs index dfa92be9d..0a4ece20c 100644 --- a/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs +++ b/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs @@ -428,6 +428,16 @@ namespace IRaCIS.Core.Application.Service } else { + + if (findTrialUser.IsDeleted == true) + { + findTrialUser.IsDeleted = false; + findTrialUser.DeletedTime = null; + findTrialUser.RemoveTime = null; + findTrialUser.JoinTime = DateTime.Now; + + } + var findTrialUserRole = findTrialUser.TrialUserRoleList.Where(t => t.UserRole.UserTypeId == userRoleId).FirstOrDefault(); if (findTrialUserRole == null) @@ -441,8 +451,7 @@ namespace IRaCIS.Core.Application.Service if (findTrialUserRole.IsDeleted == true) { findTrialUserRole.IsDeleted = false; - findTrialUserRole.DeletedTime = null; - findTrialUserRole.RemoveTime = null; + findTrialUser.DeletedTime = null; } } From 9571775343c8ebd9ae936cb4ebdcfedda691474f Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 31 Dec 2024 13:37:22 +0800 Subject: [PATCH 06/18] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=AF=E7=94=A8?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=8F=82=E4=B8=8E=E4=BA=BA=E5=91=98=E7=9A=84?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SiteSurvey/TrialSiteSurveyService.cs | 24 +++++++++++++++++-- .../TrialSiteUser/TrialExternalUserService.cs | 2 +- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 8ded0154e..d8aebca1a 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -906,7 +906,7 @@ namespace IRaCIS.Core.Application.Contracts generateUser.Password = MD5Helper.Md5(IRCEmailPasswordHelper.GenerateRandomPassword(10)); - generateUser.Status = UserStateEnum.Disable; + generateUser.Status = UserStateEnum.Enable; generateUser.UserRoleList = new List() { }; @@ -965,6 +965,16 @@ namespace IRaCIS.Core.Application.Contracts //有该人员 //是否有该角色 + + if (findTrialUser.IsDeleted == true) + { + findTrialUser.IsDeleted = false; + findTrialUser.DeletedTime = null; + findTrialUser.RemoveTime = null; + findTrialUser.JoinTime = DateTime.Now; + } + + foreach (var userTypeId in userTypeIdList) { var findTrialUserRole = findTrialUser.TrialUserRoleList.Where(t => t.UserRole.UserTypeId == userTypeId).FirstOrDefault(); @@ -1099,7 +1109,7 @@ namespace IRaCIS.Core.Application.Contracts generateUser.Password = MD5Helper.Md5(IRCEmailPasswordHelper.GenerateRandomPassword(10)); - generateUser.Status = UserStateEnum.Disable; + generateUser.Status = UserStateEnum.Enable; generateUser.UserRoleList = new List() { }; @@ -1158,6 +1168,16 @@ namespace IRaCIS.Core.Application.Contracts //有该人员 //是否有该角色 + if (findTrialUser.IsDeleted == true) + { + findTrialUser.IsDeleted = false; + findTrialUser.DeletedTime = null; + findTrialUser.RemoveTime = null; + findTrialUser.JoinTime = DateTime.Now; + } + + + foreach (var userTypeId in userTypeIdList) { var findTrialUserRole = findTrialUser.TrialUserRoleList.Where(t => t.UserRole.UserTypeId == userTypeId).FirstOrDefault(); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs index 3d3064922..80b766af9 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs @@ -277,7 +277,7 @@ namespace IRaCIS.Core.Application.Service generateUser.Password = MD5Helper.Md5(IRCEmailPasswordHelper.GenerateRandomPassword(10)); - generateUser.Status = UserStateEnum.Disable; + generateUser.Status = UserStateEnum.Enable; generateUser.UserRoleList = new List() { }; From be1f8dfad96ed5672cf2f479a72f1d8d3346b06d Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 31 Dec 2024 14:00:07 +0800 Subject: [PATCH 07/18] =?UTF-8?q?=E8=AE=B0=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/Service/Common/MailService.cs | 7 +++++++ .../AfterSaveTrigger/IdenttiyUserRoleInfoTrigger.cs | 9 ++++++++- .../Triggers/AfterSaveTrigger/UserLogAfterTrigger.cs | 7 +++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/Common/MailService.cs b/IRaCIS.Core.Application/Service/Common/MailService.cs index a86c5b2a6..a39684122 100644 --- a/IRaCIS.Core.Application/Service/Common/MailService.cs +++ b/IRaCIS.Core.Application/Service/Common/MailService.cs @@ -44,6 +44,7 @@ namespace IRaCIS.Core.Application.Service IRepository _visitTaskRepository, IRepository _trialSiteRepository, IRepository _userRoleRepository, + IRepository _userLogRepository, IRepository _identityUserRepository, IRepository _userFeedBackRepository, ITokenService _tokenService, @@ -484,6 +485,8 @@ namespace IRaCIS.Core.Application.Service await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, null); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = userId, OptType = UserOptType.UpdateUserRole }, true); + } //Site调研 用户加入项目 @@ -544,6 +547,7 @@ namespace IRaCIS.Core.Application.Service await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = userId, OptType = UserOptType.UpdateUserRole }, true); } @@ -669,6 +673,9 @@ namespace IRaCIS.Core.Application.Service await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, null); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = sysUserInfo.Id, OptType = UserOptType.UpdateUserRole }, true); + + return (sysUserInfo.Id, sysUserInfo.UserRoleList.First(t => t.UserTypeEnum == UserTypeEnum.IndependentReviewer).Id); } diff --git a/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/IdenttiyUserRoleInfoTrigger.cs b/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/IdenttiyUserRoleInfoTrigger.cs index 9df9f4542..eee6976d3 100644 --- a/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/IdenttiyUserRoleInfoTrigger.cs +++ b/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/IdenttiyUserRoleInfoTrigger.cs @@ -8,7 +8,11 @@ using System.Threading.Tasks; namespace IRaCIS.Core.Application.Triggers.AfterSaveTrigger { - + /// + /// 维护用户角色表中的账户信息 + /// + /// + /// public class IdenttiyUserRoleInfoTrigger(IRepository _identityUserRepository, IRepository _userRoleRepository) : IAfterSaveTrigger { public async Task AfterSave(ITriggerContext context, CancellationToken cancellationToken) @@ -25,4 +29,7 @@ namespace IRaCIS.Core.Application.Triggers.AfterSaveTrigger }); } } + + + } diff --git a/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/UserLogAfterTrigger.cs b/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/UserLogAfterTrigger.cs index ce19b7e24..48c0017e0 100644 --- a/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/UserLogAfterTrigger.cs +++ b/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/UserLogAfterTrigger.cs @@ -8,6 +8,10 @@ using System.Threading.Tasks; namespace IRaCIS.Core.Application.Triggers.AfterSaveTrigger { + /// + /// 账户日志 记录账户每次操作的信息 + /// + /// public class UserLogAfterTrigger(IRepository _identityUserRepository) : IAfterSaveTrigger { public async Task AfterSave(ITriggerContext context, CancellationToken cancellationToken) @@ -58,4 +62,7 @@ namespace IRaCIS.Core.Application.Triggers.AfterSaveTrigger } } } + + + } From e4c602095ffc3b2739881884cbd4109b6986e52f Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 31 Dec 2024 15:44:09 +0800 Subject: [PATCH 08/18] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/TrialSiteUser/TrialMaintenanceService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs index a8d6b7071..8f7f6b995 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs @@ -132,7 +132,7 @@ namespace IRaCIS.Core.Application.Service //之前已经选择的用户 不放在列表中,现在又要改回去 废弃 - var query = _userRoleRepository.Where(t => t.UserTypeEnum != UserTypeEnum.SuperAdmin) + var query = _userRoleRepository.Where(t => t.UserTypeEnum != UserTypeEnum.SuperAdmin && t.Status == UserStateEnum.Enable) //正式或者培训的项目 不能允许测试用户(必须正式用户) 同时必须是内部的用户 .WhereIf(trialType == TrialType.OfficialTrial || trialType == TrialType.Training, t => t.IdentityUser.IsTestUser == false && t.IdentityUser.IsZhiZhun) From e696873025a908261f012f4b18ecce6ba7af5f9b Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 31 Dec 2024 15:50:41 +0800 Subject: [PATCH 09/18] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/TrialSiteUser/TrialMaintenanceService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs index 8f7f6b995..2242e9d92 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs @@ -132,7 +132,7 @@ namespace IRaCIS.Core.Application.Service //之前已经选择的用户 不放在列表中,现在又要改回去 废弃 - var query = _userRoleRepository.Where(t => t.UserTypeEnum != UserTypeEnum.SuperAdmin && t.Status == UserStateEnum.Enable) + var query = _userRoleRepository.Where(t => t.UserTypeEnum != UserTypeEnum.SuperAdmin && t.IdentityUser.Status == UserStateEnum.Enable) //正式或者培训的项目 不能允许测试用户(必须正式用户) 同时必须是内部的用户 .WhereIf(trialType == TrialType.OfficialTrial || trialType == TrialType.Training, t => t.IdentityUser.IsTestUser == false && t.IdentityUser.IsZhiZhun) From 86236e865e821c68ac5f83caf9ff9217246ee504 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 31 Dec 2024 16:44:31 +0800 Subject: [PATCH 10/18] =?UTF-8?q?=E5=A4=96=E9=83=A8=E4=BA=BA=E5=91=98bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 26 +++++++++++++++++++ .../TrialSiteUser/TrialExternalUserService.cs | 6 +++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index d828b73ee..f64bf0e03 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -17096,6 +17096,32 @@ + + + 维护用户角色表中的账户信息 + + + + + + + 维护用户角色表中的账户信息 + + + + + + + 账户日志 记录账户每次操作的信息 + + + + + + 账户日志 记录账户每次操作的信息 + + + 因为可能先一致性核查通过,生成其他标准的任务了,新签名的标准也需要产生任务 diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs index 80b766af9..54daa6537 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs @@ -294,6 +294,10 @@ namespace IRaCIS.Core.Application.Service var newAddUser = await _identityUserRepository.AddAsync(generateUser); + + + existSysUser = newAddUser; + await _trialExternalUseRepository.BatchUpdateNoTrackingAsync(t => externalIdList.Contains(t.Id), u => new TrialExternalUser() { IsSystemUser = false, @@ -304,8 +308,6 @@ namespace IRaCIS.Core.Application.Service Phone = existSysUser.Phone, }); - existSysUser = newAddUser; - } await _identityUserRepository.SaveChangesAsync(); From 8b3dd419b734a40ed8cea5e5a7dce87a95d1d388 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 31 Dec 2024 16:49:17 +0800 Subject: [PATCH 11/18] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=A7=92=E8=89=B2=E5=90=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Common/MailService.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/Common/MailService.cs b/IRaCIS.Core.Application/Service/Common/MailService.cs index a39684122..7c283a183 100644 --- a/IRaCIS.Core.Application/Service/Common/MailService.cs +++ b/IRaCIS.Core.Application/Service/Common/MailService.cs @@ -605,11 +605,17 @@ namespace IRaCIS.Core.Application.Service { sysUserInfo = (await _identityUserRepository.Where(t => t.UserRoleList.Any(t => t.DoctorId == doctorId || t.IdentityUser.EMail == doctor.EMail), true).Include(t => t.UserRoleList).FirstOrDefaultAsync()).IfNullThrowException(); + + var findRole = sysUserInfo.UserRoleList.FirstOrDefault(t => t.UserTypeId == userType.Id); //不存在该角色,那么就加入该角色 - if (!sysUserInfo.UserRoleList.Any(t => t.UserTypeId == userType.Id)) + if (findRole == null) { sysUserInfo.UserRoleList.Add(new UserRole() { DoctorId = doctorId, UserTypeEnum = UserTypeEnum.IndependentReviewer, UserTypeId = userType.Id }); } + else + { + findRole.IsUserRoleDisabled = false; + } sysUserInfo.Status = UserStateEnum.Enable; From 6089fef0a80c7e2423b96ae34858d7ba0b6c2057 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 31 Dec 2024 17:27:44 +0800 Subject: [PATCH 12/18] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E5=86=85=E5=AE=B9=20=E9=A6=96=E6=AC=A1=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E5=8C=BA=E5=88=86=E7=94=A8=E6=88=B7=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Common/MailService.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Common/MailService.cs b/IRaCIS.Core.Application/Service/Common/MailService.cs index 7c283a183..665d2dc4f 100644 --- a/IRaCIS.Core.Application/Service/Common/MailService.cs +++ b/IRaCIS.Core.Application/Service/Common/MailService.cs @@ -471,7 +471,7 @@ namespace IRaCIS.Core.Application.Service trialInfo.ExperimentName, trialInfo.ResearchProgramNo, trialInfo.TrialCode, - sysUserInfo.EMail, + sysUserInfo.IsFirstAdd ? sysUserInfo.EMail : sysUserInfo.UserName, userTypes, sysUserInfo.IsFirstAdd ? redirectUrl : baseUrl ); @@ -533,7 +533,7 @@ namespace IRaCIS.Core.Application.Service trialInfo.ExperimentName, trialInfo.ResearchProgramNo, trialInfo.TrialCode, - sysUserInfo.EMail, + sysUserInfo.IsFirstAdd ? sysUserInfo.EMail : sysUserInfo.UserName, userTypes, sysUserInfo.IsFirstAdd ? redirectUrl : baseUrl ); @@ -665,7 +665,7 @@ namespace IRaCIS.Core.Application.Service trialInfo.ExperimentName, trialInfo.ResearchProgramNo, trialInfo.TrialCode, - sysUserInfo.UserName, + sysUserInfo.IsFirstAdd ? sysUserInfo.EMail : sysUserInfo.UserName, $"{userType.UserTypeShortName} ({userType.UserTypeName})", sysUserInfo.IsFirstAdd ? redirectUrl : baseUrl ); From ba49164db6aea646ea7f97176b70cafe313b71a4 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 31 Dec 2024 17:49:45 +0800 Subject: [PATCH 13/18] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E8=B0=83=E7=A0=94=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Management/UserService.cs | 5 ++++- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index f47188a63..dc43fb811 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -503,8 +503,11 @@ namespace IRaCIS.Core.Application.Service var user = await _identityUserRepository.Where(t => t.Id == identityUserId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync(); - user.AccountList = await _userRoleRepository.Where(t => t.IdentityUserId == identityUserId).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + if (user != null) + { + user.AccountList = await _userRoleRepository.Where(t => t.IdentityUserId == identityUserId).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + } return user; } diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index d8aebca1a..80086e4a6 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -523,7 +523,7 @@ namespace IRaCIS.Core.Application.Contracts } else if (verifyRecord.ExpirationTime < DateTime.Now) { - return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_WrongVerificationCode"]); + return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_ExpiredVerificationCode"]); } else { From 678599f218bc5205332b4bbcdd96620564643cfe Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 2 Jan 2025 10:48:07 +0800 Subject: [PATCH 14/18] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E8=AE=BE=E7=BD=AEid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 80086e4a6..056ca1843 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -874,6 +874,7 @@ namespace IRaCIS.Core.Application.Contracts { //不存在该角色,那么就添加 var addRole = _mapper.Map(existSysUser); + addRole.Id = NewId.NextSequentialGuid(); addRole.UserTypeEnum = _userTypeRepository.Where(t => t.Id == userTypeId).Select(t => t.UserTypeEnum).First(); addRole.UserTypeId = userTypeId.Value; addRole.IsUserRoleDisabled = false; @@ -1077,6 +1078,7 @@ namespace IRaCIS.Core.Application.Contracts { //不存在该角色,那么就添加 var addRole = _mapper.Map(existSysUser); + addRole.Id = NewId.NextSequentialGuid(); addRole.UserTypeEnum = _userTypeRepository.Where(t => t.Id == userTypeId).Select(t => t.UserTypeEnum).First(); addRole.UserTypeId = userTypeId; addRole.IsUserRoleDisabled = false; From 52efdc28e47d849cd1a030cc5a0037cc3221167b Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 2 Jan 2025 11:19:17 +0800 Subject: [PATCH 15/18] =?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 --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 4 +++- IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 056ca1843..85abc868c 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -895,6 +895,7 @@ namespace IRaCIS.Core.Application.Contracts generateUser.IsTestUser = true; } + generateUser.Id = NewId.NextSequentialGuid(); // 外部人员生成账号 都是外部的 generateUser.IsZhiZhun = false; @@ -1099,6 +1100,8 @@ namespace IRaCIS.Core.Application.Contracts generateUser.IsTestUser = true; } + generateUser.Id = NewId.NextSequentialGuid(); + // 外部人员生成账号 都是外部的 generateUser.IsZhiZhun = false; @@ -1108,7 +1111,6 @@ namespace IRaCIS.Core.Application.Contracts //generateUser.UserName = generateUser.UserCode; - generateUser.Password = MD5Helper.Md5(IRCEmailPasswordHelper.GenerateRandomPassword(10)); generateUser.Status = UserStateEnum.Enable; diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs b/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs index 80b34555b..b7353328d 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs @@ -93,8 +93,11 @@ namespace IRaCIS.Core.Application.AutoMapper .ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.UserTypeRole.UserTypeEnum)); + CreateMap(); + CreateMap(); + } } } \ No newline at end of file From 1fa94b95f04083d29170068c252485d7ba9dd8e1 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 2 Jan 2025 11:26:18 +0800 Subject: [PATCH 16/18] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 4 ++-- .../Service/TrialSiteUser/TrialExternalUserService.cs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 85abc868c..4abacc872 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -1007,7 +1007,7 @@ namespace IRaCIS.Core.Application.Contracts var dbUserType = _userTypeRepository.Where(t => userTypeIdList.Contains(t.Id)).ToList(); - var usertyps = string.Join(',', dbUserType.Select(t => $"{t.UserTypeShortName} ({t.UserTypeName})")); + var usertyps = string.Join(',', dbUserType.Select(t => t.UserTypeName)); await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, identityUserId, usertyps, baseUrl, routeUrl); } @@ -1210,7 +1210,7 @@ namespace IRaCIS.Core.Application.Contracts if (isNeedSendEmail) { var dbUserType = _userTypeRepository.Where(t => userTypeIdList.Contains(t.Id)).ToList(); - var usertyps = string.Join(',', dbUserType.Select(t => $"{t.UserTypeShortName} ({t.UserTypeName})")); + var usertyps = string.Join(',', dbUserType.Select(t => t.UserTypeName)); await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, identityUserId, usertyps, baseUrl, routeUrl); } await _trialSiteUserRoleRepository.SaveChangesAsync(); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs index 54daa6537..f77d0e177 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs @@ -383,7 +383,8 @@ namespace IRaCIS.Core.Application.Service await _trialIdentityUserRepository.SaveChangesAsync(); - var usertyps = string.Join(',', userTypeList.Where(t => userTypeIdList.Contains(t.UserTypeId)).Select(t => $"{t.UserTypeShortName} ({t.UserTypeName})")); + + var usertyps = string.Join(',', userTypeList.Where(t => userTypeIdList.Contains(t.UserTypeId)).Select(t => t.UserTypeName)); await _mailVerificationService.ExternalUserJoinEmail(trialId, identityUserId, usertyps, sendEmail.BaseUrl, sendEmail.RouteUrl); From 25a91904b8fe4462a5b926d738019bf59c645d45 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 2 Jan 2025 13:09:21 +0800 Subject: [PATCH 17/18] =?UTF-8?q?=E5=8A=A0=E4=BA=BA=E8=BD=AF=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E9=80=BB=E8=BE=91=E6=9C=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 4abacc872..24e25be6b 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -938,7 +938,7 @@ namespace IRaCIS.Core.Application.Contracts var identityUserId = existSysUser.Id; - var findTrialUser = await _trialIdentityUserRepository.Where(t => t.TrialId == trialId && t.IdentityUserId == identityUserId, true).Include(t => t.TrialUserRoleList).ThenInclude(t => t.UserRole).FirstOrDefaultAsync(); + var findTrialUser = await _trialIdentityUserRepository.Where(t => t.TrialId == trialId && t.IdentityUserId == identityUserId, true, true).Include(t => t.TrialUserRoleList).ThenInclude(t => t.UserRole).FirstOrDefaultAsync(); var isNeedSendEmail = false; @@ -1143,7 +1143,7 @@ namespace IRaCIS.Core.Application.Contracts var identityUserId = existSysUser.Id; - var findTrialUser = await _trialIdentityUserRepository.Where(t => t.TrialId == trialId && t.IdentityUserId == identityUserId, true).Include(t => t.TrialUserRoleList).ThenInclude(t => t.UserRole).FirstOrDefaultAsync(); + var findTrialUser = await _trialIdentityUserRepository.Where(t => t.TrialId == trialId && t.IdentityUserId == identityUserId, true, true).Include(t => t.TrialUserRoleList).ThenInclude(t => t.UserRole).FirstOrDefaultAsync(); var isNeedSendEmail = false; @@ -1207,6 +1207,15 @@ namespace IRaCIS.Core.Application.Contracts } + //加入到Site CRC + + foreach (var site in addUserRoleList) + { + + //var findTrialSiteUserRole=_trialSiteUserRoleRepository.Where(t=>t.TrialId==trialId && t.user) + + } + if (isNeedSendEmail) { var dbUserType = _userTypeRepository.Where(t => userTypeIdList.Contains(t.Id)).ToList(); From 8a26c4285755337bc12a2a8c9bcf95e8635c83ca Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 2 Jan 2025 13:20:55 +0800 Subject: [PATCH 18/18] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=B0=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SiteSurvey/TrialSiteSurveyService.cs | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 24e25be6b..83a40e9a1 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -31,6 +31,7 @@ using Microsoft.AspNetCore.Components.Routing; using IRaCIS.Core.Application.ViewModel; using Microsoft.AspNetCore.Identity; using NPOI.SS.Formula.Functions; +using System.Security.Policy; namespace IRaCIS.Core.Application.Contracts { @@ -1209,10 +1210,36 @@ namespace IRaCIS.Core.Application.Contracts //加入到Site CRC - foreach (var site in addUserRoleList) + foreach (var trialsSiteItem in addUserRoleList.GroupBy(t => t.TrialSiteId)) { + var siteUserRoleList = trialsSiteItem.ToList(); - //var findTrialSiteUserRole=_trialSiteUserRoleRepository.Where(t=>t.TrialId==trialId && t.user) + foreach (var siteUserRole in siteUserRoleList) + { + var findUserRole = existSysUser.UserRoleList.Where(t => t.UserTypeId == siteUserRole.UserTypeId).FirstOrDefault(); + + if (findUserRole != null) + { + + var findTrialSiteUserRole = await _trialSiteUserRoleRepository.Where(t => t.TrialId == trialId && t.TrialSiteId == trialsSiteItem.Key && t.UserId == findUserRole.Id, true, true).FirstOrDefaultAsync(); + + if (findTrialSiteUserRole != null) + { + findTrialSiteUserRole.IsDeleted = false; + findTrialSiteUserRole.DeletedTime = null; + + } + else + { + await _trialSiteUserRoleRepository.AddAsync(new TrialSiteUserRole() { TrialId = trialId, TrialSiteId = trialsSiteItem.Key, UserId = findUserRole.Id }); + } + + } + else + { + throw new BusinessValidationFailedException("database dirty data ,pleasse check"); + } + } }