diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e1e404ad..c19c72ee4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ 2. 【server】优化 解析文件数据采用分片形式,避免大文件造成浏览器奔溃 3. 【server】优化 插件端在线升级管理页面错误信息提示由弹窗改到对应节点 4. 【server】修复 迁移数据出现监控报警记录表字段不全问题 (感谢@loyal) +5. 【server】修复 迁移系统参数表中的 sync_trigger_token 数据重复问题 ### ❌ 不兼容功能 @@ -46,8 +47,8 @@ 1. 插件端需要同步升级,否则节点分发项目无法显示项目名称 2. 插件端需要同步升级,否则会出现部分接口 404 或者参数不正确的情况 3. 建议升级验证上传项目文件无问题后,将插件端上传文件大小限制配置属性大改小 - 1. spring.servlet.multipart.max-file-size=5MB - 2. spring.servlet.multipart.max-request-size=20MB + 1. spring.servlet.multipart.max-file-size=5MB + 2. spring.servlet.multipart.max-request-size=20MB **如果需要使用 mysql 存储,则需要修改配置** diff --git a/modules/server/src/main/java/io/jpom/model/data/SystemParametersModel.java b/modules/server/src/main/java/io/jpom/model/data/SystemParametersModel.java index 4a2d5969a..bbaa74c2b 100644 --- a/modules/server/src/main/java/io/jpom/model/data/SystemParametersModel.java +++ b/modules/server/src/main/java/io/jpom/model/data/SystemParametersModel.java @@ -23,7 +23,10 @@ package io.jpom.model.data; import io.jpom.model.BaseStrikeDbModel; +import io.jpom.service.user.TriggerTokenLogServer; import io.jpom.util.StringUtil; +import lombok.Data; +import lombok.EqualsAndHashCode; import top.jpom.h2db.TableName; /** @@ -32,7 +35,9 @@ import top.jpom.h2db.TableName; * @author bwcx_jzy * @since 2021/12/2 */ -@TableName(value = "SYSTEM_PARAMETERS", name = "系统参数") +@EqualsAndHashCode(callSuper = true) +@TableName(value = "SYSTEM_PARAMETERS", name = "系统参数", migrateIgnoreId = TriggerTokenLogServer.NAME) +@Data public class SystemParametersModel extends BaseStrikeDbModel { /** @@ -44,22 +49,6 @@ public class SystemParametersModel extends BaseStrikeDbModel { */ private String description; - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - public T jsonToBean(Class cls) { return StringUtil.jsonConvert(this.getValue(), cls); } diff --git a/modules/server/src/main/java/io/jpom/service/user/TriggerTokenLogServer.java b/modules/server/src/main/java/io/jpom/service/user/TriggerTokenLogServer.java index 8d80bb58c..336896139 100644 --- a/modules/server/src/main/java/io/jpom/service/user/TriggerTokenLogServer.java +++ b/modules/server/src/main/java/io/jpom/service/user/TriggerTokenLogServer.java @@ -57,6 +57,7 @@ public class TriggerTokenLogServer extends BaseDbService im * 填充的长度 */ private static final int BUILD_INFO_TRIGGER_TOKEN_FILL_LEN = 3; + public static final String NAME = "sync_trigger_token"; private final SystemParametersServer parametersServer; private final UserService userService; @@ -145,15 +146,14 @@ public class TriggerTokenLogServer extends BaseDbService im @Override public int statusRecover() { - String name = "sync_trigger_token"; - String triggerToken = parametersServer.getConfig(name, String.class); + String triggerToken = parametersServer.getConfig(NAME, String.class); if (StrUtil.isNotEmpty(triggerToken)) { // 已经同步过啦 return 0; } List list = userService.list(); if (CollUtil.isEmpty(list)) { - log.warn("TriggerToken status recover,user list empty"); + log.debug("TriggerToken status recover,user list empty"); return -1; } List userIds = list.stream().map(BaseIdModel::getId).collect(Collectors.toList()); @@ -179,7 +179,7 @@ public class TriggerTokenLogServer extends BaseDbService im // return CollUtil.size(triggerTokenLogBeans); }).sum(); - parametersServer.upsert(name, count, name); + parametersServer.upsert(NAME, count, NAME); log.info("trigger token sync count:{}", count); return count; }