Просмотр исходного кода

下发通知公告

临城职教中职
ndbs 2 лет назад
Родитель
Сommit
de1684e161
8 измененных файлов: 282 добавлений и 4 удалений
  1. +5
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/FormFlow.cshtml
  2. +5
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/FormFlow.js
  3. +5
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/Index.js
  4. +9
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config
  5. +4
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Learun.Application.OA.csproj
  6. +172
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/News/NewsEntity.cs
  7. +55
    -3
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/News/NewsService.cs
  8. +27
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Web/HttpMethods.cs

+ 5
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/FormFlow.cshtml Просмотреть файл

@@ -4,10 +4,14 @@
} }


<div class="lr-form-wrap" id="form"> <div class="lr-form-wrap" id="form">
<div class="col-xs-12 lr-form-item" data-table="OANews">
<div class="col-xs-6 lr-form-item" data-table="OANews">
<div class="lr-form-item-title">公告标题<font face="宋体">*</font></div> <div class="lr-form-item-title">公告标题<font face="宋体">*</font></div>
<input id="F_FullHead" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" placeholder="请输入标题" /> <input id="F_FullHead" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" placeholder="请输入标题" />
</div> </div>
<div class="col-xs-6 lr-form-item" data-table="OANews">
<div class="lr-form-item-title">下发CMS<font face="宋体">*</font></div>
<div id="IsSend" isvalid="yes" checkexpession="NotNull"></div>
</div>
<div class="col-xs-6 lr-form-item" data-table="OANews"> <div class="col-xs-6 lr-form-item" data-table="OANews">
<div class="lr-form-item-title">公告类别<font face="宋体">*</font></div> <div class="lr-form-item-title">公告类别<font face="宋体">*</font></div>
<div id="F_CategoryId" isvalid="yes" checkexpession="NotNull"></div> <div id="F_CategoryId" isvalid="yes" checkexpession="NotNull"></div>


+ 5
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/FormFlow.js Просмотреть файл

@@ -26,6 +26,11 @@ var bootstrap = function ($, learun) {
}, },
bind: function () { bind: function () {
var loginInfo = top.learun.clientdata.get(['userinfo']); var loginInfo = top.learun.clientdata.get(['userinfo']);
$('#IsSend').lrselect({
data: [{ text: "是", value: "1" }, { text: "否", value: "0" }],
text: "text",
value: "value"
});
//公告类别 //公告类别
$('#F_CategoryId').lrselect({ $('#F_CategoryId').lrselect({
url: top.$.rootUrl + '/LR_OAModule/Notice/GetNoticeCategoryByDepartment?userId=' + loginInfo.userId, url: top.$.rootUrl + '/LR_OAModule/Notice/GetNoticeCategoryByDepartment?userId=' + loginInfo.userId,


+ 5
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/Index.js Просмотреть файл

@@ -23,6 +23,11 @@ var bootstrap = function ($, learun) {
$('#lr_refresh').on('click', function () { $('#lr_refresh').on('click', function () {
location.reload(); location.reload();
}); });
$('#IsSend').lrselect({
data: [{ text: "是", value: "1" }, { text: "是", value: "否" }],
text: "text",
value: "value"
});
// 新增 // 新增
$('#lr_add').on('click', function () { $('#lr_add').on('click', function () {
learun.layerForm({ learun.layerForm({


+ 9
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config Просмотреть файл

@@ -167,4 +167,13 @@
<add key="ForbidLoginNum" value="5"/> <add key="ForbidLoginNum" value="5"/>
<!-- 禁止登录时间(分钟) --> <!-- 禁止登录时间(分钟) -->
<add key="ForbidLoginMinutes" value="10"/> <add key="ForbidLoginMinutes" value="10"/>

<!--下发新闻配置-->
<add key="SiteId" value="1"/>
<add key="ChannelId" value="6"/>
<!--秘钥-->
<add key="ApiKey" value="fafc361a-40c1-4060-8eee-ea796640c39c"/>
<!--CMS部署端口-->
<add key="Ports" value="8007"/>

</appSettings> </appSettings>

+ 4
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Learun.Application.OA.csproj Просмотреть файл

@@ -45,6 +45,9 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Dapper.1.50.2\lib\net45\Dapper.dll</HintPath> <HintPath>..\..\..\packages\Dapper.1.50.2\lib\net45\Dapper.dll</HintPath>
</Reference> </Reference>
<Reference Include="Nancy, Version=1.4.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Nancy.1.4.1\lib\net40\Nancy.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\..\..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
@@ -95,6 +98,7 @@
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />


+ 172
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/News/NewsEntity.cs Просмотреть файл

@@ -1,5 +1,6 @@
using Learun.Util; using Learun.Util;
using System; using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;


namespace Learun.Application.OA namespace Learun.Application.OA
@@ -206,6 +207,12 @@ namespace Learun.Application.OA
/// </summary> /// </summary>
[NotMapped] [NotMapped]
public string RTime { get; set; } public string RTime { get; set; }

/// <summary>
/// 是否下发到网站
/// </summary>
[Column("ISSEND")]
public string IsSend { get; set; }
#endregion #endregion


#region 扩展操作 #region 扩展操作
@@ -241,6 +248,171 @@ namespace Learun.Application.OA
} }
#endregion #endregion


public class SemdNewList
{
/// <summary>
/// 添加人
/// </summary>
[NotMapped]
public string AddUserName { get; set; }
/// <summary>
/// 修改人
/// </summary>
[NotMapped]
public string LastEditUserName { get; set; }
/// <summary>
/// 投稿人
/// </summary>
[NotMapped]
public string WritingUserName { get; set; }
/// <summary>
/// 修改时间
/// </summary>
[NotMapped]
public DateTime? LastEditDate { get; set; }
/// <summary>
/// 排序
/// </summary>
[NotMapped]
public int? Taxis { get; set; }
/// <summary>
/// 内容组
/// </summary>
[NotMapped]
public string GroupNameCollection { get; set; }
/// <summary>
/// 标签
/// </summary>
[NotMapped]
public string Tags { get; set; }
/// <summary>
/// 来源内容Id
/// </summary>
[NotMapped]
public int? SourceId { get; set; }
/// <summary>
/// 引用内容Id
/// </summary>
[NotMapped]
public int? ReferenceId { get; set; }
/// <summary>
/// 是否终审通过通过
/// </summary>
[NotMapped]
public string IsChecked { get; set; }
/// <summary>
/// 未终审通过情况下,处于第几级审核状态
/// </summary>
[NotMapped]
public int? CheckedLevel { get; set; }
/// <summary>
/// 总点击量
/// </summary>
[NotMapped]
public int? Hits { get; set; }
/// <summary>
/// 日点击
/// </summary>
[NotMapped]
public int? HitsByDay { get; set; }
/// <summary>
/// 月点击
/// </summary>
[NotMapped]
public int? HitsByMonth { get; set; }
/// <summary>
/// 最后点击时间
/// </summary>
[NotMapped]
public DateTime? LastHitsDate { get; set; }
/// <summary>
/// 标题
/// </summary>
[NotMapped]
public string Title { get; set; }
[NotMapped]
/// <summary>
/// 是否置顶内容
/// </summary>
public int? IsTop { get; set; }
/// <summary>
/// 是否置顶内容
/// </summary>
[NotMapped]
public int? IsRecommend { get; set; }
/// <summary>
/// 是否热点内容
/// </summary>
[NotMapped]
public int? IsHot { get; set; }
/// <summary>
/// 是否醒目内容
/// </summary>
[NotMapped]
public int? IsColor { get; set; }
/// <summary>
/// 外部链接
/// </summary>
[NotMapped]
public string LinkUrl { get; set; }
/// <summary>
/// 添加时间
/// </summary>
[NotMapped]
public DateTime? AddDate { get; set; }
/// <summary>
/// 内容副标题
/// </summary>
[NotMapped]
public string SubTitle { get; set; }
/// <summary>
/// 内容图片
/// </summary>
[NotMapped]
public string ImageUrl { get; set; }
/// <summary>
/// 内容视频
/// </summary>
[NotMapped]
public string VideoUrl { get; set; }
/// <summary>
/// 内容附件
/// </summary>
[NotMapped]
public string FileUrl { get; set; }
/// <summary>
/// 内容正文
/// </summary>
[NotMapped]
public string Content { get; set; }
/// <summary>
/// 内容摘要
/// </summary>
[NotMapped]
public string Summary { get; set; }
/// <summary>
/// 作者
/// </summary>
[NotMapped]
public string Author { get; set; }
/// <summary>
/// 来源
/// </summary>
[NotMapped]
public string Source { get; set; }
}

public class AuditList
{
public string siteId { get; set; }
public List<contents> contents { get; set; }
public string reasons { get; set; }
}


public class contents
{
public int channelId { get; set; }
public int id { get; set; }
}
} }
} }

+ 55
- 3
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/News/NewsService.cs Просмотреть файл

@@ -2,8 +2,13 @@
using Learun.Util; using Learun.Util;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net;
using System.Text; using System.Text;
using Nancy.Json;
using Spire.Pdf.General.Render.Decode.Jpeg2000.Icc; using Spire.Pdf.General.Render.Decode.Jpeg2000.Icc;
using static Learun.Application.OA.NewsEntity;
using Nancy.Helpers;
using System.Configuration;


namespace Learun.Application.OA namespace Learun.Application.OA
{ {
@@ -16,6 +21,7 @@ namespace Learun.Application.OA
/// </summary> /// </summary>
public class NewsService : RepositoryFactory public class NewsService : RepositoryFactory
{ {

#region 获取数据 #region 获取数据
/// <summary> /// <summary>
/// 新闻列表 /// 新闻列表
@@ -178,14 +184,60 @@ namespace Learun.Application.OA
try try
{ {


var newEntity = this.BaseRepository()
.FindEntity<NewsEntity>(a => a.F_ProgressId == parameterProcessId);
var newEntity = this.BaseRepository().FindEntity<NewsEntity>(a => a.F_ProgressId == parameterProcessId);
if (null != newEntity) if (null != newEntity)
{ {
if (status == 2) if (status == 2)
{ {

newEntity.F_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<string, object> DicText = (Dictionary<string, object>)Jss.DeserializeObject(responses);
string Nid = DicText["id"].ToString();
AuditList AList = new AuditList();
if (Nid != null)
{
AList.siteId = siteId;
List<contents> listCon = new List<contents>();
//这里应该循环,如果多个
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 else
{ {


+ 27
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Web/HttpMethods.cs Просмотреть файл

@@ -148,5 +148,32 @@ namespace Learun.Util
} }
return result; return result;
} }

public static string HttpPosts(string url, string json, WebHeaderCollection header)
{
string result = "";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.ContentType = "application/json;charset=UTF-8";
req.Headers.Add(header);
byte[] data = Encoding.UTF8.GetBytes(json);//把字符串转换为字节

req.ContentLength = data.Length; //请求长度

using (Stream reqStream = req.GetRequestStream()) //获取
{
reqStream.Write(data, 0, data.Length);//向当前流中写入字节
reqStream.Close(); //关闭当前流
}

HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); //响应结果
Stream stream = resp.GetResponseStream();
//获取响应内容
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{
result = reader.ReadToEnd();
}
return result;
}
} }
} }

Загрузка…
Отмена
Сохранить