From d340848ad318c90bd3e43013626268a63fe4dae3 Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Wed, 1 Mar 2023 15:22:22 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E6=B6=88=E6=81=AF=E6=8F=90=E9=86=92=E5=BC=B9=E6=A1=86?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E2=80=9C=E5=85=A8=E9=83=A8=E5=B7=B2=E8=AF=BB?= =?UTF-8?q?=E2=80=9D=E6=8C=89=E9=92=AE=EF=BC=9B=E7=82=B9=E5=87=BB=E2=80=9C?= =?UTF-8?q?=E6=88=91=E7=9A=84=E9=80=9A=E7=9F=A5=E2=80=9D=E4=B8=AD=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E5=90=8E=EF=BC=8C=E5=90=8C=E6=97=B6=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=8F=90=E9=86=92=E5=B7=B2=E8=AF=BB=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/LR_OA_NewsReadController.cs | 11 +++++ .../Controllers/MessageRindController.cs | 17 +++++++ .../Views/MessageRind/UnreadIndex.cshtml | 32 ++++++++++-- .../LR_Desktop/MessageRind/MessageRindBLL.cs | 49 ++++++++++++++++++- .../LR_Desktop/MessageRind/MessageRindIBLL.cs | 13 +++++ .../MessageRind/MessageRindService.cs | 49 +++++++++++++++++++ 6 files changed, 167 insertions(+), 4 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/LR_OA_NewsReadController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/LR_OA_NewsReadController.cs index 06ce7b9b9..bc566a4eb 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/LR_OA_NewsReadController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/LR_OA_NewsReadController.cs @@ -18,6 +18,7 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers public class LR_OA_NewsReadController : MvcControllerBase { private LR_OA_NewsReadIBLL lR_OA_NewsReadIBLL = new LR_OA_NewsReadBLL(); + private MessageRindIBLL messageRindIBLL = new MessageRindBLL(); #region 视图功能 @@ -156,6 +157,16 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers //修改当前通知公告的浏览量 lR_OA_NewsReadIBLL.UpdateNewsPV(newsId); } + //判断消息提醒表中的消息是否已读 + var mrentity = messageRindIBLL.GetMessageRemindEntityByInstanceId(newsId, loginUserInfo.userId); + if (mrentity != null) + { + if (!mrentity.ReadSigns.HasValue || mrentity.ReadSigns.Value != true) + { + //修改消息为已读 + messageRindIBLL.SaveReadSigns(mrentity.MessageId); + } + } return Success("阅读成功!"); } 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 80bade281..31ef71198 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 @@ -182,6 +182,23 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers return Success("保存成功!"); } + /// + /// 更改状态为已读 + /// + /// 主键 + /// + [HttpPost] + [AjaxOnly] + public ActionResult SaveReadSignsByUserId() + { + var loginUserInfo = LoginUserInfo.Get(); + if (!string.IsNullOrEmpty(loginUserInfo.userId)) + { + messageRindIBLL.SaveReadSignsByUserId(loginUserInfo.userId); + } + return Success("保存成功!"); + } + #endregion } 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 index c970e5dc8..d116ad82d 100644 --- 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 @@ -25,9 +25,20 @@ "/Views/LR_Content/style/lr-iframe-index.css", "~/Content/jquery/plugin/toastr/toastr.css" ) - + +
全部已读
@@ -39,7 +50,7 @@ "~/Areas/LR_Desktop/Views/MessageRind/Index.js" ) - + 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 index 0b332ac33..d830bf53b 100644 --- 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 @@ -66,7 +66,7 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop } } - + /// /// 未读消息的数量 /// @@ -114,6 +114,29 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop } } + /// + /// 获取MessageRemind表实体数据 + /// + /// 主键 + /// + public MessageRemindEntity GetMessageRemindEntityByInstanceId(string InstanceId, string userId) + { + try + { + return messageRindService.GetMessageRemindEntityByInstanceId(InstanceId, userId); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } #endregion #region 提交数据 @@ -188,6 +211,30 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop } } } + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + public void SaveReadSignsByUserId(string userId) + { + try + { + messageRindService.SaveReadSignsByUserId(userId); + } + 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 index ea552d6ee..8ab0be41b 100644 --- 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 @@ -37,6 +37,13 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop /// 主键 /// MessageRemindEntity GetMessageRemindEntity(string keyValue); + + /// + /// 获取MessageRemind表实体数据 + /// + /// 主键 + /// + MessageRemindEntity GetMessageRemindEntityByInstanceId(string InstanceId, string userId); #endregion #region 提交数据 @@ -57,6 +64,12 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop /// /// void SaveReadSigns(string keyValue); + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + void SaveReadSignsByUserId(string userId); #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 index 58bc868d3..a0ff983cf 100644 --- 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 @@ -141,6 +141,30 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop } } + /// + /// 获取MessageRemind表实体数据 + /// + /// 主键 + /// + public MessageRemindEntity GetMessageRemindEntityByInstanceId(string InstanceId, string userId) + { + try + { + return this.BaseRepository().FindEntity(x => x.InstanceId == InstanceId && x.ReceiptId == userId); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + #endregion #region 提交数据 @@ -230,6 +254,31 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop } } } + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + public void SaveReadSignsByUserId(string userId) + { + try + { + string sql = $"update MessageRemind set ReadSigns=1 where ReceiptId='{userId}' and ReadSigns<>1 "; + this.BaseRepository().ExecuteBySql(sql); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + #endregion }