diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Controllers/NWFProcessController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Controllers/NWFProcessController.cs index f15262608..52935e0b5 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Controllers/NWFProcessController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Controllers/NWFProcessController.cs @@ -904,9 +904,19 @@ namespace Learun.Application.Web.Areas.LR_NewWorkFlow.Controllers /// /// /// - 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, diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/StatisticCountIndex.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/StatisticCountIndex.cshtml index 9091bb698..4f0c13b80 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/StatisticCountIndex.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/StatisticCountIndex.cshtml @@ -8,6 +8,14 @@
+
+
+ +
+
+  查询 +
+
 刷新 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/StatisticCountIndex.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/StatisticCountIndex.js index b4c612e15..a024e7b27 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/StatisticCountIndex.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/StatisticCountIndex.js @@ -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(); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_ReportModule/Controllers/ReportTemplateController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_ReportModule/Controllers/ReportTemplateController.cs index 808b6229f..e75ab8052 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_ReportModule/Controllers/ReportTemplateController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_ReportModule/Controllers/ReportTemplateController.cs @@ -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 视图功能 /// /// 采购报表 @@ -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); } - + /// - /// 获取图表数据 + /// 获取流程报表图表数据 /// /// /// @@ -219,6 +220,104 @@ namespace Learun.Application.Web.Areas.LR_ReportModule.Controllers return Success(jsonData); } + /// + /// 获取新版流程报表数据 + /// + /// + [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); + } + + /// + /// 获取新版流程报表图表数据 + /// + /// + /// + 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(); + var seriesData = new List(); + var seriesLineData = new List(); + var xAxis = new List(); + 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(); + 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 } } \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_ReportModule/Views/ReportTemplate/NWFSchemeReport.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_ReportModule/Views/ReportTemplate/NWFSchemeReport.cshtml index 48b030ba6..555dcbbc0 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_ReportModule/Views/ReportTemplate/NWFSchemeReport.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_ReportModule/Views/ReportTemplate/NWFSchemeReport.cshtml @@ -1,6 +1,6 @@  @{ - ViewBag.Title = "流程报表"; + ViewBag.Title = "流程使用报表"; Layout = "~/Views/Shared/_ReportTemplate.cshtml"; } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_ReportModule/Views/ReportTemplate/NWFSchemeReport.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_ReportModule/Views/ReportTemplate/NWFSchemeReport.js index f6c35eab3..8e7beb60f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_ReportModule/Views/ReportTemplate/NWFSchemeReport.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_ReportModule/Views/ReportTemplate/NWFSchemeReport.js @@ -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: { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeBLL.cs index 10de37fca..e7923f095 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeBLL.cs @@ -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 扩展数据 + + /// + /// 获取流程模板使用次数列表 + /// + /// 查询参数 + /// + public IEnumerable GetNWFSchemeUseList(string queryJson) + { + try + { + return nWFSchemeService.GetNWFSchemeUseList(queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + #endregion } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeIBLL.cs index 8309a9bdd..6eef9c9b8 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeIBLL.cs @@ -100,5 +100,16 @@ namespace Learun.Application.WorkFlow /// 状态1启用0禁用 void UpdateState(string schemeInfoId, int state); #endregion + + #region 扩展数据 + + /// + /// 获取流程模板使用次数列表 + /// + /// 查询参数 + /// + IEnumerable GetNWFSchemeUseList(string queryJson); + + #endregion } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeInfoEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeInfoEntity.cs index e65ad98c5..862314f82 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeInfoEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeInfoEntity.cs @@ -124,6 +124,12 @@ namespace Learun.Application.WorkFlow /// [NotMapped] public string F_CreateUserName { get; set; } + /// + /// 流程主键 + /// + /// + [NotMapped] + public string F_ProcessId { get; set; } #endregion } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeService.cs index 814391f84..cd894a226 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Scheme/NWFSchemeService.cs @@ -467,5 +467,47 @@ namespace Learun.Application.WorkFlow } } #endregion + + + #region 扩展数据 + + /// + /// 获取流程模板使用次数列表 + /// + /// 查询参数 + /// + public IEnumerable 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(strSql.ToString(), dp); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + #endregion } }