b278a261e0391c6d282217292a2650ca766f8928..67965cce30e900f9b6091170745ecf115f64e23d
2023-08-02 qwj
Merge branch 'master' of http://47.108.235.38:8080/r/DocumentService
67965c 对比 | 目录
2023-08-02 qwj
更新文件服务
361e8b 对比 | 目录
4个文件已修改
32个文件已删除
11212 ■■■■■ 已修改文件
.gitignore 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentFile.Service/Controllers/DocumentController.cs 57 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentFile.Service/IUploadService.cs 47 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/bin/Debug/net6.0/DocumentServiceAPI.Core.dll 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/bin/Debug/net6.0/DocumentServiceAPI.Core.pdb 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/bin/Debug/net6.0/DocumentServiceAPI.Core.xml 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/bin/Debug/net6.0/DocumentServiceAPI.Enum.dll 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/bin/Debug/net6.0/DocumentServiceAPI.Enum.pdb 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/bin/Debug/net6.0/DocumentServiceAPI.Enum.xml 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/bin/Debug/net6.0/DocumentServiceAPI.Services.deps.json 2498 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/bin/Debug/net6.0/DocumentServiceAPI.Services.dll 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/bin/Debug/net6.0/DocumentServiceAPI.Services.pdb 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/bin/Debug/net6.0/DocumentServiceAPI.Utility.dll 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/bin/Debug/net6.0/DocumentServiceAPI.Utility.pdb 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/bin/Debug/net6.0/DocumentServiceAPI.Utility.xml 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/obj/Debug/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/obj/Debug/net6.0/DocumentServiceAPI.Services.AssemblyInfo.cs 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/obj/Debug/net6.0/DocumentServiceAPI.Services.AssemblyInfoInputs.cache 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/obj/Debug/net6.0/DocumentServiceAPI.Services.GeneratedMSBuildEditorConfig.editorconfig 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/obj/Debug/net6.0/DocumentServiceAPI.Services.GlobalUsings.g.cs 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/obj/Debug/net6.0/DocumentServiceAPI.Services.assets.cache 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/obj/Debug/net6.0/DocumentServiceAPI.Services.csproj.AssemblyReference.cache 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/obj/Debug/net6.0/DocumentServiceAPI.Services.csproj.BuildWithSkipAnalyzers 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/obj/Debug/net6.0/DocumentServiceAPI.Services.csproj.CopyComplete 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/obj/Debug/net6.0/DocumentServiceAPI.Services.csproj.CoreCompileInputs.cache 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/obj/Debug/net6.0/DocumentServiceAPI.Services.csproj.FileListAbsolute.txt 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/obj/Debug/net6.0/DocumentServiceAPI.Services.dll 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/obj/Debug/net6.0/DocumentServiceAPI.Services.pdb 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/obj/Debug/net6.0/ref/DocumentServiceAPI.Services.dll 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/obj/Debug/net6.0/refint/DocumentServiceAPI.Services.dll 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/obj/DocumentServiceAPI.Services.csproj.nuget.dgspec.json 275 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/obj/DocumentServiceAPI.Services.csproj.nuget.g.props 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/obj/DocumentServiceAPI.Services.csproj.nuget.g.targets 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/obj/project.assets.json 7932 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Services/obj/project.nuget.cache 146 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.sln 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.gitignore
@@ -27,3 +27,5 @@
/DocumentServiceAPI.Web.Entry/appsettings.json
/DocumentFile.Service/bin
/DocumentFile.Service/obj
/DocumentServiceAPI.Services/bin
/DocumentServiceAPI.Services/obj
DocumentFile.Service/Controllers/DocumentController.cs
@@ -20,16 +20,58 @@
        }
        /// <summary>
        /// 上传文件(word)
        /// 上传文件模板(doc、docx)
        /// </summary>
        /// <param name="code">租户唯一标识code</param>
        /// <param name="formFile">文件</param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> UploadDocument(IFormFile formFile)
        public async Task<IActionResult> UploadDocTemplate([FromForm]string code,IFormFile formFile)
        {
            ReturnMsg msg = new ReturnMsg();
            if(formFile.Length>0)
            {
                msg = await this._uploadService.HandleUploadWordFile(formFile);
                msg = await this._uploadService.HandleUploadTemplateFile(formFile,code);
            }
            else
            {
                msg.error = "请上传文件";
            }
            return new JsonResult(msg);
        }
        /// <summary>
        /// 上传文件(doc、docx)
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> UploadDocInstance([FromForm] string code, IFormFile formFile)
        {
            ReturnMsg msg = new ReturnMsg();
            if (formFile.Length > 0)
            {
                msg = await this._uploadService.HandleUploadWordFile(formFile, code);
            }
            else
            {
                msg.error = "请上传文件";
            }
            return new JsonResult(msg);
        }
        /// <summary>
        /// 上传图片(jpg、jpeg、png)
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> UploadPhoto([FromForm] string code, IFormFile formFile)
        {
            ReturnMsg msg = new ReturnMsg();
            if (formFile.Length > 0)
            {
                msg = await this._uploadService.HandleUploadImageFile(formFile, code);
            }
            else
            {
@@ -45,15 +87,18 @@
        /// <param name="url"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult Download([FromBody] string url)
        public IActionResult Download([FromForm] string url)
        {
            try
            {
                if (!string.IsNullOrEmpty(url))
                {
                    var _webRootPath = AppDomain.CurrentDomain.BaseDirectory;
                    return new FileStreamResult(new FileStream(_webRootPath + url, FileMode.Open), "application/octet-stream");// { FileDownloadName = FileName };
                    var path = _webRootPath + url;
                    if (System.IO.File.Exists(path))
                    {
                        return new FileStreamResult(new FileStream(path, FileMode.Open), "application/octet-stream");// { FileDownloadName = FileName };
                    }
                }
            }
            catch (Exception ex)
DocumentFile.Service/IUploadService.cs
@@ -4,11 +4,11 @@
{
    public interface IUploadService
    {
        Task<ReturnMsg> HandleUploadWordFile(IFormFile iFormFile);
        Task<ReturnMsg> HandleUploadWordFile(IFormFile iFormFile,string code);
        Task<ReturnMsg> HandleUploadTemplateFile(IFormFile iFormFile);
        Task<ReturnMsg> HandleUploadTemplateFile(IFormFile iFormFile, string code);
        Task<ReturnMsg> HandleUploadImageFile(IFormFile iFormFile);
        Task<ReturnMsg> HandleUploadImageFile(IFormFile iFormFile, string code);
        //(string fileType, byte[] archiveData, string archiveName) DownloadFiles(string subDirectory);
@@ -27,10 +27,11 @@
        /// 上传文件 辅助函数
        /// </summary>
        /// <param name="formFile"></param>
        /// <param name="folder"></param>
        /// <param name="tenant">文件夹客户标识</param>
        /// <param name="folder">文件夹分类标签</param>
        /// <param name="format"></param>
        /// <returns></returns>
        protected async virtual Task<ReturnMsg> HandleUploadFile(IFormFile formFile, string folder, params string[] format)
        protected async virtual Task<ReturnMsg> HandleUploadFile(IFormFile formFile,string tenant, string folder, params string[] format)
        {
            ReturnMsg msg = new ReturnMsg();
@@ -44,15 +45,14 @@
                }
                else
                {
                    var path = $"/upload/{folder}/{DateTime.Now:yyyyMMdd}";
                    var path = $"/uploads/{tenant}/{folder}/{DateTime.Now:yyyyMMdd}";
                    var dir = this._webRootPath + path;
                    if (!Directory.Exists(dir))
                    {
                        Directory.CreateDirectory(dir);
                    }
                    var filename = $"ZC_{DateTime.Now:HHmmssfff}" + extensionName;
                    var filename = CreateName(path,extensionName);
                    path += "/" + filename;
                                        
                    // 创建新文件
@@ -75,6 +75,25 @@
            return msg;
        }
        /// <summary>
        /// 生成唯一的文件名
        /// </summary>
        /// <param name="path"></param>
        /// <param name="extensionName"></param>
        /// <returns></returns>
        private string CreateName(string path,string extensionName)
        {
            var filename = $"ZC_{DateTime.Now:HHmmssfff}" + extensionName;
            if (File.Exists(path + "/" + filename))
            {
                return CreateName(path, extensionName);
            }
            else
            {
                return filename;
            }
        }
        /// <summary>
        /// 上传word文件
@@ -82,8 +101,8 @@
        /// <param name="iFormFile"></param>
        /// <param name="format"></param>
        /// <returns></returns>
        public async virtual Task<ReturnMsg> HandleUploadWordFile(IFormFile iFormFile)
            => await this.HandleUploadFile(iFormFile, "Instance", ".doc",".docx");
        public async virtual Task<ReturnMsg> HandleUploadWordFile(IFormFile iFormFile, string code)
            => await this.HandleUploadFile(iFormFile,code, "Instance", ".doc",".docx");
        /// <summary>
        /// 上传word模板文件
@@ -91,8 +110,8 @@
        /// <param name="iFormFile"></param>
        /// <param name="format"></param>
        /// <returns></returns>
        public async virtual Task<ReturnMsg> HandleUploadTemplateFile(IFormFile iFormFile)
            => await this.HandleUploadFile(iFormFile, "Template", ".doc", ".docx");
        public async virtual Task<ReturnMsg> HandleUploadTemplateFile(IFormFile iFormFile, string code)
            => await this.HandleUploadFile(iFormFile, code, "Template", ".doc", ".docx");
        /// <summary>
        /// 上传图片
@@ -100,8 +119,8 @@
        /// <param name="iFormFile"></param>
        /// <param name="folder"></param>
        /// <returns></returns>
        public async virtual Task<ReturnMsg> HandleUploadImageFile(IFormFile iFormFile)
            => await this.HandleUploadFile(iFormFile, "Photo", ".jpg", ".jpeg", ".png");
        public async virtual Task<ReturnMsg> HandleUploadImageFile(IFormFile iFormFile, string code)
            => await this.HandleUploadFile(iFormFile, code, "Photo", ".jpg", ".jpeg", ".png");
        /*, ".gif", ".jfif"*/
        ///// <summary>
DocumentServiceAPI.Services/bin/Debug/net6.0/DocumentServiceAPI.Core.dll
Binary files differ
DocumentServiceAPI.Services/bin/Debug/net6.0/DocumentServiceAPI.Core.pdb
Binary files differ
DocumentServiceAPI.Services/bin/Debug/net6.0/DocumentServiceAPI.Core.xml
File was deleted
DocumentServiceAPI.Services/bin/Debug/net6.0/DocumentServiceAPI.Enum.dll
Binary files differ
DocumentServiceAPI.Services/bin/Debug/net6.0/DocumentServiceAPI.Enum.pdb
Binary files differ
DocumentServiceAPI.Services/bin/Debug/net6.0/DocumentServiceAPI.Enum.xml
File was deleted
DocumentServiceAPI.Services/bin/Debug/net6.0/DocumentServiceAPI.Services.deps.json
File was deleted
DocumentServiceAPI.Services/bin/Debug/net6.0/DocumentServiceAPI.Services.dll
Binary files differ
DocumentServiceAPI.Services/bin/Debug/net6.0/DocumentServiceAPI.Services.pdb
Binary files differ
DocumentServiceAPI.Services/bin/Debug/net6.0/DocumentServiceAPI.Utility.dll
Binary files differ
DocumentServiceAPI.Services/bin/Debug/net6.0/DocumentServiceAPI.Utility.pdb
Binary files differ
DocumentServiceAPI.Services/bin/Debug/net6.0/DocumentServiceAPI.Utility.xml
File was deleted
DocumentServiceAPI.Services/obj/Debug/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs
File was deleted
DocumentServiceAPI.Services/obj/Debug/net6.0/DocumentServiceAPI.Services.AssemblyInfo.cs
File was deleted
DocumentServiceAPI.Services/obj/Debug/net6.0/DocumentServiceAPI.Services.AssemblyInfoInputs.cache
File was deleted
DocumentServiceAPI.Services/obj/Debug/net6.0/DocumentServiceAPI.Services.GeneratedMSBuildEditorConfig.editorconfig
File was deleted
DocumentServiceAPI.Services/obj/Debug/net6.0/DocumentServiceAPI.Services.GlobalUsings.g.cs
File was deleted
DocumentServiceAPI.Services/obj/Debug/net6.0/DocumentServiceAPI.Services.assets.cache
Binary files differ
DocumentServiceAPI.Services/obj/Debug/net6.0/DocumentServiceAPI.Services.csproj.AssemblyReference.cache
Binary files differ
DocumentServiceAPI.Services/obj/Debug/net6.0/DocumentServiceAPI.Services.csproj.BuildWithSkipAnalyzers
DocumentServiceAPI.Services/obj/Debug/net6.0/DocumentServiceAPI.Services.csproj.CopyComplete
DocumentServiceAPI.Services/obj/Debug/net6.0/DocumentServiceAPI.Services.csproj.CoreCompileInputs.cache
File was deleted
DocumentServiceAPI.Services/obj/Debug/net6.0/DocumentServiceAPI.Services.csproj.FileListAbsolute.txt
File was deleted
DocumentServiceAPI.Services/obj/Debug/net6.0/DocumentServiceAPI.Services.dll
Binary files differ
DocumentServiceAPI.Services/obj/Debug/net6.0/DocumentServiceAPI.Services.pdb
Binary files differ
DocumentServiceAPI.Services/obj/Debug/net6.0/ref/DocumentServiceAPI.Services.dll
Binary files differ
DocumentServiceAPI.Services/obj/Debug/net6.0/refint/DocumentServiceAPI.Services.dll
Binary files differ
DocumentServiceAPI.Services/obj/DocumentServiceAPI.Services.csproj.nuget.dgspec.json
File was deleted
DocumentServiceAPI.Services/obj/DocumentServiceAPI.Services.csproj.nuget.g.props
File was deleted
DocumentServiceAPI.Services/obj/DocumentServiceAPI.Services.csproj.nuget.g.targets
File was deleted
DocumentServiceAPI.Services/obj/project.assets.json
File was deleted
DocumentServiceAPI.Services/obj/project.nuget.cache
File was deleted
DocumentServiceAPI.sln
@@ -17,7 +17,9 @@
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocumentServiceAPI.Utility", "DocumentServiceAPI.Utility\DocumentServiceAPI.Utility.csproj", "{32288D91-01F9-45B0-AA01-A8EF1E22A6D0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DocumentServiceAPI.Services", "DocumentServiceAPI.Services\DocumentServiceAPI.Services.csproj", "{3369F102-ABB2-42A4-B216-58D530AEE8BE}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocumentFile.Service", "DocumentFile.Service\DocumentFile.Service.csproj", "{F3449EF6-8E3F-492F-832F-F5F2E1F2503C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocumentServiceAPI.Services", "DocumentServiceAPI.Services\DocumentServiceAPI.Services.csproj", "{3369F102-ABB2-42A4-B216-58D530AEE8BE}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -53,6 +55,9 @@
        {32288D91-01F9-45B0-AA01-A8EF1E22A6D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {32288D91-01F9-45B0-AA01-A8EF1E22A6D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {32288D91-01F9-45B0-AA01-A8EF1E22A6D0}.Release|Any CPU.Build.0 = Release|Any CPU
        {F3449EF6-8E3F-492F-832F-F5F2E1F2503C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {F3449EF6-8E3F-492F-832F-F5F2E1F2503C}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {F3449EF6-8E3F-492F-832F-F5F2E1F2503C}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {3369F102-ABB2-42A4-B216-58D530AEE8BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {3369F102-ABB2-42A4-B216-58D530AEE8BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {3369F102-ABB2-42A4-B216-58D530AEE8BE}.Release|Any CPU.ActiveCfg = Release|Any CPU