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.
 
 
 
 
 
 

118 lines
3.9 KiB

  1. using Learun.Application.Base.SystemModule;
  2. using Learun.Application.TwoDevelopment.LogisticsManagement;
  3. using Learun.Application.TwoDevelopment.PersonnelManagement;
  4. using Learun.Util;
  5. using Nancy;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.IO;
  9. namespace Learun.Application.WebApi.Modules
  10. {
  11. /// <summary>
  12. /// 考勤打卡功能
  13. /// </summary>
  14. public class AttendanceApi : BaseApi
  15. {
  16. public AttendanceApi()
  17. : base("/learun/adms/attendance")
  18. {
  19. //判断当前时间是否可以打卡
  20. Get["/IsAttendance"] = IsAttendance;
  21. //打卡
  22. Post["/clockin"] = ClockIn;
  23. //获取考勤打卡记录
  24. Get["/getrecordpagelist"] = GetRecordPageList;
  25. //判断学生当前打卡状态
  26. Get["IsAttendanceStudent"] = IsAttendanceStudent;
  27. //学生打卡
  28. Post["/clockinStudent"] = ClockInStudent;
  29. }
  30. private ADR_RestrictionIBLL adr_RestrictionBLL = new ADR_RestrictionBLL();
  31. private ADR_RecordIBLL adr_RecordBLL = new ADR_RecordBLL();
  32. /// <summary>
  33. /// 判断当前时间是否可以打卡
  34. /// </summary>
  35. /// <param name="_"></param>
  36. /// <returns></returns>
  37. public Response IsAttendance(dynamic _)
  38. {
  39. var res = adr_RestrictionBLL.IsAttendance();
  40. var jsondata =
  41. new
  42. {
  43. data = res
  44. };
  45. return Success(jsondata);
  46. }
  47. /// <summary>
  48. /// 学生打卡判断
  49. /// </summary>
  50. /// <param name="_"></param>
  51. /// <returns></returns>
  52. public Response IsAttendanceStudent(dynamic _)
  53. {
  54. var res = adr_RestrictionBLL.IsAttendanceStudent();
  55. var jsondata =
  56. new
  57. {
  58. data = res
  59. };
  60. return Success(jsondata);
  61. }
  62. public class Attendance
  63. {
  64. public decimal ALon { get; set; }
  65. public decimal ALat { get; set; }
  66. public bool AIsOut { get; set; }
  67. public string ARemark { get; set; }
  68. public string ADPhoto { get; set; }
  69. public string ClockPlace { get; set; }
  70. public string LessonSortNo { get; set; }
  71. public string ALTId { get; set; }
  72. public string ALTOEId { get; set; }
  73. }
  74. /// <summary>
  75. /// 打卡
  76. /// </summary>
  77. /// <param name="_"></param>
  78. /// <returns></returns>
  79. public Response ClockIn(dynamic _)
  80. {
  81. Attendance parameter = this.GetReqData<Attendance>();
  82. adr_RestrictionBLL.ClockIn(parameter.ALon, parameter.ALat, parameter.AIsOut, parameter.ARemark,parameter.ADPhoto,parameter.ClockPlace);
  83. return Success("打卡成功");
  84. }
  85. public Response ClockInStudent(dynamic _)
  86. {
  87. Attendance parameter = this.GetReqData<Attendance>();
  88. adr_RestrictionBLL.ClockInStudent(parameter.ALon, parameter.ALat, parameter.AIsOut, parameter.ARemark, parameter.ADPhoto, parameter.ClockPlace,parameter.LessonSortNo,parameter.ALTId,parameter.ALTOEId);
  89. return Success("打卡成功");
  90. }
  91. /// <summary>
  92. /// 打卡
  93. /// </summary>
  94. /// <param name="_"></param>
  95. /// <returns></returns>
  96. public Response GetRecordPageList(dynamic _)
  97. {
  98. ReqPageParam parameter = this.GetReqData<ReqPageParam>();
  99. var data = adr_RecordBLL.GetPageList(parameter.pagination, parameter.queryJson);
  100. var jsonData = new
  101. {
  102. rows = data,
  103. total = parameter.pagination.total,
  104. page = parameter.pagination.page,
  105. records = parameter.pagination.records
  106. };
  107. return Success(jsonData);
  108. }
  109. }
  110. }