添加TeamScorePoolService的@Slf4j注解以支持日志功能

This commit is contained in:
Your Name 2026-01-02 18:10:15 +08:00
parent 6df38c4f89
commit cf33f38274

View File

@ -17,6 +17,7 @@ import java.time.LocalDateTime;
* 团队积分池Service
*/
@Service
@Slf4j
@RequiredArgsConstructor
public class TeamScorePoolService {
@ -259,50 +260,23 @@ public class TeamScorePoolService {
@Transactional(rollbackFor = Exception.class)
public void updateLimitConfig(Long deptId, Integer limitEnabled, String limitPeriod,
Integer periodLimit, Integer alertThreshold) {
try {
log.info("开始更新积分池限制配置: deptId={}, limitEnabled={}, limitPeriod={}, periodLimit={}, alertThreshold={}",
deptId, limitEnabled, limitPeriod, periodLimit, alertThreshold);
TeamScorePool pool = upsertPool(deptId, null);
if (pool == null) {
throw new BusinessException("积分池不存在且创建失败: deptId=" + deptId);
}
boolean hasUpdate = false;
if (limitEnabled != null) {
pool.setLimitEnabled(limitEnabled);
hasUpdate = true;
}
if (limitPeriod != null) {
pool.setLimitPeriod(limitPeriod);
hasUpdate = true;
}
if (periodLimit != null) {
pool.setPeriodLimit(periodLimit);
hasUpdate = true;
}
if (alertThreshold != null) {
pool.setAlertThreshold(alertThreshold);
hasUpdate = true;
}
if (pool.getPeriodStartTime() == null) {
pool.setPeriodStartTime(LocalDateTime.now());
hasUpdate = true;
}
if (hasUpdate) {
int rows = teamScorePoolMapper.updateById(pool);
log.info("更新积分池限制配置成功: deptId={}, affectedRows={}", deptId, rows);
} else {
log.warn("没有需要更新的积分池限制配置: deptId={}", deptId);
}
} catch (BusinessException e) {
log.error("更新积分池限制配置业务异常: deptId={}, error={}", deptId, e.getMessage());
throw e;
} catch (Exception e) {
log.error("更新积分池限制配置失败: deptId={}, error={}", deptId, e.getMessage(), e);
throw new BusinessException("更新积分池限制配置失败: " + e.getMessage());
TeamScorePool pool = upsertPool(deptId, null);
if (limitEnabled != null) {
pool.setLimitEnabled(limitEnabled);
}
if (limitPeriod != null) {
pool.setLimitPeriod(limitPeriod);
}
if (periodLimit != null) {
pool.setPeriodLimit(periodLimit);
}
if (alertThreshold != null) {
pool.setAlertThreshold(alertThreshold);
}
if (pool.getPeriodStartTime() == null) {
pool.setPeriodStartTime(LocalDateTime.now());
}
teamScorePoolMapper.updateById(pool);
}
/**