diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoFreshController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoFreshController.cs index 7a7ed688d..21c6b7fc8 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoFreshController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoFreshController.cs @@ -50,6 +50,11 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers { return View(); } + [HttpGet] + public ActionResult ExcelImportPay() + { + return View(); + } /// /// /// diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/ExcelImportPay.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/ExcelImportPay.cshtml new file mode 100644 index 000000000..aef0e5cac --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/ExcelImportPay.cshtml @@ -0,0 +1,25 @@ +@{ + ViewBag.Title = "Form"; + Layout = "~/Views/Shared/_Form.cshtml"; +} + + +@Html.AppendCssFile("/Areas/EducationalAdministration/Views/StuInfoFresh/ExcelImportPay.css") + +
+
+
上传文件
+
下载模板
+
+
+
+
+ +
+
+

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

+
+
+
+
+@Html.AppendJsFile("/Areas/EducationalAdministration/Views/StuInfoFresh/ExcelImportPay.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/ExcelImportPay.css b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/ExcelImportPay.css new file mode 100644 index 000000000..04b556b7a --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/ExcelImportPay.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/StuInfoFresh/ExcelImportPay.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/ExcelImportPay.js new file mode 100644 index 000000000..adc35081d --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/ExcelImportPay.js @@ -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('
' + 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 + '/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 = $('
'); + $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/StuInfoFresh/PayFeeIndex.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/PayFeeIndex.cshtml index 3a6566197..d5d781461 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/PayFeeIndex.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/PayFeeIndex.cshtml @@ -37,6 +37,7 @@  现场缴费  其他费用缴费  取消其他费用缴费 +  导入缴费明细 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/PayFeeIndex.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/PayFeeIndex.js index 8c3c68bc3..ad781e6b0 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/PayFeeIndex.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/PayFeeIndex.js @@ -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'); 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 909ff2cb2..46ad06afd 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 @@ -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 视图功能 /// /// 导入模板管理页面 @@ -287,6 +289,37 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers } } + /// + /// 导入缴费明细(西昌) + /// + /// + /// + /// + /// + /// + [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("导入数据失败!"); + } + } + /// /// 下载文件(导入文件未被导入的数据) /// diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/OrderDetail.xls b/Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/OrderDetail.xls new file mode 100644 index 000000000..3b8c7780a Binary files /dev/null and b/Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/OrderDetail.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 9c8aee1fc..3b06e5129 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 @@ -1102,6 +1102,8 @@ + + @@ -7905,6 +7907,8 @@ + + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/database.config b/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/database.config index dcab597cd..20c13b189 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/database.config +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/database.config @@ -44,6 +44,5 @@ - - + \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshBLL.cs index 3b2fe7410..87047d221 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshBLL.cs @@ -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); + } + } + } } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshIBLL.cs index 3d834bb6a..eb9ed37d2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshIBLL.cs @@ -257,5 +257,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration IEnumerable GetStuEnrollFeeOrder(string keyValue, bool IsNewOrOld); void SaveStudentCompare(string identityCardNo, int photoCheckStatus, string identPhoto, string scenePhoto); + string ImportOrderDetail(DataTable dt,string fileId, string templateId); } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshService.cs index e8bb8b5a7..081186ab1 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshService.cs @@ -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("select * from StuInfoFresh where IdentityCardNo='" + identityCardNo + "'",null); + var stufresh = BaseRepository("CollegeMIS").FindEntity("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; } + } + + /// + /// 导入缴费数据 + /// + /// + /// 1新生,2老生 + 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 typecodelist = BaseRepository("CollegeMIS").FindList("select * from StuEnrollInvoiceTypeCode"); + IEnumerable stufreshlist = null; + IEnumerable stuinfobasiclist = null; + //老生缴费初始化记录 + IEnumerable stuinfobasicpayfeelist = null; + //获取学生数据 + if (templateId == "1")//新生 + { + stufreshlist = BaseRepository("CollegeMIS").FindList("select StuNo,StuName from StuInfoFresh"); + } + else//老生 + { + stuinfobasiclist = BaseRepository("CollegeMIS").FindList("select StuNo,StuName from StuInfoBasic"); + //老生缴费初始化记录 + stuinfobasicpayfeelist = BaseRepository("CollegeMIS").FindList("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(cacheKey + fileId, errordt, CacheId.excel); + } + } + return snum + "|" + fnum; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } } }