diff --git a/.vs/SGGL_SeDin/v17/.wsuo b/.vs/SGGL_SeDin/v17/.wsuo index 761316d1..809a674e 100644 Binary files a/.vs/SGGL_SeDin/v17/.wsuo and b/.vs/SGGL_SeDin/v17/.wsuo differ diff --git a/SGGL/FineUIPro.Mobile/FineUIPro.Mobile.csproj b/SGGL/FineUIPro.Mobile/FineUIPro.Mobile.csproj index cf24d76b..af590214 100644 --- a/SGGL/FineUIPro.Mobile/FineUIPro.Mobile.csproj +++ b/SGGL/FineUIPro.Mobile/FineUIPro.Mobile.csproj @@ -3365,7 +3365,6 @@ BidDocumentsReviewDetail.aspx - ASPXCodeBehind BidDocumentsReviewDetail.aspx diff --git a/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx b/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx new file mode 100644 index 00000000..daefa1df --- /dev/null +++ b/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx @@ -0,0 +1,297 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="OnlineEditing.aspx.cs" Inherits="FineUIPro.Web.AttachFile.OnlineEditing" %> + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+ +
+
+
+
+ + + + diff --git a/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx.cs b/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx.cs new file mode 100644 index 00000000..6fd16772 --- /dev/null +++ b/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx.cs @@ -0,0 +1,76 @@ +using BLL; +using RestSharp; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace FineUIPro.Web.AttachFile +{ + public partial class OnlineEditing : System.Web.UI.Page + { + #region 定义参数 + public string UserId + { + get + { + return (string)ViewState["UserId"]; + } + set + { + ViewState["UserId"] = value; + } + } + public string UserName + { + get + { + return (string)ViewState["UserName"]; + } + set + { + ViewState["UserName"] = value; + } + } + public string PCUrl + { + get + { + return (string)ViewState["PCUrl"]; + } + set + { + ViewState["PCUrl"] = value; + } + } + public string CanSave + { + get + { + return (string)ViewState["CanSave"]; + } + set + { + ViewState["CanSave"] = value; + } + } + #endregion + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + UserId = Request.Params["UserId"]; + // UserId = "C4A62EC0-E5D3-4EBF-A5FA-E56AA89633C0"; + CanSave = Request.Params["CanSave"]; + PCUrl = Request.Params["PCUrl"]; + // PCUrl = "https://sggl.sedin.com.cn/FileUpLoad/K350-ZBJH-001.doc"; + UserName=BLL.Person_PersonsService.GetPersonsNameById(UserId); + CanSave = "true"; + } + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx.designer.cs b/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx.designer.cs new file mode 100644 index 00000000..ec9d1dd5 --- /dev/null +++ b/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx.designer.cs @@ -0,0 +1,17 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.AttachFile +{ + + + public partial class OnlineEditing + { + } +} diff --git a/SGGL/FineUIPro.Web/CQMS/Plan/MainPlan.aspx.cs b/SGGL/FineUIPro.Web/CQMS/Plan/MainPlan.aspx.cs index 62c4f202..d6e32412 100644 --- a/SGGL/FineUIPro.Web/CQMS/Plan/MainPlan.aspx.cs +++ b/SGGL/FineUIPro.Web/CQMS/Plan/MainPlan.aspx.cs @@ -395,8 +395,11 @@ namespace FineUIPro.Web.CQMS.Plan { if (!string.IsNullOrEmpty(Grid1.SelectedRowID)) { - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/AttachFile/IndexOffice.aspx?cmd={0}|CQMSMainPlan", Grid1.SelectedRowID, "查看 -"))); - PageContext.RegisterStartupScript(Window1.GetHideReference()); + var ins = BLL.CQMS_MainPlanService.GetMainPlanByMainPlanId(Grid1.SelectedRowID); + + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/AttachFile/OnlineEditing.aspx?UserId={0}&PCUrl={1}", this.CurrUser.PersonId, ins.FilePath,"查看 -"))); + // PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/AttachFile/IndexOffice.aspx?cmd={0}|CQMSMainPlan", Grid1.SelectedRowID, "查看 -"))); + // PageContext.RegisterStartupScript(Window1.GetHideReference()); } else diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index 056362c0..9c77fe04 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -233,6 +233,7 @@ + @@ -5781,6 +5782,13 @@ Look.aspx + + OnlineEditing.aspx + ASPXCodeBehind + + + OnlineEditing.aspx + player.aspx ASPXCodeBehind diff --git a/SGGL/Model/APIItem/SaveOnlineFileItem.cs b/SGGL/Model/APIItem/SaveOnlineFileItem.cs new file mode 100644 index 00000000..af38de00 --- /dev/null +++ b/SGGL/Model/APIItem/SaveOnlineFileItem.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model +{ + public class SaveOnlineFileItem + { + /// + /// + /// + public string md5 + { + get; + set; + } + /// + /// + /// + public string expires + { + get; + set; + } + /// + /// + /// + public string disposition + { + get; + set; + } + /// + /// 文件名称 + /// + public string filename + { + get; + set; + } + /// + /// 保存路径 + /// + public string PCUrl + { + get; + set; + } + /// + /// 文件路径 + /// + public string UrlStr + { + get; + set; + } + } +} diff --git a/SGGL/Model/Model.csproj b/SGGL/Model/Model.csproj index 3b0d9987..1ad63674 100644 --- a/SGGL/Model/Model.csproj +++ b/SGGL/Model/Model.csproj @@ -155,6 +155,7 @@ + diff --git a/SGGL/WebAPI/Controllers/FileUploadController.cs b/SGGL/WebAPI/Controllers/FileUploadController.cs index d75f4e5e..34b8a710 100644 --- a/SGGL/WebAPI/Controllers/FileUploadController.cs +++ b/SGGL/WebAPI/Controllers/FileUploadController.cs @@ -3,7 +3,10 @@ using System; using System.Configuration; using System.Drawing; using System.IO; +using System.Net.Http; +using System.Security.Policy; using System.Text; +using System.Threading.Tasks; using System.Web; using System.Web.Http; @@ -136,7 +139,51 @@ namespace WebAPI.Controllers return responeData; } #endregion + /// + /// 在线编辑回调保存文件 + /// + /// + /// + [HttpPost] + public async Task DownloadDocument([FromBody] Model.SaveOnlineFileItem toDoItem) + //public async Task DownloadDocument( string UrlStr, string PCUrl) + { + var responeData = new Model.ResponeData(); + + HttpClient _httpClient = new HttpClient(); + try + { + System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; + // 发送 GET 请求以获取文件内容 + var response = await _httpClient.GetAsync(toDoItem.UrlStr); + response.EnsureSuccessStatusCode(); + string savePath = ""; + if (!string.IsNullOrEmpty(toDoItem.PCUrl)) + { + savePath = ConfigurationManager.AppSettings["localRoot"]+toDoItem.PCUrl; + + } + if (savePath != null) + { + // 将文件内容保存到本地 + using (var fileStream = File.Create(savePath)) + { + await response.Content.CopyToAsync(fileStream); + } + responeData.data = "文件已成功下载并保存到本地"; + // Console.WriteLine("文件已成功下载并保存到本地。"); + + } + return responeData; + } + catch (Exception ex) + { + responeData.code=0; + responeData.message = $"下载文件时出现错误:{ex.Message}"; + return responeData; + } + } #region 附件上传 /// /// 附件上传 diff --git a/SGGL/WebAPI/WebAPI.csproj b/SGGL/WebAPI/WebAPI.csproj index b739aa97..6ecd606f 100644 --- a/SGGL/WebAPI/WebAPI.csproj +++ b/SGGL/WebAPI/WebAPI.csproj @@ -301,6 +301,7 @@ +