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.
 
 
 
 
 
 

151 lines
5.0 KiB

  1. using Nancy;
  2. using Learun.Util;
  3. using System.Collections.Generic;
  4. using Learun.Application.TwoDevelopment.EducationalAdministration;
  5. using System.Linq;
  6. using System;
  7. namespace Learun.Application.WebApi
  8. {
  9. /// <summary>
  10. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  11. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  12. /// 创 建:超级管理员
  13. /// 日 期:2020-04-16 15:52
  14. /// 描 述:班级自诊打卡
  15. /// </summary>
  16. public class ThermographyApi : BaseApi
  17. {
  18. private ThermographyIBLL thermographyIBLL = new ThermographyBLL();
  19. /// <summary>
  20. /// 注册接口
  21. /// <summary>
  22. public ThermographyApi()
  23. : base("/Learun/adms/EducationalAdministration/Thermography")
  24. {
  25. Get["/pagelist"] = GetPageList;
  26. Get["/list"] = GetList;
  27. Get["/listOfStudent"] = GetListOfStudent;
  28. Get["/form"] = GetForm;
  29. Post["/delete"] = DeleteForm;
  30. Post["/save"] = SaveForm;
  31. Post["/save2"] = SaveFormList;
  32. }
  33. #region 获取数据
  34. /// <summary>
  35. /// 获取页面显示列表分页数据
  36. /// <summary>
  37. /// <param name="_"></param>
  38. /// <returns></returns>
  39. public Response GetPageList(dynamic _)
  40. {
  41. ReqPageParam parameter = this.GetReqData<ReqPageParam>();
  42. var data = thermographyIBLL.GetPageList(parameter.pagination, parameter.queryJson);
  43. var jsonData = new
  44. {
  45. rows = data,
  46. total = parameter.pagination.total,
  47. page = parameter.pagination.page,
  48. records = parameter.pagination.records
  49. };
  50. return Success(jsonData);
  51. }
  52. /// <summary>
  53. /// 获取页面显示列表数据
  54. /// <summary>
  55. /// <param name="_"></param>
  56. /// <returns></returns>
  57. public Response GetList(dynamic _)
  58. {
  59. string queryJson = this.GetReqData();
  60. var data = thermographyIBLL.GetList(queryJson);
  61. return Success(data);
  62. }
  63. /// <summary>
  64. /// 获取表单数据
  65. /// <summary>
  66. /// <param name="_"></param>
  67. /// <returns></returns>
  68. public Response GetForm(dynamic _)
  69. {
  70. string keyValue = this.GetReqData();
  71. var ThermographyData = thermographyIBLL.GetThermographyEntity(keyValue);
  72. var jsonData = new
  73. {
  74. Thermography = ThermographyData,
  75. };
  76. return Success(jsonData);
  77. }
  78. /// <summary>
  79. /// 获取页面显示列表数据
  80. /// <summary>
  81. /// <param name="_"></param>
  82. /// <returns></returns>
  83. public Response GetListOfStudent(dynamic _)
  84. {
  85. ReqPageParam parameter = this.GetReqData<ReqPageParam>();
  86. var data = thermographyIBLL.GetPageListOfStudentInApp(parameter.queryJson).OrderBy(x => x.PersonBeingMeasured);
  87. return Success(data);
  88. }
  89. #endregion
  90. #region 提交数据
  91. /// <summary>
  92. /// 删除实体数据
  93. /// <param name="_"></param>
  94. /// <summary>
  95. /// <returns></returns>
  96. public Response DeleteForm(dynamic _)
  97. {
  98. string keyValue = this.GetReqData();
  99. thermographyIBLL.DeleteEntity(keyValue);
  100. return Success("删除成功!");
  101. }
  102. /// <summary>
  103. /// 保存实体数据(新增、修改):单个学生提交测温
  104. /// <param name="_"></param>
  105. /// <summary>
  106. /// <returns></returns>
  107. public Response SaveForm(dynamic _)
  108. {
  109. ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
  110. ThermographyEntity entity = parameter.strEntity.ToObject<ThermographyEntity>();
  111. entity.MeasureDate = DateTime.Now;
  112. entity.CreateTime = DateTime.Now;
  113. thermographyIBLL.SaveEntity(this.userInfo, parameter.keyValue, entity);
  114. return Success("保存成功!");
  115. }
  116. /// <summary>
  117. /// 保存实体数据(新增、修改):整个班级提交测温
  118. /// <param name="_"></param>
  119. /// <summary>
  120. /// <returns></returns>
  121. public Response SaveFormList(dynamic _)
  122. {
  123. ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
  124. List<ThermographyEntity> entities = parameter.strEntity.ToObject<List<ThermographyEntity>>();
  125. thermographyIBLL.SaveEntityList(parameter.measureTime, entities);
  126. return Success("保存成功!");
  127. }
  128. #endregion
  129. #region 私有类
  130. /// <summary>
  131. /// 表单实体类
  132. /// <summary>
  133. private class ReqFormEntity
  134. {
  135. public string keyValue { get; set; }
  136. public string strEntity { get; set; }
  137. public string measureTime { get; set; }
  138. }
  139. #endregion
  140. }
  141. }