From 5d9bde5a35aad0ee3f1bf5d176c1244f4ece9918 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Thu, 4 Dec 2025 21:26:42 +0800 Subject: [PATCH] =?UTF-8?q?bd=20=E6=80=BB=E8=A7=88=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=85=85=E5=80=BC=E4=BB=A3=E7=90=86=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../command/bd/query/BdTeamSummaryQryExe.java | 41 +++++++++++++++++++ .../app/dto/clientobject/BdTeamSummaryCO.java | 5 +++ 2 files changed, 46 insertions(+) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/bd/query/BdTeamSummaryQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/bd/query/BdTeamSummaryQryExe.java index 0c2a0bb4..7d9f0a78 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/bd/query/BdTeamSummaryQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/bd/query/BdTeamSummaryQryExe.java @@ -1,10 +1,13 @@ package com.red.circle.other.app.command.bd.query; import com.alibaba.fastjson.JSON; +import com.red.circle.common.business.dto.cmd.AppExtCommand; import com.red.circle.component.redis.service.RedisService; +import com.red.circle.order.inner.model.dto.MonthlyRechargeSummaryVO; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.clientobject.BdTeamMemberCO; import com.red.circle.other.app.dto.clientobject.BdTeamSummaryCO; +import com.red.circle.other.app.service.recharge.RechargeUserService; import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.infra.database.mongo.dto.team.TeamBillMemberTarget; import com.red.circle.other.infra.database.mongo.entity.team.team.TeamBillCycle; @@ -53,6 +56,7 @@ public class BdTeamSummaryQryExe { private final UserProfileAppConvertor userProfileAppConvertor; private final RoomBdLeadService roomBdLeadService; private final RedisService redisService; + private final RechargeUserService rechargeUserService; /** * 执行查询 @@ -87,10 +91,12 @@ public class BdTeamSummaryQryExe { BdTeamSummaryCO.TeamSummaryItem bdLeaderTeams = queryBdLeaderSummary(userId, currentBillBelong); BdTeamSummaryCO.TeamSummaryItem bdTeams = queryBdSummary(userId, currentBillBelong); BdTeamSummaryCO.TeamSummaryItem agencyTeams = queryAgencySummary(userId, currentBillBelong); + BdTeamSummaryCO.TeamSummaryItem rechargeTeams = queryRechargeTeamsSummary(userId); summary.setBdLeaderTeams(bdLeaderTeams); summary.setBdTeams(bdTeams); summary.setAgencyTeams(agencyTeams); + summary.setRechargeTeams(rechargeTeams); // Team earnings this period = BD Teams 的 totalIncome summary.setTeamEarningsThisPeriod(bdTeams.getTotalIncome()); @@ -278,6 +284,41 @@ public class BdTeamSummaryQryExe { return ownTotalSalary(memberTargets); } + /** + * 查询充值Teams汇总 + */ + private BdTeamSummaryCO.TeamSummaryItem queryRechargeTeamsSummary(Long userId) { + BdTeamSummaryCO.TeamSummaryItem item = new BdTeamSummaryCO.TeamSummaryItem(); + + // 构建命令对象 + AppExtCommand cmd = new AppExtCommand(); + cmd.setReqUserId(userId); + + // 获取充值汇总数据 + List rechargeSummaryList = rechargeUserService.getRechargeSummary(cmd); + + if (CollectionUtils.isEmpty(rechargeSummaryList)) { + item.setCount(0); + item.setTotalIncome(BigDecimal.ZERO); + return item; + } + + // 计算累积的用户数量(去重) + long totalUserCount = rechargeSummaryList.stream() + .mapToLong(MonthlyRechargeSummaryVO::getUserCount) + .sum(); + + // 计算累积的总充值金额 + BigDecimal totalAmount = rechargeSummaryList.stream() + .map(MonthlyRechargeSummaryVO::getTotalAmount) + .reduce(BigDecimal.ZERO, BigDecimal::add); + + item.setCount((int) totalUserCount); + item.setTotalIncome(totalAmount); + + return item; + } + /** * 汇总成员工资 */ diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/BdTeamSummaryCO.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/BdTeamSummaryCO.java index e73e0fed..c6fd06b0 100644 --- a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/BdTeamSummaryCO.java +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/BdTeamSummaryCO.java @@ -30,6 +30,11 @@ public class BdTeamSummaryCO { */ private TeamSummaryItem agencyTeams; + /** + * 充值Teams + */ + private TeamSummaryItem rechargeTeams; + /** * 团队汇总项 */