From f44b19122e88c377fe20f504e31da3910659c441 Mon Sep 17 00:00:00 2001
From: zhengyuxuan <zhengyuxuan1995>
Date: 星期四, 03 四月 2025 15:56:18 +0800
Subject: [PATCH] fix:bug修复
---
LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs | 121 +++++++++++++++++++---------------------
1 files changed, 58 insertions(+), 63 deletions(-)
diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs
index 7c02e77..458bbba 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs
@@ -14,9 +14,6 @@
using LifePayment.Domain;
using static LifePayment.Domain.Shared.LifePaymentConstant;
using Newtonsoft.Json;
-using LifePayment.Domain.Common;
-using Spire.Pdf.Exporting.XPS.Schema;
-using Nest;
namespace LifePayment.Application.LifePay
{
@@ -61,7 +58,7 @@
public async Task<PageOutput<LifePayConsumptionListOutput>> GetLifePayConsumptionPage(LifePayConsumptionPageInput input)
{
var channles = await _lifePayChannlesRep.Where(x => x.ChannlesName.Contains(input.KeyWord)).Select(x => x.ChannlesNum).ToListAsync();
- var list = await _lifePayConsumption.Where(x => x.IsDeleted == false)
+ var list = await _lifePayConsumption
.WhereIf(input.KeyWord.IsNotNullOrEmpty(), x => x.OrderNo.Contains(input.KeyWord) || x.AcoolyOrderNo.Contains(input.KeyWord) || channles.Contains(x.ChannelId))
.WhereIf(input.Flow.HasValue, x => x.Flow == input.Flow)
.WhereIf(input.TimeBegin.HasValue, x => x.FinishTime >= input.TimeBegin)
@@ -81,8 +78,8 @@
})
.GetPageResult(input.PageModel);
- var totalDeductionAmount = await _lifePayConsumption.Where(x => x.IsDeleted == false).SumAsync(x => x.DeductionAmount);
- var totalFrozenAmount = await _lifePayConsumption.Where(x => x.IsDeleted == false).SumAsync(x => x.FrozenAmount);
+ var totalDeductionAmount = await _lifePayConsumption.SumAsync(x => x.DeductionAmount);
+ var totalFrozenAmount = await _lifePayConsumption.SumAsync(x => x.FrozenAmount);
LifePayConsumptionStatistics objectData = new LifePayConsumptionStatistics();
objectData.TotalDeductionAmount = totalDeductionAmount;
objectData.TotalFrozenAmount = totalFrozenAmount.Value;
@@ -97,7 +94,7 @@
/// <returns></returns>
public async Task<PageOutput<LifePayRechargeReceiptsListOutput>> GetLifePayRechargeReceiptsPage(LifePayRechargeReceiptsPageInput input)
{
- var list = await _lifePayRechargeReceiptsRepository.Where(x => x.IsDeleted == false)
+ var list = await _lifePayRechargeReceiptsRepository
.WhereIf(input.KeyWord.IsNotNullOrEmpty(), x => x.OrderNo.Contains(input.KeyWord))
.WhereIf(input.CreationTimeBegin.HasValue, x => x.CreationTime >= input.CreationTimeBegin)
.WhereIf(input.CreationTimeEnd.HasValue, x => x.CreationTime <= input.CreationTimeEnd)
@@ -112,7 +109,7 @@
})
.GetPageResult(input.PageModel);
- var total = await _lifePayRechargeReceiptsRepository.Where(x => x.IsDeleted == false).SumAsync(x => x.RechargeAmount);
+ var total = await _lifePayRechargeReceiptsRepository.SumAsync(x => x.RechargeAmount);
LifePayRechargeReceiptsStatistics objectData = new LifePayRechargeReceiptsStatistics();
objectData.TotalRechargeAmount = total;
list.ObjectData = objectData;
@@ -126,7 +123,7 @@
/// <returns></returns>
public async Task<PageOutput<LifePayExpensesReceiptsListOutput>> GetLifePayExpensesReceiptsPage(LifePayExpensesReceiptsPageInput input)
{
- var list = await _lifePayExpensesReceiptsRepository.Where(x => x.IsDeleted == false)
+ var list = await _lifePayExpensesReceiptsRepository
.WhereIf(input.KeyWord.IsNotNullOrEmpty(), x => x.OrderNo.Contains(input.KeyWord) || x.OutOrderNo.Contains(input.KeyWord))
.WhereIf(input.LifePayType.HasValue, x => x.LifePayType == input.LifePayType)
.WhereIf(input.ExpensesReceiptsType.HasValue, x => x.ExpensesReceiptsType == input.ExpensesReceiptsType)
@@ -145,8 +142,8 @@
})
.GetPageResult(input.PageModel);
- var totalIncome = await _lifePayExpensesReceiptsRepository.Where(x => x.IsDeleted == false && x.ExpensesReceiptsType == ExpensesReceiptsTypeEnum.Expenses).SumAsync(x => x.Amount);
- var totalRefund = await _lifePayExpensesReceiptsRepository.Where(x => x.IsDeleted == false && x.ExpensesReceiptsType == ExpensesReceiptsTypeEnum.Receipts).SumAsync(x => x.Amount);
+ var totalIncome = await _lifePayExpensesReceiptsRepository.Where(x => x.ExpensesReceiptsType == ExpensesReceiptsTypeEnum.Expenses).SumAsync(x => x.Amount);
+ var totalRefund = await _lifePayExpensesReceiptsRepository.Where(x => x.ExpensesReceiptsType == ExpensesReceiptsTypeEnum.Receipts).SumAsync(x => x.Amount);
LifePayExpensesReceiptsStatistics objectData = new LifePayExpensesReceiptsStatistics();
objectData.TotalIncome = totalIncome;
@@ -163,7 +160,7 @@
/// <returns></returns>
public async Task<PageOutput<LifePayChannlesRakeListOutput>> GetLifePayChannlesRakePage(LifePayChannlesRakePageInput input)
{
- var list = await _lifePayChannlesRakeRepository.Where(x => x.IsDeleted == false)
+ var list = await _lifePayChannlesRakeRepository
.WhereIf(input.ChannelId.IsNotNullOrEmpty(), x => x.ChannelId == input.ChannelId)
.WhereIf(input.CreationTimeBegin.HasValue, x => x.CreationTime >= input.CreationTimeBegin)
.WhereIf(input.CreationTimeEnd.HasValue, x => x.CreationTime <= input.CreationTimeEnd)
@@ -183,7 +180,7 @@
})
.GetPageResult(input.PageModel);
- var totalRakePrice = await _lifePayChannlesRakeRepository.Where(x => x.IsDeleted == false)
+ var totalRakePrice = await _lifePayChannlesRakeRepository
.WhereIf(input.ChannelId.IsNotNullOrEmpty(), x => x.ChannelId == input.ChannelId)
.WhereIf(input.CreationTimeBegin.HasValue, x => x.CreationTime >= input.CreationTimeBegin)
.WhereIf(input.CreationTimeEnd.HasValue, x => x.CreationTime <= input.CreationTimeEnd)
@@ -235,11 +232,11 @@
CheckExtensions.IfTrueThrowUserFriendlyException(input.OrderNo == null, "璇疯緭鍏ヤ笟鍔¤鍗曞彿");
CheckExtensions.IfTrueThrowUserFriendlyException(input.RechargeAmount <= 0, "鍏呭�奸噾棰濆簲澶т簬0");
CheckExtensions.IfTrueThrowUserFriendlyException(input.Voucher == null, "璇锋彁浜ゅ厖鍊煎嚟璇�");
- var repeat = await _lifePayRechargeReceiptsRepository.Where(x => x.IsDeleted == false && x.OrderNo == input.OrderNo).FirstOrDefaultAsync();
+ var repeat = await _lifePayRechargeReceiptsRepository.Where(x => x.OrderNo == input.OrderNo).FirstOrDefaultAsync();
CheckExtensions.IfTrueThrowUserFriendlyException(repeat != null && repeat.Id != input.Id, "涓氬姟璁㈠崟鍙烽噸澶�");
if (input.Id.HasValue)
{
- var payRechargeReceipts = await _lifePayRechargeReceiptsRepository.Where(x => x.IsDeleted == false && x.Id == input.Id.Value).FirstOrDefaultAsync();
+ var payRechargeReceipts = await _lifePayRechargeReceiptsRepository.Where(x => x.Id == input.Id.Value).FirstOrDefaultAsync();
payRechargeReceipts.OrderNo = input.OrderNo;
payRechargeReceipts.RechargeAmount = input.RechargeAmount;
payRechargeReceipts.Remark = input.Remark;
@@ -338,6 +335,9 @@
}
}
+
+
+
/// <summary>
/// 缁熻鎵�鏈夋秷璐规祦姘�
/// </summary>
@@ -380,6 +380,10 @@
}
}
+ /// <summary>
+ /// 缁熻鎵�鏈夋敹鏀祦姘�
+ /// </summary>
+ /// <returns></returns>
public async Task GetAllLifePayExpensesReceipts()
{
var orderlist = await (from a in _lifePayOrderRepository.Where(x => x.PayStatus >= LifePayStatusEnum.宸叉敮浠�)
@@ -411,37 +415,46 @@
await AddLifePayExpensesReceipts(input);
/// 鍑鸿处
+ AddLifePayExpensesReceiptsInput receipts = new AddLifePayExpensesReceiptsInput()
+ {
+ OrderNo = item.OrderNo,
+ OutOrderNo = item.OutOrderNo,
+ LifePayType = item.LifePayType,
+ Amount = item.Amount,
+ ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Expenses
+ };
if (item.RefundOrderNo.IsNotNullOrEmpty())
{
- input.OutRefundNo = item.OrderNo;
- input.ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Receipts;
- await AddLifePayExpensesReceipts(input);
-
- input.OutRefundNo = item.RefundOrderNo;
- input.ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Receipts;
- await AddLifePayExpensesReceipts(input);
+ receipts.OutRefundNo = item.RefundOrderNo;
+ receipts.ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Receipts;
+ await AddLifePayExpensesReceipts(receipts);
}
}
}
}
+ /// <summary>
+ /// 鑾峰彇鍏ㄩ儴娓犻亾鍒嗕剑
+ /// </summary>
+ /// <returns></returns>
public async Task GetAllChannlesRake()
{
- var orderlist = await _lifePayOrderRepository.Where(x => x.IsDeleted == false && x.PayStatus == LifePayStatusEnum.宸叉敮浠� && x.LifePayOrderStatus == LifePayOrderStatusEnum.宸插畬鎴�).ToListAsync();
+ var orderlist = await _lifePayOrderRepository.Where(x => x.PayStatus == LifePayStatusEnum.宸叉敮浠� && x.LifePayOrderStatus == LifePayOrderStatusEnum.宸插畬鎴�).ToListAsync();
foreach (var item in orderlist)
{
/// 姣涘埄
var grossProfit = item.RechargeAmount * (item.ChannleRate - item.PlatformRate) / 100;
/// 娓犻亾浣i噾 锛�(鍏呭�奸潰棰� * 娓犻亾鎶樻墸姣斾緥)-(鍏呭�奸潰棰� * 骞冲彴鎶樻墸姣斾緥)锛�* 浣i噾姣斾緥
- var channlesRakePrice = grossProfit * (item.ChannlesRakeRate) / 100;
+ var channlesRakePrice = grossProfit * item.ChannlesRakeRate / 100;
+
if (channlesRakePrice.HasValue)
{
LifePayChannlesRake lifePayChannlesRake = new LifePayChannlesRake()
{
OrderNo = item.OrderNo,
- PayAmount = item.PayAmount.Value,
- ChannlesRakeRate = item.ChannlesRakeRate.Value,
- ChannlesRakePrice = channlesRakePrice.Value,
+ PayAmount = item.RechargeAmount ?? 0,
+ ChannlesRakeRate = item.ChannlesRakeRate ?? 0,
+ ChannlesRakePrice = channlesRakePrice ?? 0,
FinishTime = item.FinishTime.Value,
ChannelId = item.ChannelId,
};
@@ -476,30 +489,18 @@
lifePayConsumption.Flow = ConsumptionFlowEnum.Unchanged;
lifePayConsumption.DeductionAmount = 0;
lifePayConsumption.FrozenAmount = lifePayConsumption.Amount;
-
- repeat = await _lifePayConsumption.Where(x => x.OrderNo == lifePayConsumption.OrderNo
- && x.ACOOLYStatus == lifePayConsumption.ACOOLYStatus && x.Flow == lifePayConsumption.Flow).FirstOrDefaultAsync();
- if (repeat == null)
- {
- await _lifePayConsumption.InsertAsync(lifePayConsumption);
- }
-
break;
case ACOOLYStatusEnum.宸插畬鎴�:
- lifePayConsumption.FinishTime = orderFinishTime.Value;
+ if (orderFinishTime.HasValue)
+ {
+ lifePayConsumption.FinishTime = orderFinishTime.Value;
+ }
+
lifePayConsumption.ACOOLYStatus = ACOOLYStatusEnum.宸插畬鎴�;
lifePayConsumption.FrozenStatus = ConsumptionFrozenStatusEnum.Thaw;
lifePayConsumption.Flow = ConsumptionFlowEnum.Out;
lifePayConsumption.DeductionAmount = lifePayConsumption.Amount;
lifePayConsumption.FrozenAmount = 0;
-
- repeat = await _lifePayConsumption.Where(x => x.OrderNo == lifePayConsumption.OrderNo
- && x.ACOOLYStatus == lifePayConsumption.ACOOLYStatus && x.Flow == lifePayConsumption.Flow).FirstOrDefaultAsync();
- if (repeat == null)
- {
- await _lifePayConsumption.InsertAsync(lifePayConsumption);
- }
-
break;
case ACOOLYStatusEnum.鍏呭�煎け璐�:
lifePayConsumption.FinishTime = orderCreationTime;
@@ -508,32 +509,19 @@
lifePayConsumption.Flow = ConsumptionFlowEnum.Unchanged;
lifePayConsumption.DeductionAmount = 0;
lifePayConsumption.FrozenAmount = lifePayConsumption.Amount;
-
- repeat = await _lifePayConsumption.Where(x => x.OrderNo == lifePayConsumption.OrderNo
- && x.ACOOLYStatus == lifePayConsumption.ACOOLYStatus && x.Flow == lifePayConsumption.Flow).FirstOrDefaultAsync();
- if (repeat == null)
- {
- await _lifePayConsumption.InsertAsync(lifePayConsumption);
- }
-
break;
case ACOOLYStatusEnum.宸查��娆�:
- lifePayConsumption.FinishTime = orderFinishTime.Value;
+ if (orderFinishTime.HasValue)
+ {
+ lifePayConsumption.FinishTime = orderFinishTime.Value;
+ }
+
lifePayConsumption.ACOOLYStatus = ACOOLYStatusEnum.宸查��娆�;
lifePayConsumption.FrozenStatus = ConsumptionFrozenStatusEnum.Thaw;
lifePayConsumption.Flow = ConsumptionFlowEnum.Unchanged;
lifePayConsumption.DeductionAmount = 0;
lifePayConsumption.FrozenAmount = 0;
-
- repeat = await _lifePayConsumption.Where(x => x.OrderNo == lifePayConsumption.OrderNo
- && x.ACOOLYStatus == lifePayConsumption.ACOOLYStatus && x.Flow == lifePayConsumption.Flow).FirstOrDefaultAsync();
- if (repeat == null)
- {
- await _lifePayConsumption.InsertAsync(lifePayConsumption);
- }
-
break;
-
//case ACOOLYStatusEnum.閮ㄥ垎鍏呭�兼垚鍔�:
// lifePayConsumption.FinishTime = orderCreationTime;
// lifePayConsumption.ACOOLYStatus = ACOOLYStatusEnum.閮ㄥ垎鍏呭�兼垚鍔�;
@@ -552,11 +540,18 @@
// break;
default: break;
}
+
+ repeat = await _lifePayConsumption.Where(x => x.OrderNo == lifePayConsumption.OrderNo
+ && x.ACOOLYStatus == lifePayConsumption.ACOOLYStatus && x.Flow == lifePayConsumption.Flow).FirstOrDefaultAsync();
+ if (repeat == null)
+ {
+ await _lifePayConsumption.InsertAsync(lifePayConsumption);
+ }
}
private async Task<IQueryable<LifePayChannlesRakeListOutput>> GetLifePayChannlesRakeListFilter(LifePayChannlesRakePageInput input)
{
- var list = _lifePayChannlesRakeRepository.Where(x => x.IsDeleted == false)
+ var list = _lifePayChannlesRakeRepository
.WhereIf(input.ChannelId.IsNotNullOrEmpty(), x => x.ChannelId == input.ChannelId)
.WhereIf(input.CreationTimeBegin.HasValue, x => x.CreationTime >= input.CreationTimeBegin)
.WhereIf(input.CreationTimeEnd.HasValue, x => x.CreationTime <= input.CreationTimeEnd)
--
Gitblit v1.9.1