修改密码时,顺便修改用户名,另外Site调研增加查询条件

Uat_Study
hang 2022-03-31 16:39:56 +08:00
parent e7416e03af
commit 369fbc6d2c
4 changed files with 30 additions and 1 deletions

View File

@ -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;
}

View File

@ -156,7 +156,7 @@ namespace IRaCIS.Application.Services
/// <summary>
/// 发送验证码 邮箱或者手机号
@ -255,6 +255,7 @@ namespace IRaCIS.Application.Services
/// <param name="resetPwdModel"></param>
/// <returns></returns>
[HttpPost]
public async Task<IResponseOutput> SetNewPassword(ResetPasswordCommand resetPwdModel)
{
if (resetPwdModel.IsReviewer)
@ -520,6 +521,23 @@ namespace IRaCIS.Application.Services
[HttpPost]
public async Task<IResponseOutput> 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
});

View File

@ -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

View File

@ -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<TrialSiteSurveyView>(_mapper.ConfigurationProvider);
return await trialSiteSurveyQueryable.ToPagedListAsync(surveyQueryDTO.PageIndex, surveyQueryDTO.PageSize, surveyQueryDTO.SortField, surveyQueryDTO.Asc);