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.
 
 
 
 
 
 

157 lines
5.3 KiB

  1. using Learun.Application.Organization;
  2. using Learun.Application.TwoDevelopment.EducationalAdministration;
  3. using Learun.Application.TwoDevelopment.EvaluationTeach;
  4. using Learun.Util;
  5. using Nancy;
  6. using System;
  7. using System.Collections.Generic;
  8. namespace Learun.Application.WebApi.Modules
  9. {
  10. /// <summary>
  11. /// 版 本 Learun-ADMS V7.0.0 数字化智慧校园
  12. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  13. /// 创建人:数字化智慧校园-框架开发组
  14. /// 日 期:2018.01.04
  15. /// 描 述:部门管理
  16. /// </summary>
  17. public class StuLeaveManagementApi : BaseApi
  18. {
  19. private StuLeaveManagementIBLL stuLeaveManagementBLL = new StuLeaveManagementBLL();
  20. public StuLeaveManagementApi()
  21. : base("/learun/adms/stuleavemanagement")
  22. {
  23. Get["/pagelist"] = GetPageList;
  24. Get["/list"] = GetList;
  25. Get["/form"] = GetForm;
  26. Post["/delete"] = DeleteForm;
  27. Post["/save"] = SaveForm;
  28. Post["/submit"] = Submit;
  29. Post["/savecheck"] = SaveCheckForm;
  30. }
  31. /// <summary>
  32. /// 获取页面显示列表分页数据
  33. /// <summary>
  34. /// <param name="_"></param>
  35. /// <returns></returns>
  36. public Response GetPageList(dynamic _)
  37. {
  38. ReqPageParam parameter = this.GetReqData<ReqPageParam>();
  39. var data = stuLeaveManagementBLL.GetPageList(parameter.pagination, parameter.queryJson);
  40. var jsonData = new
  41. {
  42. rows = data,
  43. total = parameter.pagination.total,
  44. page = parameter.pagination.page,
  45. records = parameter.pagination.records
  46. };
  47. return Success(jsonData);
  48. }
  49. /// <summary>
  50. /// 获取页面显示列表数据
  51. /// <summary>
  52. /// <param name="_"></param>
  53. /// <returns></returns>
  54. public Response GetList(dynamic _)
  55. {
  56. string queryJson = this.GetReqData();
  57. var data = stuLeaveManagementBLL.GetList(queryJson);
  58. return Success(data);
  59. }
  60. /// <summary>
  61. /// 获取表单数据
  62. /// <summary>
  63. /// <param name="_"></param>
  64. /// <returns></returns>
  65. public Response GetForm(dynamic _)
  66. {
  67. string keyValue = this.GetReqData();
  68. var StuMailData = stuLeaveManagementBLL.GetStuLeaveManagementEntity(keyValue);
  69. var jsonData = new
  70. {
  71. StuMail = StuMailData,
  72. };
  73. return Success(jsonData);
  74. }
  75. #region 提交数据
  76. /// <summary>
  77. /// 删除实体数据
  78. /// <param name="_"></param>
  79. /// <summary>
  80. /// <returns></returns>
  81. public Response DeleteForm(dynamic _)
  82. {
  83. string keyValue = this.GetReqData();
  84. stuLeaveManagementBLL.DeleteEntity(keyValue);
  85. return Success("删除成功!");
  86. }
  87. /// <summary>
  88. /// 保存实体数据(新增、修改)
  89. /// <param name="_"></param>
  90. /// <summary>
  91. /// <returns></returns>
  92. public Response SaveForm(dynamic _)
  93. {
  94. ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
  95. StuLeaveManagementEntity entity = parameter.strEntity.ToObject<StuLeaveManagementEntity>();
  96. entity.CreateTime = DateTime.Now;
  97. entity.CreateUserId = this.userInfo.userId;
  98. entity.CreateUserName = this.userInfo.realName;
  99. entity.CheckStatus = "0";
  100. stuLeaveManagementBLL.SaveEntity(parameter.keyValue, entity);
  101. return Success("保存成功!");
  102. }
  103. /// <summary>
  104. /// 保存实体数据(新增、修改)
  105. /// <param name="_"></param>
  106. /// <summary>
  107. /// <returns></returns>
  108. public Response SaveCheckForm(dynamic _)
  109. {
  110. ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
  111. StuLeaveManagementEntity entity = parameter.strEntity.ToObject<StuLeaveManagementEntity>();
  112. var loginInfo = LoginUserInfo.Get();
  113. entity.CheckUserId = loginInfo.userId;
  114. entity.CheckUserNo = loginInfo.account;
  115. entity.CheckTime = DateTime.Now;
  116. if (entity.CheckStatus == "1")
  117. {
  118. entity.CheckStatus = "2";
  119. }
  120. else
  121. {
  122. entity.CheckStatus = "3";
  123. }
  124. stuLeaveManagementBLL.SaveEntity(parameter.keyValue, entity);
  125. return Success("保存成功!");
  126. }
  127. /// <summary>
  128. /// 保存实体数据(新增、修改)
  129. /// <param name="_"></param>
  130. /// <summary>
  131. /// <returns></returns>
  132. public Response Submit(dynamic _)
  133. {
  134. ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
  135. stuLeaveManagementBLL.DoSubmit(parameter.keyValue);
  136. return Success("提交成功!");
  137. }
  138. #endregion
  139. #region 私有类
  140. /// <summary>
  141. /// 表单实体类
  142. /// <summary>
  143. private class ReqFormEntity
  144. {
  145. public string keyValue { get; set; }
  146. public string strEntity { get; set; }
  147. }
  148. #endregion
  149. }
  150. }