From 79914dabac38d83676ea16ff65da8d941a099285 Mon Sep 17 00:00:00 2001 From: Jay <csj123456> Date: 星期二, 08 十月 2024 10:38:01 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- 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