From d0b5230812a14617cf72147ce1ed3b83b51d5242 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Mon, 15 Dec 2025 19:47:03 +0800 Subject: [PATCH] =?UTF-8?q?admin=20=E7=BB=93=E7=AE=97=E4=BF=AE=E6=94=B92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AdminSalarySettlementServiceImpl.java | 5 ++--- .../BdLeaderSalarySettlementServiceImpl.java | 18 +++++++++++++++--- .../service/BdSalarySettlementServiceImpl.java | 12 ++++++++++++ .../rds/service/sys/AdministratorService.java | 5 +++++ .../sys/impl/AdministratorServiceImpl.java | 5 +++++ 5 files changed, 39 insertions(+), 6 deletions(-) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/AdminSalarySettlementServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/AdminSalarySettlementServiceImpl.java index 7d41db9f..240919e0 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/AdminSalarySettlementServiceImpl.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/AdminSalarySettlementServiceImpl.java @@ -53,14 +53,13 @@ public class AdminSalarySettlementServiceImpl implements AdminSalarySettlementSe private final BdTeamSummaryQryExe bdTeamSummaryQryExe; private final RechargeUserService rechargeUserService; private final UserSalaryAccountClient userSalaryAccountClient; - private final AdministratorDAO administratorDAO; + private final AdministratorService administratorService; @Override public void processAllAdminSettlement(Integer billBelong, String billTitle) { log.warn("开始处理所有管理员工资结算,结算周期:{}", billBelong); - LambdaQueryWrapper eq = Wrappers.lambdaQuery().eq(Administrator::getStatus, Boolean.TRUE); - List administrators = administratorDAO.selectList(eq); + List administrators = administratorService.listAllAdmins(); List adminUserIds = administrators.stream().map(Administrator::getUserId).toList(); if (CollectionUtils.isEmpty(adminUserIds)) { diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/BdLeaderSalarySettlementServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/BdLeaderSalarySettlementServiceImpl.java index 57b77924..36fc7377 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/BdLeaderSalarySettlementServiceImpl.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/BdLeaderSalarySettlementServiceImpl.java @@ -5,6 +5,8 @@ import com.red.circle.other.app.dto.clientobject.BdLeaderSalarySettlementCO; import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.domain.model.user.UserProfile; import com.red.circle.other.infra.database.mongo.entity.bd.detail.BdLeaderTeamMemberDetail; +import com.red.circle.other.infra.database.rds.entity.sys.Administrator; +import com.red.circle.other.infra.database.rds.service.sys.AdministratorService; import com.red.circle.other.infra.enums.BdSettlementStatus; import com.red.circle.other.infra.database.mongo.entity.bd.BdLeaderSalaryPolicy; import com.red.circle.other.infra.database.mongo.entity.bd.BdLeaderSalarySettlementRecord; @@ -24,6 +26,7 @@ import com.red.circle.wallet.inner.model.enums.SalaryType; import com.red.circle.wallet.inner.model.enums.SalaryEvent; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.jetbrains.annotations.NotNull; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -44,11 +47,10 @@ import java.util.stream.Collectors; public class BdLeaderSalarySettlementServiceImpl implements BdLeaderSalarySettlementService { private final BusinessDevelopmentBaseInfoService businessDevelopmentBaseInfoService; - private final BusinessDevelopmentTeamService businessDevelopmentTeamService; private final BdSalarySettlementRecordService bdSalarySettlementRecordService; private final BdLeaderSalaryPolicyService bdLeaderSalaryPolicyService; private final BdLeaderSalarySettlementRecordService bdLeaderSalarySettlementRecordService; - private final UserBankBalanceClient userBankBalanceClient; + private final AdministratorService administratorService; private final UserSalaryAccountClient userSalaryAccountClient; private final UserProfileGateway userProfileGateway; @@ -64,9 +66,12 @@ public class BdLeaderSalarySettlementServiceImpl implements BdLeaderSalarySettle return; } - // 按 BD Leader 用户 ID 分组(去重) + Set adminUserIds = getAdminUserIds(); + + // 按 BD Leader 用户 ID 分组(去重),并过滤掉管理员 Map> bdLeaderGroupMap = allBdLeaders.stream() .filter(info -> info.getBdLeadUserId() != null) + .filter(info -> !adminUserIds.contains(info.getBdLeadUserId())) .collect(Collectors.groupingBy(BusinessDevelopmentBaseInfo::getBdLeadUserId)); log.warn("共找到 {} 个 BD Leader", bdLeaderGroupMap.size()); @@ -88,6 +93,13 @@ public class BdLeaderSalarySettlementServiceImpl implements BdLeaderSalarySettle log.warn("BD Leader 工资结算完成,成功:{},失败:{}", successCount, failCount); } + private Set getAdminUserIds() { + List administrators = administratorService.listAllAdmins(); + return administrators.stream() + .map(Administrator::getUserId) + .collect(Collectors.toSet()); + } + @Override @Transactional(rollbackFor = Exception.class) public BdLeaderSalarySettlementCO processSingleBdLeaderSettlement(Long bdLeaderUserId, Integer billBelong, String billTitle) { diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/BdSalarySettlementServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/BdSalarySettlementServiceImpl.java index 7a4fe0f4..c5623ba0 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/BdSalarySettlementServiceImpl.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/BdSalarySettlementServiceImpl.java @@ -11,6 +11,8 @@ import com.red.circle.other.domain.model.user.UserProfile; import com.red.circle.other.infra.database.mongo.entity.bd.detail.BdTeamMemberDetail; import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMemberTarget; import com.red.circle.other.infra.database.mongo.service.team.TeamBillCycleUtils; +import com.red.circle.other.infra.database.rds.entity.sys.Administrator; +import com.red.circle.other.infra.database.rds.service.sys.AdministratorService; import com.red.circle.other.infra.enums.BdPolicyType; import com.red.circle.other.infra.enums.BdSettlementStatus; import com.red.circle.other.infra.database.mongo.entity.bd.BdSalaryPolicy; @@ -64,6 +66,7 @@ public class BdSalarySettlementServiceImpl implements BdSalarySettlementService private final InAppPurchaseDetailsClientApi inAppPurchaseDetailsClientApi; private final UserProfileGateway userProfileGateway; private final UserSalaryAccountClient userSalaryAccountClient; + private final AdministratorService administratorService; @Override @@ -78,8 +81,10 @@ public class BdSalarySettlementServiceImpl implements BdSalarySettlementService return; } + Set adminUserIds = getAdminUserIds(); // 按 BD 用户 ID 分组(去重) Map> bdGroupMap = allBdTeams.stream() + .filter(info -> !adminUserIds.contains(info.getUserId())) .collect(Collectors.groupingBy(BusinessDevelopmentTeam::getUserId)); log.warn("共找到 {} 个 BD", bdGroupMap.size()); @@ -101,6 +106,13 @@ public class BdSalarySettlementServiceImpl implements BdSalarySettlementService log.warn("BD 工资结算完成,成功:{},失败:{}", successCount, failCount); } + private Set getAdminUserIds() { + List administrators = administratorService.listAllAdmins(); + return administrators.stream() + .map(Administrator::getUserId) + .collect(Collectors.toSet()); + } + @Override @Transactional(rollbackFor = Exception.class) public BdSalarySettlementCO processSingleBdSettlement(Long bdUserId, Integer billBelong, String billTitle) { diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/sys/AdministratorService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/sys/AdministratorService.java index 6a584876..6da37e9e 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/sys/AdministratorService.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/sys/AdministratorService.java @@ -53,6 +53,11 @@ public interface AdministratorService extends BaseService { */ boolean existsManager(Long userId); + /** + * 所有正常状态的管理员 + */ + List listAllAdmins(); + /** * 用户组是否存在可用管理员. * diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/sys/impl/AdministratorServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/sys/impl/AdministratorServiceImpl.java index f33c77ea..d8fbb780 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/sys/impl/AdministratorServiceImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/sys/impl/AdministratorServiceImpl.java @@ -75,6 +75,11 @@ public class AdministratorServiceImpl extends .last(PageConstant.LIMIT_ONE).getOne() != null; } + @Override + public List listAllAdmins() { + return query().eq(Administrator::getStatus, Boolean.TRUE).list(); + } + @Override public boolean existsAvailable(Set userIds) { return Optional.ofNullable(