From 2b424ff45c2b90f230453a31c54bbf9900a93e05 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 13 Jun 2024 17:42:04 +0800 Subject: [PATCH 1/4] =?UTF-8?q?site=20=E8=B0=83=E7=A0=94=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SiteSurvey/DTO/TrialSiteSurveyViewModel.cs | 2 ++ .../Service/SiteSurvey/TrialSiteSurveyService.cs | 8 ++++++-- IRaCIS.Core.Domain.Share/Trial/TrialExpedited.cs | 11 +++++++++++ IRaCIS.Core.Domain/Trial/Trial.cs | 3 +++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs index aceccc161..38904e2cf 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs @@ -67,6 +67,8 @@ namespace IRaCIS.Core.Application.Contracts public List TrialSiteEquipmentSurveyList { get; set; } = new List(); public List TrialSiteUserSurveyList { get; set; } = new List(); + + public List FileConfigList { get; set; } = new List(); } public class TrialSiteUserSurveyAllDTO : TrialSiteUserSurveyView diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 52e7c802e..96a3c8bc8 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -22,6 +22,8 @@ using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Application.ViewModel; using Medallion.Threading; using Microsoft.Extensions.Options; +using NPOI.SS.Formula.Functions; +using Newtonsoft.Json; namespace IRaCIS.Core.Application.Contracts { @@ -386,10 +388,12 @@ namespace IRaCIS.Core.Application.Contracts } - - var result = await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId && t.TrialId == trialId).IgnoreQueryFilters() .ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync().IfNullThrowException(); + + var siteSurveryConfig= _trialSiteSurveyRepository.Where(t=>t.Id == trialSiteSurveyId).Select(t=>t.Trial.SiteSurveyConfigJsonStr).FirstOrDefault(); + + result.FileConfigList= JsonConvert.DeserializeObject>(siteSurveryConfig) ?? new List(); return result; } diff --git a/IRaCIS.Core.Domain.Share/Trial/TrialExpedited.cs b/IRaCIS.Core.Domain.Share/Trial/TrialExpedited.cs index 8a794bf0e..655849cbd 100644 --- a/IRaCIS.Core.Domain.Share/Trial/TrialExpedited.cs +++ b/IRaCIS.Core.Domain.Share/Trial/TrialExpedited.cs @@ -39,6 +39,17 @@ } + public class SiteSurveyFiledConfig + { + public string NotShowField { get; set; } + + public string NeedMofifyFiled { get; set; } + + public string ReplaceContent { get; set; } + + public string ReplaceContentCN { get; set; } + } + public enum DeclarationType { Other=3, diff --git a/IRaCIS.Core.Domain/Trial/Trial.cs b/IRaCIS.Core.Domain/Trial/Trial.cs index 7a714aea5..20d54c291 100644 --- a/IRaCIS.Core.Domain/Trial/Trial.cs +++ b/IRaCIS.Core.Domain/Trial/Trial.cs @@ -182,6 +182,9 @@ namespace IRaCIS.Core.Domain.Models + //public List + + public string SiteSurveyConfigJsonStr { get; set; } = string.Empty; public bool VisitPlanConfirmed { get; set; } From ce969822a0e2d51cec82cd83a5bdb3cc3aa9897a Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 13 Jun 2024 17:42:49 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=90=8D=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Domain.Share/Trial/TrialExpedited.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Domain.Share/Trial/TrialExpedited.cs b/IRaCIS.Core.Domain.Share/Trial/TrialExpedited.cs index 655849cbd..19a1df667 100644 --- a/IRaCIS.Core.Domain.Share/Trial/TrialExpedited.cs +++ b/IRaCIS.Core.Domain.Share/Trial/TrialExpedited.cs @@ -43,7 +43,7 @@ { public string NotShowField { get; set; } - public string NeedMofifyFiled { get; set; } + public string NeedModifyFiled { get; set; } public string ReplaceContent { get; set; } From ae913d8213d5c093ce0798528574595aee1a5f9c Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 14 Jun 2024 09:18:06 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E8=B0=83=E7=A0=94=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DTO/TrialSiteSurveyViewModel.cs | 4 ++- .../SiteSurvey/TrialSiteSurveyService.cs | 28 +++++++-------- .../Trial/TrialExpedited.cs | 34 ++++++++++++------- 3 files changed, 38 insertions(+), 28 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs index 38904e2cf..2d51494cc 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs @@ -5,6 +5,7 @@ //-------------------------------------------------------------------- using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; using IRaCIS.Core.Domain.Share; namespace IRaCIS.Core.Application.Contracts { @@ -68,7 +69,8 @@ namespace IRaCIS.Core.Application.Contracts public List TrialSiteUserSurveyList { get; set; } = new List(); - public List FileConfigList { get; set; } = new List(); + + public SiteSurveyFiledConfig SiteSurveyFiledConfig { get; set; } } public class TrialSiteUserSurveyAllDTO : TrialSiteUserSurveyView diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 96a3c8bc8..5f6de6788 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -117,7 +117,7 @@ namespace IRaCIS.Core.Application.Contracts } else //验证码正确 并且 没有超时 { - var dockerInfo=await _repository.Where(t=>t.EMail==inDto.EmailOrPhone||t.Phone==inDto.EmailOrPhone).FirstOrDefaultAsync(); + var dockerInfo = await _repository.Where(t => t.EMail == inDto.EmailOrPhone || t.Phone == inDto.EmailOrPhone).FirstOrDefaultAsync(); if (dockerInfo != null) { @@ -391,9 +391,9 @@ namespace IRaCIS.Core.Application.Contracts var result = await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId && t.TrialId == trialId).IgnoreQueryFilters() .ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync().IfNullThrowException(); - var siteSurveryConfig= _trialSiteSurveyRepository.Where(t=>t.Id == trialSiteSurveyId).Select(t=>t.Trial.SiteSurveyConfigJsonStr).FirstOrDefault(); + var siteSurveryConfig = _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId).Select(t => t.Trial.SiteSurveyConfigJsonStr).FirstOrDefault(); - result.FileConfigList= JsonConvert.DeserializeObject>(siteSurveryConfig) ?? new List(); + result.SiteSurveyFiledConfig = JsonConvert.DeserializeObject(siteSurveryConfig) ?? new SiteSurveyFiledConfig(); return result; } @@ -470,11 +470,11 @@ namespace IRaCIS.Core.Application.Contracts .WhereIf(surveyQueryDTO.State != null, t => t.State == surveyQueryDTO.State) .WhereIf(surveyQueryDTO.UpdateTimeBegin != null, t => t.UpdateTime >= surveyQueryDTO.UpdateTimeBegin) .WhereIf(surveyQueryDTO.UpdateTimeEnd != null, t => t.UpdateTime <= surveyQueryDTO.UpdateTimeEnd) - - .ProjectTo(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us }) - .WhereIf(!string.IsNullOrWhiteSpace(surveyQueryDTO.PreliminaryUserName), t => t.PreliminaryUser.RealName.Contains(surveyQueryDTO.PreliminaryUserName)) - .WhereIf(!string.IsNullOrWhiteSpace(surveyQueryDTO.ReviewerUserName), t => t.ReviewerUser.RealName.Contains(surveyQueryDTO.ReviewerUserName)) - ; + + .ProjectTo(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us }) + .WhereIf(!string.IsNullOrWhiteSpace(surveyQueryDTO.PreliminaryUserName), t => t.PreliminaryUser.RealName.Contains(surveyQueryDTO.PreliminaryUserName)) + .WhereIf(!string.IsNullOrWhiteSpace(surveyQueryDTO.ReviewerUserName), t => t.ReviewerUser.RealName.Contains(surveyQueryDTO.ReviewerUserName)) + ; return await trialSiteSurveyQueryable.ToPagedListAsync(surveyQueryDTO.PageIndex, surveyQueryDTO.PageSize, surveyQueryDTO.SortField, surveyQueryDTO.Asc); } @@ -501,7 +501,7 @@ namespace IRaCIS.Core.Application.Contracts var groupSelectIdQuery = _trialSiteSurveyRepository.Where(t => t.TrialId == queryParam.TrialId) .WhereIf(queryParam.TrialSiteId != null, t => t.TrialSiteId == queryParam.TrialSiteId) - + .WhereIf(!string.IsNullOrEmpty(queryParam.FormWriterKeyInfo), t => (t.UserName).Contains(queryParam.FormWriterKeyInfo) || t.Email.Contains(queryParam.FormWriterKeyInfo) || t.Phone.Contains(queryParam.FormWriterKeyInfo)) .GroupBy(t => t.TrialSiteId) .Select(g => g.OrderByDescending(u => u.CreateTime).Select(t => t.Id).First()); @@ -626,7 +626,7 @@ namespace IRaCIS.Core.Application.Contracts + Path.DirectorySeparatorChar.ToString() + "EmailTemplate" + Path.DirectorySeparatorChar.ToString() - + (_userInfo.IsEn_Us ? "TrialSiteSurveyReject_US.html" : "TrialSiteSurveyReject.html") ; + + (_userInfo.IsEn_Us ? "TrialSiteSurveyReject_US.html" : "TrialSiteSurveyReject.html"); using (StreamReader SourceReader = System.IO.File.OpenText(pathToFile)) @@ -729,12 +729,12 @@ namespace IRaCIS.Core.Application.Contracts var currentUserList = siteUserList.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId).ToList(); - if (!currentUserList.Any(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator) ) + if (!currentUserList.Any(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator)) { throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_MissingAccount"]); } - if (currentUserList.Where(t=>t.IsGenerateAccount && t.UserTypeId!=null).GroupBy(t => new { t.UserTypeId, t.Email }) + if (currentUserList.Where(t => t.IsGenerateAccount && t.UserTypeId != null).GroupBy(t => new { t.UserTypeId, t.Email }) .Any(g => g.Count() > 1)) { throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_DuplicateEmail"]); @@ -764,7 +764,7 @@ namespace IRaCIS.Core.Application.Contracts await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.CRCSubmitted, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved, PreliminaryUserId = _userInfo.Id, PreliminaryTime = DateTime.Now }); } - else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager|| _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM) + else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM) { var allUserList = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId).ProjectTo(_mapper.ConfigurationProvider).ToList(); @@ -938,7 +938,7 @@ namespace IRaCIS.Core.Application.Contracts DeletedTime = DateTime.Now, }); - + await _repository.SaveChangesAsync(); } diff --git a/IRaCIS.Core.Domain.Share/Trial/TrialExpedited.cs b/IRaCIS.Core.Domain.Share/Trial/TrialExpedited.cs index 19a1df667..04d5da70a 100644 --- a/IRaCIS.Core.Domain.Share/Trial/TrialExpedited.cs +++ b/IRaCIS.Core.Domain.Share/Trial/TrialExpedited.cs @@ -1,11 +1,13 @@ -namespace IRaCIS.Core.Domain.Share +using System.Collections.Generic; + +namespace IRaCIS.Core.Domain.Share { public enum TrialExpedited { - All=-1, + All = -1, - None=0, + None = 0, ExpeditedIn24H = 1, @@ -29,20 +31,26 @@ { //0全部中国医生 1美国医生 2既有中国医生,也有美国医生 - CN=0, + CN = 0, - US=1, + US = 1, - EU=2, + EU = 2, - Other=3 + Other = 3 } public class SiteSurveyFiledConfig { - public string NotShowField { get; set; } + public List NotShowFieldList { get; set; }=new List(); + public List ModifyFiledList { get; set; }=new List(); + + } + + public class SiteSurveyModifyFiled + { public string NeedModifyFiled { get; set; } public string ReplaceContent { get; set; } @@ -52,14 +60,14 @@ public enum DeclarationType { - Other=3, + Other = 3, - US=1, + US = 1, - CN=0, + CN = 0, - EU=2, + EU = 2, - JP=4 + JP = 4 } } \ No newline at end of file From 6207fb5006870df1d2dee831039a747489cd9dba Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 14 Jun 2024 10:38:58 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9MFA=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Common/MailService.cs | 8 ++++---- .../Service/Management/Interface/IUserService.cs | 2 +- IRaCIS.Core.Application/Service/Management/UserService.cs | 5 +++-- IRaCIS.Core.Domain.Share/User/UserType.cs | 7 +++++++ 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Common/MailService.cs b/IRaCIS.Core.Application/Service/Common/MailService.cs index 3acfa9ebd..588761284 100644 --- a/IRaCIS.Core.Application/Service/Common/MailService.cs +++ b/IRaCIS.Core.Application/Service/Common/MailService.cs @@ -21,7 +21,7 @@ namespace IRaCIS.Application.Services Task SiteSurveyRejectEmail(MimeMessage messageToSend); - Task SenMFAVerifyEmail(Guid userId, string userName, string emailAddress, int verificationCode); + Task SenMFAVerifyEmail(Guid userId, string userName, string emailAddress, int verificationCode, UserMFAType mfaType = UserMFAType.Login); Task SendMailEditEmail(Guid userId, string userName, string emailAddress, int verificationCode); @@ -94,7 +94,7 @@ namespace IRaCIS.Application.Services } //MFA - public async Task SenMFAVerifyEmail(Guid userId, string userName, string emailAddress, int verificationCode) + public async Task SenMFAVerifyEmail(Guid userId, string userName, string emailAddress, int verificationCode, UserMFAType mfaType = UserMFAType.Login) { var messageToSend = new MimeMessage(); //发件地址 @@ -103,7 +103,7 @@ namespace IRaCIS.Application.Services messageToSend.To.Add(new MailboxAddress(userName, emailAddress)); //主题 //---[来自{0}] 关于MFA邮箱验证的提醒 - messageToSend.Subject = _localizer["Mail_EmailMFATopic", _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN]; + messageToSend.Subject = _localizer[mfaType == UserMFAType.Login? "Mail_EmailMFALoginTopic":"Mail_EmailMFAUnlockTopic", _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN]; var builder = new BodyBuilder(); @@ -123,7 +123,7 @@ namespace IRaCIS.Application.Services builder.HtmlBody = string.Format(ReplaceCompanyName(templateInfo), userName, - _localizer["Mail_MFAEmail"], + _localizer[mfaType == UserMFAType.Login ? "Mail_EmailMFALoginEmail": "Mail_EmailMFAUnlockEmail"], verificationCode ); } diff --git a/IRaCIS.Core.Application/Service/Management/Interface/IUserService.cs b/IRaCIS.Core.Application/Service/Management/Interface/IUserService.cs index 873fced43..80a80bc94 100644 --- a/IRaCIS.Core.Application/Service/Management/Interface/IUserService.cs +++ b/IRaCIS.Core.Application/Service/Management/Interface/IUserService.cs @@ -12,7 +12,7 @@ namespace IRaCIS.Application.Services Task> Login(string userName, string password); Task VerifyMFACodeAsync(Guid userId, string Code); - Task SendMFAEmail(Guid userId); + Task SendMFAEmail(Guid userId, UserMFAType mfaType); Task GetUserBasicInfo(Guid userId,string pwd); Task ModifyPassword(EditPasswordCommand editPwModel); Task ResetPassword(Guid userId); diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index ab4a221c2..57ff8e49d 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -653,15 +653,16 @@ namespace IRaCIS.Application.Services /// 发送MFA 验证邮件 /// /// + /// /// [AllowAnonymous] - public async Task SendMFAEmail(Guid userId) + public async Task SendMFAEmail(Guid userId, UserMFAType mfaType = UserMFAType.Login) { var userInfo = await _userRepository.Where(u => u.Id == userId).Select(t => new { t.FullName, t.EMail }).FirstOrDefaultAsync(); int verificationCode = new Random().Next(100000, 1000000); - await _mailVerificationService.SenMFAVerifyEmail(userId, userInfo.FullName, userInfo.EMail, verificationCode); + await _mailVerificationService.SenMFAVerifyEmail(userId, userInfo.FullName, userInfo.EMail, verificationCode, mfaType); return ResponseOutput.Ok(); } diff --git a/IRaCIS.Core.Domain.Share/User/UserType.cs b/IRaCIS.Core.Domain.Share/User/UserType.cs index fb583c742..b38f45d76 100644 --- a/IRaCIS.Core.Domain.Share/User/UserType.cs +++ b/IRaCIS.Core.Domain.Share/User/UserType.cs @@ -90,6 +90,13 @@ EnrollOrPD_EMailCopy=5, } + public enum UserMFAType + { + Login=0, + + Unlock=1, + } + } \ No newline at end of file