diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuAttendanceLeaveController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuAttendanceLeaveController.cs index bd26f7a65..2611b9513 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuAttendanceLeaveController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuAttendanceLeaveController.cs @@ -141,6 +141,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers { if (entity.IsCheck == "1") { + //todo:暂时隐藏!需要进行去重判断! var gender = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(entity.StuNo)?.GenderNo; StuAttendanceEntity stuAttendanceEntity = new StuAttendanceEntity(); stuAttendanceEntity.AcademicYearNo = entity.AcademicYearNo; @@ -173,7 +174,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers stuAttendanceEntity.CheckMarkDept = ""; stuAttendanceEntity.CheckMark = ""; - stuAttendanceIBLL.SaveEntity("", stuAttendanceEntity); + //stuAttendanceIBLL.SaveEntity("", stuAttendanceEntity); } } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuAttendanceLeaveApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuAttendanceLeaveApi.cs index 29fe98147..c26a029d5 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuAttendanceLeaveApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuAttendanceLeaveApi.cs @@ -138,6 +138,7 @@ namespace Learun.Application.WebApi { if (entity.IsCheck == "1") { + //todo:暂时隐藏!需要进行去重判断! var gender = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(entity.StuNo)?.GenderNo; StuAttendanceEntity stuAttendanceEntity = new StuAttendanceEntity(); stuAttendanceEntity.AcademicYearNo = entity.AcademicYearNo; @@ -170,7 +171,7 @@ namespace Learun.Application.WebApi stuAttendanceEntity.CheckMarkDept = ""; stuAttendanceEntity.CheckMark = ""; - stuAttendanceIBLL.SaveEntity("", stuAttendanceEntity); + //stuAttendanceIBLL.SaveEntity("", stuAttendanceEntity); } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendance/StuAttendanceService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendance/StuAttendanceService.cs index b7d9910d9..f6911f355 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendance/StuAttendanceService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendance/StuAttendanceService.cs @@ -653,8 +653,21 @@ where 1=1 "); } else { - model.Create(); - db.Insert(model); + //多条件再次查找是否有新增的考勤记录; + var isExistModel = this.BaseRepository("CollegeMIS").FindEntity(x => + x.AcademicYearNo == model.AcademicYearNo && x.Semester == model.Semester && x.StuNo == model.StuNo && + x.LessonNo == model.LessonNo && x.TeachClassNo == model.TeachClassNo && x.LessonSortNo == model.LessonSortNo && + x.LessonDate == model.LessonDate && x.LessonTime == model.LessonTime && x.EmpNo == model.EmpNo && x.ClassRoomNo == model.ClassRoomNo); + if (isExistModel != null) + { + model.Modify(isExistModel.ID); + db.Update(model); + } + else + { + model.Create(); + db.Insert(model); + } } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuLeaveManagement/StuLeaveManagementService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuLeaveManagement/StuLeaveManagementService.cs index 32e943b50..5210cdad2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuLeaveManagement/StuLeaveManagementService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuLeaveManagement/StuLeaveManagementService.cs @@ -271,97 +271,98 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration entity.Modify(keyValue); db.Update(entity); - if (entity.CheckStatus.Trim() == "1" && entity.StartTime != null) - { - //请假审核通过后,该学生的对应日期的课表改为请假 - var model = db.FindList( - $"select * from StuLeaveManagement where Id='{keyValue}'").FirstOrDefault(); - //请假开始时间和结束时间 - var startTime = Convert.ToDateTime(model.StartTime?.ToString("yyyy-MM-dd") + " 00:00:00"); - var endTime = Convert.ToDateTime(model.EndTime?.ToString("yyyy-MM-dd") + " 23:59:59"); + //TODO:暂时隐藏!待测试!考勤表出现重复数据问题! +// if (entity.CheckStatus.Trim() == "1" && entity.StartTime != null) +// { +// //请假审核通过后,该学生的对应日期的课表改为请假 +// var model = db.FindList( +// $"select * from StuLeaveManagement where Id='{keyValue}'").FirstOrDefault(); +// //请假开始时间和结束时间 +// var startTime = Convert.ToDateTime(model.StartTime?.ToString("yyyy-MM-dd") + " 00:00:00"); +// var endTime = Convert.ToDateTime(model.EndTime?.ToString("yyyy-MM-dd") + " 23:59:59"); - //排课数据 - var arrangeLessonTermList = db.FindList($@"select a.*,b.StuName,b.Grade,b.GenderNo from [dbo].[ArrangeLessonTerm] a -join stuinfobasic b on a.teachclassno=b.classno -where b.stuno='{model.CreateUserNo}' -and a.lessondate between '{startTime}' and '{endTime}'"); +// //排课数据 +// var arrangeLessonTermList = db.FindList($@"select a.*,b.StuName,b.Grade,b.GenderNo from [dbo].[ArrangeLessonTerm] a +//join stuinfobasic b on a.teachclassno=b.classno +//where b.stuno='{model.CreateUserNo}' +//and a.lessondate between '{startTime}' and '{endTime}'"); - var deptList = db.FindList(); - var majorList = db.FindList(); - var classInfoList = db.FindList(); - var classRoomList = db.FindList().ToList(); - var lessonSortList = db.FindList().ToList(); - foreach (var arrangeLessonTerm in arrangeLessonTermList) - { - StuAttendanceLeaveEntity stuAttendanceLeave = new StuAttendanceLeaveEntity(); - stuAttendanceLeave.Create(); - stuAttendanceLeave.AcademicYearNo = arrangeLessonTerm.AcademicYearNo; - stuAttendanceLeave.Semester = arrangeLessonTerm.Semester; - stuAttendanceLeave.StuNo = model.CreateUserNo; - stuAttendanceLeave.StuName = arrangeLessonTerm.StuName; - stuAttendanceLeave.Grade = arrangeLessonTerm.Grade; - stuAttendanceLeave.DeptNo = arrangeLessonTerm.DeptNo; - stuAttendanceLeave.DeptName = deptList.Where(x => x.DeptNo == arrangeLessonTerm.DeptNo) - .FirstOrDefault()?.DeptName; - stuAttendanceLeave.MajorNo = arrangeLessonTerm.MajorNo; - stuAttendanceLeave.MajorName = majorList.Where(x => x.MajorNo == arrangeLessonTerm.MajorNo) - .FirstOrDefault()?.MajorName; - stuAttendanceLeave.ClassNo = arrangeLessonTerm.TeachClassNo; - stuAttendanceLeave.ClassName = classInfoList - .Where(x => x.ClassNo == arrangeLessonTerm.TeachClassNo).FirstOrDefault()?.ClassName; - stuAttendanceLeave.LessonNo = arrangeLessonTerm.LessonNo; - stuAttendanceLeave.LessonName = arrangeLessonTerm.LessonName; - stuAttendanceLeave.TeachClassNo = arrangeLessonTerm.TeachClassNo; - stuAttendanceLeave.LessonSortNo = arrangeLessonTerm.LessonSortNo; - stuAttendanceLeave.LessonSortName = lessonSortList.Find(m => m.LessonSortNo == arrangeLessonTerm.LessonSortNo)?.LessonSortName; - stuAttendanceLeave.LessonDate = arrangeLessonTerm.LessonDate; - stuAttendanceLeave.LessonTime = arrangeLessonTerm.LessonTime; - stuAttendanceLeave.LeaveType = "1"; - stuAttendanceLeave.EmpNo = arrangeLessonTerm.EmpNo; - stuAttendanceLeave.ClassRoomNo = arrangeLessonTerm.ClassroomNo; - stuAttendanceLeave.UpdateDate = DateTime.Now; - stuAttendanceLeave.IsCheck = "1"; - stuAttendanceLeave.TecRemark = "按天请假"; +// var deptList = db.FindList(); +// var majorList = db.FindList(); +// var classInfoList = db.FindList(); +// var classRoomList = db.FindList().ToList(); +// var lessonSortList = db.FindList().ToList(); +// foreach (var arrangeLessonTerm in arrangeLessonTermList) +// { +// StuAttendanceLeaveEntity stuAttendanceLeave = new StuAttendanceLeaveEntity(); +// stuAttendanceLeave.Create(); +// stuAttendanceLeave.AcademicYearNo = arrangeLessonTerm.AcademicYearNo; +// stuAttendanceLeave.Semester = arrangeLessonTerm.Semester; +// stuAttendanceLeave.StuNo = model.CreateUserNo; +// stuAttendanceLeave.StuName = arrangeLessonTerm.StuName; +// stuAttendanceLeave.Grade = arrangeLessonTerm.Grade; +// stuAttendanceLeave.DeptNo = arrangeLessonTerm.DeptNo; +// stuAttendanceLeave.DeptName = deptList.Where(x => x.DeptNo == arrangeLessonTerm.DeptNo) +// .FirstOrDefault()?.DeptName; +// stuAttendanceLeave.MajorNo = arrangeLessonTerm.MajorNo; +// stuAttendanceLeave.MajorName = majorList.Where(x => x.MajorNo == arrangeLessonTerm.MajorNo) +// .FirstOrDefault()?.MajorName; +// stuAttendanceLeave.ClassNo = arrangeLessonTerm.TeachClassNo; +// stuAttendanceLeave.ClassName = classInfoList +// .Where(x => x.ClassNo == arrangeLessonTerm.TeachClassNo).FirstOrDefault()?.ClassName; +// stuAttendanceLeave.LessonNo = arrangeLessonTerm.LessonNo; +// stuAttendanceLeave.LessonName = arrangeLessonTerm.LessonName; +// stuAttendanceLeave.TeachClassNo = arrangeLessonTerm.TeachClassNo; +// stuAttendanceLeave.LessonSortNo = arrangeLessonTerm.LessonSortNo; +// stuAttendanceLeave.LessonSortName = lessonSortList.Find(m => m.LessonSortNo == arrangeLessonTerm.LessonSortNo)?.LessonSortName; +// stuAttendanceLeave.LessonDate = arrangeLessonTerm.LessonDate; +// stuAttendanceLeave.LessonTime = arrangeLessonTerm.LessonTime; +// stuAttendanceLeave.LeaveType = "1"; +// stuAttendanceLeave.EmpNo = arrangeLessonTerm.EmpNo; +// stuAttendanceLeave.ClassRoomNo = arrangeLessonTerm.ClassroomNo; +// stuAttendanceLeave.UpdateDate = DateTime.Now; +// stuAttendanceLeave.IsCheck = "1"; +// stuAttendanceLeave.TecRemark = "按天请假"; - db.Insert(stuAttendanceLeave); +// db.Insert(stuAttendanceLeave); - //学生考勤 - StuAttendanceEntity stuAttendanceEntity = new StuAttendanceEntity(); - stuAttendanceEntity.AcademicYearNo = arrangeLessonTerm.AcademicYearNo; - stuAttendanceEntity.ClassName = classInfoList - .Where(x => x.ClassNo == arrangeLessonTerm.TeachClassNo).FirstOrDefault()?.ClassName; - stuAttendanceEntity.ClassNo = arrangeLessonTerm.TeachClassNo; - stuAttendanceEntity.DeptName = deptList.Where(x => x.DeptNo == arrangeLessonTerm.DeptNo) - .FirstOrDefault()?.DeptName; - stuAttendanceEntity.DeptNo = arrangeLessonTerm.DeptNo; - stuAttendanceEntity.EmpNo = arrangeLessonTerm.EmpNo; - stuAttendanceEntity.Grade = arrangeLessonTerm.Grade; - stuAttendanceEntity.InertDate = DateTime.Now; - stuAttendanceEntity.LessonDate = arrangeLessonTerm.LessonDate; - stuAttendanceEntity.LessonName = arrangeLessonTerm.LessonName; - stuAttendanceEntity.LessonNo = arrangeLessonTerm.LessonNo; - stuAttendanceEntity.LessonSortName = lessonSortList.Find(m => m.LessonSortNo == arrangeLessonTerm.LessonSortNo)?.LessonSortName; - stuAttendanceEntity.LessonSortNo = arrangeLessonTerm.LessonSortNo; - stuAttendanceEntity.LessonTime = arrangeLessonTerm.LessonTime; - stuAttendanceEntity.MajorName = majorList.Where(x => x.MajorNo == arrangeLessonTerm.MajorNo).FirstOrDefault()?.MajorName; - stuAttendanceEntity.MajorNo = arrangeLessonTerm.MajorNo; - stuAttendanceEntity.PlanWeek = null; - stuAttendanceEntity.Semester = arrangeLessonTerm.Semester; - stuAttendanceEntity.StuName = arrangeLessonTerm.StuName; - stuAttendanceEntity.StuNo = model.CreateUserNo; - stuAttendanceEntity.TeachClassNo = arrangeLessonTerm.TeachClassNo; - stuAttendanceEntity.Sort = "请假"; - stuAttendanceEntity.AttendOrNo = "否"; - stuAttendanceEntity.ClassRoomName = classRoomList.Find(x => x.ClassroomId.Trim() == arrangeLessonTerm.ClassroomNo.Trim())?.ClassroomName.Trim(); - stuAttendanceEntity.ClassRoomNo = arrangeLessonTerm.ClassroomNo; - stuAttendanceEntity.Gender = arrangeLessonTerm.GenderNo.Trim() == "0" ? "女" : "男"; - stuAttendanceEntity.CheckMarkDept = ""; - stuAttendanceEntity.CheckMark = ""; - stuAttendanceEntity.Create(); - db.Insert(stuAttendanceEntity); +// //学生考勤 +// StuAttendanceEntity stuAttendanceEntity = new StuAttendanceEntity(); +// stuAttendanceEntity.AcademicYearNo = arrangeLessonTerm.AcademicYearNo; +// stuAttendanceEntity.ClassName = classInfoList +// .Where(x => x.ClassNo == arrangeLessonTerm.TeachClassNo).FirstOrDefault()?.ClassName; +// stuAttendanceEntity.ClassNo = arrangeLessonTerm.TeachClassNo; +// stuAttendanceEntity.DeptName = deptList.Where(x => x.DeptNo == arrangeLessonTerm.DeptNo) +// .FirstOrDefault()?.DeptName; +// stuAttendanceEntity.DeptNo = arrangeLessonTerm.DeptNo; +// stuAttendanceEntity.EmpNo = arrangeLessonTerm.EmpNo; +// stuAttendanceEntity.Grade = arrangeLessonTerm.Grade; +// stuAttendanceEntity.InertDate = DateTime.Now; +// stuAttendanceEntity.LessonDate = arrangeLessonTerm.LessonDate; +// stuAttendanceEntity.LessonName = arrangeLessonTerm.LessonName; +// stuAttendanceEntity.LessonNo = arrangeLessonTerm.LessonNo; +// stuAttendanceEntity.LessonSortName = lessonSortList.Find(m => m.LessonSortNo == arrangeLessonTerm.LessonSortNo)?.LessonSortName; +// stuAttendanceEntity.LessonSortNo = arrangeLessonTerm.LessonSortNo; +// stuAttendanceEntity.LessonTime = arrangeLessonTerm.LessonTime; +// stuAttendanceEntity.MajorName = majorList.Where(x => x.MajorNo == arrangeLessonTerm.MajorNo).FirstOrDefault()?.MajorName; +// stuAttendanceEntity.MajorNo = arrangeLessonTerm.MajorNo; +// stuAttendanceEntity.PlanWeek = null; +// stuAttendanceEntity.Semester = arrangeLessonTerm.Semester; +// stuAttendanceEntity.StuName = arrangeLessonTerm.StuName; +// stuAttendanceEntity.StuNo = model.CreateUserNo; +// stuAttendanceEntity.TeachClassNo = arrangeLessonTerm.TeachClassNo; +// stuAttendanceEntity.Sort = "请假"; +// stuAttendanceEntity.AttendOrNo = "否"; +// stuAttendanceEntity.ClassRoomName = classRoomList.Find(x => x.ClassroomId.Trim() == arrangeLessonTerm.ClassroomNo.Trim())?.ClassroomName.Trim(); +// stuAttendanceEntity.ClassRoomNo = arrangeLessonTerm.ClassroomNo; +// stuAttendanceEntity.Gender = arrangeLessonTerm.GenderNo.Trim() == "0" ? "女" : "男"; +// stuAttendanceEntity.CheckMarkDept = ""; +// stuAttendanceEntity.CheckMark = ""; +// stuAttendanceEntity.Create(); +// db.Insert(stuAttendanceEntity); - } - } +// } +// } } else {