From 7190ab39eafda10eacf1cf67bdf45427c64363b3 Mon Sep 17 00:00:00 2001 From: ndbs Date: Fri, 24 Dec 2021 18:30:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E6=96=87=E4=B8=8B=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/Notice/FormFlowView.cshtml | 8 +- .../LR_OAModule/Views/Notice/FormFlowView.js | 5 + .../Views/Login/Default/Index.js | 18 ++- .../XmlConfig/system.config | 9 +- .../Learun.Application.OA/News/NewsService.cs | 127 +++++++++++------- 5 files changed, 104 insertions(+), 63 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/FormFlowView.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/FormFlowView.cshtml index bf8306d53..a7961a014 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/FormFlowView.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/FormFlowView.cshtml @@ -4,9 +4,13 @@ }
-
+
公告标题*
- + +
+
+
下发CMS*
+
公告类别*
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/FormFlowView.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/FormFlowView.js index b2d67294e..d4260d011 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/FormFlowView.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/FormFlowView.js @@ -28,6 +28,11 @@ var bootstrap = function ($, learun) { page.initData(); }, bind: function () { + $('#IsSend').lrselect({ + data: [{ text: "是", value: "1" }, { text: "否", value: "0" }], + text: "text", + value: "value" + }); //公告类别 $('#F_CategoryId').lrDataItemSelect({ code: 'NoticeCategory', maxHeight: 230, select: function (item) { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/Default/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/Default/Index.js index c2ab76654..0e126f0ef 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/Default/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/Default/Index.js @@ -176,22 +176,28 @@ success: function (res) { if (res.code == 200) { if (source == "noLogin") { - window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/SSOSystem/Index"; + //window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/SSOSystem/Index"; + window.location.href = "/SSOSystem/Index"; } else if (source == "NoLogin") { - window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/SSOSystem/DragModelOne"; + window.location.href = "SSOSystem/DragModelOne"; + //window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/SSOSystem/DragModelOne"; } else { if (res.data.pwd == true) { if (res.data.pwdtip == true) { - window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/Home/Index?pwdpwdtip=true"; + window.location.href = "/Home/Index?pwdpwdtip=true"; + //window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/Home/Index?pwdpwdtip=true"; } else { - window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/Home/Index?pwd=true"; + //window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/Home/Index?pwd=true"; + window.location.href = "/Home/Index?pwd=true"; } } else { if (res.data.pwdtip == true) { - window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/Home/Index?pwdtip=true"; + window.location.href = "/Home/Index?pwdtip=true"; + //window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/Home/Index?pwdtip=true"; } else { - window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/Home/Index"; + window.location.href = "/Home/Index"; + //window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/Home/Index"; } //window.location.href = "/Home/Index"; } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config b/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config index ea87cb9b4..ce6d8fa1e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config @@ -169,11 +169,10 @@ - - + + - - - + + \ No newline at end of file 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 cd2fbe287..87d98f58e 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 @@ -9,6 +9,8 @@ using Spire.Pdf.General.Render.Decode.Jpeg2000.Icc; using static Learun.Application.OA.NewsEntity; using Nancy.Helpers; using System.Configuration; +using System.Threading.Tasks; +using Newtonsoft.Json; namespace Learun.Application.OA { @@ -183,69 +185,24 @@ namespace Learun.Application.OA { try { - var newEntity = this.BaseRepository().FindEntity(a => a.F_ProgressId == parameterProcessId); if (null != newEntity) { if (status == 2) { newEntity.F_Status = "2"; - if (newEntity.IsSend == "1") //判断是否下发 - { - #region 获取配置文件 - - string siteId = HttpUtility.UrlEncode(ConfigurationManager.AppSettings["SiteId"]); - string channelId = HttpUtility.UrlEncode(ConfigurationManager.AppSettings["ChannelId"]); - string ApiKey = HttpUtility.UrlEncode(ConfigurationManager.AppSettings["ApiKey"]); - string ports = HttpUtility.UrlEncode(ConfigurationManager.AppSettings["Ports"]); - - #endregion - SemdNewList SendNew = new SemdNewList - { - Title = newEntity.F_FullHead, - SubTitle = newEntity.F_BriefHead, - Content = newEntity.F_NewsContent, - Author = newEntity.F_AuthorName, - Source = newEntity.F_SourceName, - AddDate = DateTime.Now, - Tags = newEntity.F_TagWord, - AddUserName = newEntity.F_CreateUserName, - }; - WebHeaderCollection ApiId = new WebHeaderCollection - { - { "X-SS-API-KEY", ApiKey } - }; - - string responses = Util.HttpMethods.HttpPosts("http://localhost:" + ports + "/api/v1/contents/" + siteId + "/" + channelId, SendNew.ToJson(), ApiId); - - #region 修改审核状态 - JavaScriptSerializer Jss = new JavaScriptSerializer(); - Dictionary DicText = (Dictionary)Jss.DeserializeObject(responses); - string Nid = DicText["id"].ToString(); - AuditList AList = new AuditList(); - if (Nid != null) - { - AList.siteId = siteId; - List listCon = new List(); - //这里应该循环,如果多个 - contents con = new contents(); - con.channelId = Convert.ToInt32(channelId); - con.id = Convert.ToInt32(Nid); - listCon.Add(con); - AList.contents = listCon; - AList.reasons = "终审通过"; - Util.HttpMethods.HttpPosts("http://localhost:" + ports + "/api/v1/contents/actions/check", AList.ToJson(), ApiId); - } - #endregion - } } else { newEntity.F_Status = "0"; } } - this.BaseRepository().Update(newEntity); + + if (newEntity.IsSend == "1" && status == 2) + { + Task.Run(async () => { sendNew(newEntity); }); + } } catch (Exception ex) { @@ -259,5 +216,75 @@ namespace Learun.Application.OA } } } + + public void sendNew(NewsEntity newEntity) + { + try + { + + if (newEntity.IsSend == "1") //判断是否下发 + { + #region 获取配置文件 + + string siteId = ConfigurationManager.AppSettings["SiteId"]; + string channelId = ConfigurationManager.AppSettings["ChannelId"]; + string ApiKey = ConfigurationManager.AppSettings["ApiKey"]; + string ports = ConfigurationManager.AppSettings["Ports"]; + + #endregion + SemdNewList SendNew = new SemdNewList + { + Title = newEntity.F_FullHead, + SubTitle = newEntity.F_BriefHead, + Content = newEntity.F_NewsContent, + Author = newEntity.F_AuthorName, + Source = newEntity.F_SourceName, + AddDate = DateTime.Now, + Tags = newEntity.F_TagWord, + AddUserName = newEntity.F_CreateUserName, + }; + WebHeaderCollection ApiId = new WebHeaderCollection + { + { "X-SS-API-KEY", ApiKey } + }; + + string responses = HttpMethods.HttpPosts("http://" + ports + "/api/v1/contents/" + siteId + "/" + channelId, SendNew.ToJson(), ApiId); + + #region 修改审核状态 + + string Nid = JsonConvert.DeserializeObject(responses).value.id; + AuditList AList = new AuditList(); + if (Nid != null) + { + AList.siteId = siteId; + List listCon = new List(); + //这里应该循环,如果多个 + contents con = new contents(); + con.channelId = Convert.ToInt32(channelId); + con.id = Convert.ToInt32(Nid); + listCon.Add(con); + AList.contents = listCon; + //AList.reasons = "终审通过"; + HttpMethods.HttpPosts("http://" + ports + "/api/v1/contents/check", AList.ToJson(), ApiId); + } + #endregion + } + } + catch (Exception ex) + { + + } + } + + } + + public class Root + { + public RootValue value { get; set; } + } + + public class RootValue + { + public string id { get; set; } } }