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 3dd9fb3a..eb78c203 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 @@ -1,5 +1,6 @@ package com.red.circle.other.app.service; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.red.circle.common.business.core.enums.ReceiptType; import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; import com.red.circle.framework.dto.ResultResponse; @@ -84,7 +85,6 @@ public class BdSalarySettlementServiceImpl implements BdSalarySettlementService 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()); @@ -95,7 +95,7 @@ public class BdSalarySettlementServiceImpl implements BdSalarySettlementService // 遍历每个 BD 进行结算 for (Long bdUserId : bdGroupMap.keySet()) { try { - processSingleBdSettlement(bdUserId, billBelong, billTitle); + processSingleBdSettlement(bdUserId, billBelong, billTitle, adminUserIds); successCount++; } catch (Exception e) { log.error("BD {} 工资结算失败", bdUserId, e); @@ -115,7 +115,7 @@ public class BdSalarySettlementServiceImpl implements BdSalarySettlementService @Override @Transactional(rollbackFor = Exception.class) - public BdSalarySettlementCO processSingleBdSettlement(Long bdUserId, Integer billBelong, String billTitle) { + public BdSalarySettlementCO processSingleBdSettlement(Long bdUserId, Integer billBelong, String billTitle, Set adminUserIds) { log.info("开始处理 BD {} 的工资结算", bdUserId); // 1. 生成幂等业务号 @@ -139,10 +139,13 @@ public class BdSalarySettlementServiceImpl implements BdSalarySettlementService record.setMemberDetails(memberDetails); // 6. 保存结算记录 + record.setIsAdmin(adminUserIds != null && adminUserIds.contains(bdUserId)); bdSalarySettlementRecordService.create(record); // 7. 如果工资大于 0,则发放工资 - if (record.getSettlementSalary() != null && record.getSettlementSalary().compareTo(BigDecimal.ZERO) > 0) { + if (record.getSettlementSalary() != null && + record.getSettlementSalary().compareTo(BigDecimal.ZERO) > 0 && + !Boolean.TRUE.equals(record.getIsAdmin())) { try { // 调用钱包服务发放工资 issueSalary(bdUserId, record); diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/BdSalarySettlementService.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/BdSalarySettlementService.java index fbe74d04..ea37bf54 100644 --- a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/BdSalarySettlementService.java +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/BdSalarySettlementService.java @@ -2,6 +2,8 @@ package com.red.circle.other.app.service; import com.red.circle.other.app.dto.clientobject.BdSalarySettlementCO; +import java.util.Set; + /** * BD 工资结算服务. * @@ -26,5 +28,5 @@ public interface BdSalarySettlementService { * @param billTitle 结算周期标题 * @return 结算结果 */ - BdSalarySettlementCO processSingleBdSettlement(Long bdUserId, Integer billBelong, String billTitle); + BdSalarySettlementCO processSingleBdSettlement(Long bdUserId, Integer billBelong, String billTitle, Set adminUserIds); } diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/bd/BdSalarySettlementRecord.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/bd/BdSalarySettlementRecord.java index 0868b97b..43b01e9a 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/bd/BdSalarySettlementRecord.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/bd/BdSalarySettlementRecord.java @@ -53,6 +53,11 @@ public class BdSalarySettlementRecord implements Serializable { @JsonSerialize(using = ToStringSerializer.class) private Long bdUserId; + /** + * 是否是管理员 + */ + private Boolean isAdmin; + /** * 结算周期(格式:202501 表示2025年1月上半月,202502 表示2025年1月下半月). */