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 14b028a78d..a37fff0e31 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()); }