|
|
|
@@ -19,6 +19,7 @@ using MassTransit;
|
|
|
|
|
using NPOI.POIFS.Properties;
|
|
|
|
|
using Org.BouncyCastle.Crypto;
|
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
using IRaCIS.Core.Application.Contracts;
|
|
|
|
|
namespace IRaCIS.Core.Application.Service;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -27,37 +28,150 @@ namespace IRaCIS.Core.Application.Service;
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[ApiExplorerSettings(GroupName = "FileRecord")]
|
|
|
|
|
public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepository,
|
|
|
|
|
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer): BaseService
|
|
|
|
|
public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepository, IRepository<AuditRecord> _auditRecordRepository,
|
|
|
|
|
IRepository<AuditRecordPermission> _auditRecordPermissionRepository, IRepository<AuditRecordIdentityUser> _auditRecordIdentityUserRepository,
|
|
|
|
|
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取稽查文档
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="inQuery"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<PageOutput<AuditDocumentView>> GetAuditDocumentList(AuditDocumentQuery inQuery)
|
|
|
|
|
{
|
|
|
|
|
var auditDocumentQueryable = _auditDocumentRepository
|
|
|
|
|
.ProjectTo<AuditDocumentView>(_mapper.ConfigurationProvider);
|
|
|
|
|
var pageList = await auditDocumentQueryable.ToPagedListAsync(inQuery);
|
|
|
|
|
|
|
|
|
|
return pageList;
|
|
|
|
|
}
|
|
|
|
|
#region 稽查新增需求
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 修改稽查文档
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="inDto"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 稽查记录 列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="inQuery"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<PageOutput<AuditRecordView>> GetAuditRecordList(AuditRecordQuery inQuery)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var auditRecordQueryable = _auditRecordRepository
|
|
|
|
|
.WhereIf(inQuery.BeginAuditTime != null, t => t.AuditTime >= inQuery.BeginAuditTime)
|
|
|
|
|
.WhereIf(inQuery.EndAuditTime != null, t => t.AuditTime <= inQuery.EndAuditTime)
|
|
|
|
|
.WhereIf(inQuery.AuditState != null, t => t.AuditState == inQuery.AuditState)
|
|
|
|
|
.WhereIf(inQuery.BeginTime != null, t => t.BeginTime >= inQuery.BeginTime)
|
|
|
|
|
.WhereIf(inQuery.EndTime != null, t => t.EndTime <= inQuery.EndTime)
|
|
|
|
|
.WhereIf(inQuery.CompanyName.IsNotNullOrEmpty(), t => t.CompanyName.Contains(inQuery.CompanyName))
|
|
|
|
|
.WhereIf(inQuery.AuditContent.IsNotNullOrEmpty(), t => t.AuditContent.Contains(inQuery.AuditContent))
|
|
|
|
|
.ProjectTo<AuditRecordView>(_mapper.ConfigurationProvider);
|
|
|
|
|
|
|
|
|
|
var pageList = await auditRecordQueryable.ToPagedListAsync(inQuery);
|
|
|
|
|
|
|
|
|
|
return pageList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<IResponseOutput> AddOrUpdateAuditRecord(AuditRecordAddOrEdit addOrEditAuditRecord)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (addOrEditAuditRecord.Id == null)
|
|
|
|
|
{
|
|
|
|
|
var entity = _mapper.Map<AuditRecord>(addOrEditAuditRecord);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (await _auditRecordRepository.AnyAsync(t => t.CompanyName == addOrEditAuditRecord.CompanyName && t.AuditContent == addOrEditAuditRecord.AuditContent && t.AuditTime == addOrEditAuditRecord.AuditTime, true))
|
|
|
|
|
{
|
|
|
|
|
//---重复的稽查记录。
|
|
|
|
|
return ResponseOutput.NotOk(_localizer["AuditDocument_RepeatAuditRecord"]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await _auditRecordRepository.AddAsync(entity, true);
|
|
|
|
|
|
|
|
|
|
return ResponseOutput.Ok(entity.Id.ToString());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (await _auditRecordRepository.AnyAsync(t => t.CompanyName == addOrEditAuditRecord.CompanyName && t.AuditContent == addOrEditAuditRecord.AuditContent && t.AuditTime == addOrEditAuditRecord.AuditTime
|
|
|
|
|
&& t.Id != addOrEditAuditRecord.Id, true))
|
|
|
|
|
{
|
|
|
|
|
//---重复的稽查记录。
|
|
|
|
|
return ResponseOutput.NotOk(_localizer["AuditDocument_RepeatAuditRecord"]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var find = _auditRecordRepository.Where(t => t.Id == addOrEditAuditRecord.Id, true).FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
_mapper.Map(addOrEditAuditRecord, find);
|
|
|
|
|
find.UpdateTime = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
var success = await _auditRecordRepository.SaveChangesAsync();
|
|
|
|
|
|
|
|
|
|
return ResponseOutput.Ok(find.Id.ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除稽查记录
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="auditRecordId"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpDelete("{auditRecordId:guid}")]
|
|
|
|
|
public async Task<IResponseOutput> DeleteAuditRecord(Guid auditRecordId)
|
|
|
|
|
{
|
|
|
|
|
if (await _auditRecordRepository.Where(t => t.Id == auditRecordId).AnyAsync(u => u.AuditState != AuditState.NotStart))
|
|
|
|
|
{
|
|
|
|
|
//未开始的才允许删除
|
|
|
|
|
return ResponseOutput.NotOk(_localizer["AuditDocument_CannotDeleteStartRecod"]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var success = await _auditRecordRepository.DeleteFromQueryAsync(t => t.Id == auditRecordId, true);
|
|
|
|
|
|
|
|
|
|
return ResponseOutput.Ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置授权
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="inCommand"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<IResponseOutput> SetAuditRecordPermission(SetAuditRecordPermissionCommand inCommand)
|
|
|
|
|
{
|
|
|
|
|
if (_auditRecordPermissionRepository.Any(t => t.AuditRecordId == inCommand.AuditRecordId && t.AuditDocumentId == inCommand.AuditDocumentId))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ResponseOutput.Ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取稽查文档
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="inQuery"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<PageOutput<AuditDocumentView>> GetAuditDocumentList(AuditDocumentQuery inQuery)
|
|
|
|
|
{
|
|
|
|
|
var auditDocumentQueryable = _auditDocumentRepository
|
|
|
|
|
.ProjectTo<AuditDocumentView>(_mapper.ConfigurationProvider);
|
|
|
|
|
var pageList = await auditDocumentQueryable.ToPagedListAsync(inQuery);
|
|
|
|
|
|
|
|
|
|
return pageList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 修改稽查文档
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="inDto"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<IResponseOutput> UpdateAuditDocument(AuditDocumentUpdateDto inDto)
|
|
|
|
|
{
|
|
|
|
|
AuditDocumentAddOrEdit addOrEdit = _mapper.Map<AuditDocumentAddOrEdit>(inDto);
|
|
|
|
|
addOrEdit.IsUpdate = true;
|
|
|
|
|
AuditDocumentAddOrEdit addOrEdit = _mapper.Map<AuditDocumentAddOrEdit>(inDto);
|
|
|
|
|
addOrEdit.IsUpdate = true;
|
|
|
|
|
|
|
|
|
|
var result= await AddOrUpdateAuditDocument(addOrEdit);
|
|
|
|
|
var result = await AddOrUpdateAuditDocument(addOrEdit);
|
|
|
|
|
|
|
|
|
|
return ResponseOutput.Ok(result.Id);
|
|
|
|
|
}
|
|
|
|
@@ -80,7 +194,7 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
|
|
|
|
List<AuditDocumentAddOrEdit> auditDocumentAddOrEdits = new List<AuditDocumentAddOrEdit>();
|
|
|
|
|
|
|
|
|
|
auditDocumentAddOrEdits.Add(inDto);
|
|
|
|
|
var result= await AddAuditDocument(auditDocumentAddOrEdits);
|
|
|
|
|
var result = await AddAuditDocument(auditDocumentAddOrEdits);
|
|
|
|
|
return ResponseOutput.Ok(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -91,21 +205,22 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<IResponseOutput> AddAuditDocument(List<AuditDocumentAddOrEdit> inDto)
|
|
|
|
|
{
|
|
|
|
|
List<Guid> resultData = new List<Guid>();
|
|
|
|
|
{
|
|
|
|
|
List<Guid> resultData = new List<Guid>();
|
|
|
|
|
inDto.ForEach(x => x.IsUpdate = false);
|
|
|
|
|
await addData(inDto);
|
|
|
|
|
|
|
|
|
|
async Task addData(List<AuditDocumentAddOrEdit> data)
|
|
|
|
|
{
|
|
|
|
|
foreach(var item in data)
|
|
|
|
|
{
|
|
|
|
|
var result= await AddOrUpdateAuditDocument(item);
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in data)
|
|
|
|
|
{
|
|
|
|
|
var result = await AddOrUpdateAuditDocument(item);
|
|
|
|
|
|
|
|
|
|
resultData.Add(result.Id);
|
|
|
|
|
item.Children.ForEach(x => {
|
|
|
|
|
x.ParentId = result.Id;
|
|
|
|
|
x.IsUpdate = false;
|
|
|
|
|
resultData.Add(result.Id);
|
|
|
|
|
item.Children.ForEach(x =>
|
|
|
|
|
{
|
|
|
|
|
x.ParentId = result.Id;
|
|
|
|
|
x.IsUpdate = false;
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@@ -114,9 +229,9 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
|
|
|
|
await addData(item.Children);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ResponseOutput.Ok(resultData);
|
|
|
|
|
return ResponseOutput.Ok(resultData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -125,74 +240,74 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
|
|
|
|
/// 通用方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="inDto"></param>
|
|
|
|
|
private async Task<AuditDocument> AddOrUpdateAuditDocument(AuditDocumentAddOrEdit inDto)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var alikeData = await _auditDocumentRepository.Where(x =>x.Id!=inDto.Id&& x.ParentId == inDto.ParentId&&x.Name==inDto.Name&&x.AuditDocumentTypeEnum==inDto.AuditDocumentTypeEnum).FirstOrDefaultAsync();
|
|
|
|
|
if (alikeData != null)
|
|
|
|
|
{
|
|
|
|
|
if (inDto.AuditDocumentTypeEnum == AuditDocumentType.Folder)
|
|
|
|
|
{
|
|
|
|
|
if (inDto.IsUpdate)
|
|
|
|
|
{
|
|
|
|
|
throw new BusinessValidationFailedException(_localizer["AuditDocument_CanNotAddFolder"]);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return alikeData;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var entityData = await _auditDocumentRepository.InsertOrUpdateAsync(inDto, true);
|
|
|
|
|
var historicalVersionIds = await _auditDocumentRepository.Where(x => x.MainFileId == alikeData.Id).OrderBy(x => x.Version).Select(x => x.Id).ToListAsync();
|
|
|
|
|
historicalVersionIds.Add(alikeData.Id);
|
|
|
|
|
int num = 1;
|
|
|
|
|
private async Task<AuditDocument> AddOrUpdateAuditDocument(AuditDocumentAddOrEdit inDto)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
foreach (var item in historicalVersionIds)
|
|
|
|
|
{
|
|
|
|
|
await _auditDocumentRepository.UpdatePartialFromQueryAsync(item, x => new AuditDocument()
|
|
|
|
|
{
|
|
|
|
|
MainFileId = entityData.Id,
|
|
|
|
|
ParentId = null,
|
|
|
|
|
Version = num,
|
|
|
|
|
AuditDocumentTypeEnum = AuditDocumentType.HistoricalVersion
|
|
|
|
|
},true);
|
|
|
|
|
num++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return entityData;
|
|
|
|
|
var alikeData = await _auditDocumentRepository.Where(x => x.Id != inDto.Id && x.ParentId == inDto.ParentId && x.Name == inDto.Name && x.AuditDocumentTypeEnum == inDto.AuditDocumentTypeEnum).FirstOrDefaultAsync();
|
|
|
|
|
if (alikeData != null)
|
|
|
|
|
{
|
|
|
|
|
if (inDto.AuditDocumentTypeEnum == AuditDocumentType.Folder)
|
|
|
|
|
{
|
|
|
|
|
if (inDto.IsUpdate)
|
|
|
|
|
{
|
|
|
|
|
throw new BusinessValidationFailedException(_localizer["AuditDocument_CanNotAddFolder"]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return alikeData;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var entityData = await _auditDocumentRepository.InsertOrUpdateAsync(inDto, true);
|
|
|
|
|
var historicalVersionIds = await _auditDocumentRepository.Where(x => x.MainFileId == alikeData.Id).OrderBy(x => x.Version).Select(x => x.Id).ToListAsync();
|
|
|
|
|
historicalVersionIds.Add(alikeData.Id);
|
|
|
|
|
int num = 1;
|
|
|
|
|
|
|
|
|
|
var entity = await _auditDocumentRepository.InsertOrUpdateAsync(inDto, true);
|
|
|
|
|
return entity;
|
|
|
|
|
}
|
|
|
|
|
foreach (var item in historicalVersionIds)
|
|
|
|
|
{
|
|
|
|
|
await _auditDocumentRepository.UpdatePartialFromQueryAsync(item, x => new AuditDocument()
|
|
|
|
|
{
|
|
|
|
|
MainFileId = entityData.Id,
|
|
|
|
|
ParentId = null,
|
|
|
|
|
Version = num,
|
|
|
|
|
AuditDocumentTypeEnum = AuditDocumentType.HistoricalVersion
|
|
|
|
|
}, true);
|
|
|
|
|
num++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取面包屑导航
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="inDto"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<List<AuditDocumentUpdateDto>> GetBreadcrumbData(GetBreadcrumbDataInDto inDto)
|
|
|
|
|
{
|
|
|
|
|
List<AuditDocumentUpdateDto> result=new List<AuditDocumentUpdateDto>();
|
|
|
|
|
return entityData;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await findParent(result, inDto.Id);
|
|
|
|
|
|
|
|
|
|
var entity = await _auditDocumentRepository.InsertOrUpdateAsync(inDto, true);
|
|
|
|
|
return entity;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取面包屑导航
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="inDto"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<List<AuditDocumentUpdateDto>> GetBreadcrumbData(GetBreadcrumbDataInDto inDto)
|
|
|
|
|
{
|
|
|
|
|
List<AuditDocumentUpdateDto> result = new List<AuditDocumentUpdateDto>();
|
|
|
|
|
|
|
|
|
|
await findParent(result, inDto.Id);
|
|
|
|
|
async Task findParent(List<AuditDocumentUpdateDto> datas, Guid id)
|
|
|
|
|
{
|
|
|
|
|
var data= await _auditDocumentRepository.Where(x => x.Id == id).ProjectTo<AuditDocumentUpdateDto>(_mapper.ConfigurationProvider).FirstNotNullAsync();
|
|
|
|
|
{
|
|
|
|
|
var data = await _auditDocumentRepository.Where(x => x.Id == id).ProjectTo<AuditDocumentUpdateDto>(_mapper.ConfigurationProvider).FirstNotNullAsync();
|
|
|
|
|
datas.Add(data);
|
|
|
|
|
if (data.ParentId != null)
|
|
|
|
|
{
|
|
|
|
|
if (data.ParentId != null)
|
|
|
|
|
{
|
|
|
|
|
await findParent(datas, data.ParentId.Value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.Reverse();
|
|
|
|
|
result.Reverse();
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
@@ -204,8 +319,8 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
|
|
|
|
/// <param name="inDto"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<PageOutput<AuditDocumentData>> GetAuditDocumentData(GetAuditDocumentDataInDto inDto)
|
|
|
|
|
{
|
|
|
|
|
public async Task<PageOutput<AuditDocumentData>> GetAuditDocumentData(GetAuditDocumentDataInDto inDto)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var defalutSortArray = new string[] { nameof(AuditDocumentData.AuditDocumentTypeEnum), nameof(AuditDocumentData.Name) };
|
|
|
|
|
if (inDto.SortField.IsNotNullOrEmpty())
|
|
|
|
@@ -213,41 +328,42 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
|
|
|
|
defalutSortArray = new string[] { nameof(AuditDocumentData.AuditDocumentTypeEnum), inDto.SortField + (inDto.Asc ? " asc" : " desc") };
|
|
|
|
|
inDto.SortField = string.Empty;
|
|
|
|
|
}
|
|
|
|
|
// 新取出来排序 然后再找子项
|
|
|
|
|
var data= (await _auditDocumentRepository
|
|
|
|
|
.Where(x=>x.AuditDocumentTypeEnum!=AuditDocumentType.HistoricalVersion)
|
|
|
|
|
.WhereIf(inDto.IsAuthorization!=null,x=>x.IsAuthorization==inDto.IsAuthorization)
|
|
|
|
|
.ProjectTo<AuditDocumentData>(_mapper.ConfigurationProvider).ToPagedListAsync(new PageInput() {
|
|
|
|
|
PageIndex=1,
|
|
|
|
|
PageSize=999999,
|
|
|
|
|
}, defalutSortArray) ).CurrentPageData.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 新取出来排序 然后再找子项
|
|
|
|
|
var data = (await _auditDocumentRepository
|
|
|
|
|
.Where(x => x.AuditDocumentTypeEnum != AuditDocumentType.HistoricalVersion)
|
|
|
|
|
.WhereIf(inDto.IsAuthorization != null, x => x.IsAuthorization == inDto.IsAuthorization)
|
|
|
|
|
.ProjectTo<AuditDocumentData>(_mapper.ConfigurationProvider).ToPagedListAsync(new PageInput()
|
|
|
|
|
{
|
|
|
|
|
PageIndex = 1,
|
|
|
|
|
PageSize = 999999,
|
|
|
|
|
}, defalutSortArray)).CurrentPageData.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (inDto.Name.IsNotNullOrEmpty())
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
List<Guid> findIds = new List<Guid>();
|
|
|
|
|
var findData = data.Where(x => x.Name.Contains(inDto.Name)).Select(x => x.Id.Value).ToList();
|
|
|
|
|
GetParentId(findIds, findData, data);
|
|
|
|
|
findIds.AddRange(findData);
|
|
|
|
|
|
|
|
|
|
data = data.Where(x => findIds.Distinct().Contains(x.Id.Value)).ToList();
|
|
|
|
|
data = data.Where(x => findIds.Distinct().Contains(x.Id.Value)).ToList();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var query = data
|
|
|
|
|
var query = data
|
|
|
|
|
.WhereIf(inDto.SelfId != null, x => inDto.SelfId == x.Id)
|
|
|
|
|
.WhereIf(inDto.Id != null, x => inDto.Id == x.ParentId)
|
|
|
|
|
.WhereIf(inDto.Id == null&& inDto.SelfId == null, x => x.ParentId == null);
|
|
|
|
|
.WhereIf(inDto.Id == null && inDto.SelfId == null, x => x.ParentId == null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PageOutput<AuditDocumentData> result = new PageOutput<AuditDocumentData>()
|
|
|
|
|
{
|
|
|
|
|
PageIndex = inDto.PageIndex,
|
|
|
|
|
PageSize = inDto.PageSize,
|
|
|
|
|
TotalCount = query.Count(),
|
|
|
|
|
PageOutput<AuditDocumentData> result = new PageOutput<AuditDocumentData>()
|
|
|
|
|
{
|
|
|
|
|
PageIndex = inDto.PageIndex,
|
|
|
|
|
PageSize = inDto.PageSize,
|
|
|
|
|
TotalCount = query.Count(),
|
|
|
|
|
};
|
|
|
|
|
var root = query
|
|
|
|
|
.Skip(inDto.PageSize * (inDto.PageIndex - 1)).Take(inDto.PageSize).ToList();
|
|
|
|
@@ -256,32 +372,32 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
|
|
|
|
.Where(x => x.AuditDocumentTypeEnum == AuditDocumentType.HistoricalVersion).ProjectTo<AuditDocumentData>(_mapper.ConfigurationProvider).ToListAsync();
|
|
|
|
|
|
|
|
|
|
foreach (var item in root)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
GetChildren(item, data, historicalVersionList);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
result.CurrentPageData = root;
|
|
|
|
|
return result;
|
|
|
|
|
result.CurrentPageData = root;
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void GetParentId(List<Guid> parentIds, List<Guid> ids, List<AuditDocumentData> dataList)
|
|
|
|
|
{
|
|
|
|
|
private void GetParentId(List<Guid> parentIds, List<Guid> ids, List<AuditDocumentData> dataList)
|
|
|
|
|
{
|
|
|
|
|
var parentid = dataList.Where(x => ids.Contains(x.Id.Value) && x.ParentId != null).Select(x => x.ParentId.Value).ToList();
|
|
|
|
|
|
|
|
|
|
if (parentid.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
if (parentid.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
parentIds.AddRange(parentid);
|
|
|
|
|
|
|
|
|
|
GetParentId(parentIds, parentid, dataList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void GetChildren(AuditDocumentData item, List<AuditDocumentData> dataList, List<AuditDocumentData> historyList)
|
|
|
|
|
private void GetChildren(AuditDocumentData item, List<AuditDocumentData> dataList, List<AuditDocumentData> historyList)
|
|
|
|
|
{
|
|
|
|
|
item.Children = dataList.Where(x => x.ParentId == item.Id).ToList();
|
|
|
|
|
item.HistoricalVersionsCount= historyList.Where(x => x.MainFileId == item.Id).Count();
|
|
|
|
|
item.HistoricalVersionsCount = historyList.Where(x => x.MainFileId == item.Id).Count();
|
|
|
|
|
foreach (var x in item.Children)
|
|
|
|
|
{
|
|
|
|
|
GetChildren(x, dataList, historyList);
|
|
|
|
@@ -295,39 +411,40 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<IResponseOutput> DeleteAuditDocument(DeleteAuditDocumentInDto inDto)
|
|
|
|
|
{
|
|
|
|
|
var data = await _auditDocumentRepository.Select(x => new DeleteAudit (){
|
|
|
|
|
Id=x.Id,
|
|
|
|
|
ParentId= x.ParentId,
|
|
|
|
|
MainFileId= x.MainFileId
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
{
|
|
|
|
|
var data = await _auditDocumentRepository.Select(x => new DeleteAudit()
|
|
|
|
|
{
|
|
|
|
|
Id = x.Id,
|
|
|
|
|
ParentId = x.ParentId,
|
|
|
|
|
MainFileId = x.MainFileId
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
List<Guid> DeleteId= inDto.Ids;
|
|
|
|
|
List<Guid> DeleteId = inDto.Ids;
|
|
|
|
|
|
|
|
|
|
finId(inDto.Ids, data);
|
|
|
|
|
|
|
|
|
|
void finId(List<Guid> deletids, List<DeleteAudit> deletes)
|
|
|
|
|
{
|
|
|
|
|
DeleteId.AddRange(deletids);
|
|
|
|
|
{
|
|
|
|
|
DeleteId.AddRange(deletids);
|
|
|
|
|
|
|
|
|
|
var temp = deletes.Where(x =>(x.ParentId!=null&& deletids.Contains(x.ParentId.Value))||(x.MainFileId!=null&& deletids.Contains(x.MainFileId.Value))).Select(x => x.Id).ToList();
|
|
|
|
|
if (temp.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
finId(temp, deletes);
|
|
|
|
|
var temp = deletes.Where(x => (x.ParentId != null && deletids.Contains(x.ParentId.Value)) || (x.MainFileId != null && deletids.Contains(x.MainFileId.Value))).Select(x => x.Id).ToList();
|
|
|
|
|
if (temp.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
finId(temp, deletes);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DeleteId = DeleteId.Distinct().ToList();
|
|
|
|
|
var mainFileId=await _auditDocumentRepository.Where(x => DeleteId.Contains(x.Id)&&x.MainFileId!=null).Select(x => x.MainFileId).Distinct().ToListAsync();
|
|
|
|
|
DeleteId = DeleteId.Distinct().ToList();
|
|
|
|
|
var mainFileId = await _auditDocumentRepository.Where(x => DeleteId.Contains(x.Id) && x.MainFileId != null).Select(x => x.MainFileId).Distinct().ToListAsync();
|
|
|
|
|
var success = await _auditDocumentRepository.DeleteFromQueryAsync(t => DeleteId.Distinct().Contains(t.Id), true);
|
|
|
|
|
|
|
|
|
|
foreach (var item in mainFileId)
|
|
|
|
|
{
|
|
|
|
|
var historicalVersionList = await _auditDocumentRepository.Where(x => x.MainFileId == item).OrderBy(x=>x.Version).ToListAsync();
|
|
|
|
|
foreach (var item in mainFileId)
|
|
|
|
|
{
|
|
|
|
|
var historicalVersionList = await _auditDocumentRepository.Where(x => x.MainFileId == item).OrderBy(x => x.Version).ToListAsync();
|
|
|
|
|
|
|
|
|
|
var num = 1;
|
|
|
|
|
foreach (var historical in historicalVersionList)
|
|
|
|
|
{
|
|
|
|
|
var num = 1;
|
|
|
|
|
foreach (var historical in historicalVersionList)
|
|
|
|
|
{
|
|
|
|
|
await _auditDocumentRepository.UpdatePartialFromQueryAsync(historical.Id, x => new AuditDocument()
|
|
|
|
|
{
|
|
|
|
|
Version = num,
|
|
|
|
@@ -335,7 +452,7 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
|
|
|
|
num++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -345,12 +462,12 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 移动文件或者文件夹 到其他文件夹
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<IResponseOutput> MovieFileOrFolder(MovieFileOrFolderInDto inDto)
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 移动文件或者文件夹 到其他文件夹
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<IResponseOutput> MovieFileOrFolder(MovieFileOrFolderInDto inDto)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var data = await _auditDocumentRepository.Select(x => new DeleteAudit()
|
|
|
|
@@ -361,8 +478,8 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
|
|
|
|
MainFileId = x.MainFileId
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
foreach (var id in inDto.Ids)
|
|
|
|
|
{
|
|
|
|
|
foreach (var id in inDto.Ids)
|
|
|
|
|
{
|
|
|
|
|
var file = data.Where(x => x.Id == id).FirstOrDefault();
|
|
|
|
|
if (file.AuditDocumentTypeEnum == AuditDocumentType.Folder)
|
|
|
|
|
{
|
|
|
|
@@ -394,7 +511,7 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var id in inDto.Ids)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
await _auditDocumentRepository.UpdatePartialFromQueryAsync(id, x => new AuditDocument()
|
|
|
|
|
{
|
|
|
|
|
ParentId = inDto.ParentId
|
|
|
|
@@ -402,7 +519,7 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
|
|
|
|
|
|
|
|
|
await _auditDocumentRepository.SaveChangesAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseOutput.Ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -412,21 +529,22 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
|
|
|
|
/// <param name="inDto"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<IResponseOutput> CopyFileOrFolder(MovieFileOrFolderInDto inDto)
|
|
|
|
|
public async Task<IResponseOutput> CopyFileOrFolder(MovieFileOrFolderInDto inDto)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
foreach (var item in inDto.Ids)
|
|
|
|
|
{
|
|
|
|
|
var data = (await GetAuditDocumentData(new GetAuditDocumentDataInDto()
|
|
|
|
|
foreach (var item in inDto.Ids)
|
|
|
|
|
{
|
|
|
|
|
var data = (await GetAuditDocumentData(new GetAuditDocumentDataInDto()
|
|
|
|
|
{
|
|
|
|
|
SelfId =item,
|
|
|
|
|
|
|
|
|
|
PageIndex=1,
|
|
|
|
|
PageSize= 1000
|
|
|
|
|
SelfId = item,
|
|
|
|
|
|
|
|
|
|
PageIndex = 1,
|
|
|
|
|
PageSize = 1000
|
|
|
|
|
})).CurrentPageData;
|
|
|
|
|
|
|
|
|
|
List<AuditDocumentAddOrEdit> auditDocumentAddOrEdits = _mapper.Map<List<AuditDocumentAddOrEdit>>(data);
|
|
|
|
|
auditDocumentAddOrEdits.ForEach(x => {
|
|
|
|
|
auditDocumentAddOrEdits.ForEach(x =>
|
|
|
|
|
{
|
|
|
|
|
x.IsUpdate = false;
|
|
|
|
|
x.Id = null;
|
|
|
|
|
x.ParentId = inDto.ParentId;
|
|
|
|
@@ -441,7 +559,8 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
|
|
|
|
item.Id = null;
|
|
|
|
|
var result = await AddOrUpdateAuditDocument(item);
|
|
|
|
|
|
|
|
|
|
item.Children.ForEach(x => {
|
|
|
|
|
item.Children.ForEach(x =>
|
|
|
|
|
{
|
|
|
|
|
x.ParentId = result.Id;
|
|
|
|
|
x.IsUpdate = false;
|
|
|
|
|
x.Id = null;
|
|
|
|
@@ -462,98 +581,100 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
|
|
|
|
/// <param name="inDto"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<List<HistoricalVersionDto>> GetHistoricalVersion(GetHistoricalVersionInDto inDto)
|
|
|
|
|
{
|
|
|
|
|
public async Task<List<HistoricalVersionDto>> GetHistoricalVersion(GetHistoricalVersionInDto inDto)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
List< HistoricalVersionDto > result=new List<HistoricalVersionDto>();
|
|
|
|
|
List<HistoricalVersionDto> result = new List<HistoricalVersionDto>();
|
|
|
|
|
|
|
|
|
|
result = await _auditDocumentRepository.Where(x => x.MainFileId == inDto.Id).ProjectTo<HistoricalVersionDto>(_mapper.ConfigurationProvider).OrderByDescending(x => x.Version).ToListAsync();
|
|
|
|
|
var currentData = await _auditDocumentRepository.Where(x => x.Id == inDto.Id).ProjectTo<HistoricalVersionDto>(_mapper.ConfigurationProvider).FirstNotNullAsync();
|
|
|
|
|
currentData.IsCurrentVersion = true;
|
|
|
|
|
result = await _auditDocumentRepository.Where(x => x.MainFileId == inDto.Id).ProjectTo<HistoricalVersionDto>(_mapper.ConfigurationProvider).OrderByDescending(x => x.Version).ToListAsync();
|
|
|
|
|
var currentData = await _auditDocumentRepository.Where(x => x.Id == inDto.Id).ProjectTo<HistoricalVersionDto>(_mapper.ConfigurationProvider).FirstNotNullAsync();
|
|
|
|
|
currentData.IsCurrentVersion = true;
|
|
|
|
|
|
|
|
|
|
result.Insert(0, currentData);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 把历史版本设置为当前版本
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<IResponseOutput> SetCurrentVersion(SetCurrentVersionInDto inDto)
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 把历史版本设置为当前版本
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<IResponseOutput> SetCurrentVersion(SetCurrentVersionInDto inDto)
|
|
|
|
|
{
|
|
|
|
|
var file = await _auditDocumentRepository.Where(x => x.Id == inDto.Id).FirstNotNullAsync();
|
|
|
|
|
if (file.AuditDocumentTypeEnum != AuditDocumentType.HistoricalVersion)
|
|
|
|
|
{
|
|
|
|
|
if (file.AuditDocumentTypeEnum != AuditDocumentType.HistoricalVersion)
|
|
|
|
|
{
|
|
|
|
|
throw new BusinessValidationFailedException(_localizer["AuditDocument_CanNotSetCurrentVersion"]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var mainFile = await _auditDocumentRepository.Where(x => x.Id == file.MainFileId).FirstNotNullAsync();
|
|
|
|
|
var mainFile = await _auditDocumentRepository.Where(x => x.Id == file.MainFileId).FirstNotNullAsync();
|
|
|
|
|
|
|
|
|
|
var historicalVersionIds= await _auditDocumentRepository.Where(x => x.MainFileId == mainFile.Id&&x.Id!=inDto.Id).OrderBy(x=>x.Version).Select(x=>x.Id).ToListAsync();
|
|
|
|
|
var historicalVersionIds = await _auditDocumentRepository.Where(x => x.MainFileId == mainFile.Id && x.Id != inDto.Id).OrderBy(x => x.Version).Select(x => x.Id).ToListAsync();
|
|
|
|
|
|
|
|
|
|
historicalVersionIds.Add(mainFile.Id);
|
|
|
|
|
await _auditDocumentRepository.UpdatePartialFromQueryAsync(inDto.Id, x => new AuditDocument() {
|
|
|
|
|
MainFileId=null,
|
|
|
|
|
ParentId= mainFile.ParentId,
|
|
|
|
|
AuditDocumentTypeEnum=AuditDocumentType.File,
|
|
|
|
|
historicalVersionIds.Add(mainFile.Id);
|
|
|
|
|
await _auditDocumentRepository.UpdatePartialFromQueryAsync(inDto.Id, x => new AuditDocument()
|
|
|
|
|
{
|
|
|
|
|
MainFileId = null,
|
|
|
|
|
ParentId = mainFile.ParentId,
|
|
|
|
|
AuditDocumentTypeEnum = AuditDocumentType.File,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
int num = 1;
|
|
|
|
|
foreach (var item in historicalVersionIds)
|
|
|
|
|
{
|
|
|
|
|
int num = 1;
|
|
|
|
|
foreach (var item in historicalVersionIds)
|
|
|
|
|
{
|
|
|
|
|
await _auditDocumentRepository.UpdatePartialFromQueryAsync(item, x => new AuditDocument()
|
|
|
|
|
{
|
|
|
|
|
MainFileId = inDto.Id,
|
|
|
|
|
ParentId = null,
|
|
|
|
|
Version=num,
|
|
|
|
|
AuditDocumentTypeEnum= AuditDocumentType.HistoricalVersion
|
|
|
|
|
Version = num,
|
|
|
|
|
AuditDocumentTypeEnum = AuditDocumentType.HistoricalVersion
|
|
|
|
|
});
|
|
|
|
|
num++;
|
|
|
|
|
num++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await _auditDocumentRepository.SaveChangesAsync();
|
|
|
|
|
await _auditDocumentRepository.SaveChangesAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseOutput.Ok();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置是否授权
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="inDto"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<IResponseOutput> SetIsAuthorization(SetIsAuthorizationInDto inDto)
|
|
|
|
|
{
|
|
|
|
|
var data = await _auditDocumentRepository.Select(x => new DeleteAudit()
|
|
|
|
|
{
|
|
|
|
|
Id = x.Id,
|
|
|
|
|
ParentId = x.ParentId,
|
|
|
|
|
MainFileId = x.MainFileId
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置是否授权
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="inDto"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<IResponseOutput> SetIsAuthorization(SetIsAuthorizationInDto inDto)
|
|
|
|
|
{
|
|
|
|
|
var data = await _auditDocumentRepository.Select(x => new DeleteAudit()
|
|
|
|
|
{
|
|
|
|
|
Id = x.Id,
|
|
|
|
|
ParentId = x.ParentId,
|
|
|
|
|
MainFileId = x.MainFileId
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
List<Guid> allid = new List<Guid>();
|
|
|
|
|
findChild(allid, inDto.Ids, data);
|
|
|
|
|
List<Guid> allid = new List<Guid>();
|
|
|
|
|
findChild(allid, inDto.Ids, data);
|
|
|
|
|
if (inDto.IsAuthorization)
|
|
|
|
|
{
|
|
|
|
|
findParent(allid, inDto.Ids, data);
|
|
|
|
|
}
|
|
|
|
|
allid= allid.Distinct().ToList();
|
|
|
|
|
await _auditDocumentRepository.UpdatePartialFromQueryAsync(t => allid.Contains(t.Id), x => new AuditDocument() {
|
|
|
|
|
|
|
|
|
|
IsAuthorization = inDto.IsAuthorization
|
|
|
|
|
allid = allid.Distinct().ToList();
|
|
|
|
|
await _auditDocumentRepository.UpdatePartialFromQueryAsync(t => allid.Contains(t.Id), x => new AuditDocument()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
IsAuthorization = inDto.IsAuthorization
|
|
|
|
|
});
|
|
|
|
|
await _auditDocumentRepository.SaveChangesAsync();
|
|
|
|
|
return ResponseOutput.Ok();
|
|
|
|
|
await _auditDocumentRepository.SaveChangesAsync();
|
|
|
|
|
return ResponseOutput.Ok();
|
|
|
|
|
|
|
|
|
|
void findParent(List<Guid> allId, List<Guid> current, List<DeleteAudit> data)
|
|
|
|
|
{
|
|
|
|
|
allId.AddRange(current);
|
|
|
|
|
var parent = data.Where(x => current.Contains(x.Id)).Select(x => x.ParentId).Where(x=>x!=null).Select(x=>(Guid)x).ToList();
|
|
|
|
|
|
|
|
|
|
var parent = data.Where(x => current.Contains(x.Id)).Select(x => x.ParentId).Where(x => x != null).Select(x => (Guid)x).ToList();
|
|
|
|
|
|
|
|
|
|
if (parent.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
@@ -563,14 +684,14 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void findChild(List<Guid> allId,List<Guid> current, List<DeleteAudit> data)
|
|
|
|
|
{
|
|
|
|
|
allId.AddRange(current);
|
|
|
|
|
void findChild(List<Guid> allId, List<Guid> current, List<DeleteAudit> data)
|
|
|
|
|
{
|
|
|
|
|
allId.AddRange(current);
|
|
|
|
|
|
|
|
|
|
var child = data.Where(x => (x.ParentId != null && current.Contains(x.ParentId.Value)) || (x.MainFileId != null && current.Contains(x.MainFileId.Value))).Select(x => x.Id).ToList();
|
|
|
|
|
if (child.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var child = data.Where(x =>(x.ParentId!=null&& current.Contains(x.ParentId.Value))||(x.MainFileId!=null&¤t.Contains(x.MainFileId.Value))).Select(x => x.Id).ToList();
|
|
|
|
|
if (child.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
findChild(allId, child, data);
|
|
|
|
|
|
|
|
|
|