From 467eeb8c689fca8c2ffffd7acfe0ee21c06bef11 Mon Sep 17 00:00:00 2001 From: hwh2023 <598694955@qq.com> Date: Wed, 30 Aug 2023 18:08:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AA=E8=AF=BB=E6=95=B0=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/MessageRindController.cs | 93 +++++++++++++++++++ .../Views/Home/AdminDesktop/Index.js | 27 ++++++ 2 files changed, 120 insertions(+) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/MessageRindController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/MessageRindController.cs index d14ddcb56..b10907083 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/MessageRindController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/MessageRindController.cs @@ -6,6 +6,9 @@ using System.Collections.Generic; using System.Collections; using System; using System.Linq; +using Learun.Application.OA; +using Learun.Application.TwoDevelopment.EducationalAdministration; +using Learun.Application.WorkFlow; namespace Learun.Application.Web.Areas.LR_Desktop.Controllers { @@ -91,6 +94,96 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers return Success(count); } + + + private SYS_ReceiveMessageIBLL sYS_ReceiveMessageIBLL = new SYS_ReceiveMessageBLL(); + private NWFProcessIBLL nWFProcessIBLL = new NWFProcessBLL(); + private NoticeIBLL newsIBLL = new NoticeBLL(); + private Sys_ReceiveFileIBLL sys_ReceiveFileIBLL = new Sys_ReceiveFileBLL(); + /// + /// 获取未读的消息的数量 + /// + /// 分页参数 + /// 查询参数 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetCountFortotalUnread() + { + int totalcount = 0; + #region 待办 + var userinfo = LoginUserInfo.Get(); + Pagination paginationobj = new Pagination() { rows = 100, page = 1, sidx = "readflag asc,SENDTIME desc ", sord = "desc" }; + //未读邮件 + int UnreadMail = sYS_ReceiveMessageIBLL.GetPageList(paginationobj, "{\"userId\":\"" + userinfo.userId + "\"}").Count(m => m.READFLAG == 0); + //办公事项 + paginationobj.sidx = "F_CreateDate"; + int UnreadTask = nWFProcessIBLL.GetMyTaskPageList(userinfo, paginationobj, "{}").Count(); + //公告 + List outnewslist = new List(); + var newsList = newsIBLL.GetPageList(paginationobj, ""); + 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)) + { + outnewslist.Add(newsitemEntity); + break; + } + } + } + else + { + if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds)) + { + outnewslist.Add(newsitemEntity); + } + } + } + } + else + { + if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId)) + { + if (userinfo.departmentId != null && newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId)) + { + outnewslist.Add(newsitemEntity); + } + } + else + { + outnewslist.Add(newsitemEntity); + } + } + } + var readnewslist = newsIBLL.GetList("", userinfo.userId).Where(m => !string.IsNullOrEmpty(m.RNewsId)).Select(m => m.F_NewsId); + int UnreadNews = outnewslist.Count(m => !readnewslist.Contains(m.F_NewsId)); + paginationobj.sidx = "SendTime"; + int UnreadFile = sys_ReceiveFileIBLL.GetPageListBySenderId(userinfo.userId).Count(); + //普通教师请假-未归档数 + int UnfileLeave = 0; + //中层领导请假-未归档数 + int UnfileLeaveZC = 0; + + totalcount = UnreadFile + UnreadNews + UnreadTask + UnreadMail + UnfileLeave + UnfileLeaveZC; + #endregion + var data = new + { + UnreadTask= UnreadTask, + UnreadNews= UnreadNews, + UnfileLeave= UnfileLeave, + UnfileLeaveZC= UnfileLeaveZC, + totalcount = totalcount + }; + return Success(data); + } /// /// 获取未读的消息 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDesktop/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDesktop/Index.js index e19598913..fc17f7ef8 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDesktop/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDesktop/Index.js @@ -328,4 +328,31 @@ } }); }; + + window.setInterval(gettotalunread, 10000); + //未读消息totalcount + function gettotalunread() { + $.ajax({ + url: top.$.rootUrl + '/LR_Desktop/MessageRind/GetCountFortotalUnread', + type: "get", + dataType: "json", + async: false, + success: function (data) { + if (data.data != 0) { + //document.getElementsByClassName("lr-im-bell2")[0].children[0].children[2].innerText = data.data; + + //UnreadTask = UnreadTask, + // UnreadNews = UnreadNews, + // UnfileLeave = UnfileLeave, + // UnfileLeaveZC = UnfileLeaveZC, + // totalcount = totalcount + $('#btn_daiban').html("待办事项 " + data.data.UnreadTask + " 条") + $('#btn_tonggao').html("通告 " + data.data.UnreadNews + " 条") + //$('#btn_gongwen').text(data.totalcount) + $('body > div.lr-im-bell2.open > ul > li:nth-child(5)').html("共 " + data.data.totalcount+" 条") + $('body > div.lr-im-bell2 > a > span:nth-child(3)').html(data.data.totalcount) + } + } + }); + }; }); \ No newline at end of file