diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuScoreOfPreviousController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuScoreOfPreviousController.cs new file mode 100644 index 000000000..9b56d8bf3 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuScoreOfPreviousController.cs @@ -0,0 +1,100 @@ +using DocumentFormat.OpenXml.Math; +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.IO; +using System.Linq; +using System.Web.Mvc; + +namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers +{ + /// + /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 + /// Copyright (c) 2013-2018 北京泉江科技有限公司 + /// 创 建:超级管理员 + /// 日 期:2024-10-16 11:02 + /// 描 述:往年成绩管理 + /// + public class StuScoreOfPreviousController : MvcControllerBase + { + private StuScoreOfPreviousIBLL stuScoreOfPreviousIBLL = new StuScoreOfPreviousBLL(); + + #region 视图功能 + + /// + /// 主页面 + /// + /// + [HttpGet] + public ActionResult Index() + { + return View(); + } + /// + /// 导入 + /// + /// + [HttpGet] + public ActionResult ImportForm() + { + return View(); + } + #endregion + + #region 获取数据 + + /// + /// 获取列表分页数据 + /// 分页参数 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetPageList(string pagination, string queryJson) + { + Pagination paginationobj = pagination.ToObject(); + var data = stuScoreOfPreviousIBLL.GetPageList(paginationobj, queryJson); + var jsonData = new + { + rows = data, + total = paginationobj.total, + page = paginationobj.page, + records = paginationobj.records + }; + return Success(jsonData); + } + #endregion + #region 拓展数据 + + /// + /// 导入下载模板 + /// + /// + public ActionResult DownTemplate() + { + FileStreamResult result = null; + try + { + var path = Server.MapPath("~/Content/excel/"); + var pathoffull = path + "StuScoreOfPreviousImport.xls"; + FileStream fsread = fsread = new FileStream(pathoffull, FileMode.OpenOrCreate, FileAccess.ReadWrite); + result = File(fsread, "application/ms-excel", "往年成绩导入模版.xls"); + + return result; + } + catch (Exception ex) + { + return null; + } + } + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOfPrevious/ImportForm.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOfPrevious/ImportForm.cshtml new file mode 100644 index 000000000..dc5ec1eff --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOfPrevious/ImportForm.cshtml @@ -0,0 +1,24 @@ +@{ + ViewBag.Title = "Form"; + Layout = "~/Views/Shared/_Form.cshtml"; +} + + +@Html.AppendCssFile("/Areas/EducationalAdministration/Views/StuScoreOfPrevious/ImportForm.css") +
+
+
上传文件
+
下载模板
+
+
+
+
+ +
+
+

试试将电脑里的文件拖拽到此上传

+
+
+
+
+@Html.AppendJsFile("/Areas/EducationalAdministration/Views/StuScoreOfPrevious/ImportForm.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOfPrevious/ImportForm.css b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOfPrevious/ImportForm.css new file mode 100644 index 000000000..04b556b7a --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOfPrevious/ImportForm.css @@ -0,0 +1,136 @@ +.lr-form-layout-body { + padding:0 5px 5px 5px; +} +.lr-form-file-queue-wrap { + position:relative; + width:100%; + height:100%; + border:1px solid #ddd; + border-radius:4px; +} +.lr-form-file-queue { + position:relative; +} +.lr-form-file-queue { + position:relative; +} +.lr-form-file-queue-item { + position:relative; + width:100%; + height:50px; + border-bottom:1px solid #ddd; + padding-left:60px; + +} +.lr-file-image { + position:absolute; + top:5px; + left:5px; +} +.lr-file-image img { + width:40px; + height:40px; +} +.lr-file-name{ + line-height:50px; + +} +.lr-msg { + position:absolute; + top:0; + right:5px; + font-size: 25px; + line-height:50px; +} +.lr-msg .fa-check-circle{ + color: #5cb85c; +} +.lr-msg .fa-exclamation-circle { + color: #b94a48; +} +.lr-msg2 { + position:absolute; + top:0; + right:5px; + line-height:50px; +} +.lr-msg2 span { + color:#333; + font-size:14px; + margin-right:5px; +} + +.lr-tool-bar { + position:absolute; + top:0; + right:35px; + font-size: 25px; + line-height:50px; + color:#666; + cursor:pointer; +} +.lr-tool-bar > i { + margin-left:8px; +} + +.lr-tool-bar .fa-minus-circle { + color: #b94a48; +} +.lr-tool-bar .fa-cloud-download { + color: #3498db; +} + +.lr-uploader-progress { + position:absolute; + bottom:2px; + left:60px; + height:4px; + width:500px; + width:calc(100% - 90px); +} +.lr-uploader-progress-bar { + position:relative; + height:100%; + background-color:#039cfd; + border-radius:4px; +} + + +.lr-form-file-queue-bg { + position:absolute; + top:50%; + left:50%; + width:300px; + height:30px; + line-height:30px; + + margin:-15px 0 0 -150px; +} +.lr-form-file-queue-bg h1 { + color: #666; + font-size: 20px; + font-family: Microsoft Yahei; + padding-bottom: 2px; + margin: 0; +} +#lr_down_file_btn { + position:absolute; + right:5px; + background:#fff; + border:1px solid #ddd; + color:#333; +} +#lr_down_file_btn:hover { + color:#337ab7; +} +/*对百度插件的样式重写*/ +.webuploader-container { + position:absolute; +} +.webuploader-pick { + padding:8px 15px; + background-color:#039cfd; +} +.webuploader-pick-hover { + background-color:#027dcb; +} \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOfPrevious/ImportForm.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOfPrevious/ImportForm.js new file mode 100644 index 000000000..907b10e4c --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOfPrevious/ImportForm.js @@ -0,0 +1,158 @@ +/* + * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) + * Copyright (c) 2013-2018 北京泉江科技有限公司 + * 创建人:陈彬彬 + * 日 期:2024-10-16 11:02 + * 描 述:导入往年成绩管理 + */ +var id = request('id'); + +var keyVaule = ''; + +var bootstrap = function ($, learun) { + "use strict"; + + var fileInfo = {}; + + // 触发合并文件碎片 + var mergeFileChunks = function (file) { + + + var param = {}; + param['__RequestVerificationToken'] = $.lrToken; + param['fileId'] = fileInfo[file.id].fileGuid; + param['chunks'] = fileInfo[file.id].chunks; + param['ext'] = file.ext; + param['templateId'] = id; + learun.httpAsyncPost(top.$.rootUrl + "/LR_SystemModule/ExcelImport/StuScoreOfPreviousImport", param, function (res) { + var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id); + $fileItem.find('.lr-uploader-progress').remove(); + if (res.code == learun.httpCode.success) { + if (res.data.Success != '0') { + learun.alert.success('导入成功' + res.data.Success + '条'); + } + // 文件保存成功后 + $fileItem.append('
' + res.data.Success + '/' + res.data.Fail + '
'); + // 如果有失败 + if (res.data.Fail != '0') + { + learun.download({ url: top.$.rootUrl + '/LR_SystemModule/ExcelImport/DownImportErrorFile', param: { fileId: fileInfo[file.id].fileGuid, fileName: fileInfo[file.id].name, __RequestVerificationToken: $.lrToken }, method: 'POST' }); + } + } + else { + $fileItem.append('
'); + } + }); + } + // 触发清楚文件碎片 + var reomveFileChunks = function (file) { + var param = {}; + param['__RequestVerificationToken'] = $.lrToken; + param['fileGuid'] = fileInfo[file.id].fileGuid; + param['chunks'] = fileInfo[file.id].chunks; + learun.httpAsyncPost(top.$.rootUrl + "/LR_SystemModule/Annexes/MergeAnnexesFile", param, function (res) { }); + var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id); + $fileItem.find('.lr-uploader-progress').remove(); + $fileItem.append('
'); + } + + var page = { + uploader: null, + init: function () { + /*模板下载*/ + $('#lr_down_file_btn').on('click', function () { + learun.download({ url: top.$.rootUrl + '/EducationalAdministration/StuScoreOfPrevious/DownTemplate', param: { keyValue: id, __RequestVerificationToken: $.lrToken }, method: 'POST' }); + }); + if (!WebUploader.Uploader.support()) { + alert('Web Uploader 不支持您的浏览器!如果你使用的是IE浏览器,请尝试升级 flash 播放器'); + throw new Error('WebUploader does not support the browser you are using.'); + } + + page.uploader = WebUploader.create({ + auto: true, + swf: top.$.rootUrl + '/Content/webuploader/Uploader.swf', + // 文件接收服务端。 + server: top.$.rootUrl + "/LR_SystemModule/Annexes/UploadAnnexesFileChunk", + // 选择文件的按钮。可选。 + // 内部根据当前运行是创建,可能是input元素,也可能是flash. + pick: '#lr_add_file_btn', + dnd: '#lr_form_file_queue', + paste: 'document.body', + disableGlobalDnd: true, + accept: { + extensions: "xls,xlsx" + }, + multiple: true, + // 不压缩image, 默认如果是jpeg,文件上传前会压缩一把再上传! + resize: false, + // 文件分片上传 + chunked: true, + chunkRetry: 3, + prepareNextFile: true, + chunkSize: '1048576', + // 上传参数 + formData: { + __RequestVerificationToken: $.lrToken + } + }); + page.uploader.on('fileQueued', page.fileQueued); + page.uploader.on('uploadStart', page.uploadStart); + page.uploader.on('uploadBeforeSend', page.uploadBeforeSend); + page.uploader.on('uploadProgress', page.uploadProgress); + page.uploader.on('uploadSuccess', page.uploadSuccess); + page.uploader.on('uploadError', page.uploadError); + page.uploader.on('uploadComplete', page.uploadComplete); + page.uploader.on('error', page.error); + + $('#lr_form_file_queue').lrscroll(); + + }, + fileQueued: function (file) {// 文件加载到队列 + fileInfo[file.id] = { name: file.name }; + $('#lr_form_file_queue .lr-form-file-queue-bg').hide(); + // 添加一条文件记录 + var $item = $('
'); + $item.append('
'); + $item.append('' + file.name + '(' + learun.countFileSize(file.size) + ')'); + + $('#lr_form_file_queue_list').append($item); + }, + uploadStart: function (file) { + var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id); + $fileItem.append('
'); + }, + uploadBeforeSend: function (object, data, headers) { + data.chunk = data.chunk || 0; + data.chunks = data.chunks || 1; + fileInfo[data.id].fileGuid = fileInfo[data.id].fileGuid || WebUploader.Base.guid(); + data.fileGuid = fileInfo[data.id].fileGuid; + fileInfo[data.id].chunks = data.chunks; + }, + uploadProgress: function (file, percentage) { + var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id); + $fileItem.find('.lr-uploader-progress-bar').css('width', (percentage * 100 + '%')); + }, + uploadSuccess: function (file, res) { + if (res.code == 200) {// 上传成功 + mergeFileChunks(file); + } + else {// 上传失败 + reomveFileChunks(file); + } + }, + uploadError: function (file, code) { + reomveFileChunks(file); + }, + uploadComplete: function (file) { + }, + error: function (type) { + switch (type) { + case 'Q_TYPE_DENIED': + learun.alert.error('当前文件类型不允许上传'); + break; + }; + } + }; + page.init(); + +} \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOfPrevious/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOfPrevious/Index.cshtml new file mode 100644 index 000000000..925f5020d --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOfPrevious/Index.cshtml @@ -0,0 +1,34 @@ +@{ + ViewBag.Title = "往年成绩管理"; + Layout = "~/Views/Shared/_Index.cshtml"; +} +
+
+
+
+
+
+
+
+
+
学号/姓名
+ +
+
+
+
+
+
+
+ +
+
+  导入 +
+
+
+
+
+
+
+@Html.AppendJsFile("/Areas/EducationalAdministration/Views/StuScoreOfPrevious/Index.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOfPrevious/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOfPrevious/Index.js new file mode 100644 index 000000000..cfa1f208d --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOfPrevious/Index.js @@ -0,0 +1,103 @@ +/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) + * Copyright (c) 2013-2018 北京泉江科技有限公司 + * 创建人:超级管理员 + * 日 期:2024-10-16 11:02 + * 描 述:往年成绩管理 + */ +var refreshGirdData; +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + page.initGird(); + page.bind(); + }, + bind: function () { + $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { + page.search(queryJson); + }, 220, 400); + // 刷新 + $('#lr_refresh').on('click', function () { + location.reload(); + }); + //导入弹窗 + $('#importBtn').on('click', function () { + learun.layerForm({ + id: 'form_import', + title: '导入数据', + url: top.$.rootUrl + '/EducationalAdministration/StuScoreOfPrevious/ImportForm', + width: 600, + height: 400, + btn: null + }); + }); + }, + // 初始化列表 + initGird: function () { + $('#gridtable').jfGrid({ + url: top.$.rootUrl + '/EducationalAdministration/StuScoreOfPrevious/GetPageList', + headData: [ + { 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: "DeptNo", width: 100, align: "left" + }, + { + label: "专业", name: "MajorNo", width: 100, align: "left" + }, + { + label: "班级", name: "ClassNo", width: 100, align: "left" + }, + { label: "年级", name: "Grade", width: 100, align: "left" }, + { label: '学年', name: 'AcademicYearNo', width: 100, align: "left" }, + { label: '学期', name: 'Semester', width: 80, align: "left" }, + { + label: '课程类型', name: 'LessonSortNo', width: 100, align: "left", formatter: function (cellvalue) { + return cellvalue == "1" ? "必修课" : "选修课"; + } + }, + { label: '课程编号', name: 'LessonNo', width: 200, align: "left" }, + { label: '课程名称', name: 'LessonName', width: 200, align: "left" }, + { label: '学分', name: 'StudyScore', width: 100, align: "left" }, + { + label: '平时成绩', name: 'OrdinaryScore', width: 100, align: "left" + }, + { label: '期中成绩', name: 'TermInScore', width: 100, align: "left" }, + { + label: '期末成绩', name: 'TermEndScore', width: 100, align: "left" + }, + { label: '总成绩', name: 'Score', width: 100, align: "left" }, + { label: '教师编号', name: 'EmpNo', width: 100, align: "left" }, + { label: '上课节次', name: 'LessonSection', width: 100, align: "left" }, + { label: '教室编号', name: 'ClassRoomNo', width: 100, align: "left" }, + { label: '教室名称', name: 'ClassRoomName', width: 100, align: "left" }, + { label: '编辑日期', name: 'ModifyDate', width: 150, align: "left" }, + { label: '编辑用户', name: 'ModifyUserName', width: 100, align: "left" }, + { + label: "审核状态", name: "CheckMark", width: 80, align: "center", + formatter: function (cellvalue) { + return cellvalue == "1" ? "已审核" : "未审核"; + } + }, + ], + mainId: 'ScoreId', + isPage: true + }); + page.search(); + }, + search: function (param) { + param = param || {}; + $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); + } + }; + refreshGirdData = function () { + page.search(); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/ExcelImportController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/ExcelImportController.cs index be98a21af..249e30646 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/ExcelImportController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/ExcelImportController.cs @@ -22,6 +22,7 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers private ExcelImportIBLL excelImportIBLL = new ExcelImportBLL(); private AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL(); private ArrangeLessonTermIBLL arrangeLessonTermIBLL = new ArrangeLessonTermBLL(); + private StuScoreOfPreviousIBLL stuScoreOfPreviousIBLL = new StuScoreOfPreviousBLL(); #region 视图功能 /// /// 导入模板管理页面 @@ -289,7 +290,7 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers } } /// - /// + /// 课表导入 /// /// /// @@ -317,6 +318,36 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers return Fail("导入数据失败!"); } } + /// + /// 往年成绩管理导入 + /// + /// + /// + /// + /// + [HttpPost] + [ValidateAntiForgeryToken] + public ActionResult StuScoreOfPreviousImport(string fileId, int chunks, string ext) + { + UserInfo userInfo = LoginUserInfo.Get(); + string path = annexesFileIBLL.SaveAnnexes(fileId, fileId + "." + ext, chunks, userInfo); + if (!string.IsNullOrEmpty(path)) + { + DataTable dt = ExcelHelper.ExcelImport(path); + var res = stuScoreOfPreviousIBLL.StuScoreOfPreviousImport(dt, fileId); + var data = new + { + Success = res.Split('|')[0], + Fail = res.Split('|')[1] + }; + return JsonResult(data); + } + else + { + return Fail("导入数据失败!"); + } + } + /// /// 下载文件(导入文件未被导入的数据) /// diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/StuScoreOfPreviousImport.xls b/Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/StuScoreOfPreviousImport.xls new file mode 100644 index 000000000..d545f4542 Binary files /dev/null and b/Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/StuScoreOfPreviousImport.xls differ 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 8cf6c1fa9..663faaa5a 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 @@ -23,7 +23,8 @@ ..\..\..\ true - false + + @@ -375,6 +376,7 @@ + @@ -1012,6 +1014,9 @@ + + + @@ -8003,6 +8008,8 @@ + + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/EducationalAdministration/StuScoreOfPreviousMap.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/EducationalAdministration/StuScoreOfPreviousMap.cs new file mode 100644 index 000000000..059a405f7 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/EducationalAdministration/StuScoreOfPreviousMap.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 北京泉江科技有限公司 + /// 创 建:超级管理员 + /// 日 期:2024-10-16 11:02 + /// 描 述:往年成绩管理 + /// + public class StuScoreOfPreviousMap : EntityTypeConfiguration + { + public StuScoreOfPreviousMap() + { + #region 表、主键 + //表 + this.ToTable("STUSCOREOFPREVIOUS"); + //主键 + 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 2711f50ec..d68d10840 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 @@ -111,6 +111,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOfPrevious/StuScoreOfPreviousBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOfPrevious/StuScoreOfPreviousBLL.cs new file mode 100644 index 000000000..1400bca57 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOfPrevious/StuScoreOfPreviousBLL.cs @@ -0,0 +1,74 @@ +using Learun.Util; +using System; +using System.Data; +using System.Collections.Generic; +using static Learun.Application.TwoDevelopment.EducationalAdministration.StuScoreOfPreviousService; + +namespace Learun.Application.TwoDevelopment.EducationalAdministration +{ + /// + /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 + /// Copyright (c) 2013-2018 北京泉江科技有限公司 + /// 创 建:超级管理员 + /// 日 期:2024-10-16 11:02 + /// 描 述:往年成绩管理 + /// + public class StuScoreOfPreviousBLL : StuScoreOfPreviousIBLL + { + private StuScoreOfPreviousService stuScoreOfPreviousService = new StuScoreOfPreviousService(); + + #region 获取数据 + + /// + /// 获取列表分页数据 + /// 分页参数 + /// + /// + public IEnumerable GetPageList(Pagination pagination, string queryJson) + { + try + { + return stuScoreOfPreviousService.GetPageList(pagination, queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + #endregion + #region 拓展数据 + + /// + /// 导入 + /// + /// + /// + /// + public string StuScoreOfPreviousImport(DataTable dt, string fileId) + { + try + { + return stuScoreOfPreviousService.StuScoreOfPreviousImport(dt, fileId); + } + 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/StuScoreOfPrevious/StuScoreOfPreviousEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOfPrevious/StuScoreOfPreviousEntity.cs new file mode 100644 index 000000000..5e5f54f37 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOfPrevious/StuScoreOfPreviousEntity.cs @@ -0,0 +1,344 @@ +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 北京泉江科技有限公司 + /// 创 建:超级管理员 + /// 日 期:2024-10-16 11:02 + /// 描 述:往年成绩管理 + /// + public class StuScoreOfPreviousEntity + { + #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 + + + } +} + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOfPrevious/StuScoreOfPreviousIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOfPrevious/StuScoreOfPreviousIBLL.cs new file mode 100644 index 000000000..14f6d1754 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOfPrevious/StuScoreOfPreviousIBLL.cs @@ -0,0 +1,38 @@ +using Learun.Util; +using System.Data; +using System.Collections.Generic; +using static Learun.Application.TwoDevelopment.EducationalAdministration.StuScoreOfPreviousService; + +namespace Learun.Application.TwoDevelopment.EducationalAdministration +{ + /// + /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 + /// Copyright (c) 2013-2018 北京泉江科技有限公司 + /// 创 建:超级管理员 + /// 日 期:2024-10-16 11:02 + /// 描 述:往年成绩管理 + /// + public interface StuScoreOfPreviousIBLL + { + #region 获取数据 + + /// + /// 获取列表分页数据 + /// 分页参数 + /// + /// + IEnumerable GetPageList(Pagination pagination, string queryJson); + #endregion + + #region 拓展数据 + + /// + /// 导入 + /// + /// + /// + /// + string StuScoreOfPreviousImport(DataTable dt, string fileId); + #endregion + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOfPrevious/StuScoreOfPreviousService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOfPrevious/StuScoreOfPreviousService.cs new file mode 100644 index 000000000..6fed1afd0 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOfPrevious/StuScoreOfPreviousService.cs @@ -0,0 +1,316 @@ +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; +using Learun.Application.Organization; +using Learun.Application.Base.SystemModule; + +namespace Learun.Application.TwoDevelopment.EducationalAdministration +{ + /// + /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 + /// Copyright (c) 2013-2018 北京泉江科技有限公司 + /// 创 建:超级管理员 + /// 日 期:2024-10-16 11:02 + /// 描 述:往年成绩管理 + /// + public class StuScoreOfPreviousService : RepositoryFactory + { + private ICache cache = CacheFactory.CaChe(); + private string cacheKey = "Learun_adms_excelError_"; + #region 构造函数和属性 + + private string fieldSql; + public StuScoreOfPreviousService() + { + fieldSql = @"t.*"; + } + #endregion + + #region 获取数据 + + /// + /// 获取列表分页数据 + /// 分页参数 + /// + /// + public IEnumerable GetPageList(Pagination pagination, string queryJson) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("SELECT "); + strSql.Append(fieldSql); + strSql.Append(" FROM StuScoreOfPrevious 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); + } + } + } + #endregion + #region 拓展数据 + + /// + /// 导入 + /// + /// + /// + /// + public string StuScoreOfPreviousImport(DataTable dt, string fileId) + { + var db = this.BaseRepository("CollegeMIS").BeginTrans(); + try + { + int snum = 0; + int fnum = 0; + //插入时间 + var Insertdate = DateTime.Now; + if (dt.Rows.Count > 0) + { + DataTable failDt = new DataTable(); + dt.Columns.Add("导入错误", typeof(string)); + foreach (DataColumn dc in dt.Columns) + { + failDt.Columns.Add(dc.ColumnName, dc.DataType); + } + + IEnumerable StuScoreOfPreviousHistory = db.FindList("select * from StuScoreOfPrevious"); + var StuScoreOfPreviousinsert = new List(); + + // 循环遍历导入 + foreach (DataRow dr in dt.Rows) + { + try + { + #region 必填项空验证 + if (dr["学号"].ToString().IsEmpty()) + { + throw (new Exception("学号不能为空")); + } + if (dr["学生姓名"].ToString().IsEmpty()) + { + throw (new Exception("学生姓名不能为空")); + } + if (dr["系部编号"].ToString().IsEmpty()) + { + throw (new Exception("系部编号不能为空")); + } + if (dr["专业编号"].ToString().IsEmpty()) + { + throw (new Exception("专业编号不能为空")); + } + if (dr["班级编号"].ToString().IsEmpty()) + { + throw (new Exception("班级编号不能为空")); + } + if (dr["性别"].ToString().IsEmpty()) + { + throw (new Exception("性别不能为空")); + } + if (dr["学年"].ToString().IsEmpty()) + { + throw (new Exception("学年不能为空")); + } + if (dr["学期"].ToString().IsEmpty()) + { + throw (new Exception("学期不能为空")); + } + if (dr["课程编号"].ToString().IsEmpty()) + { + throw (new Exception("课程编号不能为空")); + } + if (dr["课程名称"].ToString().IsEmpty()) + { + throw (new Exception("课程名称不能为空")); + } + if (dr["课程类型"].ToString().IsEmpty()) + { + throw (new Exception("课程类型不能为空")); + } + if (dr["年级"].ToString().IsEmpty()) + { + throw (new Exception("年级不能为空")); + } + if (dr["总成绩"].ToString().IsEmpty()) + { + throw (new Exception("总成绩不能为空")); + } + if (dr["教师编号"].ToString().IsEmpty()) + { + throw (new Exception("教师编号不能为空")); + } + if (dr["校区"].ToString().IsEmpty()) + { + throw (new Exception("校区不能为空")); + } + #endregion + + #region 选择性必填判断 + if (dr["课程类型"].ToString() == "1") + { + if (dr["开课系部编号"].ToString().IsEmpty()) + { + throw (new Exception("必修课的开课系部编号不能为空")); + } + if (dr["开课专业编号"].ToString().IsEmpty()) + { + throw (new Exception("必修课的开课专业编号不能为空")); + } + if (dr["教学班级编号"].ToString().IsEmpty()) + { + throw (new Exception("必修课的教学班级编号不能为空")); + } + } + else if (dr["课程类型"].ToString() == "2") + { + if (dr["上课节次"].ToString().IsEmpty()) + { + throw (new Exception("选修课的上课节次不能为空")); + } + if (dr["教室编号"].ToString().IsEmpty()) + { + throw (new Exception("选修课的教室编号不能为空")); + } + if (dr["教室名称"].ToString().IsEmpty()) + { + throw (new Exception("选修课的教室名称不能为空")); + } + } + + #endregion + + //基础数据 + var empinfoEntity = db.FindList($"select * from EmpInfo where EmpNo='" + dr["教师编号"].ToString().Trim() + "' and CheckMark=1 "); + var CompanyEntity = BaseRepository().FindList(x => x.F_EnabledMark == 1).ToList().FirstOrDefault(); + if (empinfoEntity.Count() <= 0) + throw (new Exception("查无此教师")); + var dataItemDetailEntity = BaseRepository().FindEntity($@"select dd.F_ItemName,dd.F_ItemValue from LR_Base_DataItem d left join LR_Base_DataItemDetail dd on d.F_ItemId=dd.F_ItemId +where d.F_ItemCode = 'usersex' and dd.F_EnabledMark = 1 and dd.F_DeleteMark = 0 and dd.F_ItemName = '{dr["性别"].ToString()}' ", null); + if (dataItemDetailEntity == null) + { + throw (new Exception("数据字典找不到对应值")); + } + + //写入要导入替换的数据 + StuScoreOfPreviousEntity stuScoreOfPreviousEntity = new StuScoreOfPreviousEntity + { + StuNo = dr["学号"].ToString(), + StuName = dr["学生姓名"].ToString(), + DeptNo = dr["系部编号"].ToString(), + MajorNo = dr["专业编号"].ToString(), + ClassNo = dr["班级编号"].ToString(), + GenderNo = dataItemDetailEntity.F_ItemValue, + AcademicYearNo = dr["学年"].ToString(), + Semester = dr["学期"].ToString(), + OpenLessonDeptNo = dr["开课系部编号"].ToString(), + OpenLessonMajorNo = dr["开课专业编号"].ToString(), + LessonNo = dr["课程编号"].ToString(), + LessonName = dr["课程名称"].ToString(), + TeachClassNo = dr["教学班级编号"].ToString(), + LessonSortNo = dr["课程类型"].ToString(), + Grade = dr["年级"].ToString(), + StudyScore = dr["学分"].ToDecimal(), + zysx = "1", + TestModeNo = "1", + ScoreRecordStyleNo = "1", + OrdinaryScore = dr["平时成绩"].ToDecimal(), + TermInScore = dr["期中成绩"].ToDecimal(), + TermEndScore = dr["期末成绩"].ToDecimal(), + OtherScore = dr["其他成绩"].ToDecimal(), + Score = dr["总成绩"].ToDecimal(), + IsInEffect = "1", + Remark = dr["备注"].ToString(), + CheckMark = "1", + IsPitchOn = "1", + EmpNo = dr["教师编号"].ToString(), + TestKindNo = "1", + LessonSection = dr["上课节次"].ToString(), + ClassRoomNo = dr["教室编号"].ToString(), + ClassRoomName = dr["教室名称"].ToString(), + IsEditable = "1", + ModifyDate = Insertdate, + ModifyUserId = LoginUserInfo.Get().userId, + ModifyUserName = LoginUserInfo.Get().realName, + F_SchoolId = CompanyEntity.F_CompanyId + }; + + #region 判断是否重复 + if (StuScoreOfPreviousHistory.Count(m => m.AcademicYearNo == stuScoreOfPreviousEntity.AcademicYearNo && m.Semester == stuScoreOfPreviousEntity.Semester + && m.LessonNo == stuScoreOfPreviousEntity.LessonNo && m.StuNo == stuScoreOfPreviousEntity.StuNo + && m.LessonSortNo == stuScoreOfPreviousEntity.LessonSortNo && m.EmpNo == stuScoreOfPreviousEntity.EmpNo + && m.F_SchoolId == stuScoreOfPreviousEntity.F_SchoolId) == 0 + && StuScoreOfPreviousinsert.Count(m => m.AcademicYearNo == stuScoreOfPreviousEntity.AcademicYearNo && m.Semester == stuScoreOfPreviousEntity.Semester + && m.LessonNo == stuScoreOfPreviousEntity.LessonNo && m.StuNo == stuScoreOfPreviousEntity.StuNo + && m.LessonSortNo == stuScoreOfPreviousEntity.LessonSortNo && m.EmpNo == stuScoreOfPreviousEntity.EmpNo + && m.F_SchoolId == stuScoreOfPreviousEntity.F_SchoolId) == 0) + { + StuScoreOfPreviousinsert.Add(stuScoreOfPreviousEntity); + snum++; + } + else + { + throw (new Exception("当前数据重复")); + } + #endregion + } + catch (Exception ex) + { + fnum++; + dr["导入错误"] = ex.Message; + failDt.Rows.Add(dr.ItemArray); + } + } + //执行导入 + db.Insert(StuScoreOfPreviousinsert); + db.Commit(); + if (failDt.Rows.Count > 0) + { + string errordt = failDt.ToJson(); + cache.Write(cacheKey + fileId, errordt, CacheId.excel); + } + } + return snum + "|" + fnum; + } + catch (Exception ex) + { + db.Rollback(); + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + #endregion + } +} 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 5af051acf..26adfd724 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 @@ -293,6 +293,10 @@ + + + +