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 new file mode 100644 index 000000000..35f6e64ca --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/MessageRindController.cs @@ -0,0 +1,187 @@ +using Learun.Util; +using System.Data; +using Learun.Application.TwoDevelopment.LR_Desktop; +using System.Web.Mvc; +using System.Collections.Generic; +using System.Collections; + +namespace Learun.Application.Web.Areas.LR_Desktop.Controllers +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2021-04-23 16:58 + /// 描 述:消息提醒 + /// + public class MessageRindController : MvcControllerBase + { + private MessageRindIBLL messageRindIBLL = new MessageRindBLL(); + + #region 视图功能 + + /// + /// 主页面 + /// + /// + [HttpGet] + public ActionResult Index() + { + return View(); + } + /// + /// 未读消息页面 + /// + /// + [HttpGet] + public ActionResult UnreadIndex() + { + return View(); + } + /// + /// 表单页 + /// + /// + [HttpGet] + public ActionResult Form() + { + return View(); + } + #endregion + + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 分页参数 + /// 查询参数 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetPageList(string pagination, string queryJson) + { + Pagination paginationobj = pagination.ToObject(); + var data = messageRindIBLL.GetPageList(paginationobj, queryJson); + var jsonData = new + { + rows = data, + total = paginationobj.total, + page = paginationobj.page, + records = paginationobj.records + }; + return Success(jsonData); + } + + /// + /// 获取未读的消息的数量 + /// + /// 分页参数 + /// 查询参数 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetCountForUnread() + { + var count = messageRindIBLL.GetCountForUnread(); + + return Success(count); + } + /// + /// 获取未读的消息 + /// + /// 分页参数 + /// 查询参数 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetListForUnread() + { + var data = messageRindIBLL.GetListForUnread(); + List list = new List(); + foreach (var entity in data) + { + Hashtable ht = new Hashtable(); + ht["MessageId"] = entity.MessageId; + ht["SenderName"] = entity.SenderName; + ht["TheTitle"] = entity.TheTitle; + ht["TheContent"] = entity.TheContent; + ht["ConnectionUrl"] = entity.ConnectionUrl; + ht["InstanceId"] = entity.InstanceId; + list.Add(ht); + } + return ToJsonResult(list); + } + + /// + /// 获取表单数据 + /// + /// 主键 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetFormData(string keyValue) + { + var MessageRemindData = messageRindIBLL.GetMessageRemindEntity(keyValue); + var jsonData = new + { + MessageRemind = MessageRemindData, + }; + return Success(jsonData); + } + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + /// + [HttpPost] + [AjaxOnly] + public ActionResult DeleteForm(string keyValue) + { + messageRindIBLL.DeleteEntity(keyValue); + return Success("删除成功!"); + } + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + /// + [HttpPost] + [ValidateAntiForgeryToken] + [AjaxOnly] + public ActionResult SaveForm(string keyValue, string strEntity) + { + MessageRemindEntity entity = strEntity.ToObject(); + messageRindIBLL.SaveEntity(keyValue, entity); + if (string.IsNullOrEmpty(keyValue)) + { + } + return Success("保存成功!"); + } + + /// + /// 更改状态为已读 + /// + /// 主键 + /// 实体 + /// + [HttpPost] + [AjaxOnly] + public ActionResult SaveReadSigns(string keyValue) + { + if (!string.IsNullOrEmpty(keyValue)) + { + messageRindIBLL.SaveReadSigns(keyValue); + } + return Success("保存成功!"); + } + + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/Form.cshtml new file mode 100644 index 000000000..176ce92ce --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/Form.cshtml @@ -0,0 +1,35 @@ +@{ + ViewBag.Title = "消息提醒"; + Layout = "~/Views/Shared/_Form.cshtml"; +} +
+
+
收件人ID
+ +
+
+
收件人姓名
+ +
+
+
发件人ID
+ +
+
+
发件人姓名
+ +
+
+
发送时间
+ +
+
+
标题
+ +
+
+
内容
+ +
+
+@Html.AppendJsFile("/Areas/LR_Desktop/Views/MessageRind/Form.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/Form.js new file mode 100644 index 000000000..4a30a5bfb --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/Form.js @@ -0,0 +1,41 @@ +/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) + * Copyright (c) 2013-2018 北京泉江科技有限公司 + * 创建人:超级管理员 + * 日 期:2021-05-08 + * 描 述:消息提醒 + */ +var acceptClick; +var keyValue = request('keyValue'); +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + page.bind(); + page.initData(); + }, + bind: function () { + + }, + initData: function () { + if (!!keyValue) { + $.lrSetForm(top.$.rootUrl + '/LR_Desktop/MessageRemind/GetFormData?keyValue=' + keyValue, function (data) { + $('#form').lrSetFormData(data); + }); + } + } + }; + //保存数据 + acceptClick = function (callBack) { + if (!$('#form').lrValidform()) { + return false; + } + var postData = $('#form').lrGetFormData(); + $.lrSaveForm(top.$.rootUrl + '/LR_Desktop/MessageRind/SaveForm?keyValue=' + keyValue, postData, function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(); + } + }); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/Index.cshtml new file mode 100644 index 000000000..d47a63578 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/Index.cshtml @@ -0,0 +1,90 @@ +@{ + ViewBag.Title = "消息提醒"; + Layout = "~/Views/Shared/_Index.cshtml"; +} +
+
+
+
+
+
+
+
+
+
+
+ +
+ +
+ +
+
+
+
+
+
+
+
您有新的未读消息x
+
+
+ +
+
+@Html.AppendJsFile("/Areas/LR_Desktop/Views/MessageRind/Index.js"); + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/Index.js new file mode 100644 index 000000000..2f79e8e57 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/Index.js @@ -0,0 +1,133 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2021-04-23 16:58 + * 描 述:消息提醒 + */ +var refreshGirdData; +var bootstrap = function ($, learun) { + "use strict"; + var startTime; + var endTime; + var page = { + init: function () { + page.initGird(); + page.bind(); + }, + bind: function () { + // 时间搜索框 + $('#datesearch').lrdate({ + dfdata: [ + { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, + { name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, + { name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, + { name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } } + ], + // 月 + mShow: false, + premShow: false, + // 季度 + jShow: false, + prejShow: false, + // 年 + ysShow: false, + yxShow: false, + preyShow: false, + yShow: false, + // 默认 + dfvalue: '1', + selectfn: function (begin, end) { + startTime = begin; + endTime = end; + page.search(); + } + }); + // 刷新 + $('#lr_refresh').on('click', function () { + location.reload(); + }); + // 新增 + $('#lr_add').on('click', function () { + learun.layerForm({ + id: 'form', + title: '新增', + url: top.$.rootUrl + '/LR_Desktop/MessageRind/Form', + width: 600, + height: 400, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + }); + // 编辑 + $('#lr_edit').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('MessageId'); + if (learun.checkrow(keyValue)) { + learun.layerForm({ + id: 'form', + title: '编辑', + url: top.$.rootUrl + '/LR_Desktop/MessageRind/Form?keyValue=' + keyValue, + width: 600, + height: 400, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + } + }); + // 删除 + $('#lr_delete').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('MessageId'); + if (learun.checkrow(keyValue)) { + learun.layerConfirm('是否确认删除该项!', function (res) { + if (res) { + learun.deleteForm(top.$.rootUrl + '/LR_Desktop/MessageRind/DeleteForm', { keyValue: keyValue}, function () { + refreshGirdData(); + }); + } + }); + } + }); + // 打印 + $('#lr_print').on('click', function () { + $('#gridtable').jqprintTable(); + }); + + }, + + + // 初始化列表 + initGird: function () { + $('#gridtable').lrAuthorizeJfGrid({ + url: top.$.rootUrl + '/LR_Desktop/MessageRind/GetPageList', + headData: [ + //{ label: "收件人ID", name: "ReceiptId", width: 100, align: "left"}, + { label: "收件人姓名", name: "ReceiptName", width: 100, align: "left"}, + //{ label: "发件人ID", name: "SenderId", width: 100, align: "left"}, + { label: "发件人姓名", name: "SenderName", width: 100, align: "left"}, + { label: "发送时间", name: "SendTime", width: 100, align: "left"}, + { label: "标题", name: "TheTitle", width: 100, align: "left"}, + { label: "内容", name: "TheContent", width: 400, align: "left" }, + { + label: "状态", name: "ReadSigns", width: 100, align: "left", formatter: function (cellvalue) { + return cellvalue == false ? "未读" : "已读"; + } + }, + ], + mainId:'MessageId', + isPage: true + }); + }, + search: function (param) { + param = param || {}; + param.StartTime = startTime; + param.EndTime = endTime; + $('#gridtable').jfGridSet('reload',{ queryJson: JSON.stringify(param) }); + } + }; + refreshGirdData = function () { + $('#gridtable').jfGridSet('reload'); + }; + page.init(); + +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/UnreadIndex.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/UnreadIndex.cshtml new file mode 100644 index 000000000..5012d734d --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/UnreadIndex.cshtml @@ -0,0 +1,139 @@ +@*@{ + ViewBag.Title = "未读消息"; + Layout = "~/Views/Shared/_Index.cshtml"; + } +
+
+
+ +
+
+
+
*@ + + + + + + 未读消息提醒 + + + + + @Html.AppendCssFile( + "/Views/LR_Content/style/lr-common.css", + "/Views/LR_Content/style/lr-iframe-index.css", + "~/Content/jquery/plugin/toastr/toastr.css" + ) + + + +
+ +
+ @Html.AppendJsFile( + "~/Content/jquery/plugin/toastr/toastr.min.js", + "~/Views/LR_Content/script/lr-admin.js", + "~/Views/LR_Content/script/lr-clientdata.js", + "~/Content/jquery/plugin/fullcalendar/js/jquery-1.7.2.min.js", + "~/Areas/LR_Desktop/Views/MessageRind/Index.js" + ) + + + + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Message/Views/LR_StrategyInfo/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Message/Views/LR_StrategyInfo/Form.js index 62f41594e..4b661ff71 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Message/Views/LR_StrategyInfo/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Message/Views/LR_StrategyInfo/Form.js @@ -34,7 +34,7 @@ var bootstrap = function ($, learun) { type: 'multiple', value: "id", text: "text", - data: [{ id: '1', text: '邮件' }, { id: '2', text: '微信' }, { id: '3', text: '短信' }, { id: '4', text: '系统IM' }, { id: '5', text: '飞星' }]//1邮箱2微信3短信4系统IM + data: [{ id: '1', text: '邮件' }, { id: '2', text: '微信' }, { id: '3', text: '短信' }, { id: '4', text: '系统IM' }, { id: '5', text: '飞星' }, { id: '6', text: '站内消息' }]//1邮箱2微信3短信4系统IM }); $('#F_StrategyCode').on('blur', function () { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj index a8949140d..7f8a8e17a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj @@ -390,6 +390,7 @@ + @@ -1132,6 +1133,8 @@ + + @@ -6998,6 +7001,9 @@ + + + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDesktop.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDesktop.cshtml index 6e4872af9..ccad57e96 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDesktop.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDesktop.cshtml @@ -21,9 +21,10 @@
  统计指标
-
+
+ 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 150e46747..141c4a090 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 @@ -269,5 +269,39 @@ c(g.list || []); a(g.chart || []) } - }) + }) + + funopen(); + window.setInterval(funopen, 60000); + //window.clearInterval(t1); + //消息提醒 + function funopen() { + $.ajax({ + url: top.$.rootUrl + '/LR_Desktop/MessageRind/GetCountForUnread', + type: "get", + dataType: "json", + async: false, + success: function (data) { + console.log(data); + if (data.data> 0) { + document.getElementById("sound").src = '/Resource/wav/收到新消息.wav'; + top.learun.layeropen({ + //id: 'form', + type: 2, + title: "消息提示", + closeBtn: 0, //不显示关闭按钮 + shade: [0], + area: ['340px', '215px'], + offset: 'rb', //右下角弹出 + anim: 2, + content: top.$.rootUrl + '/LR_Desktop/MessageRind/UnreadIndex', + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + } + } + }); + }; + }); \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-layer.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-layer.js index e50074863..6e90f97e0 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-layer.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-layer.js @@ -70,7 +70,7 @@ dfop.width = dfop.width > $(window).width() ? $(window).width() - 10 : dfop.width; dfop.height = dfop.height > $(window).height() ? $(window).height() - 10 : dfop.height; var r = 0; - r=top.layer.open({ + r = top.layer.open({ id: dfop.id, maxmin: dfop.maxmin, type: 2, //0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层) @@ -212,6 +212,94 @@ } }); }, + + //页面弹窗 + layeropen: function (op) { + var dfop = { + id: null, + type: 2, + title: '系统窗口', + //url: 'error', + //btn: ['确认', '关闭'], + callBack: false, + maxmin: false, + end: false, + }; + $.extend(dfop, op || {}); + + /*适应窗口大小*/ + //dfop.width = dfop.width > $(window).width() ? $(window).width() - 10 : dfop.width; + //dfop.height = dfop.height > $(window).height() ? $(window).height() - 10 : dfop.height; + + var r = top.layer.open({ + id: dfop.id, + maxmin: dfop.maxmin, + type: 2, //0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层) + title: op.title, + area: ['350px', '240px'], + anim: 2, + btn: dfop.btn, + offset: 'rb', //右下角弹出 + closeBtn: 1, //显示关闭按钮 + shade: false,//[0], + time: 60000, //60秒后自动关闭 + content: op.content,//op.url, + //skin: dfop.btn == null ? 'lr-layer-nobtn' : 'lr-layer', + success: function (layero, index) { + top['layer_' + dfop.id] = learun.iframe($(layero).find('iframe').attr('id'), top.frames); + layero[0].learun_layerid = 'layer_' + dfop.id; + //如果底部有按钮添加-确认并关闭窗口勾选按钮 + if (!!dfop.btn && layero.find('.lr-layer-btn-cb').length == 0) { + top.learun.language.get('确认并关闭窗口', + function (text) { + layero.find('.layui-layer-btn') + .append('
'); + }); + layero.find('.layui-layer-btn a').each(function () { + var $this = $(this); + var _text = $this.text(); + top.learun.language.get(_text, + function (text) { + $this.text(text); + }); + + }); + } + layero.find('.layui-layer-title').each(function () { + var $this = $(this); + var _text = $this.text(); + top.learun.language.get(_text, + function (text) { + $this.text(text); + }); + + }); + }, + yes: function (index) { + var flag = true; + if (!!dfop.callBack) { + flag = dfop.callBack('layer_' + dfop.id); + } + if (dfop.id == 'formitem') { + learun.layerClose('', index); + } + if (!!flag) { + learun.layerClose('', index); + } + }, + end: function () { + top['layer_' + dfop.id] = null; + if (!!dfop.end) { + dfop.end(); + } + } + }); + }, + // 关闭弹层 layerClose: function (name, index) { var _index; diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Desktop/MessageRemindMap.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Desktop/MessageRemindMap.cs new file mode 100644 index 000000000..8c27126f4 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Desktop/MessageRemindMap.cs @@ -0,0 +1,29 @@ +using Learun.Application.TwoDevelopment.LR_Desktop; +using System.Data.Entity.ModelConfiguration; + +namespace Learun.Application.Mapping +{ + /// + /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 + /// Copyright (c) 2013-2018 北京泉江科技有限公司 + /// 创 建:超级管理员 + /// 日 期:2018-09-25 11:32 + /// 描 述:消息提醒 + /// + public class MessageRemindMap : EntityTypeConfiguration + { + public MessageRemindMap() + { + #region 表、主键 + //表 + this.ToTable("MESSAGEREMIND"); + //主键 + this.HasKey(t => t.MessageId); + #endregion + + #region 配置关系 + #endregion + } + } +} + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj index 41aa5a8f5..87f701a9e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj @@ -112,6 +112,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Message/LR_StrategyInfo/LR_StrategyInfoBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Message/LR_StrategyInfo/LR_StrategyInfoBLL.cs index 08106b7f9..14ec3c719 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Message/LR_StrategyInfo/LR_StrategyInfoBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Message/LR_StrategyInfo/LR_StrategyInfoBLL.cs @@ -472,6 +472,32 @@ namespace Learun.Application.Message { } } + + /// + /// 消息提醒 + /// + /// + /// + public void PushMessageRemind(List needpostuserlist, string content, NWFTaskMsgEntity model) + { + foreach (UserEntity userinfo in needpostuserlist) + { + MessageRemindEntity entity = new MessageRemindEntity(); + entity.ReceiptId = userinfo.F_UserId; + entity.ReceiptName = userinfo.F_RealName; + entity.SenderId = model.F_ToUserId; + entity.SenderName = model.F_ToName; + entity.TheTitle = "流程通知"; + entity.TheContent = model.F_Title + ":" + content; + entity.InstanceId = model.F_Id; + entity.ConnectionUrl = "/LR_NewWorkFlow/NWFProcess/NWFContainerForm?tabIframeId="; + entity.SendTime = DateTime.Now; + entity.ReadSigns = false; + //messageRindIBLL.SaveEntity("", entity); + } + + } + /// /// 微信发送(企业号) /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRemindEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRemindEntity.cs new file mode 100644 index 000000000..a1d98e964 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRemindEntity.cs @@ -0,0 +1,95 @@ +using Learun.Util; +using System; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Learun.Application.TwoDevelopment.LR_Desktop +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2021-04-23 16:58 + /// 描 述:消息提醒 + /// + public class MessageRemindEntity + { + #region 实体成员 + /// + /// MessageId + /// + [Column("MESSAGEID")] + public string MessageId { get; set; } + /// + /// ReceiptId + /// + [Column("RECEIPTID")] + public string ReceiptId { get; set; } + /// + /// ReceiptName + /// + [Column("RECEIPTNAME")] + public string ReceiptName { get; set; } + /// + /// SenderId + /// + [Column("SENDERID")] + public string SenderId { get; set; } + /// + /// SenderName + /// + [Column("SENDERNAME")] + public string SenderName { get; set; } + /// + /// TheTitle + /// + [Column("THETITLE")] + public string TheTitle { get; set; } + /// + /// TheContent + /// + [Column("THECONTENT")] + public string TheContent { get; set; } + /// + /// ConnectionUrl + /// + [Column("CONNECTIONURL")] + public string ConnectionUrl { get; set; } + /// + /// 实例Id + /// + [Column("INSTANCEId")] + public string InstanceId { get; set; } + /// + /// SendTime + /// + [Column("SENDTIME")] + public DateTime? SendTime { get; set; } + /// + /// ReadSigns + /// + [Column("READSIGNS")] + public bool? ReadSigns { get; set; } + #endregion + + #region 扩展操作 + /// + /// 新增调用 + /// + public void Create() + { + this.MessageId = Guid.NewGuid().ToString(); + } + /// + /// 编辑调用 + /// + /// + public void Modify(string keyValue) + { + this.MessageId = keyValue; + } + #endregion + #region 扩展字段 + #endregion + } +} + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindBLL.cs new file mode 100644 index 000000000..0b332ac33 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindBLL.cs @@ -0,0 +1,194 @@ +using Learun.Util; +using System; +using System.Data; +using System.Collections.Generic; + +namespace Learun.Application.TwoDevelopment.LR_Desktop +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2021-04-23 16:58 + /// 描 述:消息提醒 + /// + public class MessageRindBLL : MessageRindIBLL + { + private MessageRindService messageRindService = new MessageRindService(); + + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 分页参数 + /// 查询参数 + /// + public IEnumerable GetPageList(Pagination pagination, string queryJson) + { + try + { + return messageRindService.GetPageList(pagination, queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 未读消息 + /// + /// + public IEnumerable GetListForUnread() + { + try + { + return messageRindService.GetListForUnread(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + + /// + /// 未读消息的数量 + /// + /// + public int GetCountForUnread() + { + try + { + return messageRindService.GetCountForUnread(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取MessageRemind表实体数据 + /// + /// 主键 + /// + public MessageRemindEntity GetMessageRemindEntity(string keyValue) + { + try + { + return messageRindService.GetMessageRemindEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + public void DeleteEntity(string keyValue) + { + try + { + messageRindService.DeleteEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + /// + public void SaveEntity(string keyValue, MessageRemindEntity entity) + { + try + { + messageRindService.SaveEntity(keyValue, entity); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 修改为已读 + /// + /// + public void SaveReadSigns(string keyValue) + { + try + { + messageRindService.SaveReadSigns(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindIBLL.cs new file mode 100644 index 000000000..ea552d6ee --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindIBLL.cs @@ -0,0 +1,63 @@ +using Learun.Util; +using System.Data; +using System.Collections.Generic; + +namespace Learun.Application.TwoDevelopment.LR_Desktop +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2021-04-23 16:58 + /// 描 述:消息提醒 + /// + public interface MessageRindIBLL + { + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 查询参数 + /// + IEnumerable GetPageList(Pagination pagination, string queryJson); + /// + /// 获取未读的消息 + /// + /// + IEnumerable GetListForUnread(); + /// + /// 获取未读的消息的数量 + /// + /// + int GetCountForUnread(); + /// + /// 获取MessageRemind表实体数据 + /// + /// 主键 + /// + MessageRemindEntity GetMessageRemindEntity(string keyValue); + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + void DeleteEntity(string keyValue); + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + void SaveEntity(string keyValue, MessageRemindEntity entity); + /// + /// 修改为已读 + /// + /// + void SaveReadSigns(string keyValue); + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindService.cs new file mode 100644 index 000000000..616697343 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindService.cs @@ -0,0 +1,234 @@ +using Dapper; +using Learun.DataBase.Repository; +using Learun.Util; +using System; +using System.Collections.Generic; +using System.Data; +using System.Text; + +namespace Learun.Application.TwoDevelopment.LR_Desktop +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2021-04-23 16:58 + /// 描 述:消息提醒 + /// + public class MessageRindService : RepositoryFactory + { + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 查询参数 + /// 查询参数 + /// + public IEnumerable GetPageList(Pagination pagination, string queryJson) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("SELECT "); + strSql.Append(@" + t.MessageId, + t.ReceiptId, + t.ReceiptName, + t.SenderId, + t.SenderName, + t.SendTime, + t.TheTitle, + t.TheContent, + t.ReadSigns + "); + strSql.Append(" FROM MessageRemind t "); + strSql.Append(" WHERE 1=1 "); + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty()) + { + dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime); + dp.Add("endTime", queryParam["EndTime"].ToDate(), DbType.DateTime); + strSql.Append(" AND ( t.SendTime >= @startTime AND t.SendTime <= @endTime ) "); + } + return this.BaseRepository().FindList(strSql.ToString(), dp, pagination); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取MessageRemind表未读的消息 + /// + /// + public IEnumerable GetListForUnread() + { + try + { + return this.BaseRepository().FindList(x => x.ReadSigns == false); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取MessageRemind表未读消息的数量 + /// + /// + public int GetCountForUnread() + { + try + { + string sql = "select count(1) from MessageRemind where ReadSigns=0"; + var obj = this.BaseRepository().FindObject(sql); + if (obj == null) + return 0; + else + return Convert.ToInt32(obj); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取MessageRemind表实体数据 + /// + /// 主键 + /// + public MessageRemindEntity GetMessageRemindEntity(string keyValue) + { + try + { + return this.BaseRepository().FindEntity(x => x.MessageId == keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + public void DeleteEntity(string keyValue) + { + try + { + this.BaseRepository().Delete(t => t.MessageId == keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + public void SaveEntity(string keyValue, MessageRemindEntity entity) + { + try + { + if (!string.IsNullOrEmpty(keyValue)) + { + entity.Modify(keyValue); + this.BaseRepository().Update(entity); + } + else + { + entity.Create(); + this.BaseRepository().Insert(entity); + } + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + public void SaveReadSigns(string keyValue) + { + try + { + string sql = $"update MessageRemind set ReadSigns=1 where MessageId='{keyValue}'"; + this.BaseRepository().ExecuteBySql(sql); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj index 14382a7a7..b3c58709e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj @@ -261,6 +261,10 @@ + + + +