Browse Source

【增加】驾驶舱学生信息分析接口开发;

应县
dyy 9 months ago
parent
commit
4a1c98bf0e
1 changed files with 135 additions and 10 deletions
  1. +135
    -10
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Echarts/StudentEchartsApi.cs

+ 135
- 10
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Echarts/StudentEchartsApi.cs View File

@@ -1,5 +1,6 @@
using Learun.Application.Base.SystemModule;
using Learun.Application.TwoDevelopment.EducationalAdministration;
using Learun.Util;
using Nancy;
using System;
using System.Collections.Generic;
@@ -35,6 +36,9 @@ namespace Learun.Application.WebApi.Modules.Echarts
Get["/stuEncourgementEchart"] = stuEncourgementEchart;
Get["/stuTransferNum"] = stuTransferNum;
Get["/stuGraduateEchart"] = stuGraduateEchart;
Get["/stuMapEchart"] = stuMapEchart;
Get["/stuGradeSelect"] = stuGradeSelect;
Get["/stuClassSelect"] = stuClassSelect;


}
@@ -108,8 +112,13 @@ namespace Learun.Application.WebApi.Modules.Echarts
/// <returns></returns>
public Response stuAgeEchart(dynamic _)
{
var param = this.GetReqData();
var res = new List<PieModel>();
var stuList = stuInfoBasicIBLL.GetAllList().Where(x => x.Birthday.HasValue);
if (!string.IsNullOrEmpty(param))
{
stuList = stuList.Where(x => x.Grade == param);
}
var num1820 = stuList.Where(x => Math.Abs(x.Birthday.Value.Year - DateTime.Now.Year) >= 18 && Math.Abs(x.Birthday.Value.Year - DateTime.Now.Year) <= 20).Count();
res.Add(new PieModel() { name = "18-20", value = num1820 });
var num2123 = stuList.Where(x => Math.Abs(x.Birthday.Value.Year - DateTime.Now.Year) >= 21 && Math.Abs(x.Birthday.Value.Year - DateTime.Now.Year) <= 23).Count();
@@ -126,7 +135,13 @@ namespace Learun.Application.WebApi.Modules.Echarts
/// <returns></returns>
public Response stuNationalityEchart(dynamic _)
{
var stuList = stuInfoBasicIBLL.GetAllList().Where(x => x.NationalityNo != null && x.NationalityNo.Length > 0).GroupBy(x => x.NationalityNo).Select(x => new
var param = this.GetReqData();
var stuList = stuInfoBasicIBLL.GetAllList().Where(x => x.NationalityNo != null && x.NationalityNo.Length > 0);
if (!string.IsNullOrEmpty(param))
{
stuList = stuList.Where(x => x.Grade == param);
}
var stuListGroup = stuList.GroupBy(x => x.NationalityNo).Select(x => new
{
NationalityNo = x.Key,
manNum = x.Where(y => y.GenderNo == true).Count(),
@@ -141,7 +156,7 @@ namespace Learun.Application.WebApi.Modules.Echarts
};
var s1data = new List<int>();
var s2data = new List<int>();
foreach (var item in stuList)
foreach (var item in stuListGroup)
{
res.categories.Add(nationalityList.FirstOrDefault(x => x.F_ItemValue == item.NationalityNo)?.F_ItemName);
s1data.Add(item.manNum);
@@ -159,8 +174,13 @@ namespace Learun.Application.WebApi.Modules.Echarts
/// <returns></returns>
public Response stuPartyFaceEchart(dynamic _)
{
var param = this.GetReqData();
var res = new List<PieModel>();
var stuList = stuInfoBasicIBLL.GetAllList();
if (!string.IsNullOrEmpty(param))
{
stuList = stuList.Where(x => x.Grade == param);
}
//中共党员03 共青团员01 群众02 不限
var num1 = stuList.Where(x => x.PartyFaceNo == "03").Count();
res.Add(new PieModel() { name = "中共党员", value = num1 });
@@ -210,13 +230,19 @@ namespace Learun.Application.WebApi.Modules.Echarts
/// <returns></returns>
public Response stuProvinceEchart(dynamic _)
{
var param = this.GetReqData();
var res = new List<PieModel>();
var stuList = stuInfoBasicIBLL.GetAllList().Where(x => x.F_ProvinceId != null && x.F_ProvinceId.Length > 0).GroupBy(x => x.F_ProvinceId).Select(x => new
var stuList = stuInfoBasicIBLL.GetAllList().Where(x => x.F_ProvinceId != null && x.F_ProvinceId.Length > 0);
if (!string.IsNullOrEmpty(param))
{
stuList = stuList.Where(x => x.Grade == param);
}
var stuListGroup = stuList.GroupBy(x => x.F_ProvinceId).Select(x => new
{
provinceCode = x.Key,
num = x.Count()
}).OrderBy(x => x.provinceCode);
foreach (var item in stuList)
foreach (var item in stuListGroup)
{
var model = new PieModel()
{
@@ -262,13 +288,20 @@ namespace Learun.Application.WebApi.Modules.Echarts
/// <returns></returns>
public Response stuTransferNum(dynamic _)
{
var param = this.GetReq<TransferParam>();
var res = new RingModel();
var list = stuTransferInfoIBLL.GetList(null).Where(x => x.F_EnabledMark == 1);
res.data = list.Count();
var param = this.GetReqData();
if (!string.IsNullOrEmpty(param))
if (!string.IsNullOrEmpty(param.ClassNo))
{
res.value = list.Where(x => x.AnomalousType == param).Count();
list = list.Where(x => x.ClassNo == param.ClassNo);
}
if (!string.IsNullOrEmpty(param.AnomalousType))
{
res.value = list.Where(x => x.AnomalousType == param.AnomalousType).Count();
if (list.Count() > 0)
{
res.data = ((res.value.ToDecimal() / list.Count().ToDecimal()) * 100).ToDecimal(2);
}
}

return Res(res);
@@ -299,6 +332,71 @@ namespace Learun.Application.WebApi.Modules.Echarts

return Res(res);
}
/// <summary>
/// 招生情况
/// </summary>
/// <param name="_"></param>
/// <returns></returns>
public Response stuMapEchart(dynamic _)
{
var res = new List<MapModel>();
var stuList = stuInfoBasicIBLL.GetAllList().Where(x => x.F_ProvinceId != null && x.F_ProvinceId.Length > 0).GroupBy(x => x.F_ProvinceId).Select(x => new
{
provinceCode = x.Key,
num = x.Count()
}).OrderBy(x => x.provinceCode);
foreach (var item in stuList)
{
var model = new MapModel()
{
code = item.provinceCode,
area = dIC_PROVINCEIBLL.GetDIC_PROVINCEEntityByCode(item.provinceCode)?.PNAME,
number = item.num
};
res.Add(model);
}

return Res(res);
}
/// <summary>
/// 年级下拉框
/// </summary>
/// <param name="_"></param>
/// <returns></returns>
public Response stuGradeSelect(dynamic _)
{
var res = new List<SelectModel>();
var stuList = stuInfoBasicIBLL.GetAllList().Where(x => x.Grade != null && x.Grade.Length > 0).GroupBy(x => x.Grade).Select(x => new SelectModel()
{
value = x.Key,
label = x.Key + "级"
}).OrderBy(x => x.value);
res.Add(new SelectModel() { value = "", label = "全年级" });
res.AddRange(stuList);

return Res(res.OrderBy(x => x.value));
}
/// <summary>
/// 异动-班级下拉框
/// </summary>
/// <param name="_"></param>
/// <returns></returns>
public Response stuClassSelect(dynamic _)
{
var res = new List<SelectModel>();
var stuList = stuTransferInfoIBLL.GetList(null).Where(x => x.F_EnabledMark == 1 && x.ClassNo != null && x.ClassNo.Length > 0).GroupBy(x => x.ClassNo).Select(x => new SelectModel()
{
value = x.Key,
label = classInfoIBLL.GetClassInfoEntityByClassNo(x.Key)?.ClassName
}).OrderBy(x => x.value);
res.Add(new SelectModel() { value = "", label = "全校" });
res.AddRange(stuList);

return Res(res.OrderBy(x => x.value));
}





/// <summary>
@@ -344,10 +442,37 @@ namespace Learun.Application.WebApi.Modules.Echarts
public string label { get; set; }
public int value { get; set; }
/// <summary>
/// 总数
/// 百分比
/// </summary>
public int data { get; set; }
public decimal data { get; set; }
}
/// <summary>
/// 地图数据
/// </summary>
public class MapModel
{
public string code { get; set; }
public string area { get; set; }
public int number { get; set; }
}
/// <summary>
/// 下拉框数据
/// </summary>
public class SelectModel
{
public string label { get; set; }
public string value { get; set; }
}
/// <summary>
/// 异动人数的传参
/// </summary>
public class TransferParam
{
public string AnomalousType { get; set; }
public string ClassNo { get; set; }
}




}

Loading…
Cancel
Save