From f1660e18e41e66a2e38631d6fb363f130b6259f6 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 31 May 2026 19:51:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E5=AF=B9=20JDK8=20?= =?UTF-8?q?=E7=9A=84=E5=85=BC=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/client/local/LocalFileClient.java | 3 ++- .../file/core/utils/FilePathUtils.java | 4 ++-- .../IotAlertTriggerSceneRuleAction.java | 19 ++++++++++++++----- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/local/LocalFileClient.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/local/LocalFileClient.java index 51bea83217..9c3af16cc5 100644 --- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/local/LocalFileClient.java +++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/local/LocalFileClient.java @@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.infra.framework.file.core.client.AbstractFileClie import cn.iocoder.yudao.module.infra.framework.file.core.utils.FilePathUtils; import java.nio.file.Path; +import java.nio.file.Paths; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_PATH_INVALID; @@ -55,7 +56,7 @@ public class LocalFileClient extends AbstractFileClient { private String getFilePath(String path) { FilePathUtils.validatePath(path); - Path basePath = Path.of(config.getBasePath()).toAbsolutePath().normalize(); + Path basePath = Paths.get(config.getBasePath()).toAbsolutePath().normalize(); Path filePath = basePath.resolve(path).normalize(); if (!filePath.startsWith(basePath)) { throw exception(FILE_PATH_INVALID); diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/utils/FilePathUtils.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/utils/FilePathUtils.java index 440848017b..e61bfe78fd 100644 --- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/utils/FilePathUtils.java +++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/utils/FilePathUtils.java @@ -4,7 +4,7 @@ import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.StrUtil; import java.nio.file.InvalidPathException; -import java.nio.file.Path; +import java.nio.file.Paths; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_PATH_INVALID; @@ -88,7 +88,7 @@ public class FilePathUtils { } try { // 使用 JDK Path 再兜底判断一次绝对路径 - if (Path.of(path).isAbsolute()) { + if (Paths.get(path).isAbsolute()) { return false; } } catch (InvalidPathException ex) { diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/rule/scene/action/IotAlertTriggerSceneRuleAction.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/rule/scene/action/IotAlertTriggerSceneRuleAction.java index dafebb29f1..937b8f603c 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/rule/scene/action/IotAlertTriggerSceneRuleAction.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/rule/scene/action/IotAlertTriggerSceneRuleAction.java @@ -121,11 +121,20 @@ public class IotAlertTriggerSceneRuleAction implements IotSceneRuleAction { } private String resolveTemplateCode(IotAlertConfigDO config, IotAlertReceiveTypeEnum typeEnum) { - String templateCode = switch (typeEnum) { - case SMS -> config.getSmsTemplateCode(); - case MAIL -> config.getMailTemplateCode(); - case NOTIFY -> config.getNotifyTemplateCode(); - }; + String templateCode = null; + switch (typeEnum) { + case SMS: + templateCode = config.getSmsTemplateCode(); + break; + case MAIL: + templateCode = config.getMailTemplateCode(); + break; + case NOTIFY: + templateCode = config.getNotifyTemplateCode(); + break; + default: + break; + } return StrUtil.blankToDefault(templateCode, typeEnum.getTemplateCode()); }