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/Areas/LogisticsManagement/Controllers/AccommodationController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/AccommodationController.cs index 5dd7d85e7..24e3ad8cf 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/AccommodationController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/AccommodationController.cs @@ -463,7 +463,12 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers public ActionResult SaveRoom(string RoomId, List list) { //List list = strEntity.ToObject>(); - accommodationIBLL.SaveRoom(RoomId, list); + string res = accommodationIBLL.SaveRoom(RoomId, list); + if (!string.IsNullOrEmpty(res)) + { + return Fail(res); + } + return Success("保存成功!"); } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormRoom.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormRoom.js index edc8a2238..be042398a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormRoom.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormRoom.js @@ -18,7 +18,7 @@ var bootstrap = function ($, learun) { page.initData(); }, bind: function () { - + }, initData: function () { if (!!keyValue) { @@ -51,16 +51,16 @@ var bootstrap = function ($, learun) { value: "stuno", text: "stuname", url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable', - param: { code: "StuInfoBasic", strWhere: strWhere }, + param: { code: "StuInfoBasic", strWhere: strWhere }, // 是否允许搜索 allowSearch: true, select: function (item) { - // console.log(item); + // console.log(item); var stuid = ''; if (item) { stuid = item.stuno; - } + } var id = $(this).attr('id'); //console.log('id', id); //console.log('item',item); @@ -78,9 +78,9 @@ var bootstrap = function ($, learun) { //arr.push({ ID: data[i].ID, StudentID: data[i].StudentID }); } - - - + + + }); } }, @@ -93,8 +93,14 @@ var bootstrap = function ($, learun) { //var postData = { // strEntity: JSON.stringify($('body').lrGetFormData()) //}; - //console.log('arr',arr); - + //console.log('arr', arr); + for (var i = 0; i < arr.length - 1; i++) { + for (var j = i + 1; j < arr.length; j++) { + if (!!arr[i].StudentID && arr[i].StudentID === arr[j].StudentID) { + return learun.alert.warning('学生不可重复!'); + } + } + } var postData = { list: arr }; 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 0a4e53fd2..612e4c23b 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 @@ -1492,6 +1492,7 @@ + @@ -7630,6 +7631,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); } /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationBLL.cs index d63fd9665..dcba8bb27 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationBLL.cs @@ -681,11 +681,11 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } - public void SaveRoom(string RoomId, List list) + public string SaveRoom(string RoomId, List list) { try { - accommodationService.SaveRoom(RoomId, list); + return accommodationService.SaveRoom(RoomId, list); } catch (Exception ex) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationIBLL.cs index 0f72b5a99..09ccf1e2c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationIBLL.cs @@ -83,7 +83,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement void SaveEntity(string keyValue, Acc_DormitoryBuildEntity entity); void SaveBedEntity(string keyValue,string ParentID, Acc_DormitoryBuildEntity entity); void SaveDeptClass(string keyValue, Acc_DormitoryBuildEntity entity,int type); - void SaveRoom(string RoomId, List list); + string SaveRoom(string RoomId, List list); /// /// 批量添加单元、楼层、房间、床位 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs index b2508a78b..b184d56f2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs @@ -1721,13 +1721,25 @@ where ID='{ParentID}' /// /// /// - public void SaveRoom(string RoomId, List list) + public string SaveRoom(string RoomId, List list) { var db = this.BaseRepository("CollegeMIS").BeginTrans(); try { foreach (var entity in list) { + //判断该学生是否已分配 + if (!string.IsNullOrEmpty(entity.StudentID)) + { + var count = db.FindList().Count(x => x.StudentID == entity.StudentID && x.ID != entity.ID); + if (count > 0) + { + var stuname = db.FindEntity(x => x.StuNo == entity.StudentID)?.StuName; + return "学生" + stuname + "已分配床位,不可重复分配!"; + } + } + + //分配床位 string sql = $"update Acc_DormitoryBuild set StudentID='{entity.StudentID}' where ID='{entity.ID}'"; db.ExecuteBySql(sql); } @@ -1737,6 +1749,7 @@ where ID='{ParentID}' db.ExecuteBySql(checkInSql); db.Commit(); + return ""; } catch (Exception ex) {