From d0558ff1687a1bffd62c45660d4bab3132643039 Mon Sep 17 00:00:00 2001
From: lingling <kety1122@163.com>
Date: 星期三, 16 四月 2025 17:44:07 +0800
Subject: [PATCH] fix bug
---
LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml | 5 ++
LifePayment/LifePayment.HttpApi/LifePay/ACOOLYNotifyController.cs | 7 +++
LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs | 46 ++++++++++++++---------
LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayOrderService.cs | 2
LifePayment/LifePayment.Domain.Shared/ACOOLY/ACOOLYOutput.cs | 12 ++++++
LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayService.cs | 7 ++-
LifePayment/LifePayment.Application/LifePay/LifePayService.cs | 18 ++-------
LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs | 18 ++++++---
8 files changed, 71 insertions(+), 44 deletions(-)
diff --git a/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayOrderService.cs b/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayOrderService.cs
index 9470350..3f2a7a5 100644
--- a/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayOrderService.cs
+++ b/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayOrderService.cs
@@ -31,5 +31,5 @@
Task GetAllLifePayConsumption();
Task CreatLifePayConsumption(ACOOLYStatusEnum status, string orderNo, string aCOOLYOrderNo,
- decimal platformDeductionAmount, string channelId, DateTime orderCreationTime, DateTime? orderFinishTime);
+ decimal platformDeductionAmount, string channelId, DateTime orderCreationTime, DateTime? orderFinishTime, decimal? channleRate = 0, decimal? parValue = 0, decimal? actualParValue = 0);
}
\ No newline at end of file
diff --git a/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayService.cs b/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayService.cs
index cd98ea9..4e9b5fa 100644
--- a/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayService.cs
+++ b/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayService.cs
@@ -58,8 +58,6 @@
/// <returns></returns>
Task LifePayRefundsHandler(string orderNo, LifePayRefundStatusEnum refundStatus);
-
-
/// <summary>
/// 渚涘簲鍟嗗洖璋冨鐞�
/// </summary>
@@ -68,8 +66,11 @@
/// <param name="status"></param>
/// <param name="acoolyStatus"></param>
/// <param name="payAmount"></param>
+ /// <param name="refundApplyRemark"></param>
+ /// <param name="parValue"></param>
+ /// <param name="actualParValue"></param>
/// <returns></returns>
- Task ACOOLYOrderNotifyHandler(string orderNo, string acoolyOrderNo, LifePayOrderStatusEnum status, ACOOLYStatusEnum acoolyStatus, decimal payAmount, string refundApplyRemark);
+ Task ACOOLYOrderNotifyHandler(string orderNo, string acoolyOrderNo, LifePayOrderStatusEnum status, ACOOLYStatusEnum acoolyStatus, decimal payAmount, string refundApplyRemark, decimal? parValue = 0, decimal? actualParValue = 0);
/// <summary>
/// 鍒涘缓鐢熸椿缂磋垂璇濊垂璁㈠崟
diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs
index 1bca3f1..4bb201c 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs
@@ -336,7 +336,7 @@
}
-
+
/// <summary>
/// 缁熻鎵�鏈夋秷璐规祦姘�
@@ -347,7 +347,7 @@
var orderList = await _lifePayOrderRepository.Where(x => x.PayStatus == LifePayStatusEnum.宸叉敮浠�).ToListAsync();
foreach (var item in orderList)
{
-
+
if (item.ACOOLYStatus != null)
{
switch (item.ACOOLYStatus)
@@ -474,7 +474,7 @@
#region 鏂规硶
public async Task CreatLifePayConsumption(ACOOLYStatusEnum status, string orderNo, string aCOOLYOrderNo,
- decimal platformDeductionAmount, string channelId, DateTime orderCreationTime, DateTime? orderFinishTime)
+ decimal platformDeductionAmount, string channelId, DateTime orderCreationTime, DateTime? orderFinishTime, decimal? channelRate = 0, decimal? parValue = 0, decimal? actualParValue = 0)
{
LifePayConsumption lifePayConsumption = new LifePayConsumption()
{
@@ -525,22 +525,32 @@
lifePayConsumption.DeductionAmount = 0;
lifePayConsumption.FrozenAmount = 0;
break;
- //case ACOOLYStatusEnum.閮ㄥ垎鍏呭�兼垚鍔�:
- // lifePayConsumption.FinishTime = orderCreationTime;
- // lifePayConsumption.ACOOLYStatus = ACOOLYStatusEnum.閮ㄥ垎鍏呭�兼垚鍔�;
- // lifePayConsumption.FrozenStatus = ConsumptionFrozenStatusEnum.Thaw;
- // lifePayConsumption.Flow = ConsumptionFlowEnum.Unchanged;
- // lifePayConsumption.DeductionAmount = 0;
- // lifePayConsumption.FrozenAmount = lifePayConsumption.Amount;
+ case ACOOLYStatusEnum.閮ㄥ垎鍏呭�兼垚鍔�:
+ lifePayConsumption.FinishTime = orderCreationTime;
+ lifePayConsumption.ACOOLYStatus = ACOOLYStatusEnum.閮ㄥ垎鍏呭�兼垚鍔�;
+ lifePayConsumption.FrozenStatus = ConsumptionFrozenStatusEnum.Thaw;
+ lifePayConsumption.Flow = ConsumptionFlowEnum.Out;
+ lifePayConsumption.DeductionAmount = lifePayConsumption.Amount;
+ lifePayConsumption.FrozenAmount = 0;
+ if ((parValue ?? 0) != 0 && (parValue ?? 0) != actualParValue)
+ {
+ LifePayConsumption lifePayConsumptionOther = new LifePayConsumption()
+ {
+ OrderNo = orderNo,
+ AcoolyOrderNo = aCOOLYOrderNo,
+ Amount = ((parValue ?? 0) - (actualParValue ?? 0)) * (channelRate ?? 0),
+ ChannelId = channelId,
+ FinishTime = orderCreationTime,
+ ACOOLYStatus = ACOOLYStatusEnum.閮ㄥ垎鍏呭�兼垚鍔�,
+ FrozenStatus = ConsumptionFrozenStatusEnum.Thaw,
+ Flow = ConsumptionFlowEnum.Unchanged,
+ DeductionAmount = 0,
+ FrozenAmount = 0
+ };
+ await _lifePayConsumption.InsertAsync(lifePayConsumptionOther);
+ }
- // 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;
+ break;
default: break;
}
diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
index bb94bcb..7155429 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -1,4 +1,5 @@
-锘縰sing LifePayment.Application.Contracts;
+锘縰sing Alipay.EasySDK.Payment.Common.Models;
+using LifePayment.Application.Contracts;
using LifePayment.Domain;
using LifePayment.Domain.LifePay;
using LifePayment.Domain.Models;
@@ -19,18 +20,7 @@
using Volo.Abp.EventBus.Distributed;
using Z.EntityFramework.Plus;
using ZeroD.Util;
-using Alipay.EasySDK.Payment.Common.Models;
using static LifePayment.Domain.Shared.LifePaymentConstant;
-using ZeroD.Util.Fadd;
-using Nest;
-using Volo.Abp.Domain.Entities;
-using Volo.Abp.ObjectMapping;
-using NPOI.SS.Formula.Functions;
-using StackExchange.Redis;
-using static Volo.Abp.Identity.Settings.IdentitySettingNames;
-using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
-using LifePayment.Application.LifePay;
-using Alipay.AopSdk.Core.Domain;
namespace LifePayment.Application;
@@ -1378,7 +1368,7 @@
/// <param name="orderNo"></param>
/// <param name="outOrderNo"></param>
/// <returns></returns>
- public async Task ACOOLYOrderNotifyHandler(string orderNo, string acoolyOrderNo, LifePayOrderStatusEnum status, ACOOLYStatusEnum acoolyStatus, decimal payAmount, string refundApplyRemark)
+ public async Task ACOOLYOrderNotifyHandler(string orderNo, string acoolyOrderNo, LifePayOrderStatusEnum status, ACOOLYStatusEnum acoolyStatus, decimal payAmount, string refundApplyRemark, decimal? parValue = 0, decimal? actualParValue = 0)
{
var order = await _lifePayOrderRepository.Where(x => x.OrderNo == orderNo).FirstOrDefaultAsync();
CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "璁㈠崟涓嶅瓨鍦�");
@@ -1434,7 +1424,7 @@
/// 鍒涘缓鐢熸椿缂磋垂娑堣垂璁板綍
await _lifePayOrderService.CreatLifePayConsumption(acoolyStatus, order.OrderNo, order.ACOOLYOrderNo,
- order.PlatformDeductionAmount ?? 0, order.ChannelId, order.CreationTime, order.FinishTime);
+ order.PlatformDeductionAmount ?? 0, order.ChannelId, order.CreationTime, order.FinishTime, order.ChannleRate, parValue, actualParValue);
}
/// <summary>
diff --git a/LifePayment/LifePayment.Domain.Shared/ACOOLY/ACOOLYOutput.cs b/LifePayment/LifePayment.Domain.Shared/ACOOLY/ACOOLYOutput.cs
index 3375781..d8555e3 100644
--- a/LifePayment/LifePayment.Domain.Shared/ACOOLY/ACOOLYOutput.cs
+++ b/LifePayment/LifePayment.Domain.Shared/ACOOLY/ACOOLYOutput.cs
@@ -471,6 +471,12 @@
[JsonProperty("parValue")]
public decimal ParValue { get; set; }
+
+ /// <summary>
+ /// 瀹為檯鍒拌处閲戦銆�
+ /// </summary>
+ [JsonProperty("actualParValue")]
+ public decimal ActualParValue { get; set; }
/// <summary>
/// 瀹為檯鎵f閲戦锛屽崟浣嶄负鍏冦��
/// </summary>
@@ -489,6 +495,12 @@
[JsonProperty("statusText")]
public string StatusText { get; set; }
+ /// <summary>
+ /// 閫氱煡娑堟伅
+ /// </summary>
+ [JsonProperty("responseMessage")]
+ public string ResponseMessage { get; set; }
+
}
/// <summary>
diff --git a/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml b/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
index 0d6aa37..ea4efed 100644
--- a/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
+++ b/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
@@ -50,7 +50,7 @@
<param name="refundStatus"></param>
<returns></returns>
</member>
- <member name="M:LifePayment.Application.Contracts.ILifePayService.ACOOLYOrderNotifyHandler(System.String,System.String,LifePayment.Domain.Shared.LifePayOrderStatusEnum,LifePayment.Domain.Shared.ACOOLYStatusEnum,System.Decimal,System.String)">
+ <member name="M:LifePayment.Application.Contracts.ILifePayService.ACOOLYOrderNotifyHandler(System.String,System.String,LifePayment.Domain.Shared.LifePayOrderStatusEnum,LifePayment.Domain.Shared.ACOOLYStatusEnum,System.Decimal,System.String,System.Nullable{System.Decimal},System.Nullable{System.Decimal})">
<summary>
渚涘簲鍟嗗洖璋冨鐞�
</summary>
@@ -59,6 +59,9 @@
<param name="status"></param>
<param name="acoolyStatus"></param>
<param name="payAmount"></param>
+ <param name="refundApplyRemark"></param>
+ <param name="parValue"></param>
+ <param name="actualParValue"></param>
<returns></returns>
</member>
<member name="M:LifePayment.Application.Contracts.ILifePayService.CreateLifePayPhoneOrder(LifePayment.Application.Contracts.CreateLifePayOrderInput{LifePayment.Application.Contracts.LifePhoneData})">
diff --git a/LifePayment/LifePayment.HttpApi/LifePay/ACOOLYNotifyController.cs b/LifePayment/LifePayment.HttpApi/LifePay/ACOOLYNotifyController.cs
index bd6e839..b7dd3a4 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/ACOOLYNotifyController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/ACOOLYNotifyController.cs
@@ -56,6 +56,8 @@
ACOOLYStatusEnum acoolyStatus = ACOOLYStatusEnum.鍏呭�煎け璐�;
var acoolyOrderNo = string.Empty;
decimal payAmount = 0;
+ decimal parValue = 0;
+ decimal actualParValue = 0;
string refundApplyRemark = string.Empty;
_logger.LogError("ACOOLY鍥炶皟閫氬鐞嗙被鍨嬶細" + baseInfo.Service);
_logger.LogError("ACOOLY鍥炶皟鍐呭锛�" + body);
@@ -66,6 +68,8 @@
orderNo = confirmElectricOrderResponse.ElectricChargeOrder.OutOrderNo;
acoolyOrderNo = confirmElectricOrderResponse.ElectricChargeOrder.BusiOrderNo;
payAmount = confirmElectricOrderResponse.ElectricChargeOrder.PayAmount;
+ actualParValue = confirmElectricOrderResponse.ElectricChargeOrder.ActualParValue;
+ parValue = confirmElectricOrderResponse.ElectricChargeOrder.ParValue;
_logger.LogError("ACOOLY鍥炶皟閫氬鐞嗙粨鏋滅姸鎬侊細" + confirmElectricOrderResponse.ElectricChargeOrder.Status);
if (!confirmElectricOrderResponse.Success
@@ -116,6 +120,7 @@
{
status = LifePayOrderStatusEnum.寰呴��娆�;
acoolyStatus = ACOOLYStatusEnum.閮ㄥ垎鍏呭�兼垚鍔�;
+ refundApplyRemark = confirmElectricOrderResponse.ElectricChargeOrder.ResponseMessage;
}
break;
case ACOOLYConstant.Sevice.ConfirmPhoneOrder:
@@ -236,7 +241,7 @@
throw new UserFriendlyException("ACOOLY鍥炶皟閫氬鐞嗙被鍨嬩笉瀛樺湪");
}
- await _lifePayService.ACOOLYOrderNotifyHandler(orderNo, acoolyOrderNo, status, acoolyStatus, payAmount, refundApplyRemark);
+ await _lifePayService.ACOOLYOrderNotifyHandler(orderNo, acoolyOrderNo, status, acoolyStatus, payAmount, refundApplyRemark, parValue, actualParValue);
}
}
}
\ No newline at end of file
diff --git a/LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs b/LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs
index 0ff58ca..1dc7f00 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs
@@ -63,11 +63,17 @@
{
await _lifePayService.LifePaySuccessHandler(input.OutTradeNo, input.TradeNo);
// 鎻掑叆鏀舵敮娴佹按
- await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput() { OrderNo = input.OutTradeNo,
- OutOrderNo = input.TradeNo ,LifePayType = LifePayTypeEnum.AliPay,ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Expenses });
+ await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput()
+ {
+ OrderNo = input.OutTradeNo,
+ OutOrderNo = input.TradeNo,
+ LifePayType = LifePayTypeEnum.AliPay,
+ ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Expenses
+ });
}
- else if((input.TradeStatus == LifePaymentConstant.AliPayStatus.鏀粯鎴愬姛 && input.OutBizNo.IsNotNullOrEmpty() && input.RefundFee.HasValue) ||
- input.TradeStatus == LifePaymentConstant.AliPayStatus.瓒呮椂鍏抽棴)
+ else if (((input.TradeStatus == LifePaymentConstant.AliPayStatus.鏀粯鎴愬姛 || input.TradeStatus == LifePaymentConstant.AliPayStatus.瓒呮椂鍏抽棴)
+ && input.OutBizNo.IsNotNullOrEmpty()
+ && (input.RefundFee.HasValue && input.RefundFee > 0)))
{
await _lifePayService.LifePayRefundsHandler(input.OutTradeNo, LifePayRefundStatusEnum.宸查��娆�);
// 鎻掑叆鏀舵敮娴佹按
@@ -83,7 +89,7 @@
}
else
{
- _logger.LogError($"鐢熸椿绠″鏀粯瀹濆厖鍊煎洖璋冮�氱煡锛氳鍗曞彿寮傚父 " + input.OutTradeNo);
+ _logger.LogError($"鐢熸椿绠″鏀粯瀹濆厖鍊煎洖璋冮�氱煡锛氳鍗曞彿寮傚父 " + input.OutTradeNo);
}
return new ContentResult
@@ -114,7 +120,7 @@
}
-
+
#endif
/// <summary>
--
Gitblit v1.9.1