From a9a317b367ad8617669ce562761aa5ab7234a8fc Mon Sep 17 00:00:00 2001 From: byteblogs168 <598092184@qq.com> Date: Thu, 26 Oct 2023 08:54:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=202.4.0=201.=20=E4=BF=AE=E5=A4=8D=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E7=BB=84=E6=97=B6=E6=8F=8F=E8=BF=B0=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98=202.=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E4=B8=BA=E7=A9=BA=E6=97=B6=E6=96=B0=E5=A2=9E=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/sql/easy_retry_mysql.sql | 4 ++-- .../server/web/service/impl/GroupConfigServiceImpl.java | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/sql/easy_retry_mysql.sql b/doc/sql/easy_retry_mysql.sql index 3dfbb83b0..c3fa379a7 100644 --- a/doc/sql/easy_retry_mysql.sql +++ b/doc/sql/easy_retry_mysql.sql @@ -8,7 +8,7 @@ CREATE TABLE `group_config` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `group_name` varchar(64) NOT NULL DEFAULT '' COMMENT '组名称', - `description` varchar(256) NOT NULL COMMENT '组描述', + `description` varchar(256) NOT NULL DEFAULT '' COMMENT '组描述', `group_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '组状态 0、未启用 1、启用', `version` int(11) NOT NULL COMMENT '版本号', `group_partition` int(11) NOT NULL COMMENT '分区', @@ -220,7 +220,7 @@ CREATE TABLE `job` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `group_name` varchar(64) NOT NULL COMMENT '组名称', `job_name` varchar(64) NOT NULL COMMENT '名称', - `args_str` text NOT NULL COMMENT '执行方法参数', + `args_str` text DEFAULT NULL COMMENT '执行方法参数', `args_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '参数类型 ', `next_trigger_at` datetime NOT NULL COMMENT '下次触发时间', `job_status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '重试状态 0、关闭、1、开启', diff --git a/easy-retry-server/easy-retry-server-web/src/main/java/com/aizuda/easy/retry/server/web/service/impl/GroupConfigServiceImpl.java b/easy-retry-server/easy-retry-server-web/src/main/java/com/aizuda/easy/retry/server/web/service/impl/GroupConfigServiceImpl.java index dec33b5e5..a53906553 100644 --- a/easy-retry-server/easy-retry-server-web/src/main/java/com/aizuda/easy/retry/server/web/service/impl/GroupConfigServiceImpl.java +++ b/easy-retry-server/easy-retry-server-web/src/main/java/com/aizuda/easy/retry/server/web/service/impl/GroupConfigServiceImpl.java @@ -97,14 +97,15 @@ public class GroupConfigServiceImpl implements GroupConfigService { public Boolean updateGroup(GroupConfigRequestVO groupConfigRequestVO) { ConfigAccess groupConfigAccess = accessTemplate.getGroupConfigAccess(); - GroupConfig groupConfig = groupConfigAccess.one( + long count = groupConfigAccess.count( new LambdaQueryWrapper().eq(GroupConfig::getGroupName, groupConfigRequestVO.getGroupName())); - if (Objects.isNull(groupConfig)) { + if (count <= 0) { return false; } + GroupConfig groupConfig = GroupConfigConverter.INSTANCE.convert(groupConfigRequestVO); groupConfig.setVersion(groupConfig.getVersion() + 1); - BeanUtils.copyProperties(groupConfigRequestVO, groupConfig); + groupConfig.setDescription(Optional.ofNullable(groupConfigRequestVO.getDescription()).orElse(StrUtil.EMPTY)); Assert.isTrue(systemProperties.getTotalPartition() > groupConfigRequestVO.getGroupPartition(), () -> new EasyRetryServerException("分区超过最大分区. [{}]", systemProperties.getTotalPartition() - 1)); Assert.isTrue(groupConfigRequestVO.getGroupPartition() >= 0, () -> new EasyRetryServerException("分区不能是负数.")); @@ -176,6 +177,7 @@ public class GroupConfigServiceImpl implements GroupConfigService { groupConfig.setCreateDt(LocalDateTime.now()); groupConfig.setVersion(1); groupConfig.setGroupName(groupConfigRequestVO.getGroupName()); + groupConfig.setDescription(Optional.ofNullable(groupConfigRequestVO.getDescription()).orElse(StrUtil.EMPTY)); if (Objects.isNull(groupConfigRequestVO.getGroupPartition())) { groupConfig.setGroupPartition(HashUtil.bkdrHash(groupConfigRequestVO.getGroupName()) % systemProperties.getTotalPartition()); groupConfig.setBucketIndex(HashUtil.bkdrHash(groupConfigRequestVO.getGroupName()) % systemProperties.getBucketTotal());