From 369fbc6d2c3868fe953b153a4d52107d9a1392a5 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 31 Mar 2022 16:39:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=86=E7=A0=81=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E9=A1=BA=E4=BE=BF=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=90=8D=EF=BC=8C=E5=8F=A6=E5=A4=96Site=E8=B0=83=E7=A0=94?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Management/DTO/UserModel.cs | 2 ++ .../Service/Management/UserService.cs | 22 ++++++++++++++++++- .../DTO/TrialSiteSurveyViewModel.cs | 4 ++++ .../SiteSurvey/TrialSiteSurveyService.cs | 3 +++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs b/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs index d0a568ab3..7fcf38234 100644 --- a/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs +++ b/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs @@ -167,6 +167,8 @@ namespace IRaCIS.Application.Contracts public class EditPasswordCommand { + public string NewUserName { get; set; } = string.Empty; + public string NewPassWord { get; set; } = string.Empty; public string OldPassWord { get; set; } = string.Empty; } diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index d63e13222..14d9943bc 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -156,7 +156,7 @@ namespace IRaCIS.Application.Services - + /// /// 发送验证码 邮箱或者手机号 @@ -255,6 +255,7 @@ namespace IRaCIS.Application.Services /// /// [HttpPost] + public async Task SetNewPassword(ResetPasswordCommand resetPwdModel) { if (resetPwdModel.IsReviewer) @@ -520,6 +521,23 @@ namespace IRaCIS.Application.Services [HttpPost] public async Task ModifyPassword(EditPasswordCommand editPwModel) { + + + if( !string.IsNullOrEmpty(editPwModel.NewUserName)) + { + if (await _userRepository.AnyAsync(t => t.UserName == editPwModel.NewUserName && t.Id != _userInfo.Id)) + { + return ResponseOutput.NotOk("UserId already exists"); + } + + var success = await _userRepository.UpdateFromQueryAsync(t => t.Id == _userInfo.Id, u => new User() + { + UserName = editPwModel.NewUserName, + }); + + } + + //验证旧密码OK if (await _userRepository.FirstOrDefaultAsync(t => t.Id == _userInfo.Id && t.Password == editPwModel.OldPassWord) != null) { var success = await _userRepository.UpdateFromQueryAsync(t => t.Id == _userInfo.Id, u => new User() @@ -531,10 +549,12 @@ namespace IRaCIS.Application.Services return ResponseOutput.Result(success); } + //医生密码 if (await _doctorRepository.AnyAsync(t => t.Id == _userInfo.Id && t.Password == editPwModel.OldPassWord)) { var success = await _doctorRepository.UpdateFromQueryAsync(t => t.Id == _userInfo.Id, u => new Doctor() { + Password = editPwModel.NewPassWord }); diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs index e23ac4719..c75dc068f 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs @@ -250,6 +250,10 @@ namespace IRaCIS.Core.Application.Contracts public TrialSiteSurveyEnum? State { get; set; } public bool? IsAbandon { get; set; } + + public DateTime? UpdateTimeBegin { get; set; } + + public DateTime? UpdateTimeEnd { get; set; } } public class CopyTrialSiteSurveyDTO diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 503873396..78cad6049 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -369,6 +369,9 @@ namespace IRaCIS.Core.Application.Contracts .WhereIf(surveyQueryDTO.IsAbandon != null, t => t.IsAbandon == surveyQueryDTO.IsAbandon) .WhereIf(!string.IsNullOrWhiteSpace(surveyQueryDTO.UserKeyInfo), t => t.UserName.Contains(surveyQueryDTO.UserKeyInfo) || t.Phone.Contains(surveyQueryDTO.UserKeyInfo) || t.Email.Contains(surveyQueryDTO.UserKeyInfo)) .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); return await trialSiteSurveyQueryable.ToPagedListAsync(surveyQueryDTO.PageIndex, surveyQueryDTO.PageSize, surveyQueryDTO.SortField, surveyQueryDTO.Asc);