| 
															
																@@ -1,6 +1,8 @@ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-using NPOI.SS.Formula.Functions; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+using NPOI.POIFS.Crypt.Dsig; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+using NPOI.SS.Formula.Functions; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 using OASystem.Domain; 
															 | 
															
															 | 
															
																 using OASystem.Domain; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 using OASystem.Domain.Dtos.System; 
															 | 
															
															 | 
															
																 using OASystem.Domain.Dtos.System; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+using OASystem.Domain.ViewModels.QiYeWeChat; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 using System; 
															 | 
															
															 | 
															
																 using System; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 using System.Collections.Generic; 
															 | 
															
															 | 
															
																 using System.Collections.Generic; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 using System.Linq; 
															 | 
															
															 | 
															
																 using System.Linq; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -113,25 +115,37 @@ namespace OASystem.Infrastructure.Repositories.System 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 var _readableMsgList = await _sqlSugar.SqlQueryable<ReadbleMessageView>(msgSqlWhere).ToListAsync(); 
															 | 
															
															 | 
															
																                 var _readableMsgList = await _sqlSugar.SqlQueryable<ReadbleMessageView>(msgSqlWhere).ToListAsync(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 if (_readableMsgList.Count > 0) 
															 | 
															
															 | 
															
																                 if (_readableMsgList.Count > 0) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 { 
															 | 
															
															 | 
															
																                 { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    int pageIndex = dto.PageIndex; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    int pageSize = pageIndex + 9; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    int pageSize = dto.PageSize; // 每页显示的记录数量 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    int currentPage = dto.PageIndex; // 当前页码(从1开始) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                     
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     //操作通知 OperationNotification 
															 | 
															
															 | 
															
																                     //操作通知 OperationNotification 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     List<int> operationTypeList = new List<int>() {1,2,3,4,5 }; 
															 | 
															
															 | 
															
																                     List<int> operationTypeList = new List<int>() {1,2,3,4,5 }; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     var operationNotificatioData = _readableMsgList.Where(it => operationTypeList.Contains(it.Type)).OrderBy(it => it.IsRead).ToList(); 
															 | 
															
															 | 
															
																                     var operationNotificatioData = _readableMsgList.Where(it => operationTypeList.Contains(it.Type)).OrderBy(it => it.IsRead).ToList(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    int operationNotificatioDataCount = operationNotificatioData.Count; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    // 计算起始索引和结束索引 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    int operationStartIndex = (currentPage - 1) * pageSize; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    int operationEndIndex = Math.Min(operationStartIndex + pageSize, operationNotificatioDataCount); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     var operationNotificatioDataView = new { 
															 | 
															
															 | 
															
																                     var operationNotificatioDataView = new { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                        Count = operationNotificatioData.Count, 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        Count = operationNotificatioDataCount, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         UnReadCount = operationNotificatioData.Where(it => it.IsRead == 0).Count(), 
															 | 
															
															 | 
															
																                         UnReadCount = operationNotificatioData.Where(it => it.IsRead == 0).Count(), 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                        OperationNotificatioData = operationNotificatioData.Skip(pageIndex).Take(pageSize).ToList() 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        OperationNotificatioData = operationNotificatioData.Skip(operationStartIndex).Take(pageSize).ToList() 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     }; 
															 | 
															
															 | 
															
																                     }; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     //任务通知 TaskNotification 
															 | 
															
															 | 
															
																                     //任务通知 TaskNotification 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     List<int> taskTypeList = new List<int>() { 6 }; 
															 | 
															
															 | 
															
																                     List<int> taskTypeList = new List<int>() { 6 }; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     var taskNotificatioData = _readableMsgList.Where(it => taskTypeList.Contains(it.Type)).OrderBy(it => it.IsRead).ToList(); 
															 | 
															
															 | 
															
																                     var taskNotificatioData = _readableMsgList.Where(it => taskTypeList.Contains(it.Type)).OrderBy(it => it.IsRead).ToList(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    int taskNotificatioDataCount = taskNotificatioData.Count; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    // 计算起始索引和结束索引 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    int taskStartIndex = (currentPage - 1) * pageSize; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    int taskEndIndex = Math.Min(operationStartIndex + pageSize, operationNotificatioDataCount); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     var taskNotificatioDataView = new 
															 | 
															
															 | 
															
																                     var taskNotificatioDataView = new 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     { 
															 | 
															
															 | 
															
																                     { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                        Count = taskNotificatioData.Count, 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        Count = taskNotificatioDataCount, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         UnReadCount = taskNotificatioData.Where(it => it.IsRead == 0).Count(), 
															 | 
															
															 | 
															
																                         UnReadCount = taskNotificatioData.Where(it => it.IsRead == 0).Count(), 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                        TaskNotificatioData = taskNotificatioData.Skip(pageIndex).Take(pageSize).ToList() 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        TaskNotificatioData = taskNotificatioData.Skip(taskStartIndex).Take(pageSize).ToList() 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     }; 
															 | 
															
															 | 
															
																                     }; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     var _view = new { 
															 | 
															
															 | 
															
																                     var _view = new { 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -152,6 +166,36 @@ namespace OASystem.Infrastructure.Repositories.System 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             return result; 
															 | 
															
															 | 
															
																             return result; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         } 
															 | 
															
															 | 
															
																         } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        /// <summary> 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        /// 获取消息未读消息条数 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        /// </summary> 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        /// <param name="uId">可读用户Id</param> 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        /// <returns></returns> 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        public async Task<int> GetUnReadCount(int userId) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            int _unReadCount = 0; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            string msgSqlWhere = string.Format(@"Select sm.Id,sm.Type,sm.Title,sm.Content,sd.DepName issuerDep,su.CnName issuerUser,  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                                            sm.ReleaseTime,smra.Id AuthId,smra.ReadableUId,smra.IsRead,smra.ReadTime  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                                     From Sys_Message sm  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                                     Inner Join Sys_MessageReadAuth smra On sm.Id = smra.MsgId 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                                     Inner Join Sys_Users su On sm.IssuerId = su.Id 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                                     Inner Join Sys_Department sd On su.DepId = sd.Id 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                                     Inner Join Sys_Users suAuth On smra.ReadableUId = suAuth.Id 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                                     Where sm.IsDel = 0 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                                     And smra.IsDel = 0  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                                     And smra.ReadableUId = {0} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                                     Order By ReleaseTime Desc ", userId); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            var _readableMsgList = await _sqlSugar.SqlQueryable<ReadbleMessageView>(msgSqlWhere).ToListAsync(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            if (_readableMsgList.Count > 0) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                _unReadCount = _readableMsgList.Where(it => it.IsRead == 0).Count(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            return _unReadCount; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         /// <summary> 
															 | 
															
															 | 
															
																         /// <summary> 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         /// 获取消息详细 
															 | 
															
															 | 
															
																         /// 获取消息详细 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         /// </summary> 
															 | 
															
															 | 
															
																         /// </summary> 
															 |