From 0ee3e9996050bd0df360367af28738acea9cdfc6 Mon Sep 17 00:00:00 2001 From: sunpengfei <i@angelzzz.com> Date: 星期三, 11 六月 2025 16:12:48 +0800 Subject: [PATCH] fix:修改统计公式 新增前端日志上传 --- LifePayment/LifePayment.HttpApi/LifePay/LogController.cs | 33 ++++++++++++++++ LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml | 6 +++ LifePayment/LifePayment.Application/LifePay/StatisticsService.cs | 38 ++++++++++++++---- 3 files changed, 68 insertions(+), 9 deletions(-) diff --git a/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs b/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs index 17ab4c9..7438b91 100644 --- a/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs +++ b/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(); /// 绱鏀舵锛氱粺璁″钩鍙拌处鎴蜂笅璁㈠崟鍒涘缓鏃堕棿鍦ㄦ槰澶╁強涔嬪墠鏀跺埌鐨勩�愮敤鎴锋敮浠樻垚鍔熺殑閲戦-閫�娆剧粰鐢ㄦ埛鐨勯噾棰濄�戯紱 diff --git a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml index 7c67a36..d1a134c 100644 --- a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml +++ b/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> 鏌ヨ鏃ュ織 diff --git a/LifePayment/LifePayment.HttpApi/LifePay/LogController.cs b/LifePayment/LifePayment.HttpApi/LifePay/LogController.cs new file mode 100644 index 0000000..80a0153 --- /dev/null +++ b/LifePayment/LifePayment.HttpApi/LifePay/LogController.cs @@ -0,0 +1,33 @@ +锘縰sing 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}"); + } + } +} -- Gitblit v1.9.1