StudentChargeDelayController.cs 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMIS.CommonLogic.ChargeManage.ChargeSituation;
  7. using EMIS.ViewModel;
  8. using EMIS.Web.Controls;
  9. using Bowin.Web.Controls.Mvc;
  10. using EMIS.ViewModel.ChargeManage.ChargeSituation;
  11. using Bowin.Common.Utility;
  12. using Bowin.Common.Data;
  13. using EMIS.Utility;
  14. namespace EMIS.Web.Controllers.StudentSystem.Charge
  15. {
  16. [Authorization]
  17. public class StudentChargeDelayController : Controller
  18. {
  19. public IChargeDelayServices ChargeDelayServices { get; set; }
  20. /// <summary>
  21. /// 缓交申请页面(学生平台)
  22. /// </summary>
  23. /// <returns></returns>
  24. [HttpGet]
  25. public ActionResult List()
  26. {
  27. return View();
  28. }
  29. /// <summary>
  30. /// 缓交申请列表查询(学生平台)
  31. /// </summary>
  32. /// <param name="pararms"></param>
  33. /// <returns></returns>
  34. [HttpPost]
  35. public ActionResult List(QueryParamsModel pararms)
  36. {
  37. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  38. //登录用户user
  39. var user = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  40. var chargeYearID = pararms.getExtraInt("ChargeYearDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ChargeYearDropDown");
  41. var chargeProjectID = pararms.getExtraGuid("ChargeProjectComboGrid");
  42. //状态
  43. var chargeDelayStatus = pararms.getExtraInt("DictionaryChargeDelayStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryChargeDelayStatus");
  44. return base.Json(ChargeDelayServices.GetStudentChargeDelayViewGrid(configuretView, user.UserID, chargeYearID, chargeProjectID, chargeDelayStatus, (int)pararms.page, (int)pararms.rows));
  45. }
  46. /// <summary>
  47. /// 编辑(申请、修改)
  48. /// </summary>
  49. /// <param name="chargeDelayID"></param>
  50. /// <returns></returns>
  51. [HttpGet]
  52. public ActionResult Edit(Guid? chargeDelayID)
  53. {
  54. ChargeDelayView chargeDelayView = new ChargeDelayView();
  55. if (chargeDelayID.HasValue && chargeDelayID != Guid.Empty)
  56. {
  57. chargeDelayView = ChargeDelayServices.GetChargeDelayEditView(chargeDelayID);
  58. }
  59. else
  60. {
  61. //登录用户user
  62. var user = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  63. chargeDelayView.UserID = user.UserID;
  64. chargeDelayView.ChargeYear = BaseExtensions.GetCurrentYearID();
  65. }
  66. return View(chargeDelayView);
  67. }
  68. /// <summary>
  69. /// 编辑(申请、修改)
  70. /// </summary>
  71. /// <param name="chargeDelayView"></param>
  72. /// <returns></returns>
  73. [HttpPost]
  74. public ActionResult Edit(ChargeDelayView chargeDelayView)
  75. {
  76. try
  77. {
  78. ChargeDelayServices.ChaegeDelayEdit(chargeDelayView);
  79. return Json(new ReturnMessage()
  80. {
  81. IsSuccess = true,
  82. Message = "保存成功。"
  83. });
  84. }
  85. catch (Exception ex)
  86. {
  87. return Json(new ReturnMessage()
  88. {
  89. IsSuccess = false,
  90. Message = "保存失败,原因:" + ex.Message + "。"
  91. });
  92. }
  93. }
  94. /// <summary>
  95. /// 导出Excel
  96. /// </summary>
  97. /// <returns></returns>
  98. [HttpPost]
  99. public ActionResult Excel()
  100. {
  101. NpoiExcelHelper neh = new NpoiExcelHelper();
  102. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  103. //登录用户user
  104. var user = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  105. var chargeYearID = Request.Form["ChargeYearDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ChargeYearDropDown"].ParseStrTo<int>();
  106. var chargeProjectID = Request.Form["ChargeProjectComboGrid"].ParseStrTo<Guid>();
  107. //审批状态
  108. var chargeDelayStatus = Request.Form["DictionaryChargeDelayStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryChargeDelayStatus"].ParseStrTo<int>();
  109. var dt = ChargeDelayServices.GetStudentChargeDelayViewList(configuretView, user.UserID, chargeYearID, chargeProjectID, chargeDelayStatus)
  110. .Select(x => new
  111. {
  112. x.StudentNo,
  113. x.UserName,
  114. x.SexName,
  115. x.ClassNo,
  116. x.ClassName,
  117. x.GradeMajorCode,
  118. x.GradeMajoyStr,
  119. x.CollegeCode,
  120. x.CollegeStr,
  121. x.ChargeYear,
  122. x.ChargeProjectStr,
  123. x.ActualAmount,
  124. x.PaidAmount,
  125. x.DelayAmount,
  126. x.InSchoolStatusName,
  127. x.Reason,
  128. x.RecordStatusName
  129. }).ToTable();
  130. string[] liststring = { "学号", "姓名", "性别", "班级编号", "班级名称", "年级专业编号", "年级专业名称",
  131. RSL.Get("CollegeCode"), RSL.Get("CollegeName"), "缴费学年", "收费项目",
  132. "实收金额", "已缴金额", "缓交金额", "在校状态", "缓交原因", "状态"
  133. };
  134. neh.Export(dt, liststring, "缓交申请信息" + DateTime.Now.ToString("yyyyMMdd") + "(" + user.Name.ToString() + ")");
  135. return Json(new ReturnMessage()
  136. {
  137. IsSuccess = true,
  138. Message = "导出成功。"
  139. });
  140. }
  141. }
  142. }