From 8bf83936b280c4eb2ae90cf79fa2b81362060b30 Mon Sep 17 00:00:00 2001 From: 10191 <506754232@qq.com> Date: Thu, 4 May 2023 19:17:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9webservice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SGGL/BLL/Common/CommonService.cs | 8 +- SGGL/BLL/OpenService/FileInsertService.cs | 88 +++++ SGGL/BLL/OpenService/FileStructService.cs | 50 +++ .../CNCECHSSEService/HSSEService.disco | 2 +- .../CNCECHSSEService/HSSEService.wsdl | 2 +- .../CNCECHSSEService/HSSEService1.wsdl | 2 +- .../CNCECHSSEService/Reference.svcmap | 12 +- .../CNCECHSSEService/configuration.svcinfo | 2 +- .../CNCECHSSEService/configuration91.svcinfo | 2 +- SGGL/BLL/WebService/CNCECHSSEGetWebService.cs | 14 +- SGGL/Model/Model.cs | 323 ++++++++++++++++++ 11 files changed, 486 insertions(+), 19 deletions(-) diff --git a/SGGL/BLL/Common/CommonService.cs b/SGGL/BLL/Common/CommonService.cs index 8567d494..309f6ce7 100644 --- a/SGGL/BLL/Common/CommonService.cs +++ b/SGGL/BLL/Common/CommonService.cs @@ -1,4 +1,5 @@ -using System; +using BLL.CNCECHSSEService; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -719,5 +720,10 @@ namespace BLL if (now.Month < birthDate.Month || (now.Month == birthDate.Month && now.Day < birthDate.Day)) age--; return age; } + + public static Model.Base_Unit GetIsThisUnit() + { + return Funs.DB.Base_Unit.FirstOrDefault(x=>x.UnitId==Const.UnitId_CD); + } } } diff --git a/SGGL/BLL/OpenService/FileInsertService.cs b/SGGL/BLL/OpenService/FileInsertService.cs index 3f19aac2..69973c98 100644 --- a/SGGL/BLL/OpenService/FileInsertService.cs +++ b/SGGL/BLL/OpenService/FileInsertService.cs @@ -93,6 +93,51 @@ namespace BLL } } + public static void FileMoreInsert(byte[][] fileContextList, string attachUrl) + { + if (fileContextList != null && fileContextList.Count() > 0) + { + if (fileContextList.Length > 0) + { + string[] strs = attachUrl.Trim().Split(','); + int i = 0; + foreach (var item in fileContextList) + { + if (strs.Count() > i) + { + string physicalpath = Funs.RootPath; + //HttpContext.Current.Request.PhysicalApplicationPath; + string fullPath = physicalpath + strs[i]; + if (!File.Exists(fullPath)) + { + byte[] fileContext = item; + int index = fullPath.LastIndexOf("\\"); + string filePath = fullPath.Substring(0, index); + + if (!Directory.Exists(filePath)) + { + Directory.CreateDirectory(filePath); + } + //string savePath = fullPath + fileName; + + //文件读写模式 + System.IO.FileMode fileMode = System.IO.FileMode.Create; + + //写入文件 + using (System.IO.FileStream fs = new System.IO.FileStream(fullPath, fileMode, System.IO.FileAccess.Write)) + { + fs.Write(fileContext, 0, fileContext.Length); + } + } + + i++; + } + } + } + } + } + + /// /// 数据和附件插入到多附件表 /// @@ -134,5 +179,48 @@ namespace BLL } } } + + + public static void InsertAttachFile(string attachFileId, string dataId, string attachSource, string attachUrl, byte[][] fileContext) + { + 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(); + ////插入附件文件 + BLL.FileInsertService.FileMoreInsert(fileContext, attachUrl); + } + else + { + if (attachFile.AttachUrl != attachUrl) + { + ///删除附件文件 + BLL.UploadAttachmentService.DeleteFile(Funs.RootPath, attachFile.AttachUrl); + ////插入附件文件 + BLL.FileInsertService.FileMoreInsert(fileContext, attachUrl); + attachFile.AttachSource = attachSource; + attachFile.AttachUrl = attachUrl; + Funs.DB.SubmitChanges(); + } + } + } + + + } } diff --git a/SGGL/BLL/OpenService/FileStructService.cs b/SGGL/BLL/OpenService/FileStructService.cs index e934d718..91c1f4a4 100644 --- a/SGGL/BLL/OpenService/FileStructService.cs +++ b/SGGL/BLL/OpenService/FileStructService.cs @@ -103,5 +103,55 @@ namespace BLL } return fileContext; } + + public static byte[][] GetMoreFileArrayStructByAttachUrl(string attachUrl) + { + List fileContext = new List(); + if (!String.IsNullOrEmpty(attachUrl)) + { + string[] strs = attachUrl.Trim().Split(','); + foreach (var item in strs) + { + string filePath = string.Empty; + string physicalpath = Funs.RootPath; + //HttpContext.Current.Request.PhysicalApplicationPath; + filePath = physicalpath + item; + if (File.Exists(filePath)) + { + FileInfo fileInfo = new FileInfo(filePath); + if (fileInfo != null) + { + Stream stream = fileInfo.OpenRead(); + if (stream != null) + { + //读取指定大小的文件流内容到uploadFile.Context以便上传 + int b; + while (stream.Position > -1 && stream.Position < stream.Length) + { + if (stream.Length - stream.Position >= 20000000) + { + b = 20000000; + } + else + { + b = (int)(stream.Length - stream.Position); + } + + byte[] filebyte = new byte[b]; + stream.Read(filebyte, 0, b); + fileContext.Add(filebyte); + } + } + + stream.Close(); + } + } + } + } + return fileContext.ToArray(); + } + + + } } diff --git a/SGGL/BLL/Service References/CNCECHSSEService/HSSEService.disco b/SGGL/BLL/Service References/CNCECHSSEService/HSSEService.disco index 469c5448..b73eedbc 100644 --- a/SGGL/BLL/Service References/CNCECHSSEService/HSSEService.disco +++ b/SGGL/BLL/Service References/CNCECHSSEService/HSSEService.disco @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/SGGL/BLL/Service References/CNCECHSSEService/HSSEService.wsdl b/SGGL/BLL/Service References/CNCECHSSEService/HSSEService.wsdl index fba33000..d5271254 100644 --- a/SGGL/BLL/Service References/CNCECHSSEService/HSSEService.wsdl +++ b/SGGL/BLL/Service References/CNCECHSSEService/HSSEService.wsdl @@ -1,5 +1,5 @@ - + diff --git a/SGGL/BLL/Service References/CNCECHSSEService/HSSEService1.wsdl b/SGGL/BLL/Service References/CNCECHSSEService/HSSEService1.wsdl index bc8ef192..bd1346d2 100644 --- a/SGGL/BLL/Service References/CNCECHSSEService/HSSEService1.wsdl +++ b/SGGL/BLL/Service References/CNCECHSSEService/HSSEService1.wsdl @@ -1,5 +1,5 @@ - + diff --git a/SGGL/BLL/Service References/CNCECHSSEService/Reference.svcmap b/SGGL/BLL/Service References/CNCECHSSEService/Reference.svcmap index 8f317af7..3afe07b3 100644 --- a/SGGL/BLL/Service References/CNCECHSSEService/Reference.svcmap +++ b/SGGL/BLL/Service References/CNCECHSSEService/Reference.svcmap @@ -1,5 +1,5 @@ - + false true @@ -22,13 +22,13 @@ - - - - - + + + + + diff --git a/SGGL/BLL/Service References/CNCECHSSEService/configuration.svcinfo b/SGGL/BLL/Service References/CNCECHSSEService/configuration.svcinfo index c91baf4e..7259b0cf 100644 --- a/SGGL/BLL/Service References/CNCECHSSEService/configuration.svcinfo +++ b/SGGL/BLL/Service References/CNCECHSSEService/configuration.svcinfo @@ -1,5 +1,5 @@  - + diff --git a/SGGL/BLL/Service References/CNCECHSSEService/configuration91.svcinfo b/SGGL/BLL/Service References/CNCECHSSEService/configuration91.svcinfo index 9dca5899..c7fe4623 100644 --- a/SGGL/BLL/Service References/CNCECHSSEService/configuration91.svcinfo +++ b/SGGL/BLL/Service References/CNCECHSSEService/configuration91.svcinfo @@ -1,5 +1,5 @@ - + diff --git a/SGGL/BLL/WebService/CNCECHSSEGetWebService.cs b/SGGL/BLL/WebService/CNCECHSSEGetWebService.cs index d16788d1..5120ecc5 100644 --- a/SGGL/BLL/WebService/CNCECHSSEGetWebService.cs +++ b/SGGL/BLL/WebService/CNCECHSSEGetWebService.cs @@ -1535,7 +1535,7 @@ ResultLevel = x.ResultLevel, }; - var getR = hsseC.DataInsertSupervise_UpCheckReportTable(upCheckReport.ToList(), upCheckReportItem.ToList(), upCheckReportItem2.ToList()); + var getR = hsseC.DataInsertSupervise_UpCheckReportTable(upCheckReport.ToArray(), upCheckReportItem.ToArray(), upCheckReportItem2.ToArray()); foreach (var item in getR) { var report = db.Supervise_UpCheckReport.FirstOrDefault(e => e.UpCheckReportId == item); @@ -1549,7 +1549,7 @@ } } code = "1"; - LogService.AddSys_Log(CurrUser, "【安全监督检查评价报告】上传到服务器" + getR.Count.ToString() + "条数据;", null, BLL.Const.UpCheckReportMenuId, BLL.Const.BtnUploadResources); + LogService.AddSys_Log(CurrUser, "【安全监督检查评价报告】上传到服务器" + getR.Length.ToString() + "条数据;", null, BLL.Const.UpCheckReportMenuId, BLL.Const.BtnUploadResources); } catch (Exception ex) { @@ -1597,10 +1597,10 @@ AttachSource = x.AttachSource2, AttachUrl = x.AttachUrl2, ////附件转为字节传送 - FileContext = FileStructService.GetMoreFileStructByAttachUrl(x.AttachUrl2), + FileContext = FileStructService.GetMoreFileArrayStructByAttachUrl(x.AttachUrl2), }; - var getR = hsseC.DataInsertCheck_CheckRectifyTable(upCheckReport.ToList()); + var getR = hsseC.DataInsertCheck_CheckRectifyTable(upCheckReport.ToArray()); foreach (var item in getR) { var newCheckRectify = db.Check_CheckRectify.FirstOrDefault(e => e.CheckRectifyId == item); @@ -1611,7 +1611,7 @@ } } code = "1"; - LogService.AddSys_Log(CurrUser, "【集团检查整改】上传到服务器" + getR.Count.ToString() + "条数据;", null, BLL.Const.UpCheckReportMenuId, BLL.Const.BtnUploadResources); + LogService.AddSys_Log(CurrUser, "【集团检查整改】上传到服务器" + getR.Length.ToString() + "条数据;", null, BLL.Const.UpCheckReportMenuId, BLL.Const.BtnUploadResources); } catch (Exception ex) { @@ -1652,11 +1652,11 @@ AttachSource = x.AttachSource, AttachUrl = x.AttachUrl, ////附件转为字节传送 - FileContext = FileStructService.GetMoreFileStructByAttachUrl(x.AttachUrl), + FileContext = FileStructService.GetMoreFileArrayStructByAttachUrl(x.AttachUrl), }; if (upCheckReport.Count() > 0) { - var getR = hsseC.DataInsertSupervise_SubUnitReportItemItemTable(upCheckReport.ToList()); + var getR = hsseC.DataInsertSupervise_SubUnitReportItemItemTable(upCheckReport.ToArray()); foreach (var item in getR) { var subUnitReportItem = db.Supervise_SubUnitReportItem.FirstOrDefault(e => e.SubUnitReportItemId == item); diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs index c88ef132..8ddc24d6 100644 --- a/SGGL/Model/Model.cs +++ b/SGGL/Model/Model.cs @@ -9261,6 +9261,14 @@ namespace Model } } + public System.Data.Linq.Table View_Supervise_SubUnitReportItem + { + get + { + return this.GetTable(); + } + } + public System.Data.Linq.Table View_Supervise_SuperviseCheckRectify { get @@ -406208,6 +406216,321 @@ namespace Model } } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.View_Supervise_SubUnitReportItem")] + public partial class View_Supervise_SubUnitReportItem + { + + private string _SubUnitReportItemId; + + private string _SubUnitReportId; + + private string _UnitId; + + private System.Nullable _PlanReortDate; + + private string _ReportTitle; + + private string _ReportContent; + + private System.Nullable _ReportDate; + + private string _State; + + private string _UpState; + + private string _AttachUrlName; + + private string _UnitName; + + private string _UpStates; + + private string _UpStateName; + + private string _AttachFileId; + + private string _ToKeyId; + + private string _AttachSource; + + private string _AttachUrl; + + public View_Supervise_SubUnitReportItem() + { + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SubUnitReportItemId", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] + public string SubUnitReportItemId + { + get + { + return this._SubUnitReportItemId; + } + set + { + if ((this._SubUnitReportItemId != value)) + { + this._SubUnitReportItemId = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SubUnitReportId", DbType="NVarChar(50)")] + public string SubUnitReportId + { + get + { + return this._SubUnitReportId; + } + set + { + if ((this._SubUnitReportId != value)) + { + this._SubUnitReportId = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitId", DbType="NVarChar(50)")] + public string UnitId + { + get + { + return this._UnitId; + } + set + { + if ((this._UnitId != value)) + { + this._UnitId = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PlanReortDate", DbType="DateTime")] + public System.Nullable PlanReortDate + { + get + { + return this._PlanReortDate; + } + set + { + if ((this._PlanReortDate != value)) + { + this._PlanReortDate = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ReportTitle", DbType="NVarChar(500)")] + public string ReportTitle + { + get + { + return this._ReportTitle; + } + set + { + if ((this._ReportTitle != value)) + { + this._ReportTitle = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ReportContent", DbType="NVarChar(1000)")] + public string ReportContent + { + get + { + return this._ReportContent; + } + set + { + if ((this._ReportContent != value)) + { + this._ReportContent = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ReportDate", DbType="DateTime")] + public System.Nullable ReportDate + { + get + { + return this._ReportDate; + } + set + { + if ((this._ReportDate != value)) + { + this._ReportDate = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_State", DbType="Char(1)")] + public string State + { + get + { + return this._State; + } + set + { + if ((this._State != value)) + { + this._State = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UpState", DbType="Char(1)")] + public string UpState + { + get + { + return this._UpState; + } + set + { + if ((this._UpState != value)) + { + this._UpState = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AttachUrlName", DbType="NVarChar(MAX)", UpdateCheck=UpdateCheck.Never)] + public string AttachUrlName + { + get + { + return this._AttachUrlName; + } + set + { + if ((this._AttachUrlName != value)) + { + this._AttachUrlName = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitName", DbType="NVarChar(200)")] + public string UnitName + { + get + { + return this._UnitName; + } + set + { + if ((this._UnitName != value)) + { + this._UnitName = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UpStates", DbType="VarChar(8)")] + public string UpStates + { + get + { + return this._UpStates; + } + set + { + if ((this._UpStates != value)) + { + this._UpStates = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UpStateName", DbType="NVarChar(100)")] + public string UpStateName + { + get + { + return this._UpStateName; + } + set + { + if ((this._UpStateName != value)) + { + this._UpStateName = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AttachFileId", DbType="NVarChar(50)")] + public string AttachFileId + { + get + { + return this._AttachFileId; + } + set + { + if ((this._AttachFileId != value)) + { + this._AttachFileId = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ToKeyId", DbType="NVarChar(50)")] + public string ToKeyId + { + get + { + return this._ToKeyId; + } + set + { + if ((this._ToKeyId != value)) + { + this._ToKeyId = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AttachSource", DbType="NVarChar(MAX)", UpdateCheck=UpdateCheck.Never)] + public string AttachSource + { + get + { + return this._AttachSource; + } + set + { + if ((this._AttachSource != value)) + { + this._AttachSource = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AttachUrl", DbType="NVarChar(MAX)", UpdateCheck=UpdateCheck.Never)] + public string AttachUrl + { + get + { + return this._AttachUrl; + } + set + { + if ((this._AttachUrl != value)) + { + this._AttachUrl = value; + } + } + } + } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.View_Supervise_SuperviseCheckRectify")] public partial class View_Supervise_SuperviseCheckRectify {