From 75f645785c732e10bb0610304065d67c4e6a54bb Mon Sep 17 00:00:00 2001 From: ndbs Date: Fri, 26 Aug 2022 10:33:02 +0800 Subject: [PATCH 1/4] =?UTF-8?q?app2.0=20=E6=89=8B=E6=9C=BA=E7=AB=AF?= =?UTF-8?q?=E9=98=85=E8=AF=BB=E9=80=9A=E7=9F=A5=E5=85=AC=E5=91=8A=E9=98=85?= =?UTF-8?q?=E8=AF=BB=E8=AE=B0=E5=BD=95=E4=B8=8D=E7=B4=AF=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/NewsApi.cs | 36 ++++++++++++++++++- .../LearunApp-2.2.0/pages/home/notice.vue | 6 ++-- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/NewsApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/NewsApi.cs index d932ff6aa..5027aaa9e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/NewsApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/NewsApi.cs @@ -9,6 +9,7 @@ using System.Text; using System.Data; using Learun.Application.OA; using Learun.Application.Organization; +using System; namespace Learun.Application.WebApi.Modules { @@ -18,12 +19,15 @@ namespace Learun.Application.WebApi.Modules private NoticeIBLL noticeIBLL = new NoticeBLL(); private DepartmentIBLL departmentIBLL = new DepartmentBLL(); private PostIBLL postIBLL = new PostBLL(); + private LR_OA_NewsReadIBLL lR_OA_NewsReadIBLL = new LR_OA_NewsReadBLL(); public NewsApi() : base("/learun/news") { Get["/list"] = GetList; Get["/shList"] = GetshList; + + Post["/newsRead"] = NewsRead; } @@ -137,11 +141,41 @@ namespace Learun.Application.WebApi.Modules } return Success(shlist); } - #region 私有类 + /// + /// 阅读通知公告 + /// 主键 + /// + /// + public Response NewsRead(dynamic _) + { + var loginUserInfo = LoginUserInfo.Get(); + NoticeEntity parameter = this.GetReqData(); + + //判断当前用户是否阅读当前通知公告 + var entity = lR_OA_NewsReadIBLL.GetLR_OA_NewsReadEntityByNewsIdAndUserId(parameter.newsId, loginUserInfo.userId); + if (entity == null) + { + var lR_OA_NewsRead = new LR_OA_NewsReadEntity() + { + NewsId = parameter.newsId, + RUserId = loginUserInfo.userId, + RUserName = loginUserInfo.realName, + RTime = DateTime.Now + }; + lR_OA_NewsReadIBLL.SaveEntity("", lR_OA_NewsRead); + + //修改当前通知公告的浏览量 + lR_OA_NewsReadIBLL.UpdateNewsPV(parameter.newsId); + } + + return Success("阅读成功!"); + } + #region 私有类 private class NoticeEntity { public string ProgressId { get; set; } + public string newsId { get; set; } } #endregion diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/home/notice.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/home/notice.vue index 00d89e6e7..7bd17e8f3 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/home/notice.vue +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/home/notice.vue @@ -31,15 +31,17 @@ export default { async init() { this.LOADING('加载中…') const noticeItem = this.GET_PARAM() - this.content = this.CONVERT_HTML(noticeItem.f_content) - this.time = moment(noticeItem.f_time).format('HH : mm') this.date = moment(noticeItem.f_time).format('YYYY年 M月 D日') this.SET_TITLE(noticeItem.f_title) this.ready = true this.HIDE_LOADING() + let _postData = { + newsId: noticeItem.f_id, + } + this.HTTP_POST('learun/news/newsRead',_postData, '加载数据时出错'); } } } From 55731502ac262fd2c54fd3b244c788dd0437a63c Mon Sep 17 00:00:00 2001 From: ndbs Date: Fri, 26 Aug 2022 10:34:41 +0800 Subject: [PATCH 2/4] --- .../Learun.Application.WebApi/Modules/NewsApi.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/NewsApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/NewsApi.cs index 5027aaa9e..30966dbde 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/NewsApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/NewsApi.cs @@ -144,7 +144,6 @@ namespace Learun.Application.WebApi.Modules /// /// 阅读通知公告 - /// 主键 /// /// public Response NewsRead(dynamic _) From 6d87a72c41082fb323ab9b8b2d5f4fab3d638951 Mon Sep 17 00:00:00 2001 From: ndbs Date: Fri, 26 Aug 2022 14:46:58 +0800 Subject: [PATCH 3/4] =?UTF-8?q?app2.0=20=E6=89=8B=E6=9C=BA=E7=AB=AF?= =?UTF-8?q?=E5=80=BC=E7=8F=AD=E5=AE=89=E6=8E=92=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PersonnelManagement/DutyScheduleApi.cs | 77 ++++++++++++++++++- .../DutySchedule/DutyScheduleBLL.cs | 22 ++++++ .../DutySchedule/DutyScheduleIBLL.cs | 6 ++ .../DutySchedule/DutyScheduleService.cs | 39 +++++++--- 4 files changed, 132 insertions(+), 12 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/PersonnelManagement/DutyScheduleApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/PersonnelManagement/DutyScheduleApi.cs index 54b0d5975..a18aaaf04 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/PersonnelManagement/DutyScheduleApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/PersonnelManagement/DutyScheduleApi.cs @@ -1,4 +1,5 @@ -using Nancy; +using System; +using Nancy; using Learun.Util; using System.Collections.Generic; using Learun.Application.TwoDevelopment.EducationalAdministration; @@ -21,9 +22,13 @@ namespace Learun.Application.WebApi.Modules /// 注册接口 /// public DutyScheduleApi() - : base("/Learun/adms/PersonnelManagement/DutySchedule") + : base("/learun/adms/PersonnelManagement/DutySchedule") { Get["/pagelist"] = GetPageList; + Get["/list"] = GetList; + Get["/form"] = GetForm; + Post["/save"] = SaveForm; + Post["/delete"] = DeleteForm; } #region 获取数据 @@ -45,6 +50,74 @@ namespace Learun.Application.WebApi.Modules }; return Success(jsonData); } + + /// + /// 获取页面显示列表数据 + /// + /// + /// + public Response GetList(dynamic _) + { + string queryJson = this.GetReqData(); + var data = dutyScheduleIBLL.GetList(); + return Success(data); + } + /// + /// 获取表单数据 + /// + /// + /// + public Response GetForm(dynamic _) + { + string keyValue = this.GetReqData(); + var ScheduleData = dutyScheduleIBLL.GetDutyScheduleEntity(keyValue); + //ScheduleData.StartTime = Convert.ToDateTime((ScheduleData.StartTime.ToDate().ToString("yyyy-MM-dd") + " " + ScheduleData.StartTime.Substring(0, 2) + ":" + ScheduleData.StartTime.Substring(2, 2)).ToDate().ToString("yyyy-MM-dd HH:mm")); + //ScheduleData.EndTime = Convert.ToDateTime((ScheduleData.EndTime.ToDate().ToString("yyyy-MM-dd") + " " + ScheduleData.EndTime.Substring(0, 2) + ":" + ScheduleData.F_EndTime.Substring(2, 2)).ToDate().ToString("yyyy-MM-dd HH:mm")); + var jsonData = new + { + Schedule = ScheduleData, + }; + return Success(jsonData); + } + #endregion + + #region 提交数据 + /// + /// 保存实体数据(新增、修改) + /// + /// + /// + public Response SaveForm(dynamic _) + { + ReqFormEntity parameter = this.GetReqData(); + DutyScheduleEntity entity = parameter.strEntity.ToObject(); + dutyScheduleIBLL.SaveEntity(parameter.keyValue, entity); + return Success("保存成功!"); + } + + + /// + /// 删除实体数据 + /// + /// + /// + public Response DeleteForm(dynamic _) + { + string keyValue = this.GetReqData(); + dutyScheduleIBLL.DeleteEntity(keyValue); + return Success("删除成功!"); + } + #endregion + + #region 私有类 + /// + /// 表单实体类 + /// + private class ReqFormEntity + { + public string keyValue { get; set; } + public string strEntity { get; set; } + } #endregion } } \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/DutySchedule/DutyScheduleBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/DutySchedule/DutyScheduleBLL.cs index 45ae9380c..736a0b307 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/DutySchedule/DutyScheduleBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/DutySchedule/DutyScheduleBLL.cs @@ -66,6 +66,28 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } } + /// + /// 获取列表 + /// + /// 返回列表 + public IEnumerable GetList() + { + try + { + return dutyScheduleService.GetList(); + } + 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.TwoDevelopment/PersonnelManagement/DutySchedule/DutyScheduleIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/DutySchedule/DutyScheduleIBLL.cs index a3120c615..4b456ae07 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/DutySchedule/DutyScheduleIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/DutySchedule/DutyScheduleIBLL.cs @@ -27,6 +27,12 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement /// /// DutyScheduleEntity GetDutyScheduleEntity(string keyValue); + /// + /// 获取所有数据 + /// + /// + IEnumerable GetList(); + #endregion #region 提交数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/DutySchedule/DutyScheduleService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/DutySchedule/DutyScheduleService.cs index c660b036e..a295a2b01 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/DutySchedule/DutyScheduleService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/DutySchedule/DutyScheduleService.cs @@ -28,21 +28,16 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement { try { + var adms = this.BaseRepository().getDbConnection().Database; var strSql = new StringBuilder(); strSql.Append("SELECT "); - strSql.Append(@" - t.ID, - t.StartTime, - t.EndTime, - t.Person, - t.Remark,u.F_Account,F_RealName - "); - strSql.Append(" FROM DutySchedule t left join adms7ultimate2.dbo.LR_Base_User u on t.Person=u.F_UserId "); + strSql.Append(@" t.* ,u.F_Account,F_RealName "); + strSql.Append($" FROM DutySchedule t left join {adms}.dbo.LR_Base_User u on t.Person=u.F_UserId "); strSql.Append(" WHERE 1=1 "); var queryParam = queryJson.ToJObject(); // 虚拟参数 var dp = new DynamicParameters(new { }); - return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(),dp, pagination); + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); } catch (Exception ex) { @@ -81,6 +76,29 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } } + /// + /// 获取列表 + /// + /// 返回列表 + public IEnumerable GetList() + { + try + { + var adms = this.BaseRepository().getDbConnection().Database; + var strSql = new StringBuilder(); + strSql.Append("SELECT "); + strSql.Append(@" t.*, u.F_Account,F_RealName "); + strSql.Append($" FROM DutySchedule t left join {adms}.dbo.LR_Base_User u on t.Person=u.F_UserId "); + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString()); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + throw; + else + throw ExceptionEx.ThrowServiceException(ex); + } + } #endregion #region 提交数据 @@ -94,7 +112,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement { try { - this.BaseRepository("CollegeMIS").Delete(t=>t.ID == keyValue); + this.BaseRepository("CollegeMIS").Delete(t => t.ID == keyValue); } catch (Exception ex) { @@ -126,6 +144,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement else { entity.Create(); + entity.CreateTime = DateTime.Now; this.BaseRepository("CollegeMIS").Insert(entity); } } From ec20028f92d68fadfe95ca18f7d49e39adffc9be Mon Sep 17 00:00:00 2001 From: ndbs Date: Fri, 26 Aug 2022 15:15:20 +0800 Subject: [PATCH 4/4] =?UTF-8?q?pc=20=E5=80=BC=E7=8F=AD=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/DutySchedule/Index.cshtml | 9 +++++ .../Views/DutySchedule/Index.js | 38 +++++++++++++++++++ .../DutySchedule/DutyScheduleService.cs | 13 ++++++- 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/DutySchedule/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/DutySchedule/Index.cshtml index 23b616085..9409e00a9 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/DutySchedule/Index.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/DutySchedule/Index.cshtml @@ -7,6 +7,15 @@
+
+
+
+
+ +
+
+  查询 +
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/DutySchedule/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/DutySchedule/Index.js index 39b3f0932..876fd47e1 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/DutySchedule/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/DutySchedule/Index.js @@ -7,12 +7,46 @@ 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(); + } + }); + // 查询 + $('#btn_Search').on('click', function () { + var keyword = $('#txt_Keyword').val(); + page.search({ keyword: keyword }); + }); // 刷新 $('#lr_refresh').on('click', function () { location.reload(); @@ -82,11 +116,15 @@ var bootstrap = function ($, learun) { ], mainId: 'ID', isPage: true, + sidx: 'createtime', + sord: 'desc' }); page.search(); }, search: function (param) { param = param || {}; + param.StartTime = startTime; + param.EndTime = endTime; $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); } }; diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/DutySchedule/DutyScheduleService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/DutySchedule/DutyScheduleService.cs index a295a2b01..e9db34110 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/DutySchedule/DutyScheduleService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/DutySchedule/DutyScheduleService.cs @@ -31,12 +31,23 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement var adms = this.BaseRepository().getDbConnection().Database; var strSql = new StringBuilder(); strSql.Append("SELECT "); - strSql.Append(@" t.* ,u.F_Account,F_RealName "); + strSql.Append(@" t.* ,u.F_Account,u.F_RealName "); strSql.Append($" FROM DutySchedule t left join {adms}.dbo.LR_Base_User u on t.Person=u.F_UserId "); strSql.Append(" WHERE 1=1 "); var queryParam = queryJson.ToJObject(); // 虚拟参数 var dp = new DynamicParameters(new { }); + if (!queryParam["keyword"].IsEmpty()) + { + dp.Add("keyword", "%" + queryParam["keyword"].ToString() + "%", DbType.String); + strSql.Append(" AND u.F_RealName Like @keyword "); + } + 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.StartTime >= @startTime AND t.EndTime <= @endTime ) "); + } return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); } catch (Exception ex)