外部人员删除

Uat_Study
hang 2022-05-31 16:21:00 +08:00
parent 07cd3e74ab
commit 318bdbfef0
1 changed files with 11 additions and 3 deletions

View File

@ -116,7 +116,7 @@ namespace IRaCIS.Core.Application.Service
generateUser.Code = _userRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1;
generateUser.UserCode = AppSettings.GetCodeStr(generateUser.Code, nameof(User));
generateUser.UserCode = AppSettings.GetCodeStr(generateUser.Code, nameof(User));
generateUser.UserName = generateUser.UserCode;
@ -165,7 +165,7 @@ namespace IRaCIS.Core.Application.Service
else
{
return ResponseOutput.NotOk("人员信息不支持编辑,请删除后重新添加。");
}
}
@ -176,6 +176,14 @@ namespace IRaCIS.Core.Application.Service
[Authorize(Policy = IRaCISPolicy.PM_APM)]
public async Task<IResponseOutput> DeleteTrialExternalUser(Guid trialExternalUserId, bool isSystemUser, Guid systemUserId)
{
var trialExternalUser = await _trialExternalUseRepository.FirstOrDefaultAsync(t => t.Id == trialExternalUserId);
if (await _trialUserRepository.AnyAsync(t => t.TrialId == trialExternalUser.TrialId && t.Id == trialExternalUser.SystemUserId))
{
return ResponseOutput.NotOk("当前用户已参与到项目,不允许删除");
}
var success = await _trialExternalUseRepository.BatchDeleteNoTrackingAsync(t => t.Id == trialExternalUserId);
if (isSystemUser == false)
@ -200,7 +208,7 @@ namespace IRaCIS.Core.Application.Service
var userId = userInfo.SystemUserId;
await _mailVerificationService.ExternalUserJoinEmail(trialId, userId, sendEmail.BaseUrl, sendEmail.RouteUrl);
//判断TrialUser中是否存在 不存在就插入 注意退出了,也不能再加进来
if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId, true))