sunpengfei
2025-06-11 0ee3e9996050bd0df360367af28738acea9cdfc6
fix:修改统计公式 新增前端日志上传
1个文件已添加
2个文件已修改
77 ■■■■ 已修改文件
LifePayment/LifePayment.Application/LifePay/StatisticsService.cs 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.HttpApi/LifePay/LogController.cs 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application/LifePay/StatisticsService.cs
@@ -205,19 +205,39 @@
        public async Task<ChannelDataListOutPut> GetChannelDataList(List<string> channleList)
        {
            var today = DateTime.Now.Date;
            int maxStatisticsNumber = 5;
            /// 这里不加入.Where()会报错
            var statistics = await _lifePayChannlesRakeRepository.Where(x => x.IsDeleted == false)
                            .WhereIf(channleList.Count() > 0, x => channleList.Contains(x.ChannelId))
            .ToListAsync();
            var statistics = await _lifePayChannlesRakeRepository
                .Where(x => x.IsDeleted == false && x.CreationTime < today)
                .WhereIf(channleList.Count() > 0, x => channleList.Contains(x.ChannelId))
                .ToListAsync();
            var lifepayOrderBaseList = await _lifePayOrderRepository
                .Where(x => x.CreationTime < today && x.PayStatus != LifePayStatusEnum.未支付)
                .WhereIf(channleList.Count() > 0, x => channleList.Contains(x.ChannelId))
                .ToListAsync();
            CheckExtensions.IfTrueThrowUserFriendlyException(statistics == null, "渠道收款统计失败");
            var groupedStatistics = statistics
               .GroupBy(x => x.ChannelId)
               .Select(g => new
               .Select(g =>
               {
                   ChannelId = g.Key,
                   ReceivePrice = g.Sum(x => x.PayAmount),
                   ChannlesRakePrice = g.Sum(x => x.ChannlesRakePrice),
                   /// 累计收款:统计平台账户下订单创建时间在昨天及之前收到的【用户支付成功的金额-退款给用户的金额】;
                   var accumulatedReceipts =
                        lifepayOrderBaseList
                            .Where(x => x.ChannelId == g.Key)
                            .Sum(x => x.PayAmount)
                        -
                        lifepayOrderBaseList
                            .Where(x => x.ChannelId == g.Key && x.LifePayRefundStatus == LifePayRefundStatusEnum.已退款)
                            .Sum(x => (x.RefundPrice ?? 0));
                   return new
                   {
                       ChannelId = g.Key,
                       ReceivePrice = accumulatedReceipts ?? 0,
                       ChannlesRakePrice = g.Sum(x => x.ChannlesRakePrice),
                   };
               })
               .OrderByDescending(o => o.ReceivePrice)
               .ToList();
@@ -239,7 +259,7 @@
            }
            /// 累计用户
            var users = await _lifePayUserRepository.Where(x => x.IsDeleted == false).WhereIf(channleList.Count() > 0, x => channleList.Contains(x.CreationChannleNum))
            var users = await _lifePayUserRepository.Where(x => x.IsDeleted == false && x.CreationTime < today).WhereIf(channleList.Count() > 0, x => channleList.Contains(x.CreationChannleNum))
                .ToListAsync();
            CheckExtensions.IfTrueThrowUserFriendlyException(statistics == null, "累计用户统计失败");
            var groupedUsers = users
@@ -293,7 +313,7 @@
        private async Task<DallyStatistics> TopStatistics(string channleId, DateTime today)
        {
            var lifepayOrderBaseList = await _lifePayOrderRepository.Where(x => x.CreationTime < today)
            var lifepayOrderBaseList = await _lifePayOrderRepository.Where(x => x.CreationTime < today && x.PayStatus != LifePayStatusEnum.未支付)
                .WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.ChannelId == channleId).ToListAsync();
            /// 累计收款:统计平台账户下订单创建时间在昨天及之前收到的【用户支付成功的金额-退款给用户的金额】;
LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
@@ -513,6 +513,12 @@
            <param name="input"></param>
            <returns></returns>
        </member>
        <member name="M:LifePayment.HttpApi.LifePay.LogController.LogFront(System.String)">
            <summary>
            记录前端日志
            </summary>
            <returns></returns>
        </member>
        <member name="M:LifePayment.HttpApi.OperateHistoryController.GetOperateHistoryByRelationId(LifePayment.Application.Contracts.GetOperateHistoryInput)">
            <summary>
            查询日志
LifePayment/LifePayment.HttpApi/LifePay/LogController.cs
New file
@@ -0,0 +1,33 @@
using Castle.Core.Logging;
using LifePayment.Application.Sync;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.AspNetCore.Mvc;
namespace LifePayment.HttpApi.LifePay
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class LogController : AbpController
    {
        private readonly ILogger<LogController> logger;
        public LogController(ILogger<LogController> logger)
        {
            this.logger = logger;
        }
        /// <summary>
        /// 记录前端日志
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public void LogFront(string message)
        {
            logger.LogInformation($"前端日志:{message}");
        }
    }
}