From d9f9ba31913bb9f5053ad78109e8a3c1c00f1e6a Mon Sep 17 00:00:00 2001
From: houzhongjian <houzhongyi@126.com>
Date: 星期二, 23 七月 2024 09:58:30 +0800
Subject: [PATCH] update framework

---
 iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/service/config/ConfigServiceImpl.java |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/service/config/ConfigServiceImpl.java b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/service/config/ConfigServiceImpl.java
index 6689caa..53400e7 100644
--- a/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/service/config/ConfigServiceImpl.java
+++ b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/service/config/ConfigServiceImpl.java
@@ -9,10 +9,15 @@
 import com.iailab.module.infra.enums.config.ConfigTypeEnum;
 import com.google.common.annotations.VisibleForTesting;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.validation.annotation.Validated;
 
 import javax.annotation.Resource;
+
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
 
 import static com.iailab.framework.common.exception.util.ServiceExceptionUtil.exception;
 import static com.iailab.module.infra.enums.ErrorCodeConstants.*;
@@ -27,6 +32,9 @@
 
     @Resource
     private ConfigMapper configMapper;
+
+    @Resource
+    private StringRedisTemplate stringRedisTemplate;
 
     @Override
     public Long createConfig(ConfigSaveReqVO createReqVO) {
@@ -106,4 +114,15 @@
         }
     }
 
+    @Override
+    public String getValue(String configCode) {
+        String paramValue = stringRedisTemplate.opsForValue().get(configCode);
+        if(paramValue == null){
+            ConfigDO configDO = configMapper.selectByKey(configCode);
+            paramValue = configDO.getValue();
+            stringRedisTemplate.opsForValue().set(configCode, paramValue);
+        }
+        return paramValue;
+    }
+
 }

--
Gitblit v1.9.3