ChargeDelayController.cs 17 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.ViewModel;
  7. using EMIS.Web.Controls;
  8. using Bowin.Web.Controls.Mvc;
  9. using Bowin.Common.Mapping;
  10. using Bowin.Common.JSON;
  11. using EMIS.CommonLogic.ChargeManage.ChargeSituation;
  12. using EMIS.ViewModel.ChargeManage.ChargeSituation;
  13. using EMIS.CommonLogic.CalendarManage;
  14. using Bowin.Common.Utility;
  15. using Bowin.Common.Data;
  16. using EMIS.ViewModel.WorkflowManage;
  17. using EMIS.Utility;
  18. namespace EMIS.Web.Controllers.ChargeManage.ChargeSituation
  19. {
  20. [Authorization]
  21. public class ChargeDelayController : Controller
  22. {
  23. public IChargeDelayServices ChargeDelayServices { get; set; }
  24. /// <summary>
  25. /// 缓交名单页面
  26. /// </summary>
  27. /// <returns></returns>
  28. [HttpGet]
  29. public ActionResult List()
  30. {
  31. return View();
  32. }
  33. /// <summary>
  34. /// 缓交名单列表查询
  35. /// </summary>
  36. /// <param name="pararms"></param>
  37. /// <returns></returns>
  38. [HttpPost]
  39. public ActionResult List(QueryParamsModel pararms)
  40. {
  41. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  42. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  43. var yearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown");
  44. var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
  45. var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  46. var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
  47. var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
  48. var chargeYearID = pararms.getExtraInt("ChargeYearDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ChargeYearDropDown");
  49. var chargeProjectID = pararms.getExtraGuid("ChargeProjectComboGrid");
  50. //在校状态
  51. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  52. //审批状态
  53. var chargeDelayStatus = pararms.getExtraInt("DictionaryChargeDelayStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryChargeDelayStatus");
  54. return base.Json(ChargeDelayServices.GetChargeDelayList(configuretView, collegeID, yearID, standardID, educationID,
  55. learningformID, learnSystem, chargeYearID, chargeProjectID, inSchoolStatus, chargeDelayStatus, (int)pararms.page, (int)pararms.rows));
  56. }
  57. /// <summary>
  58. /// 查询应收名单中对应的缴交信息View(对应的缴交信息全部查询,左联-待缓交金额、已缓交金额)
  59. /// </summary>
  60. /// <param name="userID"></param>
  61. /// <param name="chargeYearID"></param>
  62. /// <param name="chargeProjectID"></param>
  63. /// <returns></returns>
  64. [HttpPost]
  65. public ActionResult ChargeDelayStandard(Guid? userID, int? chargeYearID, Guid? chargeProjectID)
  66. {
  67. try
  68. {
  69. var result = ChargeDelayServices.GetChargeDelayStandardView(userID, chargeYearID, chargeProjectID);
  70. return Json(new ReturnMessage<ChargeDelayView>()
  71. {
  72. IsSuccess = true,
  73. Data = result
  74. });
  75. }
  76. catch (Exception ex)
  77. {
  78. return Json(new ReturnMessage()
  79. {
  80. IsSuccess = false,
  81. Message = ex.Message + "。"
  82. });
  83. }
  84. }
  85. /// <summary>
  86. /// 编辑(申请、修改)
  87. /// </summary>
  88. /// <param name="chargeDelayID"></param>
  89. /// <returns></returns>
  90. [HttpGet]
  91. public ActionResult Edit(Guid? chargeDelayID)
  92. {
  93. ChargeDelayView chargeDelayView = new ChargeDelayView();
  94. if (chargeDelayID.HasValue && chargeDelayID != Guid.Empty)
  95. {
  96. chargeDelayView = ChargeDelayServices.GetChargeDelayEditView(chargeDelayID);
  97. }
  98. else
  99. {
  100. chargeDelayView.ChargeYear = BaseExtensions.GetCurrentYearID();
  101. }
  102. return View(chargeDelayView);
  103. }
  104. /// <summary>
  105. /// 编辑(申请、修改)
  106. /// </summary>
  107. /// <param name="chargeDelayView"></param>
  108. /// <returns></returns>
  109. [HttpPost]
  110. public ActionResult Edit(ChargeDelayView chargeDelayView)
  111. {
  112. try
  113. {
  114. ChargeDelayServices.ChaegeDelayEdit(chargeDelayView);
  115. return Json(new ReturnMessage()
  116. {
  117. IsSuccess = true,
  118. Message = "保存成功。"
  119. });
  120. }
  121. catch (Exception ex)
  122. {
  123. return Json(new ReturnMessage()
  124. {
  125. IsSuccess = false,
  126. Message = "保存失败,原因:" + ex.Message + "。"
  127. });
  128. }
  129. }
  130. /// <summary>
  131. /// 删除
  132. /// </summary>
  133. /// <param name="chargeDelayIDs"></param>
  134. /// <returns></returns>
  135. [HttpPost]
  136. public ActionResult Delete(string chargeDelayIDs)
  137. {
  138. try
  139. {
  140. List<Guid> list = new List<Guid>();
  141. for (int i = 0; i < chargeDelayIDs.Split(',').Length; i++)
  142. {
  143. string id = chargeDelayIDs.Split(',')[i];
  144. if (!string.IsNullOrEmpty(id))
  145. {
  146. Guid chargeDelayID = new Guid(id);
  147. list.Add(chargeDelayID);
  148. }
  149. }
  150. ChargeDelayServices.ChargeDelayDelete(list);
  151. return base.Json("删除成功。");
  152. }
  153. catch (Exception ex)
  154. {
  155. return base.Json("删除失败,原因:" + ex.Message + "。");
  156. }
  157. }
  158. /// <summary>
  159. /// 提交
  160. /// </summary>
  161. /// <param name="chargeDelayIDs"></param>
  162. /// <returns></returns>
  163. [HttpPost]
  164. public ActionResult Submit(string chargeDelayIDs)
  165. {
  166. try
  167. {
  168. List<Guid> list = chargeDelayIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
  169. var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
  170. string result = ChargeDelayServices.SubmitChargeDelay(list, user.UserID, "");
  171. return Json(new ReturnMessage()
  172. {
  173. IsSuccess = true,
  174. Message = "提交成功" + result + "。"
  175. });
  176. }
  177. catch (Exception ex)
  178. {
  179. return Json(new ReturnMessage()
  180. {
  181. IsSuccess = false,
  182. Message = "提交失败,原因:" + ex.Message + "。"
  183. });
  184. }
  185. }
  186. /// <summary>
  187. /// 审核页面(单个)
  188. /// </summary>
  189. /// <param name="chargeDelayIDs"></param>
  190. /// <returns></returns>
  191. [HttpGet]
  192. public ActionResult Approve(Guid? chargeDelayID)
  193. {
  194. //查询对应的缓交信息View
  195. var chargeDelayView = ChargeDelayServices.GetChargeDelayEditView(chargeDelayID);
  196. if (chargeDelayView == null)
  197. {
  198. return RedirectToAction("MsgShow", "Common", new
  199. {
  200. WindowID = Request["WindowID"],
  201. msg = "操作失败,原因:数据有误。",
  202. url = Url.Action("List").AddMenuParameter()
  203. });
  204. }
  205. //对已结束的流程状态进行判断(包括正常结束、非正常结束[BP]标识)
  206. var endStatusList = ChargeDelayServices.GetBackpointStatus();
  207. var correctEndStatusID = ChargeDelayServices.GetCorrectEndStatus();
  208. endStatusList.Add(correctEndStatusID);
  209. foreach (var endStatus in endStatusList)
  210. {
  211. if (chargeDelayView.RecordStatus == endStatus)
  212. {
  213. return RedirectToAction("MsgShow", "Common", new
  214. {
  215. WindowID = Request["WindowID"],
  216. msg = "无法对已结束的流程进行审核。",
  217. url = Url.Action("List").AddMenuParameter()
  218. });
  219. }
  220. }
  221. var user = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  222. //根据当前环节ID、用户ID查询下一步审批动作信息List(ActionView)
  223. var actionViewList = ChargeDelayServices.GetActionView((Guid)chargeDelayID, user.UserID);
  224. if (actionViewList == null || actionViewList.Count() <= 0)
  225. {
  226. return RedirectToAction("MsgShow", "Common", new
  227. {
  228. WindowID = Request["WindowID"],
  229. msg = "对不起,您没权限操作。",
  230. url = Url.Action("List").AddMenuParameter()
  231. });
  232. }
  233. var dropList = actionViewList.Select(x => new DropdownListItem { Text = x.ActionName, Value = x.ToJson() }).ToList();
  234. ViewBag.ListAction = dropList;
  235. var newChargeDelayView = new ChargeDelayView();
  236. chargeDelayView.DynamicCloneTo(newChargeDelayView);
  237. return View(newChargeDelayView);
  238. }
  239. /// <summary>
  240. /// 审核页面(单个)
  241. /// </summary>
  242. /// <param name="chargeDelayView"></param>
  243. /// <returns></returns>
  244. [HttpPost]
  245. public ActionResult Approve(ChargeDelayView chargeDelayView)
  246. {
  247. try
  248. {
  249. List<Guid?> list = new List<Guid?>();
  250. list.Add(chargeDelayView.ChargeDelayID);
  251. var user = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  252. string action = Request.Form["ddlAction"];
  253. if (string.IsNullOrEmpty(action))
  254. {
  255. throw new Exception("请选择处理动作");
  256. }
  257. var actionID = action.JsonToObject<ActionView>().ActionID;
  258. ChargeDelayServices.ApproveChargeDelay(list, user.UserID, actionID, chargeDelayView.Comment);
  259. return Json(new ReturnMessage()
  260. {
  261. IsSuccess = true,
  262. Message = "审核成功。"
  263. });
  264. }
  265. catch (Exception ex)
  266. {
  267. return Json(new ReturnMessage()
  268. {
  269. IsSuccess = false,
  270. Message = "审核失败,原因:" + ex.Message + "。"
  271. });
  272. }
  273. }
  274. /// <summary>
  275. /// 审核确定(批量)
  276. /// </summary>
  277. /// <param name="chargeDelayIDs"></param>
  278. /// <param name="actionID"></param>
  279. /// <param name="comment"></param>
  280. /// <returns></returns>
  281. [HttpPost]
  282. public ActionResult BatchApprove(string chargeDelayIDs, Guid actionID, string comment)
  283. {
  284. try
  285. {
  286. List<Guid?> list = chargeDelayIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
  287. .Select(x => (Guid?)new Guid(x)).ToList();
  288. var user = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  289. ChargeDelayServices.ApproveChargeDelay(list, user.UserID, actionID, comment);
  290. return Json(new ReturnMessage()
  291. {
  292. IsSuccess = true,
  293. Message = "审核成功。"
  294. });
  295. }
  296. catch (Exception ex)
  297. {
  298. return Json(new ReturnMessage()
  299. {
  300. IsSuccess = false,
  301. Message = "审核失败,原因:" + ex.Message + "。"
  302. });
  303. }
  304. }
  305. /// <summary>
  306. /// 导出Excel
  307. /// </summary>
  308. /// <returns></returns>
  309. [HttpPost]
  310. public ActionResult Excel()
  311. {
  312. NpoiExcelHelper neh = new NpoiExcelHelper();
  313. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  314. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  315. var yearID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>();
  316. var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
  317. var educationID = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
  318. var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo<int>();
  319. var learnSystem = Request.Form["DictionaryLearnSystem"].ToString();
  320. var chargeYearID = Request.Form["ChargeYearDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ChargeYearDropDown"].ParseStrTo<int>();
  321. var chargeProjectID = Request.Form["ChargeProjectComboGrid"].ParseStrTo<Guid>();
  322. //在校状态
  323. var inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>();
  324. //审批状态
  325. var chargeDelayStatus = Request.Form["DictionaryChargeDelayStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryChargeDelayStatus"].ParseStrTo<int>();
  326. var dt = ChargeDelayServices.GetChargeDelayList(configuretView, collegeID, yearID, standardID, educationID,
  327. learningformID, learnSystem, chargeYearID, chargeProjectID, inSchoolStatus, chargeDelayStatus)
  328. .Select(x => new
  329. {
  330. x.StudentNo,
  331. x.UserName,
  332. x.SexName,
  333. x.ClassNo,
  334. x.ClassName,
  335. x.GradeMajorCode,
  336. x.GradeMajoyStr,
  337. x.CollegeCode,
  338. x.CollegeStr,
  339. x.ChargeYear,
  340. x.ChargeProjectStr,
  341. x.Amount,
  342. x.ChargeAmount,
  343. x.ActualAmount,
  344. x.ChargeTagName,
  345. x.PaidAmount,
  346. x.DelayAmount,
  347. x.GradeStr,
  348. x.StandardID,
  349. x.StandardCode,
  350. x.MajorStr,
  351. x.EducationName,
  352. x.LearningformName,
  353. x.LearnSystem,
  354. x.InSchoolStatusName,
  355. x.StudentStatusName,
  356. x.Reason,
  357. x.RecordStatusName
  358. }).ToTable();
  359. string[] liststring = { "学号", "姓名", "性别", "班级编号", "班级名称", "年级专业编号", "年级专业名称",
  360. RSL.Get("CollegeCode"), RSL.Get("CollegeName"), "缴费学年", "收费项目", "应收金额",
  361. "调整金额", "实收金额", "缴费标记", "已缴金额", "缓交金额", "年级", "专业ID(Value)",
  362. "专业代码", "专业名称", RSL.Get("EducationID"),
  363. "学习形式", "学制", "在校状态", "学籍状态", "缓交原因", "状态"
  364. };
  365. neh.Export(dt, liststring, "缓交名单信息" + DateTime.Now.ToString("yyyyMMdd"));
  366. return Json(new ReturnMessage()
  367. {
  368. IsSuccess = true,
  369. Message = "导出成功。"
  370. });
  371. }
  372. }
  373. }