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 3b20af763..193b772cd 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 @@ -209,6 +209,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuScoreApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuScoreApi.cs new file mode 100644 index 000000000..e4a560b61 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuScoreApi.cs @@ -0,0 +1,112 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using Learun.Application.TwoDevelopment.EducationalAdministration; +using Learun.Util; +using Nancy; +using Newtonsoft.Json; + +namespace Learun.Application.WebApi.Modules +{ + public class StuScoreApi : BaseNoLoginApi + { + public StuScoreApi() + : base("/Learun/adms/EducationalAdministration/StuScore") + { + Get["/scoreListByStuInfo"] = GetScoreListByStuInfo; + + } + + private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL(); + private StuScoreIBLL stuScoreIBLL = new StuScoreBLL(); + private CdMajorIBLL cdMajorIBLL = new CdMajorBLL(); + private ClassInfoIBLL classInfoIBLL = new ClassInfoBLL(); + + /// + /// 获取成绩列表 + /// + /// + /// + private Response GetScoreListByStuInfo(dynamic _) + { + var param = this.GetReq(); + + ScoreListByStuInfo result = new ScoreListByStuInfo(); + + var stuInfoBasicEntity = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(param.StuNo); + if (stuInfoBasicEntity != null) + { + result.StuNo = stuInfoBasicEntity.StuNo; + result.StuName = stuInfoBasicEntity.StuName; + result.MajorNo = stuInfoBasicEntity.MajorNo; + result.ClassNo = stuInfoBasicEntity.ClassNo; + if (!string.IsNullOrEmpty(stuInfoBasicEntity.MajorNo)) + { + result.MajorName = cdMajorIBLL.GetCdMajorEntityByMajorNo(stuInfoBasicEntity.MajorNo)?.MajorName; + } + if (!string.IsNullOrEmpty(stuInfoBasicEntity.ClassNo)) + { + result.ClassName = classInfoIBLL.GetClassInfoEntityByClassNo(stuInfoBasicEntity.ClassNo)?.ClassName; + } + } + var queryJson = JsonConvert.SerializeObject(param); + + var data = stuScoreIBLL.GetScoreListByStuInfo(queryJson); + var dataTemp = data.GroupBy(x => new { x.AcademicYearNo, x.Semester }).Select(x => new ScoreList() + { + AcademicYearNo = x.Key.AcademicYearNo, + Semester = x.Key.Semester, + StuScoreEntityList = x.Select(y => new StuScoreEntity() + { + AcademicYearNo = y.AcademicYearNo, + Semester = y.Semester, + LessonSortNo = y.LessonSortNo, + LessonSortName = y.LessonSortName, + LessonNo = y.LessonNo, + LessonName = y.LessonName, + StudyScore = y.StudyScore, + Score = y.Score, + ScoreOfNotPass = y.ScoreOfNotPass, + ScoreOfNotPassTwo = y.ScoreOfNotPassTwo + }).OrderBy(a=>a.LessonSortNo).ThenBy(a=>a.LessonNo).ToList() + }).ToList().OrderByDescending(x=>x.AcademicYearNo).ThenByDescending(x=>x.Semester); + result.ScoreList = dataTemp.ToList(); + + return Success(result); + + } + + public class Model + { + /// + /// 学年(18-19) + /// + public string AcademicYearNo { get; set; } + /// + /// 学期(1) + /// + public string Semester { get; set; } + /// + /// 学号 + /// + public string StuNo { get; set; } + + } + public class ScoreListByStuInfo { + public string StuNo { get; set; } + public string StuName { get; set; } + public string MajorNo { get; set; } + public string MajorName { get; set; } + public string ClassNo { get; set; } + public string ClassName { get; set; } + public List ScoreList { get; set; } + } + public class ScoreList { + public string AcademicYearNo { get; set; } + public string Semester { get; set; } + public List StuScoreEntityList { get; set; } + } + + } +} \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TimeTable.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TimeTable.cs index 78a047024..22104a168 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TimeTable.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TimeTable.cs @@ -13,7 +13,7 @@ using Nancy; namespace Learun.Application.WebApi.Modules { - public class TimeTable : BaseApi + public class TimeTable : BaseNoLoginApi { public TimeTable() : base("/learun/adms/timetable") @@ -21,6 +21,7 @@ namespace Learun.Application.WebApi.Modules Get["/list"] = GetList; Get["/StuList"] = GetStuInfo; Get["/StuLessonInfo"] = GetStuLessonInfo; + Get["/timeTableData"] = GetTimeTableData; } private ArrangeLessonTermIBLL arrangeLessonTermIBLL = new ArrangeLessonTermBLL(); private ArrangeLessonTermOfElectiveIBLL arrangeLessonTermOfElectiveIBLL = new ArrangeLessonTermOfElectiveBLL(); @@ -112,6 +113,68 @@ namespace Learun.Application.WebApi.Modules } + + /// + /// 全院课程表【按班级分组】 + /// + /// + /// + private Response GetTimeTableData(dynamic _) + { + var param = this.GetReq(); + + TimeTableData result = new TimeTableData(); + + //开始时间 + var startdate = string.IsNullOrEmpty(param.StartDate) ? DateTime.Today : Convert.ToDateTime(param.StartDate); + var startDate = Common.CalculateFirstDateOfWeek(startdate).ToString("yyyy-MM-dd"); + var endDate = Common.CalculateLastDateOfWeek(startdate).ToString("yyyy-MM-dd"); + result.StartDate = startDate; + result.EndDate = endDate; + + var semesterAndYear = Common.GetSemesterAndYear(startDate); + result.AcademicYearNo = semesterAndYear.AcademicYearLong; + result.Semester = semesterAndYear.Semester; + + //课程表数据 + var timeTableList = new List(); + //必修课课程表 + var data = arrangeLessonTermIBLL.GetTimeTableInEducation(startDate, endDate, param.ClassNo, param.EmpNo, ""); + timeTableList.AddRange(data); + //选修课课程表 + var dataOfElective = arrangeLessonTermOfElectiveIBLL.GetTimeTableInEducation(startDate, endDate, param.ClassNo, param.EmpNo, ""); + timeTableList.AddRange(dataOfElective); + var dataTemp = timeTableList.GroupBy(x => new { x.TeachClassNo, x.ClassName, x.LessonSortNo }).Select(x => new ClassDataList() + { + ClassNo = x.Key.TeachClassNo, + ClassName = x.Key.ClassName, + LessonSortNo = x.Key.LessonSortNo, + TimeTableList = x.Select(y => new TwoDevelopment.EducationalAdministration.TimeTable() + { + AcademicYear = y.AcademicYear, + Semester = y.Semester, + DeptNo = y.DeptNo, + MajorNo = y.MajorNo, + F_SchoolId = y.F_SchoolId, + LessonNo = y.LessonNo, + LessonName = y.LessonName, + LessonDate = y.LessonDate, + LessonTime = y.LessonTime, + EmpNo = y.EmpNo, + EmpName = y.EmpName, + TeachClassNo = y.TeachClassNo, + ClassName = y.ClassName, + ClassRoomNo = y.ClassRoomNo, + ClassroomName = y.ClassroomName, + LessonSortNo = y.LessonSortNo + }).OrderBy(a => a.LessonTime.Substring(0, 1)).ThenBy(a => a.LessonTime.Substring(1)).ToList() + }).OrderBy(x => x.LessonSortNo).ThenBy(x => x.ClassNo).ToList(); + + result.ClassDataList = dataTemp; + + return Success(result); + + } /// /// 数字转中文 @@ -167,6 +230,30 @@ namespace Learun.Application.WebApi.Modules { public string StartDate { get; set; } public string EndDate { get; set; } + /// + /// 班级编号 + /// + public string ClassNo { get; set; } + /// + /// 教师编号 + /// + public string EmpNo { get; set; } } + public class TimeTableData + { + public string AcademicYearNo { get; set; } + public string Semester { get; set; } + public string StartDate { get; set; } + public string EndDate { get; set; } + public List ClassDataList { get; set; } + } + public class ClassDataList + { + public string ClassNo { get; set; } + public string ClassName { get; set; } + public string LessonSortNo { get; set; } + public List TimeTableList { get; set; } + } + } \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreBLL.cs index 9fc249220..f311eb7a9 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreBLL.cs @@ -677,6 +677,30 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + /// + /// 根据学号/姓名获取学生成绩列表 + /// + /// + /// + public IEnumerable GetScoreListByStuInfo(string queryJson) + { + try + { + return stuScoreService.GetScoreListByStuInfo(queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + public List GetStuGraduateInfo(string queryJson) { try diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreEntity.cs index 5b3681e63..8946527f4 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreEntity.cs @@ -388,11 +388,29 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// - /// 成绩格式化(补)(重) + /// 成绩格式化(补)(重)(选修) /// [NotMapped] public string ScoreFormat { get; set; } + /// + /// 补考成绩 + /// + [NotMapped] + public string ScoreOfNotPass { get; set; } + /// + /// 二次补考成绩 + /// + [NotMapped] + public string ScoreOfNotPassTwo { get; set; } + /// + /// 课程类别名称 + /// + /// + [NotMapped] + public string LessonSortName { get; set; } + + } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreIBLL.cs index 1943c15b9..7e987896c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreIBLL.cs @@ -182,6 +182,12 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// /// IEnumerable GetScoreListByStuNo(string queryJson); + /// + /// 根据学号/姓名获取学生成绩列表 + /// + /// + /// + IEnumerable GetScoreListByStuInfo(string queryJson); /// /// 获取个人成绩列表 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreService.cs index ab6ed7879..d45b6a6ae 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreService.cs @@ -1876,5 +1876,72 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad } } } + + /// + /// 根据学号/姓名获取学生成绩列表 + /// + /// + /// + public IEnumerable GetScoreListByStuInfo(string queryJson) + { + try + { + //参考写法 + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + var tableName = "StuScore"; + if (!queryParam["TableName"].IsEmpty()) + { + tableName = queryParam["TableName"].ToString(); + } + var strSql = new StringBuilder(); + strSql.Append(" select bb.AcademicYearNo,bb.Semester,bb.LessonSortNo,bb.LessonNo,bb.LessonName,bb.StuNo,bb.StuName,li.StudyScore,ls.LessonSortName,bb.Score,sp.Score as ScoreOfNotPass,spt.Score as ScoreOfNotPassTwo "); + strSql.Append(" from ( "); + strSql.Append($"select s.AcademicYearNo,s.Semester,s.LessonSortNo,s.LessonNo,s.LessonName,s.StuNo,sb.StuName,Max(s.Score) as Score from {tableName} s left join StuInfoBasic sb on s.StuNo=sb.StuNo "); + strSql.Append(" where 1=1 and s.CheckMark='1' "); + if (!queryParam["AcademicYearNo"].IsEmpty()) + { + dp.Add("AcademicYearNo", queryParam["AcademicYearNo"].ToString(), DbType.String); + strSql.Append(" and s.AcademicYearNo=@AcademicYearNo "); + } + if (!queryParam["Semester"].IsEmpty()) + { + dp.Add("Semester", queryParam["Semester"].ToString(), DbType.String); + strSql.Append(" and s.Semester=@Semester "); + } + if (!queryParam["StuNo"].IsEmpty()) + { + dp.Add("StuNo", queryParam["StuNo"].ToString(), DbType.String); + strSql.Append(" and s.StuNo=@StuNo "); + } + if (!queryParam["StuName"].IsEmpty()) + { + dp.Add("StuName", queryParam["StuName"].ToString(), DbType.String); + strSql.Append(" and s.StuName=@StuName "); + } + strSql.Append(" group by s.AcademicYearNo,s.Semester,s.LessonSortNo,s.LessonNo,s.LessonName,s.StuNo,sb.StuName ) as bb "); + strSql.Append(" left join StuScoreNotPass sp on bb.AcademicYearNo=sp.AcademicYearNo and bb.Semester=sp.Semester and bb.LessonSortNo=sp.LessonSortNo and bb.LessonNo=sp.LessonNo and bb.LessonName=sp.LessonName and bb.StuNo=sp.StuNo and sp.CheckMark = '1' "); + strSql.Append(" left join StuScoreNotPassTwo spt on bb.AcademicYearNo=spt.AcademicYearNo and bb.Semester=spt.Semester and bb.LessonSortNo=spt.LessonSortNo and bb.LessonNo=spt.LessonNo and bb.LessonName=spt.LessonName and bb.StuNo=spt.StuNo and spt.CheckMark = '1' "); + strSql.Append(" left join CdLessonSort ls on bb.LessonSortNo= ls.LessonSortNo "); + strSql.Append(" left join LessonInfo li on bb.LessonNo= li.LessonNo "); + + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + + } }