Browse Source

线下导入调试

西昌缴费二期
fzp 1 year ago
parent
commit
e1202967d4
3 changed files with 30 additions and 11 deletions
  1. +2
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeRefund/FinaChargeRefundService.cs
  2. +27
    -10
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuOrder/FinaChargeStuOrderService.cs
  3. +1
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuYearItem/FinaChargeStuYearItemService.cs

+ 2
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeRefund/FinaChargeRefundService.cs View File

@@ -153,11 +153,12 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
finaChargeRefundEntity.Amount = finaChargeStuYearItemEntity.FSBlance;
db.Insert(finaChargeRefundEntity);
//退费状态修改,余额归零
finaChargeStuYearItemEntity.SJAmount =finaChargeStuYearItemEntity.SJAmount - finaChargeStuYearItemEntity.FSBlance;
finaChargeStuYearItemEntity.RefundStatus = true;
finaChargeStuYearItemEntity.FSBlance = 0;
db.Update(finaChargeStuYearItemEntity);
//FinaChargeStuYear年度余额计算
db.ExecuteBySql("update FinaChargeStuYear set FSBlance=FSBlance-" + finaChargeRefundEntity.Amount + " where FSYId='" + finaChargeStuYearItemEntity.FSYId + "'");
db.ExecuteBySql("update FinaChargeStuYear set FSBlance=FSBlance-" + finaChargeRefundEntity.Amount + ",SJAmount=SJAmount-"+ finaChargeRefundEntity.Amount + " where FSYId='" + finaChargeStuYearItemEntity.FSYId + "'");
//学生余额扣减
db.ExecuteBySql("update FinaChargeStudent set FSBlance=FSBlance-" + finaChargeRefundEntity.Amount + " where StuNo='" + finaChargeStuYearItemEntity.StuNo + "'");
//交易流水记录


+ 27
- 10
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuOrder/FinaChargeStuOrderService.cs View File

@@ -343,6 +343,10 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
orderEntity.BankOrder = dr[5].ToString();
//历史固定项目未缴费和部分缴费的数据
var oldnotpaylist = finaChargeStuYearItemList.Where(m => m.PayFeeStatus != 1).OrderBy(m => m.priority).ToList();
if (oldnotpaylist.Count==0)
{
throw new Exception("【固定收费项目】已缴费,请核对!");
}
finaChargeStuYearItemEntity = oldnotpaylist.FirstOrDefault();
//订单明细 写入优先级最高的一条为暂存位置
FinaChargeStuOrderDetailEntity detail = new FinaChargeStuOrderDetailEntity();
@@ -439,15 +443,27 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
//FinaChargeStudent表
db.ExecuteBySql("update FinaChargeStudent set NeedToPay=(case when(NeedToPay-" + dresult + ")>0 then (NeedToPay-" + dresult + ") else 0 end),FSBlance=(case when(NeedToPay-" + dresult + ")>=0 then 0 else abs(NeedToPay-" + dresult + ") end) where StuNo='" + finaChargeStuYearItemEntity.StuNo + "'");
}
if(fgdfinaChargeStuYearItem.Count() >0 && gdfinaChargeStuYearItem.Sum(m => m.NeedToPay).Value - dresult <= 0)
else
{
decimal fgdcount = fgdfinaChargeStuYearItem.Sum(m=>m.NeedToPay).Value;
//FinaChargeStuYear表
db.ExecuteBySql("update FinaChargeStuYear set SJAmount=SJAmount+" + dresult + ",NeedToPay=(case when(NeedToPay-" + dresult+"+"+ fgdcount + ")>0 then (NeedToPay-" + dresult+"+"+ fgdcount + ") else 0 end),FSBlance=(case when(NeedToPay-" + dresult +"+"+ fgdcount + ")>=0 then 0 else abs(NeedToPay-" + dresult +"+"+ fgdcount + ") end),PayFeeStatus=(case when(NeedToPay-" + dresult +"+"+ fgdcount + ">=0) then 4 else 1 end) where FSYId='" + finaChargeStuYearItemEntity.FSYId + "'");
//FinaChargeStudent表
db.ExecuteBySql("update FinaChargeStudent set NeedToPay=(case when(NeedToPay-" + dresult +"+"+ fgdcount + ")>0 then (NeedToPay-" + dresult +"+"+ fgdcount + ") else 0 end),FSBlance=(case when(NeedToPay-" + dresult +"+"+ fgdcount + ")>=0 then 0 else abs(NeedToPay-" + dresult +"+"+ fgdcount + ") end) where StuNo='" + finaChargeStuYearItemEntity.StuNo + "'");
if (gdfinaChargeStuYearItem.Sum(m=>m.NeedToPay).Value- dresult<=0)
{
//FinaChargeStuYear表
db.ExecuteBySql("update FinaChargeStuYear set SJAmount=SJAmount+" + dresult + ",NeedToPay="+ fgdcount + ",FSBlance=" + (dresult-gdfinaChargeStuYearItem.Sum(m => m.NeedToPay)) + ",PayFeeStatus=4 where FSYId='" + finaChargeStuYearItemEntity.FSYId + "'");
//FinaChargeStudent表
db.ExecuteBySql("update FinaChargeStudent set NeedToPay="+ fgdcount + ",FSBlance=" + (dresult - gdfinaChargeStuYearItem.Sum(m => m.NeedToPay)) + " where StuNo='" + finaChargeStuYearItemEntity.StuNo + "'");
}
else
{
//FinaChargeStuYear表
db.ExecuteBySql("update FinaChargeStuYear set SJAmount=SJAmount+" + dresult + ",NeedToPay=(case when(NeedToPay-" + dresult +")>0 then (NeedToPay-" + dresult +") else 0 end),FSBlance=0,PayFeeStatus=(case when(NeedToPay-" + dresult + "+" + fgdcount + ">=0) then 4 else 1 end) where FSYId='" + finaChargeStuYearItemEntity.FSYId + "'");
//FinaChargeStudent表
db.ExecuteBySql("update FinaChargeStudent set NeedToPay=(case when(NeedToPay-" + dresult + ")>0 then (NeedToPay-" + dresult + ") else 0 end),FSBlance=0 where StuNo='" + finaChargeStuYearItemEntity.StuNo + "'");
}
}
db.Commit();
//自动分配超出金额
AutoCharge(finaChargeStuYearEntity.FSYear.Value);
snum++;
}
catch (Exception ex)
@@ -458,8 +474,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
failDt.Rows.Add(dr.ItemArray);
}
}
//自动分配超出金额
AutoCharge();
// 写入缓存如果有未导入的数据
if (failDt.Rows.Count > 0)
{
@@ -486,15 +501,15 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
/// 自动分配固定项目缴费多余金额
/// </summary>
/// <param name="YearNo"></param>
public void AutoCharge(int YearNo = 0)
public void AutoCharge(int YearNo)
{
try
{
Random ran = new Random();
//获取有缴费余额的固定项目,按照优先级倒排,即优先级低的,先拿出多出余额去分配给高的项目
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 order by priority desc ");
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 and b.FSYear='"+YearNo+"' order by priority desc ");
//获取欠费的固定项目,按照优先级排序,优先级高的首先会分配到多出的余额
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.NeedToPay>0 order by priority ");
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.NeedToPay>0 and b.FSYear='" + YearNo + "' order by priority ");
foreach (var hasBalanceItem in FinaChargeStuYearItemHasBalance)
{
if (hasBalanceItem.FSBlance > 0)
@@ -539,6 +554,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
QJItem.FSBlance = 0;
QJItem.PayFeeStatus = 1;
hasBalanceItem.FSBlance = hasBalanceItem.FSBlance - QJItem.NeedToPay;
hasBalanceItem.SJAmount = hasBalanceItem.SJAmount - QJItem.NeedToPay;
finaChargeStuBalanceMinus.ChangeAmount = -QJItem.NeedToPay;
finaChargeStuBalanceMinus.NowBalance = hasBalanceItem.FSBlance;
db.Insert(finaChargeStuBalanceMinus);
@@ -569,6 +585,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
finaChargeStuBalanceAdd.ChangeAmount = 0;
finaChargeStuBalanceAdd.NowBalance = 0;
QJItem.NeedToPay = QJItem.NeedToPay - hasBalanceItem.FSBlance;
hasBalanceItem.SJAmount = hasBalanceItem.SJAmount - hasBalanceItem.FSBlance;
hasBalanceItem.FSBlance = 0;
db.Insert(finaChargeStuBalanceAdd);
db.Update(hasBalanceItem);


+ 1
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuYearItem/FinaChargeStuYearItemService.cs View File

@@ -374,6 +374,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
//更新主表
oldFinaChargeStuYearEntity.YJAmount+= finaChargeStuYearItem.Standard;
oldFinaChargeStuYearEntity.NeedToPay += finaChargeStuYearItem.Standard;
oldFinaChargeStuYearEntity.PayFeeStatus = (oldFinaChargeStuYearEntity.PayFeeStatus==1 || oldFinaChargeStuYearEntity.PayFeeStatus == 4)? 4:0;
db.Update(oldFinaChargeStuYearEntity);
snum++;
}


Loading…
Cancel
Save