using Learun.Application.OA; using Learun.Util; using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Threading.Tasks; using System.Web; using System.Web.Mvc; using Learun.Application.Base.AuthorizeModule; using Learun.Application.Base.SystemModule; using Learun.Application.Organization; using Learun.Application.TwoDevelopment.LR_Desktop; using Learun.Util.Operat; using Microsoft.AspNet.SignalR.Client; using Microsoft.Owin.Logging; using Newtonsoft.Json; using Learun.Application.TwoDevelopment.EducationalAdministration; using Learun.Application.TwoDevelopment.Permission; namespace Learun.Application.Web.Areas.LR_OAModule.Controllers { /// /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 /// Copyright (c) 2013-2018 北京泉江科技有限公司 /// 创建人:陈彬彬 /// 日 期:2017.04.01 /// 描 述:公告管理 /// public class NoticeController : MvcControllerBase { private NoticeIBLL noticeIBLL = new NoticeBLL(); private WeChatConfigIBLL weChatConfigIbll = new WeChatConfigBLL(); private WeChatTempletIBLL weChatTempletIbll = new WeChatTempletBLL(); private UserIBLL userIbll = new UserBLL(); private UserRelationIBLL userRelationIBLL = new UserRelationBLL(); private DataItemIBLL dataItemIbll = new DataItemBLL(); private DepartmentIBLL departmentIbll = new DepartmentBLL(); private Sys_InformationPushIBLL sys_InformationPushIBLL = new Sys_InformationPushBLL(); private DepartmentReleasePermissionsIBLL departmentReleasePermissionsIbll = new DepartmentReleasePermissionsBLL(); private MessageRindIBLL messageRindIBLL = new MessageRindBLL(); #region 视图功能 /// /// 管理页面 /// /// [HttpGet] public ActionResult Index() { return View(); } /// /// 表单页面 /// /// [HttpGet] public ActionResult Form() { return View(); } /// /// 通知公告(需要审核) /// /// [HttpGet] public ActionResult IndexFlow() { return View(); } /// /// 通知公告表单(需要审核) /// /// [HttpGet] public ActionResult FormFlow() { return View(); } /// /// 通知公告表单(需要审核) /// /// [HttpGet] public ActionResult FormFlowView() { return View(); } /// /// 管理页面【查看通知公告】 /// /// [HttpGet] public ActionResult ViewIndex() { return View(); } /// /// 回收站 /// /// [HttpGet] public ActionResult IndexRecycle() { return View(); } /// /// 表单页面【查看通知公告】 /// /// [HttpGet] public ActionResult ViewForm() { return View(); } /// /// 失物招领 /// /// [HttpGet] public ActionResult IndexLostArticle() { return View(); } /// /// 失物招领表单 /// /// [HttpGet] public ActionResult FormLostArticle() { return View(); } /// /// 失物招领表单 /// /// [HttpGet] public ActionResult FormLostArticleView() { return View(); } #endregion #region 获取数据 /// /// 获取分页数据 /// /// 分页参数 /// 关键词 /// public ActionResult GetPageList(string pagination, string keyword) { Pagination paginationobj = pagination.ToObject(); var data = noticeIBLL.GetPageList(paginationobj, keyword); var jsonData = new { rows = data, total = paginationobj.total, page = paginationobj.page, records = paginationobj.records, }; return JsonResult(jsonData); } public ActionResult GetPageListRevert(string pagination, string keyword) { Pagination paginationobj = pagination.ToObject(); var data = noticeIBLL.GetPageListRevert(paginationobj, keyword); var jsonData = new { rows = data, total = paginationobj.total, page = paginationobj.page, records = paginationobj.records, }; return JsonResult(jsonData); } /// /// 查看通知公告 /// /// 分页参数 /// 关键词 /// public ActionResult GetListOfSelf(string keyword, string categoryId = null) { var userinfo = LoginUserInfo.Get(); Pagination paginationobj = new Pagination(); var newsList = noticeIBLL.GetList(keyword, categoryId); //var newsListOfSelf = new List(); //foreach (var newsitemEntity in newsList) //{ // if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId)) // { // if (!string.IsNullOrEmpty(userinfo.postIds)) // { // if (userinfo.postIds.Contains(",")) // { // foreach (var postid in userinfo.postIds.Split(',')) // { // if (newsitemEntity.F_SendPostId.Contains(postid)) // { // newsListOfSelf.Add(newsitemEntity); // break; // } // } // } // else // { // if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds)) // { // newsListOfSelf.Add(newsitemEntity); // } // } // } // } // else // { // if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId)) // { // if (newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId)) // { // newsListOfSelf.Add(newsitemEntity); // } // } // else // { // newsListOfSelf.Add(newsitemEntity); // } // } //} return JsonResult(newsList); } /// /// 查看通知公告 /// /// 分页参数 /// 关键词 /// public ActionResult GetListOfSelfJY(string keyword, string categoryId = null) { var userinfo = LoginUserInfo.Get(); Pagination paginationobj = new Pagination(); var newsList = noticeIBLL.GetList(keyword, categoryId). Where(a => a.F_Status == "2"); //var newsListOfSelf = new List(); //foreach (var newsitemEntity in newsList) //{ // if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId)) // { // if (!string.IsNullOrEmpty(userinfo.postIds)) // { // if (userinfo.postIds.Contains(",")) // { // foreach (var postid in userinfo.postIds.Split(',')) // { // if (newsitemEntity.F_SendPostId.Contains(postid)) // { // newsListOfSelf.Add(newsitemEntity); // break; // } // } // } // else // { // if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds)) // { // newsListOfSelf.Add(newsitemEntity); // } // } // } // } // else // { // if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId)) // { // if (newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId)) // { // newsListOfSelf.Add(newsitemEntity); // } // } // else // { // newsListOfSelf.Add(newsitemEntity); // } // } //} return JsonResult(newsList); } /// /// 获取实体数据 /// /// 主键 /// public ActionResult GetEntity(string keyValue) { var data = noticeIBLL.GetEntity(keyValue); data.F_NewsContent = WebHelper.HtmlDecode(data.F_NewsContent); return JsonResult(data); } public ActionResult GetNoticeCategoryByDepartment(string userId) { var typeList = dataItemIbll.GetDetailList("NoticeCategory"); var permissionsEntity = departmentReleasePermissionsIbll.GetTypesByUserId(userId); List list = new List(); if (permissionsEntity != null) { var typetext = permissionsEntity.Permission?.Split(','); foreach (var item in typetext) { var entity = typeList.FirstOrDefault(a => a.F_ItemValue.Equals(item)); if (entity != null) { list.Add(new { text = entity.F_ItemName, value = entity.F_ItemValue }); } } } return JsonResult(list); } #endregion #region 提交数据 /// /// 保存表单数据 /// /// 主键 /// 实体 /// [HttpPost, ValidateAntiForgeryToken, AjaxOnly, ValidateInput(false)] public ActionResult SaveForm(string keyValue, NewsEntity entity) { entity.F_NewsContent = WebHelper.HtmlEncode(entity.F_NewsContent); noticeIBLL.SaveEntity(keyValue, entity); return Success("保存成功!"); } /// /// 删除表单数据 /// /// 主键 /// [HttpPost] [AjaxOnly] public ActionResult DeleteForm(string keyValue) { noticeIBLL.DeleteEntity(keyValue); return Success("删除成功!"); } [HttpPost] [AjaxOnly] public ActionResult RecycleForm(string keyValue) { noticeIBLL.RecycleForm(keyValue, "-1"); return Success("操作成功!"); } [HttpPost] [AjaxOnly] public ActionResult RevertForm(string keyValue) { noticeIBLL.RecycleForm(keyValue, "0"); return Success("操作成功!"); } #endregion #region 流程 /// /// 提交 /// /// /// [HttpPost] [AjaxOnly] public ActionResult ChangeStatusById(string keyValue, string processId) { noticeIBLL.ChangeStatusById(keyValue, 1, processId); return Success("操作成功!"); } /// /// 获取表单数据 /// /// [HttpGet] [AjaxOnly] public ActionResult GetFormDataByProcessId(string processId) { NewsEntity OANewsData = noticeIBLL.GetEntityByProcessId(processId); OANewsData.F_NewsContent = WebHelper.HtmlDecode(OANewsData.F_NewsContent); var jsonData = new { OANews = OANewsData, }; return Success(jsonData); } #endregion } }