diff --git a/backend/src/main/java/com/designhub/service/TeamScorePoolService.java b/backend/src/main/java/com/designhub/service/TeamScorePoolService.java index a2faba8..a3925f9 100644 --- a/backend/src/main/java/com/designhub/service/TeamScorePoolService.java +++ b/backend/src/main/java/com/designhub/service/TeamScorePoolService.java @@ -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); } /**