From b0a9717126814fd7cb9c02302e55fc71443a3a16 Mon Sep 17 00:00:00 2001
From: fzp <645608524@qq.com>
Date: Sat, 19 Aug 2023 23:56:35 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E7=BA=BF=E4=B8=8B=E7=BC=B4?=
=?UTF-8?q?=E8=B4=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../FinaChargeStuOrderController.cs | 39 +++
.../Views/FinaChargeStuBalance/Index.cshtml | 4 +-
.../Views/FinaChargeStuBalance/Index.js | 5 +-
.../Views/FinaChargeStuOrder/Import.cshtml | 26 ++
.../Views/FinaChargeStuOrder/Import.js | 175 +++++++++++++
.../Views/FinaChargeStuOrder/Index.js | 14 +-
.../Content/excel/线下缴费记录.xls | Bin 0 -> 23552 bytes
.../Learun.Application.Web.csproj | 3 +
.../FinaChargeStuBalanceService.cs | 22 +-
.../FinaChargeStuOrderBLL.cs | 19 ++
.../FinaChargeStuOrderIBLL.cs | 1 +
.../FinaChargeStuOrderService.cs | 246 +++++++++++++++++-
.../FinaChargeStuYearItemService.cs | 1 +
13 files changed, 530 insertions(+), 25 deletions(-)
create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuOrder/Import.cshtml
create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuOrder/Import.js
create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/线下缴费记录.xls
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Controllers/FinaChargeStuOrderController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Controllers/FinaChargeStuOrderController.cs
index 1f5b0a004..cd1829891 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Controllers/FinaChargeStuOrderController.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Controllers/FinaChargeStuOrderController.cs
@@ -3,6 +3,8 @@ using System.Data;
using Learun.Application.TwoDevelopment.ReceiveSendFeeManagement;
using System.Web.Mvc;
using System.Collections.Generic;
+using Learun.Application.Base.SystemModule;
+using Learun.Util.Operat;
namespace Learun.Application.Web.Areas.ReceiveSendFeeManagement.Controllers
{
@@ -16,6 +18,7 @@ namespace Learun.Application.Web.Areas.ReceiveSendFeeManagement.Controllers
public class FinaChargeStuOrderController : MvcControllerBase
{
private FinaChargeStuOrderIBLL finaChargeStuOrderIBLL = new FinaChargeStuOrderBLL();
+ private AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL();
#region 视图功能
@@ -37,6 +40,12 @@ namespace Learun.Application.Web.Areas.ReceiveSendFeeManagement.Controllers
{
return View();
}
+
+ [HttpGet]
+ public ActionResult Import()
+ {
+ return View();
+ }
#endregion
#region 获取数据
@@ -111,6 +120,36 @@ namespace Learun.Application.Web.Areas.ReceiveSendFeeManagement.Controllers
}
return Success("保存成功!");
}
+
+ ///
+ /// 导入
+ ///
+ ///
+ ///
+ ///
+ ///
+ [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 = finaChargeStuOrderIBLL.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("导入数据失败!");
+ }
+ }
#endregion
}
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuBalance/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuBalance/Index.cshtml
index c506e3c84..517bf9fdc 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuBalance/Index.cshtml
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuBalance/Index.cshtml
@@ -2,7 +2,7 @@
ViewBag.Title = "费用变更明细";
Layout = "~/Views/Shared/_Index.cshtml";
}
-
+
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuBalance/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuBalance/Index.js
index a6123d2ef..5a719781a 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuBalance/Index.js
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuBalance/Index.js
@@ -15,7 +15,6 @@ var bootstrap = function ($, learun) {
page.bind();
},
bind: function () {
- $("#ChangeType").lrDataItemSelect({ code: 'ChangeType' });
// 时间搜索框
$('#datesearch').lrdate({
dfdata: [
@@ -46,6 +45,8 @@ var bootstrap = function ($, learun) {
$('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
page.search(queryJson);
}, 220, 400);
+ $("#ChangeType").lrDataItemSelect({ code: 'ChangeType' });
+
// 刷新
$('#lr_refresh').on('click', function () {
location.reload();
@@ -53,7 +54,7 @@ var bootstrap = function ($, learun) {
},
// 初始化列表
initGird: function () {
- $('#gridtable').lrAuthorizeJfGrid({
+ $('#gridtable').jfGrid({
url: top.$.rootUrl + '/ReceiveSendFeeManagement/FinaChargeStuBalance/GetPageList',
headData: [
{ label: "学号", name: "StuNo", width: 100, align: "left" },
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuOrder/Import.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuOrder/Import.cshtml
new file mode 100644
index 000000000..f75886794
--- /dev/null
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuOrder/Import.cshtml
@@ -0,0 +1,26 @@
+@{
+ ViewBag.Title = "Form";
+ Layout = "~/Views/Shared/_Form.cshtml";
+}
+
+
+@Html.AppendCssFile("/Areas/LR_SystemModule/Views/ExcelImport/ImportForm.css")
+
+
+
+@Html.AppendJsFile("/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuOrder/Import.js")
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuOrder/Import.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuOrder/Import.js
new file mode 100644
index 000000000..fcb9330fd
--- /dev/null
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuOrder/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/FinaChargeStuOrder/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('
' + 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 {
+ learun.alert.error(res.info);
+ $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 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 = $('
');
+ $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();
+}
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuOrder/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuOrder/Index.js
index b773dda8a..322e84bf5 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuOrder/Index.js
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuOrder/Index.js
@@ -52,8 +52,20 @@ var bootstrap = function ($, learun) {
$('#lr_refresh').on('click', function () {
location.reload();
});
- // 导入
+ // 导入
$('#lr_import').on('click', function () {
+ learun.layerForm({
+ id: 'indexImport',
+ title: "导入线下缴费记录",
+ url: top.$.rootUrl + '/ReceiveSendFeeManagement/FinaChargeStuOrder/Import',
+ width: 600,
+ height: 400,
+ maxmin: true,
+ btn: null,
+ end: function () {
+ refreshGirdData();
+ }
+ });
});
//明细
$('#lr_detail').on('click', function () {
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/线下缴费记录.xls b/Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/线下缴费记录.xls
new file mode 100644
index 0000000000000000000000000000000000000000..d8cec16f6f93bed6eb25251c0f65f944cbe90811
GIT binary patch
literal 23552
zcmeHP36NC98UEkfIo`4^%W^Epu{-Pn%YE!}3b=Sj0|5ae6bLBHiX{e%Af=@nR->^D
zps)}iu*MK2mqvq{pcNCa%F>Eib0`#n5QB+YrbtjpETSb&zOUcBnRh#5Fh}L}R=;`u
zclY=I{rBI0AJaR({#E6%U3+@JCa!R
`Fv3~H6y=-|4W~Y~3WiL=INtkM`^2pKl`bbsB>Y%b}X9*XI
zDmFoeN`uJa6wrsJ6#K=g$=PI9o;;y;M6F6pTb!znjg%qyLsfgdp(%T%p(#g=Cb;=?
zoXj9Z9zI*uK?6WjQ=aK~875+9xW+R78UN|`WzHmr&tOok-
zZO>K8aui8H<9%{P$j63(Bw+>uB;_jOL{bHh!TuTE%b;*B>`#%-nen|0yk{;%bW;_d
zOb@K9u~V#|yKv|>8DbAO^`E2vAb|e;0Q#c=^qm3p#{%e&1kmpfpsx#{2gwtJ|AfLx
zLM6%$b9(qj0Ns?wTi%q%OMfT;XHNkANkvacsVUDtRBz#7_M>6R`FAJ1)S@4dS$M6n
z%6D?o%PcxxO#B1NSSmbp7yemR`J8@CJ1O_jO*`pq(GSSgm=ALDB;XX4o?Y!qz%%>N
zA(%0b??KOI0X)_#7ZaJqZsd05dgCuH?jS!wFc)Mu5AZtB@J
zPTMOhtIDdN{~f8@jP7z94KWwam2K^B9B(m3NQ;Bc0=ksL&zIm$LsSz2CehAV59rLo>PKv5PKT}i%I-sH|&;u1!fv%~j
z3iMe;RiJYUt#F=eJkV>E1doT98Yt;znjBW8Sa+sUEruI}F0KF&nqe>q{b2zhG|gZT
zI?n-sxEwNOi|K*IhUAYr=c;tcls3u65c!5Xxf?+C`owlU`132NOYWN4H^eqSr6#j7nY7Qty-?xUamOJ3%3CG
zxNH2l3hw3B*qoSwy~B)fmocs|knnkDd|@Er^Uj3AK*HypiG_iL&pVR}198qf?%u%x
ztIdeo(=MyadBx-HHY0Kmz{vo~dj*aQhpk&6eqO;o*er{+(+VGeZlR{Qgj(Y-RHozW
zxt4wUu4-ydDB8ToLtC24WI8-TJ^uLP9#>_jS(+jZ*eY1A%1+y?_m?ixS+oWjEdwPb
zBM{G7T(bV|^py+Rx39V*g(LGeVdd$735nP&bPsbZ*3@Fy00wXc)I!I(ck&=?HbOv(TDG#P`>nnS-y#M^YM3I_2=6y
zobOm4zC%O#n$A?|Ihk&L{SSZf=i5D;?>Ha6BSZO`{#Wre(#=Os{LP(Zt>?^9nRO!o(G5WwcB$;<8z00`tz*`=j&(B!$bMn
z?YW_G&o^K2=bH-W>u1lSL;2e6xuLP`rKA3Q`-k)Ov*)p)eC_t!(D=c=`~3LEq_#Dl
zX*2r5{lnt2L5s&TCGw>;iP;CPCuy@@Ds|Y4XvyWYD49sjm86GBH)3xf}~_3_S_mB(V#bdHYY%2qF&5BhvESh?O}+
z)5-%7Gfm&w$K?SL2jvlI({9ABIYiTb0}#yttSiL&JR+@il&jUY
zg0_G88`oYj=Yq?pEN?Sza!Jt>{POvBS$KG&G>E3;rVL9KZrBn^gOtTgS+bZZOBORl
zSw>NoKi%`*Dtgm5_sHV+D}7k2`r=92^BAa
zKo`uJF*7lH%T~6OHq_XfK*<5Fl8H<*SJG}rJ+N*yMDuRhE^q?G`eh8y#?Bg1c~6IJ
z8pO!;>1Mr$jPv5t0lM+~d+_bkJ#GTbn&Gt>;*a;@(;d3;2YT@B)4IscpUn5ipWwx(
zb9Cbm@!;F1Z@9E&-}1+w=*6e&bmNck;M=EZkhB;@^>nX>y34HtUM5oYFbxiH1#pZ4M3UGYyl`17d8YDZJk8Ylna
z{b{L8CI7cpytt{&Sme~B-U=ODBwjXR89vco2qIl-DoTMyz^_k*@P)>{vE{dxR7s~LzQ
zOMkD)hw=;MgXo8_MB$hG%?nP=QEC&Ox0)fF^~(J6x$Z2??yNO-?W7H>7kzt?I~$j_
z$EPQ4xMll^HC1a*&54_(O;Y*XcW!Z)x552p)BW3>*;6ZQ*-xh{7Mt0pcwGWvYDEU$
z5E#-4-%9Yx#ZsdRQDvz|6`nln)@3Wyv(=V!{u`R?1Z}5{Ms=L=OC1BR^iR2dfWTp9LifwLu~Ie#FWDxxpa<$%`T~hM3jbq
zI%JurH>&VTll7@dyDMSZ-YmhNlviLdib}_5S!MY&3|)?uvcC~@
zUe7V5q*KN}7w8-_eD7>FMXQk0%CZD{V=zh=R5NRONK%{|41Ca*8H4wJ{*AKpQuzh5oE}OSu|3CcwN4fvskI20~&j+~g
z=Rb|jLgYV1&O_wheF-A>`^yn|=zb$2&jENIz;l6Jh}JoPxqt7h>Vq8kSq)&8<=KPz
z9ZCMRA^+MaXQ3d$d8oj`Pd{|%)Skbpy3tty^bv(f1Ca(I4MZA+Y}`-f4b_xfBwxViD%@l(CR9mWUHYO#w4;>4r+H3RI3&CNjk|C{npg4IZeuDPb+4%nxh(&Sr
literal 0
HcmV?d00001
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 af0e0eca3..51a81ebc9 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
@@ -1631,6 +1631,7 @@
+
@@ -7987,6 +7988,8 @@
+
+
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuBalance/FinaChargeStuBalanceService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuBalance/FinaChargeStuBalanceService.cs
index ecd62c8ad..f3144c848 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuBalance/FinaChargeStuBalanceService.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuBalance/FinaChargeStuBalanceService.cs
@@ -30,23 +30,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
try
{
var strSql = new StringBuilder();
- strSql.Append("SELECT ");
- strSql.Append(@"
- t.Id,
- t.StuNo,
- t.FSYear,
- t.ChargeItemCode,
- t.ChargeItemName,
- t.Standard,
- t.DJAmount,
- t.PaymentAmount,
- t.QJAmount,
- t.OldBalance,
- t.ChangeAmount,
- t.NowBalance,
- t.ChangeDate,
- t.ChangeType
- ");
+ strSql.Append("SELECT * ");
strSql.Append(" FROM FinaChargeStuBalance t ");
strSql.Append(" WHERE 1=1 ");
var queryParam = queryJson.ToJObject();
@@ -75,8 +59,8 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
}
if (!queryParam["ChangeType"].IsEmpty())
{
- dp.Add("ChangeType", "%" + queryParam["ChangeType"].ToString() + "%", DbType.String);
- strSql.Append(" AND t.ChangeType Like @ChangeType ");
+ dp.Add("ChangeType", "" + queryParam["ChangeType"].ToString() + "", DbType.String);
+ strSql.Append(" AND t.ChangeType =@ChangeType ");
}
return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(),dp, pagination);
}
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuOrder/FinaChargeStuOrderBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuOrder/FinaChargeStuOrderBLL.cs
index 148f651b0..9552bd2e0 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuOrder/FinaChargeStuOrderBLL.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuOrder/FinaChargeStuOrderBLL.cs
@@ -138,6 +138,25 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
}
}
+ public string ExecuteImportExcel(DataTable dt, string fileGuid, string queryJson)
+ {
+ try
+ {
+ return finaChargeStuOrderService.ExecuteImportExcel(dt, fileGuid, queryJson);
+ }
+ catch (Exception ex)
+ {
+ if (ex is ExceptionEx)
+ {
+ throw;
+ }
+ else
+ {
+ throw ExceptionEx.ThrowBusinessException(ex);
+ }
+ }
+ }
+
#endregion
}
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuOrder/FinaChargeStuOrderIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuOrder/FinaChargeStuOrderIBLL.cs
index 9070d914e..2bf76e7da 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuOrder/FinaChargeStuOrderIBLL.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuOrder/FinaChargeStuOrderIBLL.cs
@@ -45,5 +45,6 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
#endregion
void SaveOrderData(FinaChargeStuYearEntity entity, List list);
+ string ExecuteImportExcel(DataTable dt, string fileGuid, string queryJson);
}
}
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuOrder/FinaChargeStuOrderService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuOrder/FinaChargeStuOrderService.cs
index 408989bd9..46a5da81a 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuOrder/FinaChargeStuOrderService.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuOrder/FinaChargeStuOrderService.cs
@@ -6,6 +6,9 @@ using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
+using Learun.Application.Base.SystemModule;
+using Learun.Cache.Base;
+using Learun.Cache.Factory;
namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
{
@@ -18,6 +21,9 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
///
public class FinaChargeStuOrderService : RepositoryFactory
{
+ private ICache cache = CacheFactory.CaChe();
+ private string cacheKey = "Learun_adms_excelError_";
+ private DataItemService datarItemService = new DataItemService();
#region 获取数据
///
@@ -211,7 +217,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
order.YJAmount = list.Sum(x => x.YJAmount);
order.SJAmount = list.Sum(x => x.SJAmount);
order.DJAmount = order.YJAmount - order.SJAmount;
- if (order.DJAmount<0)
+ if (order.DJAmount < 0)
{
order.NowBlance = Math.Abs(order.DJAmount.Value);
order.DJAmount = 0;
@@ -248,5 +254,243 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
}
}
}
+
+ public string ExecuteImportExcel(DataTable dt, string fileGuid, string queryJson)
+ {
+ 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 dataitemlist = datarItemService.GetDetailList("PayTypeOffLine");
+ //获取已有年度学生缴费记录
+ var oldFinaChargeStuYearList = BaseRepository("CollegeMIS").FindList();
+ //获取已有年度学生缴费明细记录
+ var oldFinaChargeStuYearItemList = BaseRepository("CollegeMIS").FindList("select a.*,b.StuNo from FinaChargeStuYearItem a left join FinaChargeStuYear b on a.FSYId=b.FSYId where ChargeItemType=1 and F_DeleteMark=0 and RefundStatus=0");
+ foreach (DataRow dr in dt.Rows)
+ {
+ var db = this.BaseRepository("CollegeMIS").BeginTrans();
+ try
+ {
+ IEnumerable finaChargeStuYearItemList = null;
+ FinaChargeStuYearItemEntity finaChargeStuYearItemEntity = null;
+ FinaChargeStuYearEntity finaChargeStuYearEntity = null;
+ int ChangeType = 0;
+ //检测是否有空值
+ if (dr[0].ToString() == "" || dr[1].ToString() == "" || dr[2].ToString() == "" || dr[3].ToString() == "" || dr[4].ToString() == "" || dr[5].ToString() == "" || dr[6].ToString() == "")
+ {
+ throw new Exception("行内数据有空值,不能为空!");
+ }
+ //检测缴费年度是否为数字
+ decimal payyearresult = 0;
+ bool parsepayyearresult = decimal.TryParse(dr[2].ToString(), out payyearresult);
+ if (!parsepayyearresult || dr[2].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("【金额】不能为零或小于零,必须为正数!");
+ }
+ //筛选不在收费学生表内的数据
+ finaChargeStuYearEntity = oldFinaChargeStuYearList.FirstOrDefault(m => m.StuNo == dr[0].ToString() && m.FSYear == payyearresult);
+ finaChargeStuYearItemList = oldFinaChargeStuYearItemList.Where(m => m.StuNo == dr[0].ToString() && m.StuName == dr[1].ToString() && m.FSYear == payyearresult);
+ if (finaChargeStuYearEntity == null || finaChargeStuYearItemList.Count()==0)
+ {
+ throw new Exception("【年度收费学生】不存在,请核对!");
+ }
+ else
+ {
+ //筛选已缴费的学生
+ if (finaChargeStuYearEntity.PayFeeStatus == 1)
+ {
+ throw new Exception("【年度收费学生】已缴费,请核对!");
+ }
+ }
+ //缴费方式判断
+ var itemcodeentity = dataitemlist.FirstOrDefault(m=>m.F_ItemName==dr[6].ToString());
+ if (itemcodeentity==null)
+ {
+ throw new Exception("【缴费方式】只能为现金或贷款,请核对!");
+ }
+ int itemcodeint = 0;
+ if (!int.TryParse(itemcodeentity.F_ItemCode,out itemcodeint))
+ {
+ throw new Exception("【线下缴费方式字典(PayTypeOffLine)】值code只能为整数,请核对!");
+ }
+ //缴费明细判断
+ finaChargeStuYearItemEntity =finaChargeStuYearItemList.FirstOrDefault(m=>m.ChargeItemCode==dr[3].ToString());
+ if (finaChargeStuYearItemEntity==null)
+ {
+ throw new Exception("【年度学生收费明细】不存在,请核对!");
+ }
+ else
+ {
+ //筛选已缴费的学生
+ if (finaChargeStuYearItemEntity.PayFeeStatus == 1)
+ {
+ throw new Exception("【年度学生收费明细】已缴费,请核对!");
+ }
+ }
+ //开始导入
+ //生成订单
+ FinaChargeStuOrderEntity orderEntity=new FinaChargeStuOrderEntity();
+ orderEntity.Create();
+ orderEntity.FSYId = finaChargeStuYearItemEntity.FSYId;
+ orderEntity.YearNo = finaChargeStuYearItemEntity.FSYear;
+ orderEntity.StuNo = finaChargeStuYearItemEntity.StuNo;
+ Random ran = new Random();
+ orderEntity.orderid = DateTime.Now.ToString("yyyyMMddhhmmss") + ran.Next(0, 100000);
+ orderEntity.YJAmount = finaChargeStuYearItemEntity.Standard;
+ orderEntity.SJAmount = dresult;
+ orderEntity.DJAmount = orderEntity.YJAmount-orderEntity.SJAmount;
+ if (orderEntity.DJAmount < 0)//有结余
+ {
+ orderEntity.NowBlance = Math.Abs(orderEntity.DJAmount.Value);
+ orderEntity.DJAmount = 0;
+ }
+ orderEntity.PlaceOrderTime = DateTime.Now;
+ orderEntity.Status = 1;
+ orderEntity.OrderType = 2;
+ db.Insert(orderEntity);
+ //订单明细
+ FinaChargeStuOrderDetailEntity detail = new FinaChargeStuOrderDetailEntity();
+ detail.Create();
+ detail.FCSOId = orderEntity.Id;
+ detail.ChargeItemCode = finaChargeStuYearItemEntity.ChargeItemCode;
+ detail.ChargeItemName = finaChargeStuYearItemEntity.ChargeItemName;
+ detail.YJAmount = finaChargeStuYearItemEntity.Standard;
+ detail.SJAmount = dresult;
+ detail.DJAmount = detail.YJAmount - detail.SJAmount;
+ if (detail.DJAmount < 0)//有结余
+ {
+ detail.NowBlance = Math.Abs(detail.DJAmount.Value);
+ detail.DJAmount = 0;
+ }
+ db.Insert(detail);
+ //判断实缴金额是否缴清费用
+ decimal sjcount = Convert.ToDecimal(db.FindObject("select isnull(sum(SJAmount),0) from FinaChargeStuOrder where StuNo='" + orderEntity.StuNo + "' and Status=1 and YearNo='" + orderEntity.YearNo + "' "));
+ //增加本次缴费金额
+ sjcount = sjcount + orderEntity.SJAmount.Value;
+ decimal yjcount = orderEntity.YJAmount.Value;
+ if (sjcount >= yjcount)
+ {
+ //更新缴费状态
+ db.ExecuteBySql("update FinaChargeStuYear set PayFeeStatus='1' where FSYId='" + finaChargeStuYearItemEntity.FSYId + "'");
+ }
+ else//更新部分缴费状态
+ {
+ //更新缴费状态
+ db.ExecuteBySql("update FinaChargeStuYear set PayFeeStatus='4' where FSYId='" + finaChargeStuYearItemEntity.FSYId + "'");
+ }
+ //费用变更明细
+ FinaChargeStuBalanceEntity finaChargeStuBalanceEntity = new FinaChargeStuBalanceEntity();
+ finaChargeStuBalanceEntity.Create();
+ finaChargeStuBalanceEntity.StuNo = orderEntity.StuNo;
+ finaChargeStuBalanceEntity.FSYear = orderEntity.YearNo;
+ finaChargeStuBalanceEntity.FCSOId = orderEntity.Id;
+ finaChargeStuBalanceEntity.ChargeItemCode = detail.ChargeItemCode;
+ finaChargeStuBalanceEntity.ChargeItemName = detail.ChargeItemName;
+ finaChargeStuBalanceEntity.Standard = finaChargeStuYearItemEntity.Standard;
+ finaChargeStuBalanceEntity.DJAmount = finaChargeStuYearItemEntity.FSBlance < 0 ? Math.Abs(finaChargeStuYearItemEntity.FSBlance.Value) : 0;
+ finaChargeStuBalanceEntity.PaymentAmount = dresult;
+ finaChargeStuBalanceEntity.QJAmount = finaChargeStuYearItemEntity.Standard - dresult>0?finaChargeStuYearItemEntity.Standard - dresult:0;
+ finaChargeStuBalanceEntity.OldBalance = finaChargeStuYearItemEntity.FSBlance <= 0? 0: finaChargeStuYearItemEntity.FSBlance;
+ finaChargeStuBalanceEntity.ChangeAmount = dresult;
+ finaChargeStuBalanceEntity.NowBalance = finaChargeStuYearItemEntity.FSBlance + dresult > 0? finaChargeStuYearItemEntity.FSBlance + dresult: 0;
+ finaChargeStuBalanceEntity.ChangeDate = DateTime.Now;
+ finaChargeStuBalanceEntity.ChangeType = itemcodeint;
+ db.Insert(finaChargeStuBalanceEntity);
+ //FinaChargeStuYearItem表
+ finaChargeStuYearItemEntity.SJAmount = finaChargeStuYearItemEntity.SJAmount+ dresult;
+ finaChargeStuYearItemEntity.FSBlance = finaChargeStuYearItemEntity.FSBlance+ dresult;
+ finaChargeStuYearItemEntity.PayFeeStatus = finaChargeStuYearItemEntity.FSBlance>0?1:4;
+ db.Update(finaChargeStuYearItemEntity);
+ //FinaChargeStuYear表
+ db.ExecuteBySql("update FinaChargeStuYear set SJAmount=SJAmount+"+ dresult + ",FSBlance=FSBlance+"+dresult+ ",PayFeeStatus=(case when(FSBlance+"+ dresult + ">=0) then 1 else 4 end) where FSYId='" + finaChargeStuYearItemEntity.FSYId + "'");
+ //FinaChargeStudent表
+ db.ExecuteBySql("update FinaChargeStudent set FSBlance=FSBlance+"+ dresult + " where StuNo='" + finaChargeStuYearItemEntity.StuNo+ "'");
+ db.Commit();
+ }
+ catch (Exception ex)
+ {
+ db.Rollback();
+ fnum++;
+ dr["导入错误"] = ex.Message;
+ failDt.Rows.Add(dr.ItemArray);
+ }
+ }
+ //自动分配超出金额
+ AutoCharge();
+ // 写入缓存如果有未导入的数据
+ if (failDt.Rows.Count > 0)
+ {
+ string errordt = failDt.ToJson();
+ cache.Write(cacheKey + fileGuid, errordt, CacheId.excel);
+ }
+ }
+ return snum + "|" + fnum;
+ }
+ catch (Exception ex)
+ {
+ if (ex is ExceptionEx)
+ {
+ throw;
+ }
+ else
+ {
+ throw ExceptionEx.ThrowServiceException(ex);
+ }
+ }
+ }
+
+ ///
+ /// 自动分配固定项目缴费多余金额
+ ///
+ ///
+ public void AutoCharge(int YearNo=0)
+ {
+ try
+ {
+ //获取有缴费余额的固定项目
+ var FinaChargeStuYearItemHasBalance = BaseRepository("CollegeMIS").FindList("select a.*,b.StuNo from FinaChargeStuYearItem a left join FinaChargeStuYear b on a.FSYId=b.FSYId where ChargeItemType=1 and F_DeleteMark=0 and a.FSBlance>0");
+ //获取欠费的固定项目
+ var FinaChargeStuYearItemHasDJ = BaseRepository("CollegeMIS").FindList("select a.*,b.StuNo from FinaChargeStuYearItem a left join FinaChargeStuYear b on a.FSYId=b.FSYId where ChargeItemType=1 and F_DeleteMark=0 and a.FSBlance<0");
+ foreach (var hasBalanceItem in FinaChargeStuYearItemHasBalance)
+ {
+ //可分配余额
+ decimal balance = hasBalanceItem.FSBlance.Value;
+ }
+ }
+ catch (Exception ex)
+ {
+ if (ex is ExceptionEx)
+ {
+ throw;
+ }
+ else
+ {
+ throw ExceptionEx.ThrowServiceException(ex);
+ }
+ }
+
+
+ }
}
}
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuYearItem/FinaChargeStuYearItemService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuYearItem/FinaChargeStuYearItemService.cs
index 1ba14adcf..05904acbd 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuYearItem/FinaChargeStuYearItemService.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuYearItem/FinaChargeStuYearItemService.cs
@@ -396,6 +396,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
}
catch (Exception ex)
{
+ db.Rollback();
if (ex is ExceptionEx)
{
throw;