25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

174 lines
5.8 KiB

  1. using Nancy;
  2. using Learun.Util;
  3. using System.Collections.Generic;
  4. using System;
  5. using Learun.Application.TwoDevelopment.EducationalAdministration;
  6. using System.Linq;
  7. namespace Learun.Application.WebApi
  8. {
  9. /// <summary>
  10. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  11. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  12. /// 创 建:超级管理员
  13. /// 日 期:2021-04-30 14:33
  14. /// 描 述:投诉管理
  15. /// </summary>
  16. public class Sys_SendComplaintApi : BaseApi
  17. {
  18. private Sys_SendComplaintIBLL sys_SendComplaintIBLL = new Sys_SendComplaintBLL();
  19. private Sys_ReceiveComplaintIBLL sys_ReceiveComplaintIBLL = new Sys_ReceiveComplaintBLL();
  20. /// <summary>
  21. /// 注册接口
  22. /// <summary>
  23. public Sys_SendComplaintApi()
  24. : base("/Learun/adms/EducationalAdministration/Sys_SendComplaint")
  25. {
  26. Get["/pagelist"] = GetPageList;
  27. Get["/replylist"] = GetReplyList;
  28. Get["/form"] = GetForm;
  29. Get["/complaintCode"] = GetComplaintCode;
  30. Post["/delete"] = DeleteForm;
  31. Post["/save"] = SaveForm;
  32. Post["/saveAssign"] = SaveAssignForm;
  33. Post["/submit"] = SubmitForm;
  34. }
  35. #region 获取数据
  36. /// <summary>
  37. /// 获取页面显示列表分页数据
  38. /// <summary>
  39. /// <param name="_"></param>
  40. /// <returns></returns>
  41. public Response GetPageList(dynamic _)
  42. {
  43. ReqPageParam parameter = this.GetReqData<ReqPageParam>();
  44. var data = sys_SendComplaintIBLL.GetPageList(parameter.pagination, parameter.queryJson);
  45. var jsonData = new
  46. {
  47. rows = data,
  48. total = parameter.pagination.total,
  49. page = parameter.pagination.page,
  50. records = parameter.pagination.records
  51. };
  52. return Success(jsonData);
  53. }
  54. /// <summary>
  55. /// 获取表单数据
  56. /// <summary>
  57. /// <param name="_"></param>
  58. /// <returns></returns>
  59. public Response GetForm(dynamic _)
  60. {
  61. string keyValue = this.GetReqData();
  62. var Sys_SendComplaintData = sys_SendComplaintIBLL.GetSys_SendComplaintEntity(keyValue);
  63. var jsonData = new
  64. {
  65. Sys_SendComplaint = Sys_SendComplaintData,
  66. };
  67. return Success(jsonData);
  68. }
  69. /// <summary>
  70. /// 获取表单数据
  71. /// <summary>
  72. /// <param name="_"></param>
  73. /// <returns></returns>
  74. public Response GetComplaintCode(dynamic _)
  75. {
  76. var ComplaintCode = "TS_" + Util.CommonHelper.CreateNo();
  77. return SuccessString(ComplaintCode);
  78. }
  79. /// <summary>
  80. /// 获取回复消息列表
  81. /// <summary>
  82. /// <param name="_"></param>
  83. /// <returns></returns>
  84. public Response GetReplyList(dynamic _)
  85. {
  86. string keyValue = this.GetReqData();
  87. var Sys_ReceiveComplaintList = sys_ReceiveComplaintIBLL.GetSys_ReceiveComplaintList(keyValue).Where(x => x.ReplyFlag == 1).OrderByDescending(x => x.ReplyTime);
  88. var jsonData = new
  89. {
  90. Sys_ReceiveComplaint = Sys_ReceiveComplaintList,
  91. };
  92. return Success(jsonData);
  93. }
  94. #endregion
  95. #region 提交数据
  96. /// <summary>
  97. /// 删除实体数据
  98. /// <param name="_"></param>
  99. /// <summary>
  100. /// <returns></returns>
  101. public Response DeleteForm(dynamic _)
  102. {
  103. string keyValue = this.GetReqData();
  104. sys_SendComplaintIBLL.DeleteEntity(keyValue);
  105. return Success("删除成功!");
  106. }
  107. /// <summary>
  108. /// 保存实体数据(新增、修改)
  109. /// <param name="_"></param>
  110. /// <summary>
  111. /// <returns></returns>
  112. public Response SaveForm(dynamic _)
  113. {
  114. ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
  115. Sys_SendComplaintEntity entity = parameter.strEntity.ToObject<Sys_SendComplaintEntity>();
  116. entity.CreateTime = DateTime.Now;
  117. entity.CreateUserId = this.userInfo.userId;
  118. entity.CreateUserName = this.userInfo.realName;
  119. entity.SendFlag = 0;
  120. entity.DelFlag = false;
  121. entity.AssignFlag = 0;
  122. entity.ReplyFlag = 0;
  123. sys_SendComplaintIBLL.SaveEntity(parameter.keyValue, entity);
  124. return Success("保存成功!");
  125. }
  126. /// <summary>
  127. /// 保存指派
  128. /// <param name="_"></param>
  129. /// <summary>
  130. /// <returns></returns>
  131. public Response SaveAssignForm(dynamic _)
  132. {
  133. ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
  134. Sys_SendComplaintEntity entity = parameter.strEntity.ToObject<Sys_SendComplaintEntity>();
  135. entity.SenderId = this.userInfo.userId;
  136. entity.Sender = this.userInfo.realName;
  137. sys_SendComplaintIBLL.AssignSaveEntity(parameter.keyValue, entity);
  138. return Success("保存成功!");
  139. }
  140. /// <summary>
  141. /// 提交
  142. /// <param name="_"></param>
  143. /// <summary>
  144. /// <returns></returns>
  145. public Response SubmitForm(dynamic _)
  146. {
  147. string keyValue = this.GetReqData();
  148. sys_SendComplaintIBLL.SubmitEntity(keyValue);
  149. return Success("提交成功!");
  150. }
  151. #endregion
  152. #region 私有类
  153. /// <summary>
  154. /// 表单实体类
  155. /// <summary>
  156. private class ReqFormEntity
  157. {
  158. public string keyValue { get; set; }
  159. public string strEntity { get; set; }
  160. }
  161. #endregion
  162. }
  163. }