GraduateCardApplyController.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using Bowin.Web.Controls.Mvc;
  7. using Bowin.Common.Utility;
  8. using Bowin.Common.Data;
  9. using Bowin.Common.JSON;
  10. using EMIS.Utility;
  11. using EMIS.ViewModel;
  12. using EMIS.Web.Controls;
  13. using EMIS.CommonLogic.GraduationManage.GraduateCardManage;
  14. using EMIS.ViewModel.GraduationManage.GraduateCardManage;
  15. namespace EMIS.Web.Controllers.GraduationManage.GraduateCardManage
  16. {
  17. [Authorization]
  18. public class GraduateCardApplyController : Controller
  19. {
  20. public IGraduateCardApplyServices GraduateCardApplyServices { get; set; }
  21. /// <summary>
  22. /// 去向申请页面
  23. /// </summary>
  24. /// <returns></returns>
  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. var gradSchoolyearID = pararms.getExtraGuid("GradSchoolyearDropdown");
  39. var campusID = pararms.getExtraGuid("CampusDropdown");
  40. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  41. var yearID = pararms.getExtraInt("DictionarySchoolyear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionarySchoolyear");
  42. var standardID = pararms.getExtraInt("DictionaryStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStandard");
  43. var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  44. var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
  45. var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
  46. //毕业类型
  47. var graduationTypeID = pararms.getExtraInt("DictionaryGraduationType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGraduationType");
  48. //在校状态
  49. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  50. //审核状态
  51. var approvalStatus = pararms.getExtraInt("DictionaryApprovalStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryApprovalStatus");
  52. return base.Json(GraduateCardApplyServices.GetGraduateCardApplyViewGrid(configuretView, gradSchoolyearID, campusID, collegeID,
  53. yearID, standardID, educationID, learningformID, learnSystem, graduationTypeID, inSchoolStatus, approvalStatus, (int)pararms.page, (int)pararms.rows));
  54. }
  55. /// <summary>
  56. /// 名单生成(新增、修改)
  57. /// 新增包括:毕业学期小于等于当前启用的毕业学期、学籍信息为在校(排除在校状态为结业、毕业的信息)、在毕业申请允许最大年限(年)范围内
  58. /// 修改:未提交
  59. /// 业务主键:学生信息ID、毕业学期ID(实际的毕业学期)
  60. /// </summary>
  61. /// <param name="pararms"></param>
  62. /// <returns></returns>
  63. public ActionResult GraduateCardApplyCreate(QueryParamsModel pararms)
  64. {
  65. try
  66. {
  67. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  68. string result = GraduateCardApplyServices.GraduateCardApplyEdit();
  69. return Json(new ReturnMessage()
  70. {
  71. IsSuccess = true,
  72. Message = "生成成功" + result + "。"
  73. });
  74. }
  75. catch (Exception ex)
  76. {
  77. return Json(new ReturnMessage()
  78. {
  79. IsSuccess = false,
  80. Message = "生成失败,原因:" + ex.Message
  81. });
  82. }
  83. }
  84. /// <summary>
  85. /// 复制新增
  86. /// </summary>
  87. /// <param name="graduateCardApplyID"></param>
  88. /// <returns></returns>
  89. public ActionResult CopyAdd(Guid graduateCardApplyID)
  90. {
  91. GraduateCardApplyView graduateCardApplyView = new GraduateCardApplyView();
  92. graduateCardApplyView = GraduateCardApplyServices.GetGraduateCardApplyView(graduateCardApplyID);
  93. return View("Edit", graduateCardApplyView);
  94. }
  95. /// <summary>
  96. /// 复制新增
  97. /// </summary>
  98. /// <param name="graduateCardApplyView"></param>
  99. /// <returns></returns>
  100. [HttpPost]
  101. public ActionResult CopyAdd(GraduateCardApplyView graduateCardApplyView)
  102. {
  103. graduateCardApplyView.GraduateCardApplyID = Guid.Empty;
  104. return this.Edit(graduateCardApplyView);
  105. }
  106. /// <summary>
  107. /// 编辑(新增、修改,业务主键:学生信息ID、毕业学期ID(实际的毕业学期))
  108. /// </summary>
  109. /// <param name="graduateCardApplyID"></param>
  110. /// <returns></returns>
  111. [HttpGet]
  112. public ActionResult Edit(Guid? graduateCardApplyID)
  113. {
  114. GraduateCardApplyView graduateCardApplyView = new GraduateCardApplyView();
  115. if (graduateCardApplyID.HasValue && graduateCardApplyID != Guid.Empty)
  116. {
  117. graduateCardApplyView = GraduateCardApplyServices.GetGraduateCardApplyView(graduateCardApplyID);
  118. }
  119. else
  120. {
  121. graduateCardApplyView.GraduatingSemesterID = BaseExtensions.GetGradSchoolYearID();
  122. }
  123. return View(graduateCardApplyView);
  124. }
  125. /// <summary>
  126. /// 编辑(新增、修改,业务主键:学生信息ID、毕业学期ID(实际的毕业学期))
  127. /// </summary>
  128. /// <param name="graduateCardApplyView"></param>
  129. /// <returns></returns>
  130. [HttpPost]
  131. public ActionResult Edit(GraduateCardApplyView graduateCardApplyView)
  132. {
  133. try
  134. {
  135. var sessionName = FileUploadHelper.GetFileUploadSessionName(graduateCardApplyView.GraduateCardApplyID);
  136. var fileList = (List<FileUploadView>)Session[sessionName];
  137. GraduateCardApplyServices.GraduateCardApplyEdit(graduateCardApplyView, fileList);
  138. return Json(new ReturnMessage()
  139. {
  140. IsSuccess = true,
  141. Message = "保存成功。"
  142. });
  143. }
  144. catch (Exception ex)
  145. {
  146. return Json(new ReturnMessage()
  147. {
  148. IsSuccess = false,
  149. Message = "保存失败,原因:" + ex.Message
  150. });
  151. }
  152. }
  153. /// <summary>
  154. /// 去向申请批量新增(业务主键:学生信息ID、毕业学期ID(实际的毕业学期))
  155. /// </summary>
  156. /// <returns></returns>
  157. [HttpGet]
  158. public ActionResult GraduateCardApplyBatchAdd()
  159. {
  160. GraduateCardApplyView graduateCardApplyView = new GraduateCardApplyView();
  161. return View(graduateCardApplyView);
  162. }
  163. /// <summary>
  164. /// 去向申请批量新增(业务主键:学生信息ID、毕业学期ID(实际的毕业学期))
  165. /// </summary>
  166. /// <param name="graduateCardApplyView"></param>
  167. /// <returns></returns>
  168. public ActionResult GraduateCardApplyBatchAdd(GraduateCardApplyView graduateCardApplyView)
  169. {
  170. try
  171. {
  172. var graduationStudentViewList = Request["graduationStudentViewList"].JsonToObject<List<GraduateCardApplyView>>();
  173. string result = GraduateCardApplyServices.GraduateCardApplyBatchAdd(graduationStudentViewList, graduateCardApplyView);
  174. return Json(new ReturnMessage()
  175. {
  176. IsSuccess = true,
  177. Message = "新增成功" + result + "。"
  178. });
  179. }
  180. catch (Exception ex)
  181. {
  182. return Json(new ReturnMessage()
  183. {
  184. IsSuccess = false,
  185. Message = "新增失败,原因:" + ex.Message
  186. });
  187. }
  188. }
  189. /// <summary>
  190. /// 查询未新增毕业学生信息GraduateCardApplyView
  191. /// </summary>
  192. /// <param name="pararms"></param>
  193. /// <returns></returns>
  194. [HttpPost]
  195. public ActionResult GraduationStudentList(QueryParamsModel pararms)
  196. {
  197. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  198. var campusID = pararms.getExtraGuid("CampusDropdown");
  199. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  200. var schoolyearID = pararms.getExtraInt("DictionarySchoolyear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionarySchoolyear");
  201. var standardID = pararms.getExtraInt("DictionaryStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStandard");
  202. var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  203. var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
  204. var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
  205. //在校状态
  206. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  207. //预毕业学期(年级专业对应的毕业学期)
  208. var gradSchoolyearID = pararms.getExtraGuid("GradSchoolyearDropdown");
  209. return base.Json(GraduateCardApplyServices.GetGraduationStudentNoAddViewGrid(configuretView, campusID, collegeID, schoolyearID,
  210. standardID, educationID, learningformID, learnSystem, inSchoolStatus, gradSchoolyearID, (int)pararms.page, (int)pararms.rows));
  211. }
  212. /// <summary>
  213. /// 删除
  214. /// </summary>
  215. /// <param name="graduateCardApplyIDs"></param>
  216. /// <returns></returns>
  217. [HttpPost]
  218. public ActionResult Delete(string graduateCardApplyIDs)
  219. {
  220. try
  221. {
  222. List<Guid?> list = graduateCardApplyIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
  223. .Select(x => (Guid?)new Guid(x)).ToList();
  224. GraduateCardApplyServices.GraduateCardApplyDelete(list);
  225. return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功。" });
  226. }
  227. catch (Exception ex)
  228. {
  229. return base.Json(new ReturnMessage { IsSuccess = false, Message = "删除失败,原因:" + ex.Message });
  230. }
  231. }
  232. /// <summary>
  233. /// 根据去向申请查看对应的最终成绩信息
  234. /// </summary>
  235. /// <returns></returns>
  236. public ActionResult FinallyScoreList()
  237. {
  238. return View();
  239. }
  240. /// <summary>
  241. /// 根据去向申请查看对应的最终成绩信息
  242. /// </summary>
  243. /// <param name="pararms"></param>
  244. /// <returns></returns>
  245. [HttpPost]
  246. public ActionResult FinallyScoreList(QueryParamsModel pararms)
  247. {
  248. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  249. var graduateCardApplyID = Request["graduateCardApplyID"].ParseStrTo<Guid>();
  250. var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
  251. var courseTypeID = pararms.getExtraInt("DictionaryCourseType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCourseType");
  252. var courseSelectTypeID = pararms.getExtraInt("DictionaryCourseSelectType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCourseSelectType");
  253. var examsCategoryID = pararms.getExtraInt("DictionaryExamsCategory") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryExamsCategory");
  254. var starttermID = pararms.getExtraInt("DictionaryStartterm") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStartterm");
  255. var isMainCourse = pararms.getExtraInt("DictionaryIsMainCourse") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryIsMainCourse");
  256. var handleModeID = pararms.getExtraInt("DictionaryHandleMode") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryHandleMode");
  257. //是否计划(执行计划)
  258. var isExecutablePlan = pararms.getExtraInt("DictionaryIsExecutablePlan") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryIsExecutablePlan");
  259. //计划状态(执行计划)
  260. var executablePlanStatus = pararms.getExtraInt("DictionaryExecutablePlanStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryExecutablePlanStatus");
  261. return Json(GraduateCardApplyServices.GetFinallyScoreViewGrid(configuretView, graduateCardApplyID, schoolyearID, courseTypeID,
  262. courseSelectTypeID, examsCategoryID, starttermID, isMainCourse, handleModeID, isExecutablePlan, executablePlanStatus, (int)pararms.page, (int)pararms.rows));
  263. }
  264. /// <summary>
  265. /// 最终成绩明细Excel导出
  266. /// </summary>
  267. /// <returns></returns>
  268. [HttpPost]
  269. public ActionResult FinallyScoreListExcel()
  270. {
  271. return null;
  272. }
  273. /// <summary>
  274. /// Excel导出
  275. /// </summary>
  276. /// <returns></returns>
  277. [HttpPost]
  278. public ActionResult Excel()
  279. {
  280. NpoiExcelHelper neh = new NpoiExcelHelper();
  281. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  282. var gradSchoolyearID = Request.Form["GradSchoolyearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["GradSchoolyearDropdown"].ParseStrTo<Guid>();
  283. var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
  284. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  285. var yearID = Request.Form["DictionarySchoolyear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionarySchoolyear"].ParseStrTo<int>();
  286. var standardID = Request.Form["DictionaryStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryStandard"].ParseStrTo<int>();
  287. var educationID = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
  288. var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo<int>();
  289. var learnSystem = Request.Form["DictionaryLearnSystem"].ToString();
  290. //毕业类型
  291. var graduationTypeID = Request.Form["DictionaryGraduationType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGraduationType"].ParseStrTo<int>();
  292. //在校状态
  293. var inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>();
  294. //审核状态
  295. var approvalStatus = Request.Form["DictionaryApprovalStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryApprovalStatus"].ParseStrTo<int>();
  296. var dt = GraduateCardApplyServices.GetGraduateCardApplyViewList(configuretView, gradSchoolyearID, campusID, collegeID, yearID,
  297. standardID, educationID, learningformID, learnSystem, graduationTypeID, inSchoolStatus, approvalStatus)
  298. .Select(x => new
  299. {
  300. x.GraduatingSemesterCode,
  301. x.StudentNo,
  302. x.UserName,
  303. x.SexName,
  304. x.GraduationTypeName,
  305. BirthDate = x.BirthDate.HasValue ? x.BirthDate.Value.ToString("yyyyMMdd") : "",
  306. x.StandardID,
  307. x.StandardCode,
  308. x.StandardName,
  309. x.SchoolyearID,
  310. x.CampusName,
  311. x.CollegeNo,
  312. x.CollegeName,
  313. x.GrademajorCode,
  314. x.GrademajorName,
  315. x.ClassNo,
  316. x.ClassName,
  317. x.EducationName,
  318. x.LearningformName,
  319. LearnSystem = x.LearnSystem.HasValue ? x.LearnSystem.Value.ToString("#.#") : null,
  320. x.ExamineeNum,
  321. x.NationName,
  322. x.PoliticsName,
  323. x.IDNumber,
  324. EntranceDate = x.EntranceDate.HasValue ? x.EntranceDate.Value.ToString("yyyyMMdd") : "",
  325. x.ZIPCode,
  326. x.Telephone,
  327. x.Address,
  328. x.InSchoolStatusName,
  329. x.StudentStatusName,
  330. x.FinallyScoreCount,
  331. x.ApprovalStatusName,
  332. x.Remark
  333. }).ToTable();
  334. string[] liststring = {
  335. "毕业学期", "学号", "姓名", "性别", "毕业类型", "出生日期", "专业ID(Value)", "专业代码", "专业名称",
  336. "年级", RSL.Get("CampusName"), RSL.Get("CollegeCode"), RSL.Get("CollegeName"), "年级专业编号",
  337. "年级专业名称", "班级编号", "班级名称", RSL.Get("EducationID"), "学习形式", "学制",
  338. "考生号", "民族", "政治面貌", "身份证号", "入学日期", "邮政编码", "联系电话", "通讯地址",
  339. "在校状态", "学籍状态", "已修门数", "审核状态", "备注"
  340. };
  341. neh.Export(dt, liststring, "去向申请信息" + DateTime.Now.ToString("yyyyMMdd"));
  342. return Json(new ReturnMessage()
  343. {
  344. IsSuccess = true,
  345. Message = "导出成功。"
  346. });
  347. }
  348. }
  349. }