From 9ae09cab250590a8b6a5e7bd33139578f5200011 Mon Sep 17 00:00:00 2001 From: zhengyuxuan <zhengyuxuan1995> Date: 星期四, 27 三月 2025 10:27:25 +0800 Subject: [PATCH] Merge branch 'master' into dev-lifepay-v1.3 --- LifePayment/LifePayment.Application/LifePay/LifePayService.cs | 109 ++++++++++++++++++++++++++++++------------------------ 1 files changed, 60 insertions(+), 49 deletions(-) diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs index d422ac7..c6b0d54 100644 --- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs +++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs @@ -265,19 +265,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(), @@ -321,19 +321,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(), @@ -405,25 +405,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(), @@ -465,18 +464,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, @@ -521,16 +520,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(), @@ -552,16 +551,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(), @@ -587,7 +586,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(); } @@ -643,7 +642,7 @@ OrderNo = x.OrderNo, RefundCheckRemark = x.RefundCheckRemark, RefundApplyRemark = x.RefundApplyRemark, - LifePayOrderStatus = x.LifePayOrderStatus, + LifePayOrderStatus = x.LifePayOrderStatus ?? 0, }).FirstOrDefaultAsync(); CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "鏈壘鍒拌鍗曚俊鎭�"); @@ -838,6 +837,11 @@ var channle = await GetLifePayChannlesDtoByNum(input.ChannelId); CheckExtensions.IfTrueThrowUserFriendlyException(channle == null, "娓犻亾涓嶅瓨鍦�"); + var repeatOrder = await _lifePayOrderRepository.Where(x => x.LifePayOrderType == LifePayOrderTypeEnum.璇濊垂璁㈠崟 + && x.LifePayOrderStatus == LifePayOrderStatusEnum.鍏呭�间腑 && x.OrderParamDetailJsonStr.Contains(input.ProductData.IspCode) + && x.OrderParamDetailJsonStr.Contains(input.ProductData.Phone)).ToListAsync(); + CheckExtensions.IfTrueThrowUserFriendlyException(repeatOrder.Count() > 0, "鎮ㄦ湁鍚屾埛鍙疯鍗曟鍦ㄥ厖鍊间腑锛岃鍕块噸澶嶅厖鍊�"); + //var rate = await GetRate(); //CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "鏈厤缃姌鎵�"); @@ -894,7 +898,10 @@ //var rate = await GetRate(); //CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "鏈厤缃姌鎵�"); - + var repeatOrder = await _lifePayOrderRepository.Where(x => x.LifePayOrderType == LifePayOrderTypeEnum.鐢佃垂璁㈠崟 + && x.LifePayOrderStatus == LifePayOrderStatusEnum.鍏呭�间腑 && x.OrderParamDetailJsonStr.Contains(input.ProductData.ElectricType) + && x.OrderParamDetailJsonStr.Contains(input.ProductData.ElectricAccount)).ToListAsync(); + CheckExtensions.IfTrueThrowUserFriendlyException(repeatOrder.Count() > 0, "鎮ㄦ湁鍚屾埛鍙疯鍗曟鍦ㄥ厖鍊间腑锛岃鍕块噸澶嶅厖鍊�"); var rate = await GetLifePayRate(channle, LifePayRateTypeEnum.榛樿鐢佃垂鎶樻墸); @@ -946,6 +953,10 @@ //var rate = await GetRate(); //CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "鏈厤缃姌鎵�"); + var repeatOrder = await _lifePayOrderRepository.Where(x => x.LifePayOrderType == LifePayOrderTypeEnum.鐕冩皵璁㈠崟 + && x.LifePayOrderStatus == LifePayOrderStatusEnum.鍏呭�间腑 && x.OrderParamDetailJsonStr.Contains(input.ProductData.GasOrgType) + && x.OrderParamDetailJsonStr.Contains(input.ProductData.GasAccount)).ToListAsync(); + CheckExtensions.IfTrueThrowUserFriendlyException(repeatOrder.Count() > 0, "鎮ㄦ湁鍚屾埛鍙疯鍗曟鍦ㄥ厖鍊间腑锛岃鍕块噸澶嶅厖鍊�"); var rate = await GetLifePayRate(channle, LifePayRateTypeEnum.榛樿鐕冩皵鎶樻墸); @@ -1017,10 +1028,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; @@ -1065,7 +1076,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); @@ -1389,7 +1400,7 @@ if (input.LifePayRefundType == LifePayRefundTypeEnum.鍏ㄩ閫�娆�) { - input.RefundPrice = order.PayAmount; + input.RefundPrice = order.PayAmount ?? 0; } if (order.LifePayOrderStatus != LifePayOrderStatusEnum.寰呴��娆� || order.PayStatus != LifePayStatusEnum.宸叉敮浠� || order.LifePayRefundStatus != LifePayRefundStatusEnum.寰呴��娆�) @@ -2042,19 +2053,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(), @@ -2093,19 +2104,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(), -- Gitblit v1.9.1