Browse Source

合并

新疆体育高职分支
liangkun 1 year ago
parent
commit
a6cc9cc7f8
14 changed files with 768 additions and 2 deletions
  1. +32
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoBasicController.cs
  2. +24
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/ImportForm.cshtml
  3. +136
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/ImportForm.css
  4. +240
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/ImportForm.js
  5. +2
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/MyClass.cshtml
  6. +11
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/MyClass.js
  7. +33
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/ExcelImportController.cs
  8. BIN
      Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/StuInfoBasicUpdateImport.xls
  9. BIN
      Learun.Framework.Ultimate V7/Learun.Application.Web/Content/images/wsbsdt.png
  10. +5
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj
  11. +17
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDefault.cshtml
  12. +24
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicBLL.cs
  13. +8
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicIBLL.cs
  14. +236
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicService.cs

+ 32
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoBasicController.cs View File

@@ -148,6 +148,16 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers

return View(stuInfoBasicEntity);
}

/// <summary>
/// 导入页面
/// <summary>
/// <returns></returns>
[HttpGet]
public ActionResult ImportForm()
{
return View();
}
#endregion


@@ -537,6 +547,28 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
stuInfoBasicIBLL.SyncMajor();
return Success("同步成功");
}

/// <summary>
/// 我的班级导入数据
/// </summary>
/// <returns></returns>
public ActionResult DownTemplate()
{
FileStreamResult result = null;
try
{
var path = Server.MapPath("~/Content/excel/");
var pathoffull = path + "StuInfoBasicUpdateImport.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
}
}

+ 24
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/ImportForm.cshtml View File

@@ -0,0 +1,24 @@
@{
ViewBag.Title = "Form";
Layout = "~/Views/Shared/_Form.cshtml";
}
<link href="~/Content/webuploader/webuploader.css" rel="stylesheet" />
<script src="~/Content/webuploader/webuploader.nolog.min.js"></script>
@Html.AppendCssFile("/Areas/EducationalAdministration/Views/StuInfoBasic/ImportForm.css")
<div class="lr-form-layout lr-form-layout-top-bottom">
<div class="lr-form-layout-header">
<div id="lr_add_file_btn"><i class="fa fa-cloud-upload"></i><span class="lrlt">上传文件</span></div>
<div class="webuploader-pick" id="lr_down_file_btn"><i class="fa fa-download"></i><span class="lrlt">下载模板</span></div>
</div>
<div class="lr-form-layout-body">
<div class="lr-form-file-queue-wrap" id="lr_form_file_queue">
<div class="lr-form-file-queue" id="lr_form_file_queue_list">

</div>
<div class="lr-form-file-queue-bg">
<h1><span class="lrlt">试试将电脑里的文件拖拽到此上传</span></h1>
</div>
</div>
</div>
</div>
@Html.AppendJsFile("/Areas/EducationalAdministration/Views/StuInfoBasic/ImportForm.js")

+ 136
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/ImportForm.css View File

@@ -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;
}

+ 240
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/ImportForm.js View File

@@ -0,0 +1,240 @@
/*
* 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
* Copyright (c) 2013-2018 北京泉江科技有限公司
* 创建人:陈彬彬
* 日 期:2017.04.11
* 描 述:导入Excel
*/
var id = request('id');

var keyVaule = '';

var bootstrap = function ($, learun) {
"use strict";

var page1 = {
init: function () {
page.bind();
page.initData();
},
bind: function () {
$('#lr_add_format').on('click', function () {
currentColRow = null;
learun.layerForm({
id: 'FormatForm',
title: '添加',
url: top.$.rootUrl + '/LR_SystemModule/CodeRule/FormatForm',
width: 450,
height: 310,
callBack: function (id) {
return top[id].acceptClick(function (data) {
$('#gridtable').jfGridSet('addRow', { row: data });
});
}
});
});
$('#lr_edit_format').on('click', function () {
currentColRow = $('#gridtable').jfGridGet('rowdata');
var _id = currentColRow ? currentColRow.itemTypeName : '';
if (learun.checkrow(_id)) {
learun.layerForm({
id: 'FormatForm',
title: '修改',
url: top.$.rootUrl + '/LR_SystemModule/CodeRule/FormatForm',
width: 450,
height: 310,
callBack: function (id) {
return top[id].acceptClick(function (data) {
$('#gridtable').jfGridSet('updateRow', { row: data });
});
}
});
}

});
$('#lr_delete_format').on('click', function () {
currentColRow = null;
var row = $('#gridtable').jfGridGet('rowdata');
var _id = row ? row.itemTypeName : '';
if (learun.checkrow(_id)) {
learun.layerConfirm('是否确认删除该项!', function (res, index) {
if (res) {
$('#gridtable').jfGridSet('removeRow');
top.layer.close(index); //再执行关闭
}
});
}
});

$('#gridtable').jfGrid({
headData: [
{ label: "前缀", name: "itemTypeName", width: 120, align: "left" },
{ label: "格式", name: "formatStr", width: 120, align: "left" },
{ label: "步长", name: "stepValue", width: 100, align: "left" },
{ label: "初始值", name: "initValue", width: 120, align: "left" },
{ label: "说明", name: "description", width: 180, align: "left" }
]
});

/*检测重复项*/
$('#F_EnCode').on('blur', function () {
$.lrExistField(keyValue, 'F_EnCode', top.$.rootUrl + '/LR_SystemModule/CodeRule/ExistEnCode');
});
$('#F_FullName').on('blur', function () {
$.lrExistField(keyValue, 'F_FullName', top.$.rootUrl + '/LR_SystemModule/CodeRule/ExistFullName');
});
},
initData: function () {
if (!!selectedRow) {
keyValue = selectedRow.F_RuleId;
$('#form').lrSetFormData(selectedRow);
var formatdata = JSON.parse(selectedRow.F_RuleFormatJson);
$('#gridtable').jfGridSet('refreshdata', formatdata);
}
}
};

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/StuInfoBasicImport", 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('<div class="lr-msg2"><span>' + res.data.Success + '</span><span>/</span><span style="color:#b94a48;" >' + res.data.Fail + '</span></div>');
// 如果有失败
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('<div class="lr-msg"><i class="fa fa-exclamation-circle"></i></div>');
}
});
}
// 触发清楚文件碎片
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('<div class="lr-msg"><i class="fa fa-exclamation-circle"></i></div>');
}

var page = {
uploader: null,
init: function () {
/*模板下载*/
$('#lr_down_file_btn').on('click', function () {
learun.download({ url: top.$.rootUrl + '/EducationalAdministration/StuInfoBasic/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 = $('<div class="lr-form-file-queue-item" id="lr_filequeue_' + file.id + '" ></div>');
$item.append('<div class="lr-file-image"><img src="' + top.$.rootUrl + '/Content/images/filetype/' + file.ext + '.png"></div>');
$item.append('<span class="lr-file-name">' + file.name + '(' + learun.countFileSize(file.size) + ')</span>');

$('#lr_form_file_queue_list').append($item);
},
uploadStart: function (file) {
var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id);
$fileItem.append('<div class="lr-uploader-progress"><div class="lr-uploader-progress-bar" style="width:0%;"></div></div>');
},
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();

}

+ 2
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/MyClass.cshtml View File

@@ -21,9 +21,10 @@
<div class=" btn-group btn-group-sm">
<a id="lr_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a>
</div>
<div class=" btn-group btn-group-sm" learun-authorize="yes">
<div class=" btn-group btn-group-sm" learun-authorize="yes">
<a id="lr_edit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
<a id="lr_view" class="btn btn-default"><i class="fa fa-pencil-square-o"></i>&nbsp;查看</a>
<a id="lr_update" class="btn btn-default"><i class="fa fa-edit"></i>&nbsp;更新数据</a>
</div>
</div>
</div>


+ 11
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/MyClass.js View File

@@ -101,6 +101,17 @@ var bootstrap = function ($, learun) {
});
}
});
//更新学生数据
$('#lr_update').on('click', function () {
learun.layerForm({
id: 'form_import',
title: '更新学生数据',
url: top.$.rootUrl + '/EducationalAdministration/StuInfoBasic/ImportForm',
width: 600,
height: 400,
btn: null
});
});
},
// 初始化列表
initGird: function () {


+ 33
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/ExcelImportController.cs View File

@@ -6,6 +6,7 @@ using System.Data;
using Learun.Application.Base.SystemModule;
using System;
using System.Drawing;
using Learun.Application.TwoDevelopment.EducationalAdministration;

namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers
{
@@ -20,6 +21,8 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers
{
private ExcelImportIBLL excelImportIBLL = new ExcelImportBLL();
private AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL();
private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL();
#region 视图功能
/// <summary>
/// 导入模板管理页面
@@ -287,6 +290,36 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers
}
}

/// <summary>
/// 学生学籍信息批量修改
/// </summary>
/// <param name="templateId">模板Id</param>
/// <param name="fileId">文件主键</param>
/// <param name="chunks">分片数</param>
/// <param name="ext">文件扩展名</param>
/// <returns></returns>
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult StuInfoBasicImport(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);
string res = stuInfoBasicIBLL.StuInfoBasicUpdateImport(dt, fileId);
var data = new
{
Success = res.Split('|')[0],
Fail = res.Split('|')[1]
};
return JsonResult(data);
}
else
{
return Fail("导入数据失败!");
}
}
/// <summary>
/// 下载文件(导入文件未被导入的数据)
/// </summary>


BIN
Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/StuInfoBasicUpdateImport.xls View File


BIN
Learun.Framework.Ultimate V7/Learun.Application.Web/Content/images/wsbsdt.png View File

Before After
Width: 18  |  Height: 18  |  Size: 2.0 KiB

+ 5
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj View File

@@ -993,6 +993,8 @@
<Content Include="Areas\EducationalAdministration\Views\YKTStateMent\AnalysisByMonthForStudent.js" />
<Content Include="Areas\EducationalAdministration\Views\YKTStateMent\ManageIndexTeacher.js" />
<Content Include="Areas\EducationalAdministration\Views\YKTStateMent\IndexForTeacher.js" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasic\ImportForm.css" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasic\ImportForm.js" />
<Content Include="Areas\EducationalAdministration\Views\YKTStateMent\IndexForStudent.js" />
<Content Include="Areas\EducationalAdministration\Views\YKTStateMent\Index.js" />
<Content Include="Areas\EducationalAdministration\Views\ArrangeExamTermNew\IndexTeach.js" />
@@ -2474,6 +2476,7 @@
<Content Include="Content\images\SsoSystem\search.png" />
<Content Include="Content\images\SsoSystem\user.jpg" />
<Content Include="Content\images\StuRecruitmentBrochure.jpg" />
<Content Include="Content\images\wsbsdt.png" />
<Content Include="Content\jquery\plugin\jqprint\jqprint.css" />
<Content Include="Content\jquery\plugin\jqprint\jQuery.print.js" />
<Content Include="Content\jquery\plugin\jSignature.min.js" />
@@ -8059,6 +8062,8 @@
<Content Include="Areas\LogisticsManagement\Views\Acc_Punishment\IndexStatistics.cshtml" />
<Content Include="Areas\EducationalAdministration\Views\YKTStateMent\IndexForTeacher.cshtml" />
<Content Include="Areas\EducationalAdministration\Views\YKTStateMent\ManageIndexTeacher.cshtml" />
<Content Include="Content\excel\StuInfoBasicUpdateImport.xls" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasic\ImportForm.cshtml" />
<Content Include="Areas\EducationalAdministration\Views\YKTStateMent\AnalysisByMonthForStudent.cshtml" />
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" />
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />


+ 17
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDefault.cshtml View File

@@ -3,6 +3,20 @@
Layout = "~/Views/Shared/_Admin.cshtml";
}
@Html.AppendCssFile("/Views/Home/AdminDefault/index.css")
<style>
.lr-im-bell2 {
width: 80px;
right: 123px;
display: flex;
justify-content: space-around;
align-items: center;
}

.lr-im-bell2 .point {
left: 23px;
right: auto;
}
</style>
<script>
function request(d) { for (var c = location.search.slice(1).split("&"), a = 0; a < c.length; a++) { var b = c[a].split("="); if (b[0] == d) if ("undefined" == unescape(b[1])) break; else return unescape(b[1]) } return "" };
</script>
@@ -47,6 +61,9 @@
<li><a href="javascript:void(0);" id="btn_gongwen3"><i class="fa fa-balance-scale"></i>备课任务 0 条</a></li>*@
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;共 @ViewBag.UnreadNum 条</li>
</ul>
<div style="display: inline-block; line-height: 18px; position: relative; top: -3px;" title="网上办事大厅">
<a href="/SSOSystem/DragModelOne" class="down downsso"><img src="~/Content/images/wsbsdt.png" /></a>
</div>
</div>

@* 即时通讯窗体 *@


+ 24
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicBLL.cs View File

@@ -564,7 +564,30 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}
}

/// <summary>
/// 更新学生数据
/// </summary>
/// <param name="dt"></param>
/// <param name="fileId"></param>
/// <returns></returns>
public string StuInfoBasicUpdateImport(DataTable dt, string fileId)
{
try
{
return stuInfoBasicService.StuInfoBasicUpdateImport(dt, fileId);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}
#endregion

}


+ 8
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicIBLL.cs View File

@@ -81,5 +81,13 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
IEnumerable<StuInfoBasicEntity> GetStuInfoByClassNo(string classNo);
void SyncDept();
void SyncMajor();
/// <summary>
/// 跟新学生数据
/// </summary>
/// <param name="dt"></param>
/// <param name="fileId"></param>
/// <returns></returns>
string StuInfoBasicUpdateImport(DataTable dt, string fileId);
}
}

+ 236
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicService.cs View File

@@ -11,6 +11,8 @@ using Learun.Application.Organization;
using System.Reflection;
using Learun.Application.Base.SystemModule;
using Learun.Application.TwoDevelopment.LogisticsManagement;
using Learun.Cache.Base;
using Learun.Cache.Factory;

namespace Learun.Application.TwoDevelopment.EducationalAdministration
{
@@ -23,6 +25,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
/// </summary>
public class StuInfoBasicService : RepositoryFactory
{
private DataItemIBLL dataItemIBLL = new DataItemBLL();

#region 获取数据

/// <summary>
@@ -993,5 +997,237 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}
}

#region 缓存定义
private ICache cache = CacheFactory.CaChe();
private string cacheKey = "Learun_adms_excelError_"; // +公司主键
#endregion

/// <summary>
/// 批量更新学生数据
/// </summary>
/// <param name="dt"></param>
public string StuInfoBasicUpdateImport(DataTable dt, string fileId)
{
try
{
int snum = 0;
int fnum = 0;
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<StuInfoBasicEntity> stuInfoBasicEntities = this.BaseRepository("CollegeMIS").FindList<StuInfoBasicEntity>("select * from StuInfoBasic");
//修改学生list
List<StuInfoBasicEntity> insertedorderlist = new List<StuInfoBasicEntity>();
var db = this.BaseRepository("CollegeMIS").BeginTrans();
// 循环遍历导入
foreach (DataRow dr in dt.Rows)
{
try
{
//Dictionary<string, List<DataItemDetailEntity>> dataItemMap = new Dictionary<string, List<DataItemDetailEntity>>();
//检测是否有空值
if (dr[0].ToString() == "" || dr[4].ToString() == "")
{
throw (new Exception("学号和姓名不能为空,不能为空!"));
}

var stuInfoBasic = stuInfoBasicEntities.FirstOrDefault(s => s.StuNo == dr[0].ToString() && s.StuName == dr[4].ToString());

//写入要导入的数据
var stuUpdateList = new StuInfoBasicEntity
{
StuId = stuInfoBasic.StuId,
StuNo = "",
StuCode = "",
NoticeNo = "",
GraduateYear = "",
ksh = "",
//DeptNo = "",
//MajorNo = "",
//MajorDetailNo = "",
//MajorDetailName = "",
//Grade = "",
//ClassNo = "",
//StuName = "",
////GenderNo = true,
//Birthday = DateTime.Now,
//PartyFaceNo = "",
//FamilyOriginNo = "",
//NationalityNo = "",
//ProvinceNo = "",
//RegionNo = "",
//ResidenceNo = "",
//TestStuSortNo = "",
//HealthStatusNo = "",
//WillNo = "",
//TestStuSubjectNo = "",
//GraduateNo = "",
//PlanFormNo = "",
//IsThreeGood = "",
//IsExcellent = "",
//IsNormalCadre = "",
//IsProvinceFirstThree = "",
//OverseasChineseNo = "",
//MatriculateSort = "",
//ComeProvinceNo = "",
//HighSchoolNo = "",
//HighSchoolName = "",
//EntranceDate = DateTime.Now,
//Religion = "",
//GoodAt = "",
//IdentityCardNo = "",
//JoinPartyDate = DateTime.Now,
//JoinLeagueDate = DateTime.Now,
//InSchoolAddress = "",
//InSchoolTelephone = "",
//AbmormityMoveMark = "",
//AwardMark = "",
//PunishMark = "",
//LinkmanMark = "",
//StuNoChangeMark = "",
//FinishSchoolMark = "",
//CurrentRegisterMark = "",
//FinishSchoolDate = DateTime.Now,
//DiplomaNo = "",
//DiplomaRemark = "",
//Remark = "",
//RegisterDate = DateTime.Now,
//Photo = "",
//TeachPlanNo = "",
CheckMark = "1",
//mobile = "",
//EMail = "",
//QQ = "",
//FatherUnit = "",
//FatherName = "",
//FatherPhone = "",
//MatherName = "",
//MatherUnit = "",
//MatherPhone = "",
//username = "",
//password = "",
//MailAddress = "",
//PostalCode = "",
//InSchoolStatus = "",
//TransMark = "",
//ClassTutorNo = "",
//ResumeCheck = "",
//PracStatus = "",
//RegisterStatus = 0,
//PunishmentDate = DateTime.Now,
//F_CityId = "",
//F_CountyId = "",
//F_ProvinceId = "",
//F_SchoolId = "",
//EduSystem = "",
//StudyModality = "",
//ChangeStatus = 0,
//SyncFlag = true,
//Balance = "",
//HealthStatus = "",
//IdCardType = "",
//EntranceWay = "",
//StudyingWay = "",
//CountryNo = "",
//MarriageStatus = "",
//TrainInterval = "",
//IsTrailChildren = "",
//StuPlaceCode = "",
//BirthPlaceCode = "",
//NativePlaceCode = "",
//ResidencePlaceCode = "",
//BelongPolice = "",
//StuLivePlaceType = "",
//StuOrigin = "",
//RecruitObject = "",
//PoorIsRecord = "",
//RecruitWay = "",
//RecruitCooperateType = "",
//AdmissionNo = "",
//ExamScore = 0,
//RecruitCooperateForm = "",
//RecruitCooperateSchoolNo = "",
//SchoolOutsidePlace = "",
//PieceCultivateWay = "",
//EnglishName = "",
//OneMembership = "",
//OneIsGuardian = "",
//OneBirthday = "",
//OneIdCardType = "",
//OneIdCardNo = "",
//OneNationalityNo = "",
//OnePartyFaceNo = "",
//OneHealthStatus = "",
//OneJob = "",
//OnePosition = "",
//TwoMembership = "",
//TwoIsGuardian = "",
//TwoBirthday = "",
//TwoIdCardType = "",
//TwoIdCardNo = "",
//TwoNationalityNo = "",
//TwoPartyFaceNo = "",
//TwoHealthStatus = "",
//TwoJob = "",
//TwoPosition = "",
//DepositBank = "",
//BankCard = "",
//BankLocation = "",
//Domicile = "",
//OneDomicile = "",
//TwoDomicile = "",
//OneAddress = "",
//TwoAddress = "",
//ThreeName = "",
//ThreeMobile = "",
//IsSingle = true,
//MoveType = "",
//MoveStatus = 0,
//GuardianName = "",
//GuardianIdCardNo = "",
//GuardianPhone = "",
//GuardianDomicile = "",
//GuardianAddress = "",

};
insertedorderlist.Add(stuUpdateList);
snum++;
}
catch (Exception ex)
{
fnum++;
dr["导入错误"] = ex.Message;
failDt.Rows.Add(dr.ItemArray);
}
}
//执行导入
db.Update(insertedorderlist);
db.Commit();
if (failDt.Rows.Count > 0)
{
string errordt = failDt.ToJson();
cache.Write<string>(cacheKey + fileId, errordt, CacheId.excel);
}
}
return snum + "|" + fnum;
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
}
}

Loading…
Cancel
Save