@@ -60,6 +60,15 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 通知公告阅读统计 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult IndexStatistics() | |||
{ | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 通知公告(需要审核) | |||
/// </summary> | |||
/// <returns></returns> | |||
@@ -279,6 +288,28 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers | |||
} | |||
/// <summary> | |||
/// 通知公告阅读统计 | |||
/// </summary> | |||
/// <param name="pagination">分页参数</param> | |||
/// <param name="keyword">关键词</param> | |||
/// <returns></returns> | |||
public ActionResult GetPageListForStatistics(string pagination, string queryJson) | |||
{ | |||
Pagination paginationobj = pagination.ToObject<Pagination>(); | |||
//添加通知公告应阅读人数 | |||
noticeIBLL.SaveNewsShouldRead(); | |||
var data = noticeIBLL.GetPageListForStatistics(paginationobj, queryJson); | |||
var jsonData = new | |||
{ | |||
rows = data, | |||
total = paginationobj.total, | |||
page = paginationobj.page, | |||
records = paginationobj.records, | |||
}; | |||
return JsonResult(jsonData); | |||
} | |||
//public ActionResult GetNoticeCategoryByDepartment(string departmentId) | |||
//{ | |||
@@ -0,0 +1,54 @@ | |||
@{ | |||
ViewBag.Title = "通知公告阅读统计"; | |||
Layout = "~/Views/Shared/_Index.cshtml"; | |||
} | |||
<div class="lr-layout"> | |||
<div class="lr-layout-center"> | |||
<div class="lr-layout-wrap lr-layout-wrap-notitle"> | |||
<div class="lr-layout-tool"> | |||
<div class="lr-layout-tool-left"> | |||
<div class="lr-layout-tool-item"> | |||
<div id="multiple_condition_query"> | |||
<div class="lr-query-formcontent"> | |||
<div class="col-xs-6 lr-form-item" id="TCNameDiv"> | |||
<div class="lr-form-item-title">年度</div> | |||
<div id="Year"></div> | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">月份</div> | |||
<div id="Month"></div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item"> | |||
<div class="lr-form-item-title">职工编号</div> | |||
<input id="F_Encode" type="text" class="form-control"/> | |||
</div> | |||
<div class="col-xs-12 lr-form-item"> | |||
<div class="lr-form-item-title">姓名</div> | |||
<input id="F_RealName" type="text" class="form-control"/> | |||
</div> | |||
<div class="col-xs-12 lr-form-item"> | |||
<div class="lr-form-item-title">部门</div> | |||
<div id="F_Departmentid"></div> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
@*<div class="lr-layout-tool-item"> | |||
<input id="txt_Keyword" type="text" class="form-control" placeholder="请输入标题" /> | |||
</div> | |||
<div class="lr-layout-tool-item"> | |||
<a id="btn_Search" class="btn btn-primary btn-sm"><i class="fa fa-search"></i> <span class="lrlt">查询</span></a> | |||
</div>*@ | |||
</div> | |||
<div class="lr-layout-tool-right"> | |||
<div class="btn-group btn-group-sm"> | |||
<a id="lr_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a> | |||
</div> | |||
</div> | |||
</div> | |||
<div class="lr-layout-body" id="gridtable"></div> | |||
</div> | |||
</div> | |||
</div> | |||
@Html.AppendJsFile("/Areas/LR_OAModule/Views/Notice/IndexStatistics.js") | |||
@@ -0,0 +1,106 @@ | |||
/* | |||
* 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) | |||
* Copyright (c) 2013-2018 北京泉江科技有限公司 | |||
* 创建人:陈彬彬 | |||
* 日 期:2017.07.11 | |||
* 描 述:通知公告阅读统计 | |||
*/ | |||
var refreshGirdData; // 更新数据 | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
var page = { | |||
init: function () { | |||
page.initGrid(); | |||
page.bind(); | |||
}, | |||
bind: function () { | |||
$('#multiple_condition_query').lrMultipleQuery(function (queryJson) { | |||
if (!!queryJson.Year && !!queryJson.Month) { | |||
queryJson.Year = queryJson.Year; | |||
queryJson.Month = Number(queryJson.Month) + 1; | |||
} | |||
page.search(queryJson); | |||
}, 200, 400); | |||
// 刷新 | |||
$('#lr_refresh').on('click', function () { | |||
location.reload(); | |||
}); | |||
//年度 | |||
$('#Year').lrselect({ | |||
url: top.$.rootUrl + '/EducationalAdministration/CdMajor/GenerateNearByYear', | |||
value: 'value', | |||
text: 'text' | |||
}); | |||
//$('#Year').lrselectSet(Year); | |||
//月份 | |||
$('#Month').lrDataItemSelect({ code: 'MPMonth' }); | |||
$('#F_Departmentid').lrselect({ | |||
allowSearch: true, | |||
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=classdata', | |||
param: { strWhere: " 1=1 and F_EnabledMark=1 and F_deleteMark=0 order by F_SortCode " }, | |||
value: "id", | |||
text: "name" | |||
}); | |||
}, | |||
initGrid: function () { | |||
$('#gridtable').jfGrid({ | |||
url: top.$.rootUrl + '/LR_OAModule/Notice/GetPageListForStatistics', | |||
headData: [ | |||
{ label: '职工编号', name: 'F_Account', width: 100, align: 'left' }, | |||
{ label: '姓名', name: 'F_RealName', width: 100, align: 'left' }, | |||
{ | |||
label: '部门', name: 'F_Departmentid', width: 100, align: 'left', | |||
formatterAsync: function (callback, value, row) { | |||
learun.clientdata.getAsync('department', { | |||
key: value, | |||
callback: function (item) { | |||
callback(item.name); | |||
} | |||
}); | |||
} | |||
}, | |||
{ label: '应阅读总次数', name: 'srnum', width: 100, align: 'left' }, | |||
{ label: '完成阅读次数(发起通知7天内)', name: 'rnum', width: 180, align: 'left' }, | |||
{ | |||
label: '完成阅读百分比', name: 'ruserid', width: 100, align: 'left', | |||
formatter: function (value, row) { | |||
if (!!row.rnum && !!row.srnum) { | |||
return GetPercent(row.rnum, row.srnum); | |||
} else { | |||
return ''; | |||
} | |||
} | |||
}, | |||
], | |||
mainId: 'F_Encode', | |||
reloadSelected: true, | |||
isMultiselect: true, | |||
isPage: true, | |||
}); | |||
page.search(); | |||
}, | |||
search: function (param) { | |||
param = param || {}; | |||
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); | |||
} | |||
}; | |||
// 保存数据后回调刷新 | |||
refreshGirdData = function () { | |||
page.search(); | |||
} | |||
page.init(); | |||
} | |||
function GetPercent(num, total) { | |||
num = parseFloat(num); | |||
total = parseFloat(total); | |||
if (isNaN(num) || isNaN(total)) { | |||
return '-'; | |||
} | |||
return total <= 0 ? '0%' : Math.round((num / total) * 10000) / 100.0 + '%'; | |||
} | |||
@@ -1484,6 +1484,7 @@ | |||
<Content Include="Areas\LR_OAModule\Views\Notice\FormFlowView.js" /> | |||
<Content Include="Areas\LR_OAModule\Views\Notice\FormFlow.js" /> | |||
<Content Include="Areas\LR_OAModule\Views\Notice\IndexFlow.js" /> | |||
<Content Include="Areas\LR_OAModule\Views\Notice\IndexStatistics.js" /> | |||
<Content Include="Areas\LR_OAModule\Views\ResourceFile\BcIndex.js" /> | |||
<Content Include="Areas\LR_OAModule\Views\Signet\Index.js" /> | |||
<Content Include="Areas\LR_PortalSite\Views\Article\Form.css" /> | |||
@@ -7721,6 +7722,7 @@ | |||
<Content Include="Areas\EducationalAdministration\Views\SunshineEducation\Index.cshtml" /> | |||
<Content Include="Areas\EducationalAdministration\Views\RecruitStuPlan\FormPlan.cshtml" /> | |||
<Content Include="Areas\EducationalAdministration\Views\RecruitStuPlan\IndexPlan.cshtml" /> | |||
<Content Include="Areas\LR_OAModule\Views\Notice\IndexStatistics.cshtml" /> | |||
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" /> | |||
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" /> | |||
<Content Include="Views\Login\Default-beifen.cshtml" /> | |||
@@ -247,6 +247,20 @@ namespace Learun.Application.OA | |||
} | |||
#endregion | |||
[NotMapped] | |||
public string F_Send { get; set; } | |||
[NotMapped] | |||
public string srnum { get; set; } | |||
[NotMapped] | |||
public string rnum { get; set; } | |||
[NotMapped] | |||
public string F_RealName { get; set; } | |||
[NotMapped] | |||
public string F_Departmentid { get; set; } | |||
[NotMapped] | |||
public string F_Account { get; set; } | |||
[NotMapped] | |||
public string ruserid { get; set; } | |||
} | |||
@@ -40,6 +40,45 @@ namespace Learun.Application.OA | |||
} | |||
} | |||
} | |||
public IEnumerable<NewsEntity> GetPageListForStatistics(Pagination pagination, string queryJson) | |||
{ | |||
try | |||
{ | |||
return noticeService.GetPageListForStatistics(pagination, queryJson); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
public void SaveNewsShouldRead() | |||
{ | |||
try | |||
{ | |||
noticeService.SaveNewsShouldRead(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 公告实体 | |||
/// </summary> | |||
@@ -20,6 +20,7 @@ namespace Learun.Application.OA | |||
/// <param name="keyword">关键词</param> | |||
/// <returns></returns> | |||
IEnumerable<NewsEntity> GetPageList(Pagination pagination, string keyword); | |||
IEnumerable<NewsEntity> GetPageListForStatistics(Pagination pagination, string queryJson); | |||
/// <summary> | |||
/// 公告实体 | |||
/// </summary> | |||
@@ -54,6 +55,7 @@ namespace Learun.Application.OA | |||
#endregion | |||
void ChangeStatusById(string keyValue, int i, string processId); | |||
void SaveNewsShouldRead(); | |||
NewsEntity GetEntityByProcessId(string processId); | |||
void SaveFormAndSubmit(string keyValue, NewsEntity entity); | |||
} | |||
@@ -1,4 +1,5 @@ | |||
using Learun.DataBase.Repository; | |||
using Dapper; | |||
using Learun.DataBase.Repository; | |||
using Learun.Util; | |||
using System; | |||
using System.Collections.Generic; | |||
@@ -51,6 +52,166 @@ 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 queryParam = queryJson.ToJObject(); | |||
var sql = new StringBuilder(@"select t.*,u.F_Account,u.f_realname,f_departmentid from "); | |||
sql.Append("("); | |||
sql.Append("select t1.ruserid,isnull(srnum,0) as srnum,isnull(rnum,0) as rnum from ("); | |||
sql.Append( | |||
@"select ruserid,COUNT(1) as srnum from LR_OA_News t left join LR_OA_NewsShouldRead s on s.newsid=t.f_newsid | |||
left join lr_base_user u on s.RUserId=u.F_UserId | |||
WHERE t.F_TypeId = 2 and t.F_DeleteMark=0 and t.F_EnabledMark=1 | |||
--and u.F_Account like '20%' | |||
--and t.F_ReleaseTime>CONVERT(datetime,SUBSTRING(u.F_Account,1,4)+'-08-31',120) | |||
"); | |||
if (!queryParam["Year"].IsEmpty() && !queryParam["Month"].IsEmpty()) | |||
{ | |||
sql.Append($" and year(t.F_ReleaseTime)='{queryParam["Year"].ToString()}' and month(t.F_ReleaseTime)='{queryParam["Month"].ToString()}'"); | |||
} | |||
sql.Append(" group by ruserid ) t1 left join ("); | |||
sql.Append( | |||
@" select ruserid,COUNT(1) as rnum from LR_OA_News t left join LR_OA_NewsRead r on r.newsid=t.f_newsid | |||
left join lr_base_user u on r.RUserId=u.F_UserId | |||
WHERE t.F_TypeId = 2 and t.F_DeleteMark=0 and t.F_EnabledMark=1 | |||
--and u.F_Account like '20%' | |||
--and t.F_ReleaseTime>CONVERT(datetime,SUBSTRING(u.F_Account,1,4)+'-08-31',120) | |||
and DATEDIFF(HOUR,t.F_ReleaseTime,r.RTime)<=24*7 "); | |||
if (!queryParam["Year"].IsEmpty() && !queryParam["Month"].IsEmpty()) | |||
{ | |||
sql.Append($" and year(t.F_ReleaseTime)='{queryParam["Year"].ToString()}' and month(t.F_ReleaseTime)='{queryParam["Month"].ToString()}'"); | |||
} | |||
sql.Append(" group by ruserid ) t2 on t1.ruserid=t2.ruserid "); | |||
sql.Append(") t"); | |||
sql.Append(" left join lr_base_user u on t.ruserid=u.f_userid where 1=1 "); | |||
// 虚拟参数 | |||
var dp = new DynamicParameters(new { }); | |||
if (queryParam.HasValues) | |||
{ | |||
if (!queryParam["F_Encode"].IsEmpty()) | |||
{ | |||
sql.Append($" AND u.f_encode like '%{queryParam["F_Encode"].ToString()}%' "); | |||
} | |||
if (!queryParam["F_RealName"].IsEmpty()) | |||
{ | |||
sql.Append($" AND u.f_realname like '%{queryParam["F_RealName"].ToString()}%' "); | |||
} | |||
if (!queryParam["F_Departmentid"].IsEmpty()) | |||
{ | |||
sql.Append($" AND f_departmentid = '{queryParam["F_Departmentid"].ToString()}' "); | |||
} | |||
} | |||
var list = this.BaseRepository().FindList<NewsEntity>(sql.ToString(), pagination); | |||
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 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 distinct Newsid from [dbo].[LR_OA_NewsShouldRead])"; | |||
var list = db.FindList<NewsEntity>(sql); | |||
foreach (var news in list) | |||
{ | |||
if (string.IsNullOrEmpty(news.F_SendDeptId) && string.IsNullOrEmpty(news.F_SendPostId)) | |||
{ | |||
//接收人是全部教师 | |||
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}',t.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 in ('{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)) | |||
{ | |||
var postids = string.Join("','", news.F_SendPostId.Split(',')); | |||
db.ExecuteBySql($@"insert into LR_OA_NewsShouldRead | |||
SELECT newid(),'{news.F_NewsId}',t.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 in ('{postids}') | |||
and t.f_userid not in ( | |||
SELECT ruserid from [dbo].[LR_OA_NewsShouldRead] where newsid='{news.F_NewsId}' | |||
)"); | |||
} | |||
} | |||
} | |||
db.Commit(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 新闻公告实体 | |||
/// </summary> | |||
@@ -151,7 +312,7 @@ namespace Learun.Application.OA | |||
} | |||
} | |||
#endregion | |||
#region 扩展数据 | |||