|
|
@@ -46,6 +46,116 @@ namespace Learun.Application.OA |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 通知公告阅读统计 |
|
|
|
/// </summary> |
|
|
|
/// <param name="pagination"></param> |
|
|
|
/// <param name="queryJson"></param> |
|
|
|
/// <returns></returns> |
|
|
|
public IEnumerable<NewsEntity> 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<NewsEntity>(sql); |
|
|
|
|
|
|
|
|
|
|
|
return list; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
if (ex is ExceptionEx) |
|
|
|
{ |
|
|
|
throw; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
throw ExceptionEx.ThrowServiceException(ex); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 保存通知公告应读人员 |
|
|
|
/// </summary> |
|
|
|
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<NewsEntity>(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); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 新闻公告实体 |
|
|
|
/// </summary> |
|
|
|