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 36061f55..caef3747 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 @@ -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 bdInfos = businessDevelopmentBaseInfoService.listBdByLeadUserId(bdUserId); + + bdInfos = filterBdLeader(bdUserId, bdInfos); + item.setCount(bdInfos.size()); + List 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 filterBdLeader(Long bdLeaderUserId, List bdList) { + Set bdIdSet = bdList.stream().map(BusinessDevelopmentBaseInfo::getUserId).collect(Collectors.toSet()); + List roomBdLeads = roomBdLeadService.listByUserIds(bdIdSet); + + List 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 汇总 */