@@ -6,6 +6,7 @@ using System.Collections.Generic; | |||||
using Learun.Application.TwoDevelopment.EducationalAdministration; | using Learun.Application.TwoDevelopment.EducationalAdministration; | ||||
using System.Linq; | using System.Linq; | ||||
using System; | using System; | ||||
using Learun.Application.Base.SystemModule; | |||||
using Learun.Util.Operat; | using Learun.Util.Operat; | ||||
using static Learun.Util.WebHelper; | using static Learun.Util.WebHelper; | ||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
@@ -23,6 +24,7 @@ namespace Learun.Application.Web.Areas.ReceiveSendFeeManagement.Controllers | |||||
{ | { | ||||
private FinaChargesStandardIBLL finaChargesStandardIBLL = new FinaChargesStandardBLL(); | private FinaChargesStandardIBLL finaChargesStandardIBLL = new FinaChargesStandardBLL(); | ||||
private FinaChargeItemIBLL finaChargeItemIBLL = new FinaChargeItemBLL(); | private FinaChargeItemIBLL finaChargeItemIBLL = new FinaChargeItemBLL(); | ||||
private AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL(); | |||||
#region 视图功能 | #region 视图功能 | ||||
@@ -44,6 +46,11 @@ namespace Learun.Application.Web.Areas.ReceiveSendFeeManagement.Controllers | |||||
{ | { | ||||
return View(); | return View(); | ||||
} | } | ||||
[HttpGet] | |||||
public ActionResult Import() | |||||
{ | |||||
return View(); | |||||
} | |||||
/// <summary> | /// <summary> | ||||
/// 编辑表单页 | /// 编辑表单页 | ||||
/// <summary> | /// <summary> | ||||
@@ -295,7 +302,35 @@ namespace Learun.Application.Web.Areas.ReceiveSendFeeManagement.Controllers | |||||
#endregion | #endregion | ||||
#region 扩展数据 | #region 扩展数据 | ||||
/// <summary> | |||||
/// 导入 | |||||
/// </summary> | |||||
/// <param name="fileGuid"></param> | |||||
/// <param name="chunks"></param> | |||||
/// <param name="queryJson"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
[ValidateAntiForgeryToken] | |||||
public ActionResult ExecuteImportExcel(string fileGuid, int chunks, string queryJson) | |||||
{ | |||||
string path = annexesFileIBLL.SaveAnnexes(fileGuid, fileGuid, chunks, LoginUserInfo.Get()); | |||||
if (!string.IsNullOrEmpty(path)) | |||||
{ | |||||
DataTable dt = ExcelHelper.ExcelImport(path); | |||||
string res = finaChargesStandardIBLL.ExecuteImportExcel(dt, fileGuid, queryJson); | |||||
var data = new | |||||
{ | |||||
Success = res.Split('|')[0], | |||||
Fail = res.Split('|')[1] | |||||
}; | |||||
Success_FinaCharge("导入成功!", "收费标准设置", OperationType.Create, "", "导入收费标准设置成功:" + res.Split('|')[0] + "条,失败:" + res.Split('|')[1] + "条"); | |||||
return JsonResult(data); | |||||
} | |||||
else | |||||
{ | |||||
return Fail("导入数据失败!"); | |||||
} | |||||
} | |||||
/// <summary> | /// <summary> | ||||
/// 学年 | /// 学年 | ||||
/// </summary> | /// </summary> | ||||
@@ -12,4 +12,4 @@ | |||||
</div> | </div> | ||||
<div class="tab-content lr-tab-content" id="lr_tab_content"> | <div class="tab-content lr-tab-content" id="lr_tab_content"> | ||||
</div> | </div> | ||||
@Html.AppendJsFile("/Areas/EducationalAdministration/Views/StuInfoBasic_PayFee/InvoiceForm.js") | |||||
@Html.AppendJsFile("/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuYear/InvoiceForm.js") |
@@ -0,0 +1,26 @@ | |||||
@{ | |||||
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/LR_SystemModule/Views/ExcelImport/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/ReceiveSendFeeManagement/Views/FinaChargesStandard/Import.js") |
@@ -0,0 +1,175 @@ | |||||
/* | |||||
* 描 述:附件上传管理 | |||||
*/ | |||||
var gridId = request('gridtable'); | |||||
var bootstrap = function ($, learun) { | |||||
"use strict"; | |||||
var fileInfo = {}; | |||||
// 触发合并文件碎片 | |||||
var mergeFileChunks = function (file) { | |||||
var param = {}; | |||||
param['__RequestVerificationToken'] = $.lrToken; | |||||
param['fileGuid'] = fileInfo[file.id].fileGuid; | |||||
param['fileName'] = fileInfo[file.id].name; | |||||
param['chunks'] = fileInfo[file.id].chunks; | |||||
var queryJson = JSON.stringify(learun.frameTab.currentIframe().queryJson); | |||||
param['queryJson'] = queryJson; | |||||
learun.httpAsyncPost(top.$.rootUrl + "/ReceiveSendFeeManagement/FinaChargesStandard/ExecuteImportExcel", 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 { | |||||
learun.alert.error(res.info); | |||||
$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 DeleteFile = function (fileId) { | |||||
var param = {}; | |||||
param['__RequestVerificationToken'] = $.lrToken; | |||||
param['fileId'] = fileInfo[fileId].fileGuid; | |||||
learun.httpAsyncPost(top.$.rootUrl + "/LR_SystemModule/Annexes/DeleteAnnexesFile", param, function (res) { }); | |||||
var file = page.uploader.getFile(fileId); | |||||
if (!!file) { | |||||
page.uploader.removeFile(file); | |||||
} | |||||
delete fileInfo[fileId]; | |||||
var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + fileId); | |||||
$fileItem.remove(); | |||||
if ($('#lr_form_file_queue_list>div').length == 0) { | |||||
$('#lr_form_file_queue .lr-form-file-queue-bg').show(); | |||||
} | |||||
} | |||||
var page = { | |||||
uploader: null, | |||||
init: function () { | |||||
if (!WebUploader.Uploader.support()) { | |||||
alert('Web Uploader 不支持您的浏览器!如果你使用的是IE浏览器,请尝试升级 flash 播放器'); | |||||
throw new Error('WebUploader does not support the browser you are using.'); | |||||
} | |||||
/*导入模板下载*/ | |||||
$('#lr_down_file_btn').on('click', function () { | |||||
learun.download({ | |||||
method: "get", | |||||
url: '/Content/excel/收费标准设置.xls' | |||||
}); | |||||
}); | |||||
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: false, | |||||
// 不压缩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').mCustomScrollbar({ // 优化滚动条 | |||||
// theme: "minimal-dark" | |||||
//}); | |||||
}, | |||||
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_delete" class="btn btn-default"><i class="fa fa-trash-o"></i> 删除</a> | <a id="lr_delete" class="btn btn-default"><i class="fa fa-trash-o"></i> 删除</a> | ||||
<a id="lr_lock" class="btn btn-default"><i class="fa fa-lock"></i> 审核</a> | <a id="lr_lock" class="btn btn-default"><i class="fa fa-lock"></i> 审核</a> | ||||
<a id="lr_unlock" class="btn btn-default"><i class="fa fa-unlock"></i> 去审核</a> | <a id="lr_unlock" class="btn btn-default"><i class="fa fa-unlock"></i> 去审核</a> | ||||
<a id="lr_import" class="btn btn-default"><i class="fa fa-file-excel-o"></i> 导入</a> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
@@ -57,6 +57,21 @@ var bootstrap = function ($, learun) { | |||||
majorno = $('#MajorNo').lrselectGet(); | majorno = $('#MajorNo').lrselectGet(); | ||||
page.search(); | page.search(); | ||||
}); | }); | ||||
// 导入 | |||||
$('#lr_import').on('click', function () { | |||||
learun.layerForm({ | |||||
id: 'indexImport', | |||||
title: "导入收费标准", | |||||
url: top.$.rootUrl + '/ReceiveSendFeeManagement/FinaChargesStandard/Import', | |||||
width: 600, | |||||
height: 400, | |||||
maxmin: true, | |||||
btn: null, | |||||
end: function () { | |||||
refreshGirdData(); | |||||
} | |||||
}); | |||||
}); | |||||
// 新增 | // 新增 | ||||
$('#lr_add').on('click', function () { | $('#lr_add').on('click', function () { | ||||
var keyValue = $('#gridtable').jfGridValue('TempId'); | var keyValue = $('#gridtable').jfGridValue('TempId'); | ||||
@@ -1634,6 +1634,7 @@ | |||||
<Content Include="Areas\PersonnelManagement\Views\WorkStudyPositionApply\FormView.js" /> | <Content Include="Areas\PersonnelManagement\Views\WorkStudyPositionApply\FormView.js" /> | ||||
<Content Include="Areas\PersonnelManagement\Views\WorkStudyPositionApply\Index.js" /> | <Content Include="Areas\PersonnelManagement\Views\WorkStudyPositionApply\Index.js" /> | ||||
<Content Include="Areas\ReceiveSendFeeManagement\Views\FinaChargeRefund\FormView.js" /> | <Content Include="Areas\ReceiveSendFeeManagement\Views\FinaChargeRefund\FormView.js" /> | ||||
<Content Include="Areas\ReceiveSendFeeManagement\Views\FinaChargesStandard\Import.js" /> | |||||
<Content Include="Areas\ReceiveSendFeeManagement\Views\FinaChargeStuOrder\Import.js" /> | <Content Include="Areas\ReceiveSendFeeManagement\Views\FinaChargeStuOrder\Import.js" /> | ||||
<Content Include="Areas\ReceiveSendFeeManagement\Views\FinaChargeStuYearItem\Import.js" /> | <Content Include="Areas\ReceiveSendFeeManagement\Views\FinaChargeStuYearItem\Import.js" /> | ||||
<Content Include="Areas\ReceiveSendFeeManagement\Views\FinaChargeStuYearItem\IndexForRefund.js" /> | <Content Include="Areas\ReceiveSendFeeManagement\Views\FinaChargeStuYearItem\IndexForRefund.js" /> | ||||
@@ -7998,6 +7999,8 @@ | |||||
<Content Include="Areas\ReceiveSendFeeManagement\Views\FinaChargeStuOrder\Import.cshtml" /> | <Content Include="Areas\ReceiveSendFeeManagement\Views\FinaChargeStuOrder\Import.cshtml" /> | ||||
<Content Include="Areas\ReceiveSendFeeManagement\Views\FinaChargeRefund\FormView.cshtml" /> | <Content Include="Areas\ReceiveSendFeeManagement\Views\FinaChargeRefund\FormView.cshtml" /> | ||||
<Content Include="Areas\EducationalAdministration\Views\TeachSwitch\FinaCharge.cshtml" /> | <Content Include="Areas\EducationalAdministration\Views\TeachSwitch\FinaCharge.cshtml" /> | ||||
<Content Include="Areas\ReceiveSendFeeManagement\Views\FinaChargesStandard\Import.cshtml" /> | |||||
<Content Include="Content\excel\收费标准设置.xls" /> | |||||
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" /> | <None Include="Properties\PublishProfiles\CustomProfile.pubxml" /> | ||||
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" /> | <None Include="Properties\PublishProfiles\FolderProfile.pubxml" /> | ||||
<Content Include="Views\Login\Default-beifen.cshtml" /> | <Content Include="Views\Login\Default-beifen.cshtml" /> | ||||
@@ -232,7 +232,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement | |||||
try | try | ||||
{ | { | ||||
this.BaseRepository("CollegeMIS").ExecuteBySql(@"insert into FinaChargeStudent(FSId, StuNo, StuName, GenderNo, IdentityCardNo, DeptNo, MajorNo, ClassNo,Grade, Mobile,NeedToPay, FSBlance, F_CheckMark) | this.BaseRepository("CollegeMIS").ExecuteBySql(@"insert into FinaChargeStudent(FSId, StuNo, StuName, GenderNo, IdentityCardNo, DeptNo, MajorNo, ClassNo,Grade, Mobile,NeedToPay, FSBlance, F_CheckMark) | ||||
select newid(), stuno, stuname, genderno, identitycardno, deptno, majorno, classno,grade, mobile, 0,0, 1 from StuInfoBasic a where a.checkmark = 1 and stuno not in(select stuno from FinaChargeStudent)"); | |||||
select newid(), stuno, stuname, genderno, identitycardno, deptno, majorno, classno,grade, mobile, 0,0, 1 from StuInfoBasic a where a.checkmark = 1 and InSchoolStatus=1 and stuno not in(select stuno from FinaChargeStudent)"); | |||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
{ | { | ||||
@@ -351,6 +351,25 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement | |||||
} | } | ||||
} | } | ||||
public string ExecuteImportExcel(DataTable dt, string fileGuid, string queryJson) | |||||
{ | |||||
try | |||||
{ | |||||
return finaChargesStandardService.ExecuteImportExcel(dt, fileGuid, queryJson); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowBusinessException(ex); | |||||
} | |||||
} | |||||
} | |||||
#endregion | #endregion | ||||
} | } | ||||
@@ -102,5 +102,6 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement | |||||
IEnumerable<FinaChargesStandardEntity> GetFinaChargesStandardListByYongYou(string stuNo, int jiaoFeiYear); | IEnumerable<FinaChargesStandardEntity> GetFinaChargesStandardListByYongYou(string stuNo, int jiaoFeiYear); | ||||
void Lock(string deptno, string majorNo, string syear, string grade, string ChargeStandardID); | void Lock(string deptno, string majorNo, string syear, string grade, string ChargeStandardID); | ||||
void UnLock(string deptno, string majorNo, string syear, string grade, string ChargeStandardID); | void UnLock(string deptno, string majorNo, string syear, string grade, string ChargeStandardID); | ||||
string ExecuteImportExcel(DataTable dt, string fileGuid, string queryJson); | |||||
} | } | ||||
} | } |
@@ -6,6 +6,9 @@ using System.Collections.Generic; | |||||
using System.Data; | using System.Data; | ||||
using System.Linq; | using System.Linq; | ||||
using System.Text; | using System.Text; | ||||
using Learun.Application.TwoDevelopment.EducationalAdministration; | |||||
using Learun.Cache.Base; | |||||
using Learun.Cache.Factory; | |||||
namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement | namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement | ||||
{ | { | ||||
@@ -18,6 +21,8 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement | |||||
/// </summary> | /// </summary> | ||||
public class FinaChargesStandardService : RepositoryFactory | public class FinaChargesStandardService : RepositoryFactory | ||||
{ | { | ||||
private ICache cache = CacheFactory.CaChe(); | |||||
private string cacheKey = "Learun_adms_excelError_"; | |||||
#region 获取数据 | #region 获取数据 | ||||
/// <summary> | /// <summary> | ||||
@@ -367,7 +372,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement | |||||
Standard = item.Standard, | Standard = item.Standard, | ||||
SYear = Convert.ToInt32(sYear), | SYear = Convert.ToInt32(sYear), | ||||
CheckMark = false, | CheckMark = false, | ||||
F_DeleteMark=false | |||||
F_DeleteMark = false | |||||
}; | }; | ||||
entity.Create(); | entity.Create(); | ||||
db.Insert(entity); | db.Insert(entity); | ||||
@@ -456,7 +461,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement | |||||
} | } | ||||
} | } | ||||
public void Lock(string deptno, string majorNo, string syear, string grade,string ChargeStandardID) | |||||
public void Lock(string deptno, string majorNo, string syear, string grade, string ChargeStandardID) | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
@@ -466,7 +471,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
BaseRepository("CollegeMIS").ExecuteBySql("update FinaChargesStandard set CheckMark=1 where ChargeStandardID='"+ ChargeStandardID + "'"); | |||||
BaseRepository("CollegeMIS").ExecuteBySql("update FinaChargesStandard set CheckMark=1 where ChargeStandardID='" + ChargeStandardID + "'"); | |||||
} | } | ||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
@@ -507,5 +512,131 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement | |||||
} | } | ||||
} | } | ||||
} | } | ||||
public string ExecuteImportExcel(DataTable dt, string fileGuid, string queryJson) | |||||
{ | |||||
var db = this.BaseRepository("CollegeMIS").BeginTrans(); | |||||
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); | |||||
} | |||||
var cddeptlist = db.FindList<CdDeptEntity>("select * from cddept"); | |||||
var cdmajorlist = db.FindList<CdMajorEntity>("select * from cdmajor where checkmark=1"); | |||||
var finaChargeItemlist = db.FindList<FinaChargeItemEntity>("select * from FinaChargeItem where checkmark=1 and f_deletemark=0"); | |||||
//获取收费标准 | |||||
var finaChargesStandardList = db.FindList<FinaChargesStandardEntity>(@"select a.Grade,a.DeptNo,a.MajorNo,a.Standard,a.SYear,b.ChargeItemName,b.ChargeItemCode,b.ChargeItemType,b.priority,a.ChargeItemID | |||||
from [dbo].[FinaChargesStandard] a left join [dbo].[FinaChargeItem] b on a.ChargeItemID=b.[ChargeItemID] | |||||
where a.F_DeleteMark=0 and a.F_DeleteMark=0 and b.CheckMark=1 and b.F_DeleteMark=0"); | |||||
// 循环遍历导入 | |||||
foreach (DataRow dr in dt.Rows) | |||||
{ | |||||
try | |||||
{ | |||||
//检测是否有空值 | |||||
if (dr[0].ToString() == "" || dr[1].ToString() == "" || dr[2].ToString() == "" || dr[3].ToString() == "" || dr[4].ToString() == "" || dr[5].ToString() == "") | |||||
{ | |||||
throw new Exception("行内数据有空值,不能为空!"); | |||||
} | |||||
//系部检测 | |||||
var deptEntity = cddeptlist.FirstOrDefault(m => m.DeptName == dr[0].ToString()); | |||||
if (deptEntity == null) | |||||
{ | |||||
throw new Exception("【系部】不存在,请确认!"); | |||||
} | |||||
//专业检测 | |||||
var cdmajorEntity = cdmajorlist.FirstOrDefault(m => m.MajorName == dr[1].ToString()&&m.DeptNo== deptEntity.DeptNo); | |||||
if (cdmajorEntity == null) | |||||
{ | |||||
throw new Exception("【专业】不存在或与系部不对应,请确认!"); | |||||
} | |||||
//收费项目检测 | |||||
var finaChargeItemEntity = finaChargeItemlist.FirstOrDefault(m => m.ChargeItemName == dr[4].ToString()); | |||||
if (finaChargeItemEntity == null) | |||||
{ | |||||
throw new Exception("【收费项目】不存在,请确认是否启用!"); | |||||
} | |||||
//检测缴费年度是否为数字 | |||||
int payyearresult = 0; | |||||
bool parsepayyearresult = int.TryParse(dr[3].ToString(), out payyearresult); | |||||
if (!parsepayyearresult || dr[3].ToString().Length != 4) | |||||
{ | |||||
throw new Exception("【缴费年度】格式不正确,必须为四位数字年份!"); | |||||
} | |||||
//首先校验金额是否为数字 | |||||
decimal dresult = 0; | |||||
bool parseresult = decimal.TryParse(dr[5].ToString(), out dresult); | |||||
if (!parseresult) | |||||
{ | |||||
throw new Exception("【金额】转换失败,必须为数字!"); | |||||
} | |||||
//金额不能小于等于零 | |||||
if (dresult <= 0) | |||||
{ | |||||
throw new Exception("【金额】不能为零或小于零,必须为正数!"); | |||||
} | |||||
//年级检测 | |||||
int paygraderesult = 0; | |||||
bool parsepaygraderesult = int.TryParse(dr[2].ToString(), out paygraderesult); | |||||
if (!parsepaygraderesult || dr[2].ToString().Length != 2) | |||||
{ | |||||
throw new Exception("【年级】格式不正确,必须为二位数字年级!"); | |||||
} | |||||
//去重 | |||||
if (finaChargesStandardList.Count(m => m.DeptNo == deptEntity.DeptNo && m.MajorNo ==cdmajorEntity.MajorNo&&m.Grade == paygraderesult.ToString()&& m.SYear==payyearresult&&m.ChargeItemID== finaChargeItemEntity.ChargeItemID) >0) | |||||
{ | |||||
throw new Exception("【收费标准】已存在,不能重复导入!"); | |||||
} | |||||
//开始导入 | |||||
FinaChargesStandardEntity finaChargesStandardEntity=new FinaChargesStandardEntity(); | |||||
finaChargesStandardEntity.Create(); | |||||
finaChargesStandardEntity.ChargeItemID = finaChargeItemEntity.ChargeItemID; | |||||
finaChargesStandardEntity.Grade = paygraderesult.ToString(); | |||||
finaChargesStandardEntity.DeptNo = deptEntity.DeptNo; | |||||
finaChargesStandardEntity.MajorNo = cdmajorEntity.MajorNo; | |||||
finaChargesStandardEntity.Standard = dresult; | |||||
finaChargesStandardEntity.SYear = payyearresult; | |||||
finaChargesStandardEntity.CheckMark = false; | |||||
finaChargesStandardEntity.F_DeleteMark = false; | |||||
db.Insert(finaChargesStandardEntity); | |||||
snum++; | |||||
} | |||||
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 + fileGuid, errordt, CacheId.excel); | |||||
} | |||||
db.Commit(); | |||||
} | |||||
return snum + "|" + fnum; | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
db.Rollback(); | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowServiceException(ex); | |||||
} | |||||
} | |||||
} | |||||
} | } | ||||
} | } |
@@ -7,11 +7,11 @@ export default { | |||||
"enableSignUp": true, | "enableSignUp": true, | ||||
//请求数据的接口地址;可以配置多个,开发环境下登录页会出现选择菜单供您选择 | //请求数据的接口地址;可以配置多个,开发环境下登录页会出现选择菜单供您选择 | ||||
"apiHost": [ | "apiHost": [ | ||||
"http://112.45.152.8:8011/" | |||||
"http://112.45.152.8:8083/" | |||||
// "http://123.57.209.16:31173/" | // "http://123.57.209.16:31173/" | ||||
// "http://112.45.152.8:8083/" | // "http://112.45.152.8:8083/" | ||||
], | ], | ||||
"webHost":"http://112.45.152.8:8010/", | |||||
"webHost":"http://112.45.152.8:8000/", | |||||
// "webHost":"http://112.45.152.8:8000/", | // "webHost":"http://112.45.152.8:8000/", | ||||
// 开发环境下自动填充登录账号密码,与接口地址一一对应,只在开发环境下显示 | // 开发环境下自动填充登录账号密码,与接口地址一一对应,只在开发环境下显示 | ||||
"devAccount": [ | "devAccount": [ | ||||