Просмотр исходного кода

学生学籍管理导入批量修改信息

新疆警官学校中职
ndbs 1 год назад
Родитель
Сommit
ce391f99f5
12 измененных файлов: 601 добавлений и 19 удалений
  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. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/Index.cshtml
  6. +13
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/Index.js
  7. +42
    -10
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/ExcelImportController.cs
  8. Двоичные данные
      Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/StuInfoBasicImport.xls
  9. +5
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj
  10. +18
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicBLL.cs
  11. +8
    -6
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicIBLL.cs
  12. +82
    -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 Просмотреть файл

@@ -265,6 +265,15 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
return View();
}

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


@@ -743,6 +752,29 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
stuInfoBasicIBLL.SynPhoto();
return Success("同步成功!");
}


/// <summary>
/// 宿舍信息导入模板
/// </summary>
/// <returns></returns>
public ActionResult DownTemplate()
{
FileStreamResult result = null;
try
{
var path = Server.MapPath("~/Content/excel/");
var pathoffull = path + "StuInfoBasicImport.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 Просмотреть файл

@@ -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 Просмотреть файл

@@ -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 Просмотреть файл

@@ -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();

}

+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/Index.cshtml Просмотреть файл

@@ -100,7 +100,7 @@
<a id="lr_photo" class="btn btn-default"><i class="fa fa-search"></i>&nbsp;拍照</a>
<a id="lr_printInfo" class="btn btn-default"><i class="fa fa-print"></i>&nbsp;学生简历表</a>
<a id="lr_printxjk" class="btn btn-default"><i class="fa fa-print"></i>&nbsp;学籍卡打印</a>
<a id="lr_import" class="btn btn-default"><i class="fa fa-plus"></i>&nbsp;信息批量修改</a>
</div>
</div>
</div>


+ 13
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/Index.js Просмотреть файл

@@ -366,7 +366,19 @@ var bootstrap = function ($, learun) {
});
}
});

$('#lr_import').on('click',
function () {
learun.layerForm({
id: 'form',
title: '导入',
url: top.$.rootUrl + '/EducationalAdministration/StuInfoBasic/ImportForm',
width: 600,
height: 400,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
});
});
},
// 初始化列表
initGird: function () {


+ 42
- 10
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/ExcelImportController.cs Просмотреть файл

@@ -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,7 @@ 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>
/// 导入模板管理页面
@@ -206,10 +208,10 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers
/// <returns></returns>
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult ExecuteImportExcel(string templateId, string fileId, int chunks,string ext)
public ActionResult ExecuteImportExcel(string templateId, string fileId, int chunks, string ext)
{
UserInfo userInfo = LoginUserInfo.Get();
string path = annexesFileIBLL.SaveAnnexes(fileId, fileId + "."+ ext, chunks, userInfo);
string path = annexesFileIBLL.SaveAnnexes(fileId, fileId + "." + ext, chunks, userInfo);
if (!string.IsNullOrEmpty(path))
{
DataTable dt = ExcelHelper.ExcelImport(path);
@@ -236,14 +238,14 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers
/// <returns></returns>
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult ExecuteImportSaralExcel(string fileId, int chunks,string ext)
public ActionResult ExecuteImportSaralExcel(string fileId, int chunks, string ext)
{
UserInfo userInfo = LoginUserInfo.Get();
string path = annexesFileIBLL.SaveAnnexes(fileId, fileId + "."+ ext, chunks, userInfo);
string path = annexesFileIBLL.SaveAnnexes(fileId, fileId + "." + ext, chunks, userInfo);
if (!string.IsNullOrEmpty(path))
{
DataTable dt = ExcelHelper.ExcelImport(path);
string res = excelImportIBLL.ImportSalaryInfo(dt,fileId);
string res = excelImportIBLL.ImportSalaryInfo(dt, fileId);
var data = new
{
Success = res.Split('|')[0],
@@ -266,14 +268,14 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers
/// <returns></returns>
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult EmpInfoImport(string fileId, int chunks,string ext)
public ActionResult EmpInfoImport(string fileId, int chunks, string ext)
{
UserInfo userInfo = LoginUserInfo.Get();
string path = annexesFileIBLL.SaveAnnexes(fileId, fileId + "."+ ext, chunks, userInfo);
string path = annexesFileIBLL.SaveAnnexes(fileId, fileId + "." + ext, chunks, userInfo);
if (!string.IsNullOrEmpty(path))
{
DataTable dt = ExcelHelper.ExcelImport(path);
string res = excelImportIBLL.EmpInfoImport(dt,fileId);
string res = excelImportIBLL.EmpInfoImport(dt, fileId);
var data = new
{
Success = res.Split('|')[0],
@@ -287,6 +289,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.StuInfoBasicImport(dt, fileId);
var data = new
{
Success = res.Split('|')[0],
Fail = res.Split('|')[1]
};
return JsonResult(data);
}
else
{
return Fail("导入数据失败!");
}
}
/// <summary>
/// 下载文件(导入文件未被导入的数据)
/// </summary>
@@ -294,7 +326,7 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers
/// <returns></returns>
[HttpPost]
[ValidateAntiForgeryToken]
public void DownImportErrorFile(string fileId,string fileName)
public void DownImportErrorFile(string fileId, string fileName)
{
//设置导出格式
ExcelConfig excelconfig = new ExcelConfig();
@@ -325,7 +357,7 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers
});
}

}
ExcelHelper.ExcelDownload(dt, excelconfig);
}


Двоичные данные
Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/StuInfoBasicImport.xls Просмотреть файл


+ 5
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj Просмотреть файл

@@ -1229,6 +1229,8 @@
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasic\GraduateFeeSettle.js" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasic\GraduateFileTransfer.js" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasic\GraduateReturnBooks.js" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasic\ImportForm.css" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasic\ImportForm.js" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasic\IndexOfDC.js" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasic\IndexInClass.js" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasic\MyClass.js" />
@@ -1319,6 +1321,7 @@
<Content Include="Areas\EducationalAdministration\Views\BookReturn\Index.cshtml" />
<Content Include="Areas\EducationalAdministration\Views\BookPutIn\Form.cshtml" />
<Content Include="Areas\EducationalAdministration\Views\BookPutIn\Index.cshtml" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasic\ImportForm.cshtml" />
<None Include="Areas\EducationalAdministration\Views\StuInfoBasic\Printxjk.cshtml" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoFresh\AllocationClassDC.js" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoFresh\StatisticClassIndex.js" />
@@ -8010,6 +8013,8 @@
<Content Include="Areas\LR_NewWorkFlow\Views\StampPersonal\Form.cshtml" />
<Content Include="Areas\LR_NewWorkFlow\Views\StampPersonal\Index.cshtml" />
<Content Include="Areas\LR_NewWorkFlow\Views\StampPersonal\StampDetailIndex.cshtml" />
<Content Include="Content\excel\AccommodationImport.xls" />
<Content Include="Content\excel\StuInfoBasicImport.xls" />
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" />
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
<Content Include="Views\Login\Default-beifen.cshtml" />


+ 18
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicBLL.cs Просмотреть файл

@@ -705,7 +705,24 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}
}

public string StuInfoBasicImport(DataTable dt, string fileId)
{
try
{
return stuInfoBasicService.StuInfoBasicImport(dt, fileId);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}
#endregion

}


+ 8
- 6
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicIBLL.cs Просмотреть файл

@@ -28,7 +28,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
/// <returns></returns>
StuInfoBasicEntity GetStuInfoBasicEntity(string keyValue);
List<CdMajorEntity> GetMajorInfoWithGraduation();
void CreateGraduateNoByMajor(string CityCode,string SchoolCode,string MajorList);
void CreateGraduateNoByMajor(string CityCode, string SchoolCode, string MajorList);

/// <summary>
/// 获取StuInfoBasic表实体数据
@@ -42,7 +42,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
StuInfoBasicEntity GetStuInfoBasicEntityByStuNo(string enCode);

StuInfoBasicEntity GetStuInfoBasicEntityByStuName(string name);
StuInfoBasicEntity GetStuInfoBasicEntityByStuNoOrStuName(string stuno,string stuname);
StuInfoBasicEntity GetStuInfoBasicEntityByStuNoOrStuName(string stuno, string stuname);
/// <summary>
/// 获取左侧树形数据
/// <summary>
@@ -55,7 +55,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
/// 审核全部
/// </summary>
void CheckAll();
void AllowGraduate(string stuNo,string status);
void AllowGraduate(string stuNo, string status);
void SynPhoto();
/// <summary>
/// 删除实体数据
@@ -67,7 +67,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
/// 领取毕业证
/// </summary>
/// <param name="keyValue"></param>
void GetCard(string keyValue,string status, StuInfoBasicEntity entity);
void GetCard(string keyValue, string status, StuInfoBasicEntity entity);
/// <summary>
/// 图书资料归还
/// </summary>
@@ -97,7 +97,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
/// 档案与组织关系转出
/// </summary>
/// <param name="keyValue"></param>
void IsFileTransfer(string keyValue, string status,string fort);
void IsFileTransfer(string keyValue, string status, string fort);
void StuStore();


@@ -108,7 +108,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
/// <returns></returns>
void SaveEntity(string keyValue, StuInfoBasicEntity entity);
void UpdateAccount();
void UpdateState(string keyValue,string state);
void UpdateState(string keyValue, string state);
#endregion

void GenerateAccout();
@@ -116,5 +116,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
IEnumerable<StuInfoBasicEntity> GetAllList();
IEnumerable<StuInfoBasicEntity> GetAllList(string ChangeType);
IEnumerable<StuInfoBasicEntity> GetStuInfoByClassNo(string classNo);

string StuInfoBasicImport(DataTable dt, string fileId);
}
}

+ 82
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicService.cs Просмотреть файл

@@ -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
{
@@ -1299,6 +1301,86 @@ 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 StuInfoBasicImport(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
{
//检测是否有空值
if (dr[0].ToString() == "" || dr[1].ToString() == "" || dr[2].ToString() == "" || dr[3].ToString() == "")
{
throw (new Exception("行内数据有空值,不能为空!"));
}
if (stuInfoBasicEntities.Count(m => m.IdentityCardNo.ToUpper() == dr[0].ToString().ToUpper()) == 0)
{
throw (new Exception("【身份证号】不存在,请核对!"));
}
//写入要导入的数据
StuInfoBasicEntity stuUpdateList = new StuInfoBasicEntity();
stuUpdateList.StuId = stuInfoBasicEntities.FirstOrDefault(s => s.IdentityCardNo.ToUpper() == dr[0].ToString().ToUpper())?.StuId.ToString();
stuUpdateList.StuCode = dr[1].ToString();
stuUpdateList.MailAddress = dr[2].ToString();
stuUpdateList.mobile = dr[3].ToString();
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);
}
}
}
#endregion




Загрузка…
Отмена
Сохранить