You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

204 lines
6.6 KiB

  1. using Learun.Util;
  2. using System.Data;
  3. using Learun.Application.TwoDevelopment.EducationalAdministration;
  4. using System.Web.Mvc;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using Learun.Application.Organization;
  8. namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
  9. {
  10. /// <summary>
  11. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  12. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  13. /// 创 建:超级管理员
  14. /// 日 期:2019-03-06 17:15
  15. /// 描 述:日志发送
  16. /// </summary>
  17. public class JournalSendController : MvcControllerBase
  18. {
  19. private JournalSendIBLL journalSendIBLL = new JournalSendBLL();
  20. private UserIBLL userIbll = new UserBLL();
  21. private DepartmentIBLL departmentIBLL = new DepartmentBLL();
  22. #region 视图功能
  23. /// <summary>
  24. /// 主页面
  25. /// <summary>
  26. /// <returns></returns>
  27. [HttpGet]
  28. public ActionResult Index()
  29. {
  30. UserInfo logInfo = LoginUserInfo.Get();
  31. ViewBag.userId = logInfo.userId;
  32. return View();
  33. }
  34. /// <summary>
  35. /// 表单页
  36. /// <summary>
  37. /// <returns></returns>
  38. [HttpGet]
  39. public ActionResult Form()
  40. {
  41. return View();
  42. }
  43. [HttpGet]
  44. public ActionResult FormView()
  45. {
  46. return View();
  47. }
  48. /// <summary>
  49. /// 主页面【大厂】
  50. /// <summary>
  51. /// <returns></returns>
  52. [HttpGet]
  53. public ActionResult IndexOfDC()
  54. {
  55. UserInfo logInfo = LoginUserInfo.Get();
  56. ViewBag.userId = logInfo.userId;
  57. return View();
  58. }
  59. /// <summary>
  60. /// 表单页【大厂】
  61. /// <summary>
  62. /// <returns></returns>
  63. [HttpGet]
  64. public ActionResult FormOfDC()
  65. {
  66. return View();
  67. }
  68. #endregion
  69. #region 获取数据
  70. /// <summary>
  71. /// 获取页面显示列表数据
  72. /// <summary>
  73. /// <param name="queryJson">查询参数</param>
  74. /// <returns></returns>
  75. [HttpGet]
  76. [AjaxOnly]
  77. public ActionResult GetPageList(string pagination, string queryJson)
  78. {
  79. Pagination paginationobj = pagination.ToObject<Pagination>();
  80. var data = journalSendIBLL.GetPageList(paginationobj, queryJson);
  81. var jsonData = new
  82. {
  83. rows = data,
  84. total = paginationobj.total,
  85. page = paginationobj.page,
  86. records = paginationobj.records
  87. };
  88. return Success(jsonData);
  89. }
  90. /// <summary>
  91. /// 获取表单数据
  92. /// <summary>
  93. /// <returns></returns>
  94. [HttpGet]
  95. [AjaxOnly]
  96. public ActionResult GetFormData(string keyValue)
  97. {
  98. var JournalSendData = journalSendIBLL.GetJournalSendEntity(keyValue);
  99. var jsonData = new
  100. {
  101. JournalSend = JournalSendData,
  102. };
  103. return Success(jsonData);
  104. }
  105. #endregion
  106. #region 提交数据
  107. /// <summary>
  108. /// 删除实体数据
  109. /// <param name="keyValue">主键</param>
  110. /// <summary>
  111. /// <returns></returns>
  112. [HttpPost]
  113. [AjaxOnly]
  114. public ActionResult DeleteForm(string keyValue)
  115. {
  116. journalSendIBLL.DeleteEntity(keyValue);
  117. return Success("删除成功!");
  118. }
  119. /// <summary>
  120. /// 保存实体数据(新增、修改)
  121. /// <param name="keyValue">主键</param>
  122. /// <summary>
  123. /// <returns></returns>
  124. [HttpPost]
  125. [ValidateAntiForgeryToken]
  126. [AjaxOnly]
  127. [ValidateInput(false)]
  128. public ActionResult SaveForm(string keyValue, string strEntity)
  129. {
  130. UserInfo logInfo = LoginUserInfo.Get();
  131. JournalSendEntity entity = strEntity.ToObject<JournalSendEntity>();
  132. entity.JSenderId = logInfo.userId;
  133. entity.JSender = logInfo.realName;
  134. if (!string.IsNullOrEmpty(entity.JReceiveId))
  135. {
  136. entity.JReceive = string.Join(",", userIbll.GetListByUserIds(entity.JReceiveId).Select(m => m.F_RealName));
  137. }
  138. entity.JIsSend = false;
  139. journalSendIBLL.SaveEntity(keyValue, entity);
  140. return Success("保存成功!", new { JournalSendId = entity.JournalSendId });
  141. }
  142. /// <summary>
  143. /// 保存实体数据(新增、修改)【大厂】
  144. /// <param name="keyValue">主键</param>
  145. /// <summary>
  146. /// <returns></returns>
  147. [HttpPost]
  148. [ValidateAntiForgeryToken]
  149. [AjaxOnly]
  150. [ValidateInput(false)]
  151. public ActionResult SaveFormOfDC(string keyValue, string strEntity)
  152. {
  153. UserInfo logInfo = LoginUserInfo.Get();
  154. JournalSendEntity entity = strEntity.ToObject<JournalSendEntity>();
  155. entity.JSenderId = logInfo.userId;
  156. entity.JSender = logInfo.realName;
  157. entity.JIsSend = false;
  158. if (!string.IsNullOrEmpty(logInfo.departmentId))
  159. {
  160. //判断登录用户所在部门是否有上级部门:如果有,找到上级部门的负责人;如果没有,找本部门的分管校长;
  161. var selfDepart = departmentIBLL.GetEntity(logInfo.departmentId);
  162. if (selfDepart != null)
  163. {
  164. var parentDepart = departmentIBLL.GetEntity(selfDepart.F_ParentId);
  165. if (parentDepart != null)
  166. {
  167. entity.JReceive = parentDepart.F_Manager;
  168. entity.JReceiveId = string.Join(",", userIbll.GetAllList().Where(x => x.F_RealName == parentDepart.F_Manager).Select(x => x.F_UserId));
  169. }
  170. else
  171. {
  172. entity.JReceiveId = selfDepart.F_SchoolMasterId;
  173. entity.JReceive = selfDepart.F_SchoolMaster;
  174. }
  175. }
  176. }
  177. journalSendIBLL.SaveEntity(keyValue, entity);
  178. return Success("保存成功!", new { JournalSendId = entity.JournalSendId });
  179. }
  180. [HttpPost]
  181. [AjaxOnly]
  182. public ActionResult Send(string keyValue)
  183. {
  184. if (!string.IsNullOrEmpty(keyValue))
  185. {
  186. journalSendIBLL.Send(keyValue);
  187. }
  188. return Success("发送成功!");
  189. }
  190. #endregion
  191. }
  192. }