From 4742a5470492e3f6d4ae79622b5a33e935ef58ca Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Tue, 25 Nov 2025 12:00:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[=E4=BF=AE=E5=A4=8D]=20=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AE=A1=E8=AE=A1=E8=AF=A6=E6=83=85=E6=97=B6?= =?UTF-8?q?=E5=8F=91=E7=94=9F=E8=BD=AC=E5=8F=91=E6=AC=A1=E6=95=B0=E8=BF=87?= =?UTF-8?q?=E5=A4=9A=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1562252673515523]查看接口审计详情时发生转发次数过多异常 http://192.168.0.96:8090/demo/rdm.html#/bug-detail/939050947543040/939050947543057/1562252673515523 --- .../server/ServerHostRepeatException.java | 20 +++++++++++++++++++ .../core/IntegrationHandlerBase.java | 6 +++--- .../framework/util/HttpRequestUtil.java | 4 ++-- .../framework/service/FileServiceImpl.java | 6 ++++++ 4 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 src/main/java/neatlogic/framework/exception/server/ServerHostRepeatException.java diff --git a/src/main/java/neatlogic/framework/exception/server/ServerHostRepeatException.java b/src/main/java/neatlogic/framework/exception/server/ServerHostRepeatException.java new file mode 100644 index 000000000..0f9672f25 --- /dev/null +++ b/src/main/java/neatlogic/framework/exception/server/ServerHostRepeatException.java @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2025 TechSure Co., Ltd. All Rights Reserved. + * This file is part of the NeatLogic software. + * Licensed under the NeatLogic Sustainable Use License (NSUL), Version 4.x – 2025. + * You may use this file only in compliance with the License. + * See the LICENSE file distributed with this work for the full license text. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + */ + +package neatlogic.framework.exception.server; + +import neatlogic.framework.exception.core.ApiRuntimeException; + +public class ServerHostRepeatException extends ApiRuntimeException { + + public ServerHostRepeatException(Integer serverId, String host, Integer currentServerId) { + super("应用服务器{0}的host({1})与应用服务器{2}的host({3})相同,应用服务器{4}可能已停机", serverId, host, currentServerId, host, serverId); + } +} diff --git a/src/main/java/neatlogic/framework/integration/core/IntegrationHandlerBase.java b/src/main/java/neatlogic/framework/integration/core/IntegrationHandlerBase.java index 3d8a0ae43..da8983d01 100644 --- a/src/main/java/neatlogic/framework/integration/core/IntegrationHandlerBase.java +++ b/src/main/java/neatlogic/framework/integration/core/IntegrationHandlerBase.java @@ -299,7 +299,7 @@ public abstract class IntegrationHandlerBase implements IIntegrationHandler { } out.flush(); } catch (Exception e) { - logger.error(e.getMessage(), e); + logger.error(url + ", " + e.getMessage(), e); resultVo.appendError(e.getMessage()); integrationAuditVo.appendError(e.getMessage()); integrationAuditVo.setStatus("failed"); @@ -335,7 +335,7 @@ public abstract class IntegrationHandlerBase implements IIntegrationHandler { throw new RuntimeException(writer.toString()); } } catch (Exception e) { - logger.error(e.getMessage(), e); + logger.error(url + ", " + e.getMessage(), e); resultVo.appendError(e.getMessage()); integrationAuditVo.appendError(e.getMessage()); integrationAuditVo.setStatus("failed"); @@ -352,7 +352,7 @@ public abstract class IntegrationHandlerBase implements IIntegrationHandler { } hasTransferred = true; } catch (Exception ex) { - logger.error(ex.getMessage(), ex); + logger.error(url + ", " + ex.getMessage(), ex); resultVo.appendError(ex.getMessage()); integrationAuditVo.appendError(ex.getMessage()); integrationAuditVo.setStatus("failed"); diff --git a/src/main/java/neatlogic/framework/util/HttpRequestUtil.java b/src/main/java/neatlogic/framework/util/HttpRequestUtil.java index 8960b6a20..4e6ccf5a3 100644 --- a/src/main/java/neatlogic/framework/util/HttpRequestUtil.java +++ b/src/main/java/neatlogic/framework/util/HttpRequestUtil.java @@ -560,7 +560,7 @@ public class HttpRequestUtil { connection.connect(); return connection; } catch (Exception ex) { - logger.error(this.url + "-" + ex.getMessage(), ex); + logger.error(this.url + ", " + ex.getMessage(), ex); this.error = ExceptionUtils.getStackTrace(ex); this.errorMsg = ex.getMessage(); } @@ -635,7 +635,7 @@ public class HttpRequestUtil { } this.errorMsg = message; } catch (Exception e) { - logger.error(e.getMessage(), e); + logger.error(this.url + ", " + e.getMessage(), e); this.error = ExceptionUtils.getStackTrace(e); this.errorMsg = e.getMessage(); } finally { diff --git a/src/main/java/neatlogic/module/framework/service/FileServiceImpl.java b/src/main/java/neatlogic/module/framework/service/FileServiceImpl.java index 4428dbfee..da059c95e 100644 --- a/src/main/java/neatlogic/module/framework/service/FileServiceImpl.java +++ b/src/main/java/neatlogic/module/framework/service/FileServiceImpl.java @@ -25,6 +25,7 @@ import neatlogic.framework.exception.file.FileNotFoundException; import neatlogic.framework.exception.file.FilePathIllegalException; import neatlogic.framework.exception.file.FileTypeHandlerNotFoundException; import neatlogic.framework.exception.server.ServerHostIsBankException; +import neatlogic.framework.exception.server.ServerHostRepeatException; import neatlogic.framework.exception.server.ServerNotFoundException; import neatlogic.framework.exception.user.NoTenantException; import neatlogic.framework.file.core.FileOperationType; @@ -220,6 +221,11 @@ public class FileServiceImpl implements IFileCrossoverService { if (StringUtils.isBlank(host)) { throw new ServerHostIsBankException(serverId); } + if (Objects.equals(paramObj.getInteger("forwardCount"), 1)) { + throw new ServerHostRepeatException(serverId, host, Config.SCHEDULE_SERVER_ID); + } else { + paramObj.put("forwardCount", 1); + } HttpServletRequest request = RequestContext.get().getRequest(); String url = host + request.getRequestURI(); HttpRequestUtil httpRequestUtil = HttpRequestUtil.post(url) -- Gitee From 15210203c2e85515f01745fb2d265e2d9720da63 Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Tue, 25 Nov 2025 12:14:25 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[=E4=BF=AE=E5=A4=8D]=20=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AE=A1=E8=AE=A1=E8=AF=A6=E6=83=85=E6=97=B6?= =?UTF-8?q?=E5=8F=91=E7=94=9F=E8=BD=AC=E5=8F=91=E6=AC=A1=E6=95=B0=E8=BF=87?= =?UTF-8?q?=E5=A4=9A=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1562252673515523]查看接口审计详情时发生转发次数过多异常 http://192.168.0.96:8090/demo/rdm.html#/bug-detail/939050947543040/939050947543057/1562252673515523 --- .../server/ServerHostRepeatException.java | 2 +- .../exception/server/ServerStopException.java | 20 +++++++++++++++++++ .../framework/service/FileServiceImpl.java | 4 ++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/main/java/neatlogic/framework/exception/server/ServerStopException.java diff --git a/src/main/java/neatlogic/framework/exception/server/ServerHostRepeatException.java b/src/main/java/neatlogic/framework/exception/server/ServerHostRepeatException.java index 0f9672f25..df069f00c 100644 --- a/src/main/java/neatlogic/framework/exception/server/ServerHostRepeatException.java +++ b/src/main/java/neatlogic/framework/exception/server/ServerHostRepeatException.java @@ -15,6 +15,6 @@ import neatlogic.framework.exception.core.ApiRuntimeException; public class ServerHostRepeatException extends ApiRuntimeException { public ServerHostRepeatException(Integer serverId, String host, Integer currentServerId) { - super("应用服务器{0}的host({1})与应用服务器{2}的host({3})相同,应用服务器{4}可能已停机", serverId, host, currentServerId, host, serverId); + super("应用服务器{0}的host({1})与应用服务器{2}的host({3})相同", serverId, host, currentServerId, host); } } diff --git a/src/main/java/neatlogic/framework/exception/server/ServerStopException.java b/src/main/java/neatlogic/framework/exception/server/ServerStopException.java new file mode 100644 index 000000000..725ad079f --- /dev/null +++ b/src/main/java/neatlogic/framework/exception/server/ServerStopException.java @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2025 TechSure Co., Ltd. All Rights Reserved. + * This file is part of the NeatLogic software. + * Licensed under the NeatLogic Sustainable Use License (NSUL), Version 4.x – 2025. + * You may use this file only in compliance with the License. + * See the LICENSE file distributed with this work for the full license text. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + */ + +package neatlogic.framework.exception.server; + +import neatlogic.framework.exception.core.ApiRuntimeException; + +public class ServerStopException extends ApiRuntimeException { + + public ServerStopException(Integer serverId, String host) { + super("应用服务器{0}({1})已停机", serverId, host); + } +} diff --git a/src/main/java/neatlogic/module/framework/service/FileServiceImpl.java b/src/main/java/neatlogic/module/framework/service/FileServiceImpl.java index da059c95e..1810ec643 100644 --- a/src/main/java/neatlogic/module/framework/service/FileServiceImpl.java +++ b/src/main/java/neatlogic/module/framework/service/FileServiceImpl.java @@ -27,6 +27,7 @@ import neatlogic.framework.exception.file.FileTypeHandlerNotFoundException; import neatlogic.framework.exception.server.ServerHostIsBankException; import neatlogic.framework.exception.server.ServerHostRepeatException; import neatlogic.framework.exception.server.ServerNotFoundException; +import neatlogic.framework.exception.server.ServerStopException; import neatlogic.framework.exception.user.NoTenantException; import neatlogic.framework.file.core.FileOperationType; import neatlogic.framework.file.core.FileTypeHandlerFactory; @@ -221,6 +222,9 @@ public class FileServiceImpl implements IFileCrossoverService { if (StringUtils.isBlank(host)) { throw new ServerHostIsBankException(serverId); } + if (Objects.equals(serverClusterVo.getStatus(), ServerClusterVo.STOP)) { + throw new ServerStopException(serverClusterVo.getServerId(), serverClusterVo.getHost()); + } if (Objects.equals(paramObj.getInteger("forwardCount"), 1)) { throw new ServerHostRepeatException(serverId, host, Config.SCHEDULE_SERVER_ID); } else { -- Gitee