Browse Source

excel导入缴费功能

西昌缴费二期
liangkun 2 years ago
parent
commit
c20a6a52a1
8 changed files with 192 additions and 15 deletions
  1. +1
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic_PayFee/PayFeeIndex.cshtml
  2. +11
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic_PayFee/PayFeeIndex.js
  3. +2
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config
  4. +12
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Website/Web.config
  5. +5
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuEnrollFeeOrder/StuEnrollFeeOrderEntity.cs
  6. +156
    -13
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshService.cs
  7. +3
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj
  8. +2
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/packages.config

+ 1
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic_PayFee/PayFeeIndex.cshtml View File

@@ -54,6 +54,7 @@
<a id="lr_generate" class="btn btn-default"><i class="fa fa-plus"></i>&nbsp;初始化缴费数据</a>
<a id="lr_payCode" class="btn btn-default"><i class="fa fa-plus"></i>&nbsp;二维码缴费</a>
<a id="lr_viewinvoice" class="btn btn-default"><i class="fa fa-pencil-square-o"></i>&nbsp;查看发票</a>
<a id="lr_import" class="btn btn-default"><i class="fa fa-plus"></i>&nbsp;导入缴费明细</a>
</div>
</div>
</div>


+ 11
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic_PayFee/PayFeeIndex.js View File

@@ -57,6 +57,17 @@ var bootstrap = function ($, learun) {
});
}
});
//导入缴费明细
$('#lr_import').on('click', function () {
learun.layerForm({
id: 'form_import',
title: '导入缴费明细',
url: top.$.rootUrl + '/EducationalAdministration/StuInfoFresh/ExcelImportPay?id=2',
width: 600,
height: 400,
btn: null
});
});
//查看发票
$('#lr_viewinvoice').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('Id');


+ 2
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config View File

@@ -170,11 +170,12 @@
<add key="ForbidLoginNum" value="5"/>
<!-- 禁止登录时间(分钟) -->
<add key="ForbidLoginMinutes" value="10"/>

<!--下发新闻配置-->
<add key="SiteId" value="39"/>
<add key="ChannelId" value="49"/>
<add key="ApiKey" value="fafc361a-40c1-4060-8eee-ea796640c39c"/>
<add key="Ports" value="192.168.50.127:8007"/>
<!--触发excel开票任务的url-->
<add key="ExcelInvoice" value="http://localhost:60037/api/PayFeeResult/SetUnInvoiceHandle"/>
</appSettings>

+ 12
- 0
Learun.Framework.Ultimate V7/Learun.Application.Website/Web.config View File

@@ -69,6 +69,18 @@
<publisherPolicy apply="no" />
<assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="89b483f429c47342" culture="neutral" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.webServer>


+ 5
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuEnrollFeeOrder/StuEnrollFeeOrderEntity.cs View File

@@ -55,7 +55,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
/// </summary>
[Column("PAYTIME")]
public DateTime? PayTime { get; set; }

/// <summary>
/// 付款方式
/// </summary>
[Column("PAYMODE")]
public string PayMode { get; set; }
/// <summary>
/// 电子票据代码
/// </summary>


+ 156
- 13
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshService.cs View File

@@ -11,6 +11,7 @@ using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Learun.Cache.Base;
using Learun.Cache.Factory;

@@ -2208,22 +2209,22 @@ where bb.StuNo not in (select b.StuNo from StuInfoBasic b where b.StuNo=bb.StuNo
//获取学生数据
if (templateId == "1")//新生
{
stufreshlist = BaseRepository("CollegeMIS").FindList<StuInfoFreshEntity>("select StuNo,StuName from StuInfoFresh");
stufreshlist = BaseRepository("CollegeMIS").FindList<StuInfoFreshEntity>("select StuNo,StuName,PayFeeStatus from StuInfoFresh");
}
else//老生
{
stuinfobasiclist = BaseRepository("CollegeMIS").FindList<StuInfoBasicEntity>("select StuNo,StuName from StuInfoBasic");
//老生缴费初始化记录
stuinfobasicpayfeelist = BaseRepository("CollegeMIS").FindList<StuInfoBasic_PayFeeEntity>("select StuNo,PayYear from StuInfoBasic_PayFee");
stuinfobasicpayfeelist = BaseRepository("CollegeMIS").FindList<StuInfoBasic_PayFeeEntity>("select StuNo,PayYear,PayStatus from StuInfoBasic_PayFee");
}
List<StuEnrollFeeOrderEntity> insertedorderlist = new List<StuEnrollFeeOrderEntity>();
// 循环遍历导入
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)
if (dr[0].ToString() == "" || dr[1].ToString() == "" || dr[2].ToString() == "" || dr[3].ToString() == "" || dr[4].ToString() == "" || dr[5].ToString() == "")
{
throw (new Exception("行内数据有空值,不能为空!"));
}
@@ -2244,7 +2245,7 @@ where bb.StuNo not in (select b.StuNo from StuInfoBasic b where b.StuNo=bb.StuNo
}
//筛选不在标准代码表内的数据
//第五列是金额
if (typecodelist.Count(m => m.ProjectCode == dr[5].ToString()) == 0)
if (typecodelist.Count(m => m.ProjectCode == dr[4].ToString()) == 0)
{
throw (new Exception("【缴费项目编码】不存在,请核对!"));
}
@@ -2256,6 +2257,11 @@ where bb.StuNo not in (select b.StuNo from StuInfoBasic b where b.StuNo=bb.StuNo
{
throw (new Exception("【学号】不存在,请核对新生数据!"));
}
//已缴费的跳过
if (stufreshlist.Count(m => m.StuNo == dr[1].ToString() & m.PayFeeStatus == "1") > 0)
{
throw (new Exception("当前学生已缴费,请核对新生数据!"));
}
}
else//老生
{
@@ -2270,15 +2276,102 @@ where bb.StuNo not in (select b.StuNo from StuInfoBasic b where b.StuNo=bb.StuNo
{
throw (new Exception("【学生年度缴费数据】不存在,请核对是否初始化缴费数据!"));
}
//已缴费的跳过
if (stuinfobasicpayfeelist.Count(m => m.StuNo == dr[1].ToString() && m.PayYear == dr[0].ToInt() && m.PayStatus == 1) == 0)
{
throw (new Exception("当前学生已缴费,请核对缴费数据!"));
}
}
//用友库查询是否存在缴费项目
if (BaseRepository("YongyouDb").FindTable("select * from SCS_XSXX where XH='" + dr[1].ToString() + "'").Rows.Count==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);

//order主表记录查询
var orderlist = BaseRepository("CollegeMIS").FindList<StuEnrollFeeOrderEntity>("select * from StuEnrollFeeOrder where YearNo='" + dr[0].ToString() + "' and StuNo='" + dr[1].ToString() + "' and Status=999");
//查无订单新建
if (orderlist.Count() == 0)
{
var db = BaseRepository("CollegeMIS");
db.BeginTrans();
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);
orderEntity.YJAmount = dr[5].ToDecimal();
orderEntity.SJAmount = dr[5].ToDecimal();
orderEntity.PlaceOrderTime = DateTime.Now;
orderEntity.PayMode = "ExcelOffLine";
orderEntity.Status = 999;
orderEntity.billStatus = false;
orderEntity.PayTime = DateTime.Now;
db.Insert(orderEntity);
//写入数据记录
insertedorderlist.Add(orderEntity);
//写入订单详情表
StuEnrollFeeOrderDetailEntity orderDetailEntity = new StuEnrollFeeOrderDetailEntity();
orderDetailEntity.Create();
orderDetailEntity.OrderId = orderEntity.Id;
orderDetailEntity.ChargeItemName = dr[3].ToString();
orderDetailEntity.ChargeItemID = dr[4].ToString();
orderDetailEntity.YJAmount = dr[5].ToDecimal();
orderDetailEntity.SJAmount = dr[5].ToDecimal();
db.Insert(orderDetailEntity);
db.Commit();
snum++;
}
//否则直接写入订单详情表,并更新主订单表
else
{
var db = BaseRepository("CollegeMIS");
db.BeginTrans();
StuEnrollFeeOrderEntity orderEntity = orderlist.FirstOrDefault();
var orderdetails = db.FindList<StuEnrollFeeOrderDetailEntity>("select * from StuEnrollFeeOrderDetail where OrderId='" + orderEntity.Id + "' and ChargeItemID='" + dr[4].ToString() + "'");
//判断是否存在缴费明细
if (orderdetails.Count() == 0)
{
//写入订单详情表
StuEnrollFeeOrderDetailEntity orderDetailEntity = new StuEnrollFeeOrderDetailEntity();
orderDetailEntity.Create();
orderDetailEntity.OrderId = orderEntity.Id;
orderDetailEntity.ChargeItemName = dr[3].ToString();
orderDetailEntity.ChargeItemID = dr[4].ToString();
orderDetailEntity.YJAmount = dr[5].ToDecimal();
orderDetailEntity.SJAmount = dr[5].ToDecimal();
db.Insert(orderDetailEntity);
//更新主订单表
orderEntity.YJAmount += orderDetailEntity.YJAmount;
orderEntity.SJAmount += orderDetailEntity.SJAmount;
db.Update(orderEntity);
db.Commit();
snum++;
}
//已存在当前缴费项目
//跳过还是覆盖?
else
{ //跳过
throw (new Exception("当前学生的缴费项目数据已存在数据,未能导入!"));
//覆盖
//StuEnrollFeeOrderDetailEntity orderDetailEntity = orderdetails.FirstOrDefault();
//orderDetailEntity.OrderId = orderEntity.Id;
//orderDetailEntity.ChargeItemName = dr[3].ToString();
//orderDetailEntity.ChargeItemID = dr[4].ToString();
//orderDetailEntity.YJAmount = dr[5].ToDecimal();
//orderDetailEntity.SJAmount = dr[5].ToDecimal();
//db.Update(orderDetailEntity);
////更新主订单表
//orderEntity.YJAmount =db.FindList<StuEnrollFeeOrderDetailEntity>("select * from StuEnrollFeeOrderDetail where OrderId='"+orderEntity.Id+"'").Sum(m=>m.YJAmount);
//orderEntity.SJAmount = db.FindList<StuEnrollFeeOrderDetailEntity>("select * from StuEnrollFeeOrderDetail where OrderId='" + orderEntity.Id + "'").Sum(m => m.SJAmount);
//db.Update(orderEntity);
//db.Commit();
}
if (insertedorderlist.Count(m => m.orderid == orderEntity.orderid) == 0)
insertedorderlist.Add(orderEntity);
}
}
catch (Exception ex)
{
@@ -2287,11 +2380,61 @@ where bb.StuNo not in (select b.StuNo from StuInfoBasic b where b.StuNo=bb.StuNo
failDt.Rows.Add(dr.ItemArray);
}
}
//用友回写

foreach (var detail in insertedorderlist)
{
var dbyongyou = BaseRepository("YongyouDb");
dbyongyou.BeginTrans();
//此处订单列表内金额不是实时数据,需要再次查询
var newdetail = BaseRepository("CollegeMIS").FindEntity<StuEnrollFeeOrderEntity>(m => m.orderid == detail.orderid);
//newdetail.Status = 1;
//newdetail.YJAmount = 0;
//newdetail.SJAmount = 0;
//BaseRepository("CollegeMIS").Update(newdetail);
//缴费状态更新
//新老生判断
if (BaseRepository("CollegeMIS").FindList<StuInfoFreshEntity>("select stuno from StuInfoFresh where StuNo='" + newdetail.StuNo + "' and grade='" + newdetail.YearNo.ToString().Substring(2) + "'").Count() > 0)
{
BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoFresh set PayFeeStatus='1' where StuNo='" + newdetail.StuNo + "'");
}
else
{
BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoBasic_PayFee set PayStatus='1' where StuNo='" + newdetail.StuNo + "' and PayYear='" + newdetail.YearNo + "'");
}
string detailstuno = newdetail.StuNo;
DataTable stuinfo = dbyongyou.FindTable("select * from SCS_XSXX where XH='" + detailstuno + "'");
if (stuinfo.Rows.Count==0)
{
//用友库无学生数据
continue;
}
string XSID = stuinfo.Rows[0]["XSID"].ToString();
string XM = stuinfo.Rows[0]["XM"].ToString();
string SFZ = stuinfo.Rows[0]["SFZ"].ToString();
string strSql = "insert into SCS_ORDER(GSDM,KJND,OR_ID,OR_NO,XSID,ZDRDM,ZDRMC,ZDRQ,ZDSJ,ZFZT,CHANNELTYPE,AMOUNT,PAYTYPE,IDCARD,realamount,moneytype,BZ,pstring) " +
" values('001','" + newdetail.YearNo + "','" + newdetail.orderid + "-" + newdetail.YearNo + "','" + newdetail.orderid + "','" + XSID + "','" + newdetail.StuNo + "','" + XM + "','" + DateTime.Now.ToString("yyyyMMdd") + "','" + DateTime.Now.ToString("hhmmss") + "','20','4','" + newdetail.SJAmount + "','ExcelOffLine','" + SFZ + "','" + newdetail.SJAmount + "','1','','支付成功')";
dbyongyou.ExecuteBySql(strSql);
//日志
BaseRepository().ExecuteBySql("insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),122,'yongyou','用友回写SCS_ORDER完成',getdate())");
//用友明细
List<StuEnrollFeeOrderDetailEntity> orderdetaillist = BaseRepository("CollegeMIS").FindList<StuEnrollFeeOrderDetailEntity>("select * from StuEnrollFeeOrderDetail where OrderId='" + newdetail.Id + "'").ToList();
for (int i = 0; i < orderdetaillist.Count; i++)
{
string sqldetail = "insert into SCS_ORDEL(GSDM,KJND,OR_ID,XH,SFND,SFXMDM,SFXMMC,JE,SFQJNM) " +
"values('001','" + newdetail.YearNo + "','" + newdetail.orderid + "-" + newdetail.YearNo + "','" + (i + 1) + "','" + newdetail.YearNo + "','" + orderdetaillist[i].ChargeItemID + "','" + orderdetaillist[i].ChargeItemName + "','" + orderdetaillist[i].SJAmount + "','" + newdetail.YearNo + "')";
dbyongyou.ExecuteBySql(sqldetail);
}
dbyongyou.Commit();
}
//触发开具发票任务
//通过调用digitalschoolapi的接口实现任务触发
string excelInvoice = Config.GetValue("ExcelInvoice");
Task.Run(()=> HttpMethods.Post(excelInvoice));
// 写入缓存如果有未导入的数据
if (failDt.Rows.Count > 0)
{
string errordt = failDt.ToJson();

cache.Write<string>(cacheKey + fileId, errordt, CacheId.excel);
}
}


+ 3
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj View File

@@ -54,6 +54,9 @@
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />


+ 2
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/packages.config View File

@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Dapper" version="1.50.2" targetFramework="net45" />
<package id="Hangfire.Core" version="1.7.3" targetFramework="net461" />
<package id="Microsoft.AspNet.SignalR.Client" version="2.2.3" targetFramework="net45" />
<package id="Microsoft.DependencyValidation.Analyzers" version="0.10.0" targetFramework="net461" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net45" />
<package id="Owin" version="1.0" targetFramework="net461" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net45" />
</packages>

Loading…
Cancel
Save