Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

152 linhas
5.5 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 PurchaseEduApplyApi : BaseApi
  18. {
  19. private Purchase_Edu_ApplyIBLL purchaseeduIBLL = new Purchase_Edu_ApplyBLL();
  20. private NWFProcessIBLL nWFProcessIBLL = new NWFProcessBLL();
  21. /// <summary>
  22. /// 注册接口
  23. /// <summary>
  24. public PurchaseEduApplyApi()
  25. : base("/learun/adms/purchaseeduapply")
  26. {
  27. Get["/pagelist"] = GetPageList;
  28. Get["/form"] = GetForm;
  29. Post["/delete"] = DeleteForm;
  30. Post["/save"] = SaveForm;
  31. Post["/submit"] = Submit;
  32. //Get["/shList"] = GetshList;
  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 = purchaseeduIBLL.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 GetForm(dynamic _)
  59. {
  60. string keyValue = this.GetReqData();
  61. var Purchase_EduData = purchaseeduIBLL.GetPurchase_Edu_ApplyEntity(keyValue);
  62. var Purchase_Edu_DetailsData = purchaseeduIBLL.GetPurchase_Edu_ApplydetailsList(Purchase_EduData.Id);
  63. var jsonData = new
  64. {
  65. Purchase_Edu = Purchase_EduData,
  66. Purchase_Edu_Details = Purchase_Edu_DetailsData,
  67. };
  68. return Success(jsonData);
  69. }
  70. ///// <summary>
  71. ///// 获取页面显示列表数据
  72. ///// <summary>
  73. ///// <param name="_"></param>
  74. ///// <returns></returns>
  75. //public Response GetshList(dynamic _)
  76. //{
  77. // FundsApplyEntity parameter = this.GetReqData<FundsApplyEntity>();
  78. // var FundsApplyData = fundsApplyIBLL.GetEntityByProcessId(parameter.ProcessId);
  79. // var FundsApplyDetailData = fundsApplyDetailIBLL.GetListByApplyId(FundsApplyData.Id);
  80. // var jsonData = new
  81. // {
  82. // FundsApply = FundsApplyData,
  83. // FundsApplyDetail = FundsApplyDetailData,
  84. // };
  85. // return Success(jsonData);
  86. //}
  87. #endregion
  88. #region 提交数据
  89. /// <summary>
  90. /// 删除实体数据
  91. /// <param name="_"></param>
  92. /// <summary>
  93. /// <returns></returns>
  94. public Response DeleteForm(dynamic _)
  95. {
  96. string keyValue = this.GetReqData();
  97. purchaseeduIBLL.DeleteEntity(keyValue);
  98. return Success("删除成功!");
  99. }
  100. /// <summary>
  101. /// 保存实体数据(新增、修改)
  102. /// <param name="_"></param>
  103. /// <summary>
  104. /// <returns></returns>
  105. public Response SaveForm(dynamic _)
  106. {
  107. //Purchase_EduEntity entity = strEntity.ToObject<Purchase_EduEntity>();
  108. //List<Purchase_Edu_DetailsEntity> purchase_Edu_DetailsList = strpurchase_Edu_DetailsList.ToObject<List<Purchase_Edu_DetailsEntity>>();
  109. //purchase_EduIBLL.SaveEntity(keyValue, entity, purchase_Edu_DetailsList);
  110. ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
  111. Purchase_Edu_ApplyEntity entity = parameter.strEntity.ToObject<Purchase_Edu_ApplyEntity>();
  112. List<Purchase_Edu_ApplydetailsEntity> detailList = parameter.DetailList.ToObject<List<Purchase_Edu_ApplydetailsEntity>>();
  113. //var code = entity.EnCode;
  114. purchaseeduIBLL.SaveEntity(parameter.keyValue, entity, detailList);
  115. return Success("保存成功!");
  116. }
  117. /// <summary>
  118. /// 提交
  119. /// <param name="_"></param>
  120. /// <summary>
  121. /// <returns></returns>
  122. public Response Submit(dynamic _)
  123. {
  124. string keyValue = this.GetReqData();
  125. var processId = Guid.NewGuid().ToString();
  126. purchaseeduIBLL.ModifyStatus(keyValue, 1, processId);
  127. UserInfo userInfo = LoginUserInfo.Get();
  128. nWFProcessIBLL.CreateFlow("2-1", processId, "", 1, "", userInfo);
  129. return Success("提交成功!");
  130. }
  131. #endregion
  132. #region 私有类
  133. /// <summary>
  134. /// 表单实体类
  135. /// <summary>
  136. private class ReqFormEntity
  137. {
  138. public string keyValue { get; set; }
  139. public string strEntity { get; set; }
  140. public string DetailList { get; set; }
  141. }
  142. #endregion
  143. }
  144. }