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.
 
 
 
 
 
 

169 line
5.9 KiB

  1. using Nancy;
  2. using Learun.Util;
  3. using System.Collections.Generic;
  4. using Learun.Application.TwoDevelopment.EducationalAdministration;
  5. using Learun.Application.TwoDevelopment.LogisticsManagement;
  6. using System;
  7. using Learun.Application.WorkFlow;
  8. namespace Learun.Application.WebApi
  9. {
  10. /// <summary>
  11. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  12. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  13. /// 创 建:超级管理员
  14. /// 日 期:2020-06-03 14:29
  15. /// 描 述:系部数据
  16. /// </summary>
  17. public class PurchaseStudentApi : BaseApi
  18. {
  19. private Purchase_StudentIBLL PurchaseStudentIBLL = new Purchase_StudentBLL();
  20. private NWFProcessIBLL nWFProcessIBLL = new NWFProcessBLL();
  21. /// <summary>
  22. /// 注册接口
  23. /// <summary>
  24. public PurchaseStudentApi()
  25. : base("/learun/adms/PurchaseStudent")
  26. {
  27. Get["/pagelist"] = GetPageList;
  28. Get["/form"] = GetForm;
  29. Get["/formdetail"] = GetFormDetails;
  30. Post["/delete"] = DeleteForm;
  31. Post["/save"] = SaveForm;
  32. Post["/submit"] = Submit;
  33. Get["/shList"] = GetshList;
  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 = PurchaseStudentIBLL.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 Purchase_StudentData = PurchaseStudentIBLL.GetPurchase_StudentEntity(keyValue);
  63. var Purchase_Student_DetailsData = PurchaseStudentIBLL.GetPurchase_Student_DetailsList(Purchase_StudentData.Id);
  64. var jsonData = new
  65. {
  66. Purchase_Student = Purchase_StudentData,
  67. Purchase_Student_Details = Purchase_Student_DetailsData,
  68. };
  69. return Success(jsonData);
  70. }
  71. /// <summary>
  72. /// 获取表单数据
  73. /// <summary>
  74. /// <param name="_"></param>
  75. /// <returns></returns>
  76. public Response GetFormDetails(dynamic _)
  77. {
  78. string keyValue = this.GetReqData();
  79. var Purchase_Student_DetailsData = PurchaseStudentIBLL.GetPurchase_Student_DetailsList(keyValue);
  80. return Success(Purchase_Student_DetailsData);
  81. }
  82. /// <summary>
  83. /// 获取页面显示列表数据
  84. /// <summary>
  85. /// <param name="_"></param>
  86. /// <returns></returns>
  87. public Response GetshList(dynamic _)
  88. {
  89. Purchase_StudentEntity parameter = this.GetReqData<Purchase_StudentEntity>();
  90. var Purchase_StudentData = PurchaseStudentIBLL.GetEntityByProcessId(parameter.ProcessId);
  91. var Purchase_Student_DetailsData = PurchaseStudentIBLL.GetPurchase_Student_DetailsList(Purchase_StudentData.Id);
  92. var jsonData = new
  93. {
  94. Purchase_Student = Purchase_StudentData,
  95. Purchase_Student_Details = Purchase_Student_DetailsData,
  96. };
  97. return Success(jsonData);
  98. }
  99. #endregion
  100. #region 提交数据
  101. /// <summary>
  102. /// 删除实体数据
  103. /// <param name="_"></param>
  104. /// <summary>
  105. /// <returns></returns>
  106. public Response DeleteForm(dynamic _)
  107. {
  108. string keyValue = this.GetReqData();
  109. PurchaseStudentIBLL.DeleteEntity(keyValue);
  110. return Success("删除成功!");
  111. }
  112. /// <summary>
  113. /// 保存实体数据(新增、修改)
  114. /// <param name="_"></param>
  115. /// <summary>
  116. /// <returns></returns>
  117. public Response SaveForm(dynamic _)
  118. {
  119. ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
  120. Purchase_StudentEntity entity = parameter.strEntity.ToObject<Purchase_StudentEntity>();
  121. List<Purchase_Student_DetailsEntity> detailList = parameter.DetailList.ToObject<List<Purchase_Student_DetailsEntity>>();
  122. //var code = entity.EnCode;
  123. string id=PurchaseStudentIBLL.SaveEntity(parameter.keyValue, entity, detailList);
  124. var json = new
  125. {
  126. Id = id
  127. };
  128. return Success(json);
  129. }
  130. /// <summary>
  131. /// 提交
  132. /// <param name="_"></param>
  133. /// <summary>
  134. /// <returns></returns>
  135. public Response Submit(dynamic _)
  136. {
  137. Purchase_StudentEntity parameter = this.GetReqData<Purchase_StudentEntity>();
  138. //string keyValue = this.GetReqData();
  139. //var processId = Guid.NewGuid().ToString();
  140. PurchaseStudentIBLL.ModifyStatus(parameter.Id, 1, parameter.ProcessId);
  141. //UserInfo userInfo = LoginUserInfo.Get();
  142. //nWFProcessIBLL.CreateFlow("2-5", processId, "", 1, "", userInfo);
  143. return Success("提交成功!");
  144. }
  145. #endregion
  146. #region 私有类
  147. /// <summary>
  148. /// 表单实体类
  149. /// <summary>
  150. private class ReqFormEntity
  151. {
  152. public string keyValue { get; set; }
  153. public string strEntity { get; set; }
  154. public string DetailList { get; set; }
  155. }
  156. #endregion
  157. }
  158. }