using Learun.Application.TwoDevelopment.EducationalAdministration; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using Learun.Util; namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers { public class HomeStatisticsController : Controller { private StuInfoFreshIBLL stuInfoFreshIBLL = new StuInfoFreshBLL(); // GET: EducationalAdministration/HomeStatistics public ActionResult Index() { return View(); } public class InAndOutList { public string DeptNo { get; set; } public string DeptName { get; set; } public string MajorNo { get; set; } public string MajorName { get; set; } /// /// 总人数 /// public int TotalNum { get; set; } /// /// 未报到人数 /// public int NoNum { get; set; } /// /// 报到人数 /// public int RegisterNum { get; set; } } public class StatisticsList { public string MajorName { get; set; } /// /// 已报到人数 /// public int Num { get; set; } /// /// 总人数 /// public string s { get; set; } } public class StatisticModel { public string MajorNo { get; set; } public string MajorName { get; set; } public string ClassNo { get; set; } public string ClassName { get; set; } public string Grade { get; set; } /// /// 总人数 /// public int TotalNum { get; set; } /// /// 完善个人信息人数 /// public int InfoNum { get; set; } /// /// 未报到人数 /// public int NoNum { get; set; } /// /// 报到人数 /// public int RegisterNum { get; set; } /// /// 缴费人数 /// public int PayFeeNum { get; set; } /// /// 领钥匙人数 /// public int GetKeyNum { get; set; } /// /// 已领取校园卡人数 /// public int GetCardNum { get; set; } /// /// 已收取档案人数 /// public int CollectFileNum { get; set; } /// /// 贷款人数 /// public int LoanNum { get; set; } } /// /// 获取报道学生和未报到学生列表 /// /// [HttpGet] public ActionResult GetNewStudentList(string queryJson) { var data = stuInfoFreshIBLL.GetNewStudentList(queryJson); var list = data.Where(x => !string.IsNullOrEmpty(x.MajorNo)).GroupBy(x => x.MajorNo).Select(x => new InAndOutList { MajorNo = x.Key, MajorName = x.FirstOrDefault()?.MajorName, DeptNo = x.FirstOrDefault()?.DeptNo, DeptName = x.FirstOrDefault()?.DeptName, TotalNum = x.Count(), RegisterNum = x.Count(y => y.RegisterStatus == "1"), NoNum = x.Count() - x.Count(y => y.RegisterStatus == "1") }).OrderBy(x => x.MajorNo); List Lists = new List(); foreach (var item in list) { StatisticsList InOutlist = new StatisticsList(); InOutlist.MajorName = item.MajorName; InOutlist.Num = item.TotalNum; InOutlist.s = "s1"; Lists.Add(InOutlist); InOutlist = new StatisticsList(); InOutlist.MajorName = item.MajorName; InOutlist.Num = item.RegisterNum; InOutlist.s = "s2"; Lists.Add(InOutlist); } Response.AddHeader("Access-Control-Allow-Credentials", "true"); Response.AddHeader("Access-Control-Allow-Origin", "http://yuntu.cloud.tencent.com "); return Content(Lists.ToJson()); } } }