| | |
| | | var accumulatedReceipts = await _lifePayOrderRepository.Where(x => x.CreationTime < today).SumAsync(x => x.PayAmount); |
| | | var receiptsYesterday = await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today).SumAsync(x => x.PayAmount); |
| | | var accumulatedOrders = await _lifePayOrderRepository.Where(x => x.CreationTime < today).CountAsync(); |
| | | var accumulatedIncome = await _lifePayOrderRepository.Where(x => x.CreationTime < today).SumAsync(x => x.ActualRechargeAmount); |
| | | var ordersNumYesterday = await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today).CountAsync(); |
| | | var yesterdaySuccess = await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today && x.LifePayOrderStatus == LifePayOrderStatusEnum.已完成).CountAsync(); |
| | | var yesterdayFail = await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today && x.LifePayOrderStatus == LifePayOrderStatusEnum.已失败).CountAsync(); |
| | |
| | | { |
| | | Id = GuidGenerator.Create(), |
| | | CreationTime = DateTime.Now, |
| | | Amount = "0", |
| | | AccumulatedReceipts = accumulatedReceipts.ToString(), |
| | | ReceiptsYesterday = receiptsYesterday.ToString(), |
| | | AccumulatedOrders = accumulatedOrders.ToString(), |
| | | OrdersNumYesterday = ordersNumYesterday.ToString(), |
| | | YesterdaySuccess = yesterdaySuccess.ToString(), |
| | | YesterdayFail = yesterdayFail.ToString(), |
| | | AccumulatedUsers = accumulatedUsers.ToString(), |
| | | Amount = 0, |
| | | AccumulatedReceipts = accumulatedReceipts, |
| | | ReceiptsYesterday = receiptsYesterday, |
| | | AccumulatedOrders = accumulatedOrders, |
| | | OrdersNumYesterday = ordersNumYesterday, |
| | | YesterdaySuccess = yesterdaySuccess, |
| | | YesterdayFail = yesterdayFail, |
| | | AccumulatedUsers = accumulatedUsers, |
| | | }; |
| | | await _dallyStatisticsRepository.InsertAsync(entity); |
| | | var result = ObjectMapper.Map<DallyStatistics, TopStatisticsOutput>(entity); |
| | | return result; |
| | | |
| | | TopStatisticsOutput topStatisticsOutput = new TopStatisticsOutput() |
| | | { |
| | | Amount = entity.Amount, |
| | | AccumulatedReceipts = entity.AccumulatedReceipts, |
| | | ReceiptsYesterday = entity.ReceiptsYesterday, |
| | | AccumulatedOrders = entity.AccumulatedOrders, |
| | | OrdersNumYesterday = entity.OrdersNumYesterday, |
| | | YesterdaySuccess = entity.YesterdaySuccess, |
| | | YesterdayFail = entity.YesterdayFail, |
| | | AccumulatedUsers = entity.AccumulatedUsers, |
| | | }; |
| | | return topStatisticsOutput; |
| | | } |
| | | else |
| | | { |
| | | var result = ObjectMapper.Map<DallyStatistics, TopStatisticsOutput>(statistics); |
| | | return result; |
| | | TopStatisticsOutput topStatisticsOutput = new TopStatisticsOutput() |
| | | { |
| | | Amount = statistics.Amount, |
| | | AccumulatedReceipts = statistics.AccumulatedReceipts, |
| | | ReceiptsYesterday = statistics.ReceiptsYesterday, |
| | | AccumulatedOrders = statistics.AccumulatedOrders, |
| | | OrdersNumYesterday = statistics.OrdersNumYesterday, |
| | | YesterdaySuccess = statistics.YesterdaySuccess, |
| | | YesterdayFail = statistics.YesterdayFail, |
| | | AccumulatedUsers = statistics.AccumulatedUsers, |
| | | }; |
| | | return topStatisticsOutput; |
| | | } |
| | | } |
| | | |
| | |
| | | PayTime = a.PayTime, |
| | | ACOOLYOrderNo = a.ACOOLYOrderNo, |
| | | RefundCredentialsImgUrl = a.RefundCredentialsImgUrl.GetOssPath(), |
| | | RefundPrice = a.RefundPrice, |
| | | CreationTime = a.CreationTime, |
| | | RefundCheckRemark = a.RefundCheckRemark, |
| | | RefundApplyRemark = a.RefundApplyRemark, |
| | |
| | | return result; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 退款订单分页 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | public async Task<PageOutput<LifePayOrderListOutput>> GetLifePayRefundOrderPage(QueryLifePayRefundOrderListInput input) |
| | | { |
| | | |
| | |
| | | RefundApplyRemark = a.RefundApplyRemark, |
| | | RefundApplyTime = a.RefundApplyTime, |
| | | RefundTime = a.RefundTime, |
| | | RefundPrice = a.RefundPrice, |
| | | ChannelName = b.ChannlesName, |
| | | ActualRechargeAmount = a.ActualRechargeAmount, |
| | | PlatformDeductionAmount = a.PlatformDeductionAmount, |
| | |
| | | PlatformRate = platformRate.Rate, |
| | | PlatformPrice = order.PlatformDeductionAmount, |
| | | ElecBillUrl = order.ElecBillUrl.GetOssPath(), |
| | | RefundElecBillUrl = order.RefundElecBillUrl.GetOssPath(), |
| | | ChannleRate = channle.ChannlesRate, |
| | | ChannlesRakeRate = channle.ChannlesRakeRate, |
| | | ChannlesRakePrice = channlesRakePrice.HasValue ? 0 : Math.Round(channlesRakePrice.Value, 2), |
| | |
| | | ACOOLYOrderNo = order.ACOOLYOrderNo, |
| | | LifePayRefundStatus = order.LifePayRefundStatus, |
| | | ActualRechargeAmount = order.ActualRechargeAmount, |
| | | ActualReceivedAmount = order.ActualReceivedAmount, |
| | | RefundPrice = order.RefundPrice, |
| | | ElecBillUrl = order.ElecBillUrl.GetOssPath(), |
| | | RefundElecBillUrl = order.RefundElecBillUrl.GetOssPath(), |
| | | }; |
| | | |
| | | return result; |
| | |
| | | { |
| | | return; |
| | | } |
| | | if (input.RefundPrice > order.PayAmount) |
| | | { |
| | | throw new UserFriendlyException("退款的金额不能大于实付金额"); |
| | | } |
| | | if (input.LifePayRefundType == LifePayRefundTypeEnum.全额退款 && input.RefundPrice != order.PayAmount) |
| | | { |
| | | throw new UserFriendlyException("全额退款的金额与实付金额不一致"); |
| | | } |
| | | |
| | | if (order.LifePayOrderStatus != LifePayOrderStatusEnum.已失败 && order.PayStatus != LifePayStatusEnum.待退款 && order.LifePayOrderStatus != LifePayOrderStatusEnum.退款待审核) |
| | | { |
| | |
| | | switch (order.LifePayType) |
| | | { |
| | | case LifePayTypeEnum.WxPay: |
| | | var wxRefundResult = await WxPayDomesticRefunds(order.OrderNo, outRefundNo,order.RefundApplyRemark, Convert.ToInt32(order.PayAmount * 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.PayStatus = LifePayStatusEnum.已退款; |
| | |
| | | |
| | | break; |
| | | case LifePayTypeEnum.AliPay: |
| | | var aliRefundResult = await AliTradeRefund(new AlipayTradeRefundRequest() { OutTradeNo = order.OrderNo, RefundAmount = order.PayAmount.ToString() }); |
| | | var aliRefundResult = await AliTradeRefund(new AlipayTradeRefundRequest() { OutTradeNo = order.OrderNo, RefundAmount = Convert.ToInt32(input.RefundPrice * 100).ToString() }); |
| | | if (aliRefundResult.Code != AlipayResultCode.Success) |
| | | { |
| | | throw new UserFriendlyException("退款失败"); |
| | |
| | | order.RefundCheckRemark = input.RefundCheckRemark; |
| | | order.RefundTime = DateTime.Now; |
| | | order.RefundCheckUserId = CurrentUser.Id; |
| | | order.RefundPrice = order.PayAmount; |
| | | order.RefundPrice = input.RefundPrice; |
| | | |
| | | await _lifePayOrderRepository.UpdateAsync(order); |
| | | |