From c5bf0d67580cf9b28006414a092a361753929ea8 Mon Sep 17 00:00:00 2001 From: ndbs Date: Mon, 14 Mar 2022 17:52:10 +0800 Subject: [PATCH] =?UTF-8?q?CMS=E4=B8=8B=E5=8F=91=E6=AD=A3=E6=96=87?= =?UTF-8?q?=E8=A7=A3=E5=AF=86=E7=BC=96=E8=BE=91=E5=99=A8=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/CMSController.cs | 124 ++++++++++++++++++ .../Learun.Application.Web.csproj | 2 + .../Learun.Application.OA/News/NewsService.cs | 2 +- 3 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/CMSController.cs diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/CMSController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/CMSController.cs new file mode 100644 index 000000000..dbf494876 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/CMSController.cs @@ -0,0 +1,124 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; +using Learun.Application.Base.SystemModule; +using Learun.Application.OA.File.FilePreview; +using Learun.Util; +using Quanjiang.DigitalSchool.AsposeHelper; + +namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers +{ + public class CMSController : MvcControllerBaseNoLogin + { + // GET: LR_SystemModule/CMS + private AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL(); + + public ActionResult Index() + { + return View(); + } + + #region 预览附件 + /// + /// 文件预览 + /// + /// 文件ID + /// + public void PreviewFile(string fileId) + { + FilePreviewIBLL filePreviewIBLL = new FilePreviewBLL(); + var data = annexesFileIBLL.GetEntity(fileId); + if (data == null) + { + return; + } + string filename = data.F_FileName;//客户端保存的文件名 + string filepath = data.F_FilePath;//路径 + if (data.F_FileType == "xlsx" || data.F_FileType == "xls") + { + filepath = filepath.Substring(0, filepath.LastIndexOf(".")) + ".pdf";//文件名 + if (!DirFileHelper.IsExistFile(filepath)) + { + //filePreviewIBLL.GetExcelData(data.F_FilePath); + //liang 2021-6-25 改aspose预览 + AsposeCore.GetExcelData(data.F_FilePath); + } + } + if (data.F_FileType == "docx" || data.F_FileType == "doc") + { + filepath = filepath.Substring(0, filepath.LastIndexOf(".")) + ".pdf";//文件名 + if (!DirFileHelper.IsExistFile(filepath)) + { + //filePreviewIBLL.GetWordData(data.F_FilePath); + //liang 2021-6-25 改aspose预览 + AsposeCore.GetWordData(data.F_FilePath); + } + } + if (data.F_FileType == "ppt" || data.F_FileType == "pptx") + { + filepath = filepath.Substring(0, filepath.LastIndexOf(".")) + ".pdf";//文件名 + if (!DirFileHelper.IsExistFile(filepath)) + { + //filePreviewIBLL.GetPptData(data.F_FilePath); + //liang 2021-6-25 改aspose预览 + AsposeCore.GetWordData(data.F_FilePath); + } + } + Response.ClearContent(); + switch (data.F_FileType) + { + case "jpg": + Response.ContentType = "image/jpeg"; + break; + case "gif": + Response.ContentType = "image/gif"; + break; + case "png": + Response.ContentType = "image/png"; + break; + case "bmp": + Response.ContentType = "application/x-bmp"; + break; + case "jpeg": + Response.ContentType = "image/jpeg"; + break; + case "doc": + Response.ContentType = "application/pdf"; + break; + case "docx": + Response.ContentType = "application/pdf"; + break; + case "ppt": + Response.ContentType = "application/pdf"; + break; + case "pptx": + Response.ContentType = "application/pdf"; + break; + case "xls": + Response.ContentType = "application/pdf"; + break; + case "xlsx": + Response.ContentType = "application/pdf"; + break; + case "pdf": + Response.ContentType = "application/pdf"; + break; + case "txt": + Response.ContentType = "text/plain"; + break; + case "csv": + Response.ContentType = ""; + break; + default: + Response.ContentType = "application/pdf"; + break; + } + Response.Charset = "GB2312"; + Response.WriteFile(filepath); + //Response.BinaryWrite(ms.ToArray()); + } + #endregion + } +} \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj index b4692d004..d6fe45c1b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj @@ -459,6 +459,7 @@ + @@ -6707,6 +6708,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/News/NewsService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/News/NewsService.cs index 09e1fed2c..a1a3bf396 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/News/NewsService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/News/NewsService.cs @@ -237,7 +237,7 @@ namespace Learun.Application.OA { Title = newEntity.F_FullHead, SubTitle = newEntity.F_BriefHead, - Content = newEntity.F_NewsContent, + Content = HttpUtility.HtmlDecode(newEntity.F_NewsContent), Author = newEntity.F_AuthorName, Source = newEntity.F_SourceName, AddDate = DateTime.Now,