diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuScoreOnlineController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuScoreOnlineController.cs new file mode 100644 index 000000000..9ad9d7fd8 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuScoreOnlineController.cs @@ -0,0 +1,1244 @@ +using Hangfire; +using Learun.Application.Base.SystemModule; +using Learun.Application.Organization; +using Learun.Application.TwoDevelopment.EducationalAdministration; +using Learun.Util; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Web.Mvc; + +namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers +{ + /// + /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 + /// Copyright (c) 2013-2018 北京泉江科技有限公司 + /// 创 建:超级管理员 + /// 日 期:2019-06-14 11:02 + /// 描 述:考试成绩同步 + /// + public class StuScoreOnlineController : MvcControllerBase + { + private StuScoreOnlineIBLL stuScoreOnlineIBLL = new StuScoreOnlineBLL(); + //暂时注释 + //private StuScoreOnlineNotPassIBLL stuScoreOnlineNotPassIBLL = new StuScoreOnlineNotPassBLL(); + //private StuScoreOnlineNotPassTwoIBLL stuScoreOnlineNotPassTwoIBLL = new StuScoreOnlineNotPassTwoBLL(); + private ClassInfoIBLL classInfoIBLL = new ClassInfoBLL(); + private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL(); + private CdMajorIBLL cdMajorIBLL = new CdMajorBLL(); + private UserIBLL userIBLL = new UserBLL(); + private EADateArrangeIBLL eADateArrangeIBLL = new EADateArrangeBLL(); + private AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL(); + + + #region 视图功能 + + /// + /// 主页面 + /// + /// + [HttpGet] + public ActionResult Index() + { + return View(); + } + [HttpGet] + public ActionResult Monitor() + { + return View(); + } + /// + /// 表单页 + /// + /// + [HttpGet] + public ActionResult Form() + { + return View(); + } + /// + /// 主页面【班级学生成绩初始化】 + /// + /// + [HttpGet] + public ActionResult ClassIndex() + { + return View(); + } + /// + /// 班级成绩查看页面 + /// + /// + [HttpGet] + public ActionResult ScoreQueryIndex() + { + return View(); + } + /// + /// 毕业证资格审核 + /// + /// + [HttpGet] + public ActionResult ScoreQueryAllIndex() + { + return View(); + } + /// + /// 个人成绩查看 + /// + /// + [HttpGet] + public ActionResult StuScoreOnlineQueryIndex() + { + var logininfo = LoginUserInfo.Get(); + ViewBag.StuNo = logininfo.account; + return View(); + } + /// + /// 毕业证资格审核(班主任) + /// + /// + [HttpGet] + public ActionResult ScoreQueryAllIndexTeacher() + { + return View(); + } + /// + /// 全院班级成绩查看页面 + /// + /// + [HttpGet] + public ActionResult AllScoreQueryIndex() + { + return View(); + } + /// + /// 新版成绩录入 + /// + /// + [HttpGet] + public ActionResult InputScoreIndex() + { + //获取“教学工作安排”中“线上成绩录入”的记录 + var entity = eADateArrangeIBLL.GetEADateArrangeEntityByName("线上成绩录入"); + if (entity != null && entity.CheckMark == "1" && DateTime.Now > entity.MakeDate && DateTime.Now < entity.EndDate) + { + ViewBag.CanInputFlag = true;//可以录入成绩标识 + } + else + { + ViewBag.CanInputFlag = false; + } + + return View(); + } + /// + /// 新版成绩录入 + /// + /// + [HttpGet] + public ActionResult InputScoreIndexInTeacher() + { + //获取“教学工作安排”中“线上成绩录入”的记录 + var entity = eADateArrangeIBLL.GetEADateArrangeEntityByName("线上成绩录入"); + if (entity != null && entity.CheckMark == "1" && DateTime.Now > entity.MakeDate && DateTime.Now < entity.EndDate) + { + ViewBag.CanInputFlag = true;//可以录入成绩标识 + } + else + { + ViewBag.CanInputFlag = false; + } + + return View(); + } + + /// + /// 成绩统计分析 + /// + /// + [HttpGet] + public ActionResult ScoreStatisticAnalysis() + { + return View(); + } + + /// + /// 毕业学生成绩查看页面 + /// + /// + [HttpGet] + public ActionResult GraduateScoreQueryAllIndex() + { + return View(); + } + + + + /// + /// 学生成绩录入可去审核页面 + /// + /// + [HttpGet] + public ActionResult ScoreInputCancelIndex() + { + return View(); + } + /// + /// 学生成绩录入可去审核页面 + /// + /// + [HttpGet] + public ActionResult ScoreInputCancelForm() + { + return View(); + } + /// + /// 全院学生成绩查看页面 + /// + /// + [HttpGet] + public ActionResult AllStuScoreOnlineQueryIndex() + { + return View(); + } + /// + /// 全院学生成绩打印 + /// + /// + [HttpGet] + public ActionResult AllStuScoreOnlineQueryPrint() + { + ViewBag.WebApi = ConfigurationManager.AppSettings["WebApi"]; + return View(); + } + + + /// + /// 成绩录入导入 + /// + /// + [HttpGet] + public ActionResult InputScoreIndexInTeacherImport() + { + return View(); + } + + #endregion + + #region 获取数据 + + /// + /// 获取列表数据 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetList(string queryJson) + { + var data = stuScoreOnlineIBLL.GetList(queryJson).OrderBy(a => a.StuNo); + return Success(data); + } + [HttpGet] + [AjaxOnly] + public ActionResult GetMonitorList(string queryJson) + { + var data = stuScoreOnlineIBLL.GetMonitorList(queryJson); + return Success(data); + } + /// + /// 获取列表分页数据 + /// 分页参数 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetPageList(string pagination, string queryJson) + { + Pagination paginationobj = pagination.ToObject(); + var data = stuScoreOnlineIBLL.GetPageList(paginationobj, queryJson); + var jsonData = new + { + rows = data, + total = paginationobj.total, + page = paginationobj.page, + records = paginationobj.records + }; + return Success(jsonData); + } + /// + /// 获取表单数据 + /// 主键 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetFormData(string keyValue) + { + var data = stuScoreOnlineIBLL.GetEntity(keyValue); + return Success(data); + } + /// + /// 获取列表分页数据 + /// 分页参数 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetScoreInputCancelPageList(string pagination, string queryJson) + { + Pagination paginationobj = pagination.ToObject(); + + var aa = JsonConvert.DeserializeObject(queryJson); + + var data = new List(); + if (!string.IsNullOrEmpty(aa.AcademicYearNo) || !string.IsNullOrEmpty(aa.Semester) || !string.IsNullOrEmpty(aa.EmpNo) || !string.IsNullOrEmpty(aa.LessonNo) || !string.IsNullOrEmpty(aa.ClassNo) || !string.IsNullOrEmpty(aa.StuNo)) + { + data = stuScoreOnlineIBLL.GetScoreInputCancelPageList(paginationobj, queryJson).ToList(); + } + var jsonData = new + { + rows = data, + total = paginationobj.total, + page = paginationobj.page, + records = paginationobj.records + }; + return Success(jsonData); + } + /// + /// 获取表单数据 + /// 主键 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetScoreInputCancelFormData(string keyValue) + { + var data = stuScoreOnlineIBLL.GetEntity(keyValue); + var StuSelectLessonListData = stuScoreOnlineIBLL.GetStuSelectLessonListEntity(data); + var jsonData = new + { + StuScoreOnline = data, + StuSelectLessonList = StuSelectLessonListData + }; + return Success(jsonData); + } + + /// + /// 获取列表数据 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetEntityByJson(string queryJson) + { + var data = stuScoreOnlineIBLL.GetEntityByJson(queryJson); + return Success(data); + } + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// 主键 + /// + /// + [HttpPost] + [AjaxOnly] + public ActionResult DeleteForm(string keyValue) + { + stuScoreOnlineIBLL.DeleteEntity(keyValue); + return Success("删除成功!"); + } + [HttpPost] + [AjaxOnly] + public ActionResult Submit(string AcademicYearNo, string Semester, string LessonNo, string EmpNo, string EditUserId) + { + stuScoreOnlineIBLL.SubmitStuScoreOnline(AcademicYearNo, Semester, LessonNo, EmpNo); + var userEntity = userIBLL.GetEntityByAccount(EditUserId); + if (userEntity != null) + { + var name = userEntity.F_Account + "_" + userEntity.F_RealName + "_线上成绩录入"; + + //删除任务 + RecurringJob.RemoveIfExists(name); + } + return Success("操作成功!"); + } + + [HttpPost] + [AjaxOnly] + public ActionResult DeleteList() + { + stuScoreOnlineIBLL.DeleteList(); + return Success("清空成功!"); + } + /// + /// 保存实体数据(新增、修改) + /// 主键 + /// + /// + [HttpPost] + [ValidateAntiForgeryToken] + [AjaxOnly] + public ActionResult SaveForm(string keyValue, StuScoreOnlineEntity entity) + { + stuScoreOnlineIBLL.SaveEntity(keyValue, entity); + return Success("保存成功!"); + } + #endregion + + #region 扩展数据 + + /// + /// 获取班级成绩初始化分页数据 + /// 分页参数 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetPageListAboutClass(string pagination, string queryJson) + { + Pagination paginationobj = pagination.ToObject(); + var data = stuScoreOnlineIBLL.GetPageListAboutClass(paginationobj, queryJson); + var jsonData = new + { + rows = data, + total = paginationobj.total, + page = paginationobj.page, + records = paginationobj.records + }; + return Success(jsonData); + } + + /// + /// 班级学生成绩录入初始化 + /// + /// + [HttpPost] + [AjaxOnly] + public ActionResult DoInitAboutClass(string academicYearNo, string semester, string classNo) + { + stuScoreOnlineIBLL.DoInitAboutClass(academicYearNo, semester, classNo); + return Success("初始化成功!"); + } + + /// + /// 学年下拉框信息【班级成绩查看】 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetAcademicYearNoData() + { + var data = stuScoreOnlineIBLL.GetAcademicYearNoData(); + + return Success(data); + } + /// + /// 学期下拉框信息【班级成绩查看】 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetSemesterData() + { + var data = WebHelper.GenerateNearBySemeter(); + + return Success(data); + } + + /// + /// 学期下拉框信息【班级成绩查看】 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetSemesterDataTwo() + { + var data = WebHelper.GenerateNearBySemeterTwo(); + + return Success(data); + } + /// + /// 班级下拉框信息【成绩录入新页面】 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetClassNoDataOfAll(string lessonNo) + { + var data = stuScoreOnlineIBLL.GetClassNoData("", "", lessonNo); + + return Success(data); + } + /// + /// 班级下拉框信息【班级成绩查看】 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetClassNoData(string lessonNo) + { + var loginInfo = LoginUserInfo.Get(); + var data = stuScoreOnlineIBLL.GetClassNoData(loginInfo.account, loginInfo.Description, lessonNo); + + return Success(data); + } + + /// + /// 班级下拉框信息【成绩录入】 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetClassNoDataForInput(string lessonNo, string AcademicYearShort, string Semester) + { + var loginInfo = LoginUserInfo.Get(); + // var semesterAndYear = Common.GetSemesterAndYear(); + var data = stuScoreOnlineIBLL.GetClassNoDataForInput(loginInfo.account, loginInfo.Description, lessonNo, AcademicYearShort, Semester); + + return Success(data); + } + /// + /// 班级下拉框信息【全院班级成绩查看】 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetAllClassNoData() + { + var data = stuScoreOnlineIBLL.GetClassNoData("", "", ""); + + return Success(data); + } + /// + /// 教师下拉框信息 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetEmpNoDataOfAll(string lessonNo) + { + var data = stuScoreOnlineIBLL.GetEmpNoData("", "", lessonNo); + + return Success(data); + } + /// + /// 教师下拉框信息【学生成绩录入可去审核】 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetEmpNoData(string lessonNo) + { + var loginInfo = LoginUserInfo.Get(); + var data = stuScoreOnlineIBLL.GetEmpNoData(loginInfo.account, loginInfo.Description, lessonNo); + + return Success(data); + } + /// + /// 课程下拉框信息【学生成绩录入可去审核】 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetLessonNoDataOfAll() + { + var loginInfo = LoginUserInfo.Get(); + var data = stuScoreOnlineIBLL.GetLessonNoDataOfAll(loginInfo.account, loginInfo.Description); + + return Success(data); + } + /// + /// 课程下拉框 带编号 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetLessonNoDataOfAllWithNo() + { + var data = stuScoreOnlineIBLL.GetLessonNoDataOfAll("", ""); + foreach (var item in data) + { + item.text = string.Format("{0}({1})", item.text, item.value); + } + + return Success(data); + } + /// + /// 课程下拉框 带编号 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetLessonNoDataWithNo(string AcademicYearShort, string Semester) + { + var loginInfo = LoginUserInfo.Get(); + //var semesterAndYear = Common.GetSemesterAndYear(); + var data = stuScoreOnlineIBLL.GetLessonNoDataOfAll(loginInfo.account, loginInfo.Description, AcademicYearShort, Semester); + foreach (var item in data) + { + item.text = string.Format("{0}({1})", item.text, item.value); + } + + return Success(data); + } + /// + /// 选修课程下拉框 带编号【选修课】 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetElectiveLessonNoDataOfAllWithNo() + { + var data = stuScoreOnlineIBLL.GetElectiveLessonNoDataOfAll("", ""); + foreach (var item in data) + { + item.text = string.Format("{0}({1})", item.text, item.value); + } + + return Success(data); + } + /// + /// 选修课程下拉框 带编号【选修课】 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetElectiveLessonNoDataWithNo(string AcademicYearShort, string Semester) + { + var loginInfo = LoginUserInfo.Get(); + //var semesterAndYear = Common.GetSemesterAndYear(); + var data = stuScoreOnlineIBLL.GetElectiveLessonNoDataOfAll(loginInfo.account, loginInfo.Description, AcademicYearShort, Semester); + foreach (var item in data) + { + item.text = string.Format("{0}({1})", item.text, item.value); + } + + return Success(data); + } + + /// + /// 教室下拉框信息【选修课】 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetElectiveClassRoomNoDataOfAll(string lessonNo) + { + var data = stuScoreOnlineIBLL.GetElectiveClassRoomNoData("", "", lessonNo); + + return Success(data); + } + /// + /// 教室下拉框信息【选修课】 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetElectiveClassRoomNoData(string lessonNo) + { + var loginInfo = LoginUserInfo.Get(); + var data = stuScoreOnlineIBLL.GetElectiveClassRoomNoData(loginInfo.account, loginInfo.Description, lessonNo); + + return Success(data); + } + + /// + /// 节次下拉框信息【选修课】 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetElectiveLessonSectionDataOfAll(string classRoomNo) + { + var data = stuScoreOnlineIBLL.GetElectiveLessonSectionData("", "", classRoomNo); + + return Success(data); + } + /// + /// 节次下拉框信息【选修课】 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetElectiveLessonSectionData(string classRoomNo) + { + var loginInfo = LoginUserInfo.Get(); + var data = stuScoreOnlineIBLL.GetElectiveLessonSectionData(loginInfo.account, loginInfo.Description, classRoomNo); + + return Success(data); + } + + /// + /// 课程信息【班级成绩查看】 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetLessonNoData(string academicYearNo, string semester, string classNo) + { + var data = stuScoreOnlineIBLL.GetLessonNoData(academicYearNo, semester, classNo).OrderBy(x => x.value); + + return Success(data); + } + + /// + /// 根据StuNo查询班级课程 + /// + /// + /// + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetLessonNoDataFromStuNo(string academicYearNo, string semester, string StuNo) + { + var data = stuScoreOnlineIBLL.GetLessonNoDataFromStuNo(academicYearNo, semester, StuNo).OrderBy(x => x.value); + + return Success(data); + } + + /// + /// 获取班级成绩列表 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetScoreListByClassNo(string queryJson) + { + var data = stuScoreOnlineIBLL.GetScoreListByClassNo(queryJson); + var stuData = stuInfoBasicIBLL.GetAllList(); + + var aa = data.GroupBy(x => new { x.StuNo, x.StuName, x.StuId }).Select(x => new + { + StuId = x.Key.StuId, + StuNo = x.Key.StuNo, + StuName = x.Key.StuName, + FinishSchoolMark = stuData.FirstOrDefault(a => a.StuNo == x.Key.StuNo)?.FinishSchoolMark, + TotalScore = x.Select(y => y.Score).Sum(), + LessonInfo = x.Select(y => new { y.LessonNo, y.LessonName, y.Score, y.ScoreFormat }).OrderBy(y => y.LessonNo) + }).OrderByDescending(x => x.TotalScore); + + var result = new List>(); + foreach (var item in aa) + { + var aaa = new Dictionary(); + aaa.Add("StuId", item.StuId); + aaa.Add("StuNo", item.StuNo); + aaa.Add("StuName", item.StuName); + aaa.Add("FinishSchoolMark", item.FinishSchoolMark); + aaa.Add("TotalScore", item.TotalScore.ToString()); + foreach (var lessonInfoItem in item.LessonInfo) + { + aaa.Add(lessonInfoItem.LessonNo, lessonInfoItem.ScoreFormat); + } + + result.Add(aaa); + } + + return Success(result); + } + + [HttpGet] + [AjaxOnly] + public ActionResult GetScoreListByStuNo(string queryJson) + { + var data = stuScoreOnlineIBLL.GetScoreListByStuNo(queryJson); + var stuData = stuInfoBasicIBLL.GetAllList(); + + var aa = data.GroupBy(x => new { x.StuNo, x.StuName, x.StuId }).Select(x => new + { + StuId = x.Key.StuId, + StuNo = x.Key.StuNo, + StuName = x.Key.StuName, + FinishSchoolMark = stuData.FirstOrDefault(a => a.StuNo == x.Key.StuNo)?.FinishSchoolMark, + TotalScore = x.Where(m => m.LessonSortNo == "1").Select(y => y.Score).Sum(), + LessonInfo = x.Select(y => new { y.LessonNo, y.LessonName, y.Score, y.ScoreFormat }).OrderBy(y => y.LessonNo) + }).OrderByDescending(x => x.TotalScore); + + var result = new List>(); + foreach (var item in aa) + { + var aaa = new Dictionary(); + aaa.Add("StuId", item.StuId); + aaa.Add("StuNo", item.StuNo); + aaa.Add("StuName", item.StuName); + aaa.Add("FinishSchoolMark", item.FinishSchoolMark); + aaa.Add("TotalScore", item.TotalScore.ToString()); + foreach (var lessonInfoItem in item.LessonInfo) + { + aaa.Add(lessonInfoItem.LessonNo, lessonInfoItem.ScoreFormat); + } + + result.Add(aaa); + } + + return Success(result); + } + + /// + /// 全院学生成绩查看 + /// + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetScoreListByStuInfo(string queryJson) + { + var data = stuScoreOnlineIBLL.GetScoreListByStuInfo(queryJson); + if (data.Any()) + { + data = data.OrderByDescending(x => x.AcademicYearNo).ThenByDescending(x => x.Semester).ThenBy(x => x.LessonSortNo).ThenBy(x => x.LessonNo); + } + + return Success(data); + } + + public ActionResult GetScoreCharts(string AcademicYearNo, string Semester, string ClassNo, string LessonNo) + { + var data = stuScoreOnlineIBLL.GetScoreCharts(AcademicYearNo, Semester, ClassNo, LessonNo); + return Success(data); + } + + [HttpGet] + [AjaxOnly] + public ActionResult GetScoreInfo(string queryJson) + { + var data = stuScoreOnlineIBLL.GetScoreInfo(queryJson); + return JsonResult(data); + } + + /// + /// 导出班级成绩列表 + /// + /// + //[HttpGet] + //[AjaxOnly] + [HttpPost, ValidateInput(false)] + public ActionResult ExportScoreListByClassNo(string queryJson) + { + var queryModel = JsonConvert.DeserializeObject(queryJson); + var className = string.Empty; + if (!string.IsNullOrEmpty(queryModel.ClassNo)) + { + var classInfoEntity = classInfoIBLL.GetClassInfoEntityByClassNo(queryModel.ClassNo); + className = classInfoEntity != null ? classInfoEntity.ClassName : string.Empty; + } + + var data = stuScoreOnlineIBLL.GetScoreListByClassNo(queryJson); + var aa = data.GroupBy(x => new { x.StuNo, x.StuName }).Select(x => new + { + StuNo = x.Key.StuNo, + StuName = x.Key.StuName, + TotalScore = x.Select(y => y.Score).Sum(), + LessonInfo = x.Select(y => new { y.LessonNo, y.LessonName, y.Score, y.ScoreFormat }).OrderBy(y => y.LessonNo) + }).OrderByDescending(x => x.TotalScore); + var result = new List>(); + foreach (var item in aa) + { + var aaa = new Dictionary(); + aaa.Add("StuNo", item.StuNo); + aaa.Add("StuName", item.StuName); + aaa.Add("TotalScore", item.TotalScore.ToString()); + foreach (var lessonInfoItem in item.LessonInfo) + { + aaa.Add(lessonInfoItem.LessonNo, lessonInfoItem.ScoreFormat); + } + + result.Add(aaa); + } + var resultStr = JsonConvert.SerializeObject(result); + + //班级成绩源 + var exportTable = resultStr.ToTable(); + //设置导出格式 + ExcelConfig excelconfig = new ExcelConfig(); + excelconfig.Title = className + " 班级成绩列表"; + excelconfig.TitleFont = "微软雅黑"; + excelconfig.TitlePoint = 20; + excelconfig.FileName = className + " 班级成绩导出.xls"; + excelconfig.IsAllSizeColumn = true; + //每一列的设置,没有设置的列信息,系统将按datatable中的列名导出 + excelconfig.ColumnEntity = new List(); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "StuNo", ExcelColumn = "学号" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "StuName", ExcelColumn = "姓名" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "TotalScore", ExcelColumn = "总分" }); + + //课程动态列 + var lessonTemp = stuScoreOnlineIBLL.GetLessonNoData(queryModel.AcademicYearNo, queryModel.Semester, queryModel.ClassNo).OrderBy(x => x.value); + foreach (var lessonTempItem in lessonTemp) + { + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = lessonTempItem.value, ExcelColumn = lessonTempItem.text }); + } + + //调用导出方法 + ExcelHelper.ExcelDownload(exportTable, excelconfig); + + return Success("导出成功!"); + } + /// + /// 查询条件模型【班级成绩查看】 + /// + public class QueryModel + { + public string AcademicYearNo { get; set; } + public string Semester { get; set; } + public string ClassNo { get; set; } + } + + [HttpGet] + [AjaxOnly] + public ActionResult GetStuGraduateInfo(string queryJson) + { + var data = stuScoreOnlineIBLL.GetStuGraduateInfo(queryJson); + return JsonResult(data); + } + + [HttpGet] + [AjaxOnly] + public ActionResult GetPassInfo(string queryJson) + { + var data = stuScoreOnlineIBLL.GetPassInfo(queryJson); + return JsonResult(data); + } + + + [HttpGet] + [AjaxOnly] + public ActionResult GetClassOfMy() + { + var data = stuScoreOnlineIBLL.GetClassOfMy(); + return JsonResult(data); + } + + + + /// + /// 获取打印成绩单数据 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetScoreListByStuNoList(string stuNoList) + { + var dataList = new List(); + var stuNoArr = stuNoList.Split(','); + foreach (var stuNo in stuNoArr) + { + var stuInfoBasicEntity = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(stuNo); + if (stuInfoBasicEntity != null) + { + var classInfoEntity = classInfoIBLL.GetClassInfoEntityByClassNo(stuInfoBasicEntity.ClassNo); + var cdMajorEntity = cdMajorIBLL.GetCdMajorEntityByMajorNo(stuInfoBasicEntity.MajorNo); + var scoreList = stuScoreOnlineIBLL.GetAllScoreListByStuNo(stuNo); + var scoreListOfSortNo1 = scoreList.Where(x => x.LessonSortNo == "1"); //必修课 + if (scoreListOfSortNo1.Any()) + { + foreach (var item in scoreListOfSortNo1) + { + if ((item.Score >= 0 && item.Score < 60) || item.Score == (-5) || item.Score == (-10)) + { + item.StuNo = stuNo; + var scoreNotPassEntity = stuScoreOnlineIBLL.GetScoreNotPassByEntity(item); + if (scoreNotPassEntity != null) + { + item.Score = scoreNotPassEntity.Score; + if ((scoreNotPassEntity.Score >= 0 && scoreNotPassEntity.Score < 60) || scoreNotPassEntity.Score == (-5) || scoreNotPassEntity.Score == (-10)) + { + scoreNotPassEntity.StuNo = stuNo; + var scoreNotPassTwoEntity = stuScoreOnlineIBLL.GetScoreNotPassTwoByEntity(scoreNotPassEntity); + if (scoreNotPassTwoEntity != null) + { + item.Score = scoreNotPassTwoEntity.Score; + } + } + } + } + } + } + + var list = scoreList.GroupBy(x => new { x.AcademicYearNo, x.Semester }).Select(x => new + { + academicYearNo = x.Key.AcademicYearNo, + semester = x.Key.Semester, + title = string.Format("{0}学年度第{1}学期", x.Key.AcademicYearNo, x.Key.Semester), + list = x.Select(y => new + { + type = y.LessonSortNo == "1" ? "专业课" : y.LessonSortNo == "2" ? "选修课" : "公共课", + className = y.LessonName, + achievement = y.Score.HasValue ? y.Score.Value.ToString() : string.Empty, + lessonNo = y.LessonNo + }).OrderBy(y => y.lessonNo) + }).OrderByDescending(x => x.academicYearNo).OrderByDescending(x => x.semester); + + var data = new + { + schoolId = stuInfoBasicEntity.F_SchoolId, + school = string.Empty, + major = cdMajorEntity != null ? cdMajorEntity.MajorName : string.Empty, + className = classInfoEntity != null ? classInfoEntity.ClassName : string.Empty, + student = stuInfoBasicEntity.StuName, + number = stuInfoBasicEntity.StuNo, + arrangementId = stuInfoBasicEntity.EduSystem, + arrangement = string.Empty, + list = list.Select(x => new { x.title, list = x.list.Select(y => new { y.type, y.className, y.achievement }) }) + }; + + dataList.Add(data); + } + } + + return Success(dataList); + } + + /// + /// 审核学生成绩 + /// + /// 成绩主键 + /// + [HttpPost] + [AjaxOnly] + public ActionResult CheckStuScoreOnline(string keyValue) + { + stuScoreOnlineIBLL.CheckStuScoreOnline(keyValue); + return Success("操作成功!"); + } + /// + /// 去审核学生成绩 + /// + /// 成绩主键 + /// + [HttpPost] + [AjaxOnly] + public ActionResult UnCheckStuScoreOnline(string keyValue) + { + stuScoreOnlineIBLL.UnCheckStuScoreOnline(keyValue); + return Success("操作成功!"); + } + + /// + /// 开始录入:占用成绩 + /// + /// + [HttpPost] + [AjaxOnly] + public ActionResult StartInputScore(string queryJson) + { + var loginInfo = LoginUserInfo.Get(); + var name = loginInfo.account + "_" + loginInfo.realName + "_线上成绩录入"; + + stuScoreOnlineIBLL.StartInputScore(queryJson); + + //添加任务 + //RecurringJob.AddOrUpdate(name, + // () => SaveInputScoreStatus2(queryJson, name), + // Cron.MinuteInterval(3), TimeZoneInfo.Local); + //var m = DateTime.Now.Minute + 30; + //if (m >= 60) + //{ + // m = m - 60; + //} + var newDate = DateTime.Now.AddMinutes(30); + RecurringJob.AddOrUpdate(name, + () => SaveInputScoreStatus2(queryJson, name), + string.Format("{0} {1} * * *", newDate.Minute, newDate.Hour), TimeZoneInfo.Local); + return Success("操作成功"); + } + /// + /// 续时 + /// + /// + [HttpPost] + [AjaxOnly] + public ActionResult AddMinutes(string queryJson, int minutes) + { + var loginInfo = LoginUserInfo.Get(); + var name = loginInfo.account + "_" + loginInfo.realName + "_线上成绩录入"; + + //更新任务 + //var m = DateTime.Now.Minute + minutes; + //if (m >= 60) + //{ + // m = m - 60; + //} + var newDate = DateTime.Now.AddMinutes(minutes); + RecurringJob.AddOrUpdate(name, + () => SaveInputScoreStatus2(queryJson, name), + string.Format("{0} {1} * * *", newDate.Minute, newDate.Hour), TimeZoneInfo.Local); + return Success("操作成功"); + } + + /// + /// 提交成绩 + /// + /// + [HttpPost] + [AjaxOnly] + public ActionResult SaveInputScore(string data) + { + var list = JsonConvert.DeserializeObject>(data); + if (list.Any()) + { + stuScoreOnlineIBLL.SaveInputScore(list); + } + return Success("操作成功"); + } + /// + /// 提交成绩:取消占用 + /// + /// + [HttpPost] + [AjaxOnly] + public ActionResult SaveInputScoreStatus(string queryJson) + { + var loginInfo = LoginUserInfo.Get(); + var name = loginInfo.account + "_" + loginInfo.realName + "_线上成绩录入"; + + stuScoreOnlineIBLL.SaveInputScoreStatus(queryJson); + //删除任务 + RecurringJob.RemoveIfExists(name); + + return Success("操作成功"); + } + /// + /// 提交成绩:取消占用【服务】 + /// + /// + public ActionResult SaveInputScoreStatus2(string queryJson, string name) + { + stuScoreOnlineIBLL.SaveInputScoreStatus2(queryJson, name); + //删除任务 + RecurringJob.RemoveIfExists(name); + + return Success("操作成功"); + } + + /// + /// 审核成绩 + /// + /// + /// 已审核:1;未审核:0; + /// + [HttpPost] + [AjaxOnly] + public ActionResult DoCheckScore(string queryJson, int checkMark) + { + stuScoreOnlineIBLL.DoCheckScore(queryJson, checkMark); + return Success("操作成功"); + } + + + #endregion + + #region 成绩录入--导入 + /// + /// 成绩导入---下载导入模板 + /// + /// + /// 表头 + /// 列表数据 + [HttpPost, ValidateInput(false)] + public void ExportExcel(string fileName, string columnJson, string dataJson) + { + //设置导出格式 + ExcelConfig excelconfig = new ExcelConfig(); + //excelconfig.Title = Server.UrlDecode(fileName); + excelconfig.TitleFont = "微软雅黑"; + excelconfig.TitlePoint = 15; + excelconfig.FileName = Server.UrlDecode(fileName) + ".xls"; + excelconfig.IsAllSizeColumn = true; + excelconfig.ColumnEntity = new List(); + //表头 + List columnList = columnJson.ToList(); + //行数据 + DataTable rowData = dataJson.ToTable(); + ////写入Excel表头 + //Dictionary exportFieldMap = new Dictionary(); + //if (!string.IsNullOrEmpty(exportField)) + //{ + // string[] exportFields = exportField.Split(','); + // foreach (var field in exportFields) + // { + // if (!exportFieldMap.ContainsKey(field)) + // { + // exportFieldMap.Add(field, "1"); + // } + // } + //} + + foreach (jfGridModel columnModel in columnList) + { + //if (exportFieldMap.ContainsKey(columnModel.name) || string.IsNullOrEmpty(exportField)) + //{ + excelconfig.ColumnEntity.Add(new ColumnModel() + { + Column = columnModel.name, + ExcelColumn = columnModel.label, + Alignment = columnModel.align, + }); + + // } + } + ExcelHelper.ExcelDownload(rowData, excelconfig); + } + + /// + /// 成绩导入 + /// + /// 1必修;2选修;3补考成绩;4二次补考成绩 + /// + /// + /// + /// + [HttpPost] + [ValidateAntiForgeryToken] + public ActionResult ExecuteImportExcel(int type, string fileGuid, int chunks, string queryJson) + { + string path = annexesFileIBLL.SaveAnnexes(fileGuid, fileGuid, chunks, LoginUserInfo.Get()); + if (!string.IsNullOrEmpty(path)) + { + DataTable dt = ExcelHelper.ExcelImport(path); + (DataTable failDt, int snum, int fnum) res; + + res = stuScoreOnlineIBLL.ExecuteImportExcel(type, dt, fileGuid, queryJson); + + //暂时注释 + //if (type == 1 || type == 2) + //{ + // //必修选修 + // res = stuScoreOnlineIBLL.ExecuteImportExcel(type, dt, fileGuid, queryJson); + //} + //else if (type == 3) + //{ + // //补考 + // res = stuScoreOnlineNotPassIBLL.ExecuteImportExcelForNotPass(dt, fileGuid, queryJson); + //} + //else + //{ + // //二次补考 + // res = stuScoreOnlineNotPassTwoIBLL.ExecuteImportExcelForNotPassTwo(dt, fileGuid, queryJson); + //} + var data = new + { + Success = res.snum, + Fail = res.failDt.Rows.Count + }; + return Success(data); + } + else + { + return Fail("导入数据失败!"); + } + } + + + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndex.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndex.cshtml new file mode 100644 index 000000000..2c34f895c --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndex.cshtml @@ -0,0 +1,122 @@ +@{ ViewBag.Title = "全院学生线上成绩录入"; Layout = "~/Views/Shared/_Index.cshtml"; } + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+  查询 +
+
+ + +
+
+ @*比例设置: + 平时成绩占比 0 %, + 期中成绩占比 0 %, + 期末成绩占比 0 %, + 其他成绩占比 0 %*@ +
提示:录入完成后,请务必点击“提交成绩”按钮,避免成绩丢失!
+ +
+
+
+
+
+
+@Html.AppendJsFile("/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndex.js") + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndex.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndex.js new file mode 100644 index 000000000..7ae6b5bea --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndex.js @@ -0,0 +1,553 @@ +/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) + * Copyright (c) 2013-2018 北京泉江科技有限公司 + * 创建人:超级管理员 + * 日 期:2023-06-12 11:02 + * 描 述:全院学生线上成绩录入 + */ +var selectedRow; +var refreshGirdData; +var refreshGirdData2; +var judgeSelect; //判断下拉框是否选择 +var modifyDate; //成绩被占用,且是登录用户时,成绩表中的编辑时间; +var timer; //计时器 +var submitScoreTimer; //五分钟提交成绩计时器 +var headData; //常规列头 +var headDataEdit; //可编辑列头 +var headDataNoEdit; //不可编辑列头 +var headDataFinally; //最终列头 +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + headData = [ + { + label: "审核状态", name: "CheckMark", width: 80, align: "center", + formatter: function (cellvalue) { + return cellvalue == "1" ? "已审核" : "未审核"; + } + }, + { label: '学年', name: 'AcademicYearNo', width: 50, align: "left" }, + { label: '学期', name: 'Semester', width: 40, align: "left" }, + { label: '课程名称', name: 'LessonName', width: 150, align: "left" }, + { + label: "学校名称", name: "F_SchoolId", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'company', + key: value, + keyId: 'f_companyid', + callback: function (_data) { + callback(_data['f_fullname']); + } + }); + } + }, + { + label: "学院", name: "DeptNo", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo', + key: value, + keyId: 'deptno', + callback: function (_data) { + callback(_data['deptname']); + } + }); + } + }, + { + label: "专业", name: "MajorNo", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo', + key: value, + keyId: 'majorno', + callback: function (_data) { + callback(_data['majorname']); + } + }); + } + }, + { + label: "班级", name: "ClassNo", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj', + key: value, + keyId: 'classno', + callback: function (_data) { + callback(_data['classname']); + } + }); + } + }, + { label: '学生姓名', name: 'StuName', width: 100, align: "left" }, + { label: '学生学号', name: 'StuNo', width: 100, align: "left" }, + ]; + headDataEdit = [ + { + label: '成绩', name: 'TermEndScore', width: 80, align: "left", + edit: { + type: 'input', + inputType: 'number', + change: function (row, rownum) { + row.Score = (parseFloat(row.TermEndScore || '0') * 1).toFixed(2); + $('#gridtable').jfGridSet('updateRow', rownum); + }, + } + }, + { label: '最终核定成绩', name: 'Score', width: 80, align: "left" }, + { + label: '备注', name: 'Remark', width: 100, align: "left", + edit: { + type: 'input', + } + }, + ]; + headDataNoEdit = [ + { + label: '成绩', name: 'TermEndScore', width: 80, align: "left" + }, + { label: '最终核定成绩', name: 'Score', width: 80, align: "left" }, + { + label: '备注', name: 'Remark', width: 100, align: "left" + }, + ]; + headDataFinally = headData.concat(headDataNoEdit); + + page.initGird(); + page.bind(); + page.bindSelect(); + }, + bind: function () { + //多条件选择 + $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { + page.search(queryJson); + }, 220, 500); + // 刷新 + $('#lr_refresh').on('click', function () { + location.reload(); + }); + //查询 + $('#btn_Search').on('click', function () { + refreshGirdData2(); + }); + //设置成绩比例(暂时未使用未修改) + $('#lr_setScale').on('click', function () { + var query = judgeSelect(); + if (query) { + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlan/GetOpenLessonPlanEntityByJson?queryJson=' + JSON.stringify(query), function (data) { + if (data["OpenLessonPlan"] != null) { + if (data["OpenLessonPlan"].IsAllowEdit) { //教务允许成绩录入时编辑比例 + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlan/GetStuSelectLessonListEntityByJson?queryJson=' + JSON.stringify(query), function (data) { + if (data["StuSelectLessonList"] != null) { + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetEntityByJson?queryJson=' + JSON.stringify(query), function (data) { + if (data != null) { + if (data.CheckMark == 1) { //学生成绩已审核 + learun.alert.warning("学生成绩已审核!"); + return false; + } else { + learun.layerForm({ + id: 'FormOfClass', + title: '班级成绩比例设置', + url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlan/FormOfClass?F_SchoolId=' + query.F_SchoolId + '&AcademicYearNo=' + query.AcademicYearNo + '&Semester=' + query.Semester + '&LessonNo=' + query.LessonNo + '&ClassNo=' + query.ClassNo, + width: 600, + height: 400, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData2); + } + }); + } + } else { + learun.alert.warning("学生成绩不存在!"); + return false; + } + }); + } else { + learun.alert.warning("学生选课数据不存在!"); + return false; + } + }); + } else { + learun.alert.warning("教务不允许设置成绩比例!"); + return false; + } + } else { + learun.alert.warning("开课计划不存在!"); + return false; + } + }); + } + }); + // 开始录入 + $('#lr_input').on('click', function () { + //提示弹框 + learun.layerConfirm('录入完成后,请务必点击“提交成绩”按钮,避免成绩丢失!', function (res) { + if (res) { + + var query = judgeSelect(); + if (query) { + //判断成绩比例是否合理 + //var OrdinaryScoreScale = $('#OrdinaryScoreScale').html(); + //var TermInScoreScale = $('#TermInScoreScale').html(); + //var TermEndScoreScale = $('#TermEndScoreScale').html(); + //var OtherScoreScale = $('#OtherScoreScale').html(); + //var totalScale = Number(OrdinaryScoreScale) + Number(TermInScoreScale) + Number(TermEndScoreScale) + Number(OtherScoreScale); + //if (totalScale !== 100) { + // learun.alert.warning("成绩比例设置不合理!"); + // return false; + //} else { + //判断是否已审核;判断是否被其他教师占用 + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetEntityByJson?queryJson=' + JSON.stringify(query), function (data) { + if (data != null) { + if (data.CheckMark == 1) { + learun.alert.warning("学生成绩已审核!"); + return false; + } + if (data.IsEditable == 0) { + if (data.EditUserId == learun.clientdata.get(['userinfo']).account) { + modifyDate = data.ModifyDate; + } else { + learun.alert.warning("当前班级成绩由账号为" + data.EditUserId + "的教师在使用!"); + return false; + } + } else { + //占用成绩 + learun.postFormSilence(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/StartInputScore', { queryJson: JSON.stringify(query) }, function (res) { }); + } + //显示可编辑列头 + headDataFinally = headData.concat(headDataEdit); + $("#gridtable")[0].dfop = undefined; + page.initGird(); + page.search(query); + //显示“提交成绩”按钮 + $('#lr_save').show(); + //隐藏“开始录入”按钮 + $('#lr_input').hide(); + //显示“倒计时” + $('.timeBox').show(); + $('#minutes').html($('#minutes').attr('data-minutes')); + //开始倒计时 + page.countDown(); + //五分钟提交成绩 + page.submitScore(); + } else { + learun.alert.warning("学生成绩不存在!"); + return false; + } + }); + //} + } + + } + }); + }); + //提交成绩 + $('#lr_save').on('click', function () { + var query = judgeSelect(); + if (query) { + //成绩被占用,且是登录用户时,根据编辑时间判断是否是本人; + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetEntityByJson?queryJson=' + JSON.stringify(query), function (data) { + if (data != null) { + if (data.CheckMark == 1) { + learun.alert.warning("学生成绩已审核!"); + return false; + } + if (data.IsEditable == 0) { + if (data.EditUserId == learun.clientdata.get(['userinfo']).account) { + if (modifyDate != null && modifyDate != data.ModifyDate) { + learun.alert.warning("当前班级成绩被修改,请重新获取!"); + return false; + } + } else { + learun.alert.warning("当前班级成绩由账号为" + data.EditUserId + "的教师在使用!"); + return false; + } + } else if (data.IsEditable == 1) { + learun.alert.warning("学生成绩已提交!"); + return false; + } + //提交成绩 + var rowdatas = $('#gridtable').jfGridGet('rowdatas'); + learun.postFormSilence(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/SaveInputScore', { data: JSON.stringify(rowdatas) }, function (res) { + if (res.code == 200) { + //提交成绩:取消占用 + learun.postForm(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/SaveInputScoreStatus', { queryJson: JSON.stringify(query) }, function (res) { + if (res.code == 200) { + refreshGirdData2(); + modifyDate = null; + //隐藏“提交成绩”按钮 + $('#lr_save').hide(); + //显示“开始录入”按钮 + $('#lr_input').show(); + //隐藏“倒计时” + $('.timeBox').hide(); + //停止倒计时 + clearInterval(timer); + //停止五分钟提交成绩 + clearInterval(submitScoreTimer); + } else { + learun.alert.warning("提交成绩:取消占用失败!"); + return false; + } + }); + } else { + learun.alert.warning("提交成绩失败!"); + return false; + } + }); + + } else { + learun.alert.warning("学生成绩不存在!"); + return false; + } + }); + } + }); + // 审核 + $('#lr_check').on('click', function () { + var query = judgeSelect(); + if (query) { + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetEntityByJson?queryJson=' + JSON.stringify(query), function (data) { + if (data != null) { + if (data.CheckMark == 1) { + learun.alert.warning("学生成绩已审核!"); + return false; + } + learun.layerConfirm('是否确认审核当前班级的学生成绩!', function (res) { + if (res) { + //审核成绩 + learun.postForm(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/DoCheckScore', { queryJson: JSON.stringify(query), checkMark: 1 }, function (res) { + if (res.code == 200) { + refreshGirdData2(); + } else { + learun.alert.warning("审核成绩失败!"); + return false; + } + }); + } + }); + } else { + learun.alert.warning("学生成绩不存在!"); + return false; + } + }); + } + }); + // 去审核 + $('#lr_uncheck').on('click', function () { + var query = judgeSelect(); + if (query) { + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetEntityByJson?queryJson=' + JSON.stringify(query), function (data) { + if (data != null) { + if (data.CheckMark != 1) { + learun.alert.warning("学生成绩未审核!"); + return false; + } + learun.layerConfirm('是否确认去审核当前班级的学生成绩!', function (res) { + if (res) { + //去审核成绩 + learun.postForm(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/DoCheckScore', { queryJson: JSON.stringify(query), checkMark: 0 }, function (res) { + if (res.code == 200) { + refreshGirdData2(); + } else { + learun.alert.warning("去审核成绩失败!"); + return false; + } + }); + } + }); + } else { + learun.alert.warning("学生成绩不存在!"); + return false; + } + }); + } + }); + //续时 + $('#addMinutesBtn').on('click', function () { + var query = judgeSelect(); + if (query) { + clearInterval(timer); + var addMinutes = $('#addMinutesBtn').attr('data-minutes'); + var newMinutes = addMinutes; + var minutes = $('#minutes').html(); + if (minutes > 0) { + newMinutes = Number(newMinutes) + Number(minutes); + } + $('#minutes').html(newMinutes); + page.countDown(); + //修改服务时间 + learun.postFormSilence(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/AddMinutes', { queryJson: JSON.stringify(query), minutes: newMinutes }, function (res) { }); + } + }); + //导入更新 + $('#lr_importScore').on('click', function () { + //todo: + + }); + }, + bindSelect: function () { + //校区 + $('#F_SchoolId').lrDataSourceSelect({ + code: 'company', value: 'f_companyid', text: 'f_fullname', select: function (item) { } + }); + $('#F_SchoolId').lrselectSet(learun.clientdata.get(['userinfo']).companyId); + //学年 + $('#AcademicYearNo').lrselect({ + placeholder: "学年", + allowSearch: false, + url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetAcademicYearNoData', + value: 'value', + text: 'text' + }); + //学期 + $('#Semester').lrselect({ + placeholder: "学期", + allowSearch: false, + url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetSemesterData', + value: 'value', + text: 'text' + }); + //课程 + $('#LessonNo').lrselect({ + placeholder: "请选择课程", + allowSearch: true, + url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetLessonNoDataOfAllWithNo', + value: 'value', + text: 'text', + select: function (item) { + if (!!item) { + $("#EmpNo").lrselectRefresh({ + url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetEmpNoDataOfAll?lessonNo=' + item.value, + value: 'value', + text: 'text', + }); + } + } + }); + //教师 + $('#EmpNo').lrselect({ + placeholder: "请选择教师", + allowSearch: true, + url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetEmpNoDataOfAll', + value: 'value', + text: 'text' + }); + //绑定学年、学期 + $.get('/Home/GetYearAndSemesteResult', function (ref) { + if (ref.code == "200") { + $('#AcademicYearNo').lrselectSet(ref.data.Item1); + $('#Semester').lrselectSet(ref.data.Item3); + } + }.bind(this), "json"); + }, + initGird: function () { + $('#gridtable').jfGrid({ + url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetList', + headData: headDataFinally, + mainId: 'ScoreId', + isPage: false, + sidx: 'StuNo', + sord: 'asc' + }); + //page.search(); + }, + search: function (param) { + param = param || {}; + $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); + }, + searchScale: function (param) { + param = param || {}; + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlan/GetStuSelectLessonListEntityByJson?queryJson=' + JSON.stringify(param), function (data) { + if (data["StuSelectLessonList"] != null) { + var ssll = data["StuSelectLessonList"]; + $('#OrdinaryScoreScale').html(ssll.OrdinaryScoreScale > 0 ? ssll.OrdinaryScoreScale : 0); + $('#TermInScoreScale').html(ssll.TermInScoreScale > 0 ? ssll.TermInScoreScale : 0); + $('#TermEndScoreScale').html(ssll.TermEndScoreScale > 0 ? ssll.TermEndScoreScale : 0); + $('#OtherScoreScale').html(ssll.OtherScoreScale > 0 ? ssll.OtherScoreScale : 0); + } else { + $('#OrdinaryScoreScale').html(0); + $('#TermInScoreScale').html(0); + $('#TermEndScoreScale').html(0); + $('#OtherScoreScale').html(0); + } + }); + }, + countDown: function () { + var minutes = $('#minutes').html(); + var minutesTemp = minutes; + var seconds = $('#seconds').attr('data-seconds'); + $('#seconds').html(seconds); + var secondsTemp = seconds; + timer = setInterval(function () { + secondsTemp--; + $('#seconds').html(secondsTemp); + if (secondsTemp == 0) { + secondsTemp = seconds; + minutesTemp--; + $('#minutes').html(minutesTemp); + if (minutesTemp == 0) { + //停止倒计时 + clearInterval(timer); + //自动提交成绩 + $('#lr_save').trigger("click"); + } + } + }, 1000); + }, + submitScore: function () { + submitScoreTimer = setInterval(function () { + var rowdatas = $('#gridtable').jfGridGet('rowdatas'); + learun.postFormSilence(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/SaveInputScore', { data: JSON.stringify(rowdatas) }, function (res) { + }); + }, 300000); + }, + }; + refreshGirdData = function () { + page.search(); + }; + refreshGirdData2 = function () { + var query = judgeSelect(); + if (query) { + //显示不可编辑列头 + headDataFinally = headData.concat(headDataNoEdit); + $("#gridtable")[0].dfop = undefined; + page.initGird(); + + page.search(query); + //page.searchScale(query); + } + }; + judgeSelect = function () { + if (CanInputFlag != "True") { + top.learun.layerConfirm('当前时间不是线上成绩录入时间!', function (res) { }); + return false; + } + + var $content = $('body').find('.lr-layout-tool-left'); + var query = $content.lrGetFormData(); + if (query.F_SchoolId == null || query.F_SchoolId == "") { + learun.alert.warning("请选择校区!"); + return false; + } + if (query.AcademicYearNo == null || query.AcademicYearNo == "") { + learun.alert.warning("请选择学年!"); + return false; + } + if (query.Semester == null || query.Semester == "") { + learun.alert.warning("请选择学期!"); + return false; + } + if (query.LessonNo == null || query.LessonNo == "") { + learun.alert.warning("请选择课程!"); + return false; + } + if (query.EmpNo == null || query.EmpNo == "") { + learun.alert.warning("请选择教师!"); + return false; + } + return query; + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/Monitor.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/Monitor.cshtml new file mode 100644 index 000000000..46703b746 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/Monitor.cshtml @@ -0,0 +1,38 @@ +@{ + ViewBag.Title = "线上成绩录入监控管理"; + Layout = "~/Views/Shared/_Index.cshtml"; +} + +
+
+
+
+
+
+
+
+
+
+
+
+  查询 +
+
+
+
+ +
+ +
+
+
+
+
+
+@Html.AppendJsFile("/Areas/EducationalAdministration/Views/StuScoreOnline/Monitor.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/Monitor.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/Monitor.js new file mode 100644 index 000000000..b772c7a08 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/Monitor.js @@ -0,0 +1,132 @@ +/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) + * Copyright (c) 2013-2018 北京泉江科技有限公司 + * 创建人:超级管理员 + * 日 期:2019-06-14 11:02 + * 描 述:考试成绩同步 + */ +var selectedRow; +var refreshGirdData; +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + page.bind(); + page.initGird(); + }, + bind: function () { + //学年 + $('#AcademicYearNo').lrselect({ + width: '150px', + placeholder: "请选择学年", + allowSearch: true, + url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetAcademicYearNoData', + value: 'value', + text: 'text' + }); + //学期 + $('#Semester').lrselect({ + width: '150px', + placeholder: "请选择学期", + allowSearch: true, + url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetSemesterData', + value: 'value', + text: 'text' + }); + // 查询 + $('#btn_Search').on('click', function () { + page.search({ AcademicYearNo: $('#AcademicYearNo').lrselectGet(), Semester: $('#Semester').lrselectGet() }); + }); + // 刷新 + $('#lr_refresh').on('click', function () { + location.reload(); + }); + //强制提交 + $('#lr_submit').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('EmpNo'); + if (learun.checkrow(keyValue)) { + var IsEditable = $('#gridtable').jfGridValue('IsEditable'); + if (IsEditable == "1") { + learun.alert.warning("当前项目无需提交!"); + return; + } + learun.layerConfirm('是否确认提交该项?未保存的成绩将会丢失!', function (res) { + if (res) { + learun.postForm(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/Submit', + { + AcademicYearNo: $('#gridtable').jfGridValue('AcademicYearNo'), + Semester: $('#gridtable').jfGridValue('Semester'), + LessonNo: $('#gridtable').jfGridValue('LessonNo'), + EmpNo: $('#gridtable').jfGridValue('EmpNo'), + EditUserId: $('#gridtable').jfGridValue('EditUserId'), + }, + function () { + refreshGirdData(); + }); + } + }); + } + }); + }, + initGird: function () { + $('#gridtable').jfGrid({ + url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetMonitorList', + headData: [ + { + label: "录入状态", name: "IsEditable", width: 80, align: "center", + formatter: function (cellvalue) { + return cellvalue == "1" ? "未占用" : "正在录入"; + } + }, + { label: '学年', name: 'AcademicYearNo', width: 50, align: "left" }, + { label: '学期', name: 'Semester', width: 40, align: "left" }, + { label: '课程编号', name: 'LessonNo', width: 100, align: "left" }, + { label: '课程名称', name: 'LessonName', width: 150, align: "left" }, + { label: '代课教师编号', name: 'EmpNo', width: 100, align: "left" }, + { + label: '代课教师姓名', name: 'EmpNo', width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'TeacherInfo', + key: value, + keyId: 'f_account', + callback: function (_data) { + callback(_data['f_realname']); + } + }); + } + }, + { label: '占用教师编号', name: 'EditUserId', width: 100, align: "left" }, + { + label: '占用教师姓名', name: 'EditUserId', width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'TeacherInfo', + key: value, + keyId: 'f_account', + callback: function (_data) { + callback(_data['f_realname']); + } + }); + } + }, + { label: '开始录入日期', name: 'BeginModifyDate', width: 150, align: "left" }, + { label: '最后保存日期', name: 'ModifyDate', width: 150, align: "left" }, + + ], + //mainId: 'ScoreId', + isPage: false + }); + //page.search(); + }, + search: function (param) { + param = param || {}; + param.AcademicYearNo = $('#AcademicYearNo').lrselectGet(); + param.Semester = $('#Semester').lrselectGet(); + $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); + } + }; + refreshGirdData = function () { + page.search(); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuSelectLessonListOfElectiveOnline/QueryStuSelectResultForTeacher.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuSelectLessonListOfElectiveOnline/QueryStuSelectResultForTeacher.cshtml index f7c8f9b3c..1f5db5c37 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuSelectLessonListOfElectiveOnline/QueryStuSelectResultForTeacher.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuSelectLessonListOfElectiveOnline/QueryStuSelectResultForTeacher.cshtml @@ -2,7 +2,7 @@ ViewBag.Title = "选修课课程"; Layout = "~/Views/Shared/_Index.cshtml"; } -
+
@@ -16,28 +16,40 @@
学期
-
+
-
+
+
学号
+ +
+
+
姓名
+ +
+
+
课程名称
+
+
+
+
建课教师
+ +
+
校区
-
系部
+
院系
专业
-
+
班级
-
-
选课状态
-
-
报名状态
@@ -45,6 +57,9 @@
+
+
提示:请输入学年和学期进行查询
+
@@ -56,4 +71,4 @@
-@Html.AppendJsFile("/Areas/EducationalAdministration/Views/StuSelectLessonListOfElective/QueryStuSelectResultForTeacher.js") +@Html.AppendJsFile("/Areas/EducationalAdministration/Views/StuSelectLessonListOfElectiveOnline/QueryStuSelectResultForTeacher.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuSelectLessonListOfElectiveOnline/QueryStuSelectResultForTeacher.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuSelectLessonListOfElectiveOnline/QueryStuSelectResultForTeacher.js index a773bbc7e..6498b18c6 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuSelectLessonListOfElectiveOnline/QueryStuSelectResultForTeacher.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuSelectLessonListOfElectiveOnline/QueryStuSelectResultForTeacher.js @@ -24,7 +24,7 @@ var bootstrap = function ($, learun) { return; } page.search(queryJson); - }, 300, 400); + }, 330, 500); $('#AcademicYearNo').lrselect({ placeholder: "请选择学年", allowSearch: true, @@ -40,12 +40,58 @@ var bootstrap = function ($, learun) { value: 'value', text: 'text' }); - $('#ElectiveSelectStatus').lrDataItemSelect({ code: 'ElectiveSelectStatus' }); - $('#ElectiveSignUpStatus').lrDataItemSelect({ code: 'ElectiveSignUpStatus' }); + //数据集不选择线上课程信息,选择选课情况里的课程信息 + $('#LessonNo').lrselect({ + allowSearch: true, + url: top.$.rootUrl + '/EducationalAdministration/StuSelectLessonListOfElectiveOnline/GetSelectLessonInfo', + value: "LessonNo", + text: "LessonName" + }); $('#F_SchoolId').lrDataSourceSelect({ code: 'company', value: 'f_companyid', text: 'f_fullname' }); - $('#DeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' }); - $('#MajorNo').lrDataSourceSelect({ code: 'CdMajorInfo', value: 'majorno', text: 'majorname' }); - $('#ClassNo').lrDataSourceSelect({ code: 'bjsj', value: 'classno', text: 'classname' }); + $('#DeptNo').lrDataSourceSelect({ + code: 'CdDeptInfo', value: 'deptno', text: 'deptname', select: function (item) { + if (!!item) { + $('#MajorNo').lrselectRefresh({ + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdMajorInfo', + param: { strWhere: "deptno='" + item.deptno + "' order by majorno " }, + }); + } else { + $('#MajorNo').lrselectRefresh({ + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdMajorInfo', + param: { strWhere: "1=1 order by majorno " }, + }); + } + } + }); + $('#MajorNo').lrselect({ + allowSearch: true, + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdMajorInfo', + param: { strWhere: "1=1 order by majorno " }, + value: "majorno", + text: "majorname", + select: function (item) { + if (!!item) { + $('#ClassNo').lrselectRefresh({ + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=bjsj', + param: { strWhere: "majorno='" + item.majorno + "' order by classno " }, + }); + } else { + $('#ClassNo').lrselectRefresh({ + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=bjsj', + param: { strWhere: "1=1 order by classno " }, + }); + } + } + }); + $('#ClassNo').lrselect({ + allowSearch: true, + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=bjsj', + param: { strWhere: "1=1 order by classno " }, + value: "classno", + text: "classname" + }); + $('#ElectiveSignUpStatus').lrDataItemSelect({ code: 'ElectiveSignUpStatus' }); + // 刷新 $('#lr_refresh').on('click', function () { location.reload(); @@ -54,12 +100,22 @@ var bootstrap = function ($, learun) { // 初始化列表 initGird: function () { $('#gridtable').jfGrid({ - url: top.$.rootUrl + '/EducationalAdministration/StuSelectLessonListOfElective/GetQueryStuSelectResultList', + url: top.$.rootUrl + '/EducationalAdministration/StuSelectLessonListOfElectiveOnline/GetQueryStuSelectResultList', headData: [ - { label: "学年", name: "AcademicYearNo", width: 80, align: "left" }, - { label: "学期", name: "Semester", width: 60, align: "left" }, + { label: "学年", name: "AcademicYearNo", width: 50, align: "left" }, + { label: "学期", name: "Semester", width: 50, align: "left" }, + { label: "学号", name: "StuNo", width: 120, align: "left" }, + { label: "姓名", name: "StuName", width: 180, align: "left" }, + { label: "课程编号", name: "LessonNo", width: 100, align: "left" }, + { + label: "课程名称", name: "LessonName", width: 150, align: "left" + }, + //{ label: "教师编号", name: "EmpNo", width: 100, align: "left" }, + { + label: "建课教师", name: "EmpName", width: 100, align: "left" + }, { - label: "校区", name: "F_SchoolId", width: 200, align: "left", + label: "建课学校", name: "F_SchoolId", width: 200, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('custmerData', { url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'company', @@ -72,7 +128,7 @@ var bootstrap = function ($, learun) { } }, { - label: "系所", name: "DeptNo", width: 100, align: "left", + label: "院系", name: "DeptNo", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('custmerData', { url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo', @@ -110,24 +166,6 @@ var bootstrap = function ($, learun) { }); } }, - { label: "学号", name: "StuNo", width: 100, align: "left" }, - { label: "姓名", name: "StuName", width: 100, align: "left" }, - { - label: "性别", name: "GenderNo", width: 80, align: "left", - formatter: function (cellvalue) { - return cellvalue == true ? "男" : "女"; - } - }, - { - label: "选课状态", name: "Id", width: 100, align: "left", - formatter: function (cellvalue, row) { - if (cellvalue == null || cellvalue == undefined || cellvalue == "") { - return '未报名'; - } else { - return '已报名'; - } - } - }, { label: "报名状态", name: "Status", width: 100, align: "left", formatter: function (cellvalue, row) { @@ -142,62 +180,7 @@ var bootstrap = function ($, learun) { } } }, - { label: "所选课程号", name: "LessonNo", width: 100, align: "left" }, - { - label: "所选课程名称", name: "LessonName", width: 150, align: "left", - formatterAsync: function (callback, value, row, op, $cell) { - learun.clientdata.getAsync('custmerData', { - url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo', - key: row.LessonNo, - keyId: 'lessonno', - callback: function (_data) { - callback(_data['lessonname']); - } - }); - } - }, - { label: "课程学分", name: "StudyScore", width: 100, align: "left" }, - { label: "教师编号", name: "EmpNo", width: 100, align: "left" }, - { - label: "教师姓名", name: "EmpName", width: 100, align: "left", - formatterAsync: function (callback, value, row, op, $cell) { - learun.clientdata.getAsync('custmerData', { - url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo', - key: row.EmpNo, - keyId: 'empno', - callback: function (_data) { - callback(_data['empname']); - } - }); - } - }, - { - label: "上课节次", name: "LessonSection", width: 150, align: "left", - formatter: function (cellvalue, row) { - if (cellvalue != "" && cellvalue != undefined && cellvalue != null) { - if (cellvalue.indexOf(',') == -1) { - return "星期" + weekChina[cellvalue.slice(0, 1) - 1] + "第" + cellvalue.slice(1) + "节"; - } else { - return "星期" + weekChina[cellvalue.slice(0, 1) - 1] + "第" + cellvalue.slice(1, 2) + "、" + cellvalue.slice(4) + "节"; - } - } - } - }, - { label: "上课时间", name: "LessonTime", width: 180, align: "left" }, - { - label: "教室名称", name: "ClassRoomName", width: 100, align: "left", - formatterAsync: function (callback, value, row, op, $cell) { - learun.clientdata.getAsync('custmerData', { - url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'ClassRoomInfo', - key: row.ClassRoomNo, - keyId: 'classroomno', - callback: function (_data) { - callback(_data['classroomname']); - } - }); - } - }, - { label: "备注", name: "Remark", width: 100, align: "left" }, + ], mainId: 'StuId', isPage: true, diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj index f28aebf75..0621a1e80 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj @@ -340,6 +340,7 @@ + @@ -1030,6 +1031,8 @@ + + @@ -8214,6 +8217,8 @@ + + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/LessonInfoOfElectiveOnlineApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/LessonInfoOfElectiveOnlineApi.cs index acdbdcc1b..eaace65ed 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/LessonInfoOfElectiveOnlineApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/LessonInfoOfElectiveOnlineApi.cs @@ -52,13 +52,13 @@ namespace Learun.Application.WebApi var stuInfoBasicEntity = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(account); if (stuInfoBasicEntity == null) { - return Fail("当前学员不存在!"); + return Success(new { msg = "当前学员不存在!" }); } //课程信息 var olpeEntity = lessonInfoOfElectiveOnlineIbll.GetLessonInfoOfElectiveOnlineEntity(keyValue); if (olpeEntity == null) { - return Fail("当前课程不存在!"); + return Success(new { msg = "当前课程不存在!" }); } //当前学员本学期是否有报名课程:每学期一门 @@ -96,11 +96,11 @@ namespace Learun.Application.WebApi { if (sslleEntity.Status == 1) { - return Fail("当前课程报名审核中,请耐心等待!"); + return Success(new { msg = "当前课程报名审核中,请耐心等待!" }); } else if (sslleEntity.Status == 2) { - return Fail("当前课程已报名成功!"); + return Success(new { msg = "当前课程已报名成功!" }); } } else @@ -110,7 +110,7 @@ namespace Learun.Application.WebApi var aaa = aa.Count(x => x.Status == 1 || x.Status == 2); if (aaa >= olpeEntity.StuNumMax) { - return Fail("当前课程报名人数已满,请选择其他课程!"); + return Success(new { msg = "当前课程报名人数已满,请选择其他课程!" }); } //每学期最多两门 var sslleList = stuSelectLessonListOfElectiveOnlineIBLL.GetStuSelectLessonListOfElectiveOnlineListByStuNo(account); @@ -118,15 +118,15 @@ namespace Learun.Application.WebApi var sslleListOfNow1 = sslleListOfNow.Where(x => x.Status == 1 || x.Status == 2); if (sslleListOfNow1.Count() >= Config.GetValue("OnlineElectiveLessonApplyMax").ToInt()) { - return Fail("每学期最多选择" + Config.GetValue("OnlineElectiveLessonApplyMax").ToInt() + "门线上选修课!"); + return Success(new { msg = "每学期最多选择" + Config.GetValue("OnlineElectiveLessonApplyMax").ToInt() + "门线上选修课!" }); } //相同时间不能报名 - if (sslleListOfNow1.Where(x => x.LessonSection == olpeEntity.LessonSection).Any()) + if (!string.IsNullOrEmpty(olpeEntity.LessonSection) && sslleListOfNow1.Where(x => x.LessonSection == olpeEntity.LessonSection).Any()) { //相同时间不能报名 - return Fail("本学期此时间段已有报名的选修课!"); + return Success(new { msg = "本学期此时间段已有报名的选修课!" }); } - + } return Fail("正在提交,请等待!"); @@ -173,20 +173,11 @@ namespace Learun.Application.WebApi public Response GetForm(dynamic _) { string keyValue = this.GetReqData(); - var JournalReceiveData = lessonInfoOfElectiveOnlineIbll.GetLessonInfoOfElectiveOnlineEntity(keyValue); - if (lessonInfoIbll.GetLessonInfoEntityByLessonNo(JournalReceiveData.LessonNo) != null) - { - if (!string.IsNullOrEmpty(lessonInfoIbll.GetLessonInfoEntityByLessonNo(JournalReceiveData.LessonNo).Introduction)) - JournalReceiveData.Introduction = WebHelper.NoHtml(WebHelper.HtmlDecode(lessonInfoIbll.GetLessonInfoEntityByLessonNo(JournalReceiveData.LessonNo).Introduction)) ?? ""; - } - if (empInfoIbll.GetEmpInfoEntityByEmpNo(JournalReceiveData.EmpNo) != null) - { - if (!string.IsNullOrEmpty(empInfoIbll.GetEmpInfoEntityByEmpNo(JournalReceiveData.EmpNo).resume)) - JournalReceiveData.resume = WebHelper.NoHtml(WebHelper.HtmlDecode(empInfoIbll.GetEmpInfoEntityByEmpNo(JournalReceiveData.EmpNo).resume)) ?? ""; - } + var Data = lessonInfoOfElectiveOnlineIbll.GetLessonInfoOfElectiveOnlineEntity(keyValue); + var jsonData = new { - JournalReceive = JournalReceiveData, + data = Data, }; return Success(jsonData); } @@ -223,7 +214,7 @@ namespace Learun.Application.WebApi if (sslleEntity.Status != 2) { stuSelectLessonListOfElectiveOnlineIBLL.DeleteEntity(sslleEntity.Id); - return Fail("取消成功"); + return Success("取消成功"); } else { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/EducationalAdministration/StuScoreOnlineMap.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/EducationalAdministration/StuScoreOnlineMap.cs new file mode 100644 index 000000000..aea32cc0b --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/EducationalAdministration/StuScoreOnlineMap.cs @@ -0,0 +1,29 @@ +using Learun.Application.TwoDevelopment.EducationalAdministration; +using System.Data.Entity.ModelConfiguration; + +namespace Learun.Application.Mapping +{ + /// + /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 + /// Copyright (c) 2013-2018 北京泉江科技有限公司 + /// 创 建:超级管理员 + /// 日 期:2019-06-14 11:02 + /// 描 述:考试成绩同步 + /// + public class StuScoreOnlineMap : EntityTypeConfiguration + { + public StuScoreOnlineMap() + { + #region 表、主键 + //表 + this.ToTable("STUSCOREONLINE"); + //主键 + this.HasKey(t => t.ScoreId); + #endregion + + #region 配置关系 + #endregion + } + } +} + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj index 5ce5ca424..11c7695c4 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj @@ -112,6 +112,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOnline/StuScoreOnlineBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOnline/StuScoreOnlineBLL.cs new file mode 100644 index 000000000..0a2e3839f --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOnline/StuScoreOnlineBLL.cs @@ -0,0 +1,1146 @@ +using Learun.Util; +using System; +using System.Data; +using System.Collections.Generic; +using static Learun.Application.TwoDevelopment.EducationalAdministration.StuScoreOnlineService; + +namespace Learun.Application.TwoDevelopment.EducationalAdministration +{ + /// + /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 + /// Copyright (c) 2013-2018 北京泉江科技有限公司 + /// 创 建:超级管理员 + /// 日 期:2019-06-14 11:02 + /// 描 述:考试成绩同步 + /// + public class StuScoreOnlineBLL : StuScoreOnlineIBLL + { + private StuScoreOnlineService stuScoreOnlineService = new StuScoreOnlineService(); + + #region 获取数据 + + /// + /// 获取列表数据 + /// + /// + public IEnumerable GetList(string queryJson) + { + try + { + return stuScoreOnlineService.GetList(queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public DataTable GetListForExport(string queryJson) + { + try + { + return stuScoreOnlineService.GetListForExport(queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public IEnumerable GetMonitorList(string queryJson) + { + try + { + return stuScoreOnlineService.GetMonitorList(queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取列表分页数据 + /// 分页参数 + /// + /// + public IEnumerable GetPageList(Pagination pagination, string queryJson) + { + try + { + return stuScoreOnlineService.GetPageList(pagination, queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取实体数据 + /// 主键 + /// + /// + public StuScoreOnlineEntity GetEntity(string keyValue) + { + try + { + return stuScoreOnlineService.GetEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取列表分页数据 + /// 分页参数 + /// + /// + public IEnumerable GetScoreInputCancelPageList(Pagination pagination, string queryJson) + { + try + { + return stuScoreOnlineService.GetScoreInputCancelPageList(pagination, queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取列表数据 + /// + /// + public StuScoreOnlineEntity GetEntityByJson(string queryJson) + { + try + { + return stuScoreOnlineService.GetEntityByJson(queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// 主键 + /// + /// + public void DeleteEntity(string keyValue) + { + try + { + stuScoreOnlineService.DeleteEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + public void SubmitStuScoreOnline(string AcademicYearNo, string Semester, string LessonNo, string EmpNo) + { + try + { + stuScoreOnlineService.SubmitStuScoreOnline(AcademicYearNo, Semester, LessonNo, EmpNo); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + /// + /// 保存实体数据(新增、修改) + /// 主键 + /// + /// + public void SaveEntity(string keyValue, StuScoreOnlineEntity entity) + { + try + { + stuScoreOnlineService.SaveEntity(keyValue, entity); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + + public void DeleteList() + { + try + { + stuScoreOnlineService.DeleteList(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + #endregion + + #region 扩展数据 + + /// + /// 获取学年学期列表 + /// + /// + public IEnumerable GetAcademicAndSemesterList() + { + try + { + return stuScoreOnlineService.GetAcademicAndSemesterList(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + /// + /// 根据学号获取成绩列表 + /// + /// + /// + /// 学号 + /// 班级编号 + /// + public ScoreListByStuNoModel GetScoreListByStuNo(string academic, string semester, string stuNo, string classNo) + { + try + { + return stuScoreOnlineService.GetScoreListByStuNo(academic, semester, stuNo, classNo); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public bool GetAny() + { + try + { + return stuScoreOnlineService.GetAny(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 保存实体数据(新增、修改) + /// 主键 + /// + /// + public void UpEmpNos(string xn, string xq, string classNo, string LessonNo, string EmpNo, string HisEmpNo, string Grade) + { + try + { + stuScoreOnlineService.UpEmpNos(xn, xq, classNo, LessonNo, EmpNo, HisEmpNo, Grade); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取一次补考名单数据 + /// + /// + public IEnumerable GetStuScoreOnlineNotPassList() + { + try + { + return stuScoreOnlineService.GetStuScoreOnlineNotPassList(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取二次补考名单数据 + /// + /// + public IEnumerable GetStuScoreOnlineNotPassTwoList() + { + try + { + return stuScoreOnlineService.GetStuScoreOnlineNotPassTwoList(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取班级成绩初始化信息 + /// + /// + public IEnumerable GetPageListAboutClass(Pagination pagination, string queryJson) + { + try + { + return stuScoreOnlineService.GetPageListAboutClass(pagination, queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取列表分页数据 + /// 分页参数 + /// + /// + public StuSelectLessonListEntity GetStuSelectLessonListEntity(StuScoreOnlineEntity entity) + { + try + { + return stuScoreOnlineService.GetStuSelectLessonListEntity(entity); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 班级学生成绩初始化 + /// + /// + public void DoInitAboutClass(string academicYearNo, string semester, string classNo) + { + try + { + stuScoreOnlineService.DoInitAboutClass(academicYearNo, semester, classNo); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 学年下拉框信息【班级成绩查看】 + /// + /// + public IEnumerable GetAcademicYearNoData() + { + try + { + return stuScoreOnlineService.GetAcademicYearNoData(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 班级下拉框信息【班级成绩查看】 + /// + /// + public IEnumerable GetClassNoData(string userAccount, string userType, string lessonNo) + { + try + { + return stuScoreOnlineService.GetClassNoData(userAccount, userType, lessonNo); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public IEnumerable GetClassNoDataForInput(string userAccount, string userType, string lessonNo, string academicYearShort, string semester) + { + try + { + return stuScoreOnlineService.GetClassNoDataForInput(userAccount, userType, lessonNo, academicYearShort, semester); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 教师下拉框信息【学生成绩录入可去审核】 + /// + /// + public IEnumerable GetEmpNoData(string userAccount, string userType, string lessonNo) + { + try + { + return stuScoreOnlineService.GetEmpNoData(userAccount, userType, lessonNo); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 课程下拉框信息【学生成绩录入可去审核】 + /// + /// + public IEnumerable GetLessonNoDataOfAll(string userAccount, string userType, string AcademicYearNo = "", string Semester = "") + { + try + { + return stuScoreOnlineService.GetLessonNoDataOfAll(userAccount, userType, AcademicYearNo, Semester); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 课程下拉框信息【选修课】 + /// + /// + public IEnumerable GetElectiveLessonNoDataOfAll(string userAccount, string userType, string AcademicYearNo = "", string Semester = "") + { + try + { + return stuScoreOnlineService.GetElectiveLessonNoDataOfAll(userAccount, userType, AcademicYearNo, Semester); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 教室下拉框信息【选修课】 + /// + /// + public IEnumerable GetElectiveClassRoomNoData(string userAccount, string userType, string lessonNo) + { + try + { + return stuScoreOnlineService.GetElectiveClassRoomNoData(userAccount, userType, lessonNo); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 节次下拉框信息【选修课】 + /// + /// + public IEnumerable GetElectiveLessonSectionData(string userAccount, string userType, string classRoomNo) + { + try + { + return stuScoreOnlineService.GetElectiveLessonSectionData(userAccount, userType, classRoomNo); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 课程信息【班级成绩查看】 + /// + /// + public IEnumerable GetLessonNoData(string academicYearNo, string semester, string classNo) + { + try + { + return stuScoreOnlineService.GetLessonNoData(academicYearNo, semester, classNo); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取班级成绩列表 + /// + /// + public IEnumerable GetScoreListByClassNo(string queryJson) + { + try + { + return stuScoreOnlineService.GetScoreListByClassNo(queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public IEnumerable GetScoreListByClassNoForScholarship(string queryJson) + { + try + { + return stuScoreOnlineService.GetScoreListByClassNoForScholarship(queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public IEnumerable GetScoreListByStuNo(string queryJson) + { + try + { + return stuScoreOnlineService.GetScoreListByStuNo(queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 根据学号/姓名获取学生成绩列表 + /// + /// + /// + public IEnumerable GetScoreListByStuInfo(string queryJson) + { + try + { + return stuScoreOnlineService.GetScoreListByStuInfo(queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public List GetStuGraduateInfo(string queryJson) + { + try + { + return stuScoreOnlineService.GetStuGraduateInfo(queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + public List GetPassInfo(string queryJson) + { + try + { + return stuScoreOnlineService.GetPassInfo(queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + public List GetClassOfMy() + { + try + { + return stuScoreOnlineService.GetClassOfMy(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取个人成绩列表 + /// + /// + public IEnumerable GetAllScoreListByStuNo(string stuNo) + { + try + { + return stuScoreOnlineService.GetAllScoreListByStuNo(stuNo); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public object GetScoreCharts(string academicYearNo, string semester, string classNo, string lessonNo) + { + try + { + var data = stuScoreOnlineService.GetScoreCharts(academicYearNo, semester, classNo, lessonNo); + return data; + + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public List GetScoreInfo(string queryJson) + { + try + { + var data = stuScoreOnlineService.GetScoreInfo(queryJson); + return data; + + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + + /// + /// 审核学生成绩 + /// 主键 + /// + /// + public void CheckStuScoreOnline(string keyValue) + { + try + { + stuScoreOnlineService.CheckStuScoreOnline(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + /// + /// 去审核学生成绩 + /// 主键 + /// + /// + public void UnCheckStuScoreOnline(string keyValue) + { + try + { + stuScoreOnlineService.UnCheckStuScoreOnline(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取个人补考成绩 + /// + /// + public StuScoreOnlineEntity GetScoreNotPassByEntity(StuScoreOnlineEntity entity) + { + try + { + return stuScoreOnlineService.GetScoreNotPassByEntity(entity); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取个人二次补考成绩 + /// + /// + public StuScoreOnlineEntity GetScoreNotPassTwoByEntity(StuScoreOnlineEntity entity) + { + try + { + return stuScoreOnlineService.GetScoreNotPassTwoByEntity(entity); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + /// + /// 开始录入:占用成绩 + /// + /// + public void StartInputScore(string queryJson) + { + try + { + stuScoreOnlineService.StartInputScore(queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 提交成绩 + /// + /// + public void SaveInputScore(List list) + { + try + { + stuScoreOnlineService.SaveInputScore(list); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 提交成绩:取消占用 + /// + /// + public void SaveInputScoreStatus(string queryJson) + { + try + { + stuScoreOnlineService.SaveInputScoreStatus(queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + /// + /// 提交成绩:取消占用【服务】 + /// + /// + public void SaveInputScoreStatus2(string queryJson, string name) + { + try + { + stuScoreOnlineService.SaveInputScoreStatus2(queryJson, name); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 审核成绩 + /// + /// + /// 已审核:1;未审核:0; + public void DoCheckScore(string queryJson, int checkMark) + { + try + { + stuScoreOnlineService.DoCheckScore(queryJson, checkMark); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public IEnumerable GetLessonNoDataFromStuNo(string academicYearNo, string semester, string stuNo) + { + try + { + return stuScoreOnlineService.GetLessonNoDataFromStuNo(academicYearNo, semester, stuNo); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 成绩导入 + /// + /// + /// + /// + /// + /// + public (DataTable failDt, int snum, int fnum) ExecuteImportExcel(int type, DataTable dt, string fileGuid, string queryJson) + { + try + { + return stuScoreOnlineService.ExecuteImportExcel(type, dt, fileGuid, queryJson); + + } + 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/EducationalAdministration/StuScoreOnline/StuScoreOnlineEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOnline/StuScoreOnlineEntity.cs new file mode 100644 index 000000000..998f8de7f --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOnline/StuScoreOnlineEntity.cs @@ -0,0 +1,452 @@ +using Learun.Util; +using System; +using System.ComponentModel.DataAnnotations.Schema; +namespace Learun.Application.TwoDevelopment.EducationalAdministration + +{ + /// + /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 + /// Copyright (c) 2013-2018 北京泉江科技有限公司 + /// 创 建:超级管理员 + /// 日 期:2019-06-14 11:02 + /// 描 述:考试成绩同步 + /// + public class StuScoreOnlineEntity + { + #region 实体成员 + /// + /// ScoreId + /// + /// + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + [Column("SCOREID")] + public int? ScoreId { get; set; } + /// + /// 通知书号 + /// + /// + [Column("NOTICEBOOKNO")] + public string NoticeBookNo { get; set; } + /// + /// 学号 + /// + /// + [Column("STUNO")] + public string StuNo { get; set; } + /// + /// 学生所在系部 + /// + /// + [Column("DEPTNO")] + public string DeptNo { get; set; } + /// + /// 学生所在专业号 + /// + /// + [Column("MAJORNO")] + public string MajorNo { get; set; } + /// + /// 行政班号 + /// + /// + [Column("CLASSNO")] + public string ClassNo { get; set; } + /// + /// 姓名 + /// + /// + [Column("STUNAME")] + public string StuName { get; set; } + /// + /// GenderNo + /// + /// + [Column("GENDERNO")] + public string GenderNo { get; set; } + /// + /// 学年度 + /// + /// + [Column("ACADEMICYEARNO")] + public string AcademicYearNo { get; set; } + /// + /// 学期 + /// + /// + [Column("SEMESTER")] + public string Semester { get; set; } + /// + /// 开课系部码 + /// + /// + [Column("OPENLESSONDEPTNO")] + public string OpenLessonDeptNo { get; set; } + /// + /// 开课专业码 + /// + /// + [Column("OPENLESSONMAJORNO")] + public string OpenLessonMajorNo { get; set; } + /// + /// 课程号 + /// + /// + [Column("LESSONNO")] + public string LessonNo { get; set; } + /// + /// 课程名称 + /// + /// + [Column("LESSONNAME")] + public string LessonName { get; set; } + /// + /// LessonNameEn + /// + /// + [Column("LESSONNAMEEN")] + public string LessonNameEn { get; set; } + /// + /// 教学班号 + /// + /// + [Column("TEACHCLASSNO")] + public string TeachClassNo { get; set; } + /// + /// 课程类别码 + /// + /// + [Column("LESSONSORTNO")] + public string LessonSortNo { get; set; } + /// + /// 学生类别 + /// + /// + [Column("STUSORTNO")] + public string StuSortNo { get; set; } + /// + /// 年级 + /// + /// + [Column("GRADE")] + public string Grade { get; set; } + /// + /// 学分 + /// + /// + [Column("STUDYSCORE")] + public decimal? StudyScore { get; set; } + /// + /// 总学时 + /// + /// + [Column("TOTALSTUDYHOUR")] + public decimal? TotalStudyHour { get; set; } + /// + /// 专业属性 + /// + /// + [Column("ZYSX")] + public string zysx { get; set; } + /// + /// 考核(试)方式码(关联表BCdTestMode) + /// + /// + [Column("TESTMODENO")] + public string TestModeNo { get; set; } + /// + /// ScoreRecordStyleNo + /// + /// + [Column("SCORERECORDSTYLENO")] + public string ScoreRecordStyleNo { get; set; } + /// + /// 平时成绩 + /// + /// + [Column("ORDINARYSCORE")] + public decimal? OrdinaryScore { get; set; } + /// + /// 期中成绩 + /// + /// + [Column("TERMINSCORE")] + public decimal? TermInScore { get; set; } + /// + /// 期末成绩 学期 + /// + /// + [Column("TERMENDSCORE")] + public decimal? TermEndScore { get; set; } + /// + /// OtherScore + /// + /// + [Column("OTHERSCORE")] + public decimal? OtherScore { get; set; } + /// + /// 总评成绩 + /// + /// + [Column("SCORE")] + public decimal? Score { get; set; } + /// + /// 绩点 + /// + /// + [Column("SCOREPOINT")] + public decimal? ScorePoint { get; set; } + /// + /// 考试日期 + /// + /// + [Column("TESTDATE")] + public DateTime? TestDate { get; set; } + /// + /// 是否有效 + /// + /// + [Column("ISINEFFECT")] + public string IsInEffect { get; set; } + /// + /// 备注 + /// + /// + [Column("REMARK")] + public string Remark { get; set; } + /// + /// 冲突课程代码 + /// + /// + [Column("CONFLICTLESSONNO")] + public string ConflictLessonNo { get; set; } + /// + /// 是否重修成绩 + /// + /// + [Column("ISRESTUDY")] + public string IsReStudy { get; set; } + /// + /// 审查标志 + /// + /// + [Column("CHECKMARK")] + public string CheckMark { get; set; } + /// + /// 是否选中 + /// + /// + [Column("ISPITCHON")] + public string IsPitchOn { get; set; } + /// + /// 教师号 + /// + /// + [Column("EMPNO")] + public string EmpNo { get; set; } + /// + /// 专业教学计划编码 + /// + /// + [Column("TECHPLANNO")] + public string TechPlanNo { get; set; } + /// + /// 考试性质码(关联表CdTestKind) + /// + /// + [Column("TESTKINDNO")] + public string TestKindNo { get; set; } + /// + /// 课程区别码(此编码针对同一课程编号,同一门课程、不同课时、学分的情况而加,由系统自动产生以区分此类课程) + /// + /// + [Column("PARTCODE")] + public string PartCode { get; set; } + /// + /// LessonSection + /// + /// + [Column("LESSONSECTION")] + public string LessonSection { get; set; } + /// + /// ClassRoomNo + /// + /// + [Column("CLASSROOMNO")] + public string ClassRoomNo { get; set; } + /// + /// ClassRoomName + /// + /// + [Column("CLASSROOMNAME")] + public string ClassRoomName { get; set; } + /// + /// IsEditable + /// + /// + [Column("ISEDITABLE")] + public string IsEditable { get; set; } + /// + /// EditUserId + /// + /// + [Column("EDITUSERID")] + public string EditUserId { get; set; } + /// + /// ModifyDate + /// + /// + [Column("MODIFYDATE")] + public DateTime? ModifyDate { get; set; } + + [Column("BEGINMODIFYDATE")] + public DateTime? BeginModifyDate { get; set; } + /// + /// ModifyUserId + /// + /// + [Column("MODIFYUSERID")] + public string ModifyUserId { get; set; } + /// + /// ModifyUserName + /// + /// + [Column("MODIFYUSERNAME")] + public string ModifyUserName { get; set; } + /// + /// 学校主键 + /// + /// + [Column("F_SCHOOLID")] + public string F_SchoolId { get; set; } + + #endregion + + #region 扩展操作 + /// + /// 新增调用 + /// + public void Create() + { + } + /// + /// 编辑调用 + /// + /// + public void Modify(int? keyValue) + { + this.ScoreId = keyValue; + } + #endregion + + + /// + /// 学生Id + /// + [NotMapped] + public string StuId { get; set; } + /// + /// 课程Id + /// + [NotMapped] + public string LessonId { get; set; } + /// + /// 班级名称 + /// + [NotMapped] + public string ClassName { get; set; } + /// + /// 班级Id + /// + [NotMapped] + public string ClassId { get; set; } + /// + /// 教师姓名 + /// + [NotMapped] + public string EmpName { get; set; } + /// + /// 教师主键 + /// + [NotMapped] + public string EmpId { get; set; } + /// + /// 补考标识(1:一次补考;2:二次补考) + /// + [NotMapped] + public int BuKaoFlag { get; set; } + /// + /// 学生成绩数量 + /// + [NotMapped] + public int StuScoreOnlineNum { get; set; } + /// + /// 临时主键 + /// + [NotMapped] + public string TempId { get; set; } + [NotMapped] + public string DepositBank { get; set; } + [NotMapped] + public string BankCard { get; set; } + [NotMapped] + public string IdCard { get; set; } + [NotMapped] + public string Birthday { get; set; } + [NotMapped] + public string NationalityNo { get; set; } + [NotMapped] + public string PartyFaceNo { get; set; } + + + /// + /// 成绩格式化(补)(重)(选修) + /// + [NotMapped] + public string ScoreFormat { get; set; } + + /// + /// 补考成绩 + /// + [NotMapped] + public string ScoreOfNotPass { get; set; } + /// + /// 二次补考成绩 + /// + [NotMapped] + public string ScoreOfNotPassTwo { get; set; } + /// + /// 课程类别名称 + /// + /// + [NotMapped] + public string LessonSortName { get; set; } + /// + /// 专业名称 + /// + [NotMapped] + public string MajorName { get; set; } + /// + /// 专业排名 + /// + [NotMapped] + public int RankInMajor { get; set; } + /// + /// 班级排名 + /// + [NotMapped] + public int RankInClass { get; set; } + /// + /// 学习形式 + /// + [NotMapped] + public string StudyModality { get; set; } + /// + /// 异动类型 + /// + [NotMapped] + public string MoveType { get; set; } + + + } +} + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOnline/StuScoreOnlineIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOnline/StuScoreOnlineIBLL.cs new file mode 100644 index 000000000..1c9c9437e --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOnline/StuScoreOnlineIBLL.cs @@ -0,0 +1,261 @@ +using Learun.Util; +using System.Data; +using System.Collections.Generic; +using static Learun.Application.TwoDevelopment.EducationalAdministration.StuScoreOnlineService; + +namespace Learun.Application.TwoDevelopment.EducationalAdministration +{ + /// + /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 + /// Copyright (c) 2013-2018 北京泉江科技有限公司 + /// 创 建:超级管理员 + /// 日 期:2019-06-14 11:02 + /// 描 述:考试成绩同步 + /// + public interface StuScoreOnlineIBLL + { + #region 获取数据 + + /// + /// 获取列表数据 + /// + /// + IEnumerable GetList(string queryJson); + DataTable GetListForExport(string queryJson); + + IEnumerable GetMonitorList(string queryJson); + /// + /// 获取列表分页数据 + /// 分页参数 + /// + /// + IEnumerable GetPageList(Pagination pagination, string queryJson); + /// + /// 获取实体数据 + /// 主键 + /// + /// + StuScoreOnlineEntity GetEntity(string keyValue); + /// + /// 获取列表分页数据 + /// 分页参数 + /// + /// + IEnumerable GetScoreInputCancelPageList(Pagination pagination, string queryJson); + + + List GetStuGraduateInfo(string queryJson); + List GetPassInfo(string queryJson); + List GetClassOfMy(); + /// + /// 获取列表分页数据 + /// 分页参数 + /// + /// + StuSelectLessonListEntity GetStuSelectLessonListEntity(StuScoreOnlineEntity entity); + + /// + /// 获取列表数据 + /// + /// + StuScoreOnlineEntity GetEntityByJson(string queryJson); + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// 主键 + /// + /// + void DeleteEntity(string keyValue); + void SubmitStuScoreOnline(string AcademicYearNo, string Semester, string LessonNo, string EmpNo); + /// + /// 保存实体数据(新增、修改) + /// 主键 + /// + /// + void SaveEntity(string keyValue, StuScoreOnlineEntity entity); + #endregion + + void DeleteList(); + + #region 扩展数据 + + /// + /// 获取学年学期列表 + /// + /// + IEnumerable GetAcademicAndSemesterList(); + /// + /// 根据学号获取成绩列表 + /// + /// + /// + /// 学号 + /// 班级编号 + /// + ScoreListByStuNoModel GetScoreListByStuNo(string academic, string semester, string stuNo, string classNo); + bool GetAny(); + + + /// + /// 获取一次补考名单数据 + /// + /// + IEnumerable GetStuScoreOnlineNotPassList(); + + /// + /// 获取二次补考名单数据 + /// + /// + IEnumerable GetStuScoreOnlineNotPassTwoList(); + + /// + /// 获取班级成绩初始化信息 + /// + /// + IEnumerable GetPageListAboutClass(Pagination pagination, string queryJson); + + /// + /// 班级学生成绩初始化 + /// + /// + void DoInitAboutClass(string academicYearNo, string semester, string classNo); + + /// + /// 学年下拉框信息【班级成绩查看】 + /// + /// + IEnumerable GetAcademicYearNoData(); + + /// + /// 班级下拉框信息【班级成绩查看】 + /// + /// + IEnumerable GetClassNoData(string userAccount, string userType, string lessonNo); + IEnumerable GetClassNoDataForInput(string userAccount, string userType, string lessonNo, string academicYearShort, string semester); + + /// + /// 教师下拉框信息【学生成绩录入可去审核】 + /// + /// + IEnumerable GetEmpNoData(string userAccount, string userType, string lessonNo); + + /// + /// 课程下拉框信息【学生成绩录入可去审核】 + /// + /// + IEnumerable GetLessonNoDataOfAll(string userAccount, string userType, string AcademicYearNo = "", string Semester = ""); + + /// + /// 课程下拉框信息【选修课】 + /// + /// + IEnumerable GetElectiveLessonNoDataOfAll(string userAccount, string userType, string AcademicYearNo = "", string Semester = ""); + + /// + /// 教室下拉框信息【选修课】 + /// + /// + IEnumerable GetElectiveClassRoomNoData(string userAccount, string userType, string lessonNo); + + /// + /// 节次下拉框信息【选修课】 + /// + /// + IEnumerable GetElectiveLessonSectionData(string userAccount, string userType, string classRoomNo); + + /// + /// 课程信息【班级成绩查看】 + /// + /// + IEnumerable GetLessonNoData(string academicYearNo, string semester, string classNo); + + /// + /// 获取班级成绩列表 + /// + /// + IEnumerable GetScoreListByClassNo(string queryJson); + IEnumerable GetScoreListByClassNoForScholarship(string queryJson); + /// + /// 获取学生成绩 + /// + /// + /// + IEnumerable GetScoreListByStuNo(string queryJson); + /// + /// 根据学号/姓名获取学生成绩列表 + /// + /// + /// + IEnumerable GetScoreListByStuInfo(string queryJson); + + /// + /// 获取个人成绩列表 + /// + /// + IEnumerable GetAllScoreListByStuNo(string stuNo); + object GetScoreCharts(string academicYearNo, string semester, string classNo, string lessonNo); + void UpEmpNos(string xn, string xq, string classNo, string LessonNo, string EmpNo, string HisEmpNo, string Grade); + + + /// + /// 审核学生成绩 + /// 主键 + /// + /// + void CheckStuScoreOnline(string keyValue); + /// + /// 去审核学生成绩 + /// 主键 + /// + /// + void UnCheckStuScoreOnline(string keyValue); + List GetScoreInfo(string queryJson); + + /// + /// 获取个人补考成绩 + /// + /// + StuScoreOnlineEntity GetScoreNotPassByEntity(StuScoreOnlineEntity entity); + + /// + /// 获取个人二次补考成绩 + /// + /// + StuScoreOnlineEntity GetScoreNotPassTwoByEntity(StuScoreOnlineEntity entity); + /// + /// 开始录入:占用成绩 + /// + /// + void StartInputScore(string queryJson); + /// + /// 提交成绩 + /// + /// + void SaveInputScore(List list); + /// + /// 提交成绩:取消占用 + /// + /// + void SaveInputScoreStatus(string queryJson); + /// + /// 提交成绩:取消占用【服务】 + /// + /// + void SaveInputScoreStatus2(string queryJson, string name); + /// + /// 审核成绩 + /// + /// + /// 已审核:1;未审核:0; + void DoCheckScore(string queryJson, int checkMark); + + (DataTable failDt, int snum, int fnum) ExecuteImportExcel(int type, DataTable dt, string fileGuid, string queryJson); + + #endregion + + IEnumerable GetLessonNoDataFromStuNo(string academicYearNo, string semester, string stuNo); + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOnline/StuScoreOnlineService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOnline/StuScoreOnlineService.cs new file mode 100644 index 000000000..5a628a84c --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOnline/StuScoreOnlineService.cs @@ -0,0 +1,2468 @@ +using Dapper; +using Learun.DataBase.Repository; +using Learun.Util; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Learun.Cache.Base; +using Learun.Cache.Factory; + +namespace Learun.Application.TwoDevelopment.EducationalAdministration +{ + /// + /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 + /// Copyright (c) 2013-2018 北京泉江科技有限公司 + /// 创 建:超级管理员 + /// 日 期:2019-06-14 11:02 + /// 描 述:考试成绩同步 + /// + public class StuScoreOnlineService : RepositoryFactory + { + #region 构造函数和属性 + + private string fieldSql; + public StuScoreOnlineService() + { + fieldSql = @" + t.ScoreId, + t.NoticeBookNo, + t.StuNo, + t.DeptNo, + t.MajorNo, + t.ClassNo, + t.StuName, + t.GenderNo, + t.AcademicYearNo, + t.Semester, + t.OpenLessonDeptNo, + t.OpenLessonMajorNo, + t.LessonNo, + t.LessonName, + t.LessonNameEn, + t.TeachClassNo, + t.LessonSortNo, + t.StuSortNo, + t.Grade, + t.StudyScore, + t.TotalStudyHour, + t.zysx, + t.TestModeNo, + t.ScoreRecordStyleNo, + t.OrdinaryScore, + t.TermInScore, + t.TermEndScore, + t.OtherScore, + t.Score, + t.ScorePoint, + t.TestDate, + t.IsInEffect, + t.Remark, + t.ConflictLessonNo, + t.IsReStudy, + t.CheckMark, + t.IsPitchOn, + t.EmpNo, + t.TechPlanNo, + t.TestKindNo, + t.PartCode, + t.LessonSection, + t.ClassRoomNo, + t.ClassRoomName, + t.IsEditable, + t.EditUserId, + t.ModifyDate, + t.ModifyUserId, + t.ModifyUserName + "; + } + #endregion + #region 缓存定义 + private ICache cache = CacheFactory.CaChe(); + private string cacheKey = "Learun_adms_excelError_"; + #endregion + #region 获取数据 + + public IEnumerable GetMonitorList(string queryJson) + { + try + { + //参考写法 + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + var strSql = new StringBuilder(); + strSql.Append("select AcademicYearNo,Semester,lessonno,LessonName,EmpNo,IsEditable,EditUserId,BeginModifyDate,ModifyDate from StuScoreOnline where 1=1 "); + if (!queryParam["AcademicYearNo"].IsEmpty()) + { + strSql.Append(" and AcademicYearNo = @AcademicYearNo "); + dp.Add("AcademicYearNo", "" + queryParam["AcademicYearNo"].ToString() + "", DbType.String); + } + if (!queryParam["Semester"].IsEmpty()) + { + strSql.Append(" and Semester =@Semester "); + dp.Add("Semester", "" + queryParam["Semester"].ToString() + "", DbType.String); + } + if (!queryParam["LessonSortNo"].IsEmpty()) + { + strSql.Append(" and LessonSortNo =@LessonSortNo "); + dp.Add("LessonSortNo", "" + queryParam["LessonSortNo"].ToString() + "", DbType.String); + } + strSql.Append(" group by AcademicYearNo,Semester,lessonno,LessonName, EmpNo, IsEditable, EditUserId, BeginModifyDate, ModifyDate "); + strSql.Append(" order by IsEditable, BeginModifyDate, edituserid,AcademicYearNo,Semester,LessonNo "); + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取列表数据 + /// + /// + public IEnumerable GetList(string queryJson) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("SELECT t.*,sb.StudyModality,sb.MoveType FROM StuScoreOnline t "); + strSql.Append(" left join StuInfoBasic sb on t.StuNo=sb.StuNo "); + strSql.Append(" where 1=1 "); + + //学籍异动的学生不显示 + //strSql.Append(" and t.StuNo not in (select StuNo from StuInfoBasic where ChangeStatus=1) "); + //20220616改 休学的要录入成绩,退学和转校的不用 + strSql.Append(" and t.StuNo not in (select StuNo from StuInfoBasicChange where StuChangeType in('04','06')) "); + var queryParam = queryJson.ToJObject(); + var dp = new DynamicParameters(new { }); + if (!queryParam["F_SchoolId"].IsEmpty()) + { + strSql.Append(" and t.F_SchoolId=@F_SchoolId "); + dp.Add("F_SchoolId", queryParam["F_SchoolId"].ToString(), DbType.String); + } + if (!queryParam["AcademicYearNo"].IsEmpty()) + { + strSql.Append(" and t.AcademicYearNo=@AcademicYearNo "); + dp.Add("AcademicYearNo", queryParam["AcademicYearNo"].ToString(), DbType.String); + } + if (!queryParam["Semester"].IsEmpty()) + { + strSql.Append(" and t.Semester=@Semester "); + dp.Add("Semester", queryParam["Semester"].ToString(), DbType.String); + } + if (!queryParam["LessonNo"].IsEmpty()) + { + strSql.Append(" and t.LessonNo=@LessonNo "); + dp.Add("LessonNo", queryParam["LessonNo"].ToString(), DbType.String); + } + if (!queryParam["LessonName"].IsEmpty()) + { + strSql.Append(" and t.LessonName=@LessonName "); + dp.Add("LessonName", queryParam["LessonName"].ToString(), DbType.String); + } + if (!queryParam["EmpNo"].IsEmpty()) + { + strSql.Append(" and t.EmpNo=@EmpNo "); + dp.Add("EmpNo", queryParam["EmpNo"].ToString(), DbType.String); + } + if (!queryParam["ClassNo"].IsEmpty()) + { + strSql.Append(" and t.ClassNo=@ClassNo "); + dp.Add("ClassNo", queryParam["ClassNo"].ToString(), DbType.String); + } + if (!queryParam["ClassRoomNo"].IsEmpty()) + { + strSql.Append(" and t.ClassRoomNo=@ClassRoomNo "); + dp.Add("ClassRoomNo", queryParam["ClassRoomNo"].ToString(), DbType.String); + } + if (!queryParam["LessonSection"].IsEmpty()) + { + strSql.Append(" and t.LessonSection=@LessonSection "); + dp.Add("LessonSection", queryParam["LessonSection"].ToString(), DbType.String); + } + + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + public DataTable GetListForExport(string queryJson) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("SELECT t.*,sb.StudyModality,sb.MoveType FROM StuScoreOnline t "); + strSql.Append(" left join StuInfoBasic sb on t.StuNo=sb.StuNo "); + strSql.Append(" where 1=1 "); + + //学籍异动的学生不显示 + //strSql.Append(" and t.StuNo not in (select StuNo from StuInfoBasic where ChangeStatus=1) "); + //20220616改 休学的要录入成绩,退学和转校的不用 + strSql.Append(" and t.StuNo not in (select StuNo from StuInfoBasicChange where StuChangeType in('04','06')) "); + var queryParam = queryJson.ToJObject(); + var dp = new DynamicParameters(new { }); + if (!queryParam["F_SchoolId"].IsEmpty()) + { + strSql.Append(" and t.F_SchoolId=@F_SchoolId "); + dp.Add("F_SchoolId", queryParam["F_SchoolId"].ToString(), DbType.String); + } + if (!queryParam["AcademicYearNo"].IsEmpty()) + { + strSql.Append(" and t.AcademicYearNo=@AcademicYearNo "); + dp.Add("AcademicYearNo", queryParam["AcademicYearNo"].ToString(), DbType.String); + } + if (!queryParam["Semester"].IsEmpty()) + { + strSql.Append(" and t.Semester=@Semester "); + dp.Add("Semester", queryParam["Semester"].ToString(), DbType.String); + } + if (!queryParam["LessonNo"].IsEmpty()) + { + strSql.Append(" and t.LessonNo=@LessonNo "); + dp.Add("LessonNo", queryParam["LessonNo"].ToString(), DbType.String); + } + if (!queryParam["ClassNo"].IsEmpty()) + { + strSql.Append(" and t.ClassNo=@ClassNo "); + dp.Add("ClassNo", queryParam["ClassNo"].ToString(), DbType.String); + } + if (!queryParam["ClassRoomNo"].IsEmpty()) + { + strSql.Append(" and t.ClassRoomNo=@ClassRoomNo "); + dp.Add("ClassRoomNo", queryParam["ClassRoomNo"].ToString(), DbType.String); + } + if (!queryParam["LessonSection"].IsEmpty()) + { + strSql.Append(" and t.LessonSection=@LessonSection "); + dp.Add("LessonSection", queryParam["LessonSection"].ToString(), DbType.String); + } + + return new DataTable(); //this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取列表分页数据 + /// 分页参数 + /// + /// + public IEnumerable GetPageList(Pagination pagination, string queryJson) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("SELECT "); + strSql.Append(fieldSql); + strSql.Append(" FROM StuScoreOnline t where 1=1 "); + var queryParam = queryJson.ToJObject(); + var dp = new DynamicParameters(new { }); + if (!queryParam["keyword"].IsEmpty()) + { + strSql.Append(" and (stuno like @keyword or stuname like @keyword )"); + dp.Add("keyword", "%" + queryParam["keyword"].ToString() + "%", DbType.String); + } + + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取实体数据 + /// 主键 + /// + /// + public StuScoreOnlineEntity GetEntity(string keyValue) + { + try + { + return this.BaseRepository("CollegeMIS").FindEntity(Convert.ToInt32(keyValue)); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取列表分页数据 + /// 分页参数 + /// + /// + public IEnumerable GetScoreInputCancelPageList(Pagination pagination, string queryJson) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("SELECT * FROM StuScoreOnline t where 1=1 "); + + var loginInfo = LoginUserInfo.Get(); + if (loginInfo.Description == "教师") + { + strSql.Append(" and t.EmpNo='" + loginInfo.account + "' "); + } + + var queryParam = queryJson.ToJObject(); + var dp = new DynamicParameters(new { }); + if (!queryParam["AcademicYearNo"].IsEmpty()) + { + strSql.Append(" and t.AcademicYearNo=@AcademicYearNo "); + dp.Add("AcademicYearNo", queryParam["AcademicYearNo"].ToString(), DbType.String); + } + if (!queryParam["Semester"].IsEmpty()) + { + strSql.Append(" and t.Semester=@Semester "); + dp.Add("Semester", queryParam["Semester"].ToString(), DbType.String); + } + if (!queryParam["EmpNo"].IsEmpty()) + { + strSql.Append(" and t.EmpNo=@EmpNo "); + dp.Add("EmpNo", queryParam["EmpNo"].ToString(), DbType.String); + } + if (!queryParam["LessonNo"].IsEmpty()) + { + strSql.Append(" and t.LessonNo=@LessonNo "); + dp.Add("LessonNo", queryParam["LessonNo"].ToString(), DbType.String); + } + if (!queryParam["ClassNo"].IsEmpty()) + { + strSql.Append(" and t.ClassNo=@ClassNo "); + dp.Add("ClassNo", queryParam["ClassNo"].ToString(), DbType.String); + } + if (!queryParam["StuNo"].IsEmpty()) + { + strSql.Append(" and t.StuNo=@StuNo "); + dp.Add("StuNo", queryParam["StuNo"].ToString(), DbType.String); + } + + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取列表分页数据 + /// 分页参数 + /// + /// + public StuSelectLessonListEntity GetStuSelectLessonListEntity(StuScoreOnlineEntity entity) + { + try + { + var model = this.BaseRepository("CollegeMIS").FindEntity(x => x.AcademicYearNo == entity.AcademicYearNo && x.Semester == entity.Semester && x.EmpNo == entity.EmpNo && x.LessonNo == entity.LessonNo && x.ClassNo == entity.ClassNo && x.StuNo == entity.StuNo); + return model; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取列表数据 + /// + /// + public StuScoreOnlineEntity GetEntityByJson(string queryJson) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("SELECT t.* FROM StuScoreOnline t where 1=1 "); + + var queryParam = queryJson.ToJObject(); + var dp = new DynamicParameters(new { }); + if (!queryParam["F_SchoolId"].IsEmpty()) + { + strSql.Append(" and t.F_SchoolId=@F_SchoolId "); + dp.Add("F_SchoolId", queryParam["F_SchoolId"].ToString(), DbType.String); + } + if (!queryParam["AcademicYearNo"].IsEmpty()) + { + strSql.Append(" and t.AcademicYearNo=@AcademicYearNo "); + dp.Add("AcademicYearNo", queryParam["AcademicYearNo"].ToString(), DbType.String); + } + if (!queryParam["Semester"].IsEmpty()) + { + strSql.Append(" and t.Semester=@Semester "); + dp.Add("Semester", queryParam["Semester"].ToString(), DbType.String); + } + if (!queryParam["LessonNo"].IsEmpty()) + { + strSql.Append(" and t.LessonNo=@LessonNo "); + dp.Add("LessonNo", queryParam["LessonNo"].ToString(), DbType.String); + } + if (!queryParam["EmpNo"].IsEmpty()) + { + strSql.Append(" and t.EmpNo=@EmpNo "); + dp.Add("EmpNo", queryParam["EmpNo"].ToString(), DbType.String); + } + if (!queryParam["ClassNo"].IsEmpty()) + { + strSql.Append(" and t.ClassNo=@ClassNo "); + dp.Add("ClassNo", queryParam["ClassNo"].ToString(), DbType.String); + } + if (!queryParam["LessonSection"].IsEmpty()) + { + strSql.Append(" and t.LessonSection=@LessonSection "); + dp.Add("LessonSection", queryParam["LessonSection"].ToString(), DbType.String); + } + if (!queryParam["ClassRoomNo"].IsEmpty()) + { + strSql.Append(" and t.ClassRoomNo=@ClassRoomNo "); + dp.Add("ClassRoomNo", queryParam["ClassRoomNo"].ToString(), DbType.String); + } + return this.BaseRepository("CollegeMIS").FindEntity(strSql.ToString(), dp); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// 主键 + /// + /// + public void DeleteEntity(string keyValue) + { + try + { + this.BaseRepository("CollegeMIS").Delete(t => t.ScoreId == Convert.ToInt32(keyValue)); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + public void SubmitStuScoreOnline(string AcademicYearNo, string Semester, string LessonNo, string EmpNo) + { + try + { + this.BaseRepository("CollegeMIS").ExecuteBySql( + @"update StuScoreOnline set IsEditable=1,EditUserId=null,BeginModifyDate=null + where AcademicYearNo='" + AcademicYearNo + "' and Semester='" + Semester + "' and LessonNo='" + + LessonNo + "' and EmpNo='" + EmpNo + "' "); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 保存实体数据(新增、修改) + /// 主键 + /// + /// + public void SaveEntity(string keyValue, StuScoreOnlineEntity entity) + { + try + { + if (!string.IsNullOrEmpty(keyValue)) + { + entity.Modify(Convert.ToInt32(keyValue)); + this.BaseRepository("CollegeMIS").Update(entity); + } + else + { + entity.Create(); + this.BaseRepository("CollegeMIS").Insert(entity); + } + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + internal bool GetAny() + { + try + { + var yearAndSemester = Common.GetSemesterAndYear(); + return this.BaseRepository("CollegeMIS").FindList(a => a.AcademicYearNo == yearAndSemester.AcademicYearShort && a.Semester == yearAndSemester.Semester).Any(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 保存实体数据(新增、修改) + /// 主键 + /// + /// + public void UpEmpNos(string xn, string xq, string classNo, string LessonNo, string EmpNo, string hisempno, string Grade) + { + try + { + StringBuilder sb = new StringBuilder(); + sb.Append(" update StuScoreOnline set EmpNo ='" + EmpNo + "' where classno = '" + classNo + "' and Semester ='" + xq + "' and AcademicYearNo ='" + xn + "' and LessonNo ='" + LessonNo + "' and empno = '" + hisempno + "' and Grade='" + Grade + "' "); + this.BaseRepository("CollegeMIS").ExecuteBySql(sb.ToString()); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + #endregion + private static HttpClient Client; + + internal List GetScoreInfo(string queryJson) + { + try + { + var queryParam = queryJson.ToJObject(); + var academicYearNo = queryParam["AcademicYearNo"].ToString(); + var semester = queryParam["Semester"].ToString(); + var classNo = queryParam["ClassNo"].ToString(); + var lessonNo = queryParam["LessonNo"].ToString(); + + var data = this.BaseRepository("CollegeMIS").FindList(a => a.AcademicYearNo == academicYearNo && a.Semester == semester && a.ClassNo == classNo && a.LessonNo == lessonNo).OrderByDescending(a => a.Score).ToList(); + //及格的 + return data; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + internal object GetScoreCharts(string academicYearNo, string semester, string classNo, string lessonNo) + { + try + { + var aab = new List(); + var data = this.BaseRepository("CollegeMIS").FindList(a => a.AcademicYearNo == academicYearNo && a.Semester == semester && a.ClassNo == classNo && a.LessonNo == lessonNo).ToList(); + //及格的 + aab.Add(new { name = "及格", value = data.Count(a => a.Score >= 60).ToString() }); + //不及格的 + aab.Add(new { name = "不及格", value = data.Count(a => a.Score < 60).ToString() }); + var aaa = new List { "及格", "不及格" }; + var aa = new { aaa, aab }; + + + var bbb = new List(); + bbb.Add(new { name = "80-100", value = data.Count(a => a.Score >= 80).ToString() }); + bbb.Add(new { name = "60-80", value = data.Count(a => a.Score >= 60 && a.Score < 80).ToString() }); + bbb.Add(new { name = "0-60", value = data.Count(a => a.Score >= 0 && a.Score < 60).ToString() }); + var bba = new List { "80-100", "60-80", "0-60" }; + var bb = new { bba, bbb }; + + return new { aa, bb }; + + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + public void DeleteList() + { + try + { + var semesterAndYear = Common.GetSemesterAndYear(); + var strAcademicYear = semesterAndYear.AcademicYearShort; + var strSemester = semesterAndYear.Semester; + BaseRepository("CollegeMIS").ExecuteBySql("delete from StuScoreOnline where AcademicYearNo = '" + strAcademicYear + "' and Semester = '" + strSemester + "'"); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + + } + + #region 扩展数据 + + /// + /// 获取学年学期列表 + /// + /// + public IEnumerable GetAcademicAndSemesterList() + { + try + { + var aa = this.BaseRepository("CollegeMIS").FindList(x => !string.IsNullOrEmpty(x.AcademicYearNo) && !string.IsNullOrEmpty(x.Semester)); + var aaa = aa.ToList().GroupBy(x => new { x.AcademicYearNo, x.Semester }).Select(x => new WebHelper.YearGrade() + { + text = string.Format("{0}学年第{1}学期", x.Key.AcademicYearNo, x.Key.Semester), + value = string.Format("{0},{1}", x.Key.AcademicYearNo, x.Key.Semester) + }); + return aaa; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + /// + /// 根据学号获取成绩列表 + /// + /// + /// + /// 学号 + /// 班级编号 + /// + public ScoreListByStuNoModel GetScoreListByStuNo(string academic, string semester, string stuNo, string classNo) + { + try + { + var result = new ScoreListByStuNoModel(); + + //获取已审核成绩列表 + var stuScoreOnlineList = this.BaseRepository("CollegeMIS").FindList(x => x.AcademicYearNo == academic && x.Semester == semester && x.StuNo == stuNo && x.CheckMark == "1"); + foreach (var scoreEntity in stuScoreOnlineList) + { + if (scoreEntity.LessonSortNo == "2") + { + scoreEntity.LessonName = scoreEntity.LessonName + "(选修)"; + } + else + { + if (scoreEntity.Score < 60) + { + //暂时注释 + //var notpass = this.BaseRepository("CollegeMIS").FindEntity(x => x.AcademicYearNo == scoreEntity.AcademicYearNo && x.Semester == scoreEntity.Semester && x.StuNo == scoreEntity.StuNo && x.LessonNo == scoreEntity.LessonNo && x.CheckMark == "1"); + //if (notpass != null) + //{ + // if (notpass.Score >= 60) + // { + // scoreEntity.Score = notpass.Score; + // } + // else + // { + // var notpasstwo = this.BaseRepository("CollegeMIS").FindEntity(x => x.AcademicYearNo == scoreEntity.AcademicYearNo && x.Semester == scoreEntity.Semester && x.StuNo == scoreEntity.StuNo && x.LessonNo == scoreEntity.LessonNo && x.CheckMark == "1"); + // if (notpasstwo != null) + // { + // if (notpasstwo.Score >= 60) + // { + // scoreEntity.Score = notpasstwo.Score; + // } + // } + // } + //} + } + } + } + result.ScoreList = stuScoreOnlineList.ToList(); + //获取排名、综合成绩 + var aa = this.BaseRepository("CollegeMIS").FindList(x => x.AcademicYearNo == academic && x.Semester == semester && x.ClassNo == classNo && x.CheckMark == "1" && x.LessonSortNo == "1"); + var aaa = aa.GroupBy(x => x.StuNo).Select(x => new + { + StuNo = x.Key, + Score = x.Select(y => y.Score).Sum() + }).OrderByDescending(x => x.Score); + if (aaa.Any()) + { + var rank = aaa.Select(x => x.StuNo).ToList().IndexOf(stuNo); + var totalScore = aaa.FirstOrDefault(x => x.StuNo == stuNo)?.Score; + + result.Rank = rank + 1; + result.TotalScore = totalScore.Value; + } + + return result; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + public class ScoreListByStuNoModel + { + /// + /// 成绩列表 + /// + public List ScoreList { get; set; } + /// + /// 排名 + /// + public int Rank { get; set; } + /// + /// 综合成绩 + /// + public decimal TotalScore { get; set; } + } + + /// + /// 获取一次补考名单数据 + /// + /// + public IEnumerable GetStuScoreOnlineNotPassList() + { + try + { + var strSql = new StringBuilder(); + strSql.Append("select s.AcademicYearNo,s.Semester,s.StuNo,s.StuName,si.StuId,s.LessonNo,s.LessonName,l.LessonId,s.ClassNo,c.ClassName,c.ClassId,s.EmpNo,e.EmpName,e.EmpId,1 AS BuKaoFlag "); + strSql.Append(" from StuScoreOnlineNotPass s left join ClassInfo c on s.ClassNo=c.ClassNo left join EmpInfo e on s.EmpNo=e.EmpNo left join StuInfoBasic si on s.StuNo=si.StuNo left join LessonInfo l on s.LessonNo=l.LessonNo "); + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString()); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取二次补考名单数据 + /// + /// + public IEnumerable GetStuScoreOnlineNotPassTwoList() + { + try + { + var strSql = new StringBuilder(); + strSql.Append("select s.AcademicYearNo,s.Semester,s.StuNo,s.StuName,si.StuId,s.LessonNo,s.LessonName,l.LessonId,s.ClassNo,c.ClassName,c.ClassId,s.EmpNo,e.EmpName,e.EmpId,2 AS BuKaoFlag "); + strSql.Append(" from StuScoreOnlineNotPassTwo s left join ClassInfo c on s.ClassNo=c.ClassNo left join EmpInfo e on s.EmpNo=e.EmpNo left join StuInfoBasic si on s.StuNo=si.StuNo left join LessonInfo l on s.LessonNo=l.LessonNo "); + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString()); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取班级成绩初始化信息 + /// + /// + public IEnumerable GetPageListAboutClass(Pagination pagination, string queryJson) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("select s.AcademicYearNo+'/'+s.Semester+'/'+s.ClassNo as TempId,s.AcademicYearNo,s.Semester,s.ClassNo,c.ClassName,count(s.scoreid) as StuScoreOnlineNum "); + strSql.Append(" FROM stuscore s inner join classinfo c on s.ClassNo=c.ClassNo "); + + var queryParam = queryJson.ToJObject(); + var dp = new DynamicParameters(new { }); + if (!queryParam["keyword"].IsEmpty()) + { + strSql.Append(" where c.classname like @keyword "); + dp.Add("keyword", "%" + queryParam["keyword"].ToString() + "%", DbType.String); + } + strSql.Append(" group by s.AcademicYearNo,s.Semester,s.ClassNo,c.ClassName "); + + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 班级学生成绩初始化 + /// + /// + public void DoInitAboutClass(string academicYearNo, string semester, string classNo) + { + try + { + //清空StuSelectLessonList + this.BaseRepository("CollegeMIS").ExecuteBySql("delete from StuSelectLessonList where AcademicYearNo='" + academicYearNo + "' and Semester='" + semester + "' and ClassNo='" + classNo + "' "); + //清空StuScoreOnline + this.BaseRepository("CollegeMIS").ExecuteBySql("delete from StuScoreOnline where AcademicYearNo='" + academicYearNo + "' and Semester='" + semester + "' and ClassNo='" + classNo + "' and LessonSortNo='1' "); + //重置StuSelectLessonList + var lessonData = this.BaseRepository("CollegeMIS").FindList(); + var TeachClassData = this.BaseRepository("CollegeMIS").FindList(x => x.AcademicYearNo == academicYearNo && x.Semester == semester && x.TeachClassNo == classNo); + var classstulist = this.BaseRepository("CollegeMIS").FindList(x => x.ClassNo == classNo); + var stuSelectLessonListEntityData = this.BaseRepository("CollegeMIS").FindList(); + var insertStuSelectLessonListDataList = new List(); + if (TeachClassData.Any()) + { + foreach (var itemteachclass in TeachClassData) + { + foreach (var stu in classstulist) + { + var insertDatastuselect = new StuSelectLessonListEntity(); + insertDatastuselect.NoticeBookNo = stu.NoticeNo; + insertDatastuselect.StuNo = stu.StuNo; + insertDatastuselect.DeptNo = stu.DeptNo; + insertDatastuselect.ClassNo = stu.ClassNo; + insertDatastuselect.MajorNo = stu.MajorNo; + insertDatastuselect.StuName = stu.StuName; + insertDatastuselect.GenderNo = stu.GenderNo != null && stu.GenderNo.Value ? "1" : "0"; + insertDatastuselect.AcademicYearNo = itemteachclass.AcademicYearNo; + insertDatastuselect.Semester = itemteachclass.Semester; + insertDatastuselect.OpenLessonDeptNo = itemteachclass.DeptNo; + insertDatastuselect.OpenLessonMajorNo = itemteachclass.MajorNo; + insertDatastuselect.LessonNo = itemteachclass.LessonNo; + insertDatastuselect.LessonName = lessonData.FirstOrDefault(m => m.LessonNo == itemteachclass.LessonNo)?.LessonName; + insertDatastuselect.PartCode = ""; + insertDatastuselect.OrdinaryScoreScale = 1; + insertDatastuselect.TermInScoreScale = 1; + insertDatastuselect.TermEndScoreScale = 1; + insertDatastuselect.OtherScoreScale = 1; + insertDatastuselect.TeachClassNo = stu.ClassNo; + insertDatastuselect.LessonSortNo = lessonData.FirstOrDefault(m => m.LessonNo == itemteachclass.LessonNo)?.LessonSortNo; + insertDatastuselect.StuSortNo = "02"; + insertDatastuselect.Grade = stu.Grade; + insertDatastuselect.StudyScore = lessonData.FirstOrDefault(m => m.LessonNo == itemteachclass.LessonNo).StudyScore == null ? 0 : lessonData.FirstOrDefault(m => m.LessonNo == itemteachclass.LessonNo).StudyScore; + insertDatastuselect.TotalStudyHour = lessonData.FirstOrDefault(m => m.LessonNo == itemteachclass.LessonNo).TotalStudyHour == null ? 0 : lessonData.FirstOrDefault(m => m.LessonNo == itemteachclass.LessonNo).TotalStudyHour; + insertDatastuselect.IsInEffect = "1"; + insertDatastuselect.EmpNo = itemteachclass.EmpNo; + insertDatastuselect.IsPitchOn = "1"; + insertDatastuselect.CheckMark = "0"; + insertDatastuselect.InsertTime = DateTime.Now; + if (stuSelectLessonListEntityData.Count(m => m.StuNo == insertDatastuselect.StuNo && + m.AcademicYearNo == insertDatastuselect.AcademicYearNo && + m.Semester == insertDatastuselect.Semester && + m.DeptNo == insertDatastuselect.DeptNo && + m.MajorNo == insertDatastuselect.MajorNo && + m.LessonNo == insertDatastuselect.LessonNo && + m.Grade == insertDatastuselect.Grade && + m.OpenLessonDeptNo == insertDatastuselect.OpenLessonDeptNo && + m.OpenLessonMajorNo == insertDatastuselect.OpenLessonMajorNo) == 0 && insertStuSelectLessonListDataList.Count(m => m.StuNo == insertDatastuselect.StuNo && + m.AcademicYearNo == insertDatastuselect.AcademicYearNo && + m.Semester == insertDatastuselect.Semester && + m.DeptNo == insertDatastuselect.DeptNo && + m.MajorNo == insertDatastuselect.MajorNo && + m.LessonNo == insertDatastuselect.LessonNo && + m.Grade == insertDatastuselect.Grade && + m.OpenLessonDeptNo == insertDatastuselect.OpenLessonDeptNo && + m.OpenLessonMajorNo == insertDatastuselect.OpenLessonMajorNo) == 0) + { + insertStuSelectLessonListDataList.Add(insertDatastuselect); + } + } + } + this.BaseRepository("CollegeMIS").Insert(insertStuSelectLessonListDataList); + } + //重置StuScoreOnline + var strSql = new StringBuilder(); + strSql.Append(@"insert into stuscore(NoticeBookNo,StuNo,DeptNo,MajorNo,ClassNo,StuName,GenderNo,AcademicYearNo,Semester,OpenLessonDeptNo,OpenLessonMajorNo,LessonNo,LessonName,LessonNameEn,TeachClassNo,LessonSortNo,StuSortNo,Grade,StudyScore,TotalStudyHour,OrdinaryScore,TermInScore,TermEndScore,OtherScore,IsInEffect,Remark,ConflictLessonNo,IsPitchOn,CheckMark,TechPlanNo,EmpNo,PartCode,ScoreRecordStyleNo,TestModeNo,zysx,TestKindNo,IsEditable) +select NoticeBookNo,StuNo,DeptNo,MajorNo,ClassNo,StuName,GenderNo,AcademicYearNo,Semester,OpenLessonDeptNo,OpenLessonMajorNo,LessonNo,LessonName,LessonNameEng as LessionNameEn,TeachClassNo,LessonSortNo,StuSortNo,Grade,StudyScore,TotalStudyHour,'0','0','0','0',IsInEffect,Remark,ConflictLessonNo,IsPitchOn,CheckMark,TeachPlanNo as TechPlanNo,EmpNo,PartCode,ScoreRecordStyleNo,TestModeNo,zysx=1,TestKindNo=1,IsEditable=1 from +( +select s.NoticeBookNo,s.StuNo,s.DeptNo,s.MajorNo,s.ClassNo,s.StuName,s.GenderNo,s.AcademicYearNo,s.Semester,s.OpenLessonDeptNo,s.OpenLessonMajorNo,s.LessonNo,s.LessonName,s.LessonNameEng,s.TeachClassNo,s.LessonSortNo,s.StuSortNo,s.Grade,s.StudyScore,s.TotalStudyHour,s.IsInEffect,s.Remark,s.ConflictLessonNo,s.IsPitchOn,s.CheckMark,s.TeachPlanNo,s.EmpNo,s.PartCode,o.ScoreRecordStyleNo,cs.ScoreRecordName,bc.TestModeNo,bc.TestMode +from StuSelectLessonList s +left join OpenLessonPlan o on s.AcademicYearNo=o.AcademicYearNo and s.Semester=o.Semester and s.LessonNo=o.LessonNo +and s.PartCode=o.PartCode and s.OpenLessonMajorNo=o.MajorNo +left join CdScoreRecordStyle cs on o.ScoreRecordStyleNo=cs.ScoreRecordStyleNo +left join BCdTestMode bc on o.CheckStyleNo=bc.TestModeNo +where s.AcademicYearNo='" + academicYearNo + "' and s.Semester='" + semester + "' and s.TeachClassNo='" + classNo + @"' and s.LessonSortNo='1' +) as sl +where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Academicyearno + and s.Semester = sl.Semester and s.lessonno = sl.lessonno and s.teachclassno = sl.teachclassno and s.LessonSortNo = '1') "); + this.BaseRepository("CollegeMIS").ExecuteBySql(strSql.ToString()); + + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 学年下拉框信息【班级成绩查看】 + /// + /// + public IEnumerable GetAcademicYearNoData() + { + try + { + var data = this.BaseRepository("CollegeMIS").FindList("select distinct s.AcademicYearNo as value,s.AcademicYearNo as text from StuScoreOnline s "); + data = data.Where(x => !string.IsNullOrEmpty(x.value)).OrderBy(x => x.value); + return data; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 班级下拉框信息【班级成绩查看】 + /// + /// + public IEnumerable GetClassNoData(string userAccount, string userType, string lessonNo) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("select distinct s.ClassNo as value,c.ClassName as text from stuscore s inner join ClassInfo c on s.ClassNo=c.ClassNo where s.LessonSortNo='1' "); + if (userType == "教师") + { + strSql.Append(" and s.EmpNo='" + userAccount + "' "); + } + if (!string.IsNullOrEmpty(lessonNo)) + { + strSql.Append(" and s.LessonNo='" + lessonNo + "' "); + } + var data = this.BaseRepository("CollegeMIS").FindList(strSql.ToString()); + data = data.Where(x => !string.IsNullOrEmpty(x.value)).OrderBy(x => x.value); + return data; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 班级下拉框【成绩录入】 + /// + /// + /// + /// + /// + /// + /// + public IEnumerable GetClassNoDataForInput(string userAccount, string userType, string lessonNo, string academicYearShort, string semester) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("select distinct s.ClassNo as value,c.ClassName as text from stuscore s inner join ClassInfo c on s.ClassNo=c.ClassNo where s.LessonSortNo='1' "); + if (userType == "教师") + { + strSql.Append(" and s.EmpNo='" + userAccount + "' "); + } + + if (!string.IsNullOrEmpty(academicYearShort)) + { + strSql.Append(" and s.AcademicYearNo='" + academicYearShort + "' and s.Semester='" + semester + "' "); + } + if (!string.IsNullOrEmpty(lessonNo)) + { + strSql.Append(" and s.LessonNo='" + lessonNo + "' "); + } + var data = this.BaseRepository("CollegeMIS").FindList(strSql.ToString()); + data = data.Where(x => !string.IsNullOrEmpty(x.value)).OrderBy(x => x.value); + return data; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 教师下拉框信息【学生成绩录入可去审核】 + /// + /// + public IEnumerable GetEmpNoData(string userAccount, string userType, string lessonNo) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("select distinct s.EmpNo as value,c.EmpName as text from StuScoreOnline s inner join EmpInfo c on s.EmpNo=c.EmpNo where 1=1 "); + if (userType == "教师") + { + strSql.Append(" and s.EmpNo='" + userAccount + "' "); + } + if (!string.IsNullOrEmpty(lessonNo)) + { + strSql.Append(" and s.LessonNo='" + lessonNo + "' "); + } + var data = this.BaseRepository("CollegeMIS").FindList(strSql.ToString()); + data = data.Where(x => !string.IsNullOrEmpty(x.value)).OrderBy(x => x.value); + return data; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 课程下拉框信息【学生成绩录入可去审核】 + /// + /// + public IEnumerable GetLessonNoDataOfAll(string userAccount, string userType, string AcademicYearNo = "", string Semester = "") + { + try + { + var strSql = new StringBuilder(); + strSql.Append("select distinct s.LessonNo as value,s.LessonName as text from StuScoreOnline s where 1=1 "); + if (userType == "教师") + { + strSql.Append(" and s.EmpNo='" + userAccount + "' "); + } + if (!string.IsNullOrEmpty(AcademicYearNo)) + { + strSql.Append(" and s.AcademicYearNo='" + AcademicYearNo + "' and s.Semester='" + Semester + "' "); + } + var data = this.BaseRepository("CollegeMIS").FindList(strSql.ToString()); + data = data.Where(x => !string.IsNullOrEmpty(x.value)).OrderBy(x => x.value); + return data; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 课程下拉框信息【选修课】 + /// + /// + public IEnumerable GetElectiveLessonNoDataOfAll(string userAccount, string userType, string AcademicYearNo = "", string Semester = "") + { + try + { + var strSql = new StringBuilder(); + strSql.Append("select distinct s.LessonNo as value,l.LessonName as text from stuscore s left join LessonInfo l on s.LessonNo=l.LessonNo where s.LessonSortNo='2' "); + if (userType == "教师") + { + strSql.Append(" and s.EmpNo='" + userAccount + "' "); + } + if (!string.IsNullOrEmpty(AcademicYearNo)) + { + strSql.Append(" and s.AcademicYearNo='" + AcademicYearNo + "' and s.Semester='" + Semester + "' "); + } + var data = this.BaseRepository("CollegeMIS").FindList(strSql.ToString()); + data = data.Where(x => !string.IsNullOrEmpty(x.value)).OrderBy(x => x.value); + return data; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 教室下拉框信息【选修课】 + /// + /// + public IEnumerable GetElectiveClassRoomNoData(string userAccount, string userType, string lessonNo) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("select distinct s.ClassRoomNo as value,c.ClassroomName as text from stuscore s inner join ClassroomInfo c on s.ClassRoomNo=c.ClassroomNo where s.LessonSortNo='2' "); + if (userType == "教师") + { + strSql.Append(" and s.EmpNo='" + userAccount + "' "); + } + if (!string.IsNullOrEmpty(lessonNo)) + { + strSql.Append(" and s.LessonNo='" + lessonNo + "' "); + } + var data = this.BaseRepository("CollegeMIS").FindList(strSql.ToString()); + data = data.Where(x => !string.IsNullOrEmpty(x.value)).OrderBy(x => x.value); + return data; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 节次下拉框信息【选修课】 + /// + /// + public IEnumerable GetElectiveLessonSectionData(string userAccount, string userType, string classRoomNo) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("select distinct s.LessonSection as value,s.LessonSection as text from stuscore s where s.LessonSortNo='2' "); + if (userType == "教师") + { + strSql.Append(" and s.EmpNo='" + userAccount + "' "); + } + if (!string.IsNullOrEmpty(classRoomNo)) + { + strSql.Append(" and s.ClassRoomNo='" + classRoomNo + "' "); + } + var data = this.BaseRepository("CollegeMIS").FindList(strSql.ToString()); + data = data.Where(x => !string.IsNullOrEmpty(x.value)).OrderBy(x => x.value); + return data; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 课程信息【班级成绩查看】 + /// + /// + public IEnumerable GetLessonNoData(string academicYearNo, string semester, string classNo) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("select distinct s.LessonNo as value,s.LessonName as text from stuscore s "); + strSql.Append(" where s.AcademicYearNo='" + academicYearNo + "' and s.Semester='" + semester + "' and s.ClassNo='" + classNo + "' and s.LessonSortNo='1' "); + var data = this.BaseRepository("CollegeMIS").FindList(strSql.ToString()); + data = data.Where(x => !string.IsNullOrEmpty(x.value)).OrderBy(x => x.value); + return data; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取班级成绩列表 + /// + /// + public IEnumerable GetScoreListByClassNo(string queryJson) + { + try + { + //参考写法 + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + var tableName = "StuScoreOnline"; + if (!queryParam["TableName"].IsEmpty()) + { + tableName = queryParam["TableName"].ToString(); + } + var strSql = new StringBuilder(); + strSql.Append(" select bb.AcademicYearNo,bb.Semester,bb.ClassNo,bb.LessonNo,bb.LessonName,bb.StuNo,bb.StuName "); + strSql.Append(" ,case when bb.Score >=60 then bb.Score else (case when sp.Score>= 60 then sp.Score else (case when spt.Score>=60 then spt.Score else bb.Score end) end) end as Score "); + strSql.Append(" ,case when bb.Score >=60 then convert(nvarchar(50),bb.Score) else (case when sp.Score>= 60 then convert(nvarchar(50),sp.Score)+'(补)' else (case when spt.Score>=60 then convert(nvarchar(50),spt.Score)+'(重)' else convert(nvarchar(50),bb.Score) end) end) end as ScoreFormat "); + strSql.Append(" from ( "); + strSql.Append($" select s.AcademicYearNo,s.Semester,s.ClassNo,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.LessonSortNo='1' and s.StuNo not in (select StuNo from StuInfoBasic where ChangeStatus =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["ClassNo"].IsEmpty()) + { + dp.Add("ClassNo", queryParam["ClassNo"].ToString(), DbType.String); + strSql.Append(" and s.ClassNo=@ClassNo "); + } + if (!queryParam["StuNo"].IsEmpty()) + { + dp.Add("StuNo", queryParam["StuNo"].ToString(), DbType.String); + strSql.Append(" and s.StuNo=@StuNo "); + } + strSql.Append(" group by s.AcademicYearNo,s.Semester,s.ClassNo,s.LessonNo,s.LessonName,s.StuNo,sb.StuName ) as bb "); + strSql.Append(" left join StuScoreOnlineNotPass sp on bb.AcademicYearNo=sp.AcademicYearNo and bb.Semester=sp.Semester and bb.ClassNo=sp.ClassNo and bb.LessonNo=sp.LessonNo and bb.LessonName=sp.LessonName and bb.StuNo=sp.StuNo "); + strSql.Append(" left join StuScoreOnlineNotPassTwo spt on bb.AcademicYearNo=spt.AcademicYearNo and bb.Semester=spt.Semester and bb.ClassNo=spt.ClassNo and bb.LessonNo=spt.LessonNo and bb.LessonName=spt.LessonName and bb.StuNo=spt.StuNo "); + + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + + /// + /// 获取班级成绩列表(校级奖学金) + /// + /// + public IEnumerable GetScoreListByClassNoForScholarship(string queryJson) + { + try + { + //参考写法 + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + var tableName = "StuScoreOnline"; + if (!queryParam["TableName"].IsEmpty()) + { + tableName = queryParam["TableName"].ToString(); + } + var strSql = new StringBuilder(); + strSql.Append(" select bb.AcademicYearNo,bb.Semester,bb.LessonNo,bb.LessonName,bb.StuNo,bb.StuName,bb.DeptNo,bb.ClassNo,bb.IdentityCardNo as IdCard,bb.DepositBank,bb.BankCard ,bb.MajorNo,bb.GenderNo,bb.Birthday,bb.NationalityNo,bb.PartyFaceNo,bb.Grade "); + strSql.Append(" ,case when bb.Score >=60 then bb.Score else (case when sp.Score>= 60 then sp.Score else (case when spt.Score>=60 then spt.Score else bb.Score end) end) end as Score "); + strSql.Append(" ,case when bb.Score >=60 then convert(nvarchar(50),bb.Score) else (case when sp.Score>= 60 then convert(nvarchar(50),sp.Score)+'(补)' else (case when spt.Score>=60 then convert(nvarchar(50),spt.Score)+'(重)' else convert(nvarchar(50),bb.Score) end) end) end as ScoreFormat "); + strSql.Append(" from ( "); + strSql.Append($" select s.AcademicYearNo,s.Semester,s.ClassNo,s.LessonNo,s.LessonName,s.StuNo,sb.StuName,Max(s.Score) as Score,sb.DeptNo,sb.IdentityCardNo,sb.DepositBank,sb.BankCard,sb.majorno,sb.GenderNo,sb.Birthday,sb.NationalityNo,sb.PartyFaceNo,sb.Grade from {tableName} s left join StuInfoBasic sb on s.StuNo=sb.StuNo "); + strSql.Append(" where 1=1 and s.LessonSortNo='1' and s.StuNo not in (select StuNo from StuInfoBasic where ChangeStatus =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["ClassNo"].IsEmpty()) + { + dp.Add("ClassNo", queryParam["ClassNo"].ToString(), DbType.String); + strSql.Append(" and s.ClassNo=@ClassNo "); + } + if (!queryParam["StuNo"].IsEmpty()) + { + dp.Add("StuNo", queryParam["StuNo"].ToString(), DbType.String); + strSql.Append(" and s.StuNo=@StuNo "); + } + strSql.Append(" group by s.AcademicYearNo,s.Semester,s.ClassNo,s.LessonNo,s.LessonName,s.StuNo,sb.StuName,sb.DeptNo,sb.ClassNo,sb.IdentityCardNo,sb.DepositBank,sb.BankCard,sb.majorno,sb.GenderNo,sb.Birthday,sb.NationalityNo,sb.PartyFaceNo,sb.Grade ) as bb "); + strSql.Append(" left join StuScoreOnlineNotPass sp on bb.AcademicYearNo=sp.AcademicYearNo and bb.Semester=sp.Semester and bb.ClassNo=sp.ClassNo and bb.LessonNo=sp.LessonNo and bb.LessonName=sp.LessonName and bb.StuNo=sp.StuNo "); + strSql.Append(" left join StuScoreOnlineNotPassTwo spt on bb.AcademicYearNo=spt.AcademicYearNo and bb.Semester=spt.Semester and bb.ClassNo=spt.ClassNo and bb.LessonNo=spt.LessonNo and bb.LessonName=spt.LessonName and bb.StuNo=spt.StuNo "); + + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + /// + /// 获取学生的补考信息 + /// + /// + /// + public List GetStuGraduateInfo(string queryJson) + { + try + { + var aa = new List(); + + //参考写法 + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + dp.Add("ClassNo", queryParam["ClassNo"].ToString(), DbType.String); + dp.Add("StuNo", queryParam["StuNo"].ToString(), DbType.String); + if (!queryParam["StuNo"].IsEmpty()) + { + var stuNo = queryParam["StuNo"].ToString(); + var result = GetStuPassInfo(stuNo); + aa.Add(result); + + } + else + { + var classNo = queryParam["ClassNo"].ToString(); + var listStu = this.BaseRepository("CollegeMIS") + .FindList(a => a.ClassNo == classNo); + + foreach (var stuInfo in listStu) + { + aa.Add(GetStuPassInfo(stuInfo?.StuNo)); + } + } + + return aa; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + public List GetPassInfo(string queryJson) + { + try + { + var aa = new List(); + + //参考写法 + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + dp.Add("StuNo", queryParam["StuNo"].ToString(), DbType.String); + if (!queryParam["StuNo"].IsEmpty()) + { + var stuNo = queryParam["StuNo"].ToString(); + //暂时注释 + //var passInfo1 = this.BaseRepository("CollegeMIS") + // .FindList(a => a.StuNo == stuNo); + //foreach (var item in passInfo1) + //{ + // aa.Add(new { item.LessonNo, item.LessonName, item.Score, Type = "第一次补考" }); + //} + //var passInfo2 = this.BaseRepository("CollegeMIS") + // .FindList(a => a.StuNo == stuNo); + //foreach (var item in passInfo2) + //{ + // aa.Add(new { item.LessonNo, item.LessonName, item.Score, Type = "第二次补考" }); + //} + + } + + return aa; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + public List GetClassOfMy() + { + try + { + var aa = new List(); + + var userInfo = LoginUserInfo.Get(); + var classList = this.BaseRepository("CollegeMIS") + .FindList(a => a.ClassDiredctorNo == userInfo.account); + foreach (var item in classList) + { + aa.Add(new { text = item.ClassName, value = item.ClassNo }); + } + + return aa; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + public object GetStuPassInfo(string stuNo) + { + var stuInfo = this.BaseRepository("CollegeMIS") + .FindEntity(a => a.StuNo == stuNo); + + //暂时注释 + //var notpass1 = this.BaseRepository("CollegeMIS") + // .FindList(a => a.StuNo == stuNo).Count(); + //var notpass2 = this.BaseRepository("CollegeMIS") + // .FindList(a => a.StuNo == stuNo).Count(); + //if ((notpass1 + notpass2) > 0) + if(0>0) + { + var result = new + { + StuNo = stuInfo?.StuNo, + StuName = stuInfo?.StuName, + IsNoPass = "是", + FinishSchoolMark = stuInfo?.FinishSchoolMark + }; + return result; + } + else + { + var result = new + { + StuNo = stuInfo?.StuNo, + StuName = stuInfo?.StuName, + IsNoPass = "否", + FinishSchoolMark = stuInfo?.FinishSchoolMark + }; + return result; + } + } + + + /// + /// 获取个人成绩列表 + /// + /// + public IEnumerable GetAllScoreListByStuNo(string stuNo) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("select s.AcademicYearNo,s.Semester,s.LessonNo,s.LessonName,s.LessonSortNo,MAX(s.Score) as Score from StuScoreOnline s "); + strSql.Append(" where s.StuNo='" + stuNo + "' "); + strSql.Append(" group by s.AcademicYearNo,s.Semester,s.LessonNo,s.LessonName,s.LessonSortNo "); + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString()); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 审核学生成绩 + /// 主键 + /// + /// + public void CheckStuScoreOnline(string keyValue) + { + try + { + this.BaseRepository("CollegeMIS").ExecuteBySql("update StuScoreOnline set CheckMark='1' where ScoreId='" + keyValue + "' "); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + /// + /// 去审核学生成绩 + /// 主键 + /// + /// + public void UnCheckStuScoreOnline(string keyValue) + { + try + { + this.BaseRepository("CollegeMIS").ExecuteBySql("update StuScoreOnline set CheckMark='0' where ScoreId='" + keyValue + "' "); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取个人补考成绩 + /// + /// + public StuScoreOnlineEntity GetScoreNotPassByEntity(StuScoreOnlineEntity entity) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("select s.ScoreId,s.AcademicYearNo,s.Semester,s.LessonNo,s.Score from StuScoreOnlineNotPass s "); + strSql.Append($" where s.AcademicYearNo='{entity.AcademicYearNo}' and s.Semester='{entity.Semester}' and s.StuNo='{entity.StuNo}' and s.LessonNo='{entity.LessonNo}' and s.CheckMark='1' "); + var aa = this.BaseRepository("CollegeMIS").FindList(strSql.ToString()); + return aa.FirstOrDefault(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取个人二次补考成绩 + /// + /// + public StuScoreOnlineEntity GetScoreNotPassTwoByEntity(StuScoreOnlineEntity entity) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("select s.ScoreId,s.AcademicYearNo,s.Semester,s.LessonNo,s.Score from StuScoreOnlineNotPassTwo s "); + strSql.Append($" where s.AcademicYearNo='{entity.AcademicYearNo}' and s.Semester='{entity.Semester}' and s.StuNo='{entity.StuNo}' and s.LessonNo='{entity.LessonNo}' and s.CheckMark='1' "); + var aa = this.BaseRepository("CollegeMIS").FindList(strSql.ToString()); + return aa.FirstOrDefault(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + + /// + /// 开始录入:占用成绩 + /// + /// + public void StartInputScore(string queryJson) + { + try + { + var queryParam = queryJson.ToJObject(); + var F_SchoolId = queryParam["F_SchoolId"].ToString(); + var AcademicYearNo = queryParam["AcademicYearNo"].ToString(); + var Semester = queryParam["Semester"].ToString(); + var LessonNo = queryParam["LessonNo"].ToString(); + var EmpNo = queryParam["EmpNo"].ToString(); + + var now = DateTime.Now; + var loginUserInfo = LoginUserInfo.Get(); + this.BaseRepository("CollegeMIS").ExecuteBySql("update StuScoreOnline set IsEditable='0',EditUserId='" + loginUserInfo.account + "',BeginModifyDate='" + now + "' where F_SchoolId='" + F_SchoolId + "' and AcademicYearNo='" + AcademicYearNo + "' and Semester='" + Semester + "' and LessonNo='" + LessonNo + "' and EmpNo='" + EmpNo + "' "); + + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 提交成绩 + /// + /// + public void SaveInputScore(List list) + { + var db = this.BaseRepository("CollegeMIS").BeginTrans(); + try + { + var now = DateTime.Now; + var loginUserInfo = LoginUserInfo.Get(); + + foreach (var item in list) + { + item.OrdinaryScore = item.OrdinaryScore.HasValue ? item.OrdinaryScore.Value : 0; + item.TermInScore = item.TermInScore.HasValue ? item.TermInScore.Value : 0; + item.TermEndScore = item.TermEndScore.HasValue ? item.TermEndScore.Value : 0; + item.OtherScore = item.OtherScore.HasValue ? item.OtherScore.Value : 0; + item.Score = item.Score.HasValue ? item.Score.Value : 0; + //if (!item.Score.HasValue) + //{ + // item.Score = 0; + //} + //db.ExecuteBySql($"update StuScoreOnline set OrdinaryScore={item.OrdinaryScore},TermInScore={item.TermInScore},TermEndScore={item.TermEndScore},OtherScore={item.OtherScore},Score={item.Score},IsEditable='1',EditUserId=null,BeginModifyDate=null,ModifyDate='{now}',ModifyUserId='{loginUserInfo.userId}',ModifyUserName='{loginUserInfo.realName}' where ScoreId='{item.ScoreId}' "); + db.ExecuteBySql($"update StuScoreOnline set OrdinaryScore={item.OrdinaryScore},TermInScore={item.TermInScore},TermEndScore={item.TermEndScore},OtherScore={item.OtherScore},Score={item.Score},Remark='{item.Remark}' where ScoreId='{item.ScoreId}' "); + } + + db.Commit(); + } + catch (Exception ex) + { + db.Rollback(); + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 提交成绩:取消占用 + /// + /// + public void SaveInputScoreStatus(string queryJson) + { + try + { + var queryParam = queryJson.ToJObject(); + var F_SchoolId = queryParam["F_SchoolId"].ToString(); + var AcademicYearNo = queryParam["AcademicYearNo"].ToString(); + var Semester = queryParam["Semester"].ToString(); + var LessonNo = queryParam["LessonNo"].ToString(); + var EmpNo = queryParam["EmpNo"].ToString(); + + var now = DateTime.Now; + var loginUserInfo = LoginUserInfo.Get(); + this.BaseRepository("CollegeMIS").ExecuteBySql($"update StuScoreOnline set IsEditable='1',EditUserId=null,BeginModifyDate=null,ModifyDate='{now}',ModifyUserId='{loginUserInfo.account}',ModifyUserName='{loginUserInfo.realName}' where F_SchoolId='{F_SchoolId}' and AcademicYearNo='{AcademicYearNo}' and Semester='{Semester}' and LessonNo='{LessonNo}' and EmpNo='{EmpNo}' "); + + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + /// + /// 提交成绩:取消占用【服务】 + /// + /// + public void SaveInputScoreStatus2(string queryJson, string name) + { + try + { + var queryParam = queryJson.ToJObject(); + var F_SchoolId = queryParam["F_SchoolId"].ToString(); + var AcademicYearNo = queryParam["AcademicYearNo"].ToString(); + var Semester = queryParam["Semester"].ToString(); + var LessonNo = queryParam["LessonNo"].ToString(); + var EmpNo = queryParam["EmpNo"].ToString(); + + var now = DateTime.Now; + var loginUserInfo = new + { + account = name.Split('_')[0], + realName = name.Split('_')[1] + }; + this.BaseRepository("CollegeMIS").ExecuteBySql($"update StuScoreOnline set IsEditable='1',EditUserId=null,BeginModifyDate=null,ModifyDate='{now}',ModifyUserId='{loginUserInfo.account}',ModifyUserName='{loginUserInfo.realName}' where F_SchoolId='{F_SchoolId}' and AcademicYearNo='{AcademicYearNo}' and Semester='{Semester}' and LessonNo='{LessonNo}' and EmpNo='{EmpNo}' "); + + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 审核成绩 + /// + /// + /// 已审核:1;未审核:0; + public void DoCheckScore(string queryJson, int checkMark) + { + try + { + var queryParam = queryJson.ToJObject(); + var F_SchoolId = queryParam["F_SchoolId"].ToString(); + var AcademicYearNo = queryParam["AcademicYearNo"].ToString(); + var Semester = queryParam["Semester"].ToString(); + var LessonNo = queryParam["LessonNo"].ToString(); + var EmpNo = queryParam["EmpNo"].ToString(); + + this.BaseRepository("CollegeMIS").ExecuteBySql($"update StuScoreOnline set CheckMark='{checkMark}' where F_SchoolId='" + F_SchoolId + "' and AcademicYearNo='" + AcademicYearNo + "' and Semester='" + Semester + "' and LessonNo='" + LessonNo + "' and EmpNo='" + EmpNo + "' "); + + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + #endregion + + /// + /// 学生成绩查看含选修 + /// + /// + /// + /// + /// + public IEnumerable GetLessonNoDataFromStuNo(string academicYearNo, string semester, string stuNo) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("select distinct s.LessonNo as value,s.LessonName+(case s.LessonSortNo when '2' then '(选修)' else '' end) as text from stuscore s "); + strSql.Append(" where s.AcademicYearNo='" + academicYearNo + "' and s.Semester='" + semester + "' and s.StuNo='" + stuNo + "' "); + var data = this.BaseRepository("CollegeMIS").FindList(strSql.ToString()); + data = data.Where(x => !string.IsNullOrEmpty(x.value)).OrderBy(x => x.value); + return data; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + public IEnumerable GetScoreListByStuNo(string queryJson) + { + try + { + //参考写法 + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + var tableName = "StuScoreOnline"; + 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 "); + strSql.Append(" ,case when bb.LessonSortNo='2' then bb.Score else (case when bb.Score >=60 then bb.Score else (case when sp.Score>= 60 then sp.Score else (case when spt.Score>=60 then spt.Score else bb.Score end) end) end) end as Score "); + strSql.Append(" ,case when bb.LessonSortNo='2' then convert(nvarchar(50),bb.Score)+'(选修)' else (case when bb.Score >=60 then convert(nvarchar(50),bb.Score) else (case when sp.Score>= 60 then convert(nvarchar(50),sp.Score)+'(补)' else (case when spt.Score>=60 then convert(nvarchar(50),spt.Score)+'(重)' else convert(nvarchar(50),bb.Score) end) end) end) end as ScoreFormat "); + 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 "); + } + strSql.Append(" group by s.AcademicYearNo,s.Semester,s.LessonSortNo,s.LessonNo,s.LessonName,s.StuNo,sb.StuName ) as bb "); + strSql.Append(" left join StuScoreOnlineNotPass 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 StuScoreOnlineNotPassTwo 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' "); + + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 根据学号/姓名获取学生成绩列表 + /// + /// + /// + public IEnumerable GetScoreListByStuInfo(string queryJson) + { + try + { + //参考写法 + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + var tableName = "StuScoreOnline"; + 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,bb.MajorNo,bb.ClassNo,li.StudyScore,ls.LessonSortName,bb.Score,(case when sp.Score>=60 then 60 else sp.score end) as ScoreOfNotPass,(case when spt.Score>=60 then 60 else spt.Score end) as ScoreOfNotPassTwo,cm.MajorName,ci.ClassName "); + strSql.Append(" from ( "); + strSql.Append($"select s.AcademicYearNo,s.Semester,s.LessonSortNo,s.LessonNo,s.LessonName,s.StuNo,sb.StuName,s.MajorNo,s.ClassNo,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,s.MajorNo,s.ClassNo ) as bb "); + strSql.Append(" left join StuScoreOnlineNotPass 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 StuScoreOnlineNotPassTwo 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 and li.CheckMark='1' "); + strSql.Append(" left join CdMajor cm on bb.MajorNo= cm.MajorNo and cm.CheckMark='1' "); + strSql.Append(" left join ClassInfo ci on bb.ClassNo= ci.ClassNo and ci.CheckMark='1' "); + + var result = this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp); + + //计算专业排名,班级排名 + if (result.Any()) + { + var temp = result.GroupBy(x => new { x.AcademicYearNo, x.Semester }).Select(x => new StuScoreOnlineEntity() + { + AcademicYearNo = x.Key.AcademicYearNo, + Semester = x.Key.Semester, + StuNo = x.FirstOrDefault().StuNo, + ClassNo = x.FirstOrDefault().ClassNo, + MajorNo = x.FirstOrDefault().MajorNo + }).ToList(); + if (temp.Any()) + { + foreach (var item in temp) + { + //专业排名 + var ml = this.BaseRepository("CollegeMIS").FindList(x => x.AcademicYearNo == item.AcademicYearNo && x.Semester == item.Semester && x.LessonSortNo == "1" && x.MajorNo == item.MajorNo && x.CheckMark == "1"); + var mlGroup = ml.GroupBy(x => x.StuNo).Select(x => new + { + StuNo = x.Key, + TotalScore = x.Select(y => y.Score).Sum() + }).OrderByDescending(x => x.TotalScore); + if (mlGroup.Any()) + { + var rank = mlGroup.Select(x => x.StuNo).ToList().IndexOf(item.StuNo); + item.RankInMajor = rank + 1; + } + //班级排名 + var cl = this.BaseRepository("CollegeMIS").FindList(x => x.AcademicYearNo == item.AcademicYearNo && x.Semester == item.Semester && x.LessonSortNo == "1" && x.ClassNo == item.ClassNo && x.CheckMark == "1"); + var clGroup = cl.GroupBy(x => x.StuNo).Select(x => new + { + StuNo = x.Key, + TotalScore = x.Select(y => y.Score).Sum() + }).OrderByDescending(x => x.TotalScore); + if (clGroup.Any()) + { + var rank = clGroup.Select(x => x.StuNo).ToList().IndexOf(item.StuNo); + item.RankInClass = rank + 1; + } + } + } + foreach (var ii in result) + { + ii.RankInMajor = temp.FirstOrDefault(x => x.AcademicYearNo == ii.AcademicYearNo && x.Semester == ii.Semester).RankInMajor; + ii.RankInClass = temp.FirstOrDefault(x => x.AcademicYearNo == ii.AcademicYearNo && x.Semester == ii.Semester).RankInClass; + } + + } + + return result; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 成绩导入--必修课 选修课 + /// + /// 1:必修,2:选修 + /// + /// + /// + /// + public (DataTable failDt, int snum, int fnum) ExecuteImportExcel(int type, DataTable dt, string fileGuid, + string queryJson) + { + if (type == 1) + { + //必修 + return ExecuteImportExcelForRequired(dt, fileGuid, queryJson); + } + else + { + //选修 + return ExecuteImportExcelForElective(dt, fileGuid, queryJson); + } + + } + + /// + /// 导入学生成绩--必修课 + /// + /// + /// + private (DataTable failDt, int snum, int fnum) ExecuteImportExcelForRequired(DataTable dt, string fileGuid, string queryJson) + { + //成功记录数 + int snum = 0; + //总记录数 + int num = 0; + var db = this.BaseRepository("CollegeMIS"); + var msg = ""; + try + { + db.BeginTrans(); + // 创建一个datatable容器用于保存导入失败的数据 + DataTable failDt = new DataTable(); + + var queryParam = queryJson.ToJObject(); + var F_SchoolId = queryParam["F_SchoolId"].ToString(); + var AcademicYearNo = queryParam["AcademicYearNo"].ToString(); + var Semester = queryParam["Semester"].ToString(); + var LessonNo = queryParam["LessonNo"].ToString(); + var ClassNo = queryParam["ClassNo"].ToString(); + var classInfoList = db.FindList(); + var lessonInfoList = db.FindList(); + var classInfoEntity = classInfoList.FirstOrDefault(x => x.ClassNo == ClassNo); + var lessonInfoEntity = lessonInfoList.FirstOrDefault(x => x.LessonNo == LessonNo && x.CheckMark == true); + + if (classInfoEntity != null) + { + //获取成绩比例数据 + var stuSelectLessonListEntity = db.FindEntity(x => x.F_SchoolId == F_SchoolId && x.AcademicYearNo == AcademicYearNo && x.Semester == Semester && x.OpenLessonDeptNo == classInfoEntity.DeptNo && x.OpenLessonMajorNo == classInfoEntity.MajorNo && x.LessonNo == LessonNo && x.LessonSortNo == "1" && x.ClassNo == ClassNo); + if (stuSelectLessonListEntity != null) + { + //当前班级学生成绩 + var list = GetList(queryJson).ToList(); + + foreach (DataColumn dc in dt.Columns) + { + failDt.Columns.Add(dc.ColumnName, dc.DataType); + } + failDt.Columns.Add("导入错误", typeof(string)); + dt.Columns.Add("导入错误", typeof(string)); + + foreach (DataRow dr in dt.Rows) + { + try + { + var stuno = dr["学号"].ToString().Trim(); + var academicYearNo_dr = dr["学年"].ToString().Trim(); + var semester_dr = dr["学期"].ToString().Trim(); + var lessoninfo_dr = dr["课程名称"].ToString().Trim(); + var classinfo_dr = dr["班级"].ToString().Trim(); + //var lessonNo_dr = lessonInfoList.FirstOrDefault(x => x.LessonName == lessoninfo_dr)?.LessonNo; + //var classNo_dr = classInfoList.FirstOrDefault(x => x.ClassName == classinfo_dr)?.ClassNo; + + if (!string.IsNullOrEmpty(stuno)) + { + num++; + if (!academicYearNo_dr.Equals(AcademicYearNo) || !semester_dr.Equals(Semester)) + { + dr["导入错误"] = "学年学期与查询条件不匹配!"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + + if (!classinfo_dr.Equals(classInfoEntity.ClassName)) + { + dr["导入错误"] = "班级与查询条件班级(" + classInfoEntity.ClassName + ")不匹配!"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + if (!lessoninfo_dr.Equals(lessonInfoEntity.LessonName)) + { + dr["导入错误"] = "课程与查询条件课程(" + lessonInfoEntity.LessonName + ")不匹配!"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + + if (!lessoninfo_dr.Equals(lessonInfoEntity.LessonName) || !classinfo_dr.Equals(classInfoEntity.ClassName)) + { + dr["导入错误"] = "课程:" + lessonInfoEntity.LessonName + ",班级:" + classInfoEntity.ClassName + "找不到学号为" + stuno + "的学生"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + var item = list.Find(x => x.StuNo == stuno && x.LessonNo == LessonNo && x.ClassNo == ClassNo); + var OrdinaryScore = Convert.ToDecimal(string.IsNullOrEmpty(dr["平时成绩"].ToString().Trim()) ? "0" : dr["平时成绩"].ToString().Trim()); + var TermInScore = Convert.ToDecimal(string.IsNullOrEmpty(dr["期中成绩"].ToString().Trim()) ? "0" : dr["期中成绩"].ToString().Trim()); + var TermEndScore = Convert.ToDecimal(string.IsNullOrEmpty(dr["期末成绩"].ToString().Trim()) ? "0" : dr["期末成绩"].ToString().Trim()); + var OtherScore = Convert.ToDecimal(string.IsNullOrEmpty(dr["其他成绩"].ToString().Trim()) ? "0" : dr["其他成绩"].ToString().Trim()); + if (OrdinaryScore < 0 || TermInScore < 0 || TermEndScore < 0 || OtherScore < 0) + { + dr["导入错误"] = "成绩必须大于0!"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + var Score = Math.Round(Convert.ToDouble(OrdinaryScore * (stuSelectLessonListEntity.OrdinaryScoreScale / 100) + + TermInScore * (stuSelectLessonListEntity.TermInScoreScale / 100) + + TermEndScore * (stuSelectLessonListEntity.TermEndScoreScale / 100) + + OtherScore * (stuSelectLessonListEntity.OtherScoreScale / 100)), MidpointRounding.AwayFromZero); + var remark = dr["备注"].ToString().Trim(); + db.ExecuteBySql($"update StuScoreOnline set OrdinaryScore={OrdinaryScore},TermInScore={TermInScore},TermEndScore={TermEndScore},OtherScore={OtherScore},Score={Score},Remark='{remark}' where ScoreId='{item.ScoreId}' "); + + } + else + { + break; + } + } + catch (Exception e) + { + dr["导入错误"] = "出现异常:" + e.Message; + failDt.Rows.Add(dr.ItemArray); + continue; + } + } + db.Commit(); + + // 写入缓存如果有未导入的数据 + if (failDt.Rows.Count > 0) + { + string errordt = failDt.ToJson(); + + cache.Write(cacheKey + fileGuid, errordt, CacheId.excel); + } + snum = (num - failDt.Rows.Count) > 0 ? num - failDt.Rows.Count : 0; + } + } + + return (failDt, snum, failDt.Rows.Count); + } + catch (Exception ex) + { + db.Rollback(); + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 导入学生成绩--选修课 + /// + /// + /// + private (DataTable failDt, int snum, int fnum) ExecuteImportExcelForElective(DataTable dt, string fileGuid, string queryJson) + { + + //成功记录数 + int snum = 0; + //总记录数 + int num = 0; + var db = this.BaseRepository("CollegeMIS"); + var msg = ""; + try + { + db.BeginTrans(); + + //创建一个datatable容器用于保存导入失败的数据 + DataTable failDt = new DataTable(); + + var queryParam = queryJson.ToJObject(); + var F_SchoolId = queryParam["F_SchoolId"].ToString(); + var AcademicYearNo = queryParam["AcademicYearNo"].ToString(); + var Semester = queryParam["Semester"].ToString(); + var LessonNo = queryParam["LessonNo"].ToString(); + var LessonSection = queryParam["LessonSection"].ToString(); + var ClassRoomNo = queryParam["ClassRoomNo"].ToString(); + + var classRoomList = db.FindList(); + var lessonInfoList = db.FindList(); + var lessonInfoEntity = lessonInfoList.FirstOrDefault(x => x.LessonNo == LessonNo && x.CheckMark == true); + var classRoomEntity = classRoomList.FirstOrDefault(x => x.ClassroomNo == ClassRoomNo); + + //成绩比例数据 + var stuSelectLessonListOfElectiveEntity = this.BaseRepository("CollegeMIS").FindEntity(x => x.F_SchoolId == F_SchoolId && x.AcademicYearNo == AcademicYearNo && x.Semester == Semester && x.LessonNo == LessonNo && x.LessonSortNo == "2" && x.ClassRoomNo == ClassRoomNo && x.LessonSection == LessonSection); + + if (stuSelectLessonListOfElectiveEntity != null) + { + //查询学生成绩数据 + var list = GetList(queryJson).ToList(); + + foreach (DataColumn dc in dt.Columns) + { + failDt.Columns.Add(dc.ColumnName, dc.DataType); + } + failDt.Columns.Add("导入错误", typeof(string)); + dt.Columns.Add("导入错误", typeof(string)); + + foreach (DataRow dr in dt.Rows) + { + try + { + var stuno = dr["学号"].ToString().Trim(); + var academicYearNo_dr = dr["学年"].ToString().Trim(); + var semester_dr = dr["学期"].ToString().Trim(); + var lessoninfo_dr = dr["课程名称"].ToString().Trim(); + var classRoominfo_dr = dr["教室名称"].ToString().Trim(); + var lessonSection_dr = dr["节次"].ToString().Trim(); + //var lessonNo_dr = lessonInfoList.FirstOrDefault(x => x.LessonName == lessoninfo_dr)?.LessonNo; + //var classRoomNo_dr = classRoomList.FirstOrDefault(x => x.ClassroomName == classRoominfo_dr)?.ClassroomNo; + if (!string.IsNullOrEmpty(stuno)) + { + num++; + var item = list.Find(x => x.StuNo == stuno && x.LessonNo == LessonNo && x.ClassRoomNo == ClassRoomNo && x.LessonSection == LessonSection); + if (!academicYearNo_dr.Equals(AcademicYearNo) || !semester_dr.Equals(semester_dr)) + { + dr["导入错误"] = "学年学期与查询条件不匹配!"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + + if (!lessoninfo_dr.Equals(lessonInfoEntity.LessonName)) + { + dr["导入错误"] = "课程与查询条件课程(" + lessonInfoEntity.LessonName + ")不匹配!"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + if (!classRoominfo_dr.Equals(classRoomEntity.ClassroomName)) + { + dr["导入错误"] = "教室与查询条件教室(" + classRoomEntity.ClassroomName + ")不匹配!"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + if (!lessonSection_dr.Equals(LessonSection)) + { + dr["导入错误"] = "节次与查询条件节次(" + LessonSection + ")不匹配!"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + if (item == null) + { + dr["导入错误"] = "课程:" + lessonInfoEntity.LessonName + "在" + LessonSection + "节次找不到学号为" + stuno + "的学生"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + var OrdinaryScore = Convert.ToDecimal(string.IsNullOrEmpty(dr["平时成绩"].ToString().Trim()) ? "0" : dr["平时成绩"].ToString().Trim()); + var TermInScore = Convert.ToDecimal(string.IsNullOrEmpty(dr["期中成绩"].ToString().Trim()) ? "0" : dr["期中成绩"].ToString().Trim()); + var TermEndScore = Convert.ToDecimal(string.IsNullOrEmpty(dr["期末成绩"].ToString().Trim()) ? "0" : dr["期末成绩"].ToString().Trim()); + var OtherScore = Convert.ToDecimal(string.IsNullOrEmpty(dr["其他成绩"].ToString().Trim()) ? "0" : dr["其他成绩"].ToString().Trim()); + if (OrdinaryScore < 0 || TermInScore < 0 || TermEndScore < 0 || OtherScore < 0) + { + dr["导入错误"] = "成绩必须大于0!"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + + var Score = Math.Round(Convert.ToDouble(OrdinaryScore * (stuSelectLessonListOfElectiveEntity.OrdinaryScoreScale / 100) + + TermInScore * (stuSelectLessonListOfElectiveEntity.TermInScoreScale / 100) + + TermEndScore * (stuSelectLessonListOfElectiveEntity.TermEndScoreScale / 100) + + OtherScore * (stuSelectLessonListOfElectiveEntity.OtherScoreScale / 100)), MidpointRounding.AwayFromZero); + var remark = dr["备注"].ToString().Trim(); + db.ExecuteBySql($"update StuScoreOnline set OrdinaryScore={OrdinaryScore},TermInScore={TermInScore},TermEndScore={TermEndScore},OtherScore={OtherScore},Score={Score},Remark='{remark}' where ScoreId='{item.ScoreId}' "); + } + else + { + break; + } + } + catch (Exception e) + { + dr["导入错误"] = "出现异常:" + e.Message; + failDt.Rows.Add(dr.ItemArray); + continue; + } + } + db.Commit(); + + // 写入缓存如果有未导入的数据 + if (failDt.Rows.Count > 0) + { + string errordt = failDt.ToJson(); + + cache.Write(cacheKey + fileGuid, errordt, CacheId.excel); + } + + snum = (num - failDt.Rows.Count) > 0 ? num - failDt.Rows.Count : 0; + } + return (failDt, snum, failDt.Rows.Count); + } + catch (Exception ex) + { + db.Rollback(); + 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/Learun.Application.TwoDevelopment.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj index 788d7dc46..4df6bb3c1 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj @@ -96,6 +96,10 @@ + + + + diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json index ff1ff458b..d82e8cb8e 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json @@ -745,6 +745,19 @@ "navigationBarTitleText": "查看详情" } }, + //线上课程选课 + { + "path": "pages/EducationalAdministration/LessonInfoOfElectiveOnline/list", + "style": { + "navigationBarTitleText": "线上课程选课" + } + }, + { + "path": "pages/EducationalAdministration/LessonInfoOfElectiveOnline/from", + "style": { + "navigationBarTitleText": "查看详情" + } + }, //学费查询 { "path": "pages/StuPayFee/list", diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/LessonInfoOfElectiveOnline/from.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/LessonInfoOfElectiveOnline/from.vue new file mode 100644 index 000000000..7f3b862a1 --- /dev/null +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/LessonInfoOfElectiveOnline/from.vue @@ -0,0 +1,137 @@ + + + + + \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/LessonInfoOfElectiveOnline/list.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/LessonInfoOfElectiveOnline/list.vue new file mode 100644 index 000000000..8dd9b5e32 --- /dev/null +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/LessonInfoOfElectiveOnline/list.vue @@ -0,0 +1,304 @@ + + + + + \ No newline at end of file