소스 검색

导入线下缴费

西昌缴费二期
fzp 1 년 전
부모
커밋
b0a9717126
13개의 변경된 파일530개의 추가작업 그리고 25개의 파일을 삭제
  1. +39
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Controllers/FinaChargeStuOrderController.cs
  2. +2
    -2
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuBalance/Index.cshtml
  3. +3
    -2
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuBalance/Index.js
  4. +26
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuOrder/Import.cshtml
  5. +175
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuOrder/Import.js
  6. +13
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuOrder/Index.js
  7. BIN
      Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/线下缴费记录.xls
  8. +3
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj
  9. +3
    -19
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuBalance/FinaChargeStuBalanceService.cs
  10. +19
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuOrder/FinaChargeStuOrderBLL.cs
  11. +1
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuOrder/FinaChargeStuOrderIBLL.cs
  12. +245
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuOrder/FinaChargeStuOrderService.cs
  13. +1
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuYearItem/FinaChargeStuYearItemService.cs

+ 39
- 0
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("保存成功!");
}

/// <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 = 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

}


+ 2
- 2
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuBalance/Index.cshtml 파일 보기

@@ -2,7 +2,7 @@
ViewBag.Title = "费用变更明细";
Layout = "~/Views/Shared/_Index.cshtml";
}
<div class="lr-layout " >
<div class="lr-layout ">
<div class="lr-layout-center">
<div class="lr-layout-wrap lr-layout-wrap-notitle ">
<div class="lr-layout-tool">
@@ -28,7 +28,7 @@
<div class="col-xs-6 lr-form-item">
<div class="lr-form-item-title">变动原因</div>
<div id="ChangeType"></div>
</div>
</div>
</div>
</div>
</div>


+ 3
- 2
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" },


+ 26
- 0
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";
}
<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/FinaChargeStuOrder/Import.js")

+ 175
- 0
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('<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();
}

+ 13
- 1
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 () {


BIN
Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/线下缴费记录.xls 파일 보기


+ 3
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj 파일 보기

@@ -1631,6 +1631,7 @@
<Content Include="Areas\PersonnelManagement\Views\WorkStudyPositionApply\Form.js" />
<Content Include="Areas\PersonnelManagement\Views\WorkStudyPositionApply\FormView.js" />
<Content Include="Areas\PersonnelManagement\Views\WorkStudyPositionApply\Index.js" />
<Content Include="Areas\ReceiveSendFeeManagement\Views\FinaChargeStuOrder\Import.js" />
<Content Include="Areas\ReceiveSendFeeManagement\Views\FinaChargeStuYearItem\Import.js" />
<Content Include="Areas\ReceiveSendFeeManagement\Views\FinaChargeStuYearItem\IndexForRefund.js" />
<Content Include="Areas\ReceiveSendFeeManagement\Views\FinaChargeStuYearItem\IndexForTeacher.js" />
@@ -7987,6 +7988,8 @@
<Content Include="Areas\ReceiveSendFeeManagement\Views\FinaChargeStuYear\IndexForTeacher.cshtml" />
<Content Include="Areas\ReceiveSendFeeManagement\Views\FinaChargeStuYearItem\IndexForTeacher.cshtml" />
<Content Include="Areas\ReceiveSendFeeManagement\Views\FinaChargeStuYearItem\IndexForRefund.cshtml" />
<Content Include="Content\excel\线下缴费记录.xls" />
<Content Include="Areas\ReceiveSendFeeManagement\Views\FinaChargeStuOrder\Import.cshtml" />
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" />
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
<Content Include="Views\Login\Default-beifen.cshtml" />


+ 3
- 19
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<FinaChargeStuBalanceEntity>(strSql.ToString(),dp, pagination);
}


+ 19
- 0
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

}


+ 1
- 0
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<FinaChargeStuOrderDetailEntity> list);
string ExecuteImportExcel(DataTable dt, string fileGuid, string queryJson);
}
}

+ 245
- 1
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
/// </summary>
public class FinaChargeStuOrderService : RepositoryFactory
{
private ICache cache = CacheFactory.CaChe();
private string cacheKey = "Learun_adms_excelError_";
private DataItemService datarItemService = new DataItemService();
#region 获取数据

/// <summary>
@@ -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<FinaChargeStuYearEntity>();
//获取已有年度学生缴费明细记录
var oldFinaChargeStuYearItemList = BaseRepository("CollegeMIS").FindList<FinaChargeStuYearItemEntity>("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<FinaChargeStuYearItemEntity> 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<string>(cacheKey + fileGuid, errordt, CacheId.excel);
}
}
return snum + "|" + fnum;
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
/// <summary>
/// 自动分配固定项目缴费多余金额
/// </summary>
/// <param name="YearNo"></param>
public void AutoCharge(int YearNo=0)
{
try
{
//获取有缴费余额的固定项目
var FinaChargeStuYearItemHasBalance = BaseRepository("CollegeMIS").FindList<FinaChargeStuYearItemEntity>("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<FinaChargeStuYearItemEntity>("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);
}
}


}
}
}

+ 1
- 0
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;


불러오는 중...
취소
저장