@@ -922,9 +922,19 @@ namespace Learun.Application.Web.Areas.LR_NewWorkFlow.Controllers | |||
/// </summary> | |||
/// <param name="queryJson"></param> | |||
/// <returns></returns> | |||
public ActionResult GetStatisticCountData() | |||
public ActionResult GetStatisticCountData(string queryJson) | |||
{ | |||
var taskdata = nWFTaskIBLL.GetFinishTaskList(); | |||
if (!string.IsNullOrEmpty(queryJson)) | |||
{ | |||
var queryParam = queryJson.ToJObject(); | |||
if (!queryParam["year"].IsEmpty()) | |||
{ | |||
var year = queryParam["year"].ToInt(); | |||
taskdata = taskdata.Where(x => x.F_ModifyDate.HasValue && x.F_ModifyDate.Value.Year == year); | |||
} | |||
} | |||
var taskgroup = taskdata.GroupBy(x => new { x.F_ModifyUserId, x.F_ModifyUserName }).Select(x => new | |||
{ | |||
userId = x.Key.F_ModifyUserId, | |||
@@ -8,6 +8,14 @@ | |||
<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> | |||
@@ -1,24 +1,35 @@ | |||
| |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
var year = ""; | |||
var page = { | |||
init: function () { | |||
page.bind(); | |||
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(); | |||
}); | |||
}, | |||
initChart: function () { | |||
var myChart1 = echarts.init(document.getElementById('main')); | |||
learun.httpAsyncPost(top.$.rootUrl + "/LR_NewWorkFlow/NWFProcess/GetStatisticCountData", { }, function (res) { | |||
var queryJson = { year: year }; | |||
learun.httpAsyncPost(top.$.rootUrl + "/LR_NewWorkFlow/NWFProcess/GetStatisticCountData", { queryJson: JSON.stringify(queryJson)}, function (res) { | |||
if (res.code == 200) { | |||
var option1 = { | |||
title: { | |||
text: '审批次数分析图', | |||
text: year + '年流程审批次数分析图', | |||
x: 'center' | |||
}, | |||
tooltip: { | |||
@@ -52,6 +63,11 @@ var bootstrap = function ($, learun) { | |||
} | |||
}); | |||
}, | |||
search: function (param) { | |||
param = param || {}; | |||
param.year = year; | |||
page.initChart(); | |||
} | |||
}; | |||
page.init(); | |||
@@ -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> | |||
/// 采购报表 | |||
@@ -130,20 +131,20 @@ namespace Learun.Application.Web.Areas.LR_ReportModule.Controllers | |||
{ | |||
var usedata = wfSchemeIBLL.GetWfSchemeUseList(queryJson).ToList(); | |||
var data = usedata.GroupBy(x => new { x.F_Category ,x.F_Code}).Select(x => new | |||
var data = usedata.GroupBy(x => new { x.F_Category, x.F_Code }).Select(x => new | |||
{ | |||
category=x.Key.F_Category, | |||
code=x.Key.F_Code, | |||
category = x.Key.F_Category, | |||
code = x.Key.F_Code, | |||
name = x.Select(y => y.F_Name).FirstOrDefault(), | |||
kind=x.Select(y => y.F_Kind).FirstOrDefault(), | |||
kind = x.Select(y => y.F_Kind).FirstOrDefault(), | |||
total = x.Select(y => y.F_Id).Count() | |||
}).OrderByDescending(m=>m.total).ToList(); | |||
}).OrderByDescending(m => m.total).ToList(); | |||
return JsonResult(data); | |||
} | |||
/// <summary> | |||
/// 获取图表数据 | |||
/// 获取流程报表图表数据 | |||
/// </summary> | |||
/// <param name="queryJson"></param> | |||
/// <returns></returns> | |||
@@ -219,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 | |||
} | |||
} |
@@ -1,6 +1,6 @@ | |||
| |||
@{ | |||
ViewBag.Title = "流程报表"; | |||
ViewBag.Title = "流程使用报表"; | |||
Layout = "~/Views/Shared/_ReportTemplate.cshtml"; | |||
} | |||
@@ -25,10 +25,22 @@ | |||
initGrid: function () { | |||
$(".lr-layout-grid").height($(window).height() - 110); | |||
$('#gridtable').jfGrid({ | |||
url: top.$.rootUrl + '/LR_ReportModule/ReportTemplate/GetWfSchemeReportList', | |||
url: top.$.rootUrl + '/LR_ReportModule/ReportTemplate/GetNWFSchemeReportList', | |||
headData: [ | |||
{ name: "category", label: "分类", width: 100, align: "center" }, | |||
{ name: "name", label: "名称", width: 150, align: "center" }, | |||
{ 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) { | |||
@@ -39,7 +51,7 @@ | |||
} | |||
} | |||
}, | |||
{ name: "total", label: "次数", width: 200, align: "center" } | |||
{ name: "total", label: "次数", width: 200, align: "center", statistics: true } | |||
] | |||
}); | |||
page.search(); | |||
@@ -48,7 +60,7 @@ | |||
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/GetWfSchemeUseList", { queryJson: JSON.stringify(queryJson) }, function (res) { | |||
learun.httpAsyncPost(top.$.rootUrl + "/LR_ReportModule/ReportTemplate/GetNWFSchemeUseList", { queryJson: JSON.stringify(queryJson) }, function (res) { | |||
if (res.code == 200) { | |||
var option1 = { | |||
title: { | |||
@@ -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,12 @@ namespace Learun.Application.WorkFlow | |||
/// <returns></returns> | |||
[NotMapped] | |||
public string F_CreateUserName { get; set; } | |||
/// <summary> | |||
/// 流程主键 | |||
/// </summary> | |||
/// <returns></returns> | |||
[NotMapped] | |||
public string F_ProcessId { get; set; } | |||
#endregion | |||
} | |||
} |
@@ -467,5 +467,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 | |||
} | |||
} |