|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844 |
- 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
- {
- /// <summary>
- /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
- /// Copyright (c) 2013-2018 北京泉江科技有限公司
- /// 创 建:超级管理员
- /// 日 期:2019-07-17 11:20
- /// 描 述:新生录取管理
- /// </summary>
- public class StuEnrollController : MvcControllerBase
- {
- private StuEnrollIBLL stuEnrollIBLL = new StuEnrollBLL();
- private AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL();
- private ClassInfoIBLL classInfoIBLL = new ClassInfoBLL();
-
- #region 视图功能
-
- /// <summary>
- /// 主页面
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Index()
- {
- 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();
- }
-
-
- /// <summary>
- /// 是否住宿
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult CheckIn()
- {
- return View();
- }
-
- /// <summary>
- /// 是否住宿
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult PayAfter()
- {
- return View();
- }
- /// <summary>
- /// 是否资助
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult IsHelp()
- {
- return View();
- }
-
- /// <summary>
- /// 是否军训
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Military()
- {
- return View();
- }
-
- /// <summary>
- /// 是否军训
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult IsPay()
- {
- return View();
- }
-
-
- [HttpGet]
- public ActionResult CheckInUrl()
- {
- return View();
- }
-
- [HttpGet]
- public ActionResult SubsidizeUrl()
- {
- return View();
- }
-
- [HttpGet]
- public ActionResult MilitaryUrl()
- {
- return View();
- }
-
- /// <summary>
- /// 是否拍照
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult IsPhoto()
- {
- return View();
- }
-
- /// <summary>
- /// 是否领取军训服
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult GetCloth()
- {
- return View();
- }
-
- /// <summary>
- /// 是否量校服尺寸
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult GetClothSize()
- {
- return View();
- }
-
- /// <summary>
- /// 是否领取床上用品
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult GetArticles()
- {
- return View();
- }
-
-
-
-
- /// <summary>
- /// 表单页
- /// <summary>
- /// <returns></returns>
- [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 获取数据
-
- /// <summary>
- /// 获取页面显示列表数据
- /// <summary>
- /// <param name="queryJson">查询参数</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetPageList(string pagination, string queryJson)
- {
- Pagination paginationobj = pagination.ToObject<Pagination>();
- 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 GetDormitorys(string pagination, string queryJson)
- {
- Pagination paginationobj = pagination.ToObject<Pagination>();
- var data = stuEnrollIBLL.GetDormitorys(paginationobj, queryJson);
- var jsonData = new
- {
- rows = data,
- total = paginationobj.total,
- page = paginationobj.page,
- records = paginationobj.records
- };
- return Success(jsonData);
- }
-
- /// <summary>
- /// 获取页面显示列表数据
- /// <summary>
- /// <param name="queryJson">查询参数</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetReportPageList(string pagination, string queryJson)
- {
- Pagination paginationobj = pagination.ToObject<Pagination>();
- var data = stuEnrollIBLL.GetReportPageList(paginationobj, queryJson);
- var jsonData = new
- {
- rows = data,
- total = paginationobj.total,
- page = paginationobj.page,
- records = paginationobj.records
- };
- return Success(jsonData);
- }
-
- /// <summary>
- /// 获取表单数据
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetFormData(string keyValue)
- {
- var StuEnrollData = stuEnrollIBLL.GetStuEnrollEntity(keyValue);
- 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,
- };
- 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<object> list=new List<object>();
- 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);
-
- }
-
- /// <summary>
- /// 获取左侧树形数据
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetTreeNew()
- {
- var data = stuEnrollIBLL.GetTree();
- return Success(data);
- }
- /// <summary>
- /// 获取左侧树形数据
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetBedTree(string classNo, string gender)
- {
- var data = stuEnrollIBLL.GetBedTree(classNo, gender);
- return Success(data);
- }
-
-
- #endregion
-
- #region 提交数据
-
- /// <summary>
- /// 删除实体数据
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- [HttpPost]
- [AjaxOnly]
- public ActionResult DeleteForm(string keyValue)
- {
- stuEnrollIBLL.DeleteEntity(keyValue);
- return Success("删除成功!");
- }
- /// <summary>
- /// 保存实体数据(新增、修改)
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- [HttpPost]
- [ValidateAntiForgeryToken]
- [AjaxOnly]
- public ActionResult SaveForm(string keyValue, string strEntity)
- {
- StuEnrollEntity entity = strEntity.ToObject<StuEnrollEntity>();
- stuEnrollIBLL.SaveEntity(keyValue, entity);
- return Success("保存成功!");
- }
- /// <summary>
- /// 保存实收金额
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- [HttpPost]
- [ValidateAntiForgeryToken]
- [AjaxOnly]
- public ActionResult SaveActualPayAmount(string keyValue, string strEntity)
- {
- StuEnrollEntity entity = strEntity.ToObject<StuEnrollEntity>();
-
- var newEntity = stuEnrollIBLL.GetStuEnrollEntity(keyValue);
- newEntity.ActualPayAmount = entity.ActualPayAmount;
- stuEnrollIBLL.SaveEntity(keyValue, newEntity);
- return Success("保存成功!");
- }
-
- /// <summary>
- /// 保存实体数据(新增、修改)
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- [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("操作成功");
- }
- /// <summary>
- /// 下载文件
- /// </summary>
- /// <param name="fileId">文件id</param>
- /// <returns></returns>
- [HttpPost]
- public void DownWrod()
- {
- ExcelHelper.aaaaa();
- }
-
- /// <summary>
- /// 关联照片
- /// </summary>
- /// <returns></returns>
- public ActionResult RelationPhoto()
- {
-
- stuEnrollIBLL.RelationPhoto();
- return Success("关联成功");
- }
-
-
- /// <summary>
- /// 同步学生数据
- /// </summary>
- /// <returns></returns>
- public ActionResult Synchronization()
- {
- stuEnrollIBLL.Synchronization();
- return Success("同步成功");
- }
-
-
-
-
- #endregion
-
- }
- }
|