From 00b91b479365444189e9fafb19cfc36cbc267f97 Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Mon, 21 Nov 2022 10:11:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84=E9=80=9A=E7=9F=A5=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E9=98=85=E8=AF=BB=E7=8A=B6=E6=80=81=E7=9A=84=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/NoticeController.cs | 7 ++ .../LR_OAModule/Views/Notice/ViewIndex.cshtml | 3 + .../LR_OAModule/Views/Notice/ViewIndex.js | 14 ++- .../Learun.Application.OA/Notice/NoticeBLL.cs | 19 ++++ .../Notice/NoticeIBLL.cs | 1 + .../Notice/NoticeService.cs | 86 +++++++++++++++++++ 6 files changed, 126 insertions(+), 4 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Controllers/NoticeController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Controllers/NoticeController.cs index eca249895..6cb224487 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Controllers/NoticeController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Controllers/NoticeController.cs @@ -215,6 +215,13 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers return JsonResult(newsList); } + + public ActionResult GetListOfSelfForView(string queryJson) + { + var newsList = noticeIBLL.GetListOfSelf(queryJson); + return JsonResult(newsList); + } + /// /// 查看通知公告 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/ViewIndex.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/ViewIndex.cshtml index f43241fe3..92f2d2137 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/ViewIndex.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/ViewIndex.cshtml @@ -10,6 +10,9 @@
+
+
+
 查询
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/ViewIndex.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/ViewIndex.js index 54430947a..f202fe8ba 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/ViewIndex.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/ViewIndex.js @@ -15,10 +15,17 @@ var bootstrap = function ($, learun) { page.bind(); }, bind: function () { + $('#IsRead').lrselect({ + placeholder: '请选择阅读状态', + data: [{ id: '1', text: '已阅读' }, { id: '0', text: '未阅读' }], + value: "id", + text: "text" + }); // 查询 $('#btn_Search').on('click', function () { var keyword = $('#txt_Keyword').val(); - page.search({ keyword: keyword }); + var IsRead = $('#IsRead').lrselectGet(); + page.search({ keyword: keyword, IsRead: IsRead }); }); // 刷新 $('#lr_refresh').on('click', function () { @@ -42,7 +49,7 @@ var bootstrap = function ($, learun) { }, initGrid: function () { $('#gridtable').jfGrid({ - url: top.$.rootUrl + '/LR_OAModule/Notice/GetListOfSelf', + url: top.$.rootUrl + '/LR_OAModule/Notice/GetListOfSelfForView', headData: [ { label: '公告标题', name: 'F_FullHead', index: 'F_FullHead', width: 600, align: 'left' }, { label: '公告类别', name: 'F_Category', index: 'F_Category', width: 100, align: 'center' }, @@ -78,12 +85,11 @@ var bootstrap = function ($, learun) { page.search(); }, search: function (param) { - param = param || {}; if (category) { param.categoryId = category; } - $('#gridtable').jfGridSet('reload', param); + $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); } }; // 保存数据后回调刷新 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeBLL.cs index 8b772e9fe..ccd539ae0 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeBLL.cs @@ -179,6 +179,25 @@ namespace Learun.Application.OA } } + public IEnumerable GetListOfSelf(string queryJson) + { + try + { + return noticeService.GetListOfSelf(queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + #endregion #region 流程 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeIBLL.cs index 599d7faec..6b40528ad 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeIBLL.cs @@ -51,6 +51,7 @@ namespace Learun.Application.OA /// 关键词 /// IEnumerable GetList(string keyword,string categoryId=null); + IEnumerable GetListOfSelf(string queryJson); #endregion diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeService.cs index 5a80c018f..be706c3fb 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeService.cs @@ -387,6 +387,92 @@ SELECT ruserid from [dbo].[LR_OA_NewsShouldRead] where newsid='{news.F_NewsId}' } } + public IEnumerable GetListOfSelf(string queryJson) + { + try + { + var userinfo = LoginUserInfo.Get(); + var userId = userinfo.userId; + var deptId = userinfo.departmentId; + var postIds = userinfo.postIds; + var strSql = new StringBuilder(); + strSql.Append("SELECT t.*,r.RNewsId,r.RTime FROM LR_OA_News t "); + strSql.Append(" left join LR_OA_NewsRead r on t.F_NewsId = r.NewsId and r.RUserId=@userId "); + strSql.Append(" left join lr_base_user u on u.F_UserId=@userId "); + strSql.Append(" WHERE t.F_TypeId = 2 and t.F_DeleteMark=0 and t.F_EnabledMark=1 "); + if (userinfo.account.Contains("20")) + { + strSql.Append(" and t.F_ReleaseTime>CONVERT(datetime,SUBSTRING(u.F_Account,1,4)+'-08-31',120) "); + } + + strSql.Append($@" and ( +((t.F_SendDeptId is null or len(t.F_SendDeptId)=0) and (t.F_SendPostId is null or len(t.F_SendPostId)=0)) +"); + if (!string.IsNullOrEmpty(deptId)) + { + strSql.Append($" or (t.F_SendDeptId is not null and t.F_SendDeptId like '%{deptId}%')"); + } + if (!string.IsNullOrEmpty(postIds)) + { + strSql.Append(" or (t.F_SendPostId is not null and "); + if (postIds.Contains(",")) + { + string postidSql = " ("; + foreach (var postId in postIds) + { + postidSql += $" t.F_SendPostId like '%{postId}%' or"; + } + + postidSql = postidSql.Substring(0, postidSql.LastIndexOf("or")) + ")"; + strSql.Append(postidSql); + } + else + { + strSql.Append($" t.F_SendPostId like '%{postIds}%'"); + } + + strSql.Append(")"); + } + + strSql.Append(") "); + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + if (!queryParam["keyword"].IsEmpty()) + { + strSql.Append($" AND t.F_FullHead Like '{queryParam["keyword"].ToString()}' "); + } + if (!queryParam["categoryId"].IsEmpty()) + { + strSql.Append($" AND t.F_CategoryId = '{queryParam["categoryId"].ToString()}'"); + } + if (!queryParam["IsRead"].IsEmpty()) + { + var IsRead = queryParam["IsRead"].ToString().Trim(); + if (IsRead == "1") + { + strSql.Append($" AND (r.RNewsId is not null and len(r.RNewsId)>0)"); + } + else + { + strSql.Append($" AND (r.RNewsId is null or len(r.RNewsId)=0)"); + } + } + strSql.Append(" ORDER BY t.F_ReleaseTime DESC "); + return this.BaseRepository().FindList(strSql.ToString(), new { userId = userId }); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } #endregion public void ChangeStatusById(string keyValue, int status, string processId)