合并
continuous-integration/drone/push Build is passing Details

Uat_IRC_Net8
he 2025-01-06 15:17:55 +08:00
commit 77b45e80fe
19 changed files with 683 additions and 636 deletions

View File

@ -254,7 +254,7 @@ namespace IRaCIS.Api.Controllers
else
{
//正常登录才发送邮件
await _userService.SendMFAEmail(userId);
await _userService.SendMFAEmail(new Core.Application.ViewModel.SendMfaCommand() { IdentityUserId= userId });
}

View File

@ -489,14 +489,6 @@
<param name="applyReReadingCommand"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Allocation.VisitTaskService.ReReadingTaskTrackingDeal(IRaCIS.Core.Domain.Models.VisitTask,IRaCIS.Core.Application.ViewModel.ConfirmReReadingCommand)">
<summary>
重阅原任务跟踪处理
</summary>
<param name="origenalTask"></param>
<param name="agreeReReadingCommand"></param>
<exception cref="T:IRaCIS.Core.Infrastructure.BusinessValidationFailedException"></exception>
</member>
<member name="M:IRaCIS.Core.Application.Service.Allocation.VisitTaskService.PMReReadingConfirmOrBackInfluenceAnalysisAsync(System.Guid)">
<summary>
PM 申请重阅 被同意 或者 PM 直接退回的时候影响
@ -2269,19 +2261,16 @@
<param name="model"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.UserService.SendMFAEmail(System.Guid,IRaCIS.Core.Domain.Share.UserMFAType)">
<member name="M:IRaCIS.Core.Application.Service.UserService.SendMFAEmail(IRaCIS.Core.Application.ViewModel.SendMfaCommand)">
<summary>
发送MFA 验证邮件
</summary>
<param name="identityUserId"></param>
<param name="mfaType"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.UserService.VerifyMFACodeAsync(System.Guid,System.String)">
<member name="M:IRaCIS.Core.Application.Service.UserService.VerifyMFACodeAsync(System.String)">
<summary>
验证MFA 邮件
</summary>
<param name="identityUserId"></param>
<param name="Code"></param>
<returns></returns>
<exception cref="T:IRaCIS.Core.Infrastructure.BusinessValidationFailedException"></exception>
@ -16129,7 +16118,7 @@
SystemDocumentService
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Services.SystemDocumentService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SystemDocument},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.UserRole},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SystemDocConfirmedIdentityUser},AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer)">
<member name="M:IRaCIS.Core.Application.Services.SystemDocumentService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SystemDocument},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.UserRole},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.IdentityUser},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SystemDocConfirmedIdentityUser},AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer)">
<summary>
SystemDocumentService
</summary>

File diff suppressed because it is too large Load Diff

View File

@ -706,8 +706,8 @@ namespace IRaCIS.Core.Application.Service
var userTypeEnumList = emailConfigInfo.EmailNoticeUserTypeList.Where(t => t.EmailUserType == EmailUserType.To).Select(t => t.UserType).ToList();
var emailList = await _userRoleRepository.Where(t => userTypeEnumList.Contains(t.UserTypeEnum) &&
(isHaveTrialId ? t.UserRoleTrials.Any(t => t.TrialId == feedBack.TrialId) : true)).Select(t => new { t.IdentityUser.EMail, t.UserTypeEnum, t.IdentityUser.FullName }).ToListAsync();
var emailList = await _userRoleRepository.Where(t => userTypeEnumList.Contains(t.UserTypeEnum) && t.IsUserRoleDisabled == false && t.IdentityUser.Status == UserStateEnum.Enable &&
(isHaveTrialId ? t.IdentityUser.UserTrialList.Any(t => t.TrialId == feedBack.TrialId && t.TrialUserRoleList.Any(c => userTypeEnumList.Contains(c.UserRole.UserTypeEnum))) : true)).Select(t => new { t.IdentityUser.EMail, t.UserTypeEnum, t.IdentityUser.FullName }).ToListAsync();
foreach (var email in emailList)

View File

@ -16,6 +16,7 @@ namespace IRaCIS.Core.Application.Services
[ApiExplorerSettings(GroupName = "Trial")]
public class SystemDocumentService(IRepository<SystemDocument> _systemDocumentRepository,
IRepository<UserRole> _userRoleRepository,
IRepository<IdentityUser> _identityUserRepository,
IRepository<SystemDocConfirmedIdentityUser> _systemDocConfirmedUserRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ISystemDocumentService
{
@ -154,7 +155,7 @@ namespace IRaCIS.Core.Application.Services
join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = _userInfo.IdentityUserId, SystemDocumentId = sysDoc.Id } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
from confirm in cc.DefaultIfEmpty()
join user in _userRoleRepository.Where() on _userInfo.UserRoleId equals user.Id
join user in _identityUserRepository.Where() on _userInfo.IdentityUserId equals user.Id
select new UnionDocumentWithConfirmInfoView()
{
@ -180,11 +181,14 @@ namespace IRaCIS.Core.Application.Services
//UserTypeShortName = user.UserTypeRole.UserTypeShortName
};
return await query.WhereIf(inQuery.IsSigned == true, t => t.ConfirmTime != null)
var list = await query.WhereIf(inQuery.IsSigned == true, t => t.ConfirmTime != null)
.WhereIf(inQuery.IsSigned == false, t => t.ConfirmTime == null)
.ToPagedListAsync(inQuery);
return list;
}

View File

@ -228,7 +228,7 @@ namespace IRaCIS.Core.Application.Services
#region 统一用户修改
var systemDocQuery =
from sysDoc in _systemDocumentRepository.AsQueryable(false).Where(t => t.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == _userInfo.UserTypeId))
from sysDoc in _systemDocumentRepository.AsQueryable(true).Where(t => t.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == _userInfo.UserTypeId))
from trialUser in _trialIdentityUserRepository.AsQueryable(false)
.Where(t => t.TrialId == inQuery.TrialId && t.IdentityUserId == _userInfo.IdentityUserId
&& t.TrialUserRoleList.Any(t => sysDoc.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == t.UserRole.UserTypeId)))
@ -266,7 +266,7 @@ namespace IRaCIS.Core.Application.Services
//项目文档查询
var trialDocQuery =
from trialDoc in _trialDocumentRepository.AsQueryable(false).Where(t => t.TrialId == inQuery.TrialId)
from trialDoc in _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == inQuery.TrialId).Where(t => t.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == _userInfo.UserTypeId))
from trialUser in _trialIdentityUserRepository.AsQueryable(false).Where(t => t.TrialId == inQuery.TrialId && t.IdentityUserId == _userInfo.IdentityUserId
&& t.TrialUserRoleList.Any(t => trialDoc.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == t.UserRole.UserTypeId)))
@ -396,6 +396,8 @@ namespace IRaCIS.Core.Application.Services
var unionQuery = systemDocQuery.Concat(trialDocQuery)
//过滤掉删除的,并且没有签名的
.Where(t=>!(t.IsDeleted == true && t.ConfirmTime==null))
.WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name))
.WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId)
.WhereIf(inQuery.IsSign == true, t => t.ConfirmTime != null)
@ -433,7 +435,7 @@ namespace IRaCIS.Core.Application.Services
.CountAsync();
var needSignSystemDocCount = await _systemDocumentRepository
var needSignSystemDocCount = await _systemDocumentRepository.AsQueryable(true)
.Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
.CountAsync();
@ -868,9 +870,9 @@ namespace IRaCIS.Core.Application.Services
var success = false;
if (isSystemDoc)
{
if (!await _systemDocConfirmedUserRepository.AnyAsync(t => t.SystemDocumentId == documentId && t.ConfirmUserId == _userInfo.UserRoleId))
if (!await _systemDocConfirmedUserRepository.AnyAsync(t => t.SystemDocumentId == documentId && t.ConfirmUserId == _userInfo.IdentityUserId))
{
await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedIdentityUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.UserRoleId, SignFirstViewTime = DateTime.Now });
await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedIdentityUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.IdentityUserId, SignFirstViewTime = DateTime.Now });
}
@ -878,10 +880,10 @@ namespace IRaCIS.Core.Application.Services
else
{
if (!await _trialDocConfirmedUserRepository.AnyAsync(t => t.TrialDocumentId == documentId && t.ConfirmUserId == _userInfo.UserRoleId))
if (!await _trialDocConfirmedUserRepository.AnyAsync(t => t.TrialDocumentId == documentId && t.ConfirmUserId == _userInfo.IdentityUserId))
{
await _trialDocConfirmedUserRepository.AddAsync(new TrialDocConfirmedIdentityUser() { TrialDocumentId = documentId, ConfirmUserId = _userInfo.UserRoleId, SignFirstViewTime = DateTime.Now });
await _trialDocConfirmedUserRepository.AddAsync(new TrialDocConfirmedIdentityUser() { TrialDocumentId = documentId, ConfirmUserId = _userInfo.IdentityUserId, SignFirstViewTime = DateTime.Now });
}
@ -896,9 +898,9 @@ namespace IRaCIS.Core.Application.Services
[HttpPut("{documentId:guid}")]
public async Task<IResponseOutput> SetSystemDocFirstViewTime(Guid documentId)
{
if (!await _systemDocConfirmedUserRepository.AnyAsync(t => t.SystemDocumentId == documentId && t.ConfirmUserId == _userInfo.UserRoleId))
if (!await _systemDocConfirmedUserRepository.AnyAsync(t => t.SystemDocumentId == documentId && t.ConfirmUserId == _userInfo.IdentityUserId))
{
await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedIdentityUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.UserRoleId, SignFirstViewTime = DateTime.Now });
await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedIdentityUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.IdentityUserId, SignFirstViewTime = DateTime.Now });
}
@ -913,7 +915,7 @@ namespace IRaCIS.Core.Application.Services
if (!await _trialDocConfirmedUserRepository.AnyAsync(t => t.TrialDocumentId == documentId && t.ConfirmUserId == _userInfo.IdentityUserId))
{
await _trialDocConfirmedUserRepository.AddAsync(new TrialDocConfirmedIdentityUser() { TrialDocumentId = documentId, ConfirmUserId = _userInfo.UserRoleId, SignFirstViewTime = DateTime.Now });
await _trialDocConfirmedUserRepository.AddAsync(new TrialDocConfirmedIdentityUser() { TrialDocumentId = documentId, ConfirmUserId = _userInfo.IdentityUserId, SignFirstViewTime = DateTime.Now });
}
var success = await _trialDocConfirmedUserRepository.SaveChangesAsync();
@ -932,7 +934,7 @@ namespace IRaCIS.Core.Application.Services
if (userConfirmCommand.isSystemDoc)
{
var sysDocConfirm = await _systemDocConfirmedUserRepository.FirstOrDefaultAsync(t => t.SystemDocumentId == userConfirmCommand.DocumentId && t.ConfirmUserId == _userInfo.UserRoleId, true);
var sysDocConfirm = await _systemDocConfirmedUserRepository.FirstOrDefaultAsync(t => t.SystemDocumentId == userConfirmCommand.DocumentId && t.ConfirmUserId == _userInfo.IdentityUserId, true);
if (sysDocConfirm.ConfirmTime != null)
{

View File

@ -65,7 +65,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
}
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
[TrialGlobalLimit("AfterStopCannNotOpt")]
public async Task<IResponseOutput> PreArchiveDicomStudy(PreArchiveDicomStudyCommand preArchiveStudyCommand)
{
@ -122,7 +122,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
[TrialGlobalLimit("AfterStopCannNotOpt")]
public async Task<IResponseOutput> AddOrUpdateArchiveStudy(NewArchiveStudyCommand incommand)
{
@ -321,6 +321,16 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
}
//项目配置的影像部位
var trialBodyPartList = _trialRepository.Where(t => t.Id == trialId).SelectMany(t => t.TrialBodyPartList).ToList();
if (trialBodyPartList.Count() == 1)
{
var first = trialBodyPartList.First();
findStudy.BodyPartForEdit = first.Code;
}
var @lock2 = _distributedLockProvider.CreateLock($"StudyCommit");
using (await @lock2.AcquireAsync())

View File

@ -30,6 +30,13 @@ namespace IRaCIS.Core.Application.ViewModel
public string IPRegion { get; set; }
}
public class SendMfaCommand
{
public Guid IdentityUserId { get; set; }
public UserMFAType MFAType { get; set; } = UserMFAType.Login;
}
///<summary>UserLogQuery 列表查询参数模型</summary>
public class UserLogQuery : PageInput
{

View File

@ -1,4 +1,5 @@
using IRaCIS.Application.Contracts;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Share;
namespace IRaCIS.Core.Application.Service
@ -10,9 +11,9 @@ namespace IRaCIS.Core.Application.Service
//Task<UserDetailDTO> GetUser(Guid id);
Task<PageOutput<UserListDTO>> GetUserList(UserListQueryDTO param);
Task<IResponseOutput<LoginReturnDTO>> Login(string userName, string password);
Task<IResponseOutput> VerifyMFACodeAsync(Guid userId, string Code);
Task<IResponseOutput> VerifyMFACodeAsync(string Code);
Task<IResponseOutput> SendMFAEmail(Guid userId, UserMFAType mfaType = 0);
Task<IResponseOutput> SendMFAEmail(SendMfaCommand sendMfa);
Task<UserBasicInfo> GetUserBasicInfo(Guid userId, string pwd);
Task<IResponseOutput> ModifyPassword(EditPasswordCommand editPwModel);
Task<IResponseOutput> ResetPassword(Guid userId);

View File

@ -61,8 +61,10 @@ namespace IRaCIS.Core.Application.Service
throw new BusinessValidationFailedException("Id 或者VisitTaskId 必传一个");
}
var result = await _userFeedBackRepository.WhereIf(inQuery.Id == null, t => t.VisitTaskId == inQuery.VisitTaskId)
.WhereIf(inQuery.VisitTaskId == null, t => t.Id == inQuery.Id).ProjectTo<UserFeedBackView>(_mapper.ConfigurationProvider).FirstOrDefaultAsync();
var result = await _userFeedBackRepository
.WhereIf(inQuery.Id != null, t => t.Id == inQuery.Id)
.WhereIf(inQuery.VisitTaskId != null, t => t.VisitTaskId == inQuery.VisitTaskId)
.ProjectTo<UserFeedBackView>(_mapper.ConfigurationProvider).FirstOrDefaultAsync();

View File

@ -735,17 +735,16 @@ namespace IRaCIS.Core.Application.Service
/// <summary>
/// 发送MFA 验证邮件
/// </summary>
/// <param name="identityUserId"></param>
/// <param name="mfaType"></param>
/// <returns></returns>
[AllowAnonymous]
public async Task<IResponseOutput> SendMFAEmail(Guid identityUserId, UserMFAType mfaType)
public async Task<IResponseOutput> SendMFAEmail(SendMfaCommand sendMfa)
{
var identityUserId = sendMfa.IdentityUserId == Guid.Empty ? _userInfo.IdentityUserId : sendMfa.IdentityUserId;
var userInfo = await _identityUserRepository.Where(u => u.Id == identityUserId).Select(t => new { t.FullName, t.EMail }).FirstOrDefaultAsync();
int verificationCode = new Random().Next(100000, 1000000);
await _mailVerificationService.SenMFAVerifyEmail(identityUserId, userInfo.FullName, userInfo.EMail, verificationCode, (UserMFAType)mfaType);
await _mailVerificationService.SenMFAVerifyEmail(identityUserId, userInfo.FullName, userInfo.EMail, verificationCode, sendMfa.MFAType);
var hiddenEmail = IRCEmailPasswordHelper.MaskEmail(userInfo.EMail);
return ResponseOutput.Ok(hiddenEmail);
@ -754,12 +753,13 @@ namespace IRaCIS.Core.Application.Service
/// <summary>
/// 验证MFA 邮件
/// </summary>
/// <param name="identityUserId"></param>
/// <param name="Code"></param>
/// <returns></returns>
/// <exception cref="BusinessValidationFailedException"></exception>
public async Task<IResponseOutput> VerifyMFACodeAsync(Guid identityUserId, string Code)
public async Task<IResponseOutput> VerifyMFACodeAsync(string Code)
{
var identityUserId = _userInfo.IdentityUserId;
var verificationRecord = await _verificationCodeRepository.Where(t => t.UserId == identityUserId && t.Code == Code && t.CodeType == VerifyType.Email).OrderByDescending(x => x.ExpirationTime).FirstOrDefaultAsync();
VerifyEmialGetDoctorInfoOutDto result = new VerifyEmialGetDoctorInfoOutDto();
@ -778,13 +778,9 @@ namespace IRaCIS.Core.Application.Service
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionUserName = _userInfo.UserName, TargetIdentityUserId = identityUserId, OptType = UserOptType.MFALoginFail }, true);
//---验证码已经过期。
throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_ExpiredVerificationCode"]);
}
else //验证码正确 并且 没有超时
{
//删除验证码历史记录
await _verificationCodeRepository.BatchDeleteNoTrackingAsync(t => t.Id == verificationRecord.Id);
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionUserName = _userInfo.UserName, TargetIdentityUserId = identityUserId, OptType = UserOptType.MFALogin }, true);
@ -1090,7 +1086,7 @@ namespace IRaCIS.Core.Application.Service
else
{
//正常登录才发送邮件
await SendMFAEmail(identityUserId, UserMFAType.Login);
await SendMFAEmail(new SendMfaCommand() { IdentityUserId = identityUserId, MFAType = UserMFAType.Login });
}

View File

@ -441,7 +441,11 @@ namespace IRaCIS.Core.Application.Contracts
{
var isTrialSPMJoin = await _trialRepository.AnyAsync(t => t.Id == trialSiteSubmitBackCommand.TrialId && t.IsSPMJoinSiteSurvey);
var hasSPMOrCPM = await _trialSiteSurveyRepository.AnyAsync(t => t.TrialId == trialSiteSubmitBackCommand.TrialId && t.Trial.TrialIdentityUserList.Any(u => u.TrialUserRoleList.Any(u => u.UserRole.UserTypeEnum == UserTypeEnum.SPM || u.UserRole.UserTypeEnum == UserTypeEnum.CPM)));
var hasSPMOrCPM = await _trialRepository.Where(t => t.Id == trialSiteSubmitBackCommand.TrialId).AnyAsync(t => t.TrialIdentityUserList.SelectMany(t => t.TrialUserRoleList).Any(t =>
t.UserRole.IdentityUser.Status == UserStateEnum.Enable
&& t.UserRole.IsUserRoleDisabled == false
&& (t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM))
);
var isSPMjoin = isTrialSPMJoin && hasSPMOrCPM;
@ -792,7 +796,11 @@ namespace IRaCIS.Core.Application.Contracts
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.Undefined || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator)
{
var hasSPMOrCPM = await _trialSiteSurveyRepository.AnyAsync(t => t.TrialId == trialId && t.Trial.TrialIdentityUserList.Any(u => u.TrialUserRoleList.Any(u => u.UserRole.UserTypeEnum == UserTypeEnum.SPM || u.UserRole.UserTypeEnum == UserTypeEnum.CPM)));
var hasSPMOrCPM = await _trialRepository.Where(t => t.Id == trialId).AnyAsync(t => t.TrialIdentityUserList.SelectMany(t => t.TrialUserRoleList).Any(t =>
t.UserRole.IdentityUser.Status == UserStateEnum.Enable
&& t.UserRole.IsUserRoleDisabled == false
&& (t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM))
);
var isTrialSPMJoin = await _trialRepository.AnyAsync(t => t.Id == trialId && t.IsSPMJoinSiteSurvey);

View File

@ -171,7 +171,7 @@ namespace IRaCIS.Application.Contracts
public bool IsDeleted { get; set; }
public UserStateEnum Status { get; set; }
public DateTime CreateTime { get; set; }
public DateTime UpdateTime { get; set; }
@ -223,6 +223,7 @@ namespace IRaCIS.Application.Contracts
public UserTypeEnum UserTypeEnum { get; set; }
public bool IsUserRoleDisabled { get; set; }
public bool IsDeleted { get; set; }

View File

@ -71,9 +71,11 @@ namespace IRaCIS.Core.Application
{
var trialDocStat = await _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing)
.Where(t => t.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId))
.WhereIf(!_userInfo.IsAdmin, c => c.TrialDocumentList.Where(t => t.IsDeleted == false && t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId) && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.UserRoleId && t.ConfirmTime != null))
.Count() > 0)
.ProjectTo<DocSignStat>(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.UserRoleId, userTypeId = _userInfo.UserTypeId })
.WhereIf(!_userInfo.IsAdmin, c => c.TrialDocumentList.Where(t => t.IsDeleted == false &&
t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)
&& !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId && t.ConfirmTime != null)).Count() > 0
)
.ProjectTo<DocSignStat>(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.IdentityUserId, userTypeId = _userInfo.UserTypeId })
.OrderByDescending(t => t.WaitSignCount)
.ToPagedListAsync(inQuery);
@ -1117,10 +1119,10 @@ namespace IRaCIS.Core.Application
var needSignTrialCount = await _trialRepository.Where(t => t.TrialStatusStr != StaticData.TrialState.TrialStopped)
.Where(t => t.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId))
.Where(c => c.TrialDocumentList.Where(t => t.IsDeleted == false && t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)
&& !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.UserRoleId && t.ConfirmTime != null)).Count() > 0).CountAsync();
&& !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId && t.ConfirmTime != null)).Count() > 0).CountAsync();
var needSignSysDocCont = await _systemDocumentRepository
.Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.UserRoleId && t.ConfirmTime != null))
.Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId && t.ConfirmTime != null))
//外部人员 只签署 文档类型枚举值有值的
.WhereIf(isInternal == false, t => t.DocUserSignType == DocUserSignType.InnerAndOuter)
.SelectMany(t => t.NeedConfirmedUserTypeList)
@ -1129,10 +1131,10 @@ namespace IRaCIS.Core.Application
var signedTrialCount = await _trialDocumentRepository.AsQueryable(true)
.Where(t => t.Trial.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId))
.Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
.Where(t => t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.UserRoleId && t.ConfirmTime != null)).CountAsync();
.Where(t => t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId && t.ConfirmTime != null)).CountAsync();
var signedSysDocCont = await _systemDocumentRepository
.Where(t => t.IsDeleted == false && t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.UserRoleId && t.ConfirmTime != null))
.Where(t => t.IsDeleted == false && t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId && t.ConfirmTime != null))
.SelectMany(t => t.NeedConfirmedUserTypeList)
.CountAsync(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId);

View File

@ -57,10 +57,12 @@ namespace IRaCIS.Core.Application.Service
UpdateTime = t.UpdateTime,
UserName = t.IdentityUser.UserName,
RemoveTime = t.RemoveTime,
Status = t.IdentityUser.Status,
TrialUserRoleList = t.TrialUserRoleList.Select(ur => new TrialIdentityUserRoleDto()
{
Id = ur.Id,
UserTypeShortName = ur.UserRole.UserTypeRole.UserTypeShortName,
IsUserRoleDisabled = ur.UserRole.IsUserRoleDisabled,
IsDeleted = ur.IsDeleted,
CreateTime = ur.CreateTime,
UserTypeEnum = ur.UserRole.UserTypeEnum,
@ -111,7 +113,7 @@ namespace IRaCIS.Core.Application.Service
[HttpPut]
public async Task<IResponseOutput> UpdateTrialUserRole(UpdateTrialUserRoleCommand updateCommand)
{
await _trialUseRoleRepository.UpdatePartialFromQueryAsync(t => updateCommand.IdList.Contains(t.Id), u => new TrialUserRole() { IsDeleted = updateCommand.IsDeleted }, true);
await _trialUseRoleRepository.UpdatePartialFromQueryAsync(t => updateCommand.IdList.Contains(t.Id), u => new TrialUserRole() { IsDeleted = updateCommand.IsDeleted }, true, true);
return ResponseOutput.Ok();
}
@ -132,7 +134,7 @@ namespace IRaCIS.Core.Application.Service
//之前已经选择的用户 不放在列表中,现在又要改回去 废弃
var query = _userRoleRepository.Where(t => t.UserTypeEnum != UserTypeEnum.SuperAdmin && t.IdentityUser.Status == UserStateEnum.Enable)
var query = _userRoleRepository.Where(t => t.UserTypeEnum != UserTypeEnum.SuperAdmin && t.IdentityUser.Status == UserStateEnum.Enable).IgnoreQueryFilters()
//正式或者培训的项目 不能允许测试用户(必须正式用户) 同时必须是内部的用户
.WhereIf(trialType == TrialType.OfficialTrial || trialType == TrialType.Training, t => t.IdentityUser.IsTestUser == false && t.IdentityUser.IsZhiZhun)

View File

@ -175,7 +175,11 @@ namespace IRaCIS.Core.Application.Service
var trial = await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId);
var hasSPMOrCPM = await _trialUserRoleRepository.Where(t => t.TrialId == trialId).AnyAsync(t => t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM);
var hasSPMOrCPM = await _trialRepository.Where(t => t.Id == trialId).AnyAsync(t => t.TrialIdentityUserList.SelectMany(t => t.TrialUserRoleList).Any(t =>
t.UserRole.IdentityUser.Status==UserStateEnum.Enable
&& t.UserRole.IsUserRoleDisabled==false
&& (t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM) )
);
var isSPMjoin = trial.IsSPMJoinReviewerSelect && hasSPMOrCPM;

View File

@ -167,7 +167,7 @@ namespace IRaCIS.Core.Application.Service
{
var userList = _userRoleRepository.Where().ToList();
foreach (var item in userList.GroupBy(t => t.EMail.Trim()))
foreach (var item in userList.GroupBy(t => t.EMail.Trim().ToLower()))
{
var emailUserIdList = item.Select(t => t.Id).ToList();

View File

@ -3,7 +3,7 @@ namespace IRaCIS.Core.Domain.Models;
[Comment("项目用户角色表")]
[Table("TrialUser")]
public class TrialUserRole : BaseFullAuditEntity
public class TrialUserRole : BaseFullDeleteAuditEntity
{
#region 导航属性
[JsonIgnore]
@ -27,10 +27,6 @@ public class TrialUserRole : BaseFullAuditEntity
public DateTime? JoinTime { get; set; }
public Guid? DeleteUserId { get; set; }
public bool IsDeleted { get; set; }
public DateTime? DeletedTime { get; set; }
public Guid TrialUserId { get; set; }
}

View File

@ -3000,12 +3000,13 @@ namespace IRaCIS.Core.Infra.EFCore.Common
await InsertInspection<ReadingTaskQuestionMark>(entity, type, x => new InspectionConvertDTO()
{
VisitTaskId = entity.VisitTaskId,
ObjectRelationParentId = entity.VisitTaskId,
},new {
Answer= answer,
LiverSegmentation= liverSegmentation,
}, new
{
Answer = answer,
LiverSegmentation = liverSegmentation,
});
}
@ -3331,36 +3332,42 @@ namespace IRaCIS.Core.Infra.EFCore.Common
UserRealName = userRealName,
};
var extraIdentification = string.Empty;
var isDistinctionInterface = true ;
#region 标识区分
if (type == AuditOpt.Add)
{
isDistinctionInterface = false;
//生成一致性分析任务
if (entity.IsSelfAnalysis == true)
{
type = type + "/" + "SelfAnalysis";
extraIdentification = "/SelfAnalysis";
}
else if (entity.IsSelfAnalysis == false)
{
type = type + "/" + "GroupAnalysis";
extraIdentification = "/GroupAnalysis";
}
else
{
type = type + "/" + "NotAnalysis";
extraIdentification = "/NotAnalysis";
}
//区分任务类型
type = type + "/" + (int)entity.ReadingCategory;
extraIdentification = extraIdentification + "/" + (int)entity.ReadingCategory;
}
else
{
isDistinctionInterface = false;
switch (_userInfo.RequestUrl)
{
//申请重阅
case "VisitTask/applyReReading":
type = type + "/" + (int)entity.ReReadingApplyState;
extraIdentification = "/" + (int)entity.ReReadingApplyState;
break;
@ -3369,12 +3376,12 @@ namespace IRaCIS.Core.Infra.EFCore.Common
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM)
{
type = type + "/" + 1;
extraIdentification = "/" + 1;
}
else
{
type = type + "/" + 2;
extraIdentification = "/" + 2;
}
break;
@ -3510,7 +3517,9 @@ namespace IRaCIS.Core.Infra.EFCore.Common
{
VisitTaskId = x.Id,
IsDistinctionInterface = type == AuditOpt.Update ? true : false,
IsDistinctionInterface = isDistinctionInterface,
ExtraIndentification = extraIdentification,
ObjectRelationParentId = entity.SourceSubjectVisitId != null ? entity.SourceSubjectVisitId : entity.SouceReadModuleId,