@@ -104,6 +104,16 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers | |||
{ | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 通知公告阅读统计 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult IndexStatistics() | |||
{ | |||
return View(); | |||
} | |||
#endregion | |||
#region 获取数据 | |||
@@ -136,6 +146,8 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers | |||
public ActionResult GetPageListForStatistics(string pagination, string queryJson) | |||
{ | |||
Pagination paginationobj = pagination.ToObject<Pagination>(); | |||
//添加通知公告应阅读人数 | |||
noticeIBLL.SaveNewsShouldRead(); | |||
var data = noticeIBLL.GetPageListForStatistics(paginationobj, queryJson); | |||
var jsonData = new | |||
{ | |||
@@ -337,7 +349,7 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers | |||
{ | |||
entity.F_NewsContent = WebHelper.HtmlEncode(entity.F_NewsContent); | |||
noticeIBLL.SaveEntity(keyValue, entity); | |||
return Success("保存成功!"); | |||
} | |||
@@ -549,7 +561,7 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers | |||
noticeIBLL.DeleteEntity(keyValue); | |||
return Success("删除成功!"); | |||
} | |||
#endregion | |||
@@ -0,0 +1,46 @@ | |||
@{ | |||
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-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,90 @@ | |||
/* | |||
* 版 本 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) { | |||
page.search(queryJson); | |||
}, 200, 400); | |||
// 刷新 | |||
$('#lr_refresh').on('click', function () { | |||
location.reload(); | |||
}); | |||
$('#Departmentid').lrselect({ | |||
allowSearch: true, | |||
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=classdata', | |||
param: { strWhere: "1=1 " }, | |||
value: "id", | |||
text: "name" | |||
}); | |||
}, | |||
initGrid: function () { | |||
$('#gridtable').jfGrid({ | |||
url: top.$.rootUrl + '/LR_OAModule/Notice/GetPageListForStatistics', | |||
headData: [ | |||
{ label: '职工编号', name: 'F_Encode', 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: '完成阅读次数', name: 'rnum', width: 100, align: 'left' }, | |||
{ | |||
label: '完成阅读百分比', name: '', 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) { | |||
$('#gridtable').jfGridSet('reload', 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 + '%'; | |||
} | |||
@@ -1519,6 +1519,7 @@ | |||
<Content Include="Areas\LR_OAModule\Views\LostArticleInfo\Index.js" /> | |||
<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\IndexStatistics.js" /> | |||
<Content Include="Areas\LR_OAModule\Views\Notice\IndexFlow.js" /> | |||
<Content Include="Areas\LR_OAModule\Views\ResourceFile\BcIndex.js" /> | |||
<Content Include="Areas\LR_OAModule\Views\Signet\Index.js" /> | |||
@@ -7963,6 +7964,7 @@ | |||
<Content Include="Areas\EducationalAdministration\Views\OpenLessonPlanOfElective\FormBatch.cshtml" /> | |||
<Content Include="Areas\EducationalAdministration\Views\StuScore\AllStuScoreQueryPrint.cshtml" /> | |||
<Content Include="Areas\LR_Desktop\Views\LoginStatistics\Index.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" /> | |||
@@ -248,6 +248,16 @@ 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_Encode { get; set; } | |||
} | |||
@@ -60,6 +60,25 @@ namespace Learun.Application.OA | |||
} | |||
} | |||
public void SaveNewsShouldRead() | |||
{ | |||
try | |||
{ | |||
noticeService.SaveNewsShouldRead(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 公告实体 | |||
/// </summary> | |||
@@ -55,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,7 +1,9 @@ | |||
using Learun.DataBase.Repository; | |||
using Dapper; | |||
using Learun.DataBase.Repository; | |||
using Learun.Util; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Data; | |||
using System.Text; | |||
namespace Learun.Application.OA | |||
@@ -57,14 +59,40 @@ namespace Learun.Application.OA | |||
{ | |||
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); | |||
var sql = new StringBuilder(@"select t.*,u.f_encode,u.f_realname,f_departmentid from ( | |||
select t1.ruserid,isnull(srnum,0) as srnum,isnull(rnum,0) as rnum from ( | |||
select ruserid,COUNT(1) as srnum from LR_OA_News t left join LR_OA_NewsShouldRead s on s.newsid=t.f_newsid | |||
WHERE t.F_TypeId = 2 and t.F_DeleteMark=0 and t.F_EnabledMark=1 group by ruserid | |||
) t1 | |||
left join ( | |||
select ruserid,COUNT(1) as rnum from LR_OA_News t left join LR_OA_NewsRead r on r.newsid=t.f_newsid | |||
WHERE t.F_TypeId = 2 and t.F_DeleteMark=0 and t.F_EnabledMark=1 and DATEDIFF(HOUR,t.F_ReleaseTime,r.RTime)<=24*7 group by ruserid | |||
) t2 on t1.ruserid=t2.ruserid | |||
) t | |||
left join lr_base_user u on t.ruserid=u.f_userid where 1=1 | |||
"); | |||
var queryParam = queryJson.ToJObject(); | |||
// 虚拟参数 | |||
var dp = new DynamicParameters(new { }); | |||
if (queryParam.HasValues) | |||
{ | |||
if (!queryParam["F_Encode"].IsEmpty()) | |||
{ | |||
dp.Add("F_Encode", "%" + queryParam["F_Encode"].ToString() + "%", DbType.String); | |||
sql.Append(" AND u.f_encode like @F_Encode "); | |||
} | |||
if (!queryParam["F_RealName"].IsEmpty()) | |||
{ | |||
dp.Add("F_RealName", "%" + queryParam["F_RealName"].ToString() + "%", DbType.String); | |||
sql.Append(" AND u.f_realname like @F_RealName "); | |||
} | |||
if (!queryParam["F_Departmentid"].IsEmpty()) | |||
{ | |||
dp.Add("F_Departmentid", queryParam["F_Departmentid"].ToString(), DbType.String); | |||
sql.Append(" AND f_departmentid like @F_Departmentid "); | |||
} | |||
} | |||
var list = this.BaseRepository().FindList<NewsEntity>(sql.ToString(), pagination); | |||
return list; | |||
} | |||
@@ -90,19 +118,17 @@ namespace Learun.Application.OA | |||
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])"; | |||
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_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 ( | |||
@@ -126,22 +152,31 @@ SELECT ruserid from [dbo].[LR_OA_NewsShouldRead] where newsid='{news.F_NewsId}' | |||
{ | |||
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 | |||
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='{postids}' | |||
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) | |||
{ | |||