using Learun.Application.TwoDevelopment.EducationalAdministration;
using Learun.Util;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web.Mvc;
using Learun.Application.Base.SystemModule;
using Newtonsoft.Json;
namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
{
///
/// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
/// Copyright (c) 2013-2018 北京泉江科技有限公司
/// 创 建:超级管理员
/// 日 期:2019-07-17 11:20
/// 描 述:新生录取管理
///
public class StuEnrollController : MvcControllerBase
{
private StuEnrollIBLL stuEnrollIBLL = new StuEnrollBLL();
private AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL();
private ClassInfoIBLL classInfoIBLL = new ClassInfoBLL();
private StuEnrollScoreIBLL stuEnrollScoreIBLL = new StuEnrollScoreBLL();
#region 视图功能
///
/// 主页面
///
///
[HttpGet]
public ActionResult Index()
{
return View();
}
///
/// 新生报名
///
///
[HttpGet]
public ActionResult EnrollForm()
{
return View();
}
///
/// 新生报名
///
///
[HttpGet]
public ActionResult EnrollFormView()
{
return View();
}
///
/// 新生报名
///
///
[HttpGet]
public ActionResult EnrollIndex()
{
return View();
}
///
/// 新生报名审核
///
///
[HttpGet]
public ActionResult EnrollSH()
{
return View();
}
///
/// 新生报名审核
///
///
[HttpGet]
public ActionResult EnrollLQ()
{
return View();
}
///
/// 招生统计
///
///
[HttpGet]
public ActionResult EnrollIndexTJ()
{
return View();
}
[HttpGet]
public ActionResult StudentStatus()
{
return View();
}
[HttpGet]
public ActionResult AmountForm()
{
return View();
}
[HttpGet]
public ActionResult CardPrint()
{
return View();
}
[HttpGet]
public ActionResult Report()
{
return View();
}
[HttpGet]
public ActionResult EnrollTypeForm()
{
return View();
}
///
/// 是否住宿
///
///
[HttpGet]
public ActionResult CheckIn()
{
return View();
}
///
/// 是否住宿
///
///
[HttpGet]
public ActionResult PayAfter()
{
return View();
}
///
/// 是否资助
///
///
[HttpGet]
public ActionResult IsHelp()
{
return View();
}
///
/// 是否军训
///
///
[HttpGet]
public ActionResult Military()
{
return View();
}
///
/// 是否军训
///
///
[HttpGet]
public ActionResult IsPay()
{
return View();
}
[HttpGet]
public ActionResult CheckInUrl()
{
return View();
}
[HttpGet]
public ActionResult SubsidizeUrl()
{
return View();
}
[HttpGet]
public ActionResult MilitaryUrl()
{
return View();
}
///
/// 是否拍照
///
///
[HttpGet]
public ActionResult IsPhoto()
{
return View();
}
///
/// 是否领取军训服
///
///
[HttpGet]
public ActionResult GetCloth()
{
return View();
}
///
/// 是否量校服尺寸
///
///
[HttpGet]
public ActionResult GetClothSize()
{
return View();
}
///
/// 是否领取床上用品
///
///
[HttpGet]
public ActionResult GetArticles()
{
return View();
}
///
/// 表单页
///
///
[HttpGet]
public ActionResult Form()
{
return View();
}
[HttpGet]
public ActionResult FormView()
{
return View();
}
public ActionResult AllocationClass()
{
return View();
}
public ActionResult AllocationDormitory()
{
return View();
}
public ActionResult NewAllocationDormitory()
{
return View();
}
public ActionResult NewAllocationBed()
{
return View();
}
#endregion
#region 获取数据
///
/// 获取表单数据
///
///
[HttpGet]
[AjaxOnly]
public ActionResult GetFormDataForEnroll(string keyValue)
{
var StuEnrollData = stuEnrollIBLL.GetStuEnrollEntity(keyValue);
var jsonData = new
{
StuEnroll = new
{
StuId = StuEnrollData.StuId,
Gender = StuEnrollData.Gender,
StuName = StuEnrollData.StuName,
IDCard = StuEnrollData.IDCard,
IdCardPto1 = StuEnrollData.IdCardPto1,
},
};
return Success(jsonData);
}
///
/// 招生统计
///
/// 查询参数
///
[HttpGet]
[AjaxOnly]
public ActionResult GetTJList(string queryJson)
{
var data = stuEnrollIBLL.GetTJList(queryJson);
return Success(data);
}
///
/// 获取页面显示列表数据
///
/// 查询参数
///
[HttpGet]
[AjaxOnly]
public ActionResult GetPageList(string pagination, string queryJson)
{
Pagination paginationobj = pagination.ToObject();
var data = stuEnrollIBLL.GetPageList(paginationobj, queryJson);
var jsonData = new
{
rows = data,
total = paginationobj.total,
page = paginationobj.page,
records = paginationobj.records
};
return Success(jsonData);
}
///
/// 获取页面显示列表数据
///
/// 查询参数
///
[HttpGet]
[AjaxOnly]
public ActionResult GetPageListForTJ(string pagination, string queryJson)
{
Pagination paginationobj = pagination.ToObject();
var data = stuEnrollIBLL.GetPageListForTJ(paginationobj, queryJson);
var jsonData = new
{
rows = data,
total = paginationobj.total,
page = paginationobj.page,
records = paginationobj.records
};
return Success(jsonData);
}
///
/// 审核页面 获取考试科目信息
///
///
public ActionResult GetExamDataByStuId(string keyValue)
{
var data = stuEnrollIBLL.GetExamDataByStuId(keyValue);
return Success(data);
}
[HttpGet]
[AjaxOnly]
public ActionResult GetDormitorys(string pagination, string queryJson)
{
Pagination paginationobj = pagination.ToObject();
var data = stuEnrollIBLL.GetDormitorys(paginationobj, queryJson);
var jsonData = new
{
rows = data,
total = paginationobj.total,
page = paginationobj.page,
records = paginationobj.records
};
return Success(jsonData);
}
///
/// 获取页面显示列表数据
///
/// 查询参数
///
[HttpGet]
[AjaxOnly]
public ActionResult GetReportPageList(string pagination, string queryJson)
{
Pagination paginationobj = pagination.ToObject();
var data = stuEnrollIBLL.GetReportPageList(paginationobj, queryJson);
var jsonData = new
{
rows = data,
total = paginationobj.total,
page = paginationobj.page,
records = paginationobj.records
};
return Success(jsonData);
}
///
/// 获取表单数据
///
///
[HttpGet]
[AjaxOnly]
public ActionResult GetFormData(string keyValue)
{
var StuEnrollData = stuEnrollIBLL.GetStuEnrollEntity(keyValue);
//获取中考成绩
var MidExamScoreData = stuEnrollIBLL.GetMidExamScoreData(keyValue).OrderBy(x => x.sort);
if (string.IsNullOrEmpty(StuEnrollData.CheckInUrl))
{
StuEnrollData.CheckInUrl = Guid.NewGuid().ToString();
}
if (string.IsNullOrEmpty(StuEnrollData.SubsidizeUrl))
{
StuEnrollData.SubsidizeUrl = Guid.NewGuid().ToString();
}
if (string.IsNullOrEmpty(StuEnrollData.MilitaryUrl))
{
StuEnrollData.MilitaryUrl = Guid.NewGuid().ToString();
}
var jsonData = new
{
StuEnroll = StuEnrollData,
StuEnrollMidExamScore = MidExamScoreData
};
return Success(jsonData);
}
[HttpPost]
[AjaxOnly]
public ActionResult RealationPhoto()
{
var studentList = stuEnrollIBLL.AllStudent().ToList();
foreach (var student in studentList)
{
if (string.IsNullOrEmpty(student.PhotoUrl))
{
student.PhotoUrl = Guid.NewGuid().ToString();
stuEnrollIBLL.SaveEntity(student.StuId, student);
}
var annexEntity = annexesFileIBLL.GetEntityByFolderId(student.PhotoUrl);
if (annexEntity == null)
{
annexEntity = new AnnexesFileEntity();
annexEntity.Create();
annexEntity.F_Id = Guid.NewGuid().ToString();
}
}
return Success("");
}
[HttpGet]
[AjaxOnly]
public ActionResult GetStuInfo(string stuId)
{
var result = stuEnrollIBLL.GetStuInfo(stuId);
return Success(result);
}
[HttpGet]
[AjaxOnly]
public ActionResult GetYearListByClass()
{
var classList = classInfoIBLL.GetAllClass().ToList();
var result = classList.GroupBy(a => a.Grade).Select(m => m.Key).ToList();
List