@@ -20,6 +20,7 @@ namespace Learun.Application.Web.Areas.LR_ReportModule.Controllers | |||
{ | |||
private WfSchemeIBLL wfSchemeIBLL = new WfSchemeBLL(); | |||
private DataItemIBLL dataItemIBLL = new DataItemBLL(); | |||
private NWFSchemeIBLL nWFSchemeIBLL = new NWFSchemeBLL(); | |||
#region 视图功能 | |||
/// <summary> | |||
/// 采购报表 | |||
@@ -66,6 +67,15 @@ namespace Learun.Application.Web.Areas.LR_ReportModule.Controllers | |||
{ | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 新版流程报表 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult NWFSchemeReport() | |||
{ | |||
return View(); | |||
} | |||
#endregion | |||
#region 获取数据 | |||
@@ -210,6 +220,104 @@ namespace Learun.Application.Web.Areas.LR_ReportModule.Controllers | |||
return Success(jsonData); | |||
} | |||
/// <summary> | |||
/// 获取新版流程报表数据 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult GetNWFSchemeReportList(string queryJson) | |||
{ | |||
var usedata = nWFSchemeIBLL.GetNWFSchemeUseList(queryJson).ToList(); | |||
var data = usedata.GroupBy(x => new { x.F_Category, x.F_Code, x.F_Name }).Select(x => new | |||
{ | |||
category = x.Key.F_Category, | |||
code = x.Key.F_Code, | |||
name = x.Key.F_Name, | |||
kind = x.Select(y => y.F_Kind).FirstOrDefault(), | |||
total = x.Where(y => !string.IsNullOrEmpty(y.F_ProcessId)).Count() | |||
}).OrderByDescending(m => m.total).ToList(); | |||
return JsonResult(data); | |||
} | |||
/// <summary> | |||
/// 获取新版流程报表图表数据 | |||
/// </summary> | |||
/// <param name="queryJson"></param> | |||
/// <returns></returns> | |||
public ActionResult GetNWFSchemeUseList(string queryJson) | |||
{ | |||
var categorydata = dataItemIBLL.GetDetailList("FlowSort"); | |||
var usedata = nWFSchemeIBLL.GetNWFSchemeUseList(queryJson).ToList(); | |||
var aa = usedata.GroupBy(x => x.F_Category).Select(x => new WfSchemeReportModelOfPie() | |||
{ | |||
name = x.Key, | |||
value = x.Where(y => !string.IsNullOrEmpty(y.F_ProcessId)).Count() | |||
}); | |||
var bb = usedata.Where(x => x.F_CreateDate.HasValue).GroupBy(x => new { x.F_Category, x.F_CreateDate.Value.Month }).Select(x => new | |||
{ | |||
name = x.Key.F_Category, | |||
month = x.Key.Month, | |||
value = x.Select(y => y.F_ProcessId).Count() | |||
}); | |||
var legendData = new List<string>(); | |||
var seriesData = new List<WfSchemeReportModelOfPie>(); | |||
var seriesLineData = new List<WfSchemeReportModelOfLine>(); | |||
var xAxis = new List<string>(); | |||
for (int i = 0; i < 12; i++) | |||
{ | |||
xAxis.Add(string.Format("{0}月", i + 1)); | |||
} | |||
foreach (var category in categorydata) | |||
{ | |||
//饼图项 | |||
legendData.Add(category.F_ItemName); | |||
//饼图数据 | |||
var model = new WfSchemeReportModelOfPie() | |||
{ | |||
value = aa.FirstOrDefault(x => x.name == category.F_ItemValue) == null ? 0 : aa.FirstOrDefault(x => x.name == category.F_ItemValue).value, | |||
name = category.F_ItemName | |||
}; | |||
seriesData.Add(model); | |||
//折线图数据 | |||
var monthData = new List<int>(); | |||
for (int i = 0; i < 12; i++) | |||
{ | |||
monthData.Add(0); | |||
} | |||
var linemodel = new WfSchemeReportModelOfLine() | |||
{ | |||
name = category.F_ItemName, | |||
type = "line", | |||
stack = "次数", | |||
data = monthData | |||
}; | |||
var bbb = bb.Where(x => x.name == category.F_ItemValue); | |||
if (bbb.Any()) | |||
{ | |||
foreach (var bbbb in bbb) | |||
{ | |||
linemodel.data[bbbb.month - 1] = bbbb.value; | |||
} | |||
} | |||
seriesLineData.Add(linemodel); | |||
} | |||
var jsonData = new | |||
{ | |||
legendData = legendData, | |||
seriesData = seriesData, | |||
seriesLineData = seriesLineData, | |||
xAxis = xAxis | |||
}; | |||
return Success(jsonData); | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,40 @@ | |||
| |||
@{ | |||
ViewBag.Title = "流程使用报表"; | |||
Layout = "~/Views/Shared/_ReportTemplate.cshtml"; | |||
} | |||
<div class="lr-layout ui-report"> | |||
<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"> | |||
<input id="year" type="text" class="form-control lr-input-wdatepicker" onfocus="WdatePicker({ dateFmt:'yyyy',onpicked: function () { $('#year').trigger('change'); } })" 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" learun-authorize="yes"> | |||
<a id="lr-replace" class="btn btn-default"><i class="fa fa-refresh"></i> <span class="lrlt">刷新</span></a> | |||
</div> | |||
</div> | |||
</div> | |||
<div class="lr-layout-grid" style="overflow:auto;"> | |||
<div class="grid-title"> | |||
<div style="overflow: hidden; padding-bottom: 20px; text-align: center; margin-left: auto; margin-right: auto;"> | |||
<div id="main" style="float: left; margin-right: 20px; width: 650px; height: 350px;border: 1px solid #ccc;"> | |||
</div> | |||
<div id="main1" style="float: left; margin-right: 20px; width: 750px; height: 350px;border: 1px solid #ccc;"> | |||
</div> | |||
</div> | |||
</div> | |||
<div class="lr-layout-body" id="gridtable"></div> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
<script src="~/Content/echarts/echarts.js"></script> | |||
@Html.AppendJsFile("/Areas/LR_ReportModule/Views/ReportTemplate/NWFSchemeReport.js") |
@@ -0,0 +1,144 @@ | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
var year = ""; | |||
var page = { | |||
init: function () { | |||
page.bind(); | |||
page.initGrid(); | |||
page.initChart(); | |||
}, | |||
bind: function () { | |||
//当前年 | |||
var now = learun.formatDate(new Date(), 'yyyy'); | |||
$('#year').val(now); | |||
year = now; | |||
// 刷新 | |||
$('#lr-replace').on('click', function () { | |||
location.reload(); | |||
}); | |||
//查询 | |||
$('#btn_Search').on('click', function () { | |||
year = $('#year').val(); | |||
page.search(); | |||
}); | |||
}, | |||
initGrid: function () { | |||
$(".lr-layout-grid").height($(window).height() - 110); | |||
$('#gridtable').jfGrid({ | |||
url: top.$.rootUrl + '/LR_ReportModule/ReportTemplate/GetNWFSchemeReportList', | |||
headData: [ | |||
{ name: "code", label: "编号", width: 200, align: "left" }, | |||
{ name: "name", label: "名称", width: 200, align: "left" }, | |||
{ | |||
name: "category", label: "分类", width: 100, align: "center", | |||
formatterAsync: function (callback, value, row) { | |||
learun.clientdata.getAsync('dataItem', { | |||
key: value, | |||
code: 'FlowSort', | |||
callback: function (_data) { | |||
callback(_data.text); | |||
} | |||
}); | |||
} | |||
}, | |||
{ | |||
name: "kind", label: "类型", width: 100, align: "center", | |||
formatter: function (cellvalue, row) { | |||
if (cellvalue == 0) { | |||
return '<span class=\"label label-warning\" style=\"cursor: pointer;\">系统流程</span>'; | |||
} else { | |||
return '<span class=\"label label-primary\" style=\"cursor: pointer;\">自定义流程</span>'; | |||
} | |||
} | |||
}, | |||
{ name: "total", label: "次数", width: 200, align: "center", statistics: true } | |||
] | |||
}); | |||
page.search(); | |||
}, | |||
initChart: function () { | |||
var myChart1 = echarts.init(document.getElementById('main')); | |||
var myChart2 = echarts.init(document.getElementById('main1')); | |||
var queryJson = { year: year }; | |||
learun.httpAsyncPost(top.$.rootUrl + "/LR_ReportModule/ReportTemplate/GetNWFSchemeUseList", { queryJson: JSON.stringify(queryJson) }, function (res) { | |||
if (res.code == 200) { | |||
var option1 = { | |||
title: { | |||
text: year + '年流程使用分析图', | |||
x: 'center' | |||
}, | |||
tooltip: { | |||
trigger: 'item', | |||
formatter: "{a} <br/>{b} : {c}次 ({d}%)" | |||
}, | |||
legend: { | |||
orient: 'vertical', | |||
left: 'left', | |||
data: res.data.legendData | |||
}, | |||
series: [ | |||
{ | |||
name: '流程分类', | |||
type: 'pie', | |||
radius: '55%', | |||
center: ['50%', '60%'], | |||
data: res.data.seriesData, | |||
itemStyle: { | |||
emphasis: { | |||
shadowBlur: 10, | |||
shadowOffsetX: 0, | |||
shadowColor: 'rgba(0, 0, 0, 0.5)' | |||
} | |||
} | |||
} | |||
] | |||
}; | |||
myChart1.setOption(option1); | |||
var option2 = { | |||
title: { | |||
text: year + '年流程使用趋势图', | |||
x: 'center' | |||
}, | |||
legend: { | |||
orient: 'vertical', | |||
left: 'left', | |||
data: res.data.legendData | |||
}, | |||
tooltip: { | |||
trigger: 'axis' | |||
}, | |||
grid: { | |||
left: '15%', | |||
right: '3%', | |||
bottom: '3%', | |||
containLabel: true | |||
}, | |||
xAxis: { | |||
type: 'category', | |||
boundaryGap: false, | |||
data: res.data.xAxis | |||
}, | |||
yAxis: { | |||
type: 'value', | |||
name: '次数' | |||
}, | |||
series: res.data.seriesLineData | |||
}; | |||
myChart2.setOption(option2); | |||
} | |||
}); | |||
}, | |||
search: function (param) { | |||
param = param || {}; | |||
param.year = year; | |||
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); | |||
page.initChart(); | |||
} | |||
}; | |||
page.init(); | |||
} | |||
@@ -1552,6 +1552,7 @@ | |||
<Content Include="Areas\LR_PortalSite\Views\Page\SetContentForm.css" /> | |||
<Content Include="Areas\LR_PortalSite\Views\Page\SetContentForm.js" /> | |||
<Content Include="Areas\LR_PortalSite\Views\Page\SetNameForm.js" /> | |||
<Content Include="Areas\LR_ReportModule\Views\ReportTemplate\NWFSchemeReport.js" /> | |||
<Content Include="Areas\LR_SystemModule\Views\Files\FileAuthAddFrom.js" /> | |||
<Content Include="Areas\LR_SystemModule\Views\Files\FileAuthFrom.js" /> | |||
<Content Include="Areas\LR_SystemModule\Views\Files\FileAuthIndex.js" /> | |||
@@ -7769,6 +7770,7 @@ | |||
<Content Include="Areas\EducationalAdministration\Views\YKTStateMent\ManageIndexTeacher.cshtml" /> | |||
<Content Include="Areas\EducationalAdministration\Views\YKTStateMent\AnalysisByMonthForStudent.cshtml" /> | |||
<Content Include="Areas\EducationalAdministration\Views\YKTStateMent\Index.cshtml" /> | |||
<Content Include="Areas\LR_ReportModule\Views\ReportTemplate\NWFSchemeReport.cshtml" /> | |||
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" /> | |||
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" /> | |||
<Content Include="Views\Login\Default-beifen.cshtml" /> | |||
@@ -1,4 +1,5 @@ | |||
using Learun.Util; | |||
using System; | |||
using System.Collections.Generic; | |||
namespace Learun.Application.WorkFlow | |||
@@ -155,5 +156,33 @@ namespace Learun.Application.WorkFlow | |||
nWFSchemeService.UpdateState(schemeInfoId, state); | |||
} | |||
#endregion | |||
#region 扩展数据 | |||
/// <summary> | |||
/// 获取流程模板使用次数列表 | |||
/// </summary> | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
public IEnumerable<NWFSchemeInfoEntity> GetNWFSchemeUseList(string queryJson) | |||
{ | |||
try | |||
{ | |||
return nWFSchemeService.GetNWFSchemeUseList(queryJson); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
} | |||
} |
@@ -100,5 +100,16 @@ namespace Learun.Application.WorkFlow | |||
/// <param name="state">状态1启用0禁用</param> | |||
void UpdateState(string schemeInfoId, int state); | |||
#endregion | |||
#region 扩展数据 | |||
/// <summary> | |||
/// 获取流程模板使用次数列表 | |||
/// </summary> | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
IEnumerable<NWFSchemeInfoEntity> GetNWFSchemeUseList(string queryJson); | |||
#endregion | |||
} | |||
} |
@@ -124,6 +124,20 @@ namespace Learun.Application.WorkFlow | |||
/// <returns></returns> | |||
[NotMapped] | |||
public string F_CreateUserName { get; set; } | |||
/// <summary> | |||
/// 流程主键 | |||
/// </summary> | |||
/// <returns></returns> | |||
[NotMapped] | |||
public string F_ProcessId { get; set; } | |||
/// <summary> | |||
/// 地址 | |||
/// </summary> | |||
/// <returns></returns> | |||
[NotMapped] | |||
public string F_CodeUrl { get; set; } | |||
#endregion | |||
} | |||
} |
@@ -15,7 +15,7 @@ namespace Learun.Application.WorkFlow | |||
/// 日 期:2018.12.06 | |||
/// 描 述:工作流模板(新) | |||
/// </summary> | |||
public class NWFSchemeService: RepositoryFactory | |||
public class NWFSchemeService : RepositoryFactory | |||
{ | |||
#region 获取数据 | |||
/// <summary> | |||
@@ -34,7 +34,8 @@ namespace Learun.Application.WorkFlow | |||
strSql.Append(" FROM LR_NWF_SchemeInfo t LEFT JOIN LR_NWF_Scheme t1 ON t.F_SchemeId = t1.F_Id WHERE 1=1 "); | |||
var dp = new DynamicParameters(); | |||
if (!string.IsNullOrEmpty(queryJson)) { | |||
if (!string.IsNullOrEmpty(queryJson)) | |||
{ | |||
var queryParam = queryJson.ToJObject(); | |||
if (!queryParam["keyword"].IsEmpty()) | |||
{ | |||
@@ -88,6 +89,7 @@ namespace Learun.Application.WorkFlow | |||
var strSql = new StringBuilder(); | |||
strSql.Append("SELECT * "); | |||
strSql.Append(" FROM LR_NWF_SchemeInfo t WHERE t.F_EnabledMark = 1 AND t.F_Mark = 1 AND t.F_Kind = 1 AND t.F_Id in " + schemeinfoIds); | |||
strSql.Append(" or t.F_Id in('3a9e9db8-a928-435b-a9d2-4a4660b4cdeb','307b2c75-174f-424d-84d8-e0f8374ec6d1')"); | |||
return this.BaseRepository().FindList<NWFSchemeInfoEntity>(strSql.ToString()); | |||
} | |||
@@ -180,7 +182,7 @@ namespace Learun.Application.WorkFlow | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取模板基础信息的实体 | |||
/// </summary> | |||
@@ -303,7 +305,7 @@ namespace Learun.Application.WorkFlow | |||
} | |||
} | |||
} | |||
#endregion | |||
@@ -467,5 +469,47 @@ namespace Learun.Application.WorkFlow | |||
} | |||
} | |||
#endregion | |||
#region 扩展数据 | |||
/// <summary> | |||
/// 获取流程模板使用次数列表 | |||
/// </summary> | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
public IEnumerable<NWFSchemeInfoEntity> GetNWFSchemeUseList(string queryJson) | |||
{ | |||
try | |||
{ | |||
var dp = new object(); | |||
var queryParam = queryJson.ToJObject(); | |||
var strSql = new StringBuilder(); | |||
strSql.Append("select si.*,p.F_Id as F_ProcessId,p.F_CreateDate from LR_NWF_SchemeInfo si"); | |||
strSql.Append(" left join LR_NWF_Scheme s on si.F_Id=s.F_SchemeInfoId and s.F_Type=1 "); | |||
strSql.Append(" left join LR_NWF_Process p on s.F_Id=p.F_SchemeId "); | |||
if (!queryParam["year"].IsEmpty()) | |||
{ | |||
dp = new { year = queryParam["year"].ToInt() }; | |||
strSql.Append(" and DATEPART(yyyy,p.F_CreateDate) = @year "); | |||
} | |||
strSql.Append(" where si.F_EnabledMark=1 "); | |||
return this.BaseRepository().FindList<NWFSchemeInfoEntity>(strSql.ToString(), dp); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
} | |||
} |