using Learun.Application.Base.SystemModule; using Learun.Application.TwoDevelopment.LogisticsManagement; using Learun.Application.TwoDevelopment.PersonnelManagement; using Learun.Util; using Nancy; using System; using System.Collections.Generic; using System.IO; namespace Learun.Application.WebApi.Modules { /// /// 考勤打卡功能 /// public class AttendanceApi : BaseApi { public AttendanceApi() : base("/learun/adms/attendance") { //判断当前时间是否可以打卡 Get["/IsAttendance"] = IsAttendance; //打卡 Post["/clockin"] = ClockIn; //获取考勤打卡记录 Get["/getrecordpagelist"] = GetRecordPageList; //判断学生当前打卡状态 Get["IsAttendanceStudent"] = IsAttendanceStudent; //学生打卡 Post["/clockinStudent"] = ClockInStudent; } private ADR_RestrictionIBLL adr_RestrictionBLL = new ADR_RestrictionBLL(); private ADR_RecordIBLL adr_RecordBLL = new ADR_RecordBLL(); /// /// 判断当前时间是否可以打卡 /// /// /// public Response IsAttendance(dynamic _) { var res = adr_RestrictionBLL.IsAttendance(); var jsondata = new { data = res }; return Success(jsondata); } /// /// 学生打卡判断 /// /// /// public Response IsAttendanceStudent(dynamic _) { var res = adr_RestrictionBLL.IsAttendanceStudent(); var jsondata = new { data = res }; return Success(jsondata); } public class Attendance { public decimal ALon { get; set; } public decimal ALat { get; set; } public bool AIsOut { get; set; } public string ARemark { get; set; } public string ADPhoto { get; set; } public string ClockPlace { get; set; } public string LessonSortNo { get; set; } public string ALTId { get; set; } public string ALTOEId { get; set; } } /// /// 打卡 /// /// /// public Response ClockIn(dynamic _) { Attendance parameter = this.GetReqData(); adr_RestrictionBLL.ClockIn(parameter.ALon, parameter.ALat, parameter.AIsOut, parameter.ARemark,parameter.ADPhoto,parameter.ClockPlace); return Success("打卡成功"); } public Response ClockInStudent(dynamic _) { Attendance parameter = this.GetReqData(); adr_RestrictionBLL.ClockInStudent(parameter.ALon, parameter.ALat, parameter.AIsOut, parameter.ARemark, parameter.ADPhoto, parameter.ClockPlace,parameter.LessonSortNo,parameter.ALTId,parameter.ALTOEId); return Success("打卡成功"); } /// /// 打卡 /// /// /// public Response GetRecordPageList(dynamic _) { ReqPageParam parameter = this.GetReqData(); var data = adr_RecordBLL.GetPageList(parameter.pagination, parameter.queryJson); var jsonData = new { rows = data, total = parameter.pagination.total, page = parameter.pagination.page, records = parameter.pagination.records }; return Success(jsonData); } } }