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 0b992dc31..e1d87ec16 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 @@ -126,6 +126,26 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers }; return JsonResult(jsonData); } + + /// + /// 通知公告阅读统计 + /// + /// 分页参数 + /// 关键词 + /// + public ActionResult GetPageListForStatistics(string pagination, string queryJson) + { + Pagination paginationobj = pagination.ToObject(); + var data = noticeIBLL.GetPageListForStatistics(paginationobj, queryJson); + var jsonData = new + { + rows = data, + total = paginationobj.total, + page = paginationobj.page, + records = paginationobj.records, + }; + return JsonResult(jsonData); + } /// /// 查看通知公告 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/News/NewsEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/News/NewsEntity.cs index d42108a92..0da502673 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/News/NewsEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/News/NewsEntity.cs @@ -246,7 +246,8 @@ namespace Learun.Application.OA this.F_ModifyUserName = userInfo.realName; } #endregion - + [NotMapped] + public string F_Send { get; set; } } 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 2c40de9f2..34ccd5803 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 @@ -40,6 +40,26 @@ namespace Learun.Application.OA } } } + + public IEnumerable GetPageListForStatistics(Pagination pagination, string queryJson) + { + try + { + return noticeService.GetPageListForStatistics(pagination, queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + /// /// 公告实体 /// 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 379dae654..7ae6d0371 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 @@ -20,6 +20,7 @@ namespace Learun.Application.OA /// 关键词 /// IEnumerable GetPageList(Pagination pagination, string keyword); + IEnumerable GetPageListForStatistics(Pagination pagination, string queryJson); /// /// 公告实体 /// 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 88da9ca7f..7da1c88eb 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 @@ -46,6 +46,116 @@ namespace Learun.Application.OA } } } + + /// + /// 通知公告阅读统计 + /// + /// + /// + /// + public IEnumerable GetPageListForStatistics(Pagination pagination, string queryJson) + { + try + { + var misdbname = BaseRepository("CollegeMIS").getDbConnection().Database; + var basedbname = BaseRepository().getDbConnection().Database; + + var sql = + @"SELECT case when (F_SendDeptId is null or len(F_SendDeptId)=0) and (F_SendPostId is null or len(F_SendDeptId)=0) then '1' else '' end as F_Send, + F_SendDeptId,F_SendPostId,*FROM LR_OA_News t WHERE t.F_TypeId = 2 and F_DeleteMark = 0 and F_EnabledMark = 1"; + var list = BaseRepository().FindList(sql); + + + return list; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 保存通知公告应读人员 + /// + public void SaveNewsShouldRead() + { + var db = this.BaseRepository(); + try + { + db.BeginTrans(); + var misdbname = BaseRepository("CollegeMIS").getDbConnection().Database; + var basedbname = BaseRepository().getDbConnection().Database; + + var sql = + @"SELECT case when (F_SendDeptId is null or len(F_SendDeptId)=0) and (F_SendPostId is null or len(F_SendDeptId)=0) then '1' else '' end as F_Send, + F_SendDeptId,F_SendPostId,* FROM LR_OA_News t WHERE t.F_TypeId = 2 and t.F_DeleteMark=0 and t.F_EnabledMark=1 + and t.f_Newsid not in (SELECT Newsid from [dbo].[LR_OA_NewsShouldRead])"; + var list = db.FindList(sql); + foreach (var news in list) + { + if (!string.IsNullOrEmpty(news.F_Send) && news.F_Send == "1") + { + //全部教师 + db.ExecuteBySql($@"insert into LR_OA_NewsShouldRead +SELECT newid(),'{news.F_NewsId}',f_userid from lr_base_user where f_description='教师' and +f_userid not in ( +SELECT ruserid from [dbo].[LR_OA_NewsShouldRead] where newsid='{news.F_NewsId}' +) +"); + } + else + { + //接收部门 + if (!string.IsNullOrEmpty(news.F_SendDeptId)) + { + var deptids = string.Join("','", news.F_SendDeptId.Split(',')); + db.ExecuteBySql($@"insert into LR_OA_NewsShouldRead +SELECT newid(),'{news.F_NewsId}',f_userid from lr_base_user where f_description='教师' and F_DepartmentId in ('{deptids}') +and f_userid not in ( +SELECT ruserid from [dbo].[LR_OA_NewsShouldRead] where newsid='{news.F_NewsId}' +)"); + //岗位 + if (!string.IsNullOrEmpty(news.F_SendPostId)) + { + var postids = string.Join("','", news.F_SendPostId.Split(',')); + db.ExecuteBySql($@"insert into LR_OA_NewsShouldRead +SELECT newid(),'{news.F_NewsId}',f_userid from lr_base_user t +join LR_Base_UserRelation r on r.f_category='2' and t.F_UserId=r.f_userid +where t.f_description='教师' and r.f_objectid='{postids}' + and t.F_DepartmentId not in ('{deptids}') +and t.f_userid not in ( +SELECT ruserid from [dbo].[LR_OA_NewsShouldRead] where newsid='{news.F_NewsId}' +)"); + } + } + + if (string.IsNullOrEmpty(news.F_SendDeptId) && !string.IsNullOrEmpty(news.F_SendPostId)) + { + + } + } + } + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + /// /// 新闻公告实体 ///