DifferentDynamicApprovalController.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  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.Students;
  7. using EMIS.ViewModel;
  8. using Bowin.Web.Controls.Mvc;
  9. using EMIS.Web.Controls;
  10. using EMIS.ViewModel.DifferentDynamic;
  11. using Bowin.Common.Linq.Entity;
  12. using Bowin.Common.JSON;
  13. using EMIS.ViewModel.WorkflowManage;
  14. using Bowin.Common.Mapping;
  15. using Bowin.Common.Utility;
  16. using Bowin.Common.Linq;
  17. using Bowin.Common.Mvc;
  18. using EMIS.CommonLogic.CalendarManage;
  19. using EMIS.Utility.FormValidate;
  20. namespace EMIS.Web.Controllers.DifferentDynamic
  21. {
  22. /// <summary>
  23. /// 异动审批
  24. /// </summary>
  25. [Authorization]
  26. public class DifferentDynamicApprovalController : DifferentDynamicController
  27. {
  28. public ISchoolYearServices SchoolYearServices { get; set; }
  29. //[StaticFileWriteFilter]
  30. public ActionResult List()
  31. {
  32. var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
  33. ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
  34. return View();
  35. }
  36. /// <summary>
  37. /// 列表查询
  38. /// </summary>
  39. /// <param name="pararms"></param>
  40. /// <returns></returns>
  41. [HttpPost]
  42. public ActionResult List(QueryParamsModel pararms)
  43. {
  44. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  45. var campusID = pararms.getExtraGuid("CampusDropdown"); //校区
  46. var collegeID = pararms.getExtraGuid("CollegeDropdown"); //院系所
  47. var year = CheckIsSelectAll(pararms.getExtraInt("SchoolyearDictionaryDropDown")); //年级
  48. var standard = CheckIsSelectAll(pararms.getExtraInt("StandardDictionaryDropDown")); //专业名称
  49. var education = CheckIsSelectAll(pararms.getExtraInt("DictionaryEducation")); //培养层次
  50. var learningform = CheckIsSelectAll(pararms.getExtraInt("DictionaryLearningform")); //学习形式
  51. var classmajorID = pararms.getExtraGuid("ClassmajorDropdown"); //班级名称
  52. var schoolYearID = pararms.getExtraGuid("SchoolYearDropdown"); //异动学期
  53. var differentDynamicType = CheckIsSelectAll(pararms.getExtraInt("DictionaryDifferentDynamicType")); //异动类型
  54. var LearnSystem = pararms.getExtraString("DictionaryLearnSystem");
  55. var result = DifferentDynamicServices.GetApprovalDifferentDynamicViewGrid(configuretView, campusID, collegeID, year, standard, education, learningform, classmajorID, schoolYearID, differentDynamicType,LearnSystem, (int)pararms.page, (int)pararms.rows);
  56. return Json(result);
  57. }
  58. public ActionResult CollegeApproveList()
  59. {
  60. var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
  61. ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
  62. return View();
  63. }
  64. /// <summary>
  65. /// 列表查询
  66. /// </summary>
  67. /// <param name="pararms"></param>
  68. /// <returns></returns>
  69. [HttpPost]
  70. public ActionResult CollegeApproveList(QueryParamsModel pararms)
  71. {
  72. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  73. var campusID = pararms.getExtraGuid("CampusDropdown"); //校区
  74. var collegeID = pararms.getExtraGuid("CollegeDropdown"); //院系所
  75. var year = CheckIsSelectAll(pararms.getExtraInt("SchoolyearDictionaryDropDown")); //年级
  76. var standard = CheckIsSelectAll(pararms.getExtraInt("StandardDictionaryDropDown")); //专业名称
  77. var education = CheckIsSelectAll(pararms.getExtraInt("DictionaryEducation")); //培养层次
  78. var learningform = CheckIsSelectAll(pararms.getExtraInt("DictionaryLearningform")); //学习形式
  79. var classmajorID = pararms.getExtraGuid("ClassmajorDropdown"); //班级名称
  80. var schoolYearID = pararms.getExtraGuid("SchoolYearDropdown"); //异动学期
  81. var differentDynamicType = CheckIsSelectAll(pararms.getExtraInt("DictionaryDifferentDynamicType")); //异动类型
  82. var LearnSystem = pararms.getExtraString("DictionaryLearnSystem");
  83. var result = DifferentDynamicServices.GetCollegeApprovalDifferentDynamicViewGrid(configuretView, campusID, collegeID, year, standard, education, learningform, classmajorID, schoolYearID, differentDynamicType, LearnSystem, (int)pararms.page, (int)pararms.rows);
  84. return Json(result);
  85. }
  86. public ActionResult AdminApproveList()
  87. {
  88. var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
  89. ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
  90. return View();
  91. }
  92. /// <summary>
  93. /// 列表查询
  94. /// </summary>
  95. /// <param name="pararms"></param>
  96. /// <returns></returns>
  97. [HttpPost]
  98. public ActionResult AdminApproveList(QueryParamsModel pararms)
  99. {
  100. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  101. var campusID = pararms.getExtraGuid("CampusDropdown"); //校区
  102. var collegeID = pararms.getExtraGuid("CollegeDropdown"); //院系所
  103. var year = CheckIsSelectAll(pararms.getExtraInt("SchoolyearDictionaryDropDown")); //年级
  104. var standard = CheckIsSelectAll(pararms.getExtraInt("StandardDictionaryDropDown")); //专业名称
  105. var education = CheckIsSelectAll(pararms.getExtraInt("DictionaryEducation")); //培养层次
  106. var learningform = CheckIsSelectAll(pararms.getExtraInt("DictionaryLearningform")); //学习形式
  107. var classmajorID = pararms.getExtraGuid("ClassmajorDropdown"); //班级名称
  108. var schoolYearID = pararms.getExtraGuid("SchoolYearDropdown"); //异动学期
  109. var differentDynamicType = CheckIsSelectAll(pararms.getExtraInt("DictionaryDifferentDynamicType")); //异动类型
  110. var LearnSystem = pararms.getExtraString("DictionaryLearnSystem");
  111. var result = DifferentDynamicServices.GetAdminApprovalDifferentDynamicViewGrid(configuretView, campusID, collegeID, year, standard, education, learningform, classmajorID, schoolYearID, differentDynamicType, LearnSystem, (int)pararms.page, (int)pararms.rows);
  112. return Json(result);
  113. }
  114. [HttpPost]
  115. public ActionResult AdminApprove(string ids, Guid actionID, string comment)
  116. {
  117. var list = ids.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(s => Guid.Parse(s)).ToList();
  118. try
  119. {
  120. DifferentDynamicServices.Approve(list, CustomPrincipal.Current.UserID, actionID, comment);
  121. return Json(new ReturnMessage { IsSuccess = true, Message = "审核成功。" });
  122. }
  123. catch (Exception ex)
  124. {
  125. return Json(new ReturnMessage { IsSuccess = false, Message = ex.Message });
  126. }
  127. }
  128. public ActionResult Edit(Guid id)
  129. {
  130. var vm = new DifferentDynamicApprovalView();
  131. var user = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  132. try
  133. {
  134. var result = DifferentDynamicServices.GetActionView(id, user.UserID);
  135. if (result.Count == 0)
  136. {
  137. return RedirectToAction("MsgShow", "Common", new
  138. {
  139. WindowID = Request["WindowID"],
  140. msg = "抱歉,因流程或操作权限限制,您无权限审核该数据,请检查后重新选择!",
  141. url = Url.Action("List").AddMenuParameter()
  142. });
  143. }
  144. var dropList = result.Select(s => new DropdownListItem { Text = s.ActionName, Value = s.ToJson() }).ToList();
  145. ViewBag.ListAction = dropList;
  146. if (id != null && id != Guid.Empty)
  147. {
  148. var resultView = DifferentDynamicServices.GetDifferentDynamicView(id);
  149. resultView.DynamicCloneTo(vm);
  150. }
  151. }
  152. catch (Exception ex)
  153. {
  154. return RedirectToAction("MsgShow", "Common", new
  155. {
  156. WindowID = Request["WindowID"],
  157. msg = "操作失败原因:" + ex.Message,
  158. url = Url.Action("List").AddMenuParameter()
  159. });
  160. }
  161. return View(vm);
  162. }
  163. [HttpPost]
  164. public ActionResult Edit(DifferentDynamicApprovalView vm)
  165. {
  166. try
  167. {
  168. string action = Request.Form["ddlAction"];
  169. var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
  170. var actionView = action.JsonToObject<ActionView>();
  171. string comment = Request.Form["txtComment"];
  172. var differentDynamicView = new DifferentDynamicView();
  173. vm.DynamicCloneTo(differentDynamicView);
  174. DifferentDynamicServices.Approve(differentDynamicView, user.UserID, actionView, comment);
  175. return Json(new ReturnMessage()
  176. {
  177. IsSuccess = true,
  178. Message = "审核成功!"
  179. });
  180. }
  181. catch (Exception ex)
  182. {
  183. return Json(new ReturnMessage()
  184. {
  185. IsSuccess = false,
  186. Message = "审核失败,原因:" + ex.Message
  187. });
  188. }
  189. }
  190. [HttpPost]
  191. public ActionResult Excel()
  192. {
  193. NpoiExcelHelper neh = new NpoiExcelHelper();
  194. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  195. //避开全选值
  196. //var roleID = Request.Form["Role"].ParseStrTo<Guid>();
  197. var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>(); //校区
  198. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>(); //院系所
  199. var year = CheckIsSelectAll(Request.Form["DictionarySchoolyear"].ParseStrTo<int>()); //年级
  200. var standard = CheckIsSelectAll(Request.Form["DictionaryStandard"].ParseStrTo<int>()); //专业名称
  201. var education = CheckIsSelectAll(Request.Form["DictionaryEducation"].ParseStrTo<int>()); //培养层次
  202. var learningform = CheckIsSelectAll(Request.Form["DictionaryLearningform"].ParseStrTo<int>()); //学习形式
  203. var classmajorID = Request.Form["ClassmajorDropdown"].ParseStrTo<Guid>(); //班级名称
  204. var schoolYearID = Request.Form["SchoolYearDropdown"].ParseStrTo<Guid>(); //异动学期
  205. var differentDynamicType = CheckIsSelectAll(Request.Form["DictionaryDifferentDynamicType"].ParseStrTo<int>()); //异动类型
  206. //var differentDynamicStatus = CheckIsSelectAll(Request.Form["DictionaryDifferentDynamicStatus"].ParseStrTo<int>()); //审批状态
  207. var LearnSystem = Request.Form["DictionaryLearnSystem"].ToString();
  208. var result = DifferentDynamicServices.GetApprovalDifferentDynamicViewList(configuretView, campusID, collegeID, year, standard, education, learningform, classmajorID, schoolYearID, differentDynamicType, LearnSystem);
  209. var dt = result.OrderBy(x => x.EntityCreateTime).Select(s => new
  210. {
  211. s.SchoolyearCode,
  212. s.LoginID,
  213. s.Name,
  214. s.DifferentDynamicTypeName,
  215. s.ReasonName,
  216. s.InSchoolStatusName,
  217. s.StudentStatusName,
  218. s.StandardName,
  219. s.ClassmajorName,
  220. s.AfterStandardName,
  221. s.AfterClassmajorName,
  222. s.AfterInSchoolStatusName,
  223. s.AfterStudentStatusName,
  224. s.EntityCreateTimeStr,
  225. s.ApprovalStatusName,
  226. s.ReportStatusName,
  227. }).ToTable();
  228. string[] liststring = { "异动学期", "学号", "姓名", "异动类型", "异动原因", "在校状态", "学籍状态",
  229. "异动前专业", "异动前班级", "异动后专业", "异动后班级", "异动后在校状态", "异动后学籍状态",
  230. "异动日期", "审批状态", "注册状态" };
  231. neh.Export(dt, liststring, "异动审核");
  232. return RedirectToAction("MsgShow", "Common", new
  233. {
  234. msg = "导出成功!",
  235. url = Url.Action("List").AddMenuParameter()
  236. });
  237. }
  238. [HttpPost]
  239. public ActionResult CollegeApproveExcel()
  240. {
  241. NpoiExcelHelper neh = new NpoiExcelHelper();
  242. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  243. //避开全选值
  244. //var roleID = Request.Form["Role"].ParseStrTo<Guid>();
  245. var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>(); //校区
  246. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>(); //院系所
  247. var year = CheckIsSelectAll(Request.Form["DictionarySchoolyear"].ParseStrTo<int>()); //年级
  248. var standard = CheckIsSelectAll(Request.Form["DictionaryStandard"].ParseStrTo<int>()); //专业名称
  249. var education = CheckIsSelectAll(Request.Form["DictionaryEducation"].ParseStrTo<int>()); //培养层次
  250. var learningform = CheckIsSelectAll(Request.Form["DictionaryLearningform"].ParseStrTo<int>()); //学习形式
  251. var classmajorID = Request.Form["ClassmajorDropdown"].ParseStrTo<Guid>(); //班级名称
  252. var schoolYearID = Request.Form["SchoolYearDropdown"].ParseStrTo<Guid>(); //异动学期
  253. var differentDynamicType = CheckIsSelectAll(Request.Form["DictionaryDifferentDynamicType"].ParseStrTo<int>()); //异动类型
  254. //var differentDynamicStatus = CheckIsSelectAll(Request.Form["DictionaryDifferentDynamicStatus"].ParseStrTo<int>()); //审批状态
  255. var LearnSystem = Request.Form["DictionaryLearnSystem"].ToString();
  256. var result = DifferentDynamicServices.GetCollegeApprovalDifferentDynamicViewList(configuretView, campusID, collegeID, year, standard, education, learningform, classmajorID, schoolYearID, differentDynamicType, LearnSystem);
  257. var dt = result.OrderBy(x => x.EntityCreateTime).Select(s => new
  258. {
  259. s.SchoolyearCode,
  260. s.LoginID,
  261. s.Name,
  262. s.DifferentDynamicTypeName,
  263. s.ReasonName,
  264. s.InSchoolStatusName,
  265. s.StudentStatusName,
  266. s.StandardName,
  267. s.ClassmajorName,
  268. s.AfterStandardName,
  269. s.AfterClassmajorName,
  270. s.AfterInSchoolStatusName,
  271. s.AfterStudentStatusName,
  272. s.EntityCreateTimeStr,
  273. s.ApprovalStatusName,
  274. s.ReportStatusName,
  275. }).ToTable();
  276. string[] liststring = { "异动学期", "学号", "姓名", "异动类型", "异动原因", "在校状态", "学籍状态",
  277. "异动前专业", "异动前班级", "异动后专业", "异动后班级", "异动后在校状态", "异动后学籍状态",
  278. "异动日期", "审批状态", "注册状态" };
  279. neh.Export(dt, liststring, "异动审核");
  280. return RedirectToAction("MsgShow", "Common", new
  281. {
  282. msg = "导出成功!",
  283. url = Url.Action("List").AddMenuParameter()
  284. });
  285. }
  286. [HttpPost]
  287. public ActionResult AdminApproveExcel()
  288. {
  289. NpoiExcelHelper neh = new NpoiExcelHelper();
  290. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  291. //避开全选值
  292. //var roleID = Request.Form["Role"].ParseStrTo<Guid>();
  293. var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>(); //校区
  294. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>(); //院系所
  295. var year = CheckIsSelectAll(Request.Form["DictionarySchoolyear"].ParseStrTo<int>()); //年级
  296. var standard = CheckIsSelectAll(Request.Form["DictionaryStandard"].ParseStrTo<int>()); //专业名称
  297. var education = CheckIsSelectAll(Request.Form["DictionaryEducation"].ParseStrTo<int>()); //培养层次
  298. var learningform = CheckIsSelectAll(Request.Form["DictionaryLearningform"].ParseStrTo<int>()); //学习形式
  299. var classmajorID = Request.Form["ClassmajorDropdown"].ParseStrTo<Guid>(); //班级名称
  300. var schoolYearID = Request.Form["SchoolYearDropdown"].ParseStrTo<Guid>(); //异动学期
  301. var differentDynamicType = CheckIsSelectAll(Request.Form["DictionaryDifferentDynamicType"].ParseStrTo<int>()); //异动类型
  302. //var differentDynamicStatus = CheckIsSelectAll(Request.Form["DictionaryDifferentDynamicStatus"].ParseStrTo<int>()); //审批状态
  303. var LearnSystem = Request.Form["DictionaryLearnSystem"].ToString();
  304. var result = DifferentDynamicServices.GetAdminApprovalDifferentDynamicViewList(configuretView, campusID, collegeID, year, standard, education, learningform, classmajorID, schoolYearID, differentDynamicType, LearnSystem);
  305. var dt = result.OrderBy(x => x.EntityCreateTime).Select(s => new
  306. {
  307. s.SchoolyearCode,
  308. s.LoginID,
  309. s.Name,
  310. s.DifferentDynamicTypeName,
  311. s.ReasonName,
  312. s.InSchoolStatusName,
  313. s.StudentStatusName,
  314. s.StandardName,
  315. s.ClassmajorName,
  316. s.AfterStandardName,
  317. s.AfterClassmajorName,
  318. s.AfterInSchoolStatusName,
  319. s.AfterStudentStatusName,
  320. s.EntityCreateTimeStr,
  321. s.ApprovalStatusName,
  322. s.ReportStatusName,
  323. }).ToTable();
  324. string[] liststring = { "异动学期", "学号", "姓名", "异动类型", "异动原因", "在校状态", "学籍状态",
  325. "异动前专业", "异动前班级", "异动后专业", "异动后班级", "异动后在校状态", "异动后学籍状态",
  326. "异动日期", "审批状态", "注册状态" };
  327. neh.Export(dt, liststring, "异动审核");
  328. return RedirectToAction("MsgShow", "Common", new
  329. {
  330. msg = "导出成功!",
  331. url = Url.Action("List").AddMenuParameter()
  332. });
  333. }
  334. /// <summary>
  335. /// 添加更新前验证
  336. /// </summary>
  337. /// <param name="activitiesID"></param>
  338. /// <param name="Name"></param>
  339. /// <returns></returns>
  340. [HttpPost]
  341. public ActionResult Verification(Guid? ID)
  342. {
  343. return base.Json("成功");
  344. }
  345. //[HttpPost]
  346. //public ActionResult AuditingActionDropdownList(Guid id)
  347. //{
  348. // var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
  349. // var result = DifferentDynamicServices.GetActionView(id, user.UserID);
  350. // //if (result.Count == 0)
  351. // //{
  352. // // return RedirectToAction("MsgShow", "Common", new
  353. // // {
  354. // // msg = "你没有审核权限!",
  355. // // url = Url.Action("List").AddMenuParameter()
  356. // // });
  357. // //}
  358. // var dropList = result.Select(s => new DropdownListItem { Text = s.ActionName, Value = s.ToJson() });
  359. // return Json(dropList);
  360. //}
  361. }
  362. }