@@ -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(); | |||
} | |||
/// <summary> | |||
/// 表单页 | |||
/// <summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult IndexReport() | |||
{ | |||
return View(); | |||
} | |||
#endregion | |||
#region 获取数据 | |||
@@ -107,6 +120,75 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers | |||
}; | |||
return Success(jsonData); | |||
} | |||
/// <summary> | |||
/// 获取下拉框数据 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult GetDept() | |||
{ | |||
var data = accommodationIBLL.GetDept(); | |||
return Success(data); | |||
} | |||
/// <summary> | |||
/// 获取下拉框数据 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult GetMajor(string strWhere) | |||
{ | |||
var data = accommodationIBLL.GetMajor(strWhere); | |||
return Success(data); | |||
} | |||
/// <summary> | |||
/// 获取下拉框数据 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult GetClass(string strWhere) | |||
{ | |||
var data = accommodationIBLL.GetClass(strWhere); | |||
return Success(data); | |||
} | |||
[HttpGet] | |||
public ActionResult GetReportList(string queryJson) | |||
{ | |||
List<Acc_DormitoryBuildEntity> data = dormitoryReturnIBLL.GetReportList(queryJson).ToList(); | |||
var list = data.GroupBy(a => a.IsReturn).Select(a => new { a.Key, num = a.Count() }).ToList(); | |||
List<object> list2 = new List<object>(); | |||
foreach (var item in list) | |||
{ | |||
var name = item.Key == 1 ? "已归宿" : "未归宿"; | |||
list2.Add(new { name = name, value = item.num }); | |||
} | |||
return JsonResult(list2); | |||
} | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <returns></returns> | |||
public ActionResult GetReportData(string queryJson) | |||
{ | |||
List<Acc_DormitoryBuildEntity> data = dormitoryReturnIBLL.GetReportList(queryJson).ToList(); | |||
var list = data.GroupBy(a => a.IsReturn).Select(a => new { a.Key, num = a.Count() }).ToList(); | |||
List<object> list2 = new List<object>(); | |||
List<String> list1 = new List<String>(); | |||
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 | |||
@@ -0,0 +1,49 @@ | |||
| |||
@{ | |||
ViewBag.Title = "学生归宿统计"; | |||
Layout = "~/Views/Shared/_ReportTemplate.cshtml"; | |||
} | |||
<style> | |||
.lr-select { | |||
width: 150px; | |||
} | |||
</style> | |||
<div class="lr-layout ui-report"> | |||
<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"> | |||
<div id="Dept" type="lrselect" class="lr-select"></div> | |||
</div> | |||
<div class="lr-layout-tool-item"> | |||
<div id="Major" type="lrselect" class="lr-select"></div> | |||
</div> | |||
<div class="lr-layout-tool-item"> | |||
<div id="Class" type="lrselect" class="lr-select"></div> | |||
</div> | |||
<div class="lr-layout-tool-item"> | |||
<a id="btn_Search" class="btn btn-primary btn-sm"><i class="fa fa-search"></i> 查询</a> | |||
</div> | |||
</div> | |||
<div class="lr-layout-tool-right"> | |||
<div class="btn-group btn-group-sm"> | |||
@*<a id="lr-replace" class="btn btn-default"><i class="fa fa-refresh"></i> <span class="lrlt">刷新</span></a>*@ | |||
</div> | |||
</div> | |||
</div> | |||
<div class="lr-layout-grid" style="overflow:auto;"> | |||
<div class="grid-title"> | |||
<div style="overflow: hidden; padding-bottom: 20px; text-align: center; margin-left: auto; margin-right: auto;"> | |||
<div id="main" style="float: left; margin-right: 20px; width: 650px; height: 350px;border: 1px solid #ccc;"> | |||
</div> | |||
</div> | |||
</div> | |||
<div class="lr-layout-body" id="gridtable"></div> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
<script src="~/Content/echarts/echarts.js"></script> | |||
@Html.AppendJsFile("/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} <br/>{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(); | |||
} | |||
@@ -1339,6 +1339,7 @@ | |||
<Content Include="Areas\LogisticsManagement\Views\APAppointmentPsychologist\Index.js" /> | |||
<Content Include="Areas\LogisticsManagement\Views\CompanyNews\Form.js" /> | |||
<Content Include="Areas\LogisticsManagement\Views\CompanyNews\Index.js" /> | |||
<Content Include="Areas\LogisticsManagement\Views\DormitoryReturn\IndexReport.js" /> | |||
<Content Include="Areas\LogisticsManagement\Views\DormitoryReturn\FormReturn.js" /> | |||
<Content Include="Areas\LogisticsManagement\Views\DormitoryReturn\FormOut.js" /> | |||
<Content Include="Areas\LogisticsManagement\Views\ProjectDataManage\FormView.js" /> | |||
@@ -7648,6 +7649,7 @@ | |||
<Content Include="Areas\EducationalAdministration\Views\TextBookInOut\IndexInOut.cshtml" /> | |||
<Content Include="Areas\LogisticsManagement\Views\DormitoryReturn\FormOut.cshtml" /> | |||
<Content Include="Areas\LogisticsManagement\Views\DormitoryReturn\FormReturn.cshtml" /> | |||
<Content Include="Areas\LogisticsManagement\Views\DormitoryReturn\IndexReport.cshtml" /> | |||
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" /> | |||
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" /> | |||
<Content Include="Views\Login\Default-beifen.cshtml" /> | |||
@@ -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 扩展操作 | |||
@@ -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<Acc_DormitoryBuildEntity> 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<Acc_DormitoryBuildEntity> 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<Acc_DormitoryBuildEntity> 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); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取左侧树形数据 | |||
/// <summary> | |||
@@ -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 | |||
} | |||
} | |||
/// <summary> | |||
/// <summary> | |||
/// 根据父id 获取树形数据 | |||
/// </summary> | |||
/// <param name="parentID"></param> | |||
@@ -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<Acc_DormitoryBuildEntity> data) | |||
public bool MatchDormitoryInfo(string stuNo, string dormitory, string unit, string floor, string room, string bed, List<Acc_DormitoryBuildEntity> 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 | |||
} | |||
} | |||
/// <summary> | |||
/// 删除实体数据 | |||
/// <param name="keyValue">主键</param> | |||
@@ -636,7 +691,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
/// <param name="keyValue">主键</param> | |||
/// <summary> | |||
/// <returns></returns> | |||
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 | |||
} | |||
} | |||
/// <summary> | |||
/// 分配系 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
/// <param name="entity"></param> | |||
public void SaveDeptClass(string keyValue, Acc_DormitoryBuildEntity entity,int type) | |||
public void SaveDeptClass(string keyValue, Acc_DormitoryBuildEntity entity, int type) | |||
{ | |||
try | |||
{ | |||
@@ -44,6 +44,9 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
/// <summary> | |||
/// <returns></returns> | |||
List<Acc_DormitoryBuildEntity> GetList(); | |||
List<Acc_DormitoryBuildEntity> GetDept(); | |||
List<Acc_DormitoryBuildEntity> GetMajor(string strWhere); | |||
List<Acc_DormitoryBuildEntity> GetClass(string strWhere); | |||
/// <summary> | |||
/// 获取左侧树形数据 | |||
/// <summary> | |||
@@ -823,6 +823,43 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName | |||
} | |||
} | |||
/// <summary> | |||
/// 获取非空床的系部专业 班级 | |||
/// </summary> | |||
/// <returns></returns> | |||
public List<Acc_DormitoryBuildEntity> 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<Acc_DormitoryBuildEntity>(sql).ToList(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取树形数据(学生归宿) | |||
/// </summary> | |||
@@ -91,6 +91,25 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
} | |||
} | |||
public IEnumerable<Acc_DormitoryBuildEntity> GetReportList(string queryJson) | |||
{ | |||
try | |||
{ | |||
return dormitoryReturnService.GetReportList(queryJson); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取Acc_DormitoryReturn表实体数据 | |||
/// </summary> | |||
@@ -21,6 +21,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
IEnumerable<Acc_DormitoryReturnEntity> GetPageList(Pagination pagination, string queryJson); | |||
IEnumerable<Acc_DormitoryBuildEntity> GetReportList(string queryJson); | |||
/// <summary> | |||
/// 获取Acc_DormitoryReturn表实体数据 | |||
/// </summary> | |||
@@ -72,6 +72,51 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
} | |||
} | |||
/// <summary> | |||
/// 获取统计数据 | |||
/// </summary> | |||
/// <param name="queryJson"></param> | |||
/// <returns></returns> | |||
public IEnumerable<Acc_DormitoryBuildEntity> 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<Acc_DormitoryBuildEntity>(sql); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取Acc_DormitoryReturn表实体数据 | |||
/// </summary> | |||