|
|
|
@@ -55,27 +55,27 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Setting 界面的 项目所有文档列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="queryTrialDocument"></param>
|
|
|
|
|
/// <param name="inQuery"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<PageOutput<TrialDocumentView>> GetTrialDocumentList(TrialDocumentQuery queryTrialDocument)
|
|
|
|
|
public async Task<PageOutput<TrialDocumentView>> GetTrialDocumentList(TrialDocumentQuery inQuery)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var trialDocumentQueryable = _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == queryTrialDocument.TrialId)
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(queryTrialDocument.Name), t => t.Name.Contains(queryTrialDocument.Name))
|
|
|
|
|
.WhereIf(queryTrialDocument.FileTypeId != null, t => t.FileTypeId == queryTrialDocument.FileTypeId)
|
|
|
|
|
.WhereIf(queryTrialDocument.UserTypeId != null, t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == queryTrialDocument.UserTypeId))
|
|
|
|
|
.WhereIf(queryTrialDocument.IsDeleted != null, t => t.IsDeleted == queryTrialDocument.IsDeleted)
|
|
|
|
|
var trialDocumentQueryable = _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == inQuery.TrialId)
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name))
|
|
|
|
|
.WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId)
|
|
|
|
|
.WhereIf(inQuery.UserTypeId != null, t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == inQuery.UserTypeId))
|
|
|
|
|
.WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted)
|
|
|
|
|
.ProjectTo<TrialDocumentView>(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, isEn_Us = _userInfo.IsEn_Us });
|
|
|
|
|
|
|
|
|
|
return await trialDocumentQueryable.ToPagedListAsync(queryTrialDocument.PageIndex, queryTrialDocument.PageSize, queryTrialDocument.SortField, queryTrialDocument.Asc);
|
|
|
|
|
return await trialDocumentQueryable.ToPagedListAsync(inQuery);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<PageOutput<TrialSignDocView>> GetTrialSignDocumentList(TrialDocQuery querySystemDocument)
|
|
|
|
|
public async Task<PageOutput<TrialSignDocView>> GetTrialSignDocumentList(TrialDocQuery inQuery)
|
|
|
|
|
{
|
|
|
|
|
var trialDocQueryable = from trialDoc in _trialDocumentRepository.AsQueryable(true)
|
|
|
|
|
.WhereIf(querySystemDocument.TrialId != null, t => t.TrialId == querySystemDocument.TrialId)
|
|
|
|
|
.WhereIf(inQuery.TrialId != null, t => t.TrialId == inQuery.TrialId)
|
|
|
|
|
.Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
|
|
|
|
|
|
|
|
|
join trialUser in _repository.Where<TrialUser>(t => t.UserId == _userInfo.Id) on trialDoc.TrialId equals trialUser.TrialId
|
|
|
|
@@ -110,13 +110,13 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
trialDocQueryable = trialDocQueryable.WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name))
|
|
|
|
|
.WhereIf(querySystemDocument.FileTypeId != null, t => t.FileTypeId == querySystemDocument.FileTypeId)
|
|
|
|
|
.WhereIf(querySystemDocument.IsSigned == true, t => t.ConfirmTime != null)
|
|
|
|
|
.WhereIf(querySystemDocument.IsSigned == false, t => t.ConfirmTime == null);
|
|
|
|
|
trialDocQueryable = trialDocQueryable.WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name))
|
|
|
|
|
.WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId)
|
|
|
|
|
.WhereIf(inQuery.IsSigned == true, t => t.ConfirmTime != null)
|
|
|
|
|
.WhereIf(inQuery.IsSigned == false, t => t.ConfirmTime == null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return await trialDocQueryable.ToPagedListAsync(querySystemDocument.PageIndex, querySystemDocument.PageSize, querySystemDocument.SortField, querySystemDocument.Asc);
|
|
|
|
|
return await trialDocQueryable.ToPagedListAsync(inQuery);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -170,10 +170,10 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 具体用户看到的 系统文件列表 + 项目类型文档
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="querySystemDocument"></param>
|
|
|
|
|
/// <param name="inQuery"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<IResponseOutput<PageOutput<UnionDocumentWithConfirmInfoView>>> GetUserDocumentList(TrialUserDocUnionQuery querySystemDocument)
|
|
|
|
|
public async Task<IResponseOutput<PageOutput<UnionDocumentWithConfirmInfoView>>> GetUserDocumentList(TrialUserDocUnionQuery inQuery)
|
|
|
|
|
{
|
|
|
|
|
#region https://github.com/dotnet/efcore/issues/16243 操作不行
|
|
|
|
|
////系统文档查询
|
|
|
|
@@ -235,9 +235,9 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
var trialId = querySystemDocument.TrialId;
|
|
|
|
|
var trialId = inQuery.TrialId;
|
|
|
|
|
|
|
|
|
|
var trialInfo = await (_repository.Where<Trial>(t => t.Id == querySystemDocument.TrialId, ignoreQueryFilters: true).Select(t => new { t.TrialFinishedTime, t.TrialStatusStr }).FirstNotNullAsync());
|
|
|
|
|
var trialInfo = await (_repository.Where<Trial>(t => t.Id == inQuery.TrialId, ignoreQueryFilters: true).Select(t => new { t.TrialFinishedTime, t.TrialStatusStr }).FirstNotNullAsync());
|
|
|
|
|
|
|
|
|
|
//系统文档查询
|
|
|
|
|
var systemDocumentQueryable = from needConfirmedUserType in _repository.Where<SystemDocNeedConfirmedUserType>(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)
|
|
|
|
@@ -245,7 +245,7 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
.WhereIf(trialInfo.TrialFinishedTime != null, u => u.SystemDocument.CreateTime < trialInfo.TrialFinishedTime)
|
|
|
|
|
.WhereIf(!_userInfo.IsAdmin, t => t.SystemDocument.IsDeleted == false || (t.SystemDocument.IsDeleted == true && t.SystemDocument.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id)))
|
|
|
|
|
|
|
|
|
|
join trialUser in _repository.Where<TrialUser>(t => t.TrialId == querySystemDocument.TrialId && t.UserId == _userInfo.Id)
|
|
|
|
|
join trialUser in _repository.Where<TrialUser>(t => t.TrialId == inQuery.TrialId && t.UserId == _userInfo.Id)
|
|
|
|
|
on needConfirmedUserType.NeedConfirmUserTypeId equals trialUser.User.UserTypeId
|
|
|
|
|
join confirm in _repository.GetQueryable<SystemDocConfirmedUser>() on new { ConfirmUserId = trialUser.UserId, SystemDocumentId = needConfirmedUserType.SystemDocumentId } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
|
|
|
|
|
from confirm in cc.DefaultIfEmpty()
|
|
|
|
@@ -275,12 +275,12 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//项目文档查询
|
|
|
|
|
var trialDocQueryable = from trialDoc in _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == querySystemDocument.TrialId)
|
|
|
|
|
var trialDocQueryable = from trialDoc in _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == inQuery.TrialId)
|
|
|
|
|
.WhereIf(!_userInfo.IsAdmin, t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
|
|
|
|
.WhereIf(!_userInfo.IsAdmin, t => t.IsDeleted == false || (t.IsDeleted == true && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id)))
|
|
|
|
|
|
|
|
|
|
join trialUser in _repository.Where<TrialUser>(t => t.TrialId == querySystemDocument.TrialId && t.UserId == _userInfo.Id) on trialDoc.TrialId equals trialUser.TrialId
|
|
|
|
|
join confirm in _repository.Where<TrialDocConfirmedUser>(t => t.TrialDocument.TrialId == querySystemDocument.TrialId) on
|
|
|
|
|
join trialUser in _repository.Where<TrialUser>(t => t.TrialId == inQuery.TrialId && t.UserId == _userInfo.Id) on trialDoc.TrialId equals trialUser.TrialId
|
|
|
|
|
join confirm in _repository.Where<TrialDocConfirmedUser>(t => t.TrialDocument.TrialId == inQuery.TrialId) on
|
|
|
|
|
new { trialUser.UserId, TrialDocumentId = trialDoc.Id } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
|
|
|
|
from confirm in cc.DefaultIfEmpty()
|
|
|
|
|
select new UnionDocumentWithConfirmInfoView()
|
|
|
|
@@ -309,14 +309,14 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
|
|
|
|
|
#region 报错 奇怪的bug
|
|
|
|
|
var unionQuery = systemDocumentQueryable.Union(trialDocQueryable)
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name))
|
|
|
|
|
.WhereIf(querySystemDocument.FileTypeId != null, t => t.FileTypeId == querySystemDocument.FileTypeId)
|
|
|
|
|
.WhereIf(querySystemDocument.IsSign == true, t => t.ConfirmTime != null)
|
|
|
|
|
.WhereIf(querySystemDocument.IsSign == false, t => 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)
|
|
|
|
|
.WhereIf(inQuery.IsSign == false, t => t.ConfirmTime == null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var result = await unionQuery.ToPagedListAsync(querySystemDocument.PageIndex, querySystemDocument.PageSize, querySystemDocument.SortField, querySystemDocument.Asc);
|
|
|
|
|
var result = await unionQuery.ToPagedListAsync(inQuery);
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 临时方案
|
|
|
|
@@ -342,7 +342,7 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == querySystemDocument.TrialId && t.Trial.TrialStatusStr != StaticData.TrialState.TrialStopped)
|
|
|
|
|
var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == inQuery.TrialId && t.Trial.TrialStatusStr != StaticData.TrialState.TrialStopped)
|
|
|
|
|
.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id))
|
|
|
|
|
.Where(t => t.IsDeleted == false && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
|
|
|
|
.CountAsync();
|
|
|
|
@@ -352,7 +352,7 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
.Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
|
|
|
|
.CountAsync();
|
|
|
|
|
|
|
|
|
|
var trialTaskConfig = _trialRepository.Where(t => t.Id == querySystemDocument.TrialId).ProjectTo<TrialProcessConfigDTO>(_mapper.ConfigurationProvider).FirstOrDefault();
|
|
|
|
|
var trialTaskConfig = _trialRepository.Where(t => t.Id == inQuery.TrialId).ProjectTo<TrialProcessConfigDTO>(_mapper.ConfigurationProvider).FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -489,7 +489,7 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
.WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted)
|
|
|
|
|
.WhereIf(inQuery.UserTypeId != null, t => t.UserTypeId == inQuery.UserTypeId);
|
|
|
|
|
|
|
|
|
|
var result = await unionQuery.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc);
|
|
|
|
|
var result = await unionQuery.ToPagedListAsync(inQuery);
|
|
|
|
|
|
|
|
|
|
var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true)
|
|
|
|
|
.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id))
|
|
|
|
@@ -819,11 +819,11 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 从 文档的维度 先看到文档列表(系统文档+项目文档 以及需要确认的人数 和已经确认人数) 点击数字查看某文档下面人确认情况
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="querySystemDocument"></param>
|
|
|
|
|
/// <param name="inQuery"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
[Obsolete]
|
|
|
|
|
public async Task<PageOutput<DocumentUnionWithUserStatView>> GetTrialSystemDocumentList(DocumentTrialUnionQuery querySystemDocument)
|
|
|
|
|
public async Task<PageOutput<DocumentUnionWithUserStatView>> GetTrialSystemDocumentList(DocumentTrialUnionQuery inQuery)
|
|
|
|
|
{
|
|
|
|
|
var systemDocumentQueryable = _repository
|
|
|
|
|
.WhereIf<SystemDocument>(!_userInfo.IsAdmin, t => t.IsDeleted == false)
|
|
|
|
@@ -842,10 +842,10 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
DocumentConfirmedUserCount = t.SystemDocConfirmedUserList.Count(),
|
|
|
|
|
|
|
|
|
|
//DocumentUserCount= _trialUserRepository.Where(tu=>tu.TrialId== querySystemDocument.TrialId).Count(u=>t.NeedConfirmedUserTypeList.Any(cc=>cc.NeedConfirmUserTypeId== u.User.UserTypeId ))
|
|
|
|
|
DocumentUserCount = t.NeedConfirmedUserTypeList.SelectMany(u => u.UserTypeRole.UserList.SelectMany(b => b.UserTrials.Where(r => r.TrialId == querySystemDocument.TrialId))).Count()
|
|
|
|
|
DocumentUserCount = t.NeedConfirmedUserTypeList.SelectMany(u => u.UserTypeRole.UserList.SelectMany(b => b.UserTrials.Where(r => r.TrialId == inQuery.TrialId))).Count()
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var trialDocQueryable = _trialDocumentRepository.Where(t => t.TrialId == querySystemDocument.TrialId).Select(t => new DocumentUnionWithUserStatView()
|
|
|
|
|
var trialDocQueryable = _trialDocumentRepository.Where(t => t.TrialId == inQuery.TrialId).Select(t => new DocumentUnionWithUserStatView()
|
|
|
|
|
{
|
|
|
|
|
Id = t.Id,
|
|
|
|
|
IsSystemDoc = false,
|
|
|
|
@@ -864,10 +864,10 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var unionQuery = systemDocumentQueryable.Union(trialDocQueryable)
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name))
|
|
|
|
|
.WhereIf(querySystemDocument.FileTypeId != null, t => t.FileTypeId == querySystemDocument.FileTypeId);
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name))
|
|
|
|
|
.WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId);
|
|
|
|
|
|
|
|
|
|
return await unionQuery.ToPagedListAsync(querySystemDocument.PageIndex, querySystemDocument.PageSize, querySystemDocument.SortField, querySystemDocument.Asc);
|
|
|
|
|
return await unionQuery.ToPagedListAsync(inQuery);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|