This commit is contained in:
itcsx committed 2026-09-06 16:07:04 +08:00
1 parent 280ccf4de8
commit 032f048a16
25 files changed
+2673 -718

No files matched your search

@@ -59,7 +59,7 @@ namespace CloudBuilder.Core.DatabaseAccessor
//public byte[] RowVersion { get; set; }
if (ex.Message.Contains("data may have been modified or deleted since entities were loaded."))
{
throw new ValidatedException(CoreMessagePolicy.GetInstance().ComposeMessage(CoreMessagePolicy.THE_DATA_HAS_BEEN_MODIFIED));
throw new ValidatedException(CoreMessagePolicy.GetInstance(_serviceProvider).ComposeMessage(CoreMessagePolicy.THE_DATA_HAS_BEEN_MODIFIED));
}
throw new ValidatedException(ex.InnerException?.Message ?? ex.Message);
}
@@ -5,6 +5,7 @@ using CloudBuilder.Core.Service;
using DocumentFormat.OpenXml.Spreadsheet;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.IdentityModel.JsonWebTokens;
using System;
using System.Collections.Generic;
@@ -45,7 +46,7 @@ namespace CloudBuilder.Core.DatabaseAccessor
{
if (ex.Message.Contains("data may have been modified or deleted since entities were loaded."))
{
throw new ValidatedException(CoreMessagePolicy.GetInstance().ComposeMessage(CoreMessagePolicy.THE_DATA_HAS_BEEN_MODIFIED));
throw new ValidatedException(CoreMessagePolicy.GetInstance(_serviceProvider).ComposeMessage(CoreMessagePolicy.THE_DATA_HAS_BEEN_MODIFIED));
}
throw new ValidatedException(ex.InnerException?.Message ?? ex.Message);
}
@@ -1,4 +1,5 @@
using CloudBuilder.Core.DependencyInjection.Form;
using CloudBuilder.Core.DatabaseAccessor.Entity;
using CloudBuilder.Core.DependencyInjection.Form;
using CloudBuilder.Core.DependencyInjection.Policy;
using CloudBuilder.Core.DependencyInjection.Request;
using Microsoft.Extensions.DependencyInjection;
@@ -22,9 +23,9 @@ namespace CloudBuilder.Core.Policy
this.values = new string[] { THE_DATA_HAS_BEEN_MODIFIED, NO_PERMISSION };
}
public static CoreMessagePolicy GetInstance()
public static CoreMessagePolicy GetInstance(IServiceProvider serviceProvider)
{
instance = ApplicationServiceContext.ServiceProvider.GetKeyedService<CoreMessagePolicy>(typeof(CoreMessagePolicy).Name);
instance = serviceProvider.GetKeyedService<CoreMessagePolicy>(typeof(CoreMessagePolicy).Name);
return instance;
}
@@ -1,4 +1,5 @@
using CloudBuilder.Core.DependencyInjection.Form;
using CloudBuilder.Core.DependencyInjection.Policy;
using CloudBuilder.Core.DependencyInjection.Request;
using Microsoft.Extensions.DependencyInjection;
using System;
@@ -9,7 +10,7 @@ using System.Threading.Tasks;
namespace System
{
public class SearchFilterOperatorPolicy : AbstractPolicy
public class SearchFilterOperatorPolicy : AbstractPolicy, IPolicy
{
public const string EQUAL_TO = "equal_to";//='value'
public const string CONTAIN = "contain";//like '%value%'
@@ -71,9 +72,9 @@ namespace System
};
}
public static SearchFilterOperatorPolicy GetInstance()
public static SearchFilterOperatorPolicy GetInstance(IServiceProvider serviceProvider)
{
instance = ApplicationServiceContext.ServiceProvider.GetKeyedService<SearchFilterOperatorPolicy>(typeof(SearchFilterOperatorPolicy).Name);
instance = serviceProvider.GetKeyedService<SearchFilterOperatorPolicy>(typeof(SearchFilterOperatorPolicy).Name);
return instance;
}
@@ -1,4 +1,5 @@
using CloudBuilder.Core.DependencyInjection.Form;
using CloudBuilder.Core.DependencyInjection.Policy;
using CloudBuilder.Core.DependencyInjection.Request;
using Microsoft.Extensions.DependencyInjection;
using System;
@@ -9,7 +10,7 @@ using System.Threading.Tasks;
namespace System
{
public class SearchFilterTypePolicy : AbstractPolicy
public class SearchFilterTypePolicy : AbstractPolicy, IPolicy
{
public const string TEXT = "Text";
public const string TEXT_CONTAIN = "TextContain";
@@ -31,9 +32,9 @@ namespace System
this.values = new string[] { TEXT, TEXT_CONTAIN, NUMBER, DATE, DATETIME, MULTIPLE_SELECTION, SINGLE_SELECTION };
}
public static SearchFilterTypePolicy GetInstance()
public static SearchFilterTypePolicy GetInstance(IServiceProvider serviceProvider)
{
instance = ApplicationServiceContext.ServiceProvider.GetKeyedService<SearchFilterTypePolicy>(typeof(SearchFilterTypePolicy).Name);
instance = serviceProvider.GetKeyedService<SearchFilterTypePolicy>(typeof(SearchFilterTypePolicy).Name);
return instance;
}
}
@@ -18,9 +18,9 @@ namespace System
this.values = new string[] { YES, NO };
}
public static YesNoPolicy GetInstance()
public static YesNoPolicy GetInstance(IServiceProvider serviceProvider)
{
instance = ApplicationServiceContext.ServiceProvider.GetKeyedService<YesNoPolicy>(typeof(YesNoPolicy).Name);
instance = serviceProvider.GetKeyedService<YesNoPolicy>(typeof(YesNoPolicy).Name);
return instance;
}
@@ -5,6 +5,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text;
@@ -138,7 +139,7 @@ namespace CloudBuilder.Core.Request
if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11);
if (response.ReasonPhrase == "Forbidden")
throw new Exception(string.Format("{0}", CoreMessagePolicy.GetInstance().ComposeMessage(CoreMessagePolicy.NO_PERMISSION)));
throw new Exception(string.Format("{0}", CoreMessagePolicy.GetInstance(provider).ComposeMessage(CoreMessagePolicy.NO_PERMISSION)));
throw new Exception(string.Format("{0}{1}", response.ReasonPhrase, string.IsNullOrEmpty(errors) ? "" : "\r\n" + errors));
}
@@ -188,7 +189,7 @@ namespace CloudBuilder.Core.Request
if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11);
if (response.ReasonPhrase == "Forbidden")
throw new Exception(string.Format("{0}", CoreMessagePolicy.GetInstance().ComposeMessage(CoreMessagePolicy.NO_PERMISSION)));
throw new Exception(string.Format("{0}", CoreMessagePolicy.GetInstance(provider).ComposeMessage(CoreMessagePolicy.NO_PERMISSION)));
throw new Exception(string.Format("{0}{1}", response.ReasonPhrase, string.IsNullOrEmpty(errors) ? "" : "\r\n" + errors));
}
@@ -244,7 +245,7 @@ namespace CloudBuilder.Core.Request
if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11);
if (response.ReasonPhrase == "Forbidden")
throw new Exception(string.Format("{0}", CoreMessagePolicy.GetInstance().ComposeMessage(CoreMessagePolicy.NO_PERMISSION)));
throw new Exception(string.Format("{0}", CoreMessagePolicy.GetInstance(provider).ComposeMessage(CoreMessagePolicy.NO_PERMISSION)));
throw new Exception(string.Format("{0}{1}", response.ReasonPhrase, string.IsNullOrEmpty(errors) ? "" : "\r\n" + errors));
}
@@ -275,7 +276,7 @@ namespace CloudBuilder.Core.Request
if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11);
if (response.ReasonPhrase == "Forbidden")
throw new Exception(string.Format("{0}", CoreMessagePolicy.GetInstance().ComposeMessage(CoreMessagePolicy.NO_PERMISSION)));
throw new Exception(string.Format("{0}", CoreMessagePolicy.GetInstance(provider).ComposeMessage(CoreMessagePolicy.NO_PERMISSION)));
throw new Exception(string.Format("{0}{1}", response.ReasonPhrase, string.IsNullOrEmpty(errors) ? "" : "\r\n" + errors));
}
@@ -306,7 +307,7 @@ namespace CloudBuilder.Core.Request
if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11);
if (response.ReasonPhrase == "Forbidden")
throw new Exception(string.Format("{0}", CoreMessagePolicy.GetInstance().ComposeMessage(CoreMessagePolicy.NO_PERMISSION)));
throw new Exception(string.Format("{0}", CoreMessagePolicy.GetInstance(provider).ComposeMessage(CoreMessagePolicy.NO_PERMISSION)));
throw new Exception(string.Format("{0}{1}", response.ReasonPhrase, string.IsNullOrEmpty(errors) ? "" : "\r\n" + errors));
}
@@ -335,7 +336,7 @@ namespace CloudBuilder.Core.Request
if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11);
if (response.ReasonPhrase == "Forbidden")
throw new Exception(string.Format("{0}", CoreMessagePolicy.GetInstance().ComposeMessage(CoreMessagePolicy.NO_PERMISSION)));
throw new Exception(string.Format("{0}", CoreMessagePolicy.GetInstance(provider).ComposeMessage(CoreMessagePolicy.NO_PERMISSION)));
throw new Exception(string.Format("{0}{1}", response.ReasonPhrase, string.IsNullOrEmpty(errors) ? "" : "\r\n" + errors));
}
@@ -395,7 +396,7 @@ namespace CloudBuilder.Core.Request
if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11);
if (response.ReasonPhrase == "Forbidden")
throw new Exception(string.Format("{0}", CoreMessagePolicy.GetInstance().ComposeMessage(CoreMessagePolicy.NO_PERMISSION)));
throw new Exception(string.Format("{0}", CoreMessagePolicy.GetInstance(provider).ComposeMessage(CoreMessagePolicy.NO_PERMISSION)));
throw new Exception(string.Format("{0}{1}", response.ReasonPhrase, string.IsNullOrEmpty(errors) ? "" : "\r\n" + errors));
}
@@ -429,7 +430,7 @@ namespace CloudBuilder.Core.Request
if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11);
if (response.ReasonPhrase == "Forbidden")
throw new Exception(string.Format("{0}", CoreMessagePolicy.GetInstance().ComposeMessage(CoreMessagePolicy.NO_PERMISSION)));
throw new Exception(string.Format("{0}", CoreMessagePolicy.GetInstance(provider).ComposeMessage(CoreMessagePolicy.NO_PERMISSION)));
throw new Exception(string.Format("{0}{1}", response.ReasonPhrase, string.IsNullOrEmpty(errors) ? "" : "\r\n" + errors));
}
@@ -1,4 +1,5 @@
using System;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -12,16 +13,16 @@ namespace CloudBuilder.Core.Service
public const string KEY_FILTER_OPERATOR = "filter_operator";
public const string KEY_FILTER_TYPE = "filter_type";
public SearchCriteria()
public SearchCriteria(IServiceProvider serviceProvider)
{
Add(KEY_FILTER_OPERATOR, SearchFilterOperatorPolicy.GetInstance().GetBindOptions());
Add(KEY_FILTER_TYPE, SearchFilterTypePolicy.GetInstance().GetBindOptions());
Add(KEY_FILTER_OPERATOR, SearchFilterOperatorPolicy.GetInstance(serviceProvider).GetBindOptions());
Add(KEY_FILTER_TYPE, SearchFilterTypePolicy.GetInstance(serviceProvider).GetBindOptions());
}
public SearchCriteria(Selection[] selections)
public SearchCriteria(IServiceProvider serviceProvider,Selection[] selections)
{
Selections = selections;
Add(KEY_FILTER_OPERATOR, SearchFilterOperatorPolicy.GetInstance().GetBindOptions());
Add(KEY_FILTER_TYPE, SearchFilterTypePolicy.GetInstance().GetBindOptions());
Add(KEY_FILTER_OPERATOR, SearchFilterOperatorPolicy.GetInstance(serviceProvider).GetBindOptions());
Add(KEY_FILTER_TYPE, SearchFilterTypePolicy.GetInstance(serviceProvider).GetBindOptions());
}
public Selection[] Selections { get; set; }
@@ -364,35 +364,29 @@ namespace CloudBuilder.Master.Service
[PermissionOperate(name: MasterPermissionPolicy.DmsFile, operate: Operate.Delete)]
[UnitOfWork]
public void Delete(long key)
{
Delete(key, false);
}
private void Delete(long key, bool hasCreateDmsFileDeleteLog)
{
DmsFileEntity dmsFile = repository.DetachedEntities.Where(x => x.FileId == key).FirstOrDefault()!;
if (dmsFile == null) return;
if (!hasCreateDmsFileDeleteLog) CreateDmsFileDeleteLog(dmsFile, null);
IRepository<DmsFileUploadEntity> repositoryUpload = repository.GetRepository<IRepository<DmsFileUploadEntity>>();
IRepository<DmsFolderMapEntity> repositoryFolderMap = repository.GetRepository<IRepository<DmsFolderMapEntity>>();
IRepository<DmsFolderEntity> repositoryFolder = repository.GetRepository<IRepository<DmsFolderEntity>>();
repository.DeleteNow(dmsFile);
IRepository<DmsFileDeleteLogEntity> repositoryDmsFileDeleteLog = repository.GetRepository<IRepository<DmsFileDeleteLogEntity>>();
DmsFileDeleteLogEntity dmsFileDeleteLogEntity = new DmsFileDeleteLogEntity();
ObjectCopyHelper.Copy(dmsFile, dmsFileDeleteLogEntity);
repositoryDmsFileDeleteLog.InsertNow(dmsFileDeleteLogEntity);
DmsFileUploadEntity DmsFileUpload = repositoryUpload.DetachedEntities.Where(x => x.FileId == key).FirstOrDefault()!;
IRepository<DmsFileUploadDeleteLogEntity> repositoryDmsFileUploadDeleteLog = repository.GetRepository<IRepository<DmsFileUploadDeleteLogEntity>>();
IRepository<DmsFolderDeleteLogEntity> repositoryDmsFolderDeleteLog = repository.GetRepository<IRepository<DmsFolderDeleteLogEntity>>();
IRepository<DmsFolderMapDeleteLogEntity> repositoryDmsFolderMapDeleteLog = repository.GetRepository<IRepository<DmsFolderMapDeleteLogEntity>>();
if (DmsFileUpload != null)
{
repositoryUpload.DeleteNow(DmsFileUpload);
DmsFileUploadDeleteLogEntity DmsFileUploadDeleteLogEntity = new DmsFileUploadDeleteLogEntity();
ObjectCopyHelper.Copy(DmsFileUpload, DmsFileUploadDeleteLogEntity);
repositoryDmsFileUploadDeleteLog.InsertNow(DmsFileUploadDeleteLogEntity);
}
if (dmsFile.IsDirectoryIndc == YesNoPolicy.YES)
@@ -404,32 +398,21 @@ namespace CloudBuilder.Master.Service
if (folder != null)
{
repositoryFolder.DeleteNow(folder);
DmsFolderDeleteLogEntity dfdLog = new DmsFolderDeleteLogEntity();
ObjectCopyHelper.Copy(folder, dfdLog);
repositoryDmsFolderDeleteLog.InsertNow(dfdLog);
}
DmsFolderMapEntity[] folderMaps = repositoryFolderMap.DetachedEntities.Where(x => x.FolderNameSon == dmsFile.FileName || x.FolderNameParent == dmsFile.FileName).ToArray();
DmsFolderMapDeleteLogEntity dmsFolderMapEntity;
if (folderMaps != null && folderMaps.Length > 0)
{
foreach (var map in folderMaps)
{
repositoryFolderMap.DeleteNow(map);
dmsFolderMapEntity = new DmsFolderMapDeleteLogEntity();
ObjectCopyHelper.Copy(map, dmsFolderMapEntity);
repositoryDmsFolderMapDeleteLog.InsertNow(dmsFolderMapEntity);
if (map.FolderNameSon == folder.FolderName) continue;
//刪除dmsfoler下的所有內容
DeleteFolder(map.FolderNameSon);
}
}
}
else
{
@@ -438,12 +421,229 @@ namespace CloudBuilder.Master.Service
if (folderMap != null)
repositoryFolderMap.DeleteNow(folderMap);
}
}
private void CreateDmsFileDeleteLogByDirectory(DmsFileEntity dmsFile, DmsFolderDeleteLogEntity folder)
{
IRepository<DmsFolderDeleteLogEntity> repositoryFolder = repository.GetRepository<IRepository<DmsFolderDeleteLogEntity>>();
ISecurityGeneratorNumberService securityGeneratorNumberService = service.ServiceProvider.GetService<ISecurityGeneratorNumberService>()!;
string folderNameParent = folder.FolderName;
//创建当前目录
folder = new DmsFolderDeleteLogEntity();
folder.FolderName = securityGeneratorNumberService.GetNo(MasterPrefixPolicy.DMS_FOLDER_DELETE_LOG, MasterPrefixPolicy.DMS_FOLDER_DELETE_LOG_FOLDER_NAME, "DR", YesNoPolicy.NO, "00000000");
folder.FolderLocalName = dmsFile.OrgFileName;//如果是目录,这个就是目录名称
repositoryFolder.InsertNow(folder);
//创建目录关系表
DmsFolderMapDeleteLogEntity map = new DmsFolderMapDeleteLogEntity();
IRepository<DmsFolderMapDeleteLogEntity> repositoryFolderMap = repository.GetRepository<IRepository<DmsFolderMapDeleteLogEntity>>();
map.FolderNameParent = folderNameParent;
map.FolderNameSon = folder.FolderName;
repositoryFolderMap.InsertNow(map);
//创建Dms目录
IRepository<DmsFileDeleteLogEntity> repositoryDmsFileDeleteLog = repository.GetRepository<IRepository<DmsFileDeleteLogEntity>>();
DmsFileDeleteLogEntity entity = new DmsFileDeleteLogEntity();
ObjectCopyHelper.Copy(dmsFile, entity);
entity.OrderKey = entity.FileName = folder.FolderName;
entity.FileId = 0;
entity.FilePath = folderNameParent;
repositoryDmsFileDeleteLog.InsertNow(entity);
DmsFileUploadDeleteLogEntity upload = new DmsFileUploadDeleteLogEntity();
upload.FileId = entity.FileId;
upload.FileCategory = "MASTER";
upload.UploadName = securityGeneratorNumberService.GetNo(MasterPrefixPolicy.UPLOAD_DMS_FILE_DELETE_LOG, MasterPrefixPolicy.UPLOAD_DMS_FILE_DELETE_LOG_UPLOAD_NAME, "DR", YesNoPolicy.NO, MasterPrefixPolicy.UPLOAD_DMS_FILE_DELETE_LOG_FORMAT);
upload.OrgFileName = entity.OrgFileName;
IRepository<DmsFileUploadDeleteLogEntity> repositoryUpload = repository.GetRepository<IRepository<DmsFileUploadDeleteLogEntity>>();
repositoryUpload.InsertNow(upload);
//创建所有目录下的内容
DmsFileEntity[] dmsFiles = repository.DetachedEntities.Where(x => x.FilePath == dmsFile.FileName).ToArray();
if (dmsFiles == null || dmsFiles.Length == 0) return;
foreach (var dms in dmsFiles)
{
CreateDmsFileDeleteLog(dms, folder);
}
}
private void CreateDmsFileDeleteLog(DmsFileEntity dmsFile, DmsFolderDeleteLogEntity folderLog)
{
IRepository<DmsFileDeleteLogEntity> repositoryDmsFileDeleteLog = repository.GetRepository<IRepository<DmsFileDeleteLogEntity>>();
IRepository<DmsFileUploadDeleteLogEntity> repositoryDmsFileUploadDeleteLog = repository.GetRepository<IRepository<DmsFileUploadDeleteLogEntity>>();
IRepository<DmsFolderDeleteLogEntity> repositoryDmsFolderDeleteLog = repository.GetRepository<IRepository<DmsFolderDeleteLogEntity>>();
IRepository<DmsFolderMapDeleteLogEntity> repositoryDmsFolderMapDeleteLog = repository.GetRepository<IRepository<DmsFolderMapDeleteLogEntity>>();
ISecurityGeneratorNumberService securityGeneratorNumberService = service.ServiceProvider.GetService<ISecurityGeneratorNumberService>()!;
//如果顶级目录不存在,创建顶级目录
if (folderLog == null)
folderLog = repositoryDmsFolderDeleteLog.DetachedEntities.Where(x => x.FolderLocalName == service.UserId).FirstOrDefault()!;
if (folderLog == null)
{
folderLog = new DmsFolderDeleteLogEntity();
folderLog.FolderName = securityGeneratorNumberService.GetNo(MasterPrefixPolicy.DMS_FOLDER_DELETE_LOG, MasterPrefixPolicy.DMS_FOLDER_DELETE_LOG_FOLDER_NAME, null, YesNoPolicy.NO, "00000000");
folderLog.FolderLocalName = service.UserId;
repositoryDmsFolderDeleteLog.InsertNow(folderLog);
}
string folderNameParent = folderLog.FolderName;
if (dmsFile.IsDirectoryIndc == YesNoPolicy.YES)
{
CreateDmsFileDeleteLogByDirectory(dmsFile, folderLog);
return;
}
DmsFileUploadDeleteLogEntity uploadLog = new DmsFileUploadDeleteLogEntity();
uploadLog.FileCategory = "MASTER";
uploadLog.UploadName = securityGeneratorNumberService.GetNo(MasterPrefixPolicy.UPLOAD_DMS_FILE_DELETE_LOG, MasterPrefixPolicy.UPLOAD_DMS_FILE_DELETE_LOG_UPLOAD_NAME, "FL", YesNoPolicy.NO, MasterPrefixPolicy.UPLOAD_DMS_FILE_DELETE_LOG_FORMAT);
uploadLog.OrgFileName = dmsFile.OrgFileName;
//创建Dms文件,需更新父目录
DmsFileDeleteLogEntity entityLog = new DmsFileDeleteLogEntity();
ObjectCopyHelper.Copy(dmsFile, entityLog);
entityLog.FilePath = folderNameParent;
entityLog.FileId = 0;
repositoryDmsFileDeleteLog.InsertNow(entityLog);
uploadLog.FileId = entityLog.FileId;
repositoryDmsFileUploadDeleteLog.InsertNow(uploadLog);
//创建目录关系表
DmsFolderMapDeleteLogEntity mapLog = new DmsFolderMapDeleteLogEntity();
mapLog.FolderNameParent = folderNameParent;
mapLog.FolderNameSon = entityLog.FileName;
repositoryDmsFolderMapDeleteLog.InsertNow(mapLog);
}
[PermissionOperate(name: MasterPermissionPolicy.DmsFile, operate: Operate.Insert)]
[UnitOfWork]
public void RestoreDmsFile(long key)
{
DeleteLog(key, true);
}
private void RestoreDmsFileByDirectory(DmsFileDeleteLogEntity dmsFile, DmsFolderEntity folder)
{
IRepository<DmsFolderEntity> repositoryFolder = repository.GetRepository<IRepository<DmsFolderEntity>>();
ISecurityGeneratorNumberService securityGeneratorNumberService = service.ServiceProvider.GetService<ISecurityGeneratorNumberService>()!;
string folderNameParent = folder.FolderName;
//创建当前目录
folder = new DmsFolderEntity();
folder.FolderName = securityGeneratorNumberService.GetNo(MasterPrefixPolicy.DMS_FOLDER_DELETE_LOG, MasterPrefixPolicy.DMS_FOLDER_DELETE_LOG_FOLDER_NAME, "DR", YesNoPolicy.NO, "00000000");
folder.FolderLocalName = dmsFile.OrgFileName;//如果是目录,这个就是目录名称
repositoryFolder.InsertNow(folder);
//创建目录关系表
DmsFolderMapEntity map = new DmsFolderMapEntity();
IRepository<DmsFolderMapEntity> repositoryFolderMap = repository.GetRepository<IRepository<DmsFolderMapEntity>>();
map.FolderNameParent = folderNameParent;
map.FolderNameSon = folder.FolderName;
repositoryFolderMap.InsertNow(map);
//创建Dms目录,要更新目录名
IRepository<DmsFileEntity> repositoryDmsFile = repository.GetRepository<IRepository<DmsFileEntity>>();
DmsFileEntity entity = new DmsFileEntity();
ObjectCopyHelper.Copy(dmsFile, entity);
entity.OrderKey = entity.FileName = folder.FolderName;
entity.FileId = 0;
entity.FilePath = folderNameParent;
repositoryDmsFile.InsertNow(entity);
DmsFileUploadEntity upload = new DmsFileUploadEntity();
upload.FileId = entity.FileId;
upload.FileCategory = "MASTER";
upload.UploadName = securityGeneratorNumberService.GetNo(MasterPrefixPolicy.UPLOAD_DMS_FILE_DELETE_LOG, MasterPrefixPolicy.UPLOAD_DMS_FILE_DELETE_LOG_UPLOAD_NAME, "DR", YesNoPolicy.NO, MasterPrefixPolicy.UPLOAD_DMS_FILE_DELETE_LOG_FORMAT);
upload.OrgFileName = entity.OrgFileName;
IRepository<DmsFileUploadEntity> repositoryUpload = repository.GetRepository<IRepository<DmsFileUploadEntity>>();
repositoryUpload.InsertNow(upload);
IRepository<DmsFileDeleteLogEntity> repositoryDmsFileDeleteLog = repository.GetRepository<IRepository<DmsFileDeleteLogEntity>>();
//创建所有目录下的内容
DmsFileDeleteLogEntity[] dmsFiles = repositoryDmsFileDeleteLog.DetachedEntities.Where(x => x.FilePath == dmsFile.FileName).ToArray();
if (dmsFiles == null || dmsFiles.Length == 0) return;
foreach (var dms in dmsFiles)
{
RestoreDmsFile(dms, folder);
}
}
private void RestoreDmsFile(DmsFileDeleteLogEntity dmsFile, DmsFolderEntity folder)
{
IRepository<DmsFileEntity> repositoryDmsFile = repository.GetRepository<IRepository<DmsFileEntity>>();
IRepository<DmsFileUploadEntity> repositoryDmsFileUpload = repository.GetRepository<IRepository<DmsFileUploadEntity>>();
IRepository<DmsFolderEntity> repositoryDmsFolder = repository.GetRepository<IRepository<DmsFolderEntity>>();
IRepository<DmsFolderMapEntity> repositoryDmsFolderMap = repository.GetRepository<IRepository<DmsFolderMapEntity>>();
ISecurityGeneratorNumberService securityGeneratorNumberService = service.ServiceProvider.GetService<ISecurityGeneratorNumberService>()!;
//如果顶级目录不存在,创建顶级目录
if (folder == null)
folder = repositoryDmsFolder.DetachedEntities.Where(x => x.FolderLocalName == service.UserId).FirstOrDefault()!;
if (folder == null)
{
folder = new DmsFolderEntity();
folder.FolderName = securityGeneratorNumberService.GetNo(MasterPrefixPolicy.DMS_FOLDER_DELETE_LOG, MasterPrefixPolicy.DMS_FOLDER_DELETE_LOG_FOLDER_NAME, null, YesNoPolicy.NO, "00000000");
folder.FolderLocalName = service.UserId;
repositoryDmsFolder.InsertNow(folder);
}
string folderNameParent = folder.FolderName;
if (dmsFile.IsDirectoryIndc == YesNoPolicy.YES)
{
RestoreDmsFileByDirectory(dmsFile, folder);
return;
}
DmsFileUploadEntity uploadLog = new DmsFileUploadEntity();
uploadLog.FileCategory = "MASTER";
uploadLog.UploadName = securityGeneratorNumberService.GetNo(MasterPrefixPolicy.UPLOAD_DMS_FILE_DELETE_LOG, MasterPrefixPolicy.UPLOAD_DMS_FILE_DELETE_LOG_UPLOAD_NAME, "FL", YesNoPolicy.NO, MasterPrefixPolicy.UPLOAD_DMS_FILE_DELETE_LOG_FORMAT);
uploadLog.OrgFileName = dmsFile.OrgFileName;
//创建Dms文件,需更新父目录
DmsFileEntity entityLog = new DmsFileEntity();
ObjectCopyHelper.Copy(dmsFile, entityLog);
entityLog.FilePath = folderNameParent;
entityLog.FileId = 0;
repositoryDmsFile.InsertNow(entityLog);
uploadLog.FileId = entityLog.FileId;
repositoryDmsFileUpload.InsertNow(uploadLog);
//创建目录关系表
DmsFolderMapEntity mapLog = new DmsFolderMapEntity();
mapLog.FolderNameParent = folderNameParent;
mapLog.FolderNameSon = entityLog.FileName;
repositoryDmsFolderMap.InsertNow(mapLog);
}
[PermissionOperate(name: MasterPermissionPolicy.DmsFile, operate: Operate.Delete)]
[UnitOfWork]
public void DeleteLog(long key)
{
DeleteLog(key, false);
}
private void DeleteLog(long key, bool isRestore)
{
IRepository<DmsFileDeleteLogEntity> repositoryDmsFileDeleteLog = repository.GetRepository<IRepository<DmsFileDeleteLogEntity>>();
@@ -451,6 +651,8 @@ namespace CloudBuilder.Master.Service
if (dmsFile == null) return;
if (isRestore) RestoreDmsFile(dmsFile, null);
repositoryDmsFileDeleteLog.DeleteNow(dmsFile);
IRepository<DmsFileUploadDeleteLogEntity> repositoryDmsFileUploadDeleteLog = repository.GetRepository<IRepository<DmsFileUploadDeleteLogEntity>>();
@@ -502,7 +704,7 @@ namespace CloudBuilder.Master.Service
if (dmsFiles == null || dmsFiles.Length == 0) return;
foreach (var dmsFile in dmsFiles)
{
DeleteLog(dmsFile.FileId);
DeleteLog(dmsFile.FileId, false);
}
}
@@ -512,7 +714,7 @@ namespace CloudBuilder.Master.Service
if (dmsFiles == null || dmsFiles.Length == 0) return;
foreach (var dmsFile in dmsFiles)
{
Delete(dmsFile.FileId);
Delete(dmsFile.FileId, true);
}
}
@@ -98,7 +98,14 @@ builder.Entity<PublishVideoFamilyGroupEntity>().HasKey(c => new {c.FamilyName,c.
//***END***
builder.Entity<DmsFileUploadDeleteLogViewEntity>(eb => { eb.HasNoKey(); });
builder.Entity<DmsFileUploadDeleteLogViewEntity>(eb => { eb.HasNoKey(); });
//***END***
}
}
}
@@ -14,14 +14,16 @@ namespace CloudBuilder.Master.Entity
{
}
[Column("allow_delete_indc")]
public string AllowDeleteIndc { get; set; }
[Column("allow_rename_indc")]
public string AllowRenameIndc { get; set; }
[Column("created_by")]
public string CreatedBy { get; set; }
[Column("created_datetime")]
public DateTime CreatedDatetime { get; set; }
[Column("created_by")]
public string CreatedBy { get; set; }
[Column("updated_datetime")]
public DateTime UpdatedDatetime { get; set; }
[Column("updated_by")]
public string UpdatedBy { get; set; }
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("file_id")]
public long FileId { get; set; }
[Column("file_name")]
@@ -30,85 +32,79 @@ namespace CloudBuilder.Master.Entity
public string FilePath { get; set; }
[Column("file_size")]
public int FileSize { get; set; }
[Column("file_tag")]
public string? FileTag { get; set; }
[Column("file_type")]
public string? FileType { get; set; }
[Column("is_directory_indc")]
public string IsDirectoryIndc { get; set; }
[Column("is_link_indc")]
public string IsLinkIndc { get; set; }
[Column("landscape_indc")]
public string? LandscapeIndc { get; set; }
[Column("linked_file_id")]
public int LinkedFileId { get; set; }
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("log_id")]
public int LogId { get; set; }
[Column("order_key")]
public string? OrderKey { get; set; }
[Column("org_file_name")]
public string OrgFileName { get; set; }
[Column("ower_id")]
public string OwerId { get; set; }
[Column("revision_no")]
public int RevisionNo { get; set; }
[Column("is_directory_indc")]
public string IsDirectoryIndc { get; set; }
[Column("is_link_indc")]
public string IsLinkIndc { get; set; }
[Column("linked_file_id")]
public int LinkedFileId { get; set; }
[Column("org_file_name")]
public string OrgFileName { get; set; }
[Column("order_key")]
public string? OrderKey { get; set; }
[Column("file_tag")]
public string? FileTag { get; set; }
[Column("allow_rename_indc")]
public string AllowRenameIndc { get; set; }
[Column("allow_delete_indc")]
public string AllowDeleteIndc { get; set; }
[Column("file_type")]
public string? FileType { get; set; }
[Column("landscape_indc")]
public string? LandscapeIndc { get; set; }
[Column("transcode_indc")]
public string? TranscodeIndc { get; set; }
[Column("updated_by")]
public string UpdatedBy { get; set; }
[Column("updated_datetime")]
public DateTime UpdatedDatetime { get; set; }
public const string ALLOW_DELETE_INDC = "AllowDeleteIndc";
public const string ALLOW_RENAME_INDC = "AllowRenameIndc";
public const string CREATED_BY = "CreatedBy";
public const string CREATED_DATETIME = "CreatedDatetime";
public const string CREATED_BY = "CreatedBy";
public const string UPDATED_DATETIME = "UpdatedDatetime";
public const string UPDATED_BY = "UpdatedBy";
public const string FILE_ID = "FileId";
public const string FILE_NAME = "FileName";
public const string FILE_PATH = "FilePath";
public const string FILE_SIZE = "FileSize";
public const string FILE_TAG = "FileTag";
public const string FILE_TYPE = "FileType";
public const string IS_DIRECTORY_INDC = "IsDirectoryIndc";
public const string IS_LINK_INDC = "IsLinkIndc";
public const string LANDSCAPE_INDC = "LandscapeIndc";
public const string LINKED_FILE_ID = "LinkedFileId";
public const string LOG_ID = "LogId";
public const string ORDER_KEY = "OrderKey";
public const string ORG_FILE_NAME = "OrgFileName";
public const string OWER_ID = "OwerId";
public const string REVISION_NO = "RevisionNo";
public const string IS_DIRECTORY_INDC = "IsDirectoryIndc";
public const string IS_LINK_INDC = "IsLinkIndc";
public const string LINKED_FILE_ID = "LinkedFileId";
public const string ORG_FILE_NAME = "OrgFileName";
public const string ORDER_KEY = "OrderKey";
public const string FILE_TAG = "FileTag";
public const string ALLOW_RENAME_INDC = "AllowRenameIndc";
public const string ALLOW_DELETE_INDC = "AllowDeleteIndc";
public const string FILE_TYPE = "FileType";
public const string LANDSCAPE_INDC = "LandscapeIndc";
public const string TRANSCODE_INDC = "TranscodeIndc";
public const string UPDATED_BY = "UpdatedBy";
public const string UPDATED_DATETIME = "UpdatedDatetime";
public const string DB_NAME_DMS_FILE_DELETE_LOG = "dms_file_delete_log";
public const string DB_NAME_FIELDS="allow_delete_indc,allow_rename_indc,created_by,created_datetime,file_id,file_name,file_path,file_size,file_tag,file_type,is_directory_indc,is_link_indc,landscape_indc,linked_file_id,log_id,order_key,org_file_name,ower_id,revision_no,transcode_indc,updated_by,updated_datetime";
public const string DB_NAME_FIELDS="created_datetime,created_by,updated_datetime,updated_by,file_id,file_name,file_path,file_size,ower_id,revision_no,is_directory_indc,is_link_indc,linked_file_id,org_file_name,order_key,file_tag,allow_rename_indc,allow_delete_indc,file_type,landscape_indc,transcode_indc";
public const string DB_ALLOW_DELETE_INDC = "allow_delete_indc";
public const string DB_ALLOW_RENAME_INDC = "allow_rename_indc";
public const string DB_CREATED_BY = "created_by";
public const string DB_CREATED_DATETIME = "created_datetime";
public const string DB_CREATED_BY = "created_by";
public const string DB_UPDATED_DATETIME = "updated_datetime";
public const string DB_UPDATED_BY = "updated_by";
public const string DB_FILE_ID = "file_id";
public const string DB_FILE_NAME = "file_name";
public const string DB_FILE_PATH = "file_path";
public const string DB_FILE_SIZE = "file_size";
public const string DB_FILE_TAG = "file_tag";
public const string DB_FILE_TYPE = "file_type";
public const string DB_IS_DIRECTORY_INDC = "is_directory_indc";
public const string DB_IS_LINK_INDC = "is_link_indc";
public const string DB_LANDSCAPE_INDC = "landscape_indc";
public const string DB_LINKED_FILE_ID = "linked_file_id";
public const string DB_LOG_ID = "log_id";
public const string DB_ORDER_KEY = "order_key";
public const string DB_ORG_FILE_NAME = "org_file_name";
public const string DB_OWER_ID = "ower_id";
public const string DB_REVISION_NO = "revision_no";
public const string DB_IS_DIRECTORY_INDC = "is_directory_indc";
public const string DB_IS_LINK_INDC = "is_link_indc";
public const string DB_LINKED_FILE_ID = "linked_file_id";
public const string DB_ORG_FILE_NAME = "org_file_name";
public const string DB_ORDER_KEY = "order_key";
public const string DB_FILE_TAG = "file_tag";
public const string DB_ALLOW_RENAME_INDC = "allow_rename_indc";
public const string DB_ALLOW_DELETE_INDC = "allow_delete_indc";
public const string DB_FILE_TYPE = "file_type";
public const string DB_LANDSCAPE_INDC = "landscape_indc";
public const string DB_TRANSCODE_INDC = "transcode_indc";
public const string DB_UPDATED_BY = "updated_by";
public const string DB_UPDATED_DATETIME = "updated_datetime";
private string ProviderName { get; set; }
@@ -129,35 +125,34 @@ namespace CloudBuilder.Master.Entity
throw new NullReferenceException("Source entity is null.");
}
this.AllowDeleteIndc = source.AllowDeleteIndc;
this.AllowRenameIndc = source.AllowRenameIndc;
this.CreatedBy = source.CreatedBy;
this.CreatedDatetime = source.CreatedDatetime;
this.CreatedBy = source.CreatedBy;
this.UpdatedDatetime = source.UpdatedDatetime;
this.UpdatedBy = source.UpdatedBy;
this.FileId = source.FileId;
this.FileName = source.FileName;
this.FilePath = source.FilePath;
this.FileSize = source.FileSize;
this.FileTag = source.FileTag;
this.FileType = source.FileType;
this.IsDirectoryIndc = source.IsDirectoryIndc;
this.IsLinkIndc = source.IsLinkIndc;
this.LandscapeIndc = source.LandscapeIndc;
this.LinkedFileId = source.LinkedFileId;
this.LogId = source.LogId;
this.OrderKey = source.OrderKey;
this.OrgFileName = source.OrgFileName;
this.OwerId = source.OwerId;
this.RevisionNo = source.RevisionNo;
this.IsDirectoryIndc = source.IsDirectoryIndc;
this.IsLinkIndc = source.IsLinkIndc;
this.LinkedFileId = source.LinkedFileId;
this.OrgFileName = source.OrgFileName;
this.OrderKey = source.OrderKey;
this.FileTag = source.FileTag;
this.AllowRenameIndc = source.AllowRenameIndc;
this.AllowDeleteIndc = source.AllowDeleteIndc;
this.FileType = source.FileType;
this.LandscapeIndc = source.LandscapeIndc;
this.TranscodeIndc = source.TranscodeIndc;
this.UpdatedBy = source.UpdatedBy;
this.UpdatedDatetime = source.UpdatedDatetime;
if (includeSystemFields)
{
this.CreatedBy = source.CreatedBy;
this.CreatedDatetime = source.CreatedDatetime;
this.UpdatedBy = source.UpdatedBy;
this.CreatedBy = source.CreatedBy;
this.UpdatedDatetime = source.UpdatedDatetime;
this.UpdatedBy = source.UpdatedBy;
}
}
@@ -229,7 +224,7 @@ namespace CloudBuilder.Master.Entity
public string GetSelectTopFromByMySql(int limit, int start,string orderby,string orderbytag, string sqlWhere)
{
if (string.IsNullOrEmpty(orderbytag) || orderbytag.Trim() != "desc") orderbytag = "asc";
if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_LOG_ID ;
if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_FILE_ID ;
int offset = limit * (start - 1);
return $" select {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_DMS_FILE_DELETE_LOG} where 1=1 {sqlWhere} ) a where num> {offset} LIMIT {limit} ";
}
@@ -237,7 +232,7 @@ namespace CloudBuilder.Master.Entity
public string GetSelectTopFromBySqlServer(int limit, int start,string orderby,string orderbytag, string sqlWhere)
{
if (string.IsNullOrEmpty(orderbytag) || orderbytag.Trim() != "desc") orderbytag = "asc";
if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_LOG_ID ;
if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_FILE_ID ;
string top = limit > 0 ? $"top {limit}" : "";
return $" select {top} {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_DMS_FILE_DELETE_LOG} with(nolock) where 1=1 {sqlWhere} ) a where num> {limit * (start - 1)}";
}
@@ -14,44 +14,44 @@ namespace CloudBuilder.Master.Entity
{
}
[Column("created_by")]
public string CreatedBy { get; set; }
[Column("created_datetime")]
public DateTime CreatedDatetime { get; set; }
[Column("file_category")]
public string FileCategory { get; set; }
[Column("created_by")]
public string CreatedBy { get; set; }
[Column("updated_datetime")]
public DateTime UpdatedDatetime { get; set; }
[Column("updated_by")]
public string UpdatedBy { get; set; }
[Key]
[Column("file_id")]
public long FileId { get; set; }
[Column("org_file_name")]
public string OrgFileName { get; set; }
[Column("updated_by")]
public string UpdatedBy { get; set; }
[Column("updated_datetime")]
public DateTime UpdatedDatetime { get; set; }
[Column("upload_name")]
public string UploadName { get; set; }
[Column("file_category")]
public string FileCategory { get; set; }
[Column("org_file_name")]
public string OrgFileName { get; set; }
public const string CREATED_BY = "CreatedBy";
public const string CREATED_DATETIME = "CreatedDatetime";
public const string FILE_CATEGORY = "FileCategory";
public const string FILE_ID = "FileId";
public const string ORG_FILE_NAME = "OrgFileName";
public const string UPDATED_BY = "UpdatedBy";
public const string CREATED_BY = "CreatedBy";
public const string UPDATED_DATETIME = "UpdatedDatetime";
public const string UPDATED_BY = "UpdatedBy";
public const string FILE_ID = "FileId";
public const string UPLOAD_NAME = "UploadName";
public const string FILE_CATEGORY = "FileCategory";
public const string ORG_FILE_NAME = "OrgFileName";
public const string DB_NAME_DMS_FILE_UPLOAD_DELETE_LOG = "dms_file_upload_delete_log";
public const string DB_NAME_FIELDS="created_by,created_datetime,file_category,file_id,org_file_name,updated_by,updated_datetime,upload_name";
public const string DB_NAME_FIELDS="created_datetime,created_by,updated_datetime,updated_by,file_id,upload_name,file_category,org_file_name";
public const string DB_CREATED_BY = "created_by";
public const string DB_CREATED_DATETIME = "created_datetime";
public const string DB_FILE_CATEGORY = "file_category";
public const string DB_FILE_ID = "file_id";
public const string DB_ORG_FILE_NAME = "org_file_name";
public const string DB_UPDATED_BY = "updated_by";
public const string DB_CREATED_BY = "created_by";
public const string DB_UPDATED_DATETIME = "updated_datetime";
public const string DB_UPDATED_BY = "updated_by";
public const string DB_FILE_ID = "file_id";
public const string DB_UPLOAD_NAME = "upload_name";
public const string DB_FILE_CATEGORY = "file_category";
public const string DB_ORG_FILE_NAME = "org_file_name";
private string ProviderName { get; set; }
@@ -72,21 +72,21 @@ namespace CloudBuilder.Master.Entity
throw new NullReferenceException("Source entity is null.");
}
this.CreatedBy = source.CreatedBy;
this.CreatedDatetime = source.CreatedDatetime;
this.FileCategory = source.FileCategory;
this.FileId = source.FileId;
this.OrgFileName = source.OrgFileName;
this.UpdatedBy = source.UpdatedBy;
this.CreatedBy = source.CreatedBy;
this.UpdatedDatetime = source.UpdatedDatetime;
this.UpdatedBy = source.UpdatedBy;
this.FileId = source.FileId;
this.UploadName = source.UploadName;
this.FileCategory = source.FileCategory;
this.OrgFileName = source.OrgFileName;
if (includeSystemFields)
{
this.CreatedBy = source.CreatedBy;
this.CreatedDatetime = source.CreatedDatetime;
this.UpdatedBy = source.UpdatedBy;
this.CreatedBy = source.CreatedBy;
this.UpdatedDatetime = source.UpdatedDatetime;
this.UpdatedBy = source.UpdatedBy;
}
}
@@ -14,102 +14,102 @@ namespace CloudBuilder.Master.Entity
{
}
[Column("allow_delete_indc")]
public string AllowDeleteIndc { get; set; }
[Column("allow_rename_indc")]
public string AllowRenameIndc { get; set; }
[Column("created_by")]
public string CreatedBy { get; set; }
[Column("created_datetime")]
public DateTime CreatedDatetime { get; set; }
[Column("file_category")]
public string FileCategory { get; set; }
[Column("created_by")]
public string CreatedBy { get; set; }
[Column("file_id")]
public long FileId { get; set; }
[Column("upload_name")]
public string UploadName { get; set; }
[Column("file_category")]
public string FileCategory { get; set; }
[Column("org_file_name")]
public string OrgFileName { get; set; }
[Column("file_name")]
public string FileName { get; set; }
[Column("file_path")]
public string FilePath { get; set; }
[Column("file_size")]
public int FileSize { get; set; }
[Column("file_tag")]
public string? FileTag { get; set; }
[Column("file_type")]
public string? FileType { get; set; }
[Column("folder_local_name")]
public string? FolderLocalName { get; set; }
[Column("is_directory_indc")]
public string IsDirectoryIndc { get; set; }
[Column("is_link_indc")]
public string IsLinkIndc { get; set; }
[Column("landscape_indc")]
public string? LandscapeIndc { get; set; }
[Column("linked_file_id")]
public int LinkedFileId { get; set; }
[Column("order_key")]
public string? OrderKey { get; set; }
[Column("org_file_name")]
public string OrgFileName { get; set; }
[Column("file_size")]
public int FileSize { get; set; }
[Column("ower_id")]
public string OwerId { get; set; }
[Column("revision_no")]
public int RevisionNo { get; set; }
[Column("is_directory_indc")]
public string IsDirectoryIndc { get; set; }
[Column("is_link_indc")]
public string IsLinkIndc { get; set; }
[Column("linked_file_id")]
public int LinkedFileId { get; set; }
[Column("order_key")]
public string? OrderKey { get; set; }
[Column("file_tag")]
public string? FileTag { get; set; }
[Column("allow_rename_indc")]
public string AllowRenameIndc { get; set; }
[Column("allow_delete_indc")]
public string AllowDeleteIndc { get; set; }
[Column("file_type")]
public string? FileType { get; set; }
[Column("landscape_indc")]
public string? LandscapeIndc { get; set; }
[Column("transcode_indc")]
public string? TranscodeIndc { get; set; }
[Column("upload_name")]
public string UploadName { get; set; }
[Column("url")]
public string Url { get; set; }
public const string ALLOW_DELETE_INDC = "AllowDeleteIndc";
public const string ALLOW_RENAME_INDC = "AllowRenameIndc";
public const string CREATED_BY = "CreatedBy";
public const string CREATED_DATETIME = "CreatedDatetime";
public const string FILE_CATEGORY = "FileCategory";
public const string CREATED_BY = "CreatedBy";
public const string FILE_ID = "FileId";
public const string UPLOAD_NAME = "UploadName";
public const string FILE_CATEGORY = "FileCategory";
public const string ORG_FILE_NAME = "OrgFileName";
public const string FILE_NAME = "FileName";
public const string FILE_PATH = "FilePath";
public const string FILE_SIZE = "FileSize";
public const string FILE_TAG = "FileTag";
public const string FILE_TYPE = "FileType";
public const string FOLDER_LOCAL_NAME = "FolderLocalName";
public const string IS_DIRECTORY_INDC = "IsDirectoryIndc";
public const string IS_LINK_INDC = "IsLinkIndc";
public const string LANDSCAPE_INDC = "LandscapeIndc";
public const string LINKED_FILE_ID = "LinkedFileId";
public const string ORDER_KEY = "OrderKey";
public const string ORG_FILE_NAME = "OrgFileName";
public const string FILE_SIZE = "FileSize";
public const string OWER_ID = "OwerId";
public const string REVISION_NO = "RevisionNo";
public const string IS_DIRECTORY_INDC = "IsDirectoryIndc";
public const string IS_LINK_INDC = "IsLinkIndc";
public const string LINKED_FILE_ID = "LinkedFileId";
public const string ORDER_KEY = "OrderKey";
public const string FILE_TAG = "FileTag";
public const string ALLOW_RENAME_INDC = "AllowRenameIndc";
public const string ALLOW_DELETE_INDC = "AllowDeleteIndc";
public const string FILE_TYPE = "FileType";
public const string LANDSCAPE_INDC = "LandscapeIndc";
public const string TRANSCODE_INDC = "TranscodeIndc";
public const string UPLOAD_NAME = "UploadName";
public const string URL = "Url";
public const string DB_NAME_DMS_FILE_UPLOAD_DELETE_LOG_VIEW = "dms_file_upload_delete_log_view";
public const string DB_NAME_FIELDS="allow_delete_indc,allow_rename_indc,created_by,created_datetime,file_category,file_id,file_name,file_path,file_size,file_tag,file_type,folder_local_name,is_directory_indc,is_link_indc,landscape_indc,linked_file_id,order_key,org_file_name,ower_id,revision_no,transcode_indc,upload_name,url";
public const string DB_NAME_FIELDS="created_datetime,created_by,file_id,upload_name,file_category,org_file_name,file_name,file_path,folder_local_name,file_size,ower_id,revision_no,is_directory_indc,is_link_indc,linked_file_id,order_key,file_tag,allow_rename_indc,allow_delete_indc,file_type,landscape_indc,transcode_indc,url";
public const string DB_ALLOW_DELETE_INDC = "allow_delete_indc";
public const string DB_ALLOW_RENAME_INDC = "allow_rename_indc";
public const string DB_CREATED_BY = "created_by";
public const string DB_CREATED_DATETIME = "created_datetime";
public const string DB_FILE_CATEGORY = "file_category";
public const string DB_CREATED_BY = "created_by";
public const string DB_FILE_ID = "file_id";
public const string DB_UPLOAD_NAME = "upload_name";
public const string DB_FILE_CATEGORY = "file_category";
public const string DB_ORG_FILE_NAME = "org_file_name";
public const string DB_FILE_NAME = "file_name";
public const string DB_FILE_PATH = "file_path";
public const string DB_FILE_SIZE = "file_size";
public const string DB_FILE_TAG = "file_tag";
public const string DB_FILE_TYPE = "file_type";
public const string DB_FOLDER_LOCAL_NAME = "folder_local_name";
public const string DB_IS_DIRECTORY_INDC = "is_directory_indc";
public const string DB_IS_LINK_INDC = "is_link_indc";
public const string DB_LANDSCAPE_INDC = "landscape_indc";
public const string DB_LINKED_FILE_ID = "linked_file_id";
public const string DB_ORDER_KEY = "order_key";
public const string DB_ORG_FILE_NAME = "org_file_name";
public const string DB_FILE_SIZE = "file_size";
public const string DB_OWER_ID = "ower_id";
public const string DB_REVISION_NO = "revision_no";
public const string DB_IS_DIRECTORY_INDC = "is_directory_indc";
public const string DB_IS_LINK_INDC = "is_link_indc";
public const string DB_LINKED_FILE_ID = "linked_file_id";
public const string DB_ORDER_KEY = "order_key";
public const string DB_FILE_TAG = "file_tag";
public const string DB_ALLOW_RENAME_INDC = "allow_rename_indc";
public const string DB_ALLOW_DELETE_INDC = "allow_delete_indc";
public const string DB_FILE_TYPE = "file_type";
public const string DB_LANDSCAPE_INDC = "landscape_indc";
public const string DB_TRANSCODE_INDC = "transcode_indc";
public const string DB_UPLOAD_NAME = "upload_name";
public const string DB_URL = "url";
private string ProviderName { get; set; }
@@ -131,34 +131,34 @@ namespace CloudBuilder.Master.Entity
throw new NullReferenceException("Source entity is null.");
}
this.AllowDeleteIndc = source.AllowDeleteIndc;
this.AllowRenameIndc = source.AllowRenameIndc;
this.CreatedBy = source.CreatedBy;
this.CreatedDatetime = source.CreatedDatetime;
this.FileCategory = source.FileCategory;
this.CreatedBy = source.CreatedBy;
this.FileId = source.FileId;
this.UploadName = source.UploadName;
this.FileCategory = source.FileCategory;
this.OrgFileName = source.OrgFileName;
this.FileName = source.FileName;
this.FilePath = source.FilePath;
this.FileSize = source.FileSize;
this.FileTag = source.FileTag;
this.FileType = source.FileType;
this.FolderLocalName = source.FolderLocalName;
this.IsDirectoryIndc = source.IsDirectoryIndc;
this.IsLinkIndc = source.IsLinkIndc;
this.LandscapeIndc = source.LandscapeIndc;
this.LinkedFileId = source.LinkedFileId;
this.OrderKey = source.OrderKey;
this.OrgFileName = source.OrgFileName;
this.FileSize = source.FileSize;
this.OwerId = source.OwerId;
this.RevisionNo = source.RevisionNo;
this.IsDirectoryIndc = source.IsDirectoryIndc;
this.IsLinkIndc = source.IsLinkIndc;
this.LinkedFileId = source.LinkedFileId;
this.OrderKey = source.OrderKey;
this.FileTag = source.FileTag;
this.AllowRenameIndc = source.AllowRenameIndc;
this.AllowDeleteIndc = source.AllowDeleteIndc;
this.FileType = source.FileType;
this.LandscapeIndc = source.LandscapeIndc;
this.TranscodeIndc = source.TranscodeIndc;
this.UploadName = source.UploadName;
this.Url = source.Url;
if (includeSystemFields)
{
this.CreatedBy = source.CreatedBy;
this.CreatedDatetime = source.CreatedDatetime;
this.CreatedBy = source.CreatedBy;
}
}
@@ -231,7 +231,7 @@ namespace CloudBuilder.Master.Entity
{
if (string.IsNullOrEmpty(orderbytag) || orderbytag.Trim() != "desc") orderbytag = "asc";
if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_ALLOW_DELETE_INDC ; int offset = limit * (start - 1);
if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_CREATED_DATETIME ; int offset = limit * (start - 1);
return $" select {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_DMS_FILE_UPLOAD_DELETE_LOG_VIEW} where 1=1 {sqlWhere} ) a where num> {offset} LIMIT {limit} ";
}
@@ -239,7 +239,7 @@ namespace CloudBuilder.Master.Entity
{
if (string.IsNullOrEmpty(orderbytag) || orderbytag.Trim() != "desc") orderbytag = "asc";
if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_ALLOW_DELETE_INDC ; string top = limit > 0 ? $"top {limit}" : "";
if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_CREATED_DATETIME ; string top = limit > 0 ? $"top {limit}" : "";
return $" select {top} {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_DMS_FILE_UPLOAD_DELETE_LOG_VIEW} with(nolock) where 1=1 {sqlWhere} ) a where num> {limit * (start - 1)}";
}
@@ -14,45 +14,41 @@ namespace CloudBuilder.Master.Entity
{
}
[Column("created_by")]
public string CreatedBy { get; set; }
[Column("created_datetime")]
public DateTime CreatedDatetime { get; set; }
[Column("folder_id")]
public int FolderId { get; set; }
[Column("folder_local_name")]
public string? FolderLocalName { get; set; }
[Column("folder_name")]
public string FolderName { get; set; }
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("log_id")]
public long LogId { get; set; }
[Column("updated_by")]
public string UpdatedBy { get; set; }
[Column("created_by")]
public string CreatedBy { get; set; }
[Column("updated_datetime")]
public DateTime UpdatedDatetime { get; set; }
[Column("updated_by")]
public string UpdatedBy { get; set; }
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("folder_id")]
public long FolderId { get; set; }
[Column("folder_name")]
public string FolderName { get; set; }
[Column("folder_local_name")]
public string? FolderLocalName { get; set; }
public const string CREATED_BY = "CreatedBy";
public const string CREATED_DATETIME = "CreatedDatetime";
public const string FOLDER_ID = "FolderId";
public const string FOLDER_LOCAL_NAME = "FolderLocalName";
public const string FOLDER_NAME = "FolderName";
public const string LOG_ID = "LogId";
public const string UPDATED_BY = "UpdatedBy";
public const string CREATED_BY = "CreatedBy";
public const string UPDATED_DATETIME = "UpdatedDatetime";
public const string UPDATED_BY = "UpdatedBy";
public const string FOLDER_ID = "FolderId";
public const string FOLDER_NAME = "FolderName";
public const string FOLDER_LOCAL_NAME = "FolderLocalName";
public const string DB_NAME_DMS_FOLDER_DELETE_LOG = "dms_folder_delete_log";
public const string DB_NAME_FIELDS="created_by,created_datetime,folder_id,folder_local_name,folder_name,log_id,updated_by,updated_datetime";
public const string DB_NAME_FIELDS="created_datetime,created_by,updated_datetime,updated_by,folder_id,folder_name,folder_local_name";
public const string DB_CREATED_BY = "created_by";
public const string DB_CREATED_DATETIME = "created_datetime";
public const string DB_FOLDER_ID = "folder_id";
public const string DB_FOLDER_LOCAL_NAME = "folder_local_name";
public const string DB_FOLDER_NAME = "folder_name";
public const string DB_LOG_ID = "log_id";
public const string DB_UPDATED_BY = "updated_by";
public const string DB_CREATED_BY = "created_by";
public const string DB_UPDATED_DATETIME = "updated_datetime";
public const string DB_UPDATED_BY = "updated_by";
public const string DB_FOLDER_ID = "folder_id";
public const string DB_FOLDER_NAME = "folder_name";
public const string DB_FOLDER_LOCAL_NAME = "folder_local_name";
private string ProviderName { get; set; }
@@ -73,21 +69,20 @@ namespace CloudBuilder.Master.Entity
throw new NullReferenceException("Source entity is null.");
}
this.CreatedBy = source.CreatedBy;
this.CreatedDatetime = source.CreatedDatetime;
this.FolderId = source.FolderId;
this.FolderLocalName = source.FolderLocalName;
this.FolderName = source.FolderName;
this.LogId = source.LogId;
this.UpdatedBy = source.UpdatedBy;
this.CreatedBy = source.CreatedBy;
this.UpdatedDatetime = source.UpdatedDatetime;
this.UpdatedBy = source.UpdatedBy;
this.FolderId = source.FolderId;
this.FolderName = source.FolderName;
this.FolderLocalName = source.FolderLocalName;
if (includeSystemFields)
{
this.CreatedBy = source.CreatedBy;
this.CreatedDatetime = source.CreatedDatetime;
this.UpdatedBy = source.UpdatedBy;
this.CreatedBy = source.CreatedBy;
this.UpdatedDatetime = source.UpdatedDatetime;
this.UpdatedBy = source.UpdatedBy;
}
}
@@ -159,7 +154,7 @@ namespace CloudBuilder.Master.Entity
public string GetSelectTopFromByMySql(int limit, int start,string orderby,string orderbytag, string sqlWhere)
{
if (string.IsNullOrEmpty(orderbytag) || orderbytag.Trim() != "desc") orderbytag = "asc";
if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_LOG_ID ;
if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_FOLDER_ID ;
int offset = limit * (start - 1);
return $" select {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_DMS_FOLDER_DELETE_LOG} where 1=1 {sqlWhere} ) a where num> {offset} LIMIT {limit} ";
}
@@ -167,7 +162,7 @@ namespace CloudBuilder.Master.Entity
public string GetSelectTopFromBySqlServer(int limit, int start,string orderby,string orderbytag, string sqlWhere)
{
if (string.IsNullOrEmpty(orderbytag) || orderbytag.Trim() != "desc") orderbytag = "asc";
if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_LOG_ID ;
if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_FOLDER_ID ;
string top = limit > 0 ? $"top {limit}" : "";
return $" select {top} {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_DMS_FOLDER_DELETE_LOG} with(nolock) where 1=1 {sqlWhere} ) a where num> {limit * (start - 1)}";
}
@@ -14,39 +14,39 @@ namespace CloudBuilder.Master.Entity
{
}
[Column("created_by")]
public string CreatedBy { get; set; }
[Column("created_datetime")]
public DateTime CreatedDatetime { get; set; }
[Column("created_by")]
public string CreatedBy { get; set; }
[Column("updated_datetime")]
public DateTime UpdatedDatetime { get; set; }
[Column("updated_by")]
public string UpdatedBy { get; set; }
[Column("folder_name_parent")]
public string FolderNameParent { get; set; }
[Column("folder_name_son")]
public string FolderNameSon { get; set; }
[Column("orderby")]
public int Orderby { get; set; }
[Column("updated_by")]
public string UpdatedBy { get; set; }
[Column("updated_datetime")]
public DateTime UpdatedDatetime { get; set; }
public const string CREATED_BY = "CreatedBy";
public const string CREATED_DATETIME = "CreatedDatetime";
public const string CREATED_BY = "CreatedBy";
public const string UPDATED_DATETIME = "UpdatedDatetime";
public const string UPDATED_BY = "UpdatedBy";
public const string FOLDER_NAME_PARENT = "FolderNameParent";
public const string FOLDER_NAME_SON = "FolderNameSon";
public const string ORDERBY = "Orderby";
public const string UPDATED_BY = "UpdatedBy";
public const string UPDATED_DATETIME = "UpdatedDatetime";
public const string DB_NAME_DMS_FOLDER_MAP_DELETE_LOG = "dms_folder_map_delete_log";
public const string DB_NAME_FIELDS="created_by,created_datetime,folder_name_parent,folder_name_son,orderby,updated_by,updated_datetime";
public const string DB_NAME_FIELDS="created_datetime,created_by,updated_datetime,updated_by,folder_name_parent,folder_name_son,orderby";
public const string DB_CREATED_BY = "created_by";
public const string DB_CREATED_DATETIME = "created_datetime";
public const string DB_CREATED_BY = "created_by";
public const string DB_UPDATED_DATETIME = "updated_datetime";
public const string DB_UPDATED_BY = "updated_by";
public const string DB_FOLDER_NAME_PARENT = "folder_name_parent";
public const string DB_FOLDER_NAME_SON = "folder_name_son";
public const string DB_ORDERBY = "orderby";
public const string DB_UPDATED_BY = "updated_by";
public const string DB_UPDATED_DATETIME = "updated_datetime";
private string ProviderName { get; set; }
@@ -67,20 +67,20 @@ namespace CloudBuilder.Master.Entity
throw new NullReferenceException("Source entity is null.");
}
this.CreatedBy = source.CreatedBy;
this.CreatedDatetime = source.CreatedDatetime;
this.CreatedBy = source.CreatedBy;
this.UpdatedDatetime = source.UpdatedDatetime;
this.UpdatedBy = source.UpdatedBy;
this.FolderNameParent = source.FolderNameParent;
this.FolderNameSon = source.FolderNameSon;
this.Orderby = source.Orderby;
this.UpdatedBy = source.UpdatedBy;
this.UpdatedDatetime = source.UpdatedDatetime;
if (includeSystemFields)
{
this.CreatedBy = source.CreatedBy;
this.CreatedDatetime = source.CreatedDatetime;
this.UpdatedBy = source.UpdatedBy;
this.CreatedBy = source.CreatedBy;
this.UpdatedDatetime = source.UpdatedDatetime;
this.UpdatedBy = source.UpdatedBy;
}
}
@@ -36,5 +36,13 @@ namespace CloudBuilder.Master.Policy
public const string AUDIO_PUBLISH = "AUDIO_PUBLISH";
public const string AUDIO_PUBLISH_PUBLISH_NAME = "PUBLISH_NAME";
public const string DMS_FOLDER_DELETE_LOG = "DMS_FOLDER_DELETE_LOG";
public const string DMS_FOLDER_DELETE_LOG_FOLDER_NAME = "FOLDER_NAME";
public const string UPLOAD_DMS_FILE_DELETE_LOG = "DMS_FOLDER_DELETE_LOG";
public const string UPLOAD_DMS_FILE_DELETE_LOG_UPLOAD_NAME = "UPLOAD_NAME";
public const string UPLOAD_DMS_FILE_DELETE_LOG_FORMAT = "00000000";
}
}
@@ -17,6 +17,7 @@ namespace CloudBuilder.Master.Service
DmsFileEntity CreateDmsFile(DmsFileEntity dmsFile);
string CreateDmsFolder(DmsFileEntity dmsFile);
void RestoreDmsFile(long fileId);
void UpdateDmsFolder(DmsFileEntity dmsFile);
@@ -63,6 +63,10 @@ return Task.Run(() => serviceRequest.PostAsJsonAsync<DmsFileEntity,DmsFileEnti
{
Task.Run(() => serviceRequest.PostAsync("/DmsFile/Delete?key=" + key.ToString())).GetAwaiter().GetResult(); }
public void RestoreDmsFile(Int64 key)
{
Task.Run(() => serviceRequest.PostAsync("/DmsFile/RestoreDmsFile?key=" + key.ToString())).GetAwaiter().GetResult(); }
public void DeleteLog(Int64 key)
{
Task.Run(() => serviceRequest.PostAsync("/DmsFile/DeleteLog?key=" + key.ToString())).GetAwaiter().GetResult(); }
@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="A" xml:space="preserve">
<value>Audio</value>
</data>
<data name="D" xml:space="preserve">
<value>Document</value>
</data>
<data name="L" xml:space="preserve">
<value>Lyric</value>
</data>
<data name="P" xml:space="preserve">
<value>Picture</value>
</data>
<data name="V" xml:space="preserve">
<value>Video</value>
</data>
</root>
@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="A" xml:space="preserve">
<value>音频</value>
</data>
<data name="D" xml:space="preserve">
<value>文档</value>
</data>
<data name="L" xml:space="preserve">
<value>歌词</value>
</data>
<data name="P" xml:space="preserve">
<value>图片</value>
</data>
<data name="V" xml:space="preserve">
<value>视频</value>
</data>
</root>
@@ -219,6 +219,26 @@ this.dmsFileService= dmsFileService;
{
dmsFileService.Delete(key);
return string.Empty;
}
catch (ValidatedException vex)
{
return vex;
}
catch (Exception ex)
{
return new ServiceErrorException(ex);
}
}
[PermissionOperate(name: "DmsFile", operate: "Insert")]
[HttpPost]
[UnitOfWork]
public dynamic RestoreDmsFile(Int64 key){
try
{
dmsFileService.RestoreDmsFile(key);
return string.Empty;
}
catch (ValidatedException vex)
@@ -0,0 +1,223 @@
<template>
<div class="operator-station">
<div class="operator-group selection-actions" v-if="hasSelection">
<template v-if="true">
<a-tooltip title="下载" v-if="!isDirectorySelected && isSingleItem">
<a-button type="text" :icon="h(DownloadOutlined)" :disabled="!canAmend"
@click="onDownload">下载</a-button>
</a-tooltip>
<a-tooltip title="还原" >
<a-button type="text" :icon="h(UndoOutlined)" :disabled="!canDelete"
@click="$emit('restore', selectedItems)" >还原</a-button>
</a-tooltip>
<a-tooltip title="删除">
<a-button type="text" :icon="h(DeleteOutlined)" :disabled="!canCreate"
@click="$emit('delete', selectedItems)">彻底删除</a-button>
</a-tooltip>
<template v-if="isSingleVideo">
<a-tooltip title="播放">
<a-button type="text" :icon="h(PlayCircleOutlined, { style: { color: 'red' } })"
@click="onPlayVideo">播放</a-button>
</a-tooltip>
</template>
<template v-if="isSingleAudio">
<a-tooltip v-if="selectedItem.IsPlay != 'Y'" title="播放">
<a-button type="text" :icon="h(PlayCircleOutlined, { style: { color: 'red' } })"
@click="onPlayAudio">播放</a-button>
</a-tooltip>
<a-tooltip v-else-if="selectedItem.IsPause != 'Y'" title="暂停">
<a-button type="text" :icon="h(PauseCircleOutlined)" @click="onPauseAudio">暂停</a-button>
</a-tooltip>
<a-tooltip v-else title="继续">
<a-button type="text" :icon="h(PlayCircleOutlined, { style: { color: 'red' } })"
@click="onContinueAudio">继续</a-button>
</a-tooltip>
</template>
</template>
</div>
<a-divider type="vertical" v-if="hasSelection" />
<div style="display: none">
<a-upload v-if="canCreate" v-model:file-list="fileList" name="file" :before-upload="onBeforeUpload"
:headers="headers" :show-upload-list="false" :action="uploadUrl" ref="uploadRef">
</a-upload>
</div>
</div>
</template>
<script setup lang="ts">
import { computed, ref, h } from "vue";
import {
UploadOutlined,
FolderAddOutlined,
DownloadOutlined,
ShareAltOutlined,
NotificationOutlined,
UnorderedListOutlined,
PlayCircleOutlined,
PauseCircleOutlined,
EyeOutlined,
EditOutlined,
ScissorOutlined,
DeleteOutlined,
UndoOutlined,
DownOutlined,
} from "@ant-design/icons-vue";
import { DmsFileUploadViewDisplayData } from "@/data/auto/dmsFileUploadViewDisplayData";
import type { UploadProps } from "ant-design-vue";
const props = defineProps<{
selectedItems: DmsFileUploadViewDisplayData[];
uploadUrl: string;
headers: any;
canCreate: boolean;
canAmend: boolean;
canDelete: boolean;
canView: boolean;
}>();
const emit = defineEmits([
"create-folder",
"before-upload",
"download",
"share",
"publish",
"view-preview",
"play-video",
"play-audio",
"pause-audio",
"continue-audio",
"preview",
"rename",
"move",
"delete",
"restore",
]);
const fileList = ref<UploadProps["fileList"]>([]);
const uploadRef = ref<any>(null);
const hasSelection = computed(() => props.selectedItems.length > 0);
const isDirectorySelected = computed(() =>
props.selectedItems.some((s) => s.IsDirectoryIndc == "Y"),
);
const isSingleItem = computed(() => props.selectedItems.length === 1);
const selectedItem = computed(() => {
return props.selectedItems[0] || ({} as DmsFileUploadViewDisplayData);
});
const selectedOrderKey = computed(() => {
return selectedItem.value?.OrderKey || selectedItem.value?.OrgFileName || "";
});
const isImage = (key: string) => {
if (!key) return false;
return /\.(png|jpe?g|gif|bmp|webp)$/i.test(key);
};
const isVideo = (key: string) => {
if (!key) return false;
return /\.(mp4|m3u8|rm|mpeg|mov|wmv|avi)$/i.test(key);
};
const isAudio = (key: string) => {
if (!key) return false;
return /\.(mp3|wav|flac|aac|ogg|wma)$/i.test(key);
};
const isSingleVideo = computed(() => {
return isSingleItem.value && isVideo(selectedOrderKey.value);
});
const isSingleAudio = computed(() => {
return isSingleItem.value && isAudio(selectedOrderKey.value);
});
const publishTooltip = computed(() => {
if (isImage(selectedOrderKey.value)) return "发布相册";
if (isVideo(selectedOrderKey.value)) return "发布影视专辑";
if (isAudio(selectedOrderKey.value)) return "发布音乐专辑";
return "发布";
});
const previewTooltip = computed(() => {
if (isImage(selectedOrderKey.value)) return "相册展览";
if (isVideo(selectedOrderKey.value)) return "影视厅播放";
if (isAudio(selectedOrderKey.value)) return "音乐厅播放";
return "预览";
});
const triggerUpload = () => {
uploadRef.value?.$el?.querySelector("input")?.click();
};
const onBeforeUpload: UploadProps["beforeUpload"] = (file) => {
emit("before-upload", file);
return false;
};
const onDownload = () => {
emit("download", props.selectedItems);
};
const onShare = () => {
emit("share", props.selectedItems);
};
const onPublish = () => {
emit("publish", props.selectedItems);
};
const onViewPreview = () => {
emit("view-preview", props.selectedItems);
};
const onPlayVideo = () => {
emit("play-video", selectedItem.value);
};
const onPlayAudio = () => {
emit("play-audio", selectedItem.value);
};
const onPauseAudio = () => {
emit("pause-audio", selectedItem.value);
};
const onContinueAudio = () => {
emit("continue-audio", selectedItem.value);
};
</script>
<style scoped>
.operator-station {
display: flex;
align-items: center;
padding: 6px 12px;
background: #fafafa;
border-bottom: 1px solid #e8e8e8;
gap: 8px;
flex-wrap: wrap;
}
.operator-group {
display: flex;
align-items: center;
gap: 4px;
}
.main-actions :deep(.ant-btn) {
height: 32px;
}
.selection-actions :deep(.ant-btn) {
padding: 4px 8px;
font-size: 16px;
}
</style>
@@ -112,6 +112,16 @@ class DmsFileService{
)
};
async RestoreDmsFile(data: number) {
return request<any>(
{
url: "/DmsFile/RestoreDmsFile?key="+data,
method: "post",
data,
}
)
};
async DeleteLog(data: number) {
return request<any>(
{
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,912 @@
<template>
<a-spin size="large" :spinning="loading">
<search
@on-submit="onSubmit"
@on-print="onPrint"
@on-reset="onReset"
@use-pagination="onPagination"
rowSelectionType="checkbox"
:scrollx="200"
:loading="loading"
:pagination="result"
@on-select-change="onSelectChange"
>
<template #control> </template>
<template #headerCell="{ column }">
<template
v-if="column.dataIndex === DmsFileUploadDeleteLogViewDisplayData.URL"
>
<span
style="color: darkgoldenrod; font-size: large; cursor: pointer"
@click.prevent="onChangeFolder(rootPath)"
>
<LaptopOutlined
style="color: darkgoldenrod; font-size: larger"
title="返回顶层"
/>返回顶层
</span>
</template>
</template>
<template #bodyCell="{ column, record, index }">
<template
v-if="column.dataIndex === DmsFileUploadDeleteLogViewDisplayData.URL"
>
<template v-if="!fileTypePolicy.isImage(record.OrderKey)">
<template v-if="record.IsDirectoryIndc == 'Y'">
<a-card hoverable style="width: 300px">
<a-card-meta>
<template #description>
<span
style="
color: darkgoldenrod;
margin-left: 4pxr;
cursor: pointer;
font-size: 26px;
"
@click.prevent="onChangeFolder(record.FileName)"
>
<FolderOutlined
style="color: darkgoldenrod; font-size: 48px"
title="打开文件夹"
/>{{ record.OrgFileName }}
</span>
</template>
</a-card-meta>
<template #actions> </template>
</a-card>
</template>
<template v-else-if="fileTypePolicy.isVideo(record.OrderKey)">
<a-card style="width: 300px">
<template #cover>
<img
style="height: 200px"
:src="record.FormattedPic.replace('.m3u8', '.png')"
:title="record.OrgFileName"
/>
</template>
<a-card-meta>
<template #description>
<a-flex>
<cust-icon-font
size="26"
type="icon-foldervideo"
v-if="record.TranscodeIndc == 'Y'"
@click.prevent="
onUrlVideoPlay(record.Url, record.OrgFileName)
"
/>
<cust-icon-font
v-else
size="26"
type="icon-mp3-play"
@click.prevent="onVideoPlay(record.FileId)"
/>
<span
style="
color: darkgoldenrod;
margin-left: 4pxr;
margin-top: 2px;
"
>
{{ record.OrgFileName }}
</span>
</a-flex>
</template>
</a-card-meta>
<template #actions> </template>
</a-card>
</template>
<template v-else>
<DownloadOutlined
style="color: rgb(19, 185, 190); font-size: larger"
title="下载"
@click.prevent="
onDownloadFile(record.FileId, record.OrgFileName)
"
/>
<span>{{ record.OrgFileName }}</span>
</template>
</template>
<template v-else>
<a-card hoverable style="width: 300px">
<template #cover>
<img
style="height: 200px"
:src="record.Url"
:title="record.OrgFileName"
@click.prevent="
onViewPictureFile(record.FileId, record.OrgFileName)
"
/>
</template>
<a-card-meta>
<template #description>
<span style="color: darkgoldenrod; margin-left: 4pxr">
<DownloadOutlined
style="color: rgb(19, 185, 190); font-size: larger"
title="原图下载"
@click.prevent="
onDownloadFile(record.FileId, record.OrgFileName)
"
/>
{{ record.OrgFileName }}
</span>
</template>
</a-card-meta>
<template #actions> </template>
</a-card>
</template>
</template>
</template>
<template #footer>
<div class="page-footer">
<a-row :gutter="24">
<a-col :lg="24" :sm="24">
<a-row v-if="isEdit" :gutter="[16, 8]">
<a-space>
<a-button type="primary" @click.prevent="onCancel"
>取消</a-button
>
<a-button type="primary" @click.prevent="onSave"
>确定</a-button
>
</a-space>
</a-row>
<a-row v-if="!isEdit" :gutter="[16, 8]">
<a-space>
<!-- <a-button type="primary" v-if="canAmend" :icon="h(FileImageOutlined)"
:disabled="!(keys && keys.length > 0)" @click.prevent="onViewPic">预览</a-button> -->
<a-popconfirm
title="确定是否删除记录?"
ok-text="是"
cancel-text="否"
@confirm="onDelete"
>
<a-button
type="primary"
danger
:icon="h(DeleteOutlined)"
v-if="canDelete"
:disabled="!(keys && keys.length > 0)"
>永久删除</a-button
>
</a-popconfirm>
</a-space>
</a-row>
</a-col>
</a-row>
</div>
</template>
</search>
<a-image
:width="1024"
:style="{ display: 'none' }"
:preview="{
visible,
onVisibleChange: setPicVisible,
}"
:src="imageSrc"
/>
<dmsFolder @on-submit="onReload"></dmsFolder>
<videoPlay></videoPlay>
</a-spin>
</template>
<script setup lang="ts">
import {
reactive,
inject,
defineComponent,
onMounted,
ref,
unref,
provide,
h,
} from "vue";
import { BindOption } from "@/data/custom/bindOption";
import { SelectOption } from "@/data/auto/selectOption";
import search from "@/components/basic/Search.vue";
import {
DeleteOutlined,
PictureOutlined,
LaptopOutlined,
ScissorOutlined,
UploadOutlined,
FolderAddOutlined,
DownloadOutlined,
FolderOutlined,
FileImageOutlined,
} from "@ant-design/icons-vue";
import { DmsFileEntity } from "@/data/auto/dmsFileEntity";
import { DmsFileResultData } from "@/data/auto/dmsFileResultData";
import { DmsFileUploadDeleteLogViewDisplayData } from "@/data/auto/dmsFileUploadDeleteLogViewDisplayData";
import { SearchFilter } from "@/data/auto/searchFilter";
import dmsFileService from "@/service/master/dmsFileService";
import { DmsFileSearchCriteria } from "@/data/auto/dmsFileSearchCriteria";
import { SearchCriteriaResultData } from "@/data/auto/searchCriteriaResultData";
import {
PermissionContext,
usePermissionContext,
} from "@/hooks/PermissionContext";
import { useRoute, useRouter } from "vue-router";
import { useBindOption } from "@/hooks/useBindOption";
import { SearchFilterOperatorPolicy } from "@/data/custom/searchFilterOperatorPolicy";
import { SearchFilterTypePolicy } from "@/data/custom/searchFilterTypePolicy";
import { notification } from "ant-design-vue";
import { GridColumnInfo } from "@/data/auto/gridColumnInfo";
import { useGridColumnInfo } from "@/hooks/gridColumnInfo";
import dmsFolder from "./DmsFolderModal.vue";
import { useLoginProfileStore } from "@/store/modules/loginProfile";
import type { UploadProps } from "ant-design-vue";
import { WebSitePolicy } from "@/policy/custom/webSitePolicy";
import { orderBy } from "lodash-es";
import { bsInfo } from "@/utils/browser";
import axios from "axios";
import { getuid } from "process";
import VideoPlay from "./PlayVideo.vue";
import {
enquiryMethodKey,
searchCriteriaManagerKey,
masterOperationToEnquiryMethodKey,
MasterOperationToEnquiryModelOption,
layoutProviderMethodKey,
} from "@/injections";
import { useOrderedChildren } from "@/hooks/use-ordered-children";
import { SearchCriteriaContext } from "@/injections";
import fileTypePolicy from "@/policy/custom/fileTypePolicy";
//page from-----------------------------------------------------------------------------------------------------------------------------------
//================inject================
//报表名称
const layoutProviderMethod = inject(layoutProviderMethodKey);
//================inject================
const widthColumn = ref<string>("3%");
if (bsInfo.size.sm) {
widthColumn.value = "8%";
} else {
widthColumn.value = "3%";
}
const loading = ref<boolean>(false);
const isEdit = ref<boolean>(false);
const canView = ref<boolean>(false);
const canAmend = ref<boolean>(false);
const canDelete = ref<boolean>(false);
const canCreate = ref<boolean>(false);
const modalTitle = ref<string>("新增文件夹");
const rootPath = ref<string>("");
const imageSrc = ref<string>("");
const route = useRoute();
const router = useRouter();
const previousFilePath = ref<string>("");
const fileList = ref<UploadProps["fileList"]>([]);
const uploadUrl = ref<string>(WebSitePolicy.WebApiRoot + "DmsFile/UploadFile");
if (process.env.NODE_ENV === "development") {
uploadUrl.value = WebSitePolicy.WebApiRootDev + "/DmsFile/UploadFile";
} else {
uploadUrl.value = WebSitePolicy.WebApiRoot + "/DmsFile/UploadFile";
}
const currFilePath = ref<string>("");
const headers = ref({
Authorization: useLoginProfileStore().getToken(),
"Content-Type": "multipart/form-data",
FilePath: currFilePath.value,
});
const columns = ref([
{
title: "",
dataIndex: DmsFileUploadDeleteLogViewDisplayData.URL,
sorter: false,
width: "50%",
sequence: 1,
hidden: "N",
},
]);
const viewOption = {
Value: "default",
SelectOptions: [{ BindValue: "default", DisplayName: "默认" }],
Columns: [{ BindValue: "default", BindColumn: columns }],
};
const bindOptions = ref<BindOption[]>([]);
const datas = ref<DmsFileUploadDeleteLogViewDisplayData[]>([]);
const pagingParams = ref<PagingParams>({ pageSize: 20, page: 1 });
const result = ref<SearchCriteriaResultData>(new SearchCriteriaResultData());
const data = ref<DmsFileResultData>(new DmsFileResultData());
const currentFilter = ref<SearchFilter[]>([]);
const isSearched = ref<boolean>(false);
const currentSearchCriteria = ref<DmsFileSearchCriteria>(
new DmsFileSearchCriteria(),
);
const keys = ref<DmsFileUploadDeleteLogViewDisplayData[]>([]);
const dmsFolderModal = ref<boolean>(false);
const dmsFolderTitle = ref<string>("新增文件夹");
const dmsFolderIsRename = ref<boolean>(false);
const dmsFolderIsMove = ref<boolean>(false);
const entity = ref<DmsFileEntity>(new DmsFileEntity());
const videoPlayModal = ref<boolean>(false);
const videoSrc = ref<string>("");
const videoType = ref<string>("");
const {
children: items,
addChild: addItem,
removeChild: removeItem,
} = useOrderedChildren<SearchCriteriaContext>();
//================provide================
//初始化查询条件UI
provide(enquiryMethodKey, {
getLayoutSetting: () => {
return {
controlLeft: 16,
controlRight: 8,
space: true,
soltLeft: 24,
soltRight: 24,
};
},
getBindOptions: () => {
return unref(bindOptions);
},
getViewOption: () => {
return unref(viewOption);
},
getDatas: () => {
return datas;
},
});
provide(
searchCriteriaManagerKey,
reactive({
items,
addItem,
removeItem,
}),
);
// provide("bindOptions", bindOptions);
provide("dmsFolderModal", dmsFolderModal);
provide("dmsFolderTitle", dmsFolderTitle);
provide("dmsFolderIsRename", dmsFolderIsRename);
provide("dmsFolderIsMove", dmsFolderIsMove);
provide("DmsFileEntity", entity);
//控制按键多行显示,可以单列24或者多列
//provide("layoutSetting", { controlLeft: 20, controlRight: 4, soltLeft: 8, soltRight: 8 });
//space: true 控制按键单行显示
// provide("layoutSetting", { controlLeft: 16, controlRight: 8, space: true });
// provide("viewOption", viewOption);
provide("videoPlayModal", videoPlayModal);
provide("videoSrc", videoSrc);
provide("videoType", videoType);
//table数据源
// provide("datas", datas);
//================provide================
defineExpose({
keys,
});
onMounted(async () => {
let pContext: PermissionContext = usePermissionContext();
canView.value = pContext.canView(route.meta.permission as string);
canAmend.value = pContext.canAmend(route.meta.permission as string);
canDelete.value = pContext.canDelete(route.meta.permission as string);
canCreate.value = pContext.canCreate(route.meta.permission as string);
await initBindOption();
onSearchByFilePath(rootPath.value);
});
const beforeUpload: UploadProps["beforeUpload"] = (file) => {
fileList.value = [...(fileList.value || []), file];
const chunks = splitFile(file);
let bindOption: BindOption = bindOptions.value.filter(
(x) => x.BindValue == DmsFileUploadDeleteLogViewDisplayData.DB_FILE_PATH,
)[0];
currFilePath.value = headers.value.FilePath = bindOption.Value;
let i = 1;
let fileSize = file.size;
let uid: string = file.uid;
uploadChunk(chunks, file.name, uid, i);
return false;
};
const uploadChunk = async (
chunks: any,
fileName: string,
uid: string,
index: number,
) => {
const formData = new FormData();
const fileExtension = fileName.split(".").pop();
formData.append(
fileName,
chunks[index - 1],
uid +
"-" +
index.toString() +
"-" +
chunks.length.toString() +
"." +
fileExtension,
);
if (process.env.NODE_ENV === "development") {
axios.defaults.baseURL = WebSitePolicy.WebApiRootDev;
axios.defaults.withCredentials = true;
} else {
axios.defaults.baseURL = WebSitePolicy.WebApiRoot;
}
try {
let response = await axios.create().request({
url: "/DmsFile/UploadFile",
method: "post",
data: formData,
headers: headers.value,
});
if (response.status == 200 && index < chunks.length) {
uploadChunk(chunks, fileName, uid, index + 1);
} else if (index == chunks.length) {
onReSearch();
loading.value = false;
}
} catch (error) {
loading.value = false;
console.log(error);
}
};
const CHUNK_SIZE = 512 * 1024; // 设置每个分片的大小为1MB
const splitFile = (file: any) => {
const chunks = [];
let start = 0;
while (start < file.size) {
const end = Math.min(start + CHUNK_SIZE, file.size);
const chunk = file.slice(start, end);
chunks.push(chunk);
start += CHUNK_SIZE;
}
return chunks;
};
const onSelectChange = (selected: DmsFileUploadDeleteLogViewDisplayData[]) => {
keys.value = selected;
};
const onLastFolder = async () => {
if (!datas.value || datas.value.length == 0) {
onSearchByFilePath(previousFilePath.value);
} else {
onPreviousFolder();
}
};
const onPreviousFolder = async () => {
let filePath: string = "";
if (datas.value && datas.value.length > 0) filePath = datas.value[0].FilePath;
dmsFileService.FindFolderNameParentByFolderName(filePath).then((res) => {
if (res && res.length > 0) onSearchByFilePath(res);
});
};
const onChangeFolder = async (fvalue: string) => {
onSearchByFilePath(fvalue);
};
const onVideoPlay = async (fid: number) => {
videoType.value = "video/mp4";
videoPlayModal.value = true;
//从服务器取出
dmsFileService
.FindDeleteLogM3u8Path(fid)
.then((res) => {
videoSrc.value = res;
})
.catch(() => {
videoPlayModal.value = false;
});
};
const onPreviewFile = async (username: string, orderKey: string) => {
loading.value = true;
getPreviewFile(username, orderKey);
};
const getPreviewFile = (username: string, fname: string) => {
let dms: DmsFileEntity = new DmsFileEntity();
dms.CreatedBy = username;
dms.OrderKey = fname;
dmsFileService
.DownloadFilePreview(dms)
.then((res) => {
const downloadUrl = window.URL.createObjectURL(new Blob([res]));
imageSrc.value = downloadUrl;
loading.value = false;
setPicVisible(true);
})
.catch(() => {
loading.value = false;
});
};
const DownloadFileCombine = (
fs: string[],
mergedData: Uint8Array,
index: number,
ttl: number,
total: number,
preview: boolean,
fname: string,
) => {
loading.value = true;
fs[fs.length - 2] = index.toString();
dmsFileService
.DownloadFileCombine(fs.toString().replace(/,/g, "-"))
.then((res) => {
mergedData.set(new Uint8Array(res), ttl);
if (index < total) {
DownloadFileCombine(
fs,
mergedData,
index + 1,
ttl + res.byteLength,
total,
preview,
fname,
);
} else if (index == total) {
loading.value = false;
const downloadUrl = window.URL.createObjectURL(new Blob([mergedData]));
imageSrc.value = downloadUrl;
if (!preview) {
const link = document.createElement("a");
link.href = downloadUrl;
link.setAttribute("download", fname);
document.body.appendChild(link);
link.click();
} else {
setPicVisible(true);
}
}
})
.catch(() => {
loading.value = false;
});
};
const onDownloadFile = async (fid: number, fname: string) => {
GetOrgPictureFile(fid, fname, false);
};
const GetOrgPictureFile = async (
fid: number,
fname: string,
preview: boolean,
) => {
if (fileTypePolicy.isVideo(fname)) {
// onVideoPlay(keys.value[0].FileId);
return;
}
loading.value = true;
dmsFileService
.FindDmsFileDeleteLogByKey(fid)
.then((res) => {
let fs: string[] = res.OrderKey.replace("scale_", "").split("-");
let index: string = fs[fs.length - 2];
let total: string = fs[fs.length - 1].split(".")[0];
var mergedData = new Uint8Array((res.FileSize + 1) * 1024);
let ttl: number = 0;
fs[fs.length - 2] = "1";
DownloadFileCombine(
fs,
mergedData,
1,
ttl,
parseInt(total),
preview,
fname,
);
})
.catch(() => {
loading.value = false;
});
};
const onViewPictureFile = async (fid: number, fname: string) => {
GetOrgPictureFile(fid, fname, true);
};
const onSearchByFilePath = async (fvalue: string) => {
setBindOptionValue(
DmsFileUploadDeleteLogViewDisplayData.DB_FILE_PATH,
fvalue,
"",
[fvalue],
false,
);
previousFilePath.value = unref(currFilePath.value);
currFilePath.value = fvalue;
isSearched.value = true;
if (currentSearchCriteria.value && fvalue && fvalue.length > 0) {
currentSearchCriteria.value.Filter = [];
let filter: SearchFilter;
filter = new SearchFilter();
filter.Column = DmsFileUploadDeleteLogViewDisplayData.DB_FILE_PATH;
filter.Type = "SingleSelection";
filter.Operator = "single";
filter.Value = fvalue;
currentSearchCriteria.value.Filter.push(filter);
} else {
currentSearchCriteria.value.Filter = [];
}
await findBySearchCriteria(unref(currentSearchCriteria));
};
const onReset = () => {
keys.value = [];
result.value.Total = 0;
setBindOptionValue(
DmsFileUploadDeleteLogViewDisplayData.DB_FILE_PATH,
rootPath.value,
"",
[rootPath.value],
false,
);
};
const onUrlVideoPlay = (url: string, title: string) => {
videoType.value = "m3u8";
videoSrc.value = url;
videoPlayModal.value = true;
};
const onViewPic = () => {
if (keys.value.length == 0) return;
if (keys.value[0].IsDirectoryIndc == "Y") {
onChangeFolder(keys.value[0].FileName);
} else if (
keys.value[0].OrgFileName.toLowerCase().indexOf("png") > 0 ||
keys.value[0].OrgFileName.toLowerCase().indexOf("jpg") > 0 ||
keys.value[0].OrgFileName.toLowerCase().indexOf("jpeg") > 0 ||
keys.value[0].OrgFileName.toLowerCase().indexOf("gif") > 0
) {
onPreviewFile(keys.value[0].CreatedBy, keys.value[0].OrderKey);
} else if (
keys.value[0].OrgFileName.toLowerCase().indexOf("mp4") > 0 ||
keys.value[0].OrgFileName.toLowerCase().indexOf("rm") > 0 ||
keys.value[0].OrgFileName.toLowerCase().indexOf("mpeg") > 0 ||
keys.value[0].OrgFileName.toLowerCase().indexOf("mov") > 0 ||
keys.value[0].OrgFileName.toLowerCase().indexOf("wmv") > 0 ||
keys.value[0].OrgFileName.toLowerCase().indexOf("avi") > 0
) {
onVideoPlay(keys.value[0].FileId);
} else {
notification.info({
message: "系统提示:",
description: "未知格式无法预览",
placement: "topRight",
});
}
};
const visible = ref<boolean>(false);
const setPicVisible = (value: boolean): void => {
visible.value = value;
};
const onDelete = async () => {
if (keys.value.length == 0) return;
for (let element of keys.value) {
await dmsFileService.DeleteLog(element.FileId);
}
notification.info({
message: "系统提示:",
description: "记录删除成功",
placement: "topRight",
});
onReload();
};
const onSave = () => {
isEdit.value = false;
};
const onCancel = () => {
isEdit.value = false;
};
const setBindOptionValue = (
bindValue: string,
value: string,
value1: string,
values: string[],
disabled: boolean,
) => {
let bindOption: BindOption = bindOptions.value.filter(
(x) => x.BindValue == bindValue,
)[0];
if (!bindOption) return;
bindOption.Value = value;
bindOption.Value1 = value1;
bindOption.Values = values;
bindOption.disabled = disabled;
};
//初始化查询条件
const initBindOption = async () => {
let ubo = useBindOption();
bindOptions.value = [];
bindOptions.value.splice(0, bindOptions.value.length);
let bindOption: BindOption = ubo.getBindOption(
DmsFileUploadDeleteLogViewDisplayData.DB_ORG_FILE_NAME,
"名称",
SearchFilterTypePolicy.TEXT,
SearchFilterOperatorPolicy.CONTAIN,
);
bindOptions.value.push(bindOption);
let rps: SelectOption[] = await dmsFileService.FindDmsFolderDeleteLogs();
if (rps && rps.length > 1) {
rootPath.value = currFilePath.value = rps[0].BindValue;
}
bindOption = ubo.getBindSelectOption(
DmsFileUploadDeleteLogViewDisplayData.DB_FILE_PATH,
"当前目录",
SearchFilterTypePolicy.SINGLE_SELECTION,
SearchFilterOperatorPolicy.SINGLE,
rps,
);
bindOptions.value.push(bindOption);
bindOption = ubo.getBindOption(
DmsFileUploadDeleteLogViewDisplayData.DB_CREATED_DATETIME,
"创建日期",
SearchFilterTypePolicy.DATE,
SearchFilterOperatorPolicy.DATE_BETWEEN,
);
bindOptions.value.push(bindOption);
setBindOptionValue(
DmsFileUploadDeleteLogViewDisplayData.DB_FILE_PATH,
currFilePath.value,
"",
[currFilePath.value],
false,
);
};
//table from-----------------------------------------------------------------------------------------------------------------------------------
result.value.Page = pagingParams.value.page ?? 1;
result.value.Limit = pagingParams.value.pageSize;
const onSubmit = async (filters: SearchFilter[]) => {
loading.value = true;
let c: DmsFileSearchCriteria = new DmsFileSearchCriteria();
currentFilter.value = filters;
isSearched.value = true;
c.Filter = filters;
c.limit = pagingParams.value.pageSize;
c.page = pagingParams.value.page ?? 1;
c.GridColumns = [];
currentSearchCriteria.value = c;
await findBySearchCriteria(c);
};
const onPrint = async () => {
loading.value = true;
let c: DmsFileSearchCriteria = new DmsFileSearchCriteria();
if (currentFilter.value.length > 0) c.Filter = currentFilter.value;
else c.Filter = [];
c.limit = pagingParams.value.pageSize;
c.page = pagingParams.value.page ?? 1;
c.GridColumns = useGridColumnInfo().getGridColumnInfo(unref(columns));
c.ReportName = layoutProviderMethod?.getLayoutProvider().layoutTitle!;
try {
let sss = await dmsFileService.PrintBySearchCriteria(c);
} catch (error) {
console.log(error);
}
};
const findBySearchCriteria = async (c: DmsFileSearchCriteria) => {
keys.value = [];
try {
if (c.limit == 0) c.limit = pagingParams.value.pageSize;
if (c.page == 0) c.page = pagingParams.value.page ?? 1;
data.value = await dmsFileService.FindDeleteLogBySearchCriteria(c);
result.value.Total = data.value.Total;
result.value.Page = data.value.Page;
result.value.Limit = data.value.Limit;
if (data.value.Logs)
data.value.Logs = orderBy(
data.value.Logs,
(x) => x.IsDirectoryIndc,
"desc",
);
datas.value = data.value.Logs;
loading.value = false;
} catch (error) {
loading.value = false;
console.log(error);
}
};
const onPagination = async (params: PagingParams) => {
try {
if (!isSearched.value) return;
let c: DmsFileSearchCriteria = new DmsFileSearchCriteria();
if (currentFilter.value.length > 0) c.Filter = currentFilter.value;
else c.Filter = [];
c.limit = params.pageSize;
c.page = params.page ?? 1;
if (params.sortField) c.orderby = params.sortField!;
if (params.sortOrder)
c.orderbytag = params.sortOrder?.toString().substring(0, 4)!;
c.GridColumns = [];
loading.value = true;
currentSearchCriteria.value = c;
await findBySearchCriteria(c);
} catch (error) {
loading.value = false;
console.log(error);
}
};
const onReSearch = async () => {
setBindOptionValue(
DmsFileUploadDeleteLogViewDisplayData.DB_FILE_PATH,
currFilePath.value,
"",
[currFilePath.value],
false,
);
await findBySearchCriteria(unref(currentSearchCriteria));
};
const onReload = async () => {
await initBindOption();
setBindOptionValue(
DmsFileUploadDeleteLogViewDisplayData.DB_FILE_PATH,
currFilePath.value,
"",
[currFilePath.value],
false,
);
await findBySearchCriteria(unref(currentSearchCriteria));
};
//table end-----------------------------------------------------------------------------------------------------------------------------------
</script>