lingling
2025-04-16 d0558ff1687a1bffd62c45660d4bab3132643039
fix bug
8个文件已修改
115 ■■■■■ 已修改文件
LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayOrderService.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayService.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application/LifePay/LifePayService.cs 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Domain.Shared/ACOOLY/ACOOLYOutput.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.HttpApi/LifePay/ACOOLYNotifyController.cs 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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);
}
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>
    /// 创建生活缴费话费订单
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;
            }
LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -1,4 +1,5 @@
using LifePayment.Application.Contracts;
using 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>
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>
    /// 实际扣款金额,单位为元。
    /// </summary>
@@ -489,6 +495,12 @@
    [JsonProperty("statusText")]
    public string StatusText { get; set; }
    /// <summary>
    /// 通知消息
    /// </summary>
    [JsonProperty("responseMessage")]
    public string ResponseMessage {  get; set; }
}
/// <summary>
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})">
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);
        }
    }
}
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>