ArrearsListController.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMIS.ViewModel;
  7. using EMIS.Web.Controls;
  8. using Bowin.Common.Utility;
  9. using Bowin.Common.Data;
  10. using Bowin.Web.Controls.Mvc;
  11. using EMIS.CommonLogic.ChargeManage.ArrearsSituation;
  12. using EMIS.ViewModel.ChargeManage.ArrearsSituation;
  13. using Bowin.Common.Linq.Entity;
  14. using EMIS.CommonLogic.CalendarManage;
  15. using EMIS.Utility;
  16. namespace EMIS.Web.Controllers.ChargeManage.ArrearsSituation
  17. {
  18. [Authorization]
  19. public class ArrearsListController : Controller
  20. {
  21. public IArrearsListServices ArrearsListServices { get; set; }
  22. /// <summary>
  23. /// 欠费名单页面
  24. /// </summary>
  25. /// <returns></returns>
  26. public ActionResult List()
  27. {
  28. return View();
  29. }
  30. /// <summary>
  31. /// 欠费名单列表查询
  32. /// </summary>
  33. /// <param name="pararms"></param>
  34. /// <returns></returns>
  35. [HttpPost]
  36. public ActionResult List(QueryParamsModel pararms)
  37. {
  38. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  39. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  40. var yearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown");
  41. var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
  42. var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  43. var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
  44. var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
  45. //欠费状态
  46. var isArrear = pararms.getExtraInt("IsArrearDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsArrearDropDown");
  47. //登录控制
  48. var isControl = pararms.getExtraInt("DictionaryIsControl") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryIsControl");
  49. //在校状态
  50. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  51. return base.Json(ArrearsListServices.GetArrearListViewGrid(configuretView, collegeID, yearID, standardID, educationID,
  52. learningformID, learnSystem, isArrear, isControl, inSchoolStatus, (int)pararms.page, (int)pararms.rows));
  53. }
  54. public ActionResult AdultList()
  55. {
  56. return View();
  57. }
  58. /// <summary>
  59. /// 欠费名单列表查询(成教)
  60. /// </summary>
  61. /// <param name="pararms"></param>
  62. /// <returns></returns>
  63. [HttpPost]
  64. public ActionResult AdultList(QueryParamsModel pararms)
  65. {
  66. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  67. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  68. var yearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown");
  69. var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
  70. var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  71. var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
  72. var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
  73. //欠费状态
  74. var isArrear = pararms.getExtraInt("IsArrearDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsArrearDropDown");
  75. //登录控制
  76. var isControl = pararms.getExtraInt("DictionaryIsControl") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryIsControl");
  77. //在校状态
  78. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  79. return base.Json(ArrearsListServices.GetArrearListViewGridForAdult(configuretView, collegeID, yearID, standardID, educationID,
  80. learningformID, learnSystem, isArrear, isControl, inSchoolStatus, (int)pararms.page, (int)pararms.rows));
  81. }
  82. /// <summary>
  83. /// 放行(个性化控制登录)
  84. /// </summary>
  85. /// <param name="userIDs"></param>
  86. /// <returns></returns>
  87. [HttpPost]
  88. public ActionResult Pass(string userIDs)
  89. {
  90. try
  91. {
  92. List<Guid?> list = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
  93. .Select(x => (Guid?)new Guid(x)).ToList();
  94. ArrearsListServices.Pass(list);
  95. return Json(new ReturnMessage()
  96. {
  97. IsSuccess = true,
  98. Message = "放行成功。"
  99. });
  100. }
  101. catch (Exception ex)
  102. {
  103. return Json(new ReturnMessage()
  104. {
  105. IsSuccess = false,
  106. Message = "放行失败,原因:" + ex.Message + "。"
  107. });
  108. }
  109. }
  110. /// <summary>
  111. /// 控制(个性化控制登录)
  112. /// </summary>
  113. /// <param name="userIDs"></param>
  114. /// <returns></returns>
  115. [HttpPost]
  116. public ActionResult Control(string userIDs)
  117. {
  118. try
  119. {
  120. List<Guid?> list = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
  121. .Select(x => (Guid?)new Guid(x)).ToList();
  122. ArrearsListServices.Control(list);
  123. return Json(new ReturnMessage()
  124. {
  125. IsSuccess = true,
  126. Message = "控制成功。"
  127. });
  128. }
  129. catch (Exception ex)
  130. {
  131. return Json(new ReturnMessage()
  132. {
  133. IsSuccess = false,
  134. Message = "控制失败,原因:" + ex.Message + "。"
  135. });
  136. }
  137. }
  138. /// <summary>
  139. /// Excel导出
  140. /// </summary>
  141. /// <returns></returns>
  142. [HttpPost]
  143. public ActionResult Excel()
  144. {
  145. NpoiExcelHelper neh = new NpoiExcelHelper();
  146. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  147. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  148. var yearID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>();
  149. var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
  150. var educationID = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
  151. var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo<int>();
  152. var learnSystem = Request.Form["DictionaryLearnSystem"].ToString();
  153. //欠费状态
  154. var isArrear = Request.Form["IsArrearDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["IsArrearDropDown"].ParseStrTo<int>();
  155. //登录控制
  156. var isControl = Request.Form["DictionaryIsControl"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryIsControl"].ParseStrTo<int>();
  157. //在校状态
  158. var inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>();
  159. var dt = ArrearsListServices.GetArrearsListViewList(configuretView, collegeID, yearID, standardID, educationID,
  160. learningformID, learnSystem, isArrear, isControl, inSchoolStatus)
  161. .Select(x => new
  162. {
  163. x.StudentNo,
  164. x.UserName,
  165. x.SexName,
  166. x.ClassNo,
  167. x.ClassName,
  168. x.GradeMajorCode,
  169. x.GrademajorStr,
  170. x.CollegeCode,
  171. x.CollegeStr,
  172. x.Amount,
  173. x.ChargeAmount,
  174. x.ActualAmount,
  175. x.DelayAmount,
  176. x.PaidAmount,
  177. x.AmountSum,
  178. x.IsArrearName,
  179. x.IsControlName,
  180. x.GradeStr,
  181. x.StandardID,
  182. x.StandardCode,
  183. x.MajorStr,
  184. x.EducationName,
  185. x.LearningformName,
  186. x.LearnSystem,
  187. x.InSchoolStatusName,
  188. x.StudentStatusName
  189. }).ToTable();
  190. string[] liststring = {
  191. "学号", "姓名", "性别", "班级编号", "班级名称", "年级专业编号", "年级专业名称",
  192. RSL.Get("CollegeCode"), RSL.Get("CollegeName"), "应收金额", "调整金额", "实收金额",
  193. "缓交金额", "已缴金额", "欠费金额", "欠费状态", "登录控制",
  194. "年级", "专业ID(Value)", "专业代码", "专业名称", RSL.Get("EducationID"), "学习形式",
  195. "学制", "在校状态", "学籍状态"
  196. };
  197. neh.Export(dt, liststring, "欠费名单信息" + DateTime.Now.ToString("yyyyMMdd"));
  198. return Json(new ReturnMessage()
  199. {
  200. IsSuccess = true,
  201. Message = "导出成功。"
  202. });
  203. }
  204. /// <summary>
  205. /// Excel导出
  206. /// </summary>
  207. /// <returns></returns>
  208. [HttpPost]
  209. public ActionResult AdultExcel()
  210. {
  211. NpoiExcelHelper neh = new NpoiExcelHelper();
  212. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  213. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  214. var yearID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>();
  215. var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
  216. var educationID = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
  217. var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo<int>();
  218. var learnSystem = Request.Form["DictionaryLearnSystem"].ToString();
  219. //欠费状态
  220. var isArrear = Request.Form["IsArrearDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["IsArrearDropDown"].ParseStrTo<int>();
  221. //登录控制
  222. var isControl = Request.Form["DictionaryIsControl"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryIsControl"].ParseStrTo<int>();
  223. //在校状态
  224. var inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>();
  225. var dt = ArrearsListServices.GetArrearsListViewList(configuretView, collegeID, yearID, standardID, educationID,
  226. learningformID, learnSystem, isArrear, isControl, inSchoolStatus).Where(x=>x.AmountSum>0)
  227. .Select(x => new
  228. {
  229. x.StudentNo,
  230. x.UserName,
  231. x.SexName,
  232. x.ClassNo,
  233. x.ClassName,
  234. x.GradeMajorCode,
  235. x.GrademajorStr,
  236. x.CollegeCode,
  237. x.CollegeStr,
  238. x.Amount,
  239. x.ChargeAmount,
  240. x.ActualAmount,
  241. x.DelayAmount,
  242. x.PaidAmount,
  243. x.AmountSum,
  244. x.IsArrearName,
  245. x.IsControlName,
  246. x.GradeStr,
  247. x.StandardID,
  248. x.StandardCode,
  249. x.MajorStr,
  250. x.EducationName,
  251. x.LearningformName,
  252. x.LearnSystem,
  253. x.InSchoolStatusName,
  254. x.StudentStatusName
  255. }).ToTable();
  256. string[] liststring = {
  257. "学号", "姓名", "性别", "班级编号", "班级名称", "年级专业编号", "年级专业名称",
  258. RSL.Get("CollegeCode"), RSL.Get("CollegeName"), "应收金额", "调整金额", "实收金额",
  259. "缓交金额", "已缴金额", "欠费金额", "欠费状态", "登录控制",
  260. "年级", "专业ID(Value)", "专业代码", "专业名称", RSL.Get("EducationID"), "学习形式",
  261. "学制", "在校状态", "学籍状态"
  262. };
  263. neh.Export(dt, liststring, "欠费名单信息" + DateTime.Now.ToString("yyyyMMdd"));
  264. return Json(new ReturnMessage()
  265. {
  266. IsSuccess = true,
  267. Message = "导出成功。"
  268. });
  269. }
  270. }
  271. }