diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Controllers/ResourceFileController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Controllers/ResourceFileController.cs index 1fc7ea82c..41d34382f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Controllers/ResourceFileController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Controllers/ResourceFileController.cs @@ -83,6 +83,15 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers { return View(); } + /// + /// 云盘文件统计 + /// + /// + [HttpGet] + public ActionResult FileStatistic() + { + return View(); + } #endregion #region 获取数据 @@ -204,6 +213,42 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers var data = fileInfoBLL.GetEntity(keyValue); return JsonResult(data); } + /// + /// 获取云盘文件统计数据 + /// + /// + /// + public ActionResult GetFileStatisitcData(string queryJson) + { + var data = fileInfoBLL.GetListByJson(queryJson); + var dataGroup = data.Where(x => x.F_CreateDate.HasValue).GroupBy(x => x.F_CreateDate.Value.Month).Select(x => new TempClass() + { + month=x.Key, + count = x.Select(y=>y.F_FileId).Count() + }); + + var xAxis = new List(); + var seriesData = new List(); + for (int i = 0; i < 12; i++) + { + xAxis.Add(string.Format("{0}月", i + 1)); + var aa = dataGroup.FirstOrDefault(x => x.month == (i + 1)); + seriesData.Add(aa == null ? 0 : aa.count); + } + + var jsonData = new + { + seriesData = seriesData, + xAxis = xAxis + }; + + return Success(jsonData); + } + public class TempClass { + public int month { get; set; } + public int count { get; set; } + } + #endregion #region 提交数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/ResourceFile/FileStatistic.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/ResourceFile/FileStatistic.cshtml new file mode 100644 index 000000000..05248285b --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/ResourceFile/FileStatistic.cshtml @@ -0,0 +1,37 @@ + +@{ + ViewBag.Title = "流程使用报表"; + Layout = "~/Views/Shared/_ReportTemplate.cshtml"; +} + +
+
+
+
+
+
+ +
+
+  查询 +
+
+
+
+  刷新 +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +@Html.AppendJsFile("/Areas/LR_OAModule/Views/ResourceFile/FileStatistic.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/ResourceFile/FileStatistic.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/ResourceFile/FileStatistic.js new file mode 100644 index 000000000..8e2380daa --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/ResourceFile/FileStatistic.js @@ -0,0 +1,79 @@ +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')); + var queryJson = { year: year }; + learun.httpAsyncPost(top.$.rootUrl + "/LR_OAModule/ResourceFile/GetFileStatisitcData", { queryJson: JSON.stringify(queryJson) }, function (res) { + if (res.code == 200) { + var option1 = { + title: { + text: year + '年云盘文件统计图', + x: 'center' + }, + legend: { + orient: 'vertical', + left: 'left', + data: ['数量'] + }, + tooltip: { + trigger: 'axis' + }, + grid: { + left: '5%', + right: '3%', + bottom: '3%', + containLabel: true + }, + xAxis: { + type: 'category', + data: res.data.xAxis + }, + yAxis: { + type: 'value', + name: '文件数/个' + + }, + series: [ + { + name: '数量', + type: 'bar', + data: res.data.seriesData + } + ] + }; + myChart1.setOption(option1); + } + }); + + }, + search: function (param) { + param = param || {}; + param.year = year; + page.initChart(); + } + }; + page.init(); +} + + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj index 6713a49cf..2b9b31c33 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj @@ -1490,6 +1490,7 @@ + @@ -7628,6 +7629,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoBLL.cs index fa1010940..1f199ff9b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoBLL.cs @@ -33,6 +33,10 @@ namespace Learun.Application.OA.File.FileInfo { return service.GetList(); } + public IEnumerable GetListByJson(string queryJson) + { + return service.GetListByJson(queryJson); + } /// /// 文档列表 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoIBLL.cs index a717529c8..df2d8f347 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoIBLL.cs @@ -22,6 +22,7 @@ namespace Learun.Application.OA.File.FileInfo IEnumerable GetList(string userId); IEnumerable GetList(); + IEnumerable GetListByJson(string queryJson); /// /// 文档列表 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoService.cs index 27aad6bf0..f038d9021 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoService.cs @@ -1,4 +1,5 @@ using Learun.DataBase.Repository; +using Learun.Util; using System; using System.Collections.Generic; using System.Data.Common; @@ -24,7 +25,25 @@ namespace Learun.Application.OA.File.FileInfo public IEnumerable GetList() { string sql = "select * from LR_OA_FileInfo where F_DeleteMark = 0"; - return this.BaseRepository().FindList(); + return this.BaseRepository().FindList(sql); + } + public IEnumerable GetListByJson(string queryJson) + { + var dp = new object(); + var queryParam = queryJson.ToJObject(); + var strSql = new StringBuilder(); + strSql.Append("select * from LR_OA_FileInfo where F_DeleteMark = 0 "); + if (!queryParam["year"].IsEmpty()) + { + dp = new { year = queryParam["year"].ToInt() }; + strSql.Append(" and DATEPART(yyyy,F_CreateDate) = @year "); + } + else + { + dp = new { year = DateTime.Now.Year }; + strSql.Append(" and DATEPART(yyyy,F_CreateDate) = @year "); + } + return this.BaseRepository().FindList(strSql.ToString(),dp); } ///