Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

148 wiersze
4.8 KiB

  1. using System;
  2. using Nancy;
  3. using Learun.Util;
  4. using System.Collections.Generic;
  5. using Learun.Application.TwoDevelopment.LogisticsManagement;
  6. using Learun.Application.TwoDevelopment.AssetManagementSystem;
  7. using Learun.Application.WorkFlow;
  8. namespace Learun.Application.WebApi
  9. {
  10. /// <summary>
  11. /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架
  12. /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  13. /// 创 建:超级管理员
  14. /// 日 期:2022-11-21 10:09
  15. /// 描 述:考勤记录
  16. /// </summary>
  17. public class FundsApplyApi : BaseApi
  18. {
  19. private FundsApplyIBLL fundsApplyIBLL = new FundsApplyBLL();
  20. private FundsApplyDetailIBLL fundsApplyDetailIBLL = new FundsApplyDetailBLL();
  21. private NWFProcessIBLL nWFProcessIBLL = new NWFProcessBLL();
  22. /// <summary>
  23. /// 注册接口
  24. /// <summary>
  25. public FundsApplyApi()
  26. : base("/learun/adms/FundsApply")
  27. {
  28. Get["/pagelist"] = GetPageList;
  29. Get["/form"] = GetForm;
  30. Get["/getEnCode"] = GetEnCode;
  31. Post["/delete"] = DeleteForm;
  32. Post["/save"] = SaveForm;
  33. Post["/submit"] = Submit;
  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 = fundsApplyIBLL.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 FundsApplyData = fundsApplyIBLL.GetFundsApplyEntity(keyValue);
  63. var FundsApplyDetailData = fundsApplyDetailIBLL.GetListByApplyId(keyValue);
  64. var jsonData = new
  65. {
  66. FundsApply = FundsApplyData,
  67. FundsApplyDetail = FundsApplyDetailData,
  68. };
  69. return Success(jsonData);
  70. }
  71. /// <summary>
  72. /// 获取申请单号
  73. /// <summary>
  74. /// <param name="_"></param>
  75. /// <returns></returns>
  76. public Response GetEnCode(dynamic _)
  77. {
  78. var jsonData = new
  79. {
  80. EnCode = "JFKZ_" + CommonHelper.CreateNo()
  81. };
  82. return Success(jsonData);
  83. }
  84. #endregion
  85. #region 提交数据
  86. /// <summary>
  87. /// 删除实体数据
  88. /// <param name="_"></param>
  89. /// <summary>
  90. /// <returns></returns>
  91. public Response DeleteForm(dynamic _)
  92. {
  93. string keyValue = this.GetReqData();
  94. fundsApplyIBLL.DeleteEntity(keyValue);
  95. return Success("删除成功!");
  96. }
  97. /// <summary>
  98. /// 保存实体数据(新增、修改)
  99. /// <param name="_"></param>
  100. /// <summary>
  101. /// <returns></returns>
  102. public Response SaveForm(dynamic _)
  103. {
  104. ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
  105. FundsApplyEntity entity = parameter.strEntity.ToObject<FundsApplyEntity>();
  106. List<FundsApplyDetailEntity> detailList = parameter.fundsApplyDetailList.ToObject<List<FundsApplyDetailEntity>>();
  107. fundsApplyIBLL.SaveEntity(parameter.keyValue, entity, detailList);
  108. return Success("保存成功!");
  109. }
  110. /// <summary>
  111. /// 提交
  112. /// <param name="_"></param>
  113. /// <summary>
  114. /// <returns></returns>
  115. public Response Submit(dynamic _)
  116. {
  117. string keyValue = this.GetReqData();
  118. var processId = Guid.NewGuid().ToString();
  119. fundsApplyIBLL.ChangeStatusById(keyValue, 1, processId);
  120. UserInfo userInfo = LoginUserInfo.Get();
  121. nWFProcessIBLL.CreateFlow("LC_FundsApply", processId, "", 1, "", userInfo);
  122. return Success("提交成功!");
  123. }
  124. #endregion
  125. #region 私有类
  126. /// <summary>
  127. /// 表单实体类
  128. /// <summary>
  129. private class ReqFormEntity
  130. {
  131. public string keyValue { get; set; }
  132. public string strEntity { get; set; }
  133. public string fundsApplyDetailList { get; set; }
  134. }
  135. #endregion
  136. }
  137. }