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.
 
 
 
 
 
 

173 lines
5.2 KiB

  1. using Learun.Application.Message;
  2. using Learun.Application.Organization;
  3. using Learun.Util;
  4. using System;
  5. using System.Web.Mvc;
  6. namespace Learun.Application.Web.Areas.LR_Message.Controllers
  7. {
  8. /// <summary>
  9. /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
  10. /// Copyright (c) 2013-2018 上海力软信息技术有限公司
  11. /// 创 建:超级管理员
  12. /// 日 期:2018-10-16 16:24
  13. /// 描 述:消息策略
  14. /// </summary>
  15. public class LR_StrategyInfoController : MvcControllerBase
  16. {
  17. private LR_StrategyInfoIBLL lR_StrategyInfoIBLL = new LR_StrategyInfoBLL();
  18. private UserIBLL userIBLL = new UserBLL();
  19. #region 视图功能
  20. /// <summary>
  21. /// 主页面
  22. /// <summary>
  23. /// <returns></returns>
  24. [HttpGet]
  25. public ActionResult Index()
  26. {
  27. return View();
  28. }
  29. /// <summary>
  30. /// 表单页
  31. /// <summary>
  32. /// <returns></returns>
  33. [HttpGet]
  34. public ActionResult Form()
  35. {
  36. return View();
  37. }
  38. /// <summary>
  39. /// 消息发送界面
  40. /// </summary>
  41. /// <returns></returns>
  42. [HttpGet]
  43. public ActionResult SendForm()
  44. {
  45. return View();
  46. }
  47. #endregion
  48. #region 获取数据
  49. /// <summary>
  50. /// 获取列表数据
  51. /// <summary>
  52. /// <returns></returns>
  53. [HttpGet]
  54. [AjaxOnly]
  55. public ActionResult GetList( string queryJson )
  56. {
  57. var data = lR_StrategyInfoIBLL.GetList(queryJson);
  58. return Success(data);
  59. }
  60. /// <summary>
  61. /// 获取列表分页数据
  62. /// <param name="pagination">分页参数</param>
  63. /// <summary>
  64. /// <returns></returns>
  65. [HttpGet]
  66. [AjaxOnly]
  67. public ActionResult GetPageList(string pagination, string queryJson)
  68. {
  69. Pagination paginationobj = pagination.ToObject<Pagination>();
  70. var data = lR_StrategyInfoIBLL.GetPageList(paginationobj, queryJson);
  71. var jsonData = new
  72. {
  73. rows = data,
  74. total = paginationobj.total,
  75. page = paginationobj.page,
  76. records = paginationobj.records
  77. };
  78. return Success(jsonData);
  79. }
  80. /// <summary>
  81. /// 获取表单数据
  82. /// <param name="keyValue">主键</param>
  83. /// <summary>
  84. /// <returns></returns>
  85. [HttpGet]
  86. [AjaxOnly]
  87. public ActionResult GetFormData(string keyValue)
  88. {
  89. var data = lR_StrategyInfoIBLL.GetEntity(keyValue);
  90. return Success(data);
  91. }
  92. #endregion
  93. #region 提交数据
  94. /// <summary>
  95. /// 删除实体数据
  96. /// <param name="keyValue">主键</param>
  97. /// <summary>
  98. /// <returns></returns>
  99. [HttpPost]
  100. [AjaxOnly]
  101. public ActionResult DeleteForm(string keyValue)
  102. {
  103. lR_StrategyInfoIBLL.DeleteEntity(keyValue);
  104. return Success("删除成功!");
  105. }
  106. /// <summary>
  107. /// 保存实体数据(新增、修改)
  108. /// <param name="keyValue">主键</param>
  109. /// <summary>
  110. /// <returns></returns>
  111. [HttpPost]
  112. [ValidateAntiForgeryToken]
  113. [AjaxOnly]
  114. public ActionResult SaveForm(string keyValue,LR_MS_StrategyInfoEntity entity)
  115. {
  116. lR_StrategyInfoIBLL.SaveEntity(keyValue, entity);
  117. return Success("保存成功!");
  118. }
  119. /// <summary>
  120. /// 验证策略编码是否重复
  121. /// </summary>
  122. /// <param name="keyValue">策略主键</param>
  123. /// <param name="F_StrategyCode">策略编码</param>
  124. /// <returns></returns>
  125. public ActionResult ExistStrategyCode(string keyValue, string F_StrategyCode)
  126. {
  127. bool res = lR_StrategyInfoIBLL.ExistStrategyCode(keyValue, F_StrategyCode);
  128. return Success(res);
  129. }
  130. /// <summary>
  131. /// 策略消息发送
  132. /// </summary>
  133. /// <param name="code">策略编码</param>
  134. /// <param name="content">消息内容</param>
  135. /// <param name="userlist">用户列表</param>
  136. /// <returns></returns>
  137. public ActionResult SendMessage(string code,string content,string userlist)
  138. {
  139. try
  140. {
  141. var data = userIBLL.GetListByUserIds(userlist);
  142. ResParameter resParameter= lR_StrategyInfoIBLL.SendMessage(code, content, data.ToJson(),"");
  143. if (resParameter.code.ToString() == "fail")
  144. {
  145. return Fail(resParameter.info);
  146. }
  147. else
  148. {
  149. return Success(resParameter.info);
  150. }
  151. }
  152. catch (Exception ex)
  153. {
  154. if (ex is ExceptionEx)
  155. {
  156. throw;
  157. }
  158. else
  159. {
  160. throw ExceptionEx.ThrowBusinessException(ex);
  161. }
  162. }
  163. }
  164. #endregion
  165. }
  166. }