| | |
| | | using Volo.Abp.ObjectMapping; |
| | | using NPOI.SS.Formula.Functions; |
| | | using StackExchange.Redis; |
| | | using static Volo.Abp.Identity.Settings.IdentitySettingNames; |
| | | |
| | | namespace LifePayment.Application; |
| | | |
| | |
| | | /// <returns></returns> |
| | | public async Task<ChannelRateOutput> GetChannelRate(ChannelsBaseInput input) |
| | | { |
| | | return _lifePayChannlesRep.Where(x => x.IsDeleted == false && x.ChannlesNum == input.CheckChannelId).Select(x => new ChannelRateOutput() { ChannlesRate = x.ChannlesRate }) |
| | | return _lifePayChannlesRep.Where(x => x.IsDeleted == false && x.ChannlesNum == input.CheckChannelId).Select(x => new ChannelRateOutput() { ChannlesRate = x.ChannlesRate }) |
| | | .FirstOrDefault(); |
| | | } |
| | | |
| | |
| | | s.PayAmountStr = s.PayAmount.ToString("F2"); |
| | | s.LifePayTypeStr = s.LifePayType.GetDescription(); |
| | | s.FinishTimeStr = !s.FinishTime.HasValue ? string.Empty : s.FinishTime.Value.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmm); |
| | | s.RefundApplyTimeStr = !s.RefundApplyTime.HasValue? string.Empty:s.RefundApplyTime.Value.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmm); |
| | | s.RefundApplyTimeStr = !s.RefundApplyTime.HasValue ? string.Empty : s.RefundApplyTime.Value.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmm); |
| | | }); |
| | | return result; |
| | | } |
| | |
| | | { |
| | | var order = await _lifePayOrderRepository.Where(x => x.OrderNo == orderNo).FirstOrDefaultAsync(); |
| | | var channle = await _lifePayChannlesRep.FirstOrDefaultAsync(r => r.ChannlesNum == order.ChannelId); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "订单不存在"); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "订单不存在"); |
| | | var user = await _lifePayUserRepository.FirstOrDefaultAsync(x => x.Id == order.UserId); |
| | | var channlesRakePrice = (order.PayAmount - (order.PlatformDeductionAmount == null ? 0 : order.PlatformDeductionAmount)) * channle.ChannlesRakeRate / 100; |
| | | var orderpirce = await GetOrderPrice(order.RechargeAmount, order.PayAmount,order.PlatformRate, order.ChannleRate, order.ChannlesRakeRate,order.PremiumRate); |
| | | var orderpirce = await GetOrderPrice(order.RechargeAmount, order.PayAmount, order.PlatformRate, order.ChannleRate, order.ChannlesRakeRate, order.PremiumRate); |
| | | |
| | | |
| | | var result = new LifePayOrderOutput() |
| | | { |
| | | { |
| | | UserName = user.Name, |
| | | UserPhoneNumber = user.PhoneNumber, |
| | | DiscountAmount = order.DiscountAmount, |
| | |
| | | LifePayType = x.LifePayType, |
| | | OrderNo = x.OrderNo, |
| | | PayAmount = x.PayAmount, |
| | | ActualRechargeAmount = x.ActualRechargeAmount.HasValue?x.ActualRechargeAmount.Value:0, |
| | | ActualRechargeAmount = x.ActualRechargeAmount.HasValue ? x.ActualRechargeAmount.Value : 0, |
| | | PhoneNumber = x.PhoneNumber, |
| | | RechargeAmount = x.RechargeAmount, |
| | | OutOrderNo = x.OutOrderNo, |
| | |
| | | var amount = CalculateAmount(input.ProductData.ParValue, rate.FirstOrDefault(x => x.RateType == LifePayRateTypeEnum.默认话费折扣).Rate); |
| | | |
| | | var platformRate = await _lifePayRateRepository.FirstOrDefaultAsync(r => r.RateType == LifePayRateTypeEnum.供应商折扣价); |
| | | |
| | | |
| | | |
| | | var orderInput = new CreateLifePayOrderInput |
| | | { |
| | |
| | | RechargeAmount = amount.RechargeAmount, |
| | | ChannelId = channle.ChannlesNum, |
| | | PlatformRate = platformRate.Rate, |
| | | PlatformDeductionAmount = amount.RechargeAmount * platformRate.Rate /100, |
| | | PlatformDeductionAmount = amount.RechargeAmount * platformRate.Rate / 100, |
| | | ChannleRate = channle.ChannlesRate, |
| | | ChannlesRakeRate = channle.ChannlesRakeRate, |
| | | //ChannlesRakePrice = amount.RechargeAmount * (channle.ChannlesRate - platformRate.Rate) / 100 * channle.ChannlesRakeRate / 100 |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 修改实际到账金额 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | public async Task<int> UpdateLifePayOrderActualReceivedAmount(UpdateLifePayOrderInput input) |
| | | { |
| | | var order = await _lifePayOrderRepository.Where(x => x.Id == input.Id).FirstOrDefaultAsync(); |
| | | |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "订单不存在"); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(order.ACOOLYStatus != ACOOLYStatusEnum.部分充值成功, "该订单无法修改到账金额"); |
| | | |
| | | order.ActualReceivedAmount = input.ActualReceivedAmount; |
| | | |
| | | await _lifePayOrderRepository.UpdateAsync(order); |
| | | |
| | | return Constant.SUCCESS; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 创建生活缴费订单 |
| | | /// </summary> |
| | | /// <param name="input"></param> |