From cf33f38274f28d55a41a68688ea15407e56a270f Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 2 Jan 2026 18:10:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0TeamScorePoolService=E7=9A=84?= =?UTF-8?q?@Slf4j=E6=B3=A8=E8=A7=A3=E4=BB=A5=E6=94=AF=E6=8C=81=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/TeamScorePoolService.java | 60 ++++++------------- 1 file changed, 17 insertions(+), 43 deletions(-) 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); } /**