From 6b13557f72098d5191b03936bdf4c3f6df6d9ad1 Mon Sep 17 00:00:00 2001 From: xiaju <1784803958@qq.com> Date: Thu, 18 Sep 2025 11:26:22 +0800 Subject: [PATCH] 1 --- SGGL/BLL/BLL.csproj | 1 + .../ServerCheck/DCGLCheckNoticeItemService.cs | 39 +++++++++ SGGL/BLL/OpenService/FileInsertService.cs | 83 ++++++++++++++++++- .../DCGL/ServerCheck/CheckNotice.aspx.cs | 2 +- .../DCGL/ServerCheck/CheckRectify.aspx.cs | 4 +- SGGL/FineUIPro.Web/FineUIPro.Web.csproj | 11 +++ 6 files changed, 134 insertions(+), 6 deletions(-) create mode 100644 SGGL/BLL/DCGL/ServerCheck/DCGLCheckNoticeItemService.cs diff --git a/SGGL/BLL/BLL.csproj b/SGGL/BLL/BLL.csproj index 26ce9b36..98079fd0 100644 --- a/SGGL/BLL/BLL.csproj +++ b/SGGL/BLL/BLL.csproj @@ -310,6 +310,7 @@ + diff --git a/SGGL/BLL/DCGL/ServerCheck/DCGLCheckNoticeItemService.cs b/SGGL/BLL/DCGL/ServerCheck/DCGLCheckNoticeItemService.cs new file mode 100644 index 00000000..31313172 --- /dev/null +++ b/SGGL/BLL/DCGL/ServerCheck/DCGLCheckNoticeItemService.cs @@ -0,0 +1,39 @@ +using Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BLL +{ + /// + /// 督查检查整改明细表 + /// + public static class DCGLCheckNoticeItemService + { + /// + /// 根据主键获取督查检查整改明细信息 + /// + /// + /// + public static Model.DCGL_Check_CheckInfo_TableNoticeItem GetCheckNoticeItemByCheckNoticeItemId(string checkNoticeItemId) + { + return Funs.DB.DCGL_Check_CheckInfo_TableNoticeItem.FirstOrDefault(e => e.ID == checkNoticeItemId); + } + + /// + /// 添加督查检查整改明细信息 + /// + /// + public static void UpdateCheckNoticeItem(Model.DCGL_Check_CheckInfo_TableNoticeItem CheckNoticeItem) + { + var newCheckNoticeItem = Funs.DB.DCGL_Check_CheckInfo_TableNoticeItem.FirstOrDefault(x => x.ID == CheckNoticeItem.ID); + if (newCheckNoticeItem != null) + { + newCheckNoticeItem.Situation = CheckNoticeItem.Situation; + Funs.DB.SubmitChanges(); + } + } + } +} diff --git a/SGGL/BLL/OpenService/FileInsertService.cs b/SGGL/BLL/OpenService/FileInsertService.cs index 5331491e..2594188f 100644 --- a/SGGL/BLL/OpenService/FileInsertService.cs +++ b/SGGL/BLL/OpenService/FileInsertService.cs @@ -6,11 +6,51 @@ using System.Collections; using System.IO; using System.Web; using System.Text.RegularExpressions; +using System.Net; namespace BLL { public static class FileInsertService { + /// + /// 获取服务器图片转byte + /// + /// + /// + /// + public static List FilePathTransStream(string fileHost, string attachUrl) + { + List bytes = new List(); + var strs = attachUrl.Trim().Split(','); + + try + { + foreach (var fileUrl in strs) + { + string filepath = $"{fileHost}{fileUrl}"; + // 创建WebClient实例 + using (WebClient webClient = new WebClient()) + { + // 下载图片并保存到内存流 + using (MemoryStream ms = new MemoryStream(webClient.DownloadData(filepath))) + { + // 将MemoryStream转换为byte数组 + byte[] imageBytes = ms.ToArray(); + bytes.Add(imageBytes); + //// 使用byte数组(例如,保存到文件或进行其他处理) + //File.WriteAllBytes("localImage.jpg", imageBytes); + } + } + } + } + catch (Exception ex) + { + Console.WriteLine("Error: " + ex.Message); + } + return bytes; + } + + /// /// 获取附件数据流类 /// @@ -45,7 +85,6 @@ namespace BLL } } - /// /// 获取多附件数据流类 /// @@ -63,7 +102,6 @@ namespace BLL { if (strs.Count() > i) { - //string physicalpath = Funs.AttachRootPath; string physicalpath = Funs.RootPath; string fpath = strs[i]; string fullPath = physicalpath + fpath; @@ -107,7 +145,6 @@ namespace BLL } } - /// /// 数据和附件插入到多附件表 /// @@ -149,5 +186,45 @@ namespace BLL } } } + + + /// + /// 数据和附件插入到多附件表【不存实际文件,只存地址】 + /// + public static void InsertAttachFileRecord(string attachFileId, string dataId, string attachSource, string attachUrl) + { + var getAtt = Funs.DB.AttachFile.FirstOrDefault(x => x.AttachFileId == attachFileId); + if (getAtt != null) + { + Funs.DB.AttachFile.DeleteOnSubmit(getAtt); + Funs.DB.SubmitChanges(); + } + //多附件 + var attachFile = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == dataId); + if (attachFile == null && !string.IsNullOrEmpty(attachSource)) + { + Model.AttachFile newAttachFile = new Model.AttachFile + { + AttachFileId = attachFileId, + ToKeyId = dataId, + AttachSource = attachSource, + AttachUrl = attachUrl + }; + Funs.DB.AttachFile.InsertOnSubmit(newAttachFile); + Funs.DB.SubmitChanges(); + } + else + { + if (attachFile.AttachUrl != attachUrl) + { + ///删除附件文件 + BLL.UploadAttachmentService.DeleteFile(Funs.RootPath, attachFile.AttachUrl); + attachFile.AttachSource = attachSource; + attachFile.AttachUrl = attachUrl; + Funs.DB.SubmitChanges(); + } + } + } + } } diff --git a/SGGL/FineUIPro.Web/DCGL/ServerCheck/CheckNotice.aspx.cs b/SGGL/FineUIPro.Web/DCGL/ServerCheck/CheckNotice.aspx.cs index a08899ac..a7d158c9 100644 --- a/SGGL/FineUIPro.Web/DCGL/ServerCheck/CheckNotice.aspx.cs +++ b/SGGL/FineUIPro.Web/DCGL/ServerCheck/CheckNotice.aspx.cs @@ -396,7 +396,7 @@ namespace FineUIPro.Web.DCGL.ServerCheck JArray arr = JArray.Parse(data); if (arr.Count() > 0) { - using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString)) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { List ids = new List(); foreach (var item in arr) diff --git a/SGGL/FineUIPro.Web/DCGL/ServerCheck/CheckRectify.aspx.cs b/SGGL/FineUIPro.Web/DCGL/ServerCheck/CheckRectify.aspx.cs index 995b16c5..9ea7a3f7 100644 --- a/SGGL/FineUIPro.Web/DCGL/ServerCheck/CheckRectify.aspx.cs +++ b/SGGL/FineUIPro.Web/DCGL/ServerCheck/CheckRectify.aspx.cs @@ -423,7 +423,7 @@ namespace FineUIPro.Web.DCGL.ServerCheck JArray getData = JArray.Parse(obj["data"].ToString()); if (getData.Count() > 0) { - using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString)) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { List ids = new List(); foreach (var item in getData) @@ -655,7 +655,7 @@ namespace FineUIPro.Web.DCGL.ServerCheck JArray getData = JArray.Parse(obj["data"].ToString()); if (getData.Count() > 0) { - using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString)) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { List ids = new List(); foreach (var item in getData) diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index 3add8dbf..a5878805 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -1858,6 +1858,7 @@ + @@ -1896,12 +1897,22 @@ + + + + + + + + + +