@@ -50,6 +50,11 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
{ | |||
return View(); | |||
} | |||
[HttpGet] | |||
public ActionResult ExcelImportPay() | |||
{ | |||
return View(); | |||
} | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
@@ -0,0 +1,25 @@ | |||
@{ | |||
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/StuInfoFresh/ExcelImportPay.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/StuInfoFresh/ExcelImportPay.js") |
@@ -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; | |||
} |
@@ -0,0 +1,158 @@ | |||
/* | |||
* 版 本 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 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/ExecuteImportOrderDetail", 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 + '/Content/excel/OrderDetail.xls' }); | |||
}); | |||
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(); | |||
} |
@@ -37,6 +37,7 @@ | |||
<a id="lr_onsitePay" class="btn btn-default"><i class="fa fa-plus"></i> 现场缴费</a> | |||
<a id="lr_otherPay" class="btn btn-default"><i class="fa fa-plus"></i> 其他费用缴费</a> | |||
<a id="lr_cancelOtherPay" class="btn btn-default"><i class="fa fa-trash-o"></i> 取消其他费用缴费</a> | |||
<a id="lr_import" class="btn btn-default"><i class="fa fa-plus"></i> 导入缴费明细</a> | |||
</div> | |||
</div> | |||
</div> | |||
@@ -58,6 +58,17 @@ var bootstrap = function ($, learun) { | |||
}); | |||
} | |||
}); | |||
//导入缴费明细 | |||
$('#lr_import').on('click', function () { | |||
learun.layerForm({ | |||
id: 'form_import', | |||
title: '导入缴费明细', | |||
url: top.$.rootUrl + '/EducationalAdministration/StuInfoFresh/ExcelImportPay?id=1', | |||
width: 600, | |||
height: 400, | |||
btn: null | |||
}); | |||
}); | |||
//查看发票 | |||
$('#lr_viewinvoice').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('ID'); | |||
@@ -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 StuInfoFreshIBLL stuInfoFreshIBll = new StuInfoFreshBLL(); | |||
#region 视图功能 | |||
/// <summary> | |||
/// 导入模板管理页面 | |||
@@ -287,6 +289,37 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers | |||
} | |||
} | |||
/// <summary> | |||
/// 导入缴费明细(西昌) | |||
/// </summary> | |||
/// <param name="templateId"></param> | |||
/// <param name="fileId"></param> | |||
/// <param name="chunks"></param> | |||
/// <param name="ext"></param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
[ValidateAntiForgeryToken] | |||
public ActionResult ExecuteImportOrderDetail(string templateId, 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 = stuInfoFreshIBll.ImportOrderDetail(dt, fileId, templateId); | |||
var data = new | |||
{ | |||
Success = res.Split('|')[0], | |||
Fail = res.Split('|')[1] | |||
}; | |||
return JsonResult(data); | |||
} | |||
else | |||
{ | |||
return Fail("导入数据失败!"); | |||
} | |||
} | |||
/// <summary> | |||
/// 下载文件(导入文件未被导入的数据) | |||
/// </summary> | |||
@@ -1102,6 +1102,8 @@ | |||
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasic_PayFee\PayFeeIndex.js" /> | |||
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasic\Print.css" /> | |||
<Content Include="Areas\EducationalAdministration\Views\StuInfoFresh\AllocationClassDC.js" /> | |||
<Content Include="Areas\EducationalAdministration\Views\StuInfoFresh\ExcelImportPay.js" /> | |||
<Content Include="Areas\EducationalAdministration\Views\StuInfoFresh\ExcelImportPay.css" /> | |||
<Content Include="Areas\EducationalAdministration\Views\StuInfoFresh\InvoiceForm.js" /> | |||
<Content Include="Areas\EducationalAdministration\Views\StuInfoFresh\StatisticClassIndex.js" /> | |||
<Content Include="Areas\EducationalAdministration\Views\StuInfoFresh\StatusView.js" /> | |||
@@ -7905,6 +7907,8 @@ | |||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\ClearForm.cshtml" /> | |||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\IndexImport.cshtml" /> | |||
<Content Include="Content\excel\AccommodationImport.xls" /> | |||
<Content Include="Areas\EducationalAdministration\Views\StuInfoFresh\ExcelImportPay.cshtml" /> | |||
<Content Include="Content\excel\OrderDetail.xls" /> | |||
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" /> | |||
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" /> | |||
<Content Include="Views\Login\Default-beifen.cshtml" /> | |||
@@ -44,6 +44,5 @@ | |||
<add name="CollegeMIS" connectionString="Server=123.57.209.16;Initial Catalog=CollegeMIS_西昌;User ID=sa;Password=bjqjkj@2014~2015!" providerName="System.Data.SqlClient" /> | |||
<add name="hangfireString" connectionString="Server=123.57.209.16;Initial Catalog=Hangfire;User ID=sa;Password=bjqjkj@2014~2015!" providerName="System.Data.SqlClient" /> | |||
<add name="paikeDbString" connectionString="Data Source=10.30.0.11;Database=paike;User ID=root;Password=12345678;" providerName="MySql.Data.MySqlClient" /> | |||
<add name="YongyouDb" connectionString="Server=.;Password=1;User ID=sa; Initial Catalog=u8gx" providerName="System.Data.SqlClient" /> | |||
<add name="YongyouDb" connectionString="Server=123.57.209.16;Password=bjqjkj@2014~2015!;User ID=sa; Initial Catalog=u8gx" providerName="System.Data.SqlClient" /> | |||
</connectionStrings> |
@@ -1052,5 +1052,24 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
#endregion | |||
public string ImportOrderDetail(DataTable dt,string fileId, string templateId) | |||
{ | |||
try | |||
{ | |||
return stuInfoFreshService.ImportOrderDetail(dt, fileId,templateId); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -257,5 +257,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
IEnumerable<StuEnrollInvoiceRecordEntity> GetStuEnrollFeeOrder(string keyValue, bool IsNewOrOld); | |||
void SaveStudentCompare(string identityCardNo, int photoCheckStatus, string identPhoto, string scenePhoto); | |||
string ImportOrderDetail(DataTable dt,string fileId, string templateId); | |||
} | |||
} |
@@ -11,6 +11,8 @@ using System.Data; | |||
using System.IO; | |||
using System.Linq; | |||
using System.Text; | |||
using Learun.Cache.Base; | |||
using Learun.Cache.Factory; | |||
namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
{ | |||
@@ -2145,7 +2147,7 @@ where bb.StuNo not in (select b.StuNo from StuInfoBasic b where b.StuNo=bb.StuNo | |||
{ | |||
try | |||
{ | |||
var stufresh = BaseRepository("CollegeMIS").FindEntity<StuInfoFreshEntity>("select * from StuInfoFresh where IdentityCardNo='" + identityCardNo + "'",null); | |||
var stufresh = BaseRepository("CollegeMIS").FindEntity<StuInfoFreshEntity>("select * from StuInfoFresh where IdentityCardNo='" + identityCardNo + "'", null); | |||
if (stufresh != null) | |||
{ | |||
stufresh.PhotoCheckStatus = photoCheckStatus; | |||
@@ -2166,5 +2168,146 @@ where bb.StuNo not in (select b.StuNo from StuInfoBasic b where b.StuNo=bb.StuNo | |||
} | |||
} | |||
} | |||
#region 缓存定义 | |||
private ICache cache = CacheFactory.CaChe(); | |||
private string cacheKey = "Learun_adms_excelError_"; // +公司主键 | |||
#endregion | |||
public class StuEnrollInvoiceTypeCodeEntity | |||
{ | |||
public string InvoiceTypeCode { get; set; } | |||
public string ProjectCode { get; set; } | |||
public string ProjectName { get; set; } | |||
} | |||
/// <summary> | |||
/// 导入缴费数据 | |||
/// </summary> | |||
/// <param name="dt"></param> | |||
/// <param name="templateId">1新生,2老生</param> | |||
public string ImportOrderDetail(DataTable dt, string fileId, string templateId) | |||
{ | |||
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<StuEnrollInvoiceTypeCodeEntity> typecodelist = BaseRepository("CollegeMIS").FindList<StuEnrollInvoiceTypeCodeEntity>("select * from StuEnrollInvoiceTypeCode"); | |||
IEnumerable<StuInfoFreshEntity> stufreshlist = null; | |||
IEnumerable<StuInfoBasicEntity> stuinfobasiclist = null; | |||
//老生缴费初始化记录 | |||
IEnumerable<StuInfoBasic_PayFeeEntity> stuinfobasicpayfeelist = null; | |||
//获取学生数据 | |||
if (templateId == "1")//新生 | |||
{ | |||
stufreshlist = BaseRepository("CollegeMIS").FindList<StuInfoFreshEntity>("select StuNo,StuName from StuInfoFresh"); | |||
} | |||
else//老生 | |||
{ | |||
stuinfobasiclist = BaseRepository("CollegeMIS").FindList<StuInfoBasicEntity>("select StuNo,StuName from StuInfoBasic"); | |||
//老生缴费初始化记录 | |||
stuinfobasicpayfeelist = BaseRepository("CollegeMIS").FindList<StuInfoBasic_PayFeeEntity>("select StuNo,PayYear from StuInfoBasic_PayFee"); | |||
} | |||
// 循环遍历导入 | |||
foreach (DataRow dr in dt.Rows) | |||
{ | |||
try | |||
{ | |||
//检测是否有空值 | |||
if (dr[0] == null || dr[1] == null || dr[2] == null || dr[3] == null || dr[4] == null || dr[5] == null) | |||
{ | |||
throw (new Exception("行内数据有空值,不能为空!")); | |||
} | |||
//检测缴费年度是否为数字 | |||
decimal payyearresult = 0; | |||
bool parsepayyearresult = decimal.TryParse(dr[0].ToString(), out payyearresult); | |||
if (!parsepayyearresult || dr[0].ToString().Length != 4) | |||
{ | |||
throw (new Exception("【缴费年度】格式不正确,必须为四位数字年份!")); | |||
} | |||
//首先校验金额是否为数字 | |||
//第六列是金额 | |||
decimal dresult = 0; | |||
bool parseresult = decimal.TryParse(dr[5].ToString(), out dresult); | |||
if (!parseresult) | |||
{ | |||
throw (new Exception("【金额】转换失败,必须为数字!")); | |||
} | |||
//筛选不在标准代码表内的数据 | |||
//第五列是金额 | |||
if (typecodelist.Count(m => m.ProjectCode == dr[5].ToString()) == 0) | |||
{ | |||
throw (new Exception("【缴费项目编码】不存在,请核对!")); | |||
} | |||
//筛选不在学生数据表中的学号 | |||
if (templateId == "1")//新生 | |||
{ | |||
//第二列是学号 | |||
if (stufreshlist.Count(m => m.StuNo == dr[1].ToString()) == 0) | |||
{ | |||
throw (new Exception("【学号】不存在,请核对新生数据!")); | |||
} | |||
} | |||
else//老生 | |||
{ | |||
//第二列是学号 | |||
if (stuinfobasiclist.Count(m => m.StuNo == dr[1].ToString()) == 0) | |||
{ | |||
throw (new Exception("【学号】不存在,请核对学籍数据!")); | |||
} | |||
//老生需要再筛选是否存在缴费初始化记录 | |||
//第一列是缴费年度 | |||
if (stuinfobasicpayfeelist.Count(m => m.StuNo == dr[1].ToString() && m.PayYear == dr[0].ToInt()) == 0) | |||
{ | |||
throw (new Exception("【学生年度缴费数据】不存在,请核对是否初始化缴费数据!")); | |||
} | |||
} | |||
//数据筛查完毕,执行导入 | |||
StuEnrollFeeOrderEntity orderEntity=new StuEnrollFeeOrderEntity(); | |||
orderEntity.Create(); | |||
orderEntity.YearNo = dr[0].ToInt(); | |||
orderEntity.StuNo = dr[1].ToString(); | |||
Random ran = new Random(); | |||
orderEntity.orderid = DateTime.Now.ToString("yyyyMMddhhmmss") + ran.Next(0, 100000); | |||
} | |||
catch (Exception ex) | |||
{ | |||
fnum++; | |||
dr["导入错误"] = ex.Message; | |||
failDt.Rows.Add(dr.ItemArray); | |||
} | |||
} | |||
// 写入缓存如果有未导入的数据 | |||
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); | |||
} | |||
} | |||
} | |||
} | |||
} |