From cd3ac4bd5d39297d17569aa1df202f41588e97d0 Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Fri, 11 Mar 2022 16:38:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=BD=92=E5=AE=BF=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/DormitoryReturnController.cs | 84 ++++++++++- .../Views/DormitoryReturn/IndexReport.cshtml | 49 +++++++ .../Views/DormitoryReturn/IndexReport.js | 131 ++++++++++++++++++ .../Learun.Application.Web.csproj | 2 + .../Accommodation/Acc_DormitoryBuildEntity.cs | 7 + .../Accommodation/AccommodationBLL.cs | 73 ++++++++-- .../Accommodation/AccommodationIBLL.cs | 3 + .../Accommodation/AccommodationService.cs | 37 +++++ .../DormitoryReturn/DormitoryReturnBLL.cs | 19 +++ .../DormitoryReturn/DormitoryReturnIBLL.cs | 1 + .../DormitoryReturn/DormitoryReturnService.cs | 45 ++++++ 11 files changed, 441 insertions(+), 10 deletions(-) create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/IndexReport.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/IndexReport.js diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/DormitoryReturnController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/DormitoryReturnController.cs index a56981cfc..10d1f7135 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/DormitoryReturnController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/DormitoryReturnController.cs @@ -3,6 +3,8 @@ using System.Data; using Learun.Application.TwoDevelopment.LogisticsManagement; using System.Web.Mvc; using System.Collections.Generic; +using System.Linq; +using System; namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers { @@ -16,6 +18,7 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers public class DormitoryReturnController : MvcControllerBase { private DormitoryReturnIBLL dormitoryReturnIBLL = new DormitoryReturnBLL(); + private AccommodationIBLL accommodationIBLL = new AccommodationBLL(); #region 视图功能 @@ -56,6 +59,16 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers { return View(); } + /// + /// 表单页 + /// + /// + [HttpGet] + public ActionResult IndexReport() + { + return View(); + } + #endregion #region 获取数据 @@ -107,6 +120,75 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers }; return Success(jsonData); } + /// + /// 获取下拉框数据 + /// + /// + [HttpGet] + public ActionResult GetDept() + { + var data = accommodationIBLL.GetDept(); + + return Success(data); + } + /// + /// 获取下拉框数据 + /// + /// + [HttpGet] + public ActionResult GetMajor(string strWhere) + { + var data = accommodationIBLL.GetMajor(strWhere); + + return Success(data); + } + /// + /// 获取下拉框数据 + /// + /// + [HttpGet] + public ActionResult GetClass(string strWhere) + { + var data = accommodationIBLL.GetClass(strWhere); + + return Success(data); + } + + [HttpGet] + public ActionResult GetReportList(string queryJson) + { + List data = dormitoryReturnIBLL.GetReportList(queryJson).ToList(); + var list = data.GroupBy(a => a.IsReturn).Select(a => new { a.Key, num = a.Count() }).ToList(); + List list2 = new List(); + foreach (var item in list) + { + var name = item.Key == 1 ? "已归宿" : "未归宿"; + list2.Add(new { name = name, value = item.num }); + + } + return JsonResult(list2); + } + + /// + /// + /// + /// + public ActionResult GetReportData(string queryJson) + { + List data = dormitoryReturnIBLL.GetReportList(queryJson).ToList(); + var list = data.GroupBy(a => a.IsReturn).Select(a => new { a.Key, num = a.Count() }).ToList(); + List list2 = new List(); + List list1 = new List(); + foreach (var item in list) + { + var name = item.Key == 1 ? "已归宿" : "未归宿"; + list2.Add(new { name = name, value = item.num }); + list1.Add(name); + + } + return Success(new { list1, list2 }); + } + #endregion #region 提交数据 @@ -155,7 +237,7 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers return Success("保存成功!"); } - + #endregion diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/IndexReport.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/IndexReport.cshtml new file mode 100644 index 000000000..0997a8d61 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/IndexReport.cshtml @@ -0,0 +1,49 @@ + +@{ + ViewBag.Title = "学生归宿统计"; + Layout = "~/Views/Shared/_ReportTemplate.cshtml"; +} + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  查询 +
+ +
+
+
+ @* 刷新*@ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +@Html.AppendJsFile("/Areas/LogisticsManagement/Views/DormitoryReturn/IndexReport.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/IndexReport.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/IndexReport.js new file mode 100644 index 000000000..7f8aec873 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/IndexReport.js @@ -0,0 +1,131 @@ +var bootstrap = function ($, learun) { + "use strict"; + var year = ""; + var page = { + init: function () { + page.bind(); + page.initGrid(); + page.initChart(); + }, + bind: function () { + $('#Dept').lrselect({ + width: '150px', + placeholder: "请选择系部", + allowSearch: true, + url: top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/GetDept', + value: 'Dept', + text: 'DeptName', + select: function (item) { + if (item) { + $('#Major').lrselectRefresh({ + url: top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/GetMajor', + param: { strWhere: "m.deptno='" + item.Dept + "'" } + }); + $('#Class').lrselectRefresh({ + //url: top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/GetClass', + //param: { strWhere: "c.majorno=''" } + }); + } + } + }); + $('#Major').lrselect({ + width: '150px', + placeholder: "请选择专业", + allowSearch: true, + //url: top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/GetMajor', + value: 'Major', + text: 'MajorName', + select: function (item) { + if (item) { + $('#Class').lrselectRefresh({ + url: top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/GetClass', + param: { strWhere: "c.majorno='" + item.Major + "'" } + }); + } + } + }); + $('#Class').lrselect({ + width: '150px', + placeholder: "请选择班级", + allowSearch: true, + value: 'Class', + text: 'ClassName' + }); + + //查询 + $('#btn_Search').on('click', function () { + page.search({ Dept: $('#Dept').lrselectGet(), Major: $('#Major').lrselectGet(), Class: $('#Class').lrselectGet() }); + }); + + }, + initGrid: function () { + $(".lr-layout-grid").height($(window).height() - 110); + $('#gridtable').jfGrid({ + url: top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/GetReportList', + headData: [ + { name: "name", label: "状态", width: 100, align: "center" }, + { name: "value", label: "人数", width: 150, align: "center" } + + ] + }); + page.search(); + }, + initChart: function (queryJson) { + var myChart1 = echarts.init(document.getElementById('main')); + //var myChart2 = echarts.init(document.getElementById('main1')); + queryJson = { + Dept: $('#Dept').lrselectGet(), + Major: $('#Major').lrselectGet(), + Class: $('#Class').lrselectGet() + }; + //console.log('queryJson', queryJson); + learun.httpAsyncPost(top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/GetReportData', { queryJson: JSON.stringify(queryJson) }, function (res) { + if (res.code == 200) { + var option = { + title: { + text: '学生归宿统计', + x: 'center' + }, + tooltip: { + trigger: 'item', + formatter: "{a}
{b} : {c} ({d}%)" + }, + legend: { + orient: 'vertical', + left: 'left', + data: res.data.list1 + }, + series: [ + { + name: '学生归宿', + type: 'pie', + radius: '55%', + center: ['50%', '60%'], + data: res.data.list2, + itemStyle: { + emphasis: { + shadowBlur: 10, + shadowOffsetX: 0, + shadowColor: 'rgba(0, 0, 0, 0.5)' + } + } + } + ] + }; + + myChart1.setOption(option); + + } + }); + + }, + search: function (param) { + param = param || {}; + $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); + page.initChart(param); + } + }; + 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 02aaffd0c..b4692d004 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 @@ -1339,6 +1339,7 @@ + @@ -7648,6 +7649,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/Acc_DormitoryBuildEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/Acc_DormitoryBuildEntity.cs index e5bd4c356..0c0866c1e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/Acc_DormitoryBuildEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/Acc_DormitoryBuildEntity.cs @@ -220,6 +220,13 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement [NotMapped] public string bedId { get; set; } + + [NotMapped] + public string DeptName { get; set; } + [NotMapped] + public string MajorName { get; set; } + [NotMapped] + public string ClassName { get; set; } #endregion #region 扩展操作 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 dcba8bb27..41bda8acd 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 @@ -85,7 +85,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement { try { - return accommodationService.GetClassifyList(paginationobj,queryJson); + return accommodationService.GetClassifyList(paginationobj, queryJson); } catch (Exception ex) { @@ -311,6 +311,61 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } + public List GetDept() + { + try + { + return accommodationService.GetSelectData("").Select(x => new Acc_DormitoryBuildEntity { Dept = x.Dept, DeptName = x.DeptName }).Distinct().ToList(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + public List GetMajor(string strWhere) + { + try + { + return accommodationService.GetSelectData(strWhere).Select(x => new Acc_DormitoryBuildEntity { Major = x.Major, MajorName = x.MajorName }).Distinct().ToList(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + public List GetClass(string strWhere) + { + try + { + return accommodationService.GetSelectData(strWhere).Select(x => new Acc_DormitoryBuildEntity { Class = x.Class, ClassName = x.ClassName }).Distinct().ToList(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + /// /// 获取左侧树形数据 /// @@ -417,7 +472,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement checkstate = 0, isexpand = false, parentId = item.ParentID == null ? "" : item.ParentID, - title =string.IsNullOrEmpty(item.BuildType)?"":(Convert.ToInt32(item.BuildType)+1).ToString() , + title = string.IsNullOrEmpty(item.BuildType) ? "" : (Convert.ToInt32(item.BuildType) + 1).ToString(), }; @@ -487,7 +542,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } - /// + /// /// 根据父id 获取树形数据 /// /// @@ -532,11 +587,11 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } - public bool MatchDormitoryInfo(string stuNo,string dormitory,string unit,string floor,string room,string bed ,List data) + public bool MatchDormitoryInfo(string stuNo, string dormitory, string unit, string floor, string room, string bed, List data) { try { - return accommodationService.MatchDormitoryInfo(stuNo,dormitory,unit,floor,room,bed,data); + return accommodationService.MatchDormitoryInfo(stuNo, dormitory, unit, floor, room, bed, data); } catch (Exception ex) @@ -582,7 +637,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } - + /// /// 删除实体数据 /// 主键 @@ -636,7 +691,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement /// 主键 /// /// - public void SaveBedEntity(string keyValue,string ParentID, Acc_DormitoryBuildEntity entity) + public void SaveBedEntity(string keyValue, string ParentID, Acc_DormitoryBuildEntity entity) { try { @@ -655,14 +710,14 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } - + /// /// 分配系 /// /// /// - public void SaveDeptClass(string keyValue, Acc_DormitoryBuildEntity entity,int type) + public void SaveDeptClass(string keyValue, Acc_DormitoryBuildEntity entity, int type) { try { 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 09ccf1e2c..2050f1292 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 @@ -44,6 +44,9 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement /// /// List GetList(); + List GetDept(); + List GetMajor(string strWhere); + List GetClass(string strWhere); /// /// 获取左侧树形数据 /// 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 d03e72a74..996ada2f3 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 @@ -823,6 +823,43 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName } } + /// + /// 获取非空床的系部专业 班级 + /// + /// + public List GetSelectData(string strWhere) + { + try + { + string sql = + @"select distinct dept,d.DeptName,major,m.MajorName,class,c.ClassName from [dbo].[Acc_DormitoryBuild] t +join CdDept d on t.dept=d.deptno +join CdMajor m on t.major=m.majorno +join ClassInfo c on t.class=c.classno +where t.ID in ( +select parentid from [dbo].[Acc_DormitoryBuild] where BuildType='5' and (studentid is not null and len(studentid)>0) +)"; + if (!string.IsNullOrEmpty(strWhere)) + { + sql += " and " + strWhere; + } + + return this.BaseRepository("CollegeMIS").FindList(sql).ToList(); + + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + /// /// 获取树形数据(学生归宿) /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnBLL.cs index d3e715821..066f0b3e8 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnBLL.cs @@ -91,6 +91,25 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } + public IEnumerable GetReportList(string queryJson) + { + try + { + return dormitoryReturnService.GetReportList(queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + /// /// 获取Acc_DormitoryReturn表实体数据 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnIBLL.cs index 3cc1c7e5b..39401c7d1 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnIBLL.cs @@ -21,6 +21,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement /// 查询参数 /// IEnumerable GetPageList(Pagination pagination, string queryJson); + IEnumerable GetReportList(string queryJson); /// /// 获取Acc_DormitoryReturn表实体数据 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnService.cs index 43f4a6c61..66b235250 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnService.cs @@ -72,6 +72,51 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } + /// + /// 获取统计数据 + /// + /// + /// + public IEnumerable GetReportList(string queryJson) + { + try + { + string sql = @"select t.isreturn,a.Dept,a.Major,a.class from +( +select parentid,isreturn from [dbo].[Acc_DormitoryBuild] where BuildType='5' and (studentid is not null and len(studentid)>0) +) t +join Acc_DormitoryBuild a on a.ID=t.parentid where 1=1 +"; + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + if (!queryParam["Dept"].IsEmpty()) + { + sql += $" AND a.Dept = '{queryParam["Dept"].ToString()}'"; + } + if (!queryParam["Major"].IsEmpty()) + { + sql += $" AND a.Major = '{queryParam["Major"].ToString()}'"; + } + if (!queryParam["Class"].IsEmpty()) + { + sql += $" AND a.Class = '{queryParam["Class"].ToString()}'"; + } + return this.BaseRepository("CollegeMIS").FindList(sql); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + /// /// 获取Acc_DormitoryReturn表实体数据 ///