diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/TimeTableController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/TimeTableController.cs index ed879416d..67838a503 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/TimeTableController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/TimeTableController.cs @@ -330,7 +330,7 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers curriculum = string.IsNullOrEmpty(e.EnName) ? (e.LessonSortNo == "2" ? e.LessonName + "[选修]" : e.LessonName) : (e.LessonSortNo == "2" ? e.EnName + "[选修]" : e.EnName), lessonName = e.LessonName, teacher = e.EmpName, - classRoom = e.ClassroomName?.Trim(), + classRoom = e?.ClassroomName?.Trim(), academicyear = semesterAndYear.AcademicYearShort, semester = strSemester, lessonNo = e?.LessonNo, @@ -338,7 +338,7 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers empno = e?.EmpNo, lessonTime = e.LessonTime, lessonDate = e.LessonDate.ToString("yyyy-MM-dd"), - classRoomNo = e?.ClassRoomNo.Trim(), + classRoomNo = e?.ClassRoomNo?.Trim(), lessonSortNo = e.LessonSortNo, e.OLPEId, className = string.IsNullOrEmpty(e.ClassName) ? "" : e.ClassName, diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/Attendance.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/Attendance.js index 69871e65e..b4ba280cc 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/Attendance.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/Attendance.js @@ -83,7 +83,7 @@ var bootstrap = function ($, learun) { item.className + '' + '
教室:' + - item.classRoom + + (item.classRoom ? item.classRoom : '') + '
'; }); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducation.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducation.js index e9fb9c6ec..381cb06d0 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducation.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducation.js @@ -85,7 +85,7 @@ var bootstrap = function ($, learun) { item.className + '' + '
教室:' + - item.classRoom + + (item.classRoom ? item.classRoom:'') + '
'; }); html += ''; diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/database.config b/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/database.config index 1f042fa87..1efe21b19 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/database.config +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/database.config @@ -41,7 +41,7 @@ - + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/AttendanceApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/AttendanceApi.cs index 1c1e43934..28fad63fb 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/AttendanceApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/AttendanceApi.cs @@ -23,6 +23,8 @@ namespace Learun.Application.WebApi.Modules Post["/clockin"] = ClockIn; //获取考勤打卡记录 Get["/getrecordpagelist"] = GetRecordPageList; + //判断学生当前打卡状态 + Get["IsAttendanceStudent"] = IsAttendanceStudent; } private ADR_RestrictionIBLL adr_RestrictionBLL = new ADR_RestrictionBLL(); private ADR_RecordIBLL adr_RecordBLL = new ADR_RecordBLL(); @@ -42,6 +44,21 @@ namespace Learun.Application.WebApi.Modules }; return Success(jsondata); } + /// + /// 学生打卡判断 + /// + /// + /// + public Response IsAttendanceStudent(dynamic _) + { + var res = adr_RestrictionBLL.IsAttendanceStudent(); + var jsondata = + new + { + data = res + }; + return Success(jsondata); + } public class Attendance { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/system.config b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/system.config index 296ae2ea8..75541c535 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/system.config +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/system.config @@ -111,5 +111,7 @@ + + \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermEntity.cs index 65767cb44..7cbafc091 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermEntity.cs @@ -28,6 +28,16 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration [Column("LESSONDATE")] public DateTime? LessonDate { get; set; } /// + /// 上课开始时间 + /// + [Column("StartTime")] + public string StartTime { get; set; } + /// + /// 上课结束时间 + /// + [Column("ENDTIME")] + public string EndTime { get; set; } + /// /// 学年度 /// /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs index 79a331efc..1a8fc2b31 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs @@ -809,7 +809,7 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest //判断有无上课时间 if (LessontimesList.Count() > 0 && LessontimesList.First().studyhour != null && LessontimesList.First().studyhour.Contains(",")) { - timelist = new List(LessontimesList.First().studyhour.Split(',')); + timelist = new List(LessontimesList.First().studyhour.Split(',')); } var oldArrangeLessonTermList = (await BaseRepository("CollegeMIS").FindListAsync()).ToList(); var insertDataList = new List(); @@ -819,22 +819,22 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest var timesArr = item.timetext.Substring(0, item.timetext.Length - 1).Split(','); foreach (var timesItem in timesArr) { - string ltime = ""; - string datestr = timesItem; - if (timelist.Count()>0&& timelist[Convert.ToInt32(item.section)]!=null) + string starttime = ""; + string endtime = ""; + if (timelist.Count() > 0 && timelist[Convert.ToInt32(item.section) - 1] != null) { - ltime = timelist[Convert.ToInt32(item.section)]; - DateTime dt = DateTime.Parse(datestr); - if (dt.Hour==0&&dt.Minute==0) + if (timelist[Convert.ToInt32(item.section) - 1].Contains("-")) { - dt.Add(TimeSpan.Parse(ltime)); + starttime = timelist[Convert.ToInt32(item.section) - 1].Split('-')[0]; + endtime = timelist[Convert.ToInt32(item.section) - 1].Split('-')[1]; } - datestr = dt.ToString(); } var insertData = new ArrangeLessonTermEntity { ALTId = Guid.NewGuid().ToString(), - LessonDate = DateTime.Parse(datestr), + LessonDate = DateTime.Parse(timesItem), + StartTime = starttime, + EndTime = endtime, AcademicYearNo = item.year, Semester = item.semester, DeptNo = classinfo?.DeptNo, diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionBLL.cs index b7b3b1ca9..8c377e54a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionBLL.cs @@ -243,6 +243,25 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } } + public ADR_RestrictionEntity IsAttendanceStudent() + { + try + { + return aDR_RestrictionService.IsAttendanceStudent(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionEntity.cs index 83fcc7dd7..dd6ae7593 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionEntity.cs @@ -157,6 +157,16 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement /// [NotMapped] public string AttendanceTypeString { get; set; } + [NotMapped] + public string LessonName { get; set; } + [NotMapped] + public string EmpName { get; set; } + [NotMapped] + public string StartTime { get; set; } + [NotMapped] + public string EndTime { get; set; } + [NotMapped] + public string Classroom { get; set; } #endregion diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionIBLL.cs index af5435437..d7bf174d0 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionIBLL.cs @@ -61,5 +61,6 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement ADR_RestrictionEntity GetADR_RestrictionEntityEnabled(); IEnumerable GetADR_RestrictionDay(string keyValue); void SaveFormDay(string keyValue, List entity); + ADR_RestrictionEntity IsAttendanceStudent(); } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionService.cs index c39352d8f..ec07b39ca 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionService.cs @@ -1092,6 +1092,11 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement { attendancerulEntity = this.BaseRepository("CollegeMIS").FindEntity(m => m.REnable == true && m.AType == 1); } + //考勤范围 + adrresult.GPSLon = attendancerulEntity.GPSLon; + adrresult.GPSLat = attendancerulEntity.GPSLat; + adrresult.GPSRange = attendancerulEntity.GPSRange; + adrresult.GPSAddr = attendancerulEntity.GPSAddr; //上班时间 DateTime workDateTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.WorkTime); //上班考勤时间段 @@ -1404,5 +1409,80 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } } } + + public ADR_RestrictionEntity IsAttendanceStudent() + { + try + { + var adrresult = new ADR_RestrictionEntity(); + var userinfo = LoginUserInfo.Get(); + var stuInfoBasic = BaseRepository("").FindEntity(m => m.StuNo == userinfo.account); + //当前服务器日期 + var datenow = DateTime.Now.ToString("yyyy-MM-dd"); + + var datetimenow = DateTime.Now; + var StuNo = LoginUserInfo.Get().account; + //首先获取考勤规则 + ADR_RestrictionEntity attendancerulEntity = null; + if (stuInfoBasic !=null) + { + attendancerulEntity = this.BaseRepository("CollegeMIS") + .FindEntity(m => m.REnable == true && m.AType == 2); + } + else + { + adrresult.AttendanceType = 5; + adrresult.AttendanceTypeString = "非学生用户不能签到"; + return adrresult; + } + //考勤范围 + adrresult.GPSLon = attendancerulEntity.GPSLon; + adrresult.GPSLat = attendancerulEntity.GPSLat; + adrresult.GPSRange = attendancerulEntity.GPSRange; + adrresult.GPSAddr = attendancerulEntity.GPSAddr; + //获取课表信息 + //当前学年学期信息 + var say=Common.GetSemesterAndYear(); + //当天课程 + var lessons = BaseRepository("").FindList(m => m.AcademicYearNo == say.AcademicYearShort&&m.Semester==say.Semester + &&m.DeptNo==stuInfoBasic.DeptNo&&m.MajorNo==stuInfoBasic.MajorNo&&m.TeachClassNo.Contains(stuInfoBasic.ClassNo)&&m.LessonDate.Value.ToString("yyyy-MM-dd") == datenow); + //当前打卡课程判断 + foreach (var arrangeLessonTermEntity in lessons) + { + TimeSpan start = TimeSpan.Parse(arrangeLessonTermEntity.StartTime); + int StuAttendanceEarliestMinute=string.IsNullOrEmpty(Util.Config.GetValue("StuAttendanceEarliestMinute"))?Convert.ToInt32(Util.Config.GetValue("StuAttendanceEarliestMinute")) :0; + //当前时间小于等于上课时间,且大于开课前指定分钟 + if (datetimenow.TimeOfDay<=start && datetimenow.TimeOfDay< start.Add(-TimeSpan.FromMinutes(StuAttendanceEarliestMinute))) + { + adrresult.AttendanceType = 1; + adrresult.AttendanceTypeString = "正常签到"; + adrresult.LessonName = arrangeLessonTermEntity.LessonName; + adrresult.StartTime = arrangeLessonTermEntity.StartTime; + adrresult.EndTime = arrangeLessonTermEntity.EndTime; + adrresult.EmpName = arrangeLessonTermEntity.EmpName; + adrresult.Classroom = BaseRepository("").FindEntity(m => m.ClassroomNo == arrangeLessonTermEntity.ClassroomNo)?.ClassroomName; + return adrresult; + } + else + { + continue; + } + } + adrresult.AttendanceType = 5; + adrresult.AttendanceTypeString = "不在考勤时间范围"; + return adrresult; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } } }