Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

183 lignes
6.3 KiB

  1. using Nancy;
  2. using Learun.Util;
  3. using System.Collections.Generic;
  4. using Learun.Application.TwoDevelopment.PersonnelManagement;
  5. using System;
  6. using Learun.Application.WorkFlow;
  7. namespace Learun.Application.WebApi
  8. {
  9. /// <summary>
  10. /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架
  11. /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  12. /// 创 建:超级管理员
  13. /// 日 期:2021-02-21 10:07
  14. /// 描 述:会议管理
  15. /// </summary>
  16. public class MeetingManagementApi : BaseApi
  17. {
  18. private MeetingManagementIBLL meetingManagementIBLL = new MeetingManagementBLL();
  19. private NWFProcessIBLL nWFProcessIBLL = new NWFProcessBLL();
  20. /// <summary>
  21. /// 注册接口
  22. /// <summary>
  23. public MeetingManagementApi()
  24. : base("/learun/adms/PersonnelManagement/MeetingManagement")
  25. {
  26. Get["/pagelist"] = GetPageList;
  27. Get["/list"] = GetList;
  28. Get["/form"] = GetForm;
  29. Get["/shList"] = GetshList;
  30. Post["/delete"] = DeleteForm;
  31. Post["/save"] = SaveForm;
  32. Post["/submit"] = Submit;
  33. }
  34. #region 获取数据
  35. /// <summary>
  36. /// 获取页面显示列表分页数据
  37. /// <summary>
  38. /// <param name="_"></param>
  39. /// <returns></returns>
  40. public Response GetPageList(dynamic _)
  41. {
  42. ReqPageParam parameter = this.GetReqData<ReqPageParam>();
  43. var data = meetingManagementIBLL.GetPageList(parameter.pagination, parameter.queryJson);
  44. var jsonData = new
  45. {
  46. rows = data,
  47. total = parameter.pagination.total,
  48. page = parameter.pagination.page,
  49. records = parameter.pagination.records
  50. };
  51. return Success(jsonData);
  52. }
  53. /// <summary>
  54. /// 获取页面显示列表数据
  55. /// <summary>
  56. /// <param name="_"></param>
  57. /// <returns></returns>
  58. public Response GetList(dynamic _)
  59. {
  60. string queryJson = this.GetReqData();
  61. var data = meetingManagementIBLL.GetList(queryJson);
  62. return Success(data);
  63. }
  64. /// <summary>
  65. /// 获取表单数据
  66. /// <summary>
  67. /// <param name="_"></param>
  68. /// <returns></returns>
  69. public Response GetForm(dynamic _)
  70. {
  71. string keyValue = this.GetReqData();
  72. var MeetingManagementData = meetingManagementIBLL.GetMeetingManagementEntity(keyValue);
  73. var jsonData = new
  74. {
  75. MeetingManagement = MeetingManagementData,
  76. };
  77. return Success(jsonData);
  78. }
  79. /// <summary>
  80. /// 获取页面显示列表数据
  81. /// <summary>
  82. /// <param name="_"></param>
  83. /// <returns></returns>
  84. public Response GetshList(dynamic _)
  85. {
  86. MeetingManagementEntity parameter = this.GetReqData<MeetingManagementEntity>();
  87. var MeetingManagement = meetingManagementIBLL.GetMeetingManagementEntityByProcessId(parameter.ProcessId);
  88. return Success(MeetingManagement);
  89. }
  90. #endregion
  91. #region 提交数据
  92. /// <summary>
  93. /// 删除实体数据
  94. /// <param name="_"></param>
  95. /// <summary>
  96. /// <returns></returns>
  97. public Response DeleteForm(dynamic _)
  98. {
  99. string keyValue = this.GetReqData();
  100. meetingManagementIBLL.DeleteEntity(keyValue);
  101. return Success("删除成功!");
  102. }
  103. /// <summary>
  104. /// 保存实体数据(新增、修改)
  105. /// <param name="_"></param>
  106. /// <summary>
  107. /// <returns></returns>
  108. public Response SaveForm(dynamic _)
  109. {
  110. ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
  111. MeetingManagementEntity entity = parameter.strEntity.ToObject<MeetingManagementEntity>();
  112. //判断会议场地是否被占用
  113. var isOccupy = meetingManagementIBLL.JudgeIsOccupy(entity);
  114. if (isOccupy)
  115. {
  116. return Fail("会议场地当前时间段已被占用!");
  117. }
  118. entity.CreateUser = userInfo.userId;
  119. entity.CreateTime = DateTime.Now;
  120. entity.CheckStatus = "0";
  121. string id = meetingManagementIBLL.SaveEntity(this.userInfo, parameter.keyValue, entity); ;
  122. var json = new
  123. {
  124. Id = id
  125. };
  126. return Success(json);
  127. }
  128. ///// <summary>
  129. ///// 提交
  130. ///// <param name="_"></param>
  131. ///// <summary>
  132. ///// <returns></returns>
  133. //public Response Submit(dynamic _)
  134. //{
  135. // string keyValue = this.GetReqData();
  136. // var processId = Guid.NewGuid().ToString();
  137. // meetingManagementIBLL.DoSubmit(keyValue, "1", processId);
  138. // UserInfo userInfo = LoginUserInfo.Get();
  139. // nWFProcessIBLL.CreateFlow("MeetingManagementApply", processId, "", 1, "", userInfo);
  140. // return Success("提交成功!");
  141. //}
  142. public Response Submit(dynamic _)
  143. {
  144. MeetingManagementEntity parameter = this.GetReqData<MeetingManagementEntity>();
  145. //判断会议场地是否被占用
  146. var entity = meetingManagementIBLL.GetMeetingManagementEntity(parameter.Id);
  147. var isOccupy = meetingManagementIBLL.JudgeIsOccupy(entity);
  148. if (isOccupy)
  149. {
  150. return Fail("会议场地当前时间段已被占用!");
  151. }
  152. //string keyValue = this.GetReqData();
  153. //var processId = Guid.NewGuid().ToString();
  154. meetingManagementIBLL.DoSubmit(parameter.Id, "1", parameter.ProcessId);
  155. //UserInfo userInfo = LoginUserInfo.Get();
  156. //nWFProcessIBLL.CreateFlow("0.1", processId, "", 1, "", userInfo);
  157. return Success("提交成功!");
  158. }
  159. #endregion
  160. #region 私有类
  161. /// <summary>
  162. /// 表单实体类
  163. /// <summary>
  164. private class ReqFormEntity
  165. {
  166. public string keyValue { get; set; }
  167. public string strEntity { get; set; }
  168. }
  169. #endregion
  170. }
  171. }