From 8e8cd0208446e07760ab8375b0dffc7d020f0901 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 19 May 2022 13:22:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=91=E9=80=81=E9=82=AE?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Management/UserService.cs | 17 +++++++++++++++++ .../Service/QC/QCOperationService.cs | 13 +++++++++---- .../SiteSurvey/TrialSiteSurveyService.cs | 2 +- .../TrialSiteUser/TrialExternalUserService.cs | 16 ++++++++++++++-- 4 files changed, 41 insertions(+), 7 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index a414f206f..8ca78e239 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -138,6 +138,23 @@ namespace IRaCIS.Application.Services return ResponseOutput.Ok(); } + + [HttpGet] + public async Task InitSetUserNameAndPwd (Guid userId, string newUserName,string newPWd) + { + await _userRepository.UpdatePartialFromQueryAsync(userId, u => new User() + { + UserName = newUserName, + + Password=newPWd, + + IsFirstAdd=false, + + },true); + + return ResponseOutput.Ok(); + } + /// /// 重置密码为 默认密码 diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs index b6ef700ec..938e26ccb 100644 --- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs @@ -1599,6 +1599,7 @@ namespace IRaCIS.Core.Application.Image.QA return ResponseOutput.NotOk("重传 只允许QA 设置!"); } + //获取项目配置 var trialConfig = await _repository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.QCProcessEnum, t.IsImageConsistencyVerification }) .FirstOrDefaultAsync().IfNullThrowException(); @@ -1610,6 +1611,11 @@ namespace IRaCIS.Core.Application.Image.QA var qcChallenge = (await _qcChallengeRepository.FirstOrDefaultAsync(t => t.Id == qcChallengeId)).IfNullThrowException(); + var sv = (await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == qcChallenge.SubjectVisitId)).IfNullThrowException(); + + await VerifyIsCanQCAsync(sv); + + if (qcChallenge.ReuploadEnum != QCChanllengeReuploadEnum.CRCRequestReupload) { throw new BusinessValidationFailedException("当前重传状态不为CRC申请重传,不允许设置同意重传"); @@ -1641,9 +1647,7 @@ namespace IRaCIS.Core.Application.Image.QA if (trialConfig.QCProcessEnum == TrialQCProcess.DoubleAudit && await _repository.AnyAsync(t => t.Id == qcChallengeId && t.SubjectVisit.AuditState == AuditStateEnum.InSecondaryQC)) { - var sv = await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == qcChallenge.SubjectVisitId); - - if (sv == null) return Null404NotFound(sv); + // //一致性核查质疑状态 // sv.CheckChallengeState = CheckChanllengeTypeEnum.None; @@ -1654,7 +1658,8 @@ namespace IRaCIS.Core.Application.Image.QA sv.CurrentActionUserExpireTime = DateTime.Now.AddHours(1); sv.CurrentActionUserId = _userInfo.Id; - BackgroundJob.Schedule(t => t.CancelQCObtaion(qcChallenge.SubjectVisitId, DateTime.Now), TimeSpan.FromHours(1)); + + //BackgroundJob.Schedule(t => t.CancelQCObtaion(qcChallenge.SubjectVisitId, DateTime.Now), TimeSpan.FromHours(1)); sv.IsTake = true; sv.PreliminaryAuditUserId = null; diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index e90b4a1d9..7fadf8a23 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -837,7 +837,7 @@ namespace IRaCIS.Core.Application.Contracts 角色: {sysUserInfo.UserTypeRole.UserTypeShortName}
- {(sysUserInfo.IsFirstAdd ? "系统登录地址:" + joinCommand.BaseUrl : "首次登陆前,请通过该链接修改您的账户信息:" + joinCommand.RouteUrl)} + {(sysUserInfo.IsFirstAdd==false ? "系统登录地址:" + joinCommand.BaseUrl : "首次登陆前,请通过该链接修改您的账户信息:" + joinCommand.RouteUrl)}
diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs index 00ce0604e..b02bd529e 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs @@ -14,6 +14,8 @@ using MailKit.Security; using Microsoft.AspNetCore.Authorization; using Panda.DynamicWebApi.Attributes; using IRaCIS.Core.Application.Helper; +using IRaCIS.Core.Application.Auth; +using IRaCIS.Application.Contracts; namespace IRaCIS.Core.Application.Service { @@ -28,15 +30,17 @@ namespace IRaCIS.Core.Application.Service private readonly IRepository _trialUserRepository; private readonly IRepository _trialSiteSurveyUserRepository; private readonly IRepository _trialSiteUserRepository; + private readonly ITokenService _tokenService; public TrialExternalUserService(IRepository trialExternalUseRepository, IRepository userRepository, IRepository trialUserRepository, - IRepository trialSiteSurveyUserRepository, IRepository trialSiteUserRepository) + IRepository trialSiteSurveyUserRepository, IRepository trialSiteUserRepository, ITokenService tokenService) { _trialExternalUseRepository = trialExternalUseRepository; _userRepository = userRepository; _trialUserRepository = trialUserRepository; _trialSiteSurveyUserRepository = trialSiteSurveyUserRepository; _trialSiteUserRepository = trialSiteUserRepository; + _tokenService = tokenService; } @@ -228,6 +232,14 @@ namespace IRaCIS.Core.Application.Service var sysUserInfo = (await _userRepository.Where(t => t.Id == userInfo.SystemUserId).Include(t=>t.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException(); + var token = _tokenService.GetToken(IRaCISClaims.Create(_mapper.Map(sysUserInfo))); + + var initUrl = $@" + 修改 "; + + + builder.HtmlBody = @$"
@@ -255,7 +267,7 @@ namespace IRaCIS.Core.Application.Service 角色: {sysUserInfo.UserTypeRole.UserTypeShortName}
- {(sysUserInfo.IsFirstAdd ? "系统登录地址:" + sendEmail.BaseUrl : "首次登陆前,请通过该链接修改您的账户信息:" + sendEmail.RouteUrl)} + {(sysUserInfo.IsFirstAdd==false ? "系统登录地址:" + sendEmail.BaseUrl : "首次登陆前,请通过该链接修改您的账户信息:" + initUrl)}