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 list = new List(); foreach (var item in result) { list.Add(new { year = item }); } return Success(list); } [HttpPost] [AjaxOnly] public ActionResult GetStuDefaultInfo(string StuId) { var result = stuEnrollIBLL.GetStuDefaultInfo(StuId); return Success(result); } [HttpPost] [AjaxOnly] public ActionResult GetPaymentInfo() { var result = stuEnrollIBLL.GetPaymentInfo(); return Success(result); } [HttpPost] [AjaxOnly] public ActionResult GetCheckInStatistics(string DeptNo, string MajorNo, string ClassNo) { var result = stuEnrollIBLL.GetCheckInStatistics(DeptNo, MajorNo, ClassNo); return Success(result); } [HttpPost] [AjaxOnly] public ActionResult GetHelpStatistics(string DeptNo, string MajorNo, string ClassNo) { var result = stuEnrollIBLL.GetHelpStatistics(DeptNo, MajorNo, ClassNo); return Success(result); } [HttpPost] [AjaxOnly] public ActionResult GetMilitaryStatistics(string DeptNo, string MajorNo, string ClassNo) { var result = stuEnrollIBLL.GetMilitaryStatistics(DeptNo, MajorNo, ClassNo); return Success(result); } /// /// 获取左侧树形数据 /// /// [HttpGet] [AjaxOnly] public ActionResult GetTreeNew() { var data = stuEnrollIBLL.GetTree(); return Success(data); } /// /// 获取左侧树形数据 /// /// [HttpGet] [AjaxOnly] public ActionResult GetBedTree(string classNo, string gender) { var data = stuEnrollIBLL.GetBedTree(classNo, gender); return Success(data); } #endregion #region 提交数据 /// /// 删除实体数据 /// 主键 /// /// [HttpPost] [AjaxOnly] public ActionResult DeleteForm(string keyValue) { stuEnrollIBLL.DeleteEntity(keyValue); return Success("删除成功!"); } /// /// 保存实体数据(新增、修改) /// 主键 /// /// [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] public ActionResult SaveForm(string keyValue, string strEntity) { StuEnrollEntity entity = strEntity.ToObject(); stuEnrollIBLL.SaveEntity(keyValue, entity); return Success("保存成功!"); } /// /// 保存实收金额 /// 主键 /// /// [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] public ActionResult SaveActualPayAmount(string keyValue, string strEntity) { StuEnrollEntity entity = strEntity.ToObject(); var newEntity = stuEnrollIBLL.GetStuEnrollEntity(keyValue); newEntity.ActualPayAmount = entity.ActualPayAmount; stuEnrollIBLL.SaveEntity(keyValue, newEntity); return Success("保存成功!"); } /// /// 保存实体数据(新增、修改) /// 主键 /// /// [HttpPost] [AjaxOnly] public ActionResult EditEnrollType(string stuIds, string enrollType) { if (!string.IsNullOrEmpty(stuIds)) { stuEnrollIBLL.EditEnrollType(stuIds, enrollType); } return Success("保存成功!"); } [HttpPost] [AjaxOnly] public ActionResult AllocationClass(string classNo, string dataJson) { stuEnrollIBLL.AllocationClass(classNo, dataJson); return Success("分配成功!"); } [HttpPost] [AjaxOnly] public ActionResult NewAllocationDormitory(string classNo, string dataJson) { stuEnrollIBLL.NewAllocationDormitory(classNo, dataJson); return Success("分配成功!"); } [HttpPost] [AjaxOnly] public ActionResult AllocationDormitory(string dormitoryNo, string stuId, string dormitoryName) { stuEnrollIBLL.AllocationDormiotry(dormitoryNo, stuId, dormitoryName); return Success("分配成功!"); } [HttpPost] [AjaxOnly] public ActionResult SyncDept() { stuEnrollIBLL.SyncDept(); return Success("同步成功"); } [HttpPost] [AjaxOnly] public ActionResult SyncMajor() { stuEnrollIBLL.SyncMajor(); return Success("同步成功"); } [HttpPost] [AjaxOnly] public ActionResult Sign(string stuId, bool status) { var result = stuEnrollIBLL.Sign(stuId, status); if (result.Item1) { return Success(result.Item2); } else { return Fail(result.Item2); } } [HttpPost] [AjaxOnly] public ActionResult AllReport() { stuEnrollIBLL.AllReport(); return Success("操作成功"); } [HttpPost] [AjaxOnly] public ActionResult AllPhoto() { stuEnrollIBLL.AllPhoto(); return Success("操作成功"); } [HttpPost] [AjaxOnly] public ActionResult AllGetCloth() { stuEnrollIBLL.AllGetCloth(); return Success("操作成功"); } [HttpPost] [AjaxOnly] public ActionResult AllGetSize() { stuEnrollIBLL.AllGetSize(); return Success("操作成功"); } [HttpPost] [AjaxOnly] public ActionResult AllGetArticle() { stuEnrollIBLL.AllGetArticle(); return Success("操作成功"); } [HttpPost] [AjaxOnly] public ActionResult Report(string stuId, bool status) { var result = stuEnrollIBLL.Report(stuId, status); if (result.Item1) { return Success(result.Item2); } else { return Fail(result.Item2); } } [HttpPost] [AjaxOnly] public ActionResult Stay(string stuId, bool status, bool payAfter = false) { var result = stuEnrollIBLL.Stay(stuId, status, payAfter); if (result.Item1) { return Success(result.Item2); } else { return Fail(result.Item2); } } [HttpPost] [AjaxOnly] public ActionResult AllStay() { stuEnrollIBLL.AllStay(); return Success("操作成功"); } [HttpPost] [AjaxOnly] public ActionResult Help(string stuId, bool status, bool payAfter = false) { var result = stuEnrollIBLL.Help(stuId, status, payAfter); if (result.Item1) { return Success(result.Item2); } else { return Fail(result.Item2); } } [HttpPost] [AjaxOnly] public ActionResult AllHelp() { stuEnrollIBLL.AllHelp(); return Success("操作成功"); } [HttpPost] [AjaxOnly] public ActionResult Military(string stuId, bool status, bool payAfter = false) { var result = stuEnrollIBLL.Military(stuId, status, payAfter); if (result.Item1) { return Success(result.Item2); } else { return Fail(result.Item2); } } [HttpPost] [AjaxOnly] public ActionResult AllMilitary() { stuEnrollIBLL.AllMilitary(); return Success("成功"); } [HttpPost] [AjaxOnly] public ActionResult IsPay(string stuId, bool status) { var result = stuEnrollIBLL.IsPay(stuId, status); if (result.Item1) { return Success(result.Item2); } else { return Fail(result.Item2); } } [HttpPost] [AjaxOnly] public ActionResult IsPhoto(string stuId, string base64url) { var loginuser = LoginUserInfo.Get(); //头像处理 var folderId = Guid.NewGuid().ToString(); string filePath = Config.GetValue("AnnexesFile"); string uploadDate = DateTime.Now.ToString("yyyyMMdd"); string FileEextension = ".png"; string fileGuid = Guid.NewGuid().ToString(); string virtualPath = string.Format("{0}/{1}/{2}/{3}{4}", filePath, loginuser.account, uploadDate, fileGuid, FileEextension); //创建文件夹 string path = Path.GetDirectoryName(virtualPath); Directory.CreateDirectory(path); AnnexesFileEntity fileAnnexesEntity = new AnnexesFileEntity(); if (!System.IO.File.Exists(virtualPath)) { byte[] bytes = Convert.FromBase64String(base64url.Replace("data:image/png;base64,", "")); FileInfo file = new FileInfo(virtualPath); FileStream fs = file.Create(); fs.Write(bytes, 0, bytes.Length); fs.Close(); //文件信息写入数据库 fileAnnexesEntity.F_Id = fileGuid; fileAnnexesEntity.F_FileName = "userphoto.png"; fileAnnexesEntity.F_FilePath = virtualPath; fileAnnexesEntity.F_FileSize = bytes.Length.ToString(); fileAnnexesEntity.F_FileExtensions = FileEextension; fileAnnexesEntity.F_FileType = FileEextension.Replace(".", ""); fileAnnexesEntity.F_CreateUserId = loginuser.userId; fileAnnexesEntity.F_CreateUserName = loginuser.realName; annexesFileIBLL.SaveEntity(folderId, fileAnnexesEntity); } var result = stuEnrollIBLL.IsPhoto(stuId, true, fileGuid); if (result.Item1) { return Success(result.Item2); } else { return Fail(result.Item2); } } [HttpPost] [AjaxOnly] public ActionResult GetCloth(string stuId, bool status) { var result = stuEnrollIBLL.GetCloth(stuId, status); if (result.Item1) { return Success(result.Item2); } else { return Fail(result.Item2); } } [HttpPost] [AjaxOnly] public ActionResult GetClothSize(string stuId, bool status) { var result = stuEnrollIBLL.GetClothSize(stuId, status); if (result.Item1) { return Success(result.Item2); } else { return Fail(result.Item2); } } [HttpPost] [AjaxOnly] public ActionResult GetArticles(string stuId, bool status) { var result = stuEnrollIBLL.GetArticles(stuId, status); if (result.Item1) { return Success(result.Item2); } else { return Fail(result.Item2); } } [HttpPost] [AjaxOnly] public ActionResult GetMoney() { stuEnrollIBLL.GetMoney(); return Success("操作成功"); } /// /// 下载文件 /// /// 文件id /// [HttpPost] public void DownWrod() { ExcelHelper.aaaaa(); } /// /// 关联照片 /// /// public ActionResult RelationPhoto() { stuEnrollIBLL.RelationPhoto(); return Success("关联成功"); } /// /// 同步学生数据 /// /// public ActionResult Synchronization() { stuEnrollIBLL.Synchronization(); return Success("同步成功"); } /// /// 报名审核 /// /// public ActionResult UpdateEnrollStatus(string keyValue, string strEntity) { var StuEnrollData = stuEnrollIBLL.GetStuEnrollEntity(keyValue); if (string.IsNullOrEmpty(StuEnrollData.SubjectNo)) { return Fail("考试科目不能为空!"); } stuEnrollIBLL.UpdateEnrollStatus(keyValue, 2); return Success("保存成功"); } /// /// 报名--去审核 /// /// public ActionResult NoCheck(string keyValue) { stuEnrollIBLL.UpdateEnrollStatus(keyValue, 0); return Success("保存成功"); } /// /// 录取 /// /// public ActionResult Admission(string keyValue, int IsAdmission) { var count = stuEnrollScoreIBLL.GetNoCheck(keyValue); if (count > 0) { return Fail("该学生有未审核的科目成绩"); } stuEnrollIBLL.Admission(keyValue, IsAdmission); return Success("保存成功"); } #endregion } }