bdleader部分管理员工资处理
This commit is contained in:
parent
e1b05d783e
commit
834f1c795d
@ -72,7 +72,6 @@ public class BdLeaderSalarySettlementServiceImpl implements BdLeaderSalarySettle
|
||||
// 按 BD Leader 用户 ID 分组(去重),并过滤掉管理员
|
||||
Map<Long, List<BusinessDevelopmentBaseInfo>> 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());
|
||||
@ -83,7 +82,7 @@ public class BdLeaderSalarySettlementServiceImpl implements BdLeaderSalarySettle
|
||||
// 遍历每个 BD Leader 进行结算
|
||||
for (Long bdLeaderUserId : bdLeaderGroupMap.keySet()) {
|
||||
try {
|
||||
processSingleBdLeaderSettlement(bdLeaderUserId, billBelong, billTitle);
|
||||
processSingleBdLeaderSettlement(bdLeaderUserId, billBelong, billTitle, adminUserIds);
|
||||
successCount++;
|
||||
} catch (Exception e) {
|
||||
log.error("BD Leader {} 工资结算失败", bdLeaderUserId, e);
|
||||
@ -103,7 +102,7 @@ public class BdLeaderSalarySettlementServiceImpl implements BdLeaderSalarySettle
|
||||
|
||||
@Override
|
||||
@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);
|
||||
|
||||
// 1. 生成幂等业务号
|
||||
@ -186,10 +185,13 @@ public class BdLeaderSalarySettlementServiceImpl implements BdLeaderSalarySettle
|
||||
calculateLeaderSalary(record);
|
||||
|
||||
// 6. 保存结算记录
|
||||
record.setIsAdmin(adminUserIds != null && adminUserIds.contains(bdLeaderUserId));
|
||||
bdLeaderSalarySettlementRecordService.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(bdLeaderUserId, record);
|
||||
|
||||
@ -2,6 +2,8 @@ package com.red.circle.other.app.service;
|
||||
|
||||
import com.red.circle.other.app.dto.clientobject.BdLeaderSalarySettlementCO;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* BD Leader 工资结算服务.
|
||||
*
|
||||
@ -26,5 +28,5 @@ public interface BdLeaderSalarySettlementService {
|
||||
* @param billTitle 结算周期标题
|
||||
* @return 结算结果
|
||||
*/
|
||||
BdLeaderSalarySettlementCO processSingleBdLeaderSettlement(Long bdLeaderUserId, Integer billBelong, String billTitle);
|
||||
BdLeaderSalarySettlementCO processSingleBdLeaderSettlement(Long bdLeaderUserId, Integer billBelong, String billTitle, Set<Long> adminUserIds);
|
||||
}
|
||||
|
||||
@ -52,6 +52,11 @@ public class BdLeaderSalarySettlementRecord implements Serializable {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long bdLeaderUserId;
|
||||
|
||||
/**
|
||||
* 是否是管理员
|
||||
*/
|
||||
private Boolean isAdmin;
|
||||
|
||||
/**
|
||||
* 结算周期(格式:202501 表示2025年1月上半月,202502 表示2025年1月下半月).
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user