From 9351d47948e1421f308eac1fa761b18b621580a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Mon, 29 Nov 2021 14:10:53 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-common/pom.xml | 5 ++++ .../com/ruoyi/common/utils/RedisUtils.java | 23 ------------------- .../demo/controller/TestDemoController.java | 2 +- .../web/exception/GlobalExceptionHandler.java | 1 + 4 files changed, 7 insertions(+), 24 deletions(-) diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index a3ce9d7c..37282f44 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -40,6 +40,11 @@ sa-token-jwt + + org.springframework.security + spring-security-crypto + + org.springframework.boot diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/RedisUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/RedisUtils.java index 04db787b..7f4d2cac 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/RedisUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/RedisUtils.java @@ -114,29 +114,6 @@ public class RedisUtils { } } - /** - * 缓存基本的对象,保留当前对象 TTL 有效期 - * - * @param key 缓存的键值 - * @param value 缓存的值 - * @param isSaveTtl 是否保留TTL有效期(例如: set之前ttl剩余90 set之后还是为90) - * @since Redis 6.X 以上使用 setAndKeepTTL 兼容 5.X 方案 - */ - public static void setCacheObject(final String key, final T value, final boolean isSaveTtl) { - RBucket bucket = client.getBucket(key); - if (isSaveTtl) { - try { - bucket.setAndKeepTTL(value); - } catch (Exception e) { - long timeToLive = bucket.remainTimeToLive(); - bucket.set(value); - bucket.expire(timeToLive, TimeUnit.MILLISECONDS); - } - } else { - bucket.set(value); - } - } - /** * 缓存基本的对象,Integer、String、实体类等 * diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java index 7d558aed..68374524 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java @@ -73,7 +73,7 @@ public class TestDemoController extends BaseController { @ApiImplicitParam(name = "file", value = "导入文件", dataType = "java.io.File", required = true), }) @Log(title = "测试单表", businessType = BusinessType.IMPORT) - @PreAuthorize("@ss.hasPermi('demo:demo:import')") + @SaCheckPermission("demo:demo:import") @PostMapping("/importData") public AjaxResult importData(@RequestPart("file") MultipartFile file) throws Exception { ExcelResult excelResult = ExcelUtil.importExcel(file.getInputStream(), TestDemoImportVo.class, true); diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java index 2be7afa6..cfa72432 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java @@ -9,6 +9,7 @@ import com.ruoyi.common.exception.DemoModeException; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.StringUtils; import lombok.extern.slf4j.Slf4j; +import org.springframework.context.support.DefaultMessageSourceResolvable; import org.springframework.validation.BindException; import org.springframework.web.HttpRequestMethodNotSupportedException; import org.springframework.web.bind.MethodArgumentNotValidException;