bdleader部分管理员工资处理

This commit is contained in:
tianfeng 2026-01-04 17:03:03 +08:00
parent e1b05d783e
commit 834f1c795d
3 changed files with 14 additions and 5 deletions

View File

@ -72,7 +72,6 @@ public class BdLeaderSalarySettlementServiceImpl implements BdLeaderSalarySettle
// BD Leader 用户 ID 分组去重并过滤掉管理员 // BD Leader 用户 ID 分组去重并过滤掉管理员
Map<Long, List<BusinessDevelopmentBaseInfo>> bdLeaderGroupMap = allBdLeaders.stream() Map<Long, List<BusinessDevelopmentBaseInfo>> bdLeaderGroupMap = allBdLeaders.stream()
.filter(info -> info.getBdLeadUserId() != null) .filter(info -> info.getBdLeadUserId() != null)
.filter(info -> !adminUserIds.contains(info.getBdLeadUserId()))
.collect(Collectors.groupingBy(BusinessDevelopmentBaseInfo::getBdLeadUserId)); .collect(Collectors.groupingBy(BusinessDevelopmentBaseInfo::getBdLeadUserId));
log.warn("共找到 {} 个 BD Leader", bdLeaderGroupMap.size()); log.warn("共找到 {} 个 BD Leader", bdLeaderGroupMap.size());
@ -83,7 +82,7 @@ public class BdLeaderSalarySettlementServiceImpl implements BdLeaderSalarySettle
// 遍历每个 BD Leader 进行结算 // 遍历每个 BD Leader 进行结算
for (Long bdLeaderUserId : bdLeaderGroupMap.keySet()) { for (Long bdLeaderUserId : bdLeaderGroupMap.keySet()) {
try { try {
processSingleBdLeaderSettlement(bdLeaderUserId, billBelong, billTitle); processSingleBdLeaderSettlement(bdLeaderUserId, billBelong, billTitle, adminUserIds);
successCount++; successCount++;
} catch (Exception e) { } catch (Exception e) {
log.error("BD Leader {} 工资结算失败", bdLeaderUserId, e); log.error("BD Leader {} 工资结算失败", bdLeaderUserId, e);
@ -103,7 +102,7 @@ public class BdLeaderSalarySettlementServiceImpl implements BdLeaderSalarySettle
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public BdLeaderSalarySettlementCO processSingleBdLeaderSettlement(Long bdLeaderUserId, Integer billBelong, String billTitle) { public BdLeaderSalarySettlementCO processSingleBdLeaderSettlement(Long bdLeaderUserId, Integer billBelong, String billTitle, Set<Long> adminUserIds) {
log.info("开始处理 BD Leader {} 的工资结算", bdLeaderUserId); log.info("开始处理 BD Leader {} 的工资结算", bdLeaderUserId);
// 1. 生成幂等业务号 // 1. 生成幂等业务号
@ -186,10 +185,13 @@ public class BdLeaderSalarySettlementServiceImpl implements BdLeaderSalarySettle
calculateLeaderSalary(record); calculateLeaderSalary(record);
// 6. 保存结算记录 // 6. 保存结算记录
record.setIsAdmin(adminUserIds != null && adminUserIds.contains(bdLeaderUserId));
bdLeaderSalarySettlementRecordService.create(record); bdLeaderSalarySettlementRecordService.create(record);
// 7. 如果工资大于 0则发放工资 // 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 { try {
// 调用钱包服务发放工资 // 调用钱包服务发放工资
issueSalary(bdLeaderUserId, record); issueSalary(bdLeaderUserId, record);

View File

@ -2,6 +2,8 @@ package com.red.circle.other.app.service;
import com.red.circle.other.app.dto.clientobject.BdLeaderSalarySettlementCO; import com.red.circle.other.app.dto.clientobject.BdLeaderSalarySettlementCO;
import java.util.Set;
/** /**
* BD Leader 工资结算服务. * BD Leader 工资结算服务.
* *
@ -26,5 +28,5 @@ public interface BdLeaderSalarySettlementService {
* @param billTitle 结算周期标题 * @param billTitle 结算周期标题
* @return 结算结果 * @return 结算结果
*/ */
BdLeaderSalarySettlementCO processSingleBdLeaderSettlement(Long bdLeaderUserId, Integer billBelong, String billTitle); BdLeaderSalarySettlementCO processSingleBdLeaderSettlement(Long bdLeaderUserId, Integer billBelong, String billTitle, Set<Long> adminUserIds);
} }

View File

@ -52,6 +52,11 @@ public class BdLeaderSalarySettlementRecord implements Serializable {
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long bdLeaderUserId; private Long bdLeaderUserId;
/**
* 是否是管理员
*/
private Boolean isAdmin;
/** /**
* 结算周期格式202501 表示2025年1月上半月202502 表示2025年1月下半月. * 结算周期格式202501 表示2025年1月上半月202502 表示2025年1月下半月.
*/ */