From b8d3cc1f394d47c9f50a8823577942a468778e69 Mon Sep 17 00:00:00 2001 From: zhengyuxuan <zhengyuxuan1995> Date: 星期四, 20 三月 2025 17:56:34 +0800 Subject: [PATCH] fix;新增字段 --- LifePayment/LifePayment.Application/LifePay/LifePayService.cs | 50 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 47 insertions(+), 3 deletions(-) diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs index 4491695..dc14ec6 100644 --- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs +++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs @@ -23,6 +23,8 @@ using static LifePayment.Domain.Shared.LifePaymentConstant; using ZeroD.Util.Fadd; using Nest; +using Volo.Abp.Domain.Entities; +using Volo.Abp.ObjectMapping; namespace LifePayment.Application; @@ -36,6 +38,7 @@ private readonly IRepository<LifePayOrder, Guid> _lifePayOrderRepository; private readonly IRepository<LifePayUser, Guid> _lifePayUserRepository; private readonly IRepository<LifePayIntroInfo, Guid> _lifePayIntroInfoRepository; + private readonly IRepository<DallyStatistics, Guid> _dallyStatisticsRepository; private readonly IRepository<LifePayChannles, Guid> _lifePayChannlesRep; private readonly IRepository<LifePayAccount, Guid> _lifePayAccount; private readonly IDataFilter dataFilter; @@ -54,6 +57,7 @@ IRepository<LifePayUser, Guid> lifePayUserRepository, IRepository<LifePayPremium, Guid> lifePayPremiumRepository, IRepository<LifePayIntroInfo, Guid> lifePayIntroInfoRepository, + IRepository<DallyStatistics, Guid> dallyStatisticsRepository, IAliPayApi aliPayApi, IWxPayApi wxPayApi, IOptions<WxPayOption> wxPayOptions, @@ -69,6 +73,7 @@ _lifePayUserRepository = lifePayUserRepository; _lifePayPremiumRepository = lifePayPremiumRepository; _lifePayIntroInfoRepository = lifePayIntroInfoRepository; + _dallyStatisticsRepository = dallyStatisticsRepository; _aliPayApi = aliPayApi; _wxPayApi = wxPayApi; _wxPayOptions = wxPayOptions.Value; @@ -80,6 +85,38 @@ } #region 鏌ヨ + + public async Task<TopStatisticsOutput> GetTopStatistics() + { + var today = DateTime.Now.ToString("yyyy-MM-dd"); + var statistics = await _dallyStatisticsRepository.Where(x => x.CreationTime.ToString("yyyy-MM-dd") == today).FirstOrDefaultAsync(); + if (statistics == null) + { + //var accumulatedReceipts = await _lifePayOrderRepository.Where(x => x.CreationTime < today).SumAsync(x => x.PayAmount); + + var entity = new DallyStatistics() + { + Id = GuidGenerator.Create(), + CreationTime = DateTime.Now, + Amount = "0", + AccumulatedReceipts = "0", + ReceiptsYesterda = "0", + AccumulatedOrders = "0", + OrdersNumYesterda = "0", + YesterdaSuccess = "0", + YesterdaFail = "0", + AccumulatedUsers = "0", + }; + + return new TopStatisticsOutput(); + } + else + { + var result = ObjectMapper.Map<DallyStatistics,TopStatisticsOutput>(statistics); + return result; + } + + } /// <summary> /// 鑾峰彇鐢佃垂闈㈠�� @@ -286,7 +323,7 @@ Id = order.Id, OutOrderNo = order.OutOrderNo, LifePayChannle = channle.ChannlesName, - LifePayOrderStatus = order.LifePayOrderStatus, + Status = order.LifePayOrderStatus, LifePayOrderType = order.LifePayOrderType, LifePayType = order.LifePayType, OrderNo = order.OrderNo, @@ -336,7 +373,7 @@ Id = order.Id, OutOrderNo = order.OutOrderNo, LifePayChannle = channle.ChannlesName, - LifePayOrderStatus = order.LifePayOrderStatus, + Status = order.LifePayOrderStatus, LifePayOrderType = order.LifePayOrderType, LifePayType = order.LifePayType, OrderNo = order.OrderNo, @@ -349,6 +386,7 @@ RefundCheckRemark = order.RefundCheckRemark, RefundApplyRemark = order.RefundApplyRemark, RefundTime = order.RefundTime, + RefundOrderNo = order.RefundOrderNo, ACOOLYOrderNo = order.ACOOLYOrderNo, LifePayRefundStatus = order.LifePayRefundStatus, ActualRechargeAmount = order.ActualRechargeAmount, @@ -971,10 +1009,12 @@ OpenId = openid } }; + Logger.LogError("璋冪敤璇锋眰锛�" + req.ToJson()); var timestamp = DateTimeOffset.Now.ToUnixTimeSeconds(); string nonce = Guid.NewGuid().ToString(); var res = await _wxPayApi.PayTransactionsJsAPI(req); + Logger.LogError("璋冪敤缁撴灉锛�" + res.ToJson()); string package = "prepay_id=" + res.PrepayId; ModelPaymentMiniPay info = new ModelPaymentMiniPay(); if (res != null) @@ -1128,15 +1168,19 @@ { order.PayStatus = LifePayStatusEnum.宸查��娆�; order.LifePayOrderStatus = LifePayOrderStatusEnum.宸查��娆�; + order.LifePayRefundStatus = LifePayRefundStatusEnum.宸查��娆�; } else if (wxRefundResult.Status == "PROCESSING") { order.PayStatus = LifePayStatusEnum.閫�娆句腑; order.LifePayOrderStatus = LifePayOrderStatusEnum.閫�娆句腑; + order.LifePayRefundStatus = LifePayRefundStatusEnum.閫�娆句腑; } else { - throw new UserFriendlyException("閫�娆惧け璐�"); + order.PayStatus = LifePayStatusEnum.寰呴��娆�; + order.LifePayOrderStatus = LifePayOrderStatusEnum.閫�娆惧け璐�; + order.LifePayRefundStatus = LifePayRefundStatusEnum.寰呴��娆�; } break; -- Gitblit v1.9.1