IsAbandon->IsDeleted

This commit is contained in:
2022-04-08 10:41:15 +08:00
parent 10bc94f9fd
commit 7aa3d7acdf
15 changed files with 159 additions and 107 deletions
@@ -29,6 +29,8 @@ namespace IRaCIS.Core.Application.Contracts
public bool IsSystemDoc { get; set; }
public string FileType { get; set; } = string.Empty;
}
@@ -89,7 +91,7 @@ namespace IRaCIS.Core.Application.Contracts
public Guid? SystemDocumentId { get; set; }
public string Type { get; set; } = string.Empty;
public Guid? FileTypeId { get; set; }
public string Name { get; set; } = string.Empty;
@@ -101,7 +103,7 @@ namespace IRaCIS.Core.Application.Contracts
[NotDefault]
public Guid TrialId { get; set; }
public string Type { get; set; } = string.Empty;
public Guid? FileTypeId { get; set; }
public string Name { get; set; } = string.Empty;
@@ -139,11 +141,11 @@ namespace IRaCIS.Core.Application.Contracts
public class SystemDocumentAddOrEdit
{
public Guid? Id { get; set; }
public string Type { get; set; } = string.Empty;
public Guid FileTypeId { get; set; }
public string Name { get; set; } = string.Empty;
public string Path { get; set; } = string.Empty;
public bool IsAbandon { get; set; }
public bool IsDeleted { get; set; }
public int SignViewMinimumMinutes { get; set; }
@@ -31,8 +31,8 @@ namespace IRaCIS.Core.Application.Contracts
///<summary>TrialDocumentQuery 列表查询参数模型</summary>
public class TrialDocumentQuery : PageInput
{
public string Type { get; set; } = String.Empty;
public Guid? FileTypeId { get; set; }
public string Name { get; set; } = String.Empty;
@@ -47,12 +47,12 @@ namespace IRaCIS.Core.Application.Contracts
public Guid? Id { get; set; }
public Guid TrialId { get; set; }
public string Type { get; set; } = String.Empty;
public Guid FileTypeId { get; set; }
public string Name { get; set; } = String.Empty;
public string Path { get; set; } = String.Empty;
public string Description { get; set; } = String.Empty;
public bool IsAbandon { get; set; }
public bool IsDeleted { get; set; }
public int SignViewMinimumMinutes { get; set; }
@@ -39,9 +39,9 @@ namespace IRaCIS.Core.Application.Services
[HttpPost]
public async Task<PageOutput<SystemDocumentView>> GetSystemDocumentListAsync(SystemDocumentQuery querySystemDocument)
{
var systemDocumentQueryable = _systemDocumentRepository
var systemDocumentQueryable = _systemDocumentRepository.AsQueryable(true)
.WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name))
.WhereIf(!string.IsNullOrEmpty(querySystemDocument.Type), t => t.Type.Contains(querySystemDocument.Type))
.WhereIf(querySystemDocument.FileTypeId != null, t => t.FileTypeId == querySystemDocument.FileTypeId)
.ProjectTo<SystemDocumentView>(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.Id });
return await systemDocumentQueryable.ToPagedListAsync(querySystemDocument.PageIndex, querySystemDocument.PageSize, querySystemDocument.SortField, querySystemDocument.Asc);
@@ -54,7 +54,7 @@ namespace IRaCIS.Core.Application.Services
var entity = _mapper.Map<SystemDocument>(addOrEditSystemDocument);
if (await _systemDocumentRepository.AnyAsync(t => t.Type == addOrEditSystemDocument.Type && t.Name == addOrEditSystemDocument.Name))
if (await _systemDocumentRepository.AnyAsync(t => t.FileTypeId == addOrEditSystemDocument.FileTypeId && t.Name == addOrEditSystemDocument.Name,true))
{
return ResponseOutput.NotOk("同类型已存在该文件名");
}
@@ -66,24 +66,24 @@ namespace IRaCIS.Core.Application.Services
}
else
{
var document = await _systemDocumentRepository.Where(t => t.Id == addOrEditSystemDocument.Id, true).Include(t => t.NeedConfirmedUserTypeList).FirstOrDefaultAsync();
var document = await _systemDocumentRepository.Where(t => t.Id == addOrEditSystemDocument.Id, true,true).Include(t => t.NeedConfirmedUserTypeList).FirstOrDefaultAsync();
if (document == null) return Null404NotFound(document);
if (await _systemDocumentRepository.AnyAsync(t => t.Type == addOrEditSystemDocument.Type && t.Name == addOrEditSystemDocument.Name && t.Id != addOrEditSystemDocument.Id))
if (await _systemDocumentRepository.AnyAsync(t => t.FileTypeId == addOrEditSystemDocument.FileTypeId && t.Name == addOrEditSystemDocument.Name && t.Id != addOrEditSystemDocument.Id,true))
{
return ResponseOutput.NotOk("同类型已存在该文件名");
}
var dbDocumentType = document.Type;
_mapper.Map(addOrEditSystemDocument, document);
if (dbDocumentType != addOrEditSystemDocument.Type)
if (document.FileTypeId != addOrEditSystemDocument.FileTypeId)
{
var rootPath = Directory.GetParent(_hostEnvironment.ContentRootPath.TrimEnd('\\')).IfNullThrowException().FullName;
var beforeFilePath = Path.Combine(rootPath, document.Path);
document.Path = document.Path.Replace(dbDocumentType, addOrEditSystemDocument.Type);
document.Path = document.Path.Replace(document.FileTypeId.ToString(), addOrEditSystemDocument.FileTypeId.ToString());
var nowPath = Path.Combine(rootPath, document.Path);
@@ -128,7 +128,7 @@ namespace IRaCIS.Core.Application.Services
{
var query = from sysDoc in _systemDocumentRepository.Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
var query = from sysDoc in _systemDocumentRepository.Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId),true)
join confirm in _repository.GetQueryable<SystemDocConfirmedUser>() on new { ConfirmUserId = _userInfo.Id, SystemDocumentId = sysDoc.Id } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
from confirm in cc.DefaultIfEmpty()
@@ -141,11 +141,11 @@ namespace IRaCIS.Core.Application.Services
Id = sysDoc.Id,
CreateTime = sysDoc.CreateTime,
IsAbandon = sysDoc.IsAbandon,
IsDeleted = sysDoc.IsDeleted,
SignViewMinimumMinutes = sysDoc.SignViewMinimumMinutes,
Name = sysDoc.Name,
Path = sysDoc.Path,
Type = sysDoc.Type,
FileType = sysDoc.FileType.Value,
UpdateTime = sysDoc.UpdateTime,
FullFilePath = sysDoc.Path + "?access_token=" + _userInfo.UserToken,
@@ -24,13 +24,15 @@ namespace IRaCIS.Core.Application.Services
private readonly IWebHostEnvironment _hostEnvironment;
private readonly IRepository<TrialDocument> _trialDocumentRepository;
private readonly IRepository<SystemDocConfirmedUser> _systemDocConfirmedUserRepository;
private readonly IRepository<SystemDocument> _systemDocumentRepository;
public TrialDocumentService(IWebHostEnvironment hostEnvironment, IRepository<TrialDocument> trialDocumentRepository
, IRepository<SystemDocConfirmedUser> systemDocConfirmedUserRepository)
, IRepository<SystemDocConfirmedUser> systemDocConfirmedUserRepository,IRepository<SystemDocument> systemDocumentRepository)
{
_hostEnvironment = hostEnvironment;
this._trialDocumentRepository = trialDocumentRepository;
this._systemDocConfirmedUserRepository = systemDocConfirmedUserRepository;
_trialDocumentRepository = trialDocumentRepository;
_systemDocConfirmedUserRepository = systemDocConfirmedUserRepository;
_systemDocumentRepository = systemDocumentRepository;
}
/// <summary>
@@ -42,9 +44,9 @@ namespace IRaCIS.Core.Application.Services
public async Task<PageOutput<TrialDocumentView>> GetTrialDocumentList(TrialDocumentQuery queryTrialDocument)
{
var trialDocumentQueryable = _trialDocumentRepository.Where(t => t.TrialId == queryTrialDocument.TrialId)
var trialDocumentQueryable = _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == queryTrialDocument.TrialId)
.WhereIf(!string.IsNullOrEmpty(queryTrialDocument.Name), t => t.Name.Contains(queryTrialDocument.Name))
.WhereIf(!string.IsNullOrEmpty(queryTrialDocument.Type), t => t.Type.Contains(queryTrialDocument.Type))
.WhereIf(queryTrialDocument.FileTypeId!=null, t => t.FileTypeId==queryTrialDocument.FileTypeId)
.ProjectTo<TrialDocumentView>(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken });
return await trialDocumentQueryable.ToPagedListAsync(queryTrialDocument.PageIndex, queryTrialDocument.PageSize, queryTrialDocument.SortField, queryTrialDocument.Asc);
@@ -126,7 +128,7 @@ namespace IRaCIS.Core.Application.Services
var systemDocumentQueryable = from needConfirmedUserType in _repository.Where<SystemDocNeedConfirmedUserType>(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)
//.Where(u => u.UserTypeRole.UserList.SelectMany(cc => cc.UserTrials.Where(t => t.TrialId == querySystemDocument.TrialId)).Any(e => e.Trial.TrialFinishedTime < u.SystemDocument.CreateTime))
.WhereIf(trialFininshedTime != null, u => u.SystemDocument.CreateTime < trialFininshedTime)
.WhereIf(!_userInfo.IsAdmin, t => t.SystemDocument.IsAbandon == false || (t.SystemDocument.IsAbandon == true && t.SystemDocument.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id)))
.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)
on needConfirmedUserType.NeedConfirmUserTypeId equals trialUser.User.UserTypeId
@@ -138,11 +140,11 @@ namespace IRaCIS.Core.Application.Services
Id = needConfirmedUserType.SystemDocument.Id,
CreateTime = needConfirmedUserType.SystemDocument.CreateTime,
IsAbandon = needConfirmedUserType.SystemDocument.IsAbandon,
IsDeleted = needConfirmedUserType.SystemDocument.IsDeleted,
SignViewMinimumMinutes = needConfirmedUserType.SystemDocument.SignViewMinimumMinutes,
Name = needConfirmedUserType.SystemDocument.Name,
Path = needConfirmedUserType.SystemDocument.Path,
Type = needConfirmedUserType.SystemDocument.Type,
FileType = needConfirmedUserType.SystemDocument.FileType.Value,
UpdateTime = needConfirmedUserType.SystemDocument.UpdateTime,
FullFilePath = needConfirmedUserType.SystemDocument.Path + "?access_token=" + _userInfo.UserToken,
@@ -155,9 +157,9 @@ namespace IRaCIS.Core.Application.Services
};
//项目文档查询
var trialDocQueryable = from trialDoc in _trialDocumentRepository.Where(t => t.TrialId == querySystemDocument.TrialId)
var trialDocQueryable = from trialDoc in _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == querySystemDocument.TrialId)
.WhereIf(!_userInfo.IsAdmin, t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
.WhereIf(!_userInfo.IsAdmin, t => t.IsAbandon == false || (t.IsAbandon == true && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id)))
.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<TrialDocUserTypeConfirmedUser>(t => t.TrialDocument.TrialId == querySystemDocument.TrialId) on
@@ -169,10 +171,10 @@ namespace IRaCIS.Core.Application.Services
IsSystemDoc = false,
CreateTime = trialDoc.CreateTime,
FullFilePath = trialDoc.Path + "?access_token=" + _userInfo.UserToken,
IsAbandon = trialDoc.IsAbandon,
IsDeleted = trialDoc.IsDeleted,
Name = trialDoc.Name,
Path = trialDoc.Path,
Type = trialDoc.Type,
FileType = trialDoc.FileType.Value,
UpdateTime = trialDoc.UpdateTime,
SignViewMinimumMinutes = trialDoc.SignViewMinimumMinutes,
@@ -188,7 +190,7 @@ namespace IRaCIS.Core.Application.Services
var unionQuery = systemDocumentQueryable.Union(trialDocQueryable)
.WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name))
.WhereIf(!string.IsNullOrEmpty(querySystemDocument.Type), t => t.Type.Contains(querySystemDocument.Type));
.WhereIf(querySystemDocument.FileTypeId!=null, t => t.FileTypeId==querySystemDocument.FileTypeId);
return await unionQuery.ToPagedListAsync(querySystemDocument.PageIndex, querySystemDocument.PageSize, querySystemDocument.SortField, querySystemDocument.Asc);
}
@@ -208,7 +210,7 @@ namespace IRaCIS.Core.Application.Services
var systemDocumentQueryable = from needConfirmedUserType in _repository.Where<SystemDocNeedConfirmedUserType>(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)
//.Where(u => u.UserTypeRole.UserList.SelectMany(cc => cc.UserTrials.Where(t => t.TrialId == querySystemDocument.TrialId)).Any(e => e.Trial.TrialFinishedTime < u.SystemDocument.CreateTime))
.WhereIf(trialFininshedTime != null, u => u.SystemDocument.CreateTime < trialFininshedTime)
.WhereIf(!_userInfo.IsAdmin, t => t.SystemDocument.IsAbandon == false || (t.SystemDocument.IsAbandon == true && t.SystemDocument.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id)))
.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 == trialId && t.UserId == _userInfo.Id)
on needConfirmedUserType.NeedConfirmUserTypeId equals trialUser.User.UserTypeId
@@ -223,7 +225,7 @@ namespace IRaCIS.Core.Application.Services
//项目文档查询
var trialDocQueryable = from trialDoc in _trialDocumentRepository.Where(t => t.TrialId == trialId)
.WhereIf(!_userInfo.IsAdmin, t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
.WhereIf(!_userInfo.IsAdmin, t => t.IsAbandon == false || (t.IsAbandon == true && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id)))
.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 == trialId && t.UserId == _userInfo.Id) on trialDoc.TrialId equals trialUser.TrialId
join confirm in _repository.Where<TrialDocUserTypeConfirmedUser>(t => t.TrialDocument.TrialId == trialId) on
@@ -303,11 +305,11 @@ namespace IRaCIS.Core.Application.Services
Id = trialDocumentNeedConfirmedUserType.TrialDocument.Id,
CreateTime = trialDocumentNeedConfirmedUserType.TrialDocument.CreateTime,
IsAbandon = trialDocumentNeedConfirmedUserType.TrialDocument.IsAbandon,
IsDeleted = trialDocumentNeedConfirmedUserType.TrialDocument.IsDeleted,
SignViewMinimumMinutes = trialDocumentNeedConfirmedUserType.TrialDocument.SignViewMinimumMinutes,
Name = trialDocumentNeedConfirmedUserType.TrialDocument.Name,
Path = trialDocumentNeedConfirmedUserType.TrialDocument.Path,
Type = trialDocumentNeedConfirmedUserType.TrialDocument.Type,
FileType = trialDocumentNeedConfirmedUserType.TrialDocument.FileType.Value,
UpdateTime = trialDocumentNeedConfirmedUserType.TrialDocument.UpdateTime,
@@ -336,11 +338,11 @@ namespace IRaCIS.Core.Application.Services
Id = needConfirmEdUserType.SystemDocument.Id,
CreateTime = needConfirmEdUserType.SystemDocument.CreateTime,
IsAbandon = needConfirmEdUserType.SystemDocument.IsAbandon,
IsDeleted = needConfirmEdUserType.SystemDocument.IsDeleted,
SignViewMinimumMinutes = needConfirmEdUserType.SystemDocument.SignViewMinimumMinutes,
Name = needConfirmEdUserType.SystemDocument.Name,
Path = needConfirmEdUserType.SystemDocument.Path,
Type = needConfirmEdUserType.SystemDocument.Type,
FileType = needConfirmEdUserType.SystemDocument.FileType.Value,
UpdateTime = needConfirmEdUserType.SystemDocument.UpdateTime,
@@ -355,7 +357,7 @@ namespace IRaCIS.Core.Application.Services
var unionQuery = trialDocQuery.Union(systemDocQuery)
.WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name))
.WhereIf(!string.IsNullOrEmpty(querySystemDocument.Type), t => t.Type.Contains(querySystemDocument.Type));
.WhereIf(querySystemDocument.FileTypeId!=null, t => t.FileTypeId==querySystemDocument.FileTypeId);
return await unionQuery.ToPagedListAsync(querySystemDocument.PageIndex, querySystemDocument.PageSize, querySystemDocument.SortField, querySystemDocument.Asc);
}
@@ -383,8 +385,8 @@ namespace IRaCIS.Core.Application.Services
[HttpGet("{trialId:guid}")]
public async Task<List<string>> GetTrialDocAndSystemDocType(Guid trialId)
{
return await _trialDocumentRepository.Where(t => t.TrialId == trialId).Select(t => t.Type)
.Union(_repository.GetQueryable<SystemDocument>().Select(t => t.Type)).Distinct()
return await _trialDocumentRepository.Where(t => t.TrialId == trialId).Select(t => t.FileType.Value)
.Union(_repository.GetQueryable<SystemDocument>().Select(t => t.FileType.Value)).Distinct()
.ToListAsync();
}
@@ -395,7 +397,7 @@ namespace IRaCIS.Core.Application.Services
var entity = _mapper.Map<TrialDocument>(addOrEditTrialDocument);
if (await _trialDocumentRepository.AnyAsync(t => t.Type == addOrEditTrialDocument.Type && t.Name == addOrEditTrialDocument.Name && t.TrialId == addOrEditTrialDocument.TrialId))
if (await _trialDocumentRepository.AnyAsync(t => t.FileTypeId == addOrEditTrialDocument.FileTypeId && t.Name == addOrEditTrialDocument.Name && t.TrialId == addOrEditTrialDocument.TrialId,true))
{
return ResponseOutput.NotOk("同类型已存在该文件名");
}
@@ -405,7 +407,7 @@ namespace IRaCIS.Core.Application.Services
}
else
{
if (await _trialDocumentRepository.AnyAsync(t => t.Type == addOrEditTrialDocument.Type && t.Name == addOrEditTrialDocument.Name && t.Id != addOrEditTrialDocument.Id && t.TrialId == addOrEditTrialDocument.TrialId))
if (await _trialDocumentRepository.AnyAsync(t => t.FileTypeId == addOrEditTrialDocument.FileTypeId && t.Name == addOrEditTrialDocument.Name && t.Id != addOrEditTrialDocument.Id && t.TrialId == addOrEditTrialDocument.TrialId,true))
{
return ResponseOutput.NotOk("同类型已存在该文件名");
}
@@ -414,18 +416,18 @@ namespace IRaCIS.Core.Application.Services
if (document == null) return Null404NotFound(document);
var dbDocumentType = document.Type;
//var dbDocumentType = document.Type;
_mapper.Map(addOrEditTrialDocument, document);
if (dbDocumentType != addOrEditTrialDocument.Type)
if (document.FileTypeId != addOrEditTrialDocument.FileTypeId)
{
var rootPath = Directory.GetParent(_hostEnvironment.ContentRootPath.TrimEnd('\\')).IfNullThrowException().FullName;
var beforeFilePath = Path.Combine(rootPath, document.Path);
document.Path = document.Path.Replace(dbDocumentType, addOrEditTrialDocument.Type);
document.Path = document.Path.Replace(document.FileTypeId.ToString(), addOrEditTrialDocument.FileTypeId.ToString());
var nowPath = Path.Combine(rootPath, document.Path);
@@ -453,7 +455,7 @@ namespace IRaCIS.Core.Application.Services
[HttpDelete("{trialId:guid}/{trialDocumentId:guid}")]
public async Task<IResponseOutput> DeleteTrialDocument(Guid trialDocumentId, Guid trialId)
{
if (await _trialDocumentRepository.Where(t => t.Id == trialDocumentId).AnyAsync(t => t.TrialDocConfirmedUserList.Any()))
if (await _trialDocumentRepository.AsQueryable(true).Where(t => t.Id == trialDocumentId).AnyAsync(t => t.TrialDocConfirmedUserList.Any()))
{
return ResponseOutput.NotOk("该文档,已有用户签名 不允许删除");
}
@@ -479,14 +481,12 @@ namespace IRaCIS.Core.Application.Services
if (isSystemDoc)
{
await _repository.AddAsync(new SystemDocConfirmedUser() { SystemDocumentId = documentId, SignFirstViewTime = DateTime.Now });
//success = await _repository.UpdateFromQueryAsync<SystemDocConfirmedUser>(t => t.Id == documentId, d => new SystemDocConfirmedUser() { SignFirstViewTime = DateTime.Now });
}
else
{
await _repository.AddAsync(new TrialDocUserTypeConfirmedUser() { TrialDocumentId = documentId, SignFirstViewTime = DateTime.Now });
//success = await _repository.UpdateFromQueryAsync<TrialDocUserTypeConfirmedUser>(t => t.Id == documentId , d => new TrialDocUserTypeConfirmedUser() { SignFirstViewTime = DateTime.Now });
}
success= await _repository.SaveChangesAsync();
@@ -519,7 +519,7 @@ namespace IRaCIS.Core.Application.Services
{
return ResponseOutput.NotOk("该文档已经签名");
}
if (!await _repository.AnyAsync<SystemDocument>(t => t.Id == userConfirmCommand.DocumentId) || await _trialDocumentRepository.AnyAsync(t => t.Id == userConfirmCommand.DocumentId && t.IsAbandon))
if (!await _systemDocumentRepository.AnyAsync(t => t.Id == userConfirmCommand.DocumentId) || await _trialDocumentRepository.AnyAsync(t => t.Id == userConfirmCommand.DocumentId && t.IsDeleted,true))
{
return ResponseOutput.NotOk("文件已删除或者废除,签署失败!");
}
@@ -533,7 +533,7 @@ namespace IRaCIS.Core.Application.Services
return ResponseOutput.NotOk("该文档已经签名");
}
if (!await _trialDocumentRepository.AnyAsync(t => t.Id == userConfirmCommand.DocumentId) || await _repository.AnyAsync<TrialDocument>(t => t.Id == userConfirmCommand.DocumentId && t.IsAbandon))
if (!await _trialDocumentRepository.AnyAsync(t => t.Id == userConfirmCommand.DocumentId) || await _repository.AnyAsync<TrialDocument>(t => t.Id == userConfirmCommand.DocumentId && t.IsDeleted,true))
{
return ResponseOutput.NotOk("文件已删除或者废除,签署失败!");
}
@@ -558,11 +558,11 @@ namespace IRaCIS.Core.Application.Services
{
if (isSystemDoc)
{
await _repository.UpdateFromQueryAsync<SystemDocument>(t => t.Id == documentId, u => new SystemDocument() { IsAbandon = true });
await _repository.UpdateFromQueryAsync<SystemDocument>(t => t.Id == documentId, u => new SystemDocument() { IsDeleted = true });
}
else
{
await _trialDocumentRepository.UpdateFromQueryAsync(t => t.Id == documentId, u => new TrialDocument() { IsAbandon = true });
await _trialDocumentRepository.UpdateFromQueryAsync(t => t.Id == documentId, u => new TrialDocument() { IsDeleted = true });
}
return ResponseOutput.Ok();
}
@@ -606,17 +606,17 @@ namespace IRaCIS.Core.Application.Services
public PageOutput<DocumentUnionWithUserStatView> GetTrialSystemDocumentList(DocumentTrialUnionQuery querySystemDocument)
{
var systemDocumentQueryable = _repository
.WhereIf<SystemDocument>(!_userInfo.IsAdmin, t => t.IsAbandon == false)
.WhereIf<SystemDocument>(!_userInfo.IsAdmin, t => t.IsDeleted == false)
.Select(t => new DocumentUnionWithUserStatView()
{
Id = t.Id,
IsSystemDoc = true,
CreateTime = t.CreateTime,
FullFilePath = t.Path + "?access_token=" + _userInfo.UserToken,
IsAbandon = t.IsAbandon,
IsDeleted = t.IsDeleted,
Name = t.Name,
Path = t.Path,
Type = t.Type,
FileType = t.FileType.Value,
UpdateTime = t.UpdateTime,
SignViewMinimumMinutes = t.SignViewMinimumMinutes,
DocumentConfirmedUserCount = t.SystemDocConfirmedUserList.Count(),
@@ -631,10 +631,10 @@ namespace IRaCIS.Core.Application.Services
IsSystemDoc = false,
CreateTime = t.CreateTime,
FullFilePath = t.Path + "?access_token=" + _userInfo.UserToken,
IsAbandon = t.IsAbandon,
IsDeleted = t.IsDeleted,
Name = t.Name,
Path = t.Path,
Type = t.Type,
FileType = t.FileType.Value,
UpdateTime = t.UpdateTime,
SignViewMinimumMinutes = t.SignViewMinimumMinutes,
@@ -645,7 +645,7 @@ namespace IRaCIS.Core.Application.Services
var unionQuery = systemDocumentQueryable.Union(trialDocQueryable)
.WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name))
.WhereIf(!string.IsNullOrEmpty(querySystemDocument.Type), t => t.Type.Contains(querySystemDocument.Type));
.WhereIf(querySystemDocument.FileTypeId!=null, t => t.FileTypeId==querySystemDocument.FileTypeId);
return unionQuery.ToPagedList(querySystemDocument.PageIndex, querySystemDocument.PageSize, querySystemDocument.SortField, querySystemDocument.Asc);
}