| | |
| | | using Volo.Abp.EventBus.Distributed; |
| | | using Z.EntityFramework.Plus; |
| | | using ZeroD.Util; |
| | | using ZeroD.Util.Fadd; |
| | | using static LifePayment.Domain.Shared.LifePaymentConstant; |
| | | |
| | | namespace LifePayment.Application; |
| | |
| | | order.OutRequestNo = result.RequestNo.IsNullOrEmpty() ? null : result.RequestNo; |
| | | order.ACOOLYOrderNo = result.ACOOLYOrderNo; |
| | | order.ACOOLYStatus = ACOOLYStatusEnum.充值中; |
| | | await _lifePayOrderRepository.UpdateAsync(order); |
| | | _logger.LogInformation("生活缴费订单:" + order.ToJson()); |
| | | |
| | | /// 创建生活缴费消费记录 |
| | |
| | | order.LifePayRefundStatus = LifePayRefundStatusEnum.待退款; |
| | | order.ACOOLYStatus = ACOOLYStatusEnum.充值失败; |
| | | order.RefundApplyRemark = ex.Message; |
| | | await _lifePayOrderRepository.UpdateAsync(order); |
| | | _logger.LogError("生活缴费订单状态:" + order.LifePayOrderStatus.ToString()); |
| | | } |
| | | _logger.LogError("生活缴费订单状态:" + order.LifePayOrderStatus.ToString()); |
| | | await _lifePayOrderRepository.UpdateAsync(order); |
| | | } |
| | | |
| | | public async Task LifePayRefundsHandler(string orderNo, LifePayRefundStatusEnum refundStatus) |
| | |
| | | /// <returns></returns> |
| | | public async Task ACOOLYOrderNotifyHandler(string orderNo, string acoolyOrderNo, LifePayOrderStatusEnum status, ACOOLYStatusEnum acoolyStatus, decimal payAmount, string refundApplyRemark, decimal? parValue = 0, decimal? actualParValue = 0) |
| | | { |
| | | await using var orderLock = await distributedLock.TryAcquireAsync($"LockKey:UpdateOrder:{orderNo}", TimeSpan.FromSeconds(60)); |
| | | _logger.LogInformation($"锁:LockKey:UpdateOrder:{orderNo} - {orderLock != null}"); |
| | | |
| | | var order = await _lifePayOrderRepository.Where(x => x.OrderNo == orderNo).FirstOrDefaultAsync(); |
| | | |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "订单不存在"); |
| | | |
| | | await using var orderLock = await distributedLock.TryAcquireAsync($"LockKey:UpdateOrder:{orderNo}", TimeSpan.FromSeconds(60)); |
| | | |
| | | if (order.ACOOLYStatus.HasValue && (int)order.ACOOLYStatus > (int)acoolyStatus) |
| | | { |
| | |
| | | order.RefundPrice = Math.Round((1 - ((order.ActualReceivedAmount ?? 0) / (order.RechargeAmount ?? 0))) * (order.PayAmount ?? 0), 2); |
| | | } |
| | | |
| | | await _lifePayOrderRepository.UpdateAsync(order); |
| | | |
| | | if (order.LifePayOrderStatus == LifePayOrderStatusEnum.已完成) |
| | | { |
| | | ///结算渠道佣金 |
| | |
| | | /// 创建生活缴费消费记录 |
| | | await _lifePayOrderService.CreatLifePayConsumption(acoolyStatus, order.OrderNo, order.ACOOLYOrderNo, |
| | | order.PlatformDeductionAmount ?? 0, order.ChannelId, order.CreationTime, order.FinishTime, order.ChannleRate, parValue, actualParValue); |
| | | |
| | | await CurrentUnitOfWork.SaveChangesAsync(); |
| | | } |
| | | |
| | | /// <summary> |