| | |
| | | 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; |
| | |
| | | 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; |
| | | |
| | |
| | | DiscountAmount = a.DiscountAmount ?? 0, |
| | | FinishTime = a.FinishTime, |
| | | Id = a.Id, |
| | | LifePayOrderStatus = a.LifePayOrderStatus?? 0, |
| | | LifePayOrderStatus = a.LifePayOrderStatus ?? 0, |
| | | LifePayOrderType = a.LifePayOrderType, |
| | | LifePayType = a.LifePayType, |
| | | OrderNo = a.OrderNo, |
| | | PayAmount = a.PayAmount ?? 0, |
| | | PhoneNumber = a.PhoneNumber, |
| | | RechargeAmount = a.RechargeAmount??0, |
| | | RechargeAmount = a.RechargeAmount ?? 0, |
| | | UserId = a.UserId, |
| | | OutOrderNo = a.OutOrderNo, |
| | | PayStatus = a.PayStatus?? 0, |
| | | PayStatus = a.PayStatus ?? 0, |
| | | PayTime = a.PayTime, |
| | | ACOOLYOrderNo = a.ACOOLYOrderNo, |
| | | RefundCredentialsImgUrl = a.RefundCredentialsImgUrl.GetOssPath(), |
| | |
| | | RefundTime = a.RefundTime, |
| | | ChannelName = b.ChannlesName, |
| | | ActualRechargeAmount = a.RechargeAmount, |
| | | ActualReceivedAmount = a.ActualReceivedAmount, |
| | | PlatformDeductionAmount = a.PlatformDeductionAmount, |
| | | ACOOLYStatus = a.ACOOLYStatus, |
| | | LifePayRefundStatus = a.LifePayRefundStatus, |
| | |
| | | .WhereIf(input.ACOOLYStatus.HasValue, x => x.ACOOLYStatus == input.ACOOLYStatus.Value) |
| | | .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.RefundOrderNo.Contains(input.KeyWords) || x.OutOrderNo.Contains(input.KeyWords) || x.ACOOLYOrderNo.Contains(input.KeyWords)) |
| | | .WhereIf(input.KeyWords.IsNotNullOrEmpty(), x => x.PhoneNumber.Contains(input.KeyWords) || x.RefundOrderNo.Contains(input.KeyWords) || x.OutOrderNo.Contains(input.KeyWords) || x.ACOOLYOrderNo.Contains(input.KeyWords) || x.OrderNo.Contains(input.KeyWords)) |
| | | join b in _lifePayChannlesRep on a.ChannelId equals b.ChannlesNum into temp |
| | | from b in temp.DefaultIfEmpty() |
| | | select new LifePayOrderListOutput |
| | |
| | | ACOOLYStatus = x.ACOOLYStatus, |
| | | RefundApplyRemark = x.RefundApplyRemark, |
| | | RechargeAmount = x.RechargeAmount, |
| | | ActualReceivedAmount = x.ActualReceivedAmount.ToString("F2"), |
| | | ActualReceivedAmount = (x.ActualReceivedAmount ?? 0).ToString("F2"), |
| | | LifePayRefundStatus = x.LifePayRefundStatus, |
| | | OrderNo = x.OrderNo, |
| | | |
| | | }).OrderByDescending(r => r.CreationTime).ToListAsync(); |
| | | var i = 0; |
| | |
| | | DiscountAmount = x.DiscountAmount ?? 0, |
| | | FinishTime = x.FinishTime, |
| | | Id = x.Id, |
| | | LifePayOrderStatus = x.LifePayOrderStatus?? 0 , |
| | | LifePayOrderStatus = x.LifePayOrderStatus ?? 0, |
| | | LifePayOrderType = x.LifePayOrderType, |
| | | LifePayType = x.LifePayType, |
| | | OrderNo = x.OrderNo, |
| | |
| | | |
| | | public async Task<List<CreateEditPayChannelsInput>> GetLifePayChannlesAllList(QueryLifePayChannlesInput input) |
| | | { |
| | | return await GetLifePayChannlesListFilter().WhereIf(input.Status.HasValue,x => x.Status == input.Status).ToListAsync(); |
| | | return await GetLifePayChannlesListFilter().WhereIf(input.Status.HasValue, x => x.Status == input.Status).ToListAsync(); |
| | | } |
| | | |
| | | public async Task<CreateEditPayChannelsInput> GetLifePayChannlesDto(Guid id) |
| | |
| | | return await _wxPayApi.WxPayTradeQuery(outTradeNo); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | |
| | | var channle = await GetLifePayChannlesDtoByNum(input.ChannelId); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(channle == null, "渠道不存在"); |
| | | |
| | | var repeatOrder = await _lifePayOrderRepository.Where(x => x.LifePayOrderType == LifePayOrderTypeEnum.PhoneOrder |
| | | var repeatOrder = await _lifePayOrderRepository.Where(x => x.LifePayOrderType == LifePayOrderTypeEnum.PhoneOrder |
| | | && x.PayStatus == LifePayStatusEnum.已支付 |
| | | && x.LifePayOrderStatus == LifePayOrderStatusEnum.充值中 |
| | | && x.OrderParamDetailJsonStr.Contains(input.ProductData.Phone)).AnyAsync(); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(repeatOrder, "您有同户号订单正在充值中,请勿重复充值"); |
| | | |
| | | //var rate = await GetRate(); |
| | | //CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "未配置折扣"); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(repeatOrder, "您有同户号订单正在充值中,请勿重复充值"); |
| | | |
| | | var rate = await GetLifePayRate(channle, LifePayRateTypeEnum.默认话费折扣); |
| | | |
| | |
| | | PlatformDeductionAmount = amount.RechargeAmount * platformRate.Rate / 100, |
| | | ChannleRate = rate, |
| | | ChannlesRakeRate = channle.ChannlesRakeRate, |
| | | //ChannlesRakePrice = amount.RechargeAmount * (channle.ChannlesRate - platformRate.Rate) / 100 * channle.ChannlesRakeRate / 100 |
| | | }; |
| | | |
| | | await CreateLifePayOrder(orderInput); |
| | |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(channle == null, "渠道不存在"); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(channle.Status == LifePayChannelsStatsEnum.禁用, "渠道已被禁用"); |
| | | |
| | | //var rate = await GetRate(); |
| | | //CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "未配置折扣"); |
| | | var repeatOrder = await _lifePayOrderRepository.Where(x => x.LifePayOrderType == LifePayOrderTypeEnum.ElectricOrder && x.PayStatus == LifePayStatusEnum.已支付 |
| | | && x.LifePayOrderStatus == LifePayOrderStatusEnum.充值中 && x.OrderParamDetailJsonStr.Contains(input.ProductData.ElectricType) |
| | | && x.OrderParamDetailJsonStr.Contains(input.ProductData.ElectricAccount)).AnyAsync(); |
| | |
| | | OrderNo = channle.ChannlesNum + CreateOrderNo(), |
| | | LifePayOrderStatus = LifePayOrderStatusEnum.充值中, |
| | | LifePayOrderType = LifePayOrderTypeEnum.ElectricOrder, |
| | | // LifePayType = input.LifePayType, |
| | | OrderParamDetailJsonStr = JsonConvert.SerializeObject(input.ProductData), |
| | | UserId = user.Id, |
| | | PayStatus = LifePayStatusEnum.未支付, |
| | |
| | | RechargeAmount = amount.RechargeAmount, |
| | | ChannelId = channle.ChannlesNum, |
| | | PlatformRate = platformRate.Rate, |
| | | PlatformDeductionAmount = amount.RechargeAmount * platformRate.Rate / 100, |
| | | ChannleRate = rate, |
| | | ChannlesRakeRate = channle.ChannlesRakeRate, |
| | | }; |
| | |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(channle == null, "渠道不存在"); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(channle.Status == LifePayChannelsStatsEnum.禁用, "渠道已被禁用"); |
| | | |
| | | //var rate = await GetRate(); |
| | | //CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "未配置折扣"); |
| | | var repeatOrder = await _lifePayOrderRepository.Where(x => x.LifePayOrderType == LifePayOrderTypeEnum.GasOrder && x.PayStatus == LifePayStatusEnum.已支付 |
| | | && x.LifePayOrderStatus == LifePayOrderStatusEnum.充值中 && x.OrderParamDetailJsonStr.Contains(input.ProductData.GasOrgType) |
| | | && x.OrderParamDetailJsonStr.Contains(input.ProductData.GasAccount)).AnyAsync(); |
| | |
| | | RechargeAmount = amount.RechargeAmount, |
| | | ChannelId = channle.ChannlesNum, |
| | | PlatformRate = platformRate.Rate, |
| | | PlatformDeductionAmount = amount.RechargeAmount * platformRate.Rate / 100, |
| | | ChannleRate = rate, |
| | | ChannlesRakeRate = channle.ChannlesRakeRate, |
| | | }; |
| | |
| | | /// <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, "订单不存在"); |
| | | |
| | | if (order.LifePayOrderStatus >= LifePayOrderStatusEnum.已完成) |
| | | if (order.LifePayOrderStatus == LifePayOrderStatusEnum.已完成) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | order.PlatformDeductionAmount = payAmount; |
| | | // order.PlatformDeductionAmount = payAmount; |
| | | |
| | | if (acoolyOrderNo.IsNotNullOrEmpty()) |
| | | { |
| | | order.ACOOLYOrderNo = acoolyOrderNo; |
| | |
| | | |
| | | /// 创建生活缴费消费记录 |
| | | 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> |
| | |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | |
| | | return new SetPayTypeReturn() |
| | | { |
| | | Desc = desc, |
| | | OrderNo = order.OrderNo, |
| | | PayAmount = order.PayAmount.HasValue? order.PayAmount.Value : 0, |
| | | PayAmount = order.PayAmount.HasValue ? order.PayAmount.Value : 0, |
| | | LifePayType = lifePayType, |
| | | }; |
| | | } |