bd 总览新增充值代理数据

This commit is contained in:
tianfeng 2025-12-04 21:26:42 +08:00
parent 56b0d8bdc5
commit 5d9bde5a35
2 changed files with 46 additions and 0 deletions

View File

@ -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<MonthlyRechargeSummaryVO> 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;
}
/**
* 汇总成员工资
*/

View File

@ -30,6 +30,11 @@ public class BdTeamSummaryCO {
*/
private TeamSummaryItem agencyTeams;
/**
* 充值Teams
*/
private TeamSummaryItem rechargeTeams;
/**
* 团队汇总项
*/