From 33c5e891d16ea42493f19a5859e6dd3d4c4895d8 Mon Sep 17 00:00:00 2001 From: byteblogs168 <598092184@qq.com> Date: Wed, 14 Jun 2023 17:17:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=202.0.0=201.=20=E5=90=8E=E7=AB=AF=E4=BA=8C?= =?UTF-8?q?=E6=AC=A1=E6=A0=A1=E9=AA=8C=E5=88=86=E5=8C=BA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../easy/retry/server/service/impl/GroupConfigServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/easy-retry-server/src/main/java/com/aizuda/easy/retry/server/service/impl/GroupConfigServiceImpl.java b/easy-retry-server/src/main/java/com/aizuda/easy/retry/server/service/impl/GroupConfigServiceImpl.java index d3f79bc5..d4025450 100644 --- a/easy-retry-server/src/main/java/com/aizuda/easy/retry/server/service/impl/GroupConfigServiceImpl.java +++ b/easy-retry-server/src/main/java/com/aizuda/easy/retry/server/service/impl/GroupConfigServiceImpl.java @@ -172,6 +172,9 @@ public class GroupConfigServiceImpl implements GroupConfigService { groupConfig.setGroupName(groupConfigRequestVO.getGroupName()); if (Objects.isNull(groupConfigRequestVO.getGroupPartition())) { groupConfig.setGroupPartition(HashUtil.bkdrHash(groupConfigRequestVO.getGroupName()) % totalPartition); + } else { + Assert.isTrue(totalPartition > groupConfigRequestVO.getGroupPartition(), () -> new EasyRetryServerException("分区超过最大分区. [{}]", totalPartition-1)); + Assert.isTrue(groupConfigRequestVO.getGroupPartition() > 0, () -> new EasyRetryServerException("分区不能是负数.")); } Assert.isTrue(1 == groupConfigMapper.insert(groupConfig), () -> new EasyRetryServerException("新增组异常异常 groupConfigVO[{}]", groupConfigRequestVO));