diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj index 80e571ae9..e561f9044 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj @@ -222,6 +222,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Device/LessonShow.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Device/LessonShow.cs new file mode 100644 index 000000000..707b9f424 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Device/LessonShow.cs @@ -0,0 +1,89 @@ +using Learun.Application.Base.SystemModule; +using Learun.Application.TwoDevelopment.EducationalAdministration; +using Microsoft.Ajax.Utilities; +using Nancy; +using Nancy.Session; +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Learun.Application.WebApi.Modules.Device +{ + public class LessonShow : BaseNoAuthentication + { + + public LessonShow() : base("/app/lesson") + { + Get["/class/list"] = GetClassList; + Get["/arrangelesson"] = GetLesson; + Post["/class/bind"] = BindClass; + Post["/checkpwd"] = CheckPwd; + } + + private DataSourceIBLL dataSourceIBLL = new DataSourceBLL(); + private ClassInfoIBLL classInfoIBLL = new ClassInfoBLL(); + private ArrangeLessonTermIBLL arrangeLessonTermIBLL = new ArrangeLessonTermBLL(); + + /// + /// 班级列表 + /// + /// + /// + public Response GetClassList(dynamic _) + { + //var keyValue = this.GetReqData(); 1=1 AND CheckMark=1 order by classno desc + var data = dataSourceIBLL.GetDataTable("bjsj", ""); + return Success(data); + } + /// + /// 邦定班级 + /// + /// + /// + public Response BindClass(dynamic _) + { + var k = this.GetReq(); + classInfoIBLL.BindDevice(k.ClassNo, k.DeviceNo); + return Success("操作成功"); + } + public class BindDevClass + { + public string ClassNo { get; set; } + + public string DeviceNo { get; set; } + + public string DevPwd { get; set; } + } + /// + /// 获取课程 + /// + /// + /// + public Response GetLesson(dynamic _) + { + var bj = this.GetReq(); + var classInfo = classInfoIBLL.GetClassNoByDevice(bj.DeviceNo); + if (classInfo == null) return Fail("未找到班级"); + var lesson = arrangeLessonTermIBLL.GetLessonDay(DateTime.Today, classInfo.ClassNo, ""); + return Success(lesson); + } + /// + /// 验证密码 + /// + /// + /// + public Response CheckPwd(dynamic _) + { + var pwd = this.GetReq(); + var setp = ConfigurationManager.AppSettings["DevPwd"].ToString(); + if (pwd.DevPwd != setp) + { + return Fail("密码错误!"); + } + return Success("lesson"); + } + } +} 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 0931b9d8c..f51da1b0e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/system.config +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/system.config @@ -1,118 +1,120 @@  - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermBLL.cs index 0bd240547..0b2ff4b81 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermBLL.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using Learun.Application.Organization; using static Learun.Application.TwoDevelopment.EducationalAdministration.ArrangeExamTermService; +using System.Runtime.InteropServices.ComTypes; namespace Learun.Application.TwoDevelopment.EducationalAdministration { @@ -594,5 +595,24 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration var data = arrangeLessonTermService.InitAsyncDataByCondition(entity); return data; } + + public IEnumerable GetLessonDay(DateTime lessonDate, string classNo, string classroomNo) + { + try + { + return arrangeLessonTermService.GetLessonDay(lessonDate, classNo, classroomNo); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermIBLL.cs index caa1deec0..3b977391f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermIBLL.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using Learun.Application.Organization; using static Learun.Application.TwoDevelopment.EducationalAdministration.ArrangeExamTermService; +using System; namespace Learun.Application.TwoDevelopment.EducationalAdministration { @@ -111,6 +112,9 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// IEnumerable GetTimeTableInEducation(string startDate, string endDate, string classNo, string empNo, string schoolId, string classroomNo); + + IEnumerable GetLessonDay(DateTime lessonDate, string classNo, string classroomNo); + /// /// 课程表【教务】--班级下拉框信息 /// 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 4db127a9a..f5ac12536 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 @@ -1785,6 +1785,52 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les } } + + public IEnumerable GetLessonDay(DateTime lessonDate, string classNo, string classroomNo) + { + var startDate = lessonDate; + var endDate = lessonDate.AddDays(1); + string sql = @"select b.AltId,b.F_SchoolId,b.DeptNo,b.MajorNo,b.AcademicYearNo as AcademicYear,b.LessonNo,b.LessonName,b.LessonTime,b.LessonDate,b.EmpNo,b.Empname EmpName,replace (b.TeachClassNo,b.LessonName,'') TeachClassNo, b.Semester,b.ClassroomNo as ClassRoomNo,b.LessonSortNo,d.ClassName,f.LessonTypeName,f.LessonTypeCode + from ArrangeLessonTerm b + left join ClassInfo d on replace(b.TeachClassNo,b.LessonName,'')=d.ClassNo + left join LessonInfo e on b.LessonNo=e.LessonNo + left join CdLessonType f on e.LessonTypeId=f.LTId + where b.LessonDate>=@startDate and b.LessonDate<=@endDate + and b.CheckMark=1"; + try + { + var result = BaseRepository("CollegeMIS").FindList(sql, new { startDate, endDate }); + if (!string.IsNullOrEmpty(classNo)) + { + if (classNo.Contains(",")) + { + result = result.Where(x => classNo.Contains(x.ClassName)); + } + else + { + result = result.Where(x => x.TeachClassNo == classNo); + } + } + + //if (!string.IsNullOrEmpty(classroomNo)) + //{ + // result = result.Where(x => x.ClassRoomNo == classroomNo); + //} + return result; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + /// /// 课程表【教务】--班级下拉框信息 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoBLL.cs index 92dbae532..fe0d00215 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoBLL.cs @@ -276,5 +276,44 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration #endregion + public void BindDevice(string classno, string dev) + { + try + { + classInfoService.BindDevice(classno, dev); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public ClassInfoEntity GetClassNoByDevice(string dev) + { + try + { + var bj = classInfoService.GetClassNoByDevice(dev); + return bj; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoEntity.cs index 99c2ec017..bebba70bf 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoEntity.cs @@ -102,6 +102,13 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// [Column("ISSEPARATE")] public bool? IsSeparate { get; set; } + + /// + /// 设备编码 + /// + [Column("DeviceCode")] + public string DeviceCode { get; set; } + #endregion #region 扩展操作 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoIBLL.cs index ba5a96914..5f21f8fa8 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoIBLL.cs @@ -69,5 +69,10 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration IEnumerable GetAllClass(); IEnumerable GetClassByMajorNo(string majorNo); + + void BindDevice(string classno, string dev); + + ClassInfoEntity GetClassNoByDevice(string dev); + } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoService.cs index 03abca056..847365e5c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoService.cs @@ -354,5 +354,53 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } } + + public void BindDevice(string classno, string dev) + { + var db = this.BaseRepository("CollegeMIS"); + try + { + var cn = db.FindEntity(x => x.ClassNo == classno); + if (cn == null) throw new Exception("未找到班级"); + cn.DeviceCode = dev; + db.Update(cn); + + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + public ClassInfoEntity GetClassNoByDevice(string dev) + { + var db = this.BaseRepository("CollegeMIS"); + try + { + var cn = db.FindEntity(x => x.DeviceCode == dev); + if (cn == null) throw new Exception("未找到班级"); + + return cn; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + } }