|
|
|
@@ -6,8 +6,13 @@
|
|
|
|
|
|
|
|
|
|
using IRaCIS.Core.Application.Contracts;
|
|
|
|
|
using IRaCIS.Core.Application.Filter;
|
|
|
|
|
using IRaCIS.Core.Domain.Models;
|
|
|
|
|
using IRaCIS.Core.Domain.Share;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Linq.Dynamic.Core;
|
|
|
|
|
|
|
|
|
|
namespace IRaCIS.Core.Application.Services
|
|
|
|
|
{
|
|
|
|
@@ -16,15 +21,15 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ApiExplorerSettings(GroupName = "Trial")]
|
|
|
|
|
public class TrialDocumentService(IRepository<TrialDocument> _trialDocumentRepository,
|
|
|
|
|
IRepository<TrialDocConfirmedUser> _trialDocUserTypeConfirmedUserRepository,
|
|
|
|
|
IRepository<Trial> _trialRepository,
|
|
|
|
|
ISystemDocumentService _systemDocumentService,
|
|
|
|
|
IRepository<SystemDocConfirmedUser> _systemDocConfirmedUserRepository,
|
|
|
|
|
IRepository<SystemDocConfirmedIdentityUser> _systemDocConfirmedUserRepository,
|
|
|
|
|
IRepository<SystemDocNeedConfirmedUserType> _systemDocNeedConfirmedUserTypeRepository,
|
|
|
|
|
IRepository<TrialDocNeedConfirmedUserType> _trialDocNeedConfirmedUserTypeRepository,
|
|
|
|
|
IRepository<SystemDocument> _systemDocumentRepository,
|
|
|
|
|
IRepository<TrialUserRole> _trialUserRoleRepository,
|
|
|
|
|
IRepository<TrialDocConfirmedUser> _trialDocConfirmedUserRepository,
|
|
|
|
|
IRepository<TrialIdentityUser> _trialIdentityUserRepository,
|
|
|
|
|
IRepository<TrialUserRole> _trialUserRoleRepository,
|
|
|
|
|
IRepository<TrialDocConfirmedIdentityUser> _trialDocConfirmedUserRepository,
|
|
|
|
|
IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITrialDocumentService
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
@@ -57,9 +62,9 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
.WhereIf(inQuery.TrialId != null, t => t.TrialId == inQuery.TrialId)
|
|
|
|
|
.Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
|
|
|
|
|
|
|
|
|
join trialUser in _trialUserRoleRepository.Where(t => t.UserId == _userInfo.UserRoleId) on trialDoc.TrialId equals trialUser.TrialId
|
|
|
|
|
join trialUser in _trialIdentityUserRepository.Where(t => t.IdentityUserId == _userInfo.IdentityUserId) on trialDoc.TrialId equals trialUser.TrialId
|
|
|
|
|
join confirm in _trialDocConfirmedUserRepository.Where() on
|
|
|
|
|
new { trialUser.UserId, TrialDocumentId = trialDoc.Id } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
|
|
|
|
new { trialUser.IdentityUserId, TrialDocumentId = trialDoc.Id } equals new { IdentityUserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
|
|
|
|
|
|
|
|
|
from confirm in cc.DefaultIfEmpty()
|
|
|
|
|
select new TrialSignDocView()
|
|
|
|
@@ -82,11 +87,12 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
//IsConfirmed = confirm.ConfirmTime != null,
|
|
|
|
|
ConfirmUserId = confirm.ConfirmUserId,
|
|
|
|
|
ConfirmTime = confirm.ConfirmTime,
|
|
|
|
|
RealName = trialUser.UserRole.FullName,
|
|
|
|
|
UserName = trialUser.UserRole.IdentityUser.UserName,
|
|
|
|
|
UserTypeId = trialUser.UserRole.UserTypeId,
|
|
|
|
|
UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName
|
|
|
|
|
RealName = trialUser.IdentityUser.FullName,
|
|
|
|
|
UserName = trialUser.IdentityUser.UserName,
|
|
|
|
|
|
|
|
|
|
IdentityUserTypeList = trialUser.TrialUserRoleList.Select(t => t.UserRole.UserTypeRole.UserTypeShortName).ToList(),
|
|
|
|
|
|
|
|
|
|
DocNeedSignUserTypeList = trialDoc.NeedConfirmedUserTypeList.Select(t => t.UserTypeRole.UserTypeShortName).ToList(),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
trialDocQueryable = trialDocQueryable.WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name))
|
|
|
|
@@ -218,75 +224,178 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
|
|
|
|
|
var trialInfo = await (_trialRepository.Where(t => t.Id == inQuery.TrialId, ignoreQueryFilters: true).Select(t => new { t.TrialFinishedTime, t.TrialStatusStr }).FirstNotNullAsync());
|
|
|
|
|
|
|
|
|
|
//系统文档查询
|
|
|
|
|
var systemDocumentQueryable = from needConfirmedUserType in _systemDocNeedConfirmedUserTypeRepository.Where(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId, ignoreQueryFilters: true)
|
|
|
|
|
.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.UserRoleId)))
|
|
|
|
|
|
|
|
|
|
join trialUser in _trialUserRoleRepository.Where(t => t.TrialId == inQuery.TrialId && t.UserId == _userInfo.UserRoleId)
|
|
|
|
|
on needConfirmedUserType.NeedConfirmUserTypeId equals trialUser.UserRole.UserTypeId
|
|
|
|
|
join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = trialUser.UserId, SystemDocumentId = needConfirmedUserType.SystemDocumentId } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
|
|
|
|
|
from confirm in cc.DefaultIfEmpty()
|
|
|
|
|
select new UnionDocumentWithConfirmInfoView()
|
|
|
|
|
{
|
|
|
|
|
IsSystemDoc = true,
|
|
|
|
|
#region 统一用户修改
|
|
|
|
|
|
|
|
|
|
Id = needConfirmedUserType.SystemDocument.Id,
|
|
|
|
|
CreateTime = needConfirmedUserType.SystemDocument.CreateTime,
|
|
|
|
|
IsDeleted = needConfirmedUserType.SystemDocument.IsDeleted,
|
|
|
|
|
SignViewMinimumMinutes = needConfirmedUserType.SystemDocument.SignViewMinimumMinutes,
|
|
|
|
|
Name = needConfirmedUserType.SystemDocument.Name,
|
|
|
|
|
Path = needConfirmedUserType.SystemDocument.Path,
|
|
|
|
|
FileTypeId = needConfirmedUserType.SystemDocument.FileTypeId,
|
|
|
|
|
FileType = _userInfo.IsEn_Us ? needConfirmedUserType.SystemDocument.FileType.Value : needConfirmedUserType.SystemDocument.FileType.ValueCN,
|
|
|
|
|
UpdateTime = needConfirmedUserType.SystemDocument.UpdateTime,
|
|
|
|
|
var systemDocQuery =
|
|
|
|
|
from sysDoc in _systemDocumentRepository.AsQueryable(false).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)))
|
|
|
|
|
|
|
|
|
|
FullFilePath = needConfirmedUserType.SystemDocument.Path,
|
|
|
|
|
join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = trialUser.IdentityUserId, SystemDocumentId = sysDoc.Id } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
|
|
|
|
|
from confirm in cc.DefaultIfEmpty()
|
|
|
|
|
select new UnionDocumentWithConfirmInfoView()
|
|
|
|
|
{
|
|
|
|
|
IsSystemDoc = true,
|
|
|
|
|
|
|
|
|
|
Id = sysDoc.Id,
|
|
|
|
|
CreateTime = sysDoc.CreateTime,
|
|
|
|
|
IsDeleted = sysDoc.IsDeleted,
|
|
|
|
|
SignViewMinimumMinutes = sysDoc.SignViewMinimumMinutes,
|
|
|
|
|
Name = sysDoc.Name,
|
|
|
|
|
Path = sysDoc.Path,
|
|
|
|
|
FileType = _userInfo.IsEn_Us ? sysDoc.FileType.Value : sysDoc.FileType.ValueCN,
|
|
|
|
|
FileTypeId = sysDoc.FileTypeId,
|
|
|
|
|
UpdateTime = sysDoc.UpdateTime,
|
|
|
|
|
//IsConfirmed = confirm.ConfirmTime != null,
|
|
|
|
|
|
|
|
|
|
ConfirmUserId = confirm.ConfirmUserId,
|
|
|
|
|
ConfirmTime = confirm.ConfirmTime,
|
|
|
|
|
|
|
|
|
|
RealName = trialUser.IdentityUser.FullName,
|
|
|
|
|
UserName = trialUser.IdentityUser.UserName,
|
|
|
|
|
|
|
|
|
|
//UserTypeId = trialUser.UserRole.UserTypeId,
|
|
|
|
|
//UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
|
|
|
|
|
//DocNeedSignUserTypeList = sysDoc.NeedConfirmedUserTypeList.Select(t => t.UserTypeRole.UserTypeName),
|
|
|
|
|
|
|
|
|
|
FullFilePath = sysDoc.Path
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//IsConfirmed = confirm.ConfirmTime != null,
|
|
|
|
|
ConfirmUserId = confirm.ConfirmUserId,
|
|
|
|
|
ConfirmTime = confirm.ConfirmTime,
|
|
|
|
|
RealName = trialUser.UserRole.FullName,
|
|
|
|
|
UserName = trialUser.UserRole.IdentityUser.UserName,
|
|
|
|
|
UserTypeId = trialUser.UserRole.UserTypeId,
|
|
|
|
|
UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//项目文档查询
|
|
|
|
|
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.UserRoleId)))
|
|
|
|
|
var trialDocQuery =
|
|
|
|
|
from trialDoc in _trialDocumentRepository.AsQueryable(false).Where(t => t.TrialId == inQuery.TrialId)
|
|
|
|
|
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)))
|
|
|
|
|
|
|
|
|
|
join trialUser in _trialUserRoleRepository.Where(t => t.TrialId == inQuery.TrialId && t.UserId == _userInfo.UserRoleId) on trialDoc.TrialId equals trialUser.TrialId
|
|
|
|
|
join confirm in _trialDocConfirmedUserRepository.Where(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()
|
|
|
|
|
{
|
|
|
|
|
Id = trialDoc.Id,
|
|
|
|
|
IsSystemDoc = false,
|
|
|
|
|
CreateTime = trialDoc.CreateTime,
|
|
|
|
|
FullFilePath = trialDoc.Path,
|
|
|
|
|
IsDeleted = trialDoc.IsDeleted,
|
|
|
|
|
Name = trialDoc.Name,
|
|
|
|
|
Path = trialDoc.Path,
|
|
|
|
|
FileTypeId = trialDoc.FileTypeId,
|
|
|
|
|
FileType = _userInfo.IsEn_Us ? trialDoc.FileType.Value : trialDoc.FileType.ValueCN,
|
|
|
|
|
UpdateTime = trialDoc.UpdateTime,
|
|
|
|
|
SignViewMinimumMinutes = trialDoc.SignViewMinimumMinutes,
|
|
|
|
|
join confirm in _trialDocConfirmedUserRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) on
|
|
|
|
|
new { trialUser.IdentityUserId, TrialDocumentId = trialDoc.Id } equals new { IdentityUserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
|
|
|
|
from confirm in cc.DefaultIfEmpty()
|
|
|
|
|
select new UnionDocumentWithConfirmInfoView()
|
|
|
|
|
{
|
|
|
|
|
IsSystemDoc = false,
|
|
|
|
|
|
|
|
|
|
//IsConfirmed = confirm.ConfirmTime != null,
|
|
|
|
|
ConfirmUserId = confirm.ConfirmUserId,
|
|
|
|
|
ConfirmTime = confirm.ConfirmTime,
|
|
|
|
|
RealName = trialUser.UserRole.FullName,
|
|
|
|
|
UserName = trialUser.UserRole.IdentityUser.UserName,
|
|
|
|
|
UserTypeId = trialUser.UserRole.UserTypeId,
|
|
|
|
|
UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName
|
|
|
|
|
Id = trialDoc.Id,
|
|
|
|
|
CreateTime = trialDoc.CreateTime,
|
|
|
|
|
IsDeleted = trialDoc.IsDeleted,
|
|
|
|
|
SignViewMinimumMinutes = trialDoc.SignViewMinimumMinutes,
|
|
|
|
|
Name = trialDoc.Name,
|
|
|
|
|
Path = trialDoc.Path,
|
|
|
|
|
FileTypeId = trialDoc.FileTypeId,
|
|
|
|
|
FileType = _userInfo.IsEn_Us ? trialDoc.FileType.Value : trialDoc.FileType.ValueCN,
|
|
|
|
|
UpdateTime = trialDoc.UpdateTime,
|
|
|
|
|
//IsConfirmed= confirm.ConfirmTime!=null,
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ConfirmUserId = confirm.ConfirmUserId,
|
|
|
|
|
ConfirmTime = confirm.ConfirmTime,
|
|
|
|
|
RealName = trialUser.IdentityUser.FullName,
|
|
|
|
|
UserName = trialUser.IdentityUser.UserName,
|
|
|
|
|
|
|
|
|
|
//DocNeedSignUserTypeList = trialDoc.NeedConfirmedUserTypeList.Select(t => t.UserTypeRole.UserTypeName),
|
|
|
|
|
|
|
|
|
|
//UserTypeId = trialUser.UserRole.UserTypeId,
|
|
|
|
|
//UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
|
|
|
|
|
|
|
|
|
|
FullFilePath = trialDoc.Path
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 废弃
|
|
|
|
|
|
|
|
|
|
////系统文档查询
|
|
|
|
|
//var systemDocQuery = from needConfirmedUserType in _systemDocNeedConfirmedUserTypeRepository.Where(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId, ignoreQueryFilters: true)
|
|
|
|
|
// .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.IdentityUserId)))
|
|
|
|
|
|
|
|
|
|
// join trialUser in _trialUserRoleRepository.Where(t => t.TrialId == inQuery.TrialId && t.UserRole.IdentityUserId == _userInfo.IdentityUserId)
|
|
|
|
|
// on needConfirmedUserType.NeedConfirmUserTypeId equals trialUser.UserRole.UserTypeId
|
|
|
|
|
// join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = trialUser.UserId, SystemDocumentId = needConfirmedUserType.SystemDocumentId } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
|
|
|
|
|
// from confirm in cc.DefaultIfEmpty()
|
|
|
|
|
// select new UnionDocumentWithConfirmInfoView()
|
|
|
|
|
// {
|
|
|
|
|
// IsSystemDoc = true,
|
|
|
|
|
|
|
|
|
|
// Id = needConfirmedUserType.SystemDocument.Id,
|
|
|
|
|
// CreateTime = needConfirmedUserType.SystemDocument.CreateTime,
|
|
|
|
|
// IsDeleted = needConfirmedUserType.SystemDocument.IsDeleted,
|
|
|
|
|
// SignViewMinimumMinutes = needConfirmedUserType.SystemDocument.SignViewMinimumMinutes,
|
|
|
|
|
// Name = needConfirmedUserType.SystemDocument.Name,
|
|
|
|
|
// Path = needConfirmedUserType.SystemDocument.Path,
|
|
|
|
|
// FileTypeId = needConfirmedUserType.SystemDocument.FileTypeId,
|
|
|
|
|
// FileType = _userInfo.IsEn_Us ? needConfirmedUserType.SystemDocument.FileType.Value : needConfirmedUserType.SystemDocument.FileType.ValueCN,
|
|
|
|
|
// UpdateTime = needConfirmedUserType.SystemDocument.UpdateTime,
|
|
|
|
|
|
|
|
|
|
// FullFilePath = needConfirmedUserType.SystemDocument.Path,
|
|
|
|
|
|
|
|
|
|
// //IsConfirmed = confirm.ConfirmTime != null,
|
|
|
|
|
// ConfirmUserId = confirm.ConfirmUserId,
|
|
|
|
|
// ConfirmTime = confirm.ConfirmTime,
|
|
|
|
|
// RealName = trialUser.UserRole.FullName,
|
|
|
|
|
// UserName = trialUser.UserRole.IdentityUser.UserName,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// //IdentityUserTypeList = trialUser.TrialUser.TrialUserRoleList.Select(t => t.UserRole.UserTypeRole.UserTypeShortName),
|
|
|
|
|
|
|
|
|
|
// //DocNeedSignUserTypeList = needConfirmedUserType.SystemDocument.NeedConfirmedUserTypeList.Select(t => t.UserTypeRole.UserTypeShortName).ToList(),
|
|
|
|
|
|
|
|
|
|
// //UserTypeId = trialUser.UserRole.UserTypeId,
|
|
|
|
|
// //UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
////项目文档查询
|
|
|
|
|
//var trialDocQuery = 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.IdentityUserId)))
|
|
|
|
|
|
|
|
|
|
// join trialUser in _trialUserRoleRepository.Where(t => t.TrialId == inQuery.TrialId && t.UserRole.IdentityUserId == _userInfo.IdentityUserId) on trialDoc.TrialId equals trialUser.TrialId
|
|
|
|
|
// join confirm in _trialDocConfirmedUserRepository.Where(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()
|
|
|
|
|
// {
|
|
|
|
|
// Id = trialDoc.Id,
|
|
|
|
|
// IsSystemDoc = false,
|
|
|
|
|
// CreateTime = trialDoc.CreateTime,
|
|
|
|
|
// FullFilePath = trialDoc.Path,
|
|
|
|
|
// IsDeleted = trialDoc.IsDeleted,
|
|
|
|
|
// Name = trialDoc.Name,
|
|
|
|
|
// Path = trialDoc.Path,
|
|
|
|
|
// FileTypeId = trialDoc.FileTypeId,
|
|
|
|
|
// FileType = _userInfo.IsEn_Us ? trialDoc.FileType.Value : trialDoc.FileType.ValueCN,
|
|
|
|
|
// UpdateTime = trialDoc.UpdateTime,
|
|
|
|
|
// SignViewMinimumMinutes = trialDoc.SignViewMinimumMinutes,
|
|
|
|
|
|
|
|
|
|
// //IsConfirmed = confirm.ConfirmTime != null,
|
|
|
|
|
// ConfirmUserId = confirm.ConfirmUserId,
|
|
|
|
|
// ConfirmTime = confirm.ConfirmTime,
|
|
|
|
|
// RealName = trialUser.UserRole.FullName,
|
|
|
|
|
// UserName = trialUser.UserRole.IdentityUser.UserName,
|
|
|
|
|
|
|
|
|
|
// //UserTypeId = trialUser.UserRole.UserTypeId,
|
|
|
|
|
// //UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// //IdentityUserTypeList = trialUser.TrialUser.TrialUserRoleList.Select(t => t.UserRole.UserTypeRole.UserTypeShortName).ToList(),
|
|
|
|
|
|
|
|
|
|
// //DocNeedSignUserTypeList = trialDoc.NeedConfirmedUserTypeList.Select(t => t.UserTypeRole.UserTypeShortName).ToList(),
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 报错 奇怪的bug
|
|
|
|
|
var unionQuery = systemDocumentQueryable.Union(trialDocQueryable)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var unionQuery = systemDocQuery.Concat(trialDocQuery)
|
|
|
|
|
.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)
|
|
|
|
@@ -318,16 +427,14 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == inQuery.TrialId && t.Trial.TrialStatusStr != StaticData.TrialState.TrialStopped)
|
|
|
|
|
.Where(t => t.Trial.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId))
|
|
|
|
|
.Where(t => t.IsDeleted == false && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.UserRoleId && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
|
|
|
|
.Where(t => t.IsDeleted == false && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
|
|
|
|
.CountAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var needSignSystemDocCount = await _systemDocumentRepository
|
|
|
|
|
.Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.UserRoleId && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
|
|
|
|
.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();
|
|
|
|
|
|
|
|
|
|
var trialTaskConfig = _trialRepository.Where(t => t.Id == inQuery.TrialId).ProjectTo<TrialProcessConfigDTO>(_mapper.ConfigurationProvider).FirstOrDefault();
|
|
|
|
@@ -338,7 +445,7 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
var isAdditionalAssessment = _readingQuestionCriterionTrialRepository.Where(t => t.TrialId == trialId && t.IsSigned && t.IsAdditionalAssessment == true
|
|
|
|
|
&& t.TrialCriterionAdditionalAssessmentTypeList.Any(c =>/*c.AdditionalAssessmentType==Domain.Share.Reading.AdditionalAssessmentType.BrainMetastasis &&*/ c.IsSelected == true)).Any();
|
|
|
|
|
|
|
|
|
|
return ResponseOutput.Ok<PageOutput<UnionDocumentWithConfirmInfoView>>(result, new { NeedSignCount = needSignTrialDocCount + needSignSystemDocCount, NeedSignTrialDocCount = needSignTrialDocCount, NeedSignSystemDocCount = needSignSystemDocCount, IsAdditionalAssessment = isAdditionalAssessment && isManualGenerateTask, TrialStatusStr = trialInfo.TrialStatusStr, TrialConfig = trialTaskConfig });
|
|
|
|
|
return ResponseOutput.Ok(result, new { NeedSignCount = needSignTrialDocCount + needSignSystemDocCount, NeedSignTrialDocCount = needSignTrialDocCount, NeedSignSystemDocCount = needSignSystemDocCount, IsAdditionalAssessment = isAdditionalAssessment && isManualGenerateTask, TrialStatusStr = trialInfo.TrialStatusStr, TrialConfig = trialTaskConfig });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -353,6 +460,147 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
public async Task<IResponseOutput<PageOutput<UnionDocumentWithConfirmInfoView>>> GetDocumentConfirmList(DocumentTrialUnionQuery inQuery)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
#region 测试
|
|
|
|
|
|
|
|
|
|
var trialInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId, ignoreQueryFilters: true).Select(t => new { t.TrialFinishedTime, t.TrialStatusStr }).FirstNotNullAsync());
|
|
|
|
|
|
|
|
|
|
var trialDocQuery =
|
|
|
|
|
from trialDoc in _trialDocumentRepository.AsQueryable(false).Where(t => t.TrialId == inQuery.TrialId)
|
|
|
|
|
.Where(t => inQuery.UserTypeId != null ? t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == inQuery.UserTypeId) : true)
|
|
|
|
|
from trialUser in _trialIdentityUserRepository.AsQueryable(false).Where(t => t.TrialId == inQuery.TrialId
|
|
|
|
|
&& t.TrialUserRoleList.AsQueryable().Any(t => trialDoc.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == t.UserRole.UserTypeId))
|
|
|
|
|
)
|
|
|
|
|
.Where(t => inQuery.UserId != null ? t.IdentityUserId == inQuery.UserId : true)
|
|
|
|
|
|
|
|
|
|
join confirm in _trialDocConfirmedUserRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) on
|
|
|
|
|
new { trialUser.IdentityUserId, TrialDocumentId = trialDoc.Id } equals new { IdentityUserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
|
|
|
|
from confirm in cc.DefaultIfEmpty()
|
|
|
|
|
select new UnionDocumentWithConfirmInfoView()
|
|
|
|
|
{
|
|
|
|
|
IsSystemDoc = false,
|
|
|
|
|
|
|
|
|
|
Id = trialDoc.Id,
|
|
|
|
|
CreateTime = trialDoc.CreateTime,
|
|
|
|
|
IsDeleted = trialDoc.IsDeleted,
|
|
|
|
|
SignViewMinimumMinutes = trialDoc.SignViewMinimumMinutes,
|
|
|
|
|
Name = trialDoc.Name,
|
|
|
|
|
Path = trialDoc.Path,
|
|
|
|
|
FileTypeId = trialDoc.FileTypeId,
|
|
|
|
|
FileType = _userInfo.IsEn_Us ? trialDoc.FileType.Value : trialDoc.FileType.ValueCN,
|
|
|
|
|
UpdateTime = trialDoc.UpdateTime,
|
|
|
|
|
//IsConfirmed= confirm.ConfirmTime!=null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ConfirmUserId = trialUser.IdentityUserId,
|
|
|
|
|
ConfirmTime = confirm.ConfirmTime,
|
|
|
|
|
RealName = trialUser.IdentityUser.FullName,
|
|
|
|
|
UserName = trialUser.IdentityUser.UserName,
|
|
|
|
|
|
|
|
|
|
//UserTypeId = trialUser.UserRole.UserTypeId,
|
|
|
|
|
//UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
|
|
|
|
|
//DocNeedSignUserTypeList = trialDoc.NeedConfirmedUserTypeList.Select(t => t.UserTypeRole.UserTypeName),
|
|
|
|
|
|
|
|
|
|
FullFilePath = trialDoc.Path
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var systemDocQuery =
|
|
|
|
|
from sysDoc in _systemDocumentRepository.AsQueryable(false).Where(u => trialInfo.TrialFinishedTime != null ? u.CreateTime < trialInfo.TrialFinishedTime : true)
|
|
|
|
|
from trialUser in _trialIdentityUserRepository.AsQueryable(false).Where(t => t.TrialId == inQuery.TrialId
|
|
|
|
|
&& t.TrialUserRoleList.Any(t => sysDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserRole.UserTypeId)))
|
|
|
|
|
.Where(t => inQuery.UserId != null ? t.IdentityUserId == inQuery.UserId : true)
|
|
|
|
|
|
|
|
|
|
join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = trialUser.IdentityUserId, SystemDocumentId = sysDoc.Id } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
|
|
|
|
|
from confirm in cc.DefaultIfEmpty()
|
|
|
|
|
select new UnionDocumentWithConfirmInfoView()
|
|
|
|
|
{
|
|
|
|
|
IsSystemDoc = true,
|
|
|
|
|
|
|
|
|
|
Id = sysDoc.Id,
|
|
|
|
|
CreateTime = sysDoc.CreateTime,
|
|
|
|
|
IsDeleted = sysDoc.IsDeleted,
|
|
|
|
|
SignViewMinimumMinutes = sysDoc.SignViewMinimumMinutes,
|
|
|
|
|
Name = sysDoc.Name,
|
|
|
|
|
Path = sysDoc.Path,
|
|
|
|
|
FileType = _userInfo.IsEn_Us ? sysDoc.FileType.Value : sysDoc.FileType.ValueCN,
|
|
|
|
|
FileTypeId = sysDoc.FileTypeId,
|
|
|
|
|
UpdateTime = sysDoc.UpdateTime,
|
|
|
|
|
//IsConfirmed = confirm.ConfirmTime != null,
|
|
|
|
|
|
|
|
|
|
ConfirmUserId = trialUser.IdentityUserId,
|
|
|
|
|
ConfirmTime = confirm.ConfirmTime,
|
|
|
|
|
|
|
|
|
|
RealName = trialUser.IdentityUser.FullName,
|
|
|
|
|
UserName = trialUser.IdentityUser.UserName,
|
|
|
|
|
|
|
|
|
|
//UserTypeId = trialUser.UserRole.UserTypeId,
|
|
|
|
|
//UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
|
|
|
|
|
|
|
|
|
|
FullFilePath = sysDoc.Path
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//var tt = await trialDocQuery.ToPagedListAsync(inQuery);
|
|
|
|
|
|
|
|
|
|
var unionQuery = trialDocQuery.Union(systemDocQuery).IgnoreQueryFilters().Where(t => !(t.IsDeleted == true && t.ConfirmUserId == null))
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name))
|
|
|
|
|
.WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId)
|
|
|
|
|
.WhereIf(inQuery.IsConfirmed == true, t => t.ConfirmTime != null)
|
|
|
|
|
.WhereIf(inQuery.IsConfirmed == false, t => t.ConfirmTime == null)
|
|
|
|
|
.WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted);
|
|
|
|
|
|
|
|
|
|
var result = await unionQuery.ToPagedListAsync(inQuery);
|
|
|
|
|
|
|
|
|
|
#region 处理文档 需要签署的角色类型 和每个人的角色信息
|
|
|
|
|
|
|
|
|
|
var trialDocIdList = result.CurrentPageData.Where(t => t.IsSystemDoc == false).Select(t => t.Id).ToList();
|
|
|
|
|
|
|
|
|
|
var sysDocIdList = result.CurrentPageData.Where(t => t.IsSystemDoc == true).Select(t => t.Id).ToList();
|
|
|
|
|
|
|
|
|
|
var trialIdentityUserIdList = result.CurrentPageData.Select(t => t.ConfirmUserId).Distinct().ToList();
|
|
|
|
|
|
|
|
|
|
var trialDocUserTypeList = _trialDocNeedConfirmedUserTypeRepository.Where(t => trialDocIdList.Contains(t.TrialDocumentId)).Select(t => new { t.TrialDocumentId, t.UserTypeRole.UserTypeShortName }).ToList();
|
|
|
|
|
|
|
|
|
|
var sysDocUserTypeList = _systemDocNeedConfirmedUserTypeRepository.Where(t => sysDocIdList.Contains(t.SystemDocumentId)).Select(t => new { t.SystemDocumentId, t.UserTypeRole.UserTypeShortName }).ToList();
|
|
|
|
|
|
|
|
|
|
var trialUserUserTypeList = _trialIdentityUserRepository.Where(t => t.TrialId==inQuery.TrialId && trialIdentityUserIdList.Contains(t.IdentityUserId)).Select(t => new { t.IdentityUserId, UserTypeList = t.TrialUserRoleList.Select(c => c.UserRole.UserTypeRole.UserTypeShortName).ToList() });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in result.CurrentPageData)
|
|
|
|
|
{
|
|
|
|
|
if (item.IsSystemDoc)
|
|
|
|
|
{
|
|
|
|
|
item.DocNeedSignUserTypeList = sysDocUserTypeList.Where(t => t.SystemDocumentId == item.Id).Select(t => t.UserTypeShortName).ToList();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
item.DocNeedSignUserTypeList = trialDocUserTypeList.Where(t => t.TrialDocumentId == item.Id).Select(t => t.UserTypeShortName).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
item.IdentityUserTypeList = trialUserUserTypeList.Where(t => t.IdentityUserId == item.ConfirmUserId).SelectMany(c => c.UserTypeList).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true)
|
|
|
|
|
.Where(t => t.Trial.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId))
|
|
|
|
|
.Where(t => t.IsDeleted == false && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
|
|
|
|
.CountAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var needSignSystemDocCount = await _systemDocumentRepository
|
|
|
|
|
.Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
|
|
|
|
.CountAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseOutput.Ok(result, new { NeedSignCount = needSignTrialDocCount + needSignSystemDocCount, NeedSignTrialDocCount = needSignTrialDocCount, NeedSignSystemDocCount = needSignSystemDocCount, TrialStatusStr = trialInfo.TrialStatusStr });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region linq join 方式
|
|
|
|
|
//var trialDocQuery = from trialDocumentNeedConfirmedUserType in _trialDocumentNeedConfirmedUserTypeRepository.Where(t => t.TrialDocument.TrialId == querySystemDocument.TrialId)
|
|
|
|
@@ -387,100 +635,106 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
var trialInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId, ignoreQueryFilters: true).Select(t => new { t.TrialFinishedTime, t.TrialStatusStr }).FirstNotNullAsync());
|
|
|
|
|
#region 废弃
|
|
|
|
|
//var trialInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId, ignoreQueryFilters: true).Select(t => new { t.TrialFinishedTime, t.TrialStatusStr }).FirstNotNullAsync());
|
|
|
|
|
|
|
|
|
|
var trialDocQuery = from trialDocumentNeedConfirmedUserType in _trialDocNeedConfirmedUserTypeRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId)
|
|
|
|
|
join trialUser in _trialUserRoleRepository.Where(t => t.TrialId == inQuery.TrialId)
|
|
|
|
|
.WhereIf(inQuery.UserId != null, t => t.UserId == inQuery.UserId)
|
|
|
|
|
.WhereIf(inQuery.UserTypeId != null, t => t.UserRole.UserTypeId == inQuery.UserTypeId)
|
|
|
|
|
on trialDocumentNeedConfirmedUserType.NeedConfirmUserTypeId equals trialUser.UserRole.UserTypeId
|
|
|
|
|
//var trialDocQuery = from trialDocumentNeedConfirmedUserType in _trialDocNeedConfirmedUserTypeRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId)
|
|
|
|
|
// join trialUser in _trialUserRoleRepository.Where(t => t.TrialId == inQuery.TrialId)
|
|
|
|
|
// .WhereIf(inQuery.UserId != null, t => t.UserRole.IdentityUserId == inQuery.UserId)
|
|
|
|
|
// .WhereIf(inQuery.UserTypeId != null, t => t.UserRole.UserTypeId == inQuery.UserTypeId)
|
|
|
|
|
// on trialDocumentNeedConfirmedUserType.NeedConfirmUserTypeId equals trialUser.UserRole.UserTypeId
|
|
|
|
|
|
|
|
|
|
join confirm in _trialDocConfirmedUserRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) on
|
|
|
|
|
new { trialUser.UserId, TrialDocumentId = trialDocumentNeedConfirmedUserType.TrialDocumentId } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
|
|
|
|
from confirm in cc.DefaultIfEmpty()
|
|
|
|
|
select new UnionDocumentWithConfirmInfoView()
|
|
|
|
|
{
|
|
|
|
|
IsSystemDoc = false,
|
|
|
|
|
// join confirm in _trialDocConfirmedUserRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) on
|
|
|
|
|
// new { trialUser.UserRole.IdentityUserId, TrialDocumentId = trialDocumentNeedConfirmedUserType.TrialDocumentId } equals new { IdentityUserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
|
|
|
|
// from confirm in cc.DefaultIfEmpty()
|
|
|
|
|
// select new UnionDocumentWithConfirmInfoView()
|
|
|
|
|
// {
|
|
|
|
|
// IsSystemDoc = false,
|
|
|
|
|
|
|
|
|
|
Id = trialDocumentNeedConfirmedUserType.TrialDocument.Id,
|
|
|
|
|
CreateTime = trialDocumentNeedConfirmedUserType.TrialDocument.CreateTime,
|
|
|
|
|
IsDeleted = trialDocumentNeedConfirmedUserType.TrialDocument.IsDeleted,
|
|
|
|
|
SignViewMinimumMinutes = trialDocumentNeedConfirmedUserType.TrialDocument.SignViewMinimumMinutes,
|
|
|
|
|
Name = trialDocumentNeedConfirmedUserType.TrialDocument.Name,
|
|
|
|
|
Path = trialDocumentNeedConfirmedUserType.TrialDocument.Path,
|
|
|
|
|
FileTypeId = trialDocumentNeedConfirmedUserType.TrialDocument.FileTypeId,
|
|
|
|
|
FileType = _userInfo.IsEn_Us ? trialDocumentNeedConfirmedUserType.TrialDocument.FileType.Value : trialDocumentNeedConfirmedUserType.TrialDocument.FileType.ValueCN,
|
|
|
|
|
UpdateTime = trialDocumentNeedConfirmedUserType.TrialDocument.UpdateTime,
|
|
|
|
|
//IsConfirmed= confirm.ConfirmTime!=null,
|
|
|
|
|
// Id = trialDocumentNeedConfirmedUserType.TrialDocument.Id,
|
|
|
|
|
// CreateTime = trialDocumentNeedConfirmedUserType.TrialDocument.CreateTime,
|
|
|
|
|
// IsDeleted = trialDocumentNeedConfirmedUserType.TrialDocument.IsDeleted,
|
|
|
|
|
// SignViewMinimumMinutes = trialDocumentNeedConfirmedUserType.TrialDocument.SignViewMinimumMinutes,
|
|
|
|
|
// Name = trialDocumentNeedConfirmedUserType.TrialDocument.Name,
|
|
|
|
|
// Path = trialDocumentNeedConfirmedUserType.TrialDocument.Path,
|
|
|
|
|
// FileTypeId = trialDocumentNeedConfirmedUserType.TrialDocument.FileTypeId,
|
|
|
|
|
// FileType = _userInfo.IsEn_Us ? trialDocumentNeedConfirmedUserType.TrialDocument.FileType.Value : trialDocumentNeedConfirmedUserType.TrialDocument.FileType.ValueCN,
|
|
|
|
|
// UpdateTime = trialDocumentNeedConfirmedUserType.TrialDocument.UpdateTime,
|
|
|
|
|
// //IsConfirmed= confirm.ConfirmTime!=null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ConfirmUserId = confirm.ConfirmUserId,
|
|
|
|
|
ConfirmTime = confirm.ConfirmTime,
|
|
|
|
|
RealName = trialUser.UserRole.FullName,
|
|
|
|
|
UserName = trialUser.UserRole.IdentityUser.UserName,
|
|
|
|
|
UserTypeId = trialUser.UserRole.UserTypeId,
|
|
|
|
|
UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
|
|
|
|
|
// ConfirmUserId = confirm.ConfirmUserId,
|
|
|
|
|
// ConfirmTime = confirm.ConfirmTime,
|
|
|
|
|
// RealName = trialUser.UserRole.FullName,
|
|
|
|
|
// UserName = trialUser.UserRole.IdentityUser.UserName,
|
|
|
|
|
|
|
|
|
|
FullFilePath = trialDocumentNeedConfirmedUserType.TrialDocument.Path
|
|
|
|
|
};
|
|
|
|
|
// //UserTypeId = trialUser.UserRole.UserTypeId,
|
|
|
|
|
// //UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
|
|
|
|
|
|
|
|
|
|
// FullFilePath = trialDocumentNeedConfirmedUserType.TrialDocument.Path
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var systemDocQuery = from needConfirmEdUserType in _systemDocNeedConfirmedUserTypeRepository.WhereIf(trialInfo.TrialFinishedTime != null, u => u.SystemDocument.CreateTime < trialInfo.TrialFinishedTime)
|
|
|
|
|
//var systemDocQuery = from needConfirmEdUserType in _systemDocNeedConfirmedUserTypeRepository.WhereIf(trialInfo.TrialFinishedTime != null, u => u.SystemDocument.CreateTime < trialInfo.TrialFinishedTime)
|
|
|
|
|
|
|
|
|
|
join trialUser in _trialUserRoleRepository.Where(t => t.TrialId == inQuery.TrialId)
|
|
|
|
|
.WhereIf(inQuery.UserId != null, t => t.UserId == inQuery.UserId)
|
|
|
|
|
on needConfirmEdUserType.NeedConfirmUserTypeId equals trialUser.UserRole.UserTypeId
|
|
|
|
|
join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = trialUser.UserId, SystemDocumentId = needConfirmEdUserType.SystemDocumentId } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
|
|
|
|
|
from confirm in cc.DefaultIfEmpty()
|
|
|
|
|
select new UnionDocumentWithConfirmInfoView()
|
|
|
|
|
{
|
|
|
|
|
IsSystemDoc = true,
|
|
|
|
|
// join trialUser in _trialUserRoleRepository.Where(t => t.TrialId == inQuery.TrialId)
|
|
|
|
|
// .WhereIf(inQuery.UserId != null, t => t.UserRole.IdentityUserId == inQuery.UserId)
|
|
|
|
|
// on needConfirmEdUserType.NeedConfirmUserTypeId equals trialUser.UserRole.UserTypeId
|
|
|
|
|
// join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = trialUser.UserId, SystemDocumentId = needConfirmEdUserType.SystemDocumentId } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
|
|
|
|
|
// from confirm in cc.DefaultIfEmpty()
|
|
|
|
|
// select new UnionDocumentWithConfirmInfoView()
|
|
|
|
|
// {
|
|
|
|
|
// IsSystemDoc = true,
|
|
|
|
|
|
|
|
|
|
Id = needConfirmEdUserType.SystemDocument.Id,
|
|
|
|
|
CreateTime = needConfirmEdUserType.SystemDocument.CreateTime,
|
|
|
|
|
IsDeleted = needConfirmEdUserType.SystemDocument.IsDeleted,
|
|
|
|
|
SignViewMinimumMinutes = needConfirmEdUserType.SystemDocument.SignViewMinimumMinutes,
|
|
|
|
|
Name = needConfirmEdUserType.SystemDocument.Name,
|
|
|
|
|
Path = needConfirmEdUserType.SystemDocument.Path,
|
|
|
|
|
FileType = _userInfo.IsEn_Us ? needConfirmEdUserType.SystemDocument.FileType.Value : needConfirmEdUserType.SystemDocument.FileType.ValueCN,
|
|
|
|
|
FileTypeId = needConfirmEdUserType.SystemDocument.FileTypeId,
|
|
|
|
|
UpdateTime = needConfirmEdUserType.SystemDocument.UpdateTime,
|
|
|
|
|
//IsConfirmed = confirm.ConfirmTime != null,
|
|
|
|
|
// Id = needConfirmEdUserType.SystemDocument.Id,
|
|
|
|
|
// CreateTime = needConfirmEdUserType.SystemDocument.CreateTime,
|
|
|
|
|
// IsDeleted = needConfirmEdUserType.SystemDocument.IsDeleted,
|
|
|
|
|
// SignViewMinimumMinutes = needConfirmEdUserType.SystemDocument.SignViewMinimumMinutes,
|
|
|
|
|
// Name = needConfirmEdUserType.SystemDocument.Name,
|
|
|
|
|
// Path = needConfirmEdUserType.SystemDocument.Path,
|
|
|
|
|
// FileType = _userInfo.IsEn_Us ? needConfirmEdUserType.SystemDocument.FileType.Value : needConfirmEdUserType.SystemDocument.FileType.ValueCN,
|
|
|
|
|
// FileTypeId = needConfirmEdUserType.SystemDocument.FileTypeId,
|
|
|
|
|
// UpdateTime = needConfirmEdUserType.SystemDocument.UpdateTime,
|
|
|
|
|
// //IsConfirmed = confirm.ConfirmTime != null,
|
|
|
|
|
|
|
|
|
|
ConfirmUserId = confirm.ConfirmUserId,
|
|
|
|
|
ConfirmTime = confirm.ConfirmTime,
|
|
|
|
|
RealName = trialUser.UserRole.FullName,
|
|
|
|
|
UserName = trialUser.UserRole.IdentityUser.UserName,
|
|
|
|
|
UserTypeId = trialUser.UserRole.UserTypeId,
|
|
|
|
|
UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
|
|
|
|
|
// ConfirmUserId = confirm.ConfirmUserId,
|
|
|
|
|
// ConfirmTime = confirm.ConfirmTime,
|
|
|
|
|
// RealName = trialUser.UserRole.FullName,
|
|
|
|
|
// UserName = trialUser.UserRole.IdentityUser.UserName,
|
|
|
|
|
|
|
|
|
|
FullFilePath = needConfirmEdUserType.SystemDocument.Path
|
|
|
|
|
};
|
|
|
|
|
// //UserTypeId = trialUser.UserRole.UserTypeId,
|
|
|
|
|
// //UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
|
|
|
|
|
|
|
|
|
|
var unionQuery = trialDocQuery.Union(systemDocQuery).IgnoreQueryFilters().Where(t => !(t.IsDeleted == true && t.ConfirmUserId == null))
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name))
|
|
|
|
|
.WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId)
|
|
|
|
|
.WhereIf(inQuery.IsConfirmed == true, t => t.ConfirmTime != null)
|
|
|
|
|
.WhereIf(inQuery.IsConfirmed == false, t => t.ConfirmTime == null)
|
|
|
|
|
.WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted)
|
|
|
|
|
.WhereIf(inQuery.UserTypeId != null, t => t.UserTypeId == inQuery.UserTypeId);
|
|
|
|
|
// FullFilePath = needConfirmEdUserType.SystemDocument.Path
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
var result = await unionQuery.ToPagedListAsync(inQuery);
|
|
|
|
|
//var unionQuery = trialDocQuery.Union(systemDocQuery).IgnoreQueryFilters().Where(t => !(t.IsDeleted == true && t.ConfirmUserId == null))
|
|
|
|
|
// .WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name))
|
|
|
|
|
// .WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId)
|
|
|
|
|
// .WhereIf(inQuery.IsConfirmed == true, t => t.ConfirmTime != null)
|
|
|
|
|
// .WhereIf(inQuery.IsConfirmed == false, t => t.ConfirmTime == null)
|
|
|
|
|
// .WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted)
|
|
|
|
|
// /*.Distinct()*/;
|
|
|
|
|
|
|
|
|
|
var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true)
|
|
|
|
|
.Where(t => t.Trial.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId))
|
|
|
|
|
.Where(t => t.IsDeleted == false && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.UserRoleId) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
|
|
|
|
.CountAsync();
|
|
|
|
|
//var result = await unionQuery.ToPagedListAsync(inQuery);
|
|
|
|
|
|
|
|
|
|
//var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true)
|
|
|
|
|
// .Where(t => t.Trial.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId))
|
|
|
|
|
// .Where(t => t.IsDeleted == false && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
|
|
|
|
// .CountAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var needSignSystemDocCount = await _systemDocumentRepository
|
|
|
|
|
.Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.UserRoleId) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
|
|
|
|
.CountAsync();
|
|
|
|
|
//var needSignSystemDocCount = await _systemDocumentRepository
|
|
|
|
|
// .Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
|
|
|
|
// .CountAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseOutput.Ok(result, new { NeedSignCount = needSignTrialDocCount + needSignSystemDocCount, NeedSignTrialDocCount = needSignTrialDocCount, NeedSignSystemDocCount = needSignSystemDocCount, TrialStatusStr = trialInfo.TrialStatusStr });
|
|
|
|
|
//return ResponseOutput.Ok(result, new { NeedSignCount = needSignTrialDocCount + needSignSystemDocCount, NeedSignTrialDocCount = needSignTrialDocCount, NeedSignSystemDocCount = needSignSystemDocCount, TrialStatusStr = trialInfo.TrialStatusStr });
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -492,8 +746,8 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
[HttpGet("{trialId:guid}")]
|
|
|
|
|
public async Task<List<TrialUserDto>> GetTrialUserSelect(Guid trialId)
|
|
|
|
|
{
|
|
|
|
|
return await _trialUserRoleRepository.Where(t => t.TrialId == trialId)
|
|
|
|
|
.Select(t => new TrialUserDto() { UserId = t.UserId, RealName = t.UserRole.FullName, UserName = t.UserRole.IdentityUser.UserName })
|
|
|
|
|
return await _trialIdentityUserRepository.Where(t => t.TrialId == trialId)
|
|
|
|
|
.Select(t => new TrialUserDto() { UserId = t.IdentityUserId, RealName = t.IdentityUser.FullName, UserName = t.IdentityUser.UserName })
|
|
|
|
|
.ToListAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -513,7 +767,7 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
return ResponseOutput.Ok(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TrialGlobalLimit( "BeforeOngoingCantOpt", "AfterStopCannNotOpt" )]
|
|
|
|
|
[TrialGlobalLimit("BeforeOngoingCantOpt", "AfterStopCannNotOpt")]
|
|
|
|
|
//[Authorize(Policy = IRaCISPolicy.PM)]
|
|
|
|
|
public async Task<IResponseOutput> AddOrUpdateTrialDocument(AddOrEditTrialDocument addOrEditTrialDocument)
|
|
|
|
|
{
|
|
|
|
@@ -585,7 +839,7 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpDelete("{trialId:guid}/{trialDocumentId:guid}")]
|
|
|
|
|
//[Authorize(Policy = IRaCISPolicy.PM)]
|
|
|
|
|
[TrialGlobalLimit( "BeforeOngoingCantOpt", "AfterStopCannNotOpt" )]
|
|
|
|
|
[TrialGlobalLimit("BeforeOngoingCantOpt", "AfterStopCannNotOpt")]
|
|
|
|
|
public async Task<IResponseOutput> DeleteTrialDocument(Guid trialDocumentId, Guid trialId)
|
|
|
|
|
{
|
|
|
|
|
if (await _trialDocumentRepository.AsQueryable(true).Where(t => t.Id == trialDocumentId).AnyAsync(t => t.TrialDocConfirmedUserList.Any()))
|
|
|
|
@@ -616,7 +870,7 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
{
|
|
|
|
|
if (!await _systemDocConfirmedUserRepository.AnyAsync(t => t.SystemDocumentId == documentId && t.ConfirmUserId == _userInfo.UserRoleId))
|
|
|
|
|
{
|
|
|
|
|
await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.UserRoleId, SignFirstViewTime = DateTime.Now });
|
|
|
|
|
await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedIdentityUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.UserRoleId, SignFirstViewTime = DateTime.Now });
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -624,10 +878,10 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (!await _trialDocUserTypeConfirmedUserRepository.AnyAsync(t => t.TrialDocumentId == documentId && t.ConfirmUserId == _userInfo.UserRoleId))
|
|
|
|
|
if (!await _trialDocConfirmedUserRepository.AnyAsync(t => t.TrialDocumentId == documentId && t.ConfirmUserId == _userInfo.UserRoleId))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
await _trialDocConfirmedUserRepository.AddAsync(new TrialDocConfirmedUser() { TrialDocumentId = documentId, ConfirmUserId = _userInfo.UserRoleId, SignFirstViewTime = DateTime.Now });
|
|
|
|
|
await _trialDocConfirmedUserRepository.AddAsync(new TrialDocConfirmedIdentityUser() { TrialDocumentId = documentId, ConfirmUserId = _userInfo.UserRoleId, SignFirstViewTime = DateTime.Now });
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -644,7 +898,7 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
{
|
|
|
|
|
if (!await _systemDocConfirmedUserRepository.AnyAsync(t => t.SystemDocumentId == documentId && t.ConfirmUserId == _userInfo.UserRoleId))
|
|
|
|
|
{
|
|
|
|
|
await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.UserRoleId, SignFirstViewTime = DateTime.Now });
|
|
|
|
|
await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedIdentityUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.UserRoleId, SignFirstViewTime = DateTime.Now });
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -656,10 +910,10 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
[HttpPut("{trialId:guid}/{documentId:guid}")]
|
|
|
|
|
public async Task<IResponseOutput> SetTrialDocFirstViewTime(Guid documentId)
|
|
|
|
|
{
|
|
|
|
|
if (!await _trialDocUserTypeConfirmedUserRepository.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 TrialDocConfirmedUser() { TrialDocumentId = documentId, ConfirmUserId = _userInfo.UserRoleId, SignFirstViewTime = DateTime.Now });
|
|
|
|
|
await _trialDocConfirmedUserRepository.AddAsync(new TrialDocConfirmedIdentityUser() { TrialDocumentId = documentId, ConfirmUserId = _userInfo.UserRoleId, SignFirstViewTime = DateTime.Now });
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
var success = await _trialDocConfirmedUserRepository.SaveChangesAsync();
|
|
|
|
@@ -671,7 +925,7 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
/// 用户 签名某个文档 可能是系统的,也可能是项目的
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[TrialGlobalLimit( "BeforeOngoingCantOpt", "AfterStopCannNotOpt" )]
|
|
|
|
|
[TrialGlobalLimit("BeforeOngoingCantOpt", "AfterStopCannNotOpt")]
|
|
|
|
|
public async Task<IResponseOutput> UserConfirm(UserConfirmCommand userConfirmCommand)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
@@ -705,7 +959,7 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var trialDocConfirm = await _trialDocUserTypeConfirmedUserRepository.FirstOrDefaultAsync(t => t.TrialDocumentId == userConfirmCommand.DocumentId && t.ConfirmUserId == _userInfo.UserRoleId, true);
|
|
|
|
|
var trialDocConfirm = await _trialDocConfirmedUserRepository.FirstOrDefaultAsync(t => t.TrialDocumentId == userConfirmCommand.DocumentId && t.ConfirmUserId == _userInfo.IdentityUserId, true);
|
|
|
|
|
|
|
|
|
|
if (trialDocConfirm.ConfirmTime != null)
|
|
|
|
|
{
|
|
|
|
@@ -722,7 +976,7 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
trialDocConfirm.ConfirmTime = DateTime.Now;
|
|
|
|
|
trialDocConfirm.SignText = userConfirmCommand.SignText;
|
|
|
|
|
|
|
|
|
|
await _trialDocUserTypeConfirmedUserRepository.SaveChangesAsync();
|
|
|
|
|
await _trialDocConfirmedUserRepository.SaveChangesAsync();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -738,13 +992,13 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
/// <param name="isSystemDoc"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPut("{documentId:guid}/{isSystemDoc:bool}")]
|
|
|
|
|
[TrialGlobalLimit( "BeforeOngoingCantOpt", "AfterStopCannNotOpt", "SignSystemDocNoTrialId" )]
|
|
|
|
|
[TrialGlobalLimit("BeforeOngoingCantOpt", "AfterStopCannNotOpt", "SignSystemDocNoTrialId")]
|
|
|
|
|
public async Task<IResponseOutput> UserAbandonDoc(Guid documentId, bool isSystemDoc)
|
|
|
|
|
{
|
|
|
|
|
if (isSystemDoc)
|
|
|
|
|
{
|
|
|
|
|
await _systemDocumentRepository.UpdatePartialFromQueryAsync(documentId, u => new SystemDocument() { IsDeleted = true });
|
|
|
|
|
await _systemDocConfirmedUserRepository.UpdatePartialFromQueryAsync(x => x.SystemDocumentId == documentId, x => new SystemDocConfirmedUser()
|
|
|
|
|
await _systemDocConfirmedUserRepository.UpdatePartialFromQueryAsync(x => x.SystemDocumentId == documentId, x => new SystemDocConfirmedIdentityUser()
|
|
|
|
|
{
|
|
|
|
|
IsDeleted = true
|
|
|
|
|
});
|
|
|
|
@@ -752,7 +1006,7 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
await _trialDocumentRepository.UpdatePartialFromQueryAsync(documentId, u => new TrialDocument() { IsDeleted = true });
|
|
|
|
|
await _trialDocUserTypeConfirmedUserRepository.UpdatePartialFromQueryAsync(x => x.TrialDocumentId == documentId, x => new TrialDocConfirmedUser()
|
|
|
|
|
await _trialDocConfirmedUserRepository.UpdatePartialFromQueryAsync(x => x.TrialDocumentId == documentId, x => new TrialDocConfirmedIdentityUser()
|
|
|
|
|
{
|
|
|
|
|
IsDeleted = true
|
|
|
|
|
});
|
|
|
|
@@ -762,93 +1016,8 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 废弃
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 从项目下参与者的维度 先看人员列表(展示统计数字) 点击数字 再看人员具体签署的 系统文档+项目文档(共用上面与人相关的具体文档列表)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="trialId"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("{trialId:guid}")]
|
|
|
|
|
[Obsolete]
|
|
|
|
|
public List<TrialUserUnionDocumentView> GetTrialUserDocumentList(Guid trialId)
|
|
|
|
|
{
|
|
|
|
|
var query = _trialUserRoleRepository.Where(t => t.TrialId == trialId)
|
|
|
|
|
.Select(t => new TrialUserUnionDocumentView()
|
|
|
|
|
{
|
|
|
|
|
UserId = t.UserId,
|
|
|
|
|
UserName = t.UserRole.IdentityUser.UserName,
|
|
|
|
|
RealName = t.UserRole.FullName,
|
|
|
|
|
UserTypeShortName = t.UserRole.UserTypeRole.UserTypeShortName,
|
|
|
|
|
TrialDocumentCount = t.Trial.TrialDocumentList.Count(u => u.NeedConfirmedUserTypeList.Any(k => k.NeedConfirmUserTypeId == t.UserRole.UserTypeId)),
|
|
|
|
|
TrialDocumentConfirmedCount = t.Trial.TrialDocumentList.SelectMany(u => u.TrialDocConfirmedUserList).Count(k => k.ConfirmUserId == t.UserId),
|
|
|
|
|
SystemDocumentConfirmedCount = t.UserRole.SystemDocConfirmedList.Count(),
|
|
|
|
|
//这样写不行
|
|
|
|
|
//SystemDocumentCount = _systemDocumentRepository.Where(s => s.NeedConfirmedUserTypeList.Any(kk => kk.NeedConfirmUserTypeId == t.User.UserTypeId))
|
|
|
|
|
// .WhereIf(!_userInfo.IsAdmin, s => s.IsAbandon == false || (s.IsAbandon == true && s.SystemDocConfirmedUserList.Any(uu => uu.ConfirmUserId == t.UserId))).Count()
|
|
|
|
|
SystemDocumentCount = t.UserRole.UserTypeRole.SystemDocNeedConfirmedUserTypeList.Where(cc => cc.NeedConfirmUserTypeId == t.UserRole.UserTypeId).Select(y => y.SystemDocument).Count()
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return query.ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 从 文档的维度 先看到文档列表(系统文档+项目文档 以及需要确认的人数 和已经确认人数) 点击数字查看某文档下面人确认情况
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="inQuery"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
[Obsolete]
|
|
|
|
|
public async Task<PageOutput<DocumentUnionWithUserStatView>> GetTrialSystemDocumentList(DocumentTrialUnionQuery inQuery)
|
|
|
|
|
{
|
|
|
|
|
var systemDocumentQueryable = _systemDocumentRepository
|
|
|
|
|
.WhereIf(!_userInfo.IsAdmin, t => t.IsDeleted == false)
|
|
|
|
|
.Select(t => new DocumentUnionWithUserStatView()
|
|
|
|
|
{
|
|
|
|
|
Id = t.Id,
|
|
|
|
|
IsSystemDoc = true,
|
|
|
|
|
CreateTime = t.CreateTime,
|
|
|
|
|
FullFilePath = t.Path,
|
|
|
|
|
IsDeleted = t.IsDeleted,
|
|
|
|
|
Name = t.Name,
|
|
|
|
|
Path = t.Path,
|
|
|
|
|
FileType = t.FileType.Value,
|
|
|
|
|
UpdateTime = t.UpdateTime,
|
|
|
|
|
SignViewMinimumMinutes = t.SignViewMinimumMinutes,
|
|
|
|
|
DocumentConfirmedUserCount = t.SystemDocConfirmedUserList.Count(),
|
|
|
|
|
|
|
|
|
|
//DocumentUserCount= _trialUserRoleRepository.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.UserRoleTrials.Where(r => r.TrialId == inQuery.TrialId))).Count()
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var trialDocQueryable = _trialDocumentRepository.Where(t => t.TrialId == inQuery.TrialId).Select(t => new DocumentUnionWithUserStatView()
|
|
|
|
|
{
|
|
|
|
|
Id = t.Id,
|
|
|
|
|
IsSystemDoc = false,
|
|
|
|
|
CreateTime = t.CreateTime,
|
|
|
|
|
FullFilePath = t.Path,
|
|
|
|
|
IsDeleted = t.IsDeleted,
|
|
|
|
|
Name = t.Name,
|
|
|
|
|
Path = t.Path,
|
|
|
|
|
FileType = t.FileType.Value,
|
|
|
|
|
UpdateTime = t.UpdateTime,
|
|
|
|
|
SignViewMinimumMinutes = t.SignViewMinimumMinutes,
|
|
|
|
|
|
|
|
|
|
DocumentConfirmedUserCount = t.TrialDocConfirmedUserList.Count(),
|
|
|
|
|
DocumentUserCount = t.Trial.TrialUserRoleList.Count(cc => t.NeedConfirmedUserTypeList.Any(k => k.NeedConfirmUserTypeId == cc.UserRole.UserTypeId))
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var unionQuery = systemDocumentQueryable.Union(trialDocQueryable)
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name))
|
|
|
|
|
.WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId);
|
|
|
|
|
|
|
|
|
|
return await unionQuery.ToPagedListAsync(inQuery);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|