bd总览数据修复

This commit is contained in:
tianfeng 2025-12-18 19:08:29 +08:00
parent 8ba98a46f4
commit 9ce1e6c2d5

View File

@ -31,6 +31,7 @@ import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import com.red.circle.tool.core.collection.CollectionUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
@ -173,8 +174,14 @@ public class BdTeamSummaryQryExe {
}
List<BusinessDevelopmentBaseInfo> bdInfos = businessDevelopmentBaseInfoService.listBdByLeadUserId(bdUserId);
bdInfos = filterBdLeader(bdUserId, bdInfos);
item.setCount(bdInfos.size());
List<Long> list = bdInfos.stream().map(BusinessDevelopmentBaseInfo::getUserId).toList();
bdTeamList = bdTeamList.stream().filter(e -> list.contains(e.getUserId())).collect(Collectors.toList());
// 计算总收入
BigDecimal totalIncome = calculateBdTotalIncome(bdTeamList, currentBillBelong);
item.setTotalIncome(totalIncome);
@ -182,6 +189,19 @@ public class BdTeamSummaryQryExe {
return item;
}
@NotNull
private List<BusinessDevelopmentBaseInfo> filterBdLeader(Long bdLeaderUserId, List<BusinessDevelopmentBaseInfo> bdList) {
Set<Long> bdIdSet = bdList.stream().map(BusinessDevelopmentBaseInfo::getUserId).collect(Collectors.toSet());
List<RoomBdLead> roomBdLeads = roomBdLeadService.listByUserIds(bdIdSet);
List<Long> bdLeaderIdList = roomBdLeads.stream().map(RoomBdLead::getUserId)
.filter(e -> !e.equals(bdLeaderUserId))
.toList();
bdList = bdList.stream()
.filter(e -> !bdLeaderIdList.contains(e.getUserId())).collect(Collectors.toList());
return bdList;
}
/**
* 查询 Agency 汇总
*/