From 902aad255936ef913923df3dc3d3d4b24d9d9e1e Mon Sep 17 00:00:00 2001
From: "1437892690@qq.com" <1437892690@qq.com>
Date: Tue, 2 Dec 2025 17:12:41 +0800
Subject: [PATCH] =?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 | 27 +++++++++++++++++++
.../exception/server/ServerStopException.java | 27 +++++++++++++++++++
.../core/IntegrationHandlerBase.java | 8 +++---
.../framework/util/HttpRequestUtil.java | 4 +--
.../framework/service/FileServiceImpl.java | 10 +++++++
5 files changed, 70 insertions(+), 6 deletions(-)
create mode 100644 src/main/java/neatlogic/framework/exception/server/ServerHostRepeatException.java
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
new file mode 100644
index 000000000..f0e806b62
--- /dev/null
+++ b/src/main/java/neatlogic/framework/exception/server/ServerHostRepeatException.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2025 深圳极向量科技有限公司 All Rights Reserved.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+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})相同", 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..d8e66ba18
--- /dev/null
+++ b/src/main/java/neatlogic/framework/exception/server/ServerStopException.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2025 深圳极向量科技有限公司 All Rights Reserved.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+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/framework/integration/core/IntegrationHandlerBase.java b/src/main/java/neatlogic/framework/integration/core/IntegrationHandlerBase.java
index a9ad979eb..0708ba018 100644
--- a/src/main/java/neatlogic/framework/integration/core/IntegrationHandlerBase.java
+++ b/src/main/java/neatlogic/framework/integration/core/IntegrationHandlerBase.java
@@ -286,7 +286,7 @@ public abstract class IntegrationHandlerBase implements IIntegrationHandler {
connection.connect();
} catch (Exception e) {
String errorMsg = e.getMessage() == null ? ExceptionUtils.getStackTrace(e) : e.getMessage();
- logger.error(e.getMessage(), e);
+ logger.error(url + ", " + e.getMessage(), e);
integrationAuditVo.appendError(errorMsg);
resultVo.appendError(errorMsg);
integrationAuditVo.setStatus("failed");
@@ -302,7 +302,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");
@@ -338,7 +338,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");
@@ -355,7 +355,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 7029586a7..316ac0f56 100644
--- a/src/main/java/neatlogic/framework/util/HttpRequestUtil.java
+++ b/src/main/java/neatlogic/framework/util/HttpRequestUtil.java
@@ -563,7 +563,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();
}
@@ -638,7 +638,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 36b12fdb1..54d5d3aec 100644
--- a/src/main/java/neatlogic/module/framework/service/FileServiceImpl.java
+++ b/src/main/java/neatlogic/module/framework/service/FileServiceImpl.java
@@ -28,7 +28,9 @@ 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.server.ServerStopException;
import neatlogic.framework.exception.user.NoTenantException;
import neatlogic.framework.file.core.FileOperationType;
import neatlogic.framework.file.core.FileTypeHandlerFactory;
@@ -223,6 +225,14 @@ 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 {
+ paramObj.put("forwardCount", 1);
+ }
HttpServletRequest request = RequestContext.get().getRequest();
String url = host + request.getRequestURI();
HttpRequestUtil httpRequestUtil = HttpRequestUtil.post(url)
--
Gitee