From f8e21d7b31d7690e17f5980aeb5763036dda99f0 Mon Sep 17 00:00:00 2001 From: liushijie <lslola@126.com> Date: 星期四, 27 三月 2025 09:12:14 +0800 Subject: [PATCH] fix bug --- LifePayment/LifePayment.Domain/LifePay/LifePayOrder.cs | 18 ++++---- LifePayment/LifePayment.Application/LifePay/LifePayService.cs | 95 +++++++++++++++++++++++------------------------ LifePayment/LifePayment.Application/LifePay/StatisticsService.cs | 6 +- 3 files changed, 59 insertions(+), 60 deletions(-) diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs index 405d11c..ef50008 100644 --- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs +++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs @@ -263,19 +263,19 @@ from b in temp.DefaultIfEmpty() select new LifePayOrderListOutput { - DiscountAmount = a.DiscountAmount, + DiscountAmount = a.DiscountAmount ?? 0, FinishTime = a.FinishTime, Id = a.Id, - LifePayOrderStatus = a.LifePayOrderStatus, + LifePayOrderStatus = a.LifePayOrderStatus?? 0, LifePayOrderType = a.LifePayOrderType, LifePayType = a.LifePayType, OrderNo = a.OrderNo, - PayAmount = a.PayAmount, + PayAmount = a.PayAmount ?? 0, PhoneNumber = a.PhoneNumber, - RechargeAmount = a.RechargeAmount, + RechargeAmount = a.RechargeAmount??0, UserId = a.UserId, OutOrderNo = a.OutOrderNo, - PayStatus = a.PayStatus, + PayStatus = a.PayStatus?? 0, PayTime = a.PayTime, ACOOLYOrderNo = a.ACOOLYOrderNo, RefundCredentialsImgUrl = a.RefundCredentialsImgUrl.GetOssPath(), @@ -319,19 +319,19 @@ from b in temp.DefaultIfEmpty() select new LifePayOrderListOutput { - DiscountAmount = a.DiscountAmount, + DiscountAmount = a.DiscountAmount ?? 0, FinishTime = a.FinishTime, Id = a.Id, - LifePayOrderStatus = a.LifePayOrderStatus, + LifePayOrderStatus = a.LifePayOrderStatus ?? 0, LifePayOrderType = a.LifePayOrderType, LifePayType = a.LifePayType, OrderNo = a.OrderNo, - PayAmount = a.PayAmount, + PayAmount = a.PayAmount ?? 0, PhoneNumber = a.PhoneNumber, - RechargeAmount = a.RechargeAmount, + RechargeAmount = a.RechargeAmount ?? 0, UserId = a.UserId, OutOrderNo = a.OutOrderNo, - PayStatus = a.PayStatus, + PayStatus = a.PayStatus ?? 0, PayTime = a.PayTime, ACOOLYOrderNo = a.ACOOLYOrderNo, RefundCredentialsImgUrl = a.RefundCredentialsImgUrl.GetOssPath(), @@ -403,25 +403,24 @@ CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "璁㈠崟涓嶅瓨鍦�"); var user = await _lifePayUserRepository.FirstOrDefaultAsync(x => x.Id == order.UserId); CheckExtensions.IfTrueThrowUserFriendlyException(user == null, "鐢ㄦ埛涓嶅瓨鍦�"); - var orderpirce = await GetOrderPrice(order.RechargeAmount, order.PayAmount, order.PlatformRate ?? 0, order.ChannleRate ?? 0, order.ChannlesRakeRate ?? 0, order.PremiumRate ?? 0); - + var orderpirce = await GetOrderPrice(order.RechargeAmount ?? 0, order.PayAmount ?? 0, order.PlatformRate ?? 0, order.ChannleRate ?? 0, order.ChannlesRakeRate ?? 0, order.PremiumRate ?? 0); var result = new LifePayOrderOutput() { UserName = user.Name, UserPhoneNumber = user.PhoneNumber, - DiscountAmount = order.DiscountAmount, + DiscountAmount = order.DiscountAmount ?? 0, FinishTime = order.FinishTime, Id = order.Id, OutOrderNo = order.OutOrderNo, LifePayChannle = channle.ChannlesName, - Status = order.LifePayOrderStatus, + Status = order.LifePayOrderStatus ?? 0, LifePayOrderType = order.LifePayOrderType, LifePayType = order.LifePayType, OrderNo = order.OrderNo, - PayAmount = order.PayAmount, - RechargeAmount = order.RechargeAmount, - PayStatus = order.PayStatus, + PayAmount = order.PayAmount ?? 0, + RechargeAmount = order.RechargeAmount ?? 0, + PayStatus = order.PayStatus ?? 0, PayTime = order.PayTime, OrderParamDetailJsonStr = order.OrderParamDetailJsonStr, RefundCredentialsImgUrl = order.RefundCredentialsImgUrl.GetOssPath(), @@ -463,18 +462,18 @@ { UserName = user.Name, UserPhoneNumber = user.PhoneNumber, - DiscountAmount = order.DiscountAmount, + DiscountAmount = order.DiscountAmount ?? 0, FinishTime = order.FinishTime, Id = order.Id, OutOrderNo = order.OutOrderNo, LifePayChannle = channle.ChannlesName, - Status = order.LifePayOrderStatus, + Status = order.LifePayOrderStatus ?? 0, LifePayOrderType = order.LifePayOrderType, LifePayType = order.LifePayType, OrderNo = order.OrderNo, - PayAmount = order.PayAmount, - RechargeAmount = order.RechargeAmount, - PayStatus = order.PayStatus, + PayAmount = order.PayAmount ?? 0, + RechargeAmount = order.RechargeAmount ?? 0, + PayStatus = order.PayStatus ?? 0, PayTime = order.PayTime, RefundCredentialsImgUrl = order.RefundCredentialsImgUrl.GetOssPath(), CreationTime = order.CreationTime, @@ -519,16 +518,16 @@ .Select(x => new UserLifePayOrderOutput { - DiscountAmount = x.DiscountAmount, + DiscountAmount = x.DiscountAmount ?? 0, FinishTime = x.FinishTime, Id = x.Id, - LifePayOrderStatus = x.LifePayOrderStatus, + LifePayOrderStatus = x.LifePayOrderStatus ?? 0, LifePayOrderType = x.LifePayOrderType, LifePayType = x.LifePayType, OrderNo = x.OrderNo, - PayAmount = x.PayAmount, - RechargeAmount = x.RechargeAmount, - PayStatus = x.PayStatus, + PayAmount = x.PayAmount ?? 0, + RechargeAmount = x.RechargeAmount ?? 0, + PayStatus = x.PayStatus ?? 0, PayTime = x.PayTime, OrderParamDetailJsonStr = x.OrderParamDetailJsonStr, RefundCredentialsImgUrl = x.RefundCredentialsImgUrl.GetOssPath(), @@ -550,16 +549,16 @@ .Select(x => new UserLifePayOrderOutput { - DiscountAmount = x.DiscountAmount, + DiscountAmount = x.DiscountAmount ?? 0, FinishTime = x.FinishTime, Id = x.Id, - LifePayOrderStatus = x.LifePayOrderStatus, + LifePayOrderStatus = x.LifePayOrderStatus?? 0 , LifePayOrderType = x.LifePayOrderType, LifePayType = x.LifePayType, OrderNo = x.OrderNo, - PayAmount = x.PayAmount, - RechargeAmount = x.RechargeAmount, - PayStatus = x.PayStatus, + PayAmount = x.PayAmount ?? 0, + RechargeAmount = x.RechargeAmount ?? 0, + PayStatus = x.PayStatus ?? 0, PayTime = x.PayTime, OrderParamDetailJsonStr = x.OrderParamDetailJsonStr, RefundCredentialsImgUrl = x.RefundCredentialsImgUrl.GetOssPath(), @@ -585,7 +584,7 @@ public async Task<LifePayStatusEnum> GetPayStatusByOrderNo(string orderNo) { return await _lifePayOrderRepository.Where(x => x.OrderNo == orderNo) - .Select(x => x.PayStatus) + .Select(x => x.PayStatus ?? 0) .FirstOrDefaultAsync(); } @@ -641,7 +640,7 @@ OrderNo = x.OrderNo, RefundCheckRemark = x.RefundCheckRemark, RefundApplyRemark = x.RefundApplyRemark, - LifePayOrderStatus = x.LifePayOrderStatus, + LifePayOrderStatus = x.LifePayOrderStatus ?? 0, }).FirstOrDefaultAsync(); CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "鏈壘鍒拌鍗曚俊鎭�"); @@ -1015,10 +1014,10 @@ #if DEBUG //var payUrl = await GetPayQRCode(order.LifePayType.Value, order.OrderNo, desc, 0.01m, ip, input.H5Type); - var payUrl = await GetPayQRCode(order.LifePayType.Value, order.OrderNo, desc, order.PayAmount, ip, input.H5Type); + var payUrl = await GetPayQRCode(order.LifePayType.Value, order.OrderNo, desc, order.PayAmount ?? 0, ip, input.H5Type); #else //var payUrl = await GetPayQRCode(order.LifePayType.Value, order.OrderNo, desc, 0.01m, ip, input.H5Type); - var payUrl = await GetPayQRCode(order.LifePayType.Value, order.OrderNo, desc, order.PayAmount, ip, input.H5Type); + var payUrl = await GetPayQRCode(order.LifePayType.Value, order.OrderNo, desc, order.PayAmount??0, ip, input.H5Type); #endif return payUrl; @@ -1063,7 +1062,7 @@ // var result = await PayTransactionsJsAPI(input.OpenId, input.Attach, order.PayAmount, input.OrderNo, desc); - var result = await PayTransactionsJsAPI(input.OpenId, input.PayAppId, input.Attach, order.PayAmount, input.OrderNo, desc); + var result = await PayTransactionsJsAPI(input.OpenId, input.PayAppId, input.Attach, order.PayAmount ?? 0, input.OrderNo, desc); return result; //var payUrl = await GetPayQRCode(order.LifePayType.Value, order.OrderNo, desc, 0.01m, ip, input.H5Type); //var payUrl = await GetPayQRCode(order.LifePayType.Value, order.OrderNo, desc, order.PayAmount, ip, input.H5Type); @@ -1387,7 +1386,7 @@ if (input.LifePayRefundType == LifePayRefundTypeEnum.鍏ㄩ閫�娆�) { - input.RefundPrice = order.PayAmount; + input.RefundPrice = order.PayAmount ?? 0; } if (order.LifePayOrderStatus != LifePayOrderStatusEnum.寰呴��娆� || order.PayStatus != LifePayStatusEnum.宸叉敮浠� || order.LifePayRefundStatus != LifePayRefundStatusEnum.寰呴��娆�) @@ -2026,19 +2025,19 @@ from b in temp.DefaultIfEmpty() select new LifePayOrderListOutput { - DiscountAmount = a.DiscountAmount, + DiscountAmount = a.DiscountAmount ?? 0, FinishTime = a.FinishTime, Id = a.Id, - LifePayOrderStatus = a.LifePayOrderStatus, + LifePayOrderStatus = a.LifePayOrderStatus ?? 0, LifePayOrderType = a.LifePayOrderType, LifePayType = a.LifePayType, OrderNo = a.OrderNo, - PayAmount = a.PayAmount, + PayAmount = a.PayAmount ?? 0, PhoneNumber = a.PhoneNumber, - RechargeAmount = a.RechargeAmount, + RechargeAmount = a.RechargeAmount ?? 0, UserId = a.UserId, OutOrderNo = a.OutOrderNo, - PayStatus = a.PayStatus, + PayStatus = a.PayStatus ?? 0, PayTime = a.PayTime, ACOOLYOrderNo = a.ACOOLYOrderNo, RefundCredentialsImgUrl = a.RefundCredentialsImgUrl.GetOssPath(), @@ -2077,19 +2076,19 @@ from b in temp.DefaultIfEmpty() select new LifePayOrderListOutput { - DiscountAmount = a.DiscountAmount, + DiscountAmount = a.DiscountAmount ?? 0, FinishTime = a.FinishTime, Id = a.Id, - LifePayOrderStatus = a.LifePayOrderStatus, + LifePayOrderStatus = a.LifePayOrderStatus ?? 0, LifePayOrderType = a.LifePayOrderType, LifePayType = a.LifePayType, OrderNo = a.OrderNo, - PayAmount = a.PayAmount, + PayAmount = a.PayAmount ?? 0, PhoneNumber = a.PhoneNumber, - RechargeAmount = a.RechargeAmount, + RechargeAmount = a.RechargeAmount ?? 0, UserId = a.UserId, OutOrderNo = a.OutOrderNo, - PayStatus = a.PayStatus, + PayStatus = a.PayStatus ?? 0, PayTime = a.PayTime, ACOOLYOrderNo = a.ACOOLYOrderNo, RefundCredentialsImgUrl = a.RefundCredentialsImgUrl.GetOssPath(), diff --git a/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs b/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs index a5aa6a3..f6fec66 100644 --- a/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs +++ b/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs @@ -65,9 +65,9 @@ Id = GuidGenerator.Create(), CreationTime = DateTime.Now, Amount = 0, - AccumulatedReceipts = accumulatedReceipts, - AccumulatedIncome = accumulatedIncome, - ReceiptsYesterday = receiptsYesterday, + AccumulatedReceipts = accumulatedReceipts??0, + AccumulatedIncome = accumulatedIncome ?? 0, + ReceiptsYesterday = receiptsYesterday ?? 0, AccumulatedOrders = accumulatedOrders, OrdersNumYesterday = ordersNumYesterday, YesterdaySuccess = yesterdaySuccess, diff --git a/LifePayment/LifePayment.Domain/LifePay/LifePayOrder.cs b/LifePayment/LifePayment.Domain/LifePay/LifePayOrder.cs index f6c1394..c9899cf 100644 --- a/LifePayment/LifePayment.Domain/LifePay/LifePayOrder.cs +++ b/LifePayment/LifePayment.Domain/LifePay/LifePayOrder.cs @@ -36,19 +36,19 @@ /// <summary> /// 鍏呭�奸噾棰� /// </summary> - public decimal RechargeAmount { get; set; } + public decimal? RechargeAmount { get; set; } /// <summary> /// 浼樻儬閲戦 /// </summary> - public decimal DiscountAmount { get; set; } + public decimal? DiscountAmount { get; set; } /// <summary> /// 瀹炰粯閲戦 /// </summary> - public decimal PayAmount { get; set; } + public decimal? PayAmount { get; set; } /// <summary> /// 骞冲彴鎵f閲戦 @@ -63,7 +63,7 @@ /// <summary> /// 鏀粯鐘舵�� /// </summary> - public LifePayStatusEnum PayStatus { get; set; } + public LifePayStatusEnum? PayStatus { get; set; } /// <summary> /// 澶栭儴璁㈠崟鍙� @@ -73,7 +73,7 @@ /// <summary> /// 閫�娆捐鍗曞彿 /// </summary> - public string? RefundOrderNo { get; set; } + public string RefundOrderNo { get; set; } /// <summary> /// 娓犻亾娴佹按鍙� @@ -83,7 +83,7 @@ /// <summary> /// 骞冲彴璁㈠崟鐘舵�� /// </summary> - public LifePayOrderStatusEnum LifePayOrderStatus { get; set; } + public LifePayOrderStatusEnum? LifePayOrderStatus { get; set; } /// <summary> /// 渚涘簲鍟嗙姸鎬� @@ -135,7 +135,7 @@ /// </summary> public Guid? RefundCheckUserId { get; set; } - public string? ChannelId { get; set; } + public string ChannelId { get; set; } /// <summary> /// 閫�娆鹃噾棰� @@ -160,12 +160,12 @@ /// <summary> /// 鍥炲崟鍦板潃 /// </summary> - public string? ElecBillUrl { get; set; } + public string ElecBillUrl { get; set; } /// <summary> /// 閫�娆惧洖鍗曞湴鍧� /// </summary> - public string? RefundElecBillUrl { get; set; } + public string RefundElecBillUrl { get; set; } /// <summary> -- Gitblit v1.9.1