From 37a0d618c0b33cd817f6ed12c0b54743a2af0ff3 Mon Sep 17 00:00:00 2001 From: zhengyuxuan <zhengyuxuan1995> Date: 星期四, 27 三月 2025 13:40:03 +0800 Subject: [PATCH] Merge branch 'master' into dev-lifepay-v1.3 --- LifePayment/LifePayment.Application/LifePay/LifePayService.cs | 322 ++++++++++++++++++++++++++++++----------------------- 1 files changed, 180 insertions(+), 142 deletions(-) diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs index 0972372..544d13e 100644 --- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs +++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs @@ -51,6 +51,7 @@ private readonly IAlipayInterfaceManager _alipayInterfaceManager; private readonly IWxPayApi _wxPayApi; private readonly WxPayOption _wxPayOptions; + private readonly InitSetting _initSettingOptions; private readonly IACOOLYManager _aCOOLYManager; @@ -67,6 +68,7 @@ IAlipayInterfaceManager aliPayInterfaceManager, IWxPayApi wxPayApi, IOptions<WxPayOption> wxPayOptions, + IOptions<InitSetting> initSettingOptions, IRepository<LifePayChannles, Guid> lifePayChannlesRep, IRepository<LifePayAccount, Guid> lifePayAccount, IDataFilter dataFilter, @@ -83,6 +85,7 @@ _alipayInterfaceManager = aliPayInterfaceManager; _wxPayApi = wxPayApi; _wxPayOptions = wxPayOptions.Value; + _initSettingOptions = initSettingOptions.Value; _distributedEventBus = distributedEventBus; _lifePayChannlesRep = lifePayChannlesRep; _lifePayAccount = lifePayAccount; @@ -194,6 +197,8 @@ .WhereIf(!string.IsNullOrEmpty(input.QueryCondition), x => x.PhoneNumber.Contains(input.QueryCondition) || x.Name.Contains(input.QueryCondition)) .WhereIf(input.CreationTimeBegin.HasValue, x => x.CreationTime >= input.CreationTimeBegin) .WhereIf(input.CreationTimeEnd.HasValue, x => x.CreationTime <= input.CreationTimeEnd) + .WhereIf(input.LoginTimeBegin.HasValue, x => x.LastLoginTime >= input.LoginTimeBegin) + .WhereIf(input.LoginTimeEnd.HasValue, x => x.LastLoginTime <= input.LoginTimeEnd) .Select(x => new UserListOutput() { @@ -263,19 +268,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 +324,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(), @@ -402,25 +407,25 @@ var channle = await _lifePayChannlesRep.FirstOrDefaultAsync(r => r.ChannlesNum == order.ChannelId); CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "璁㈠崟涓嶅瓨鍦�"); var user = await _lifePayUserRepository.FirstOrDefaultAsync(x => x.Id == order.UserId); - var orderpirce = await GetOrderPrice(order.RechargeAmount, order.PayAmount, order.PlatformRate, order.ChannleRate, order.ChannlesRakeRate, order.PremiumRate); - + CheckExtensions.IfTrueThrowUserFriendlyException(user == null, "鐢ㄦ埛涓嶅瓨鍦�"); + 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(), @@ -441,7 +446,8 @@ ChannlesRakePrice = orderpirce.ChannlesRakePrice, PremiumRate = order.PremiumRate, PremiumPrice = orderpirce.PremiumPrice, - Profit = orderpirce.Profit + Profit = orderpirce.Profit, + RefundOrderNo = order.RefundOrderNo, }; return result; @@ -461,18 +467,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, @@ -517,16 +523,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(), @@ -548,16 +554,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(), @@ -583,7 +589,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(); } @@ -639,7 +645,7 @@ OrderNo = x.OrderNo, RefundCheckRemark = x.RefundCheckRemark, RefundApplyRemark = x.RefundApplyRemark, - LifePayOrderStatus = x.LifePayOrderStatus, + LifePayOrderStatus = x.LifePayOrderStatus ?? 0, }).FirstOrDefaultAsync(); CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "鏈壘鍒拌鍗曚俊鎭�"); @@ -834,6 +840,11 @@ var channle = await GetLifePayChannlesDtoByNum(input.ChannelId); CheckExtensions.IfTrueThrowUserFriendlyException(channle == null, "娓犻亾涓嶅瓨鍦�"); + var repeatOrder = await _lifePayOrderRepository.Where(x => x.LifePayOrderType == LifePayOrderTypeEnum.璇濊垂璁㈠崟 && x.PayStatus == LifePayStatusEnum.宸叉敮浠� + && 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(), "鏈厤缃姌鎵�"); @@ -859,7 +870,7 @@ RechargeAmount = amount.RechargeAmount, ChannelId = channle.ChannlesNum, PlatformRate = platformRate.Rate, - PlatformDeductionAmount = amount.RechargeAmount * platformRate.Rate /100, + PlatformDeductionAmount = amount.RechargeAmount * platformRate.Rate / 100, ChannleRate = rate, ChannlesRakeRate = channle.ChannlesRakeRate, //ChannlesRakePrice = amount.RechargeAmount * (channle.ChannlesRate - platformRate.Rate) / 100 * channle.ChannlesRakeRate / 100 @@ -890,7 +901,10 @@ //var rate = await GetRate(); //CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "鏈厤缃姌鎵�"); - + var repeatOrder = await _lifePayOrderRepository.Where(x => x.LifePayOrderType == LifePayOrderTypeEnum.鐢佃垂璁㈠崟 && x.PayStatus == LifePayStatusEnum.宸叉敮浠� + && 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.榛樿鐢佃垂鎶樻墸); @@ -942,6 +956,10 @@ //var rate = await GetRate(); //CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "鏈厤缃姌鎵�"); + var repeatOrder = await _lifePayOrderRepository.Where(x => x.LifePayOrderType == LifePayOrderTypeEnum.鐕冩皵璁㈠崟 && x.PayStatus == LifePayStatusEnum.宸叉敮浠� + && 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.榛樿鐕冩皵鎶樻墸); @@ -1013,10 +1031,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; @@ -1061,7 +1079,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); @@ -1320,7 +1338,7 @@ case LifePayRefundStatusEnum.閫�娆句腑: order.LifePayOrderStatus = LifePayOrderStatusEnum.閫�娆句腑; break; - default:break; + default: break; } } @@ -1330,7 +1348,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) { var order = await _lifePayOrderRepository.Where(x => x.OrderNo == orderNo).FirstOrDefaultAsync(); CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "璁㈠崟涓嶅瓨鍦�"); @@ -1385,7 +1403,7 @@ if (input.LifePayRefundType == LifePayRefundTypeEnum.鍏ㄩ閫�娆�) { - input.RefundPrice = order.PayAmount; + input.RefundPrice = order.PayAmount ?? 0; } if (order.LifePayOrderStatus != LifePayOrderStatusEnum.寰呴��娆� || order.PayStatus != LifePayStatusEnum.宸叉敮浠� || order.LifePayRefundStatus != LifePayRefundStatusEnum.寰呴��娆�) @@ -1398,7 +1416,7 @@ switch (order.LifePayType) { case LifePayTypeEnum.WxPay: - var wxRefundResult = await WxPayDomesticRefunds(order.OrderNo, outRefundNo,order.RefundApplyRemark, Convert.ToInt32(input.RefundPrice * 100), Convert.ToInt32(order.PayAmount * 100)); + var wxRefundResult = await WxPayDomesticRefunds(order.OrderNo, outRefundNo, order.RefundApplyRemark, Convert.ToInt32(input.RefundPrice * 100), Convert.ToInt32(order.PayAmount * 100)); if (wxRefundResult.Status == "SUCCESS") { order.LifePayOrderStatus = LifePayOrderStatusEnum.宸查��娆�; @@ -1500,7 +1518,7 @@ /// <param name="total"></param> /// <param name="currency"></param> /// <returns></returns> - public async Task<WxPayDomesticRefundsReponse> WxPayDomesticRefunds(string outTradeNo,string outRefundNo, string reason, int refund, int total, string currency = "CNY") + public async Task<WxPayDomesticRefundsReponse> WxPayDomesticRefunds(string outTradeNo, string outRefundNo, string reason, int refund, int total, string currency = "CNY") { WxPayDomesticRefundsRequest req = new WxPayDomesticRefundsRequest { @@ -1535,7 +1553,7 @@ var userAccount = await _lifePayAccount.Where(x => x.UserId == input.UserId && x.Id == input.Id) .FirstOrDefaultAsync(); CheckExtensions.IfTrueThrowUserFriendlyException(userAccount == null, "鎴峰彿涓嶅瓨鍦�"); - var repeatAccountContent = await _lifePayAccount.Where(x => x.UserId == input.UserId && x.LifePayType == input.LifePayType && x.Content == input.Content && x.Id != input.Id) + var repeatAccountContent = await _lifePayAccount.Where(x => x.UserId == input.UserId && x.LifePayType == input.LifePayType && x.Content == input.Content && x.Id != input.Id && x.IsDeleted == false) .FirstOrDefaultAsync(); CheckExtensions.IfTrueThrowUserFriendlyException(repeatAccountContent != null, "鎴峰彿宸插瓨鍦�"); @@ -1549,22 +1567,36 @@ } else { - var repeatAccountContent = await _lifePayAccount.Where(x => x.UserId == input.UserId && x.LifePayType == input.LifePayType && x.Content == input.Content) + var repeatAccountContent = await _lifePayAccount.Where(x => x.UserId == input.UserId && x.LifePayType == input.LifePayType && x.Content == input.Content && x.IsDeleted == false) .FirstOrDefaultAsync(); - CheckExtensions.IfTrueThrowUserFriendlyException(repeatAccountContent != null, "鎴峰彿宸插瓨鍦�"); - var userAccount = new LifePayAccount + /// CheckExtensions.IfTrueThrowUserFriendlyException(repeatAccountContent != null, "鎴峰彿宸插瓨鍦�"); + if (repeatAccountContent != null) { - Id = Guid.NewGuid(), - UserId = input.UserId, - Content = input.Content, - Province = input.Province, - LifePayType = input.LifePayType, - City = input.City, - Remark = input.Remark, - Operators = input.Operators, - ExtraProperties = input.ExtraProperties, - }; - await _lifePayAccount.InsertAsync(userAccount); + repeatAccountContent.LifePayType = input.LifePayType; + repeatAccountContent.Content = input.Content; + repeatAccountContent.Province = input.Province; + repeatAccountContent.City = input.City; + repeatAccountContent.Remark = input.Remark; + repeatAccountContent.Operators = input.Operators; + repeatAccountContent.ExtraProperties = input.ExtraProperties; + } + else + { + var userAccount = new LifePayAccount + { + Id = Guid.NewGuid(), + UserId = input.UserId, + Content = input.Content, + Province = input.Province, + LifePayType = input.LifePayType, + City = input.City, + Remark = input.Remark, + Operators = input.Operators, + ExtraProperties = input.ExtraProperties, + }; + await _lifePayAccount.InsertAsync(userAccount); + } + } if (input.LifePayType == LifePayOrderTypeEnum.璇濊垂璁㈠崟) @@ -1797,15 +1829,21 @@ private (decimal PayAmont, decimal DiscountAmount, decimal RechargeAmount) CalculateAmount(decimal amount, decimal rate) { - /// 姝e父鏀粯 - var payAmount = decimal.Round(amount * rate / 100, 2, MidpointRounding.AwayFromZero); + if (_initSettingOptions.OpenTheOnePennyTest) + { + /// 1鍒嗛挶鏀粯 + decimal payAmount = 0.01m; - /// 1鍒嗛挶鏀粯 - //decimal payAmount = 0.01m; + CheckExtensions.IfTrueThrowUserFriendlyException(payAmount < 0.01m, "鏀粯閲戦閿欒"); - CheckExtensions.IfTrueThrowUserFriendlyException(payAmount < 0.01m, "鏀粯閲戦閿欒"); - - return (payAmount, amount - payAmount, amount); + return (payAmount, amount - payAmount, amount); + } + else + { + /// 姝e父鏀粯 + var payAmount = decimal.Round(amount * rate / 100, 2, MidpointRounding.AwayFromZero); + return (payAmount, amount - payAmount, amount); + } } private void SetOrderStatus(LifePayOrder order, string code) @@ -2020,39 +2058,39 @@ .WhereIf(input.LifePayOrderType.HasValue, x => x.LifePayOrderType == input.LifePayOrderType.Value) .WhereIf(input.UserId.HasValue, x => x.UserId == input.UserId.Value) .WhereIf(input.KeyWords.IsNotNullOrEmpty(), x => x.OrderNo.Contains(input.KeyWords) || x.OutOrderNo.Contains(input.KeyWords) || x.ACOOLYOrderNo.Contains(input.KeyWords) || channles.Contains(x.ChannelId)) - join b in _lifePayChannlesRep on a.ChannelId equals b.ChannlesNum into temp - from b in temp.DefaultIfEmpty() - select new LifePayOrderListOutput - { - DiscountAmount = a.DiscountAmount, - FinishTime = a.FinishTime, - Id = a.Id, - LifePayOrderStatus = a.LifePayOrderStatus, - LifePayOrderType = a.LifePayOrderType, - LifePayType = a.LifePayType, - OrderNo = a.OrderNo, - PayAmount = a.PayAmount, - PhoneNumber = a.PhoneNumber, - RechargeAmount = a.RechargeAmount, - UserId = a.UserId, - OutOrderNo = a.OutOrderNo, - PayStatus = a.PayStatus, - PayTime = a.PayTime, - ACOOLYOrderNo = a.ACOOLYOrderNo, - RefundCredentialsImgUrl = a.RefundCredentialsImgUrl.GetOssPath(), - RefundPrice = a.RefundPrice, - CreationTime = a.CreationTime, - RefundCheckRemark = a.RefundCheckRemark, - RefundApplyRemark = a.RefundApplyRemark, - RefundTime = a.RefundTime, - ChannelName = b.ChannlesName, - ActualRechargeAmount = a.ActualRechargeAmount, - PlatformDeductionAmount = a.PlatformDeductionAmount, - ACOOLYStatus = a.ACOOLYStatus, - LifePayRefundStatus = a.LifePayRefundStatus, - }); + join b in _lifePayChannlesRep on a.ChannelId equals b.ChannlesNum into temp + from b in temp.DefaultIfEmpty() + select new LifePayOrderListOutput + { + DiscountAmount = a.DiscountAmount ?? 0, + FinishTime = a.FinishTime, + Id = a.Id, + LifePayOrderStatus = a.LifePayOrderStatus ?? 0, + LifePayOrderType = a.LifePayOrderType, + LifePayType = a.LifePayType, + OrderNo = a.OrderNo, + PayAmount = a.PayAmount ?? 0, + PhoneNumber = a.PhoneNumber, + RechargeAmount = a.RechargeAmount ?? 0, + UserId = a.UserId, + OutOrderNo = a.OutOrderNo, + PayStatus = a.PayStatus ?? 0, + PayTime = a.PayTime, + ACOOLYOrderNo = a.ACOOLYOrderNo, + RefundCredentialsImgUrl = a.RefundCredentialsImgUrl.GetOssPath(), + RefundPrice = a.RefundPrice, + CreationTime = a.CreationTime, + RefundCheckRemark = a.RefundCheckRemark, + RefundApplyRemark = a.RefundApplyRemark, + RefundTime = a.RefundTime, + ChannelName = b.ChannlesName, + ActualRechargeAmount = a.ActualRechargeAmount, + PlatformDeductionAmount = a.PlatformDeductionAmount, + ACOOLYStatus = a.ACOOLYStatus, + LifePayRefundStatus = a.LifePayRefundStatus, + }); - + return result; } @@ -2071,40 +2109,40 @@ .WhereIf(input.LifePayOrderType.HasValue, x => x.LifePayOrderType == input.LifePayOrderType.Value) .WhereIf(input.UserId.HasValue, x => x.UserId == input.UserId.Value) .WhereIf(input.KeyWords.IsNotNullOrEmpty(), x => x.PhoneNumber.Contains(input.KeyWords) || x.OrderNo.Contains(input.KeyWords) || x.OutOrderNo.Contains(input.KeyWords) || x.ACOOLYOrderNo.Contains(input.KeyWords)) - join b in _lifePayChannlesRep on a.ChannelId equals b.ChannlesNum into temp - from b in temp.DefaultIfEmpty() - select new LifePayOrderListOutput - { - DiscountAmount = a.DiscountAmount, - FinishTime = a.FinishTime, - Id = a.Id, - LifePayOrderStatus = a.LifePayOrderStatus, - LifePayOrderType = a.LifePayOrderType, - LifePayType = a.LifePayType, - OrderNo = a.OrderNo, - PayAmount = a.PayAmount, - PhoneNumber = a.PhoneNumber, - RechargeAmount = a.RechargeAmount, - UserId = a.UserId, - OutOrderNo = a.OutOrderNo, - PayStatus = a.PayStatus, - PayTime = a.PayTime, - ACOOLYOrderNo = a.ACOOLYOrderNo, - RefundCredentialsImgUrl = a.RefundCredentialsImgUrl.GetOssPath(), - CreationTime = a.CreationTime, - RefundCheckRemark = a.RefundCheckRemark, - RefundApplyRemark = a.RefundApplyRemark, - RefundApplyTime = a.RefundApplyTime, - RefundTime = a.RefundTime, - RefundOrderNo = a.RefundOrderNo, - RefundPrice = a.RefundPrice, - ChannelName = b.ChannlesName, - ActualRechargeAmount = a.ActualRechargeAmount, - PlatformDeductionAmount = a.PlatformDeductionAmount, - ACOOLYStatus = a.ACOOLYStatus, - LifePayRefundStatus = a.LifePayRefundStatus, - ActualReceivedAmount = a.ActualReceivedAmount.HasValue? a.ActualReceivedAmount.Value : 0 - }); + join b in _lifePayChannlesRep on a.ChannelId equals b.ChannlesNum into temp + from b in temp.DefaultIfEmpty() + select new LifePayOrderListOutput + { + DiscountAmount = a.DiscountAmount ?? 0, + FinishTime = a.FinishTime, + Id = a.Id, + LifePayOrderStatus = a.LifePayOrderStatus ?? 0, + LifePayOrderType = a.LifePayOrderType, + LifePayType = a.LifePayType, + OrderNo = a.OrderNo, + PayAmount = a.PayAmount ?? 0, + PhoneNumber = a.PhoneNumber, + RechargeAmount = a.RechargeAmount ?? 0, + UserId = a.UserId, + OutOrderNo = a.OutOrderNo, + PayStatus = a.PayStatus ?? 0, + PayTime = a.PayTime, + ACOOLYOrderNo = a.ACOOLYOrderNo, + RefundCredentialsImgUrl = a.RefundCredentialsImgUrl.GetOssPath(), + CreationTime = a.CreationTime, + RefundCheckRemark = a.RefundCheckRemark, + RefundApplyRemark = a.RefundApplyRemark, + RefundApplyTime = a.RefundApplyTime, + RefundTime = a.RefundTime, + RefundOrderNo = a.RefundOrderNo, + RefundPrice = a.RefundPrice, + ChannelName = b.ChannlesName, + ActualRechargeAmount = a.ActualRechargeAmount, + PlatformDeductionAmount = a.PlatformDeductionAmount, + ACOOLYStatus = a.ACOOLYStatus, + LifePayRefundStatus = a.LifePayRefundStatus, + ActualReceivedAmount = a.ActualReceivedAmount.HasValue ? a.ActualReceivedAmount.Value : 0 + }); return result; } private IQueryable<CreateEditPayChannelsInput> GetLifePayChannlesListFilter() @@ -2123,8 +2161,8 @@ }); } - public async Task<OrderPriceReturn> GetOrderPrice(decimal price, decimal priceAmount, decimal? platformRate,decimal? channleRate, - decimal? channlesRakeRate,decimal? premiumRate) + public async Task<OrderPriceReturn> GetOrderPrice(decimal price, decimal priceAmount, decimal platformRate, decimal channleRate, + decimal channlesRakeRate, decimal premiumRate) { /// 姣涘埄 var grossProfit = price * (channleRate - platformRate) / 100; @@ -2133,20 +2171,20 @@ var platformPrice = price * platformRate / 100; /// 鎵嬬画璐� - var premiumPrice = priceAmount * premiumRate / 100; + var premiumPrice = priceAmount * (premiumRate) / 100; /// 娓犻亾浣i噾 锛�(鍏呭�奸潰棰� * 娓犻亾鎶樻墸姣斾緥)-(鍏呭�奸潰棰� * 骞冲彴鎶樻墸姣斾緥)锛�* 浣i噾姣斾緥 - var channlesRakePrice = grossProfit * channlesRakeRate / 100; + var channlesRakePrice = grossProfit * (channlesRakeRate) / 100; /// 鍒╂鼎 - var profit = grossProfit - channlesRakePrice - premiumPrice; + var profit = grossProfit - channlesRakePrice - (premiumRate); return new OrderPriceReturn() { - PlatformPrice = platformPrice.HasValue? platformPrice.Value :0, - PremiumPrice = premiumPrice.HasValue ? premiumPrice.Value : 0, - ChannlesRakePrice = channlesRakePrice.HasValue? channlesRakePrice.Value:0, - Profit = profit.HasValue ? profit.Value : 0 + PlatformPrice = platformPrice, + PremiumPrice = premiumPrice, + ChannlesRakePrice = channlesRakePrice, + Profit = profit }; } -- Gitblit v1.9.1