You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

845 lines
22 KiB

  1. using Learun.Application.TwoDevelopment.EducationalAdministration;
  2. using Learun.Util;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.IO;
  6. using System.Linq;
  7. using System.Web.Mvc;
  8. using Learun.Application.Base.SystemModule;
  9. using Newtonsoft.Json;
  10. namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
  11. {
  12. /// <summary>
  13. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  14. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  15. /// 创 建:超级管理员
  16. /// 日 期:2019-07-17 11:20
  17. /// 描 述:新生录取管理
  18. /// </summary>
  19. public class StuEnrollController : MvcControllerBase
  20. {
  21. private StuEnrollIBLL stuEnrollIBLL = new StuEnrollBLL();
  22. private AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL();
  23. private ClassInfoIBLL classInfoIBLL = new ClassInfoBLL();
  24. #region 视图功能
  25. /// <summary>
  26. /// 主页面
  27. /// <summary>
  28. /// <returns></returns>
  29. [HttpGet]
  30. public ActionResult Index()
  31. {
  32. return View();
  33. }
  34. [HttpGet]
  35. public ActionResult StudentStatus()
  36. {
  37. return View();
  38. }
  39. [HttpGet]
  40. public ActionResult AmountForm()
  41. {
  42. return View();
  43. }
  44. [HttpGet]
  45. public ActionResult CardPrint()
  46. {
  47. return View();
  48. }
  49. [HttpGet]
  50. public ActionResult Report()
  51. {
  52. return View();
  53. }
  54. [HttpGet]
  55. public ActionResult EnrollTypeForm()
  56. {
  57. return View();
  58. }
  59. /// <summary>
  60. /// 是否住宿
  61. /// </summary>
  62. /// <returns></returns>
  63. [HttpGet]
  64. public ActionResult CheckIn()
  65. {
  66. return View();
  67. }
  68. /// <summary>
  69. /// 是否住宿
  70. /// </summary>
  71. /// <returns></returns>
  72. [HttpGet]
  73. public ActionResult PayAfter()
  74. {
  75. return View();
  76. }
  77. /// <summary>
  78. /// 是否资助
  79. /// </summary>
  80. /// <returns></returns>
  81. [HttpGet]
  82. public ActionResult IsHelp()
  83. {
  84. return View();
  85. }
  86. /// <summary>
  87. /// 是否军训
  88. /// </summary>
  89. /// <returns></returns>
  90. [HttpGet]
  91. public ActionResult Military()
  92. {
  93. return View();
  94. }
  95. /// <summary>
  96. /// 是否军训
  97. /// </summary>
  98. /// <returns></returns>
  99. [HttpGet]
  100. public ActionResult IsPay()
  101. {
  102. return View();
  103. }
  104. [HttpGet]
  105. public ActionResult CheckInUrl()
  106. {
  107. return View();
  108. }
  109. [HttpGet]
  110. public ActionResult SubsidizeUrl()
  111. {
  112. return View();
  113. }
  114. [HttpGet]
  115. public ActionResult MilitaryUrl()
  116. {
  117. return View();
  118. }
  119. /// <summary>
  120. /// 是否拍照
  121. /// </summary>
  122. /// <returns></returns>
  123. [HttpGet]
  124. public ActionResult IsPhoto()
  125. {
  126. return View();
  127. }
  128. /// <summary>
  129. /// 是否领取军训服
  130. /// </summary>
  131. /// <returns></returns>
  132. [HttpGet]
  133. public ActionResult GetCloth()
  134. {
  135. return View();
  136. }
  137. /// <summary>
  138. /// 是否量校服尺寸
  139. /// </summary>
  140. /// <returns></returns>
  141. [HttpGet]
  142. public ActionResult GetClothSize()
  143. {
  144. return View();
  145. }
  146. /// <summary>
  147. /// 是否领取床上用品
  148. /// </summary>
  149. /// <returns></returns>
  150. [HttpGet]
  151. public ActionResult GetArticles()
  152. {
  153. return View();
  154. }
  155. /// <summary>
  156. /// 表单页
  157. /// <summary>
  158. /// <returns></returns>
  159. [HttpGet]
  160. public ActionResult Form()
  161. {
  162. return View();
  163. }
  164. [HttpGet]
  165. public ActionResult FormView()
  166. {
  167. return View();
  168. }
  169. public ActionResult AllocationClass()
  170. {
  171. return View();
  172. }
  173. public ActionResult AllocationDormitory()
  174. {
  175. return View();
  176. }
  177. public ActionResult NewAllocationDormitory()
  178. {
  179. return View();
  180. }
  181. public ActionResult NewAllocationBed()
  182. {
  183. return View();
  184. }
  185. #endregion
  186. #region 获取数据
  187. /// <summary>
  188. /// 获取页面显示列表数据
  189. /// <summary>
  190. /// <param name="queryJson">查询参数</param>
  191. /// <returns></returns>
  192. [HttpGet]
  193. [AjaxOnly]
  194. public ActionResult GetPageList(string pagination, string queryJson)
  195. {
  196. Pagination paginationobj = pagination.ToObject<Pagination>();
  197. var data = stuEnrollIBLL.GetPageList(paginationobj, queryJson);
  198. var jsonData = new
  199. {
  200. rows = data,
  201. total = paginationobj.total,
  202. page = paginationobj.page,
  203. records = paginationobj.records
  204. };
  205. return Success(jsonData);
  206. }
  207. [HttpGet]
  208. [AjaxOnly]
  209. public ActionResult GetDormitorys(string pagination, string queryJson)
  210. {
  211. Pagination paginationobj = pagination.ToObject<Pagination>();
  212. var data = stuEnrollIBLL.GetDormitorys(paginationobj, queryJson);
  213. var jsonData = new
  214. {
  215. rows = data,
  216. total = paginationobj.total,
  217. page = paginationobj.page,
  218. records = paginationobj.records
  219. };
  220. return Success(jsonData);
  221. }
  222. /// <summary>
  223. /// 获取页面显示列表数据
  224. /// <summary>
  225. /// <param name="queryJson">查询参数</param>
  226. /// <returns></returns>
  227. [HttpGet]
  228. [AjaxOnly]
  229. public ActionResult GetReportPageList(string pagination, string queryJson)
  230. {
  231. Pagination paginationobj = pagination.ToObject<Pagination>();
  232. var data = stuEnrollIBLL.GetReportPageList(paginationobj, queryJson);
  233. var jsonData = new
  234. {
  235. rows = data,
  236. total = paginationobj.total,
  237. page = paginationobj.page,
  238. records = paginationobj.records
  239. };
  240. return Success(jsonData);
  241. }
  242. /// <summary>
  243. /// 获取表单数据
  244. /// <summary>
  245. /// <returns></returns>
  246. [HttpGet]
  247. [AjaxOnly]
  248. public ActionResult GetFormData(string keyValue)
  249. {
  250. var StuEnrollData = stuEnrollIBLL.GetStuEnrollEntity(keyValue);
  251. if (string.IsNullOrEmpty(StuEnrollData.CheckInUrl))
  252. {
  253. StuEnrollData.CheckInUrl = Guid.NewGuid().ToString();
  254. }
  255. if (string.IsNullOrEmpty(StuEnrollData.SubsidizeUrl))
  256. {
  257. StuEnrollData.SubsidizeUrl = Guid.NewGuid().ToString();
  258. }
  259. if (string.IsNullOrEmpty(StuEnrollData.MilitaryUrl))
  260. {
  261. StuEnrollData.MilitaryUrl = Guid.NewGuid().ToString();
  262. }
  263. var jsonData = new
  264. {
  265. StuEnroll = StuEnrollData,
  266. };
  267. return Success(jsonData);
  268. }
  269. [HttpPost]
  270. [AjaxOnly]
  271. public ActionResult RealationPhoto()
  272. {
  273. var studentList = stuEnrollIBLL.AllStudent().ToList();
  274. foreach (var student in studentList)
  275. {
  276. if (string.IsNullOrEmpty(student.PhotoUrl))
  277. {
  278. student.PhotoUrl = Guid.NewGuid().ToString();
  279. stuEnrollIBLL.SaveEntity(student.StuId,student);
  280. }
  281. var annexEntity = annexesFileIBLL.GetEntityByFolderId(student.PhotoUrl);
  282. if (annexEntity == null)
  283. {
  284. annexEntity=new AnnexesFileEntity();
  285. annexEntity.Create();
  286. annexEntity.F_Id = Guid.NewGuid().ToString();
  287. }
  288. }
  289. return Success("");
  290. }
  291. [HttpGet]
  292. [AjaxOnly]
  293. public ActionResult GetStuInfo(string stuId)
  294. {
  295. var result = stuEnrollIBLL.GetStuInfo(stuId);
  296. return Success(result);
  297. }
  298. [HttpGet]
  299. [AjaxOnly]
  300. public ActionResult GetYearListByClass()
  301. {
  302. var classList = classInfoIBLL.GetAllClass().ToList();
  303. var result = classList.GroupBy(a => a.Grade).Select(m=>m.Key).ToList();
  304. List<object> list=new List<object>();
  305. foreach (var item in result)
  306. {
  307. list.Add(new{year=item});
  308. }
  309. return Success(list);
  310. }
  311. [HttpPost]
  312. [AjaxOnly]
  313. public ActionResult GetStuDefaultInfo(string StuId)
  314. {
  315. var result = stuEnrollIBLL.GetStuDefaultInfo(StuId);
  316. return Success(result);
  317. }
  318. [HttpPost]
  319. [AjaxOnly]
  320. public ActionResult GetPaymentInfo()
  321. {
  322. var result = stuEnrollIBLL.GetPaymentInfo();
  323. return Success(result);
  324. }
  325. [HttpPost]
  326. [AjaxOnly]
  327. public ActionResult GetCheckInStatistics(string DeptNo, string MajorNo, string ClassNo)
  328. {
  329. var result = stuEnrollIBLL.GetCheckInStatistics(DeptNo, MajorNo, ClassNo);
  330. return Success(result);
  331. }
  332. [HttpPost]
  333. [AjaxOnly]
  334. public ActionResult GetHelpStatistics(string DeptNo, string MajorNo, string ClassNo)
  335. {
  336. var result = stuEnrollIBLL.GetHelpStatistics(DeptNo, MajorNo, ClassNo);
  337. return Success(result);
  338. }
  339. [HttpPost]
  340. [AjaxOnly]
  341. public ActionResult GetMilitaryStatistics(string DeptNo, string MajorNo, string ClassNo)
  342. {
  343. var result = stuEnrollIBLL.GetMilitaryStatistics(DeptNo, MajorNo, ClassNo);
  344. return Success(result);
  345. }
  346. /// <summary>
  347. /// 获取左侧树形数据
  348. /// <summary>
  349. /// <returns></returns>
  350. [HttpGet]
  351. [AjaxOnly]
  352. public ActionResult GetTreeNew()
  353. {
  354. var data = stuEnrollIBLL.GetTree();
  355. return Success(data);
  356. }
  357. /// <summary>
  358. /// 获取左侧树形数据
  359. /// <summary>
  360. /// <returns></returns>
  361. [HttpGet]
  362. [AjaxOnly]
  363. public ActionResult GetBedTree(string classNo, string gender)
  364. {
  365. var data = stuEnrollIBLL.GetBedTree(classNo, gender);
  366. return Success(data);
  367. }
  368. #endregion
  369. #region 提交数据
  370. /// <summary>
  371. /// 删除实体数据
  372. /// <param name="keyValue">主键</param>
  373. /// <summary>
  374. /// <returns></returns>
  375. [HttpPost]
  376. [AjaxOnly]
  377. public ActionResult DeleteForm(string keyValue)
  378. {
  379. stuEnrollIBLL.DeleteEntity(keyValue);
  380. return Success("删除成功!");
  381. }
  382. /// <summary>
  383. /// 保存实体数据(新增、修改)
  384. /// <param name="keyValue">主键</param>
  385. /// <summary>
  386. /// <returns></returns>
  387. [HttpPost]
  388. [ValidateAntiForgeryToken]
  389. [AjaxOnly]
  390. public ActionResult SaveForm(string keyValue, string strEntity)
  391. {
  392. StuEnrollEntity entity = strEntity.ToObject<StuEnrollEntity>();
  393. stuEnrollIBLL.SaveEntity(keyValue, entity);
  394. return Success("保存成功!");
  395. }
  396. /// <summary>
  397. /// 保存实收金额
  398. /// <param name="keyValue">主键</param>
  399. /// <summary>
  400. /// <returns></returns>
  401. [HttpPost]
  402. [ValidateAntiForgeryToken]
  403. [AjaxOnly]
  404. public ActionResult SaveActualPayAmount(string keyValue, string strEntity)
  405. {
  406. StuEnrollEntity entity = strEntity.ToObject<StuEnrollEntity>();
  407. var newEntity = stuEnrollIBLL.GetStuEnrollEntity(keyValue);
  408. newEntity.ActualPayAmount = entity.ActualPayAmount;
  409. stuEnrollIBLL.SaveEntity(keyValue, newEntity);
  410. return Success("保存成功!");
  411. }
  412. /// <summary>
  413. /// 保存实体数据(新增、修改)
  414. /// <param name="keyValue">主键</param>
  415. /// <summary>
  416. /// <returns></returns>
  417. [HttpPost]
  418. [AjaxOnly]
  419. public ActionResult EditEnrollType(string stuIds, string enrollType)
  420. {
  421. if (!string.IsNullOrEmpty(stuIds))
  422. {
  423. stuEnrollIBLL.EditEnrollType(stuIds, enrollType);
  424. }
  425. return Success("保存成功!");
  426. }
  427. [HttpPost]
  428. [AjaxOnly]
  429. public ActionResult AllocationClass(string classNo, string dataJson)
  430. {
  431. stuEnrollIBLL.AllocationClass(classNo, dataJson);
  432. return Success("分配成功!");
  433. }
  434. [HttpPost]
  435. [AjaxOnly]
  436. public ActionResult NewAllocationDormitory(string classNo, string dataJson)
  437. {
  438. stuEnrollIBLL.NewAllocationDormitory(classNo, dataJson);
  439. return Success("分配成功!");
  440. }
  441. [HttpPost]
  442. [AjaxOnly]
  443. public ActionResult AllocationDormitory(string dormitoryNo, string stuId, string dormitoryName)
  444. {
  445. stuEnrollIBLL.AllocationDormiotry(dormitoryNo, stuId, dormitoryName);
  446. return Success("分配成功!");
  447. }
  448. [HttpPost]
  449. [AjaxOnly]
  450. public ActionResult SyncDept()
  451. {
  452. stuEnrollIBLL.SyncDept();
  453. return Success("同步成功");
  454. }
  455. [HttpPost]
  456. [AjaxOnly]
  457. public ActionResult SyncMajor()
  458. {
  459. stuEnrollIBLL.SyncMajor();
  460. return Success("同步成功");
  461. }
  462. [HttpPost]
  463. [AjaxOnly]
  464. public ActionResult Sign(string stuId, bool status)
  465. {
  466. var result = stuEnrollIBLL.Sign(stuId, status);
  467. if (result.Item1)
  468. {
  469. return Success(result.Item2);
  470. }
  471. else
  472. {
  473. return Fail(result.Item2);
  474. }
  475. }
  476. [HttpPost]
  477. [AjaxOnly]
  478. public ActionResult AllReport()
  479. {
  480. stuEnrollIBLL.AllReport();
  481. return Success("操作成功");
  482. }
  483. [HttpPost]
  484. [AjaxOnly]
  485. public ActionResult AllPhoto()
  486. {
  487. stuEnrollIBLL.AllPhoto();
  488. return Success("操作成功");
  489. }
  490. [HttpPost]
  491. [AjaxOnly]
  492. public ActionResult AllGetCloth()
  493. {
  494. stuEnrollIBLL.AllGetCloth();
  495. return Success("操作成功");
  496. }
  497. [HttpPost]
  498. [AjaxOnly]
  499. public ActionResult AllGetSize()
  500. {
  501. stuEnrollIBLL.AllGetSize();
  502. return Success("操作成功");
  503. }
  504. [HttpPost]
  505. [AjaxOnly]
  506. public ActionResult AllGetArticle()
  507. {
  508. stuEnrollIBLL.AllGetArticle();
  509. return Success("操作成功");
  510. }
  511. [HttpPost]
  512. [AjaxOnly]
  513. public ActionResult Report(string stuId, bool status)
  514. {
  515. var result = stuEnrollIBLL.Report(stuId, status);
  516. if (result.Item1)
  517. {
  518. return Success(result.Item2);
  519. }
  520. else
  521. {
  522. return Fail(result.Item2);
  523. }
  524. }
  525. [HttpPost]
  526. [AjaxOnly]
  527. public ActionResult Stay(string stuId, bool status, bool payAfter = false)
  528. {
  529. var result = stuEnrollIBLL.Stay(stuId, status, payAfter);
  530. if (result.Item1)
  531. {
  532. return Success(result.Item2);
  533. }
  534. else
  535. {
  536. return Fail(result.Item2);
  537. }
  538. }
  539. [HttpPost]
  540. [AjaxOnly]
  541. public ActionResult AllStay()
  542. {
  543. stuEnrollIBLL.AllStay();
  544. return Success("操作成功");
  545. }
  546. [HttpPost]
  547. [AjaxOnly]
  548. public ActionResult Help(string stuId, bool status, bool payAfter = false)
  549. {
  550. var result = stuEnrollIBLL.Help(stuId, status, payAfter);
  551. if (result.Item1)
  552. {
  553. return Success(result.Item2);
  554. }
  555. else
  556. {
  557. return Fail(result.Item2);
  558. }
  559. }
  560. [HttpPost]
  561. [AjaxOnly]
  562. public ActionResult AllHelp()
  563. {
  564. stuEnrollIBLL.AllHelp();
  565. return Success("操作成功");
  566. }
  567. [HttpPost]
  568. [AjaxOnly]
  569. public ActionResult Military(string stuId, bool status, bool payAfter = false)
  570. {
  571. var result = stuEnrollIBLL.Military(stuId, status, payAfter);
  572. if (result.Item1)
  573. {
  574. return Success(result.Item2);
  575. }
  576. else
  577. {
  578. return Fail(result.Item2);
  579. }
  580. }
  581. [HttpPost]
  582. [AjaxOnly]
  583. public ActionResult AllMilitary()
  584. {
  585. stuEnrollIBLL.AllMilitary();
  586. return Success("成功");
  587. }
  588. [HttpPost]
  589. [AjaxOnly]
  590. public ActionResult IsPay(string stuId, bool status)
  591. {
  592. var result = stuEnrollIBLL.IsPay(stuId, status);
  593. if (result.Item1)
  594. {
  595. return Success(result.Item2);
  596. }
  597. else
  598. {
  599. return Fail(result.Item2);
  600. }
  601. }
  602. [HttpPost]
  603. [AjaxOnly]
  604. public ActionResult IsPhoto(string stuId, string base64url)
  605. {
  606. var loginuser = LoginUserInfo.Get();
  607. //头像处理
  608. var folderId = Guid.NewGuid().ToString();
  609. string filePath = Config.GetValue("AnnexesFile");
  610. string uploadDate = DateTime.Now.ToString("yyyyMMdd");
  611. string FileEextension = ".png";
  612. string fileGuid = Guid.NewGuid().ToString();
  613. string virtualPath = string.Format("{0}/{1}/{2}/{3}{4}", filePath, loginuser.account, uploadDate, fileGuid, FileEextension);
  614. //创建文件夹
  615. string path = Path.GetDirectoryName(virtualPath);
  616. Directory.CreateDirectory(path);
  617. AnnexesFileEntity fileAnnexesEntity = new AnnexesFileEntity();
  618. if (!System.IO.File.Exists(virtualPath))
  619. {
  620. byte[] bytes = Convert.FromBase64String(base64url.Replace("data:image/png;base64,", ""));
  621. FileInfo file = new FileInfo(virtualPath);
  622. FileStream fs = file.Create();
  623. fs.Write(bytes, 0, bytes.Length);
  624. fs.Close();
  625. //文件信息写入数据库
  626. fileAnnexesEntity.F_Id = fileGuid;
  627. fileAnnexesEntity.F_FileName = "userphoto.png";
  628. fileAnnexesEntity.F_FilePath = virtualPath;
  629. fileAnnexesEntity.F_FileSize = bytes.Length.ToString();
  630. fileAnnexesEntity.F_FileExtensions = FileEextension;
  631. fileAnnexesEntity.F_FileType = FileEextension.Replace(".", "");
  632. fileAnnexesEntity.F_CreateUserId = loginuser.userId;
  633. fileAnnexesEntity.F_CreateUserName = loginuser.realName;
  634. annexesFileIBLL.SaveEntity(folderId, fileAnnexesEntity);
  635. }
  636. var result = stuEnrollIBLL.IsPhoto(stuId, true, fileGuid);
  637. if (result.Item1)
  638. {
  639. return Success(result.Item2);
  640. }
  641. else
  642. {
  643. return Fail(result.Item2);
  644. }
  645. }
  646. [HttpPost]
  647. [AjaxOnly]
  648. public ActionResult GetCloth(string stuId, bool status)
  649. {
  650. var result = stuEnrollIBLL.GetCloth(stuId, status);
  651. if (result.Item1)
  652. {
  653. return Success(result.Item2);
  654. }
  655. else
  656. {
  657. return Fail(result.Item2);
  658. }
  659. }
  660. [HttpPost]
  661. [AjaxOnly]
  662. public ActionResult GetClothSize(string stuId, bool status)
  663. {
  664. var result = stuEnrollIBLL.GetClothSize(stuId, status);
  665. if (result.Item1)
  666. {
  667. return Success(result.Item2);
  668. }
  669. else
  670. {
  671. return Fail(result.Item2);
  672. }
  673. }
  674. [HttpPost]
  675. [AjaxOnly]
  676. public ActionResult GetArticles(string stuId, bool status)
  677. {
  678. var result = stuEnrollIBLL.GetArticles(stuId, status);
  679. if (result.Item1)
  680. {
  681. return Success(result.Item2);
  682. }
  683. else
  684. {
  685. return Fail(result.Item2);
  686. }
  687. }
  688. [HttpPost]
  689. [AjaxOnly]
  690. public ActionResult GetMoney()
  691. {
  692. stuEnrollIBLL.GetMoney();
  693. return Success("操作成功");
  694. }
  695. /// <summary>
  696. /// 下载文件
  697. /// </summary>
  698. /// <param name="fileId">文件id</param>
  699. /// <returns></returns>
  700. [HttpPost]
  701. public void DownWrod()
  702. {
  703. ExcelHelper.aaaaa();
  704. }
  705. /// <summary>
  706. /// 关联照片
  707. /// </summary>
  708. /// <returns></returns>
  709. public ActionResult RelationPhoto()
  710. {
  711. stuEnrollIBLL.RelationPhoto();
  712. return Success("关联成功");
  713. }
  714. /// <summary>
  715. /// 同步学生数据
  716. /// </summary>
  717. /// <returns></returns>
  718. public ActionResult Synchronization()
  719. {
  720. stuEnrollIBLL.Synchronization();
  721. return Success("同步成功");
  722. }
  723. #endregion
  724. }
  725. }