[Fix]同步

This commit is contained in:
xiezubing1
2021-11-08 17:09:14 +08:00
parent bbbe83b737
commit 41b81f0682
18 changed files with 369 additions and 349 deletions

View File

@ -3,7 +3,7 @@ package com.ruoyi.system.service.impl;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.core.redis.RedisUtils;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.exception.ServiceException;
@ -19,7 +19,7 @@ import java.util.List;
/**
* 参数配置 服务层实现
*
*
* @author ruoyi
*/
@Service
@ -29,7 +29,7 @@ public class SysConfigServiceImpl implements ISysConfigService
private SysConfigMapper configMapper;
@Autowired
private RedisCache redisCache;
private RedisUtils redisUtils;
/**
* 项目启动时,初始化参数到缓存
@ -42,7 +42,7 @@ public class SysConfigServiceImpl implements ISysConfigService
/**
* 查询参数配置信息
*
*
* @param configId 参数配置ID
* @return 参数配置信息
*/
@ -57,14 +57,14 @@ public class SysConfigServiceImpl implements ISysConfigService
/**
* 根据键名查询参数配置信息
*
*
* @param configKey 参数key
* @return 参数键值
*/
@Override
public String selectConfigByKey(String configKey)
{
String configValue = Convert.toStr(redisCache.getCacheObject(getCacheKey(configKey)));
String configValue = Convert.toStr(redisUtils.getCacheObject(getCacheKey(configKey)));
if (StringUtils.isNotEmpty(configValue))
{
return configValue;
@ -74,7 +74,7 @@ public class SysConfigServiceImpl implements ISysConfigService
SysConfig retConfig = configMapper.selectConfig(config);
if (StringUtils.isNotNull(retConfig))
{
redisCache.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue());
redisUtils.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue());
return retConfig.getConfigValue();
}
return StringUtils.EMPTY;
@ -82,7 +82,7 @@ public class SysConfigServiceImpl implements ISysConfigService
/**
* 获取验证码开关
*
*
* @return true开启false关闭
*/
@Override
@ -98,7 +98,7 @@ public class SysConfigServiceImpl implements ISysConfigService
/**
* 查询参数配置列表
*
*
* @param config 参数配置信息
* @return 参数配置集合
*/
@ -110,7 +110,7 @@ public class SysConfigServiceImpl implements ISysConfigService
/**
* 新增参数配置
*
*
* @param config 参数配置信息
* @return 结果
*/
@ -120,14 +120,14 @@ public class SysConfigServiceImpl implements ISysConfigService
int row = configMapper.insertConfig(config);
if (row > 0)
{
redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
redisUtils.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
}
return row;
}
/**
* 修改参数配置
*
*
* @param config 参数配置信息
* @return 结果
*/
@ -137,14 +137,14 @@ public class SysConfigServiceImpl implements ISysConfigService
int row = configMapper.updateConfig(config);
if (row > 0)
{
redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
redisUtils.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
}
return row;
}
/**
* 批量删除参数信息
*
*
* @param configIds 需要删除的参数ID
* @return 结果
*/
@ -159,7 +159,7 @@ public class SysConfigServiceImpl implements ISysConfigService
throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
}
configMapper.deleteConfigById(configId);
redisCache.deleteObject(getCacheKey(config.getConfigKey()));
redisUtils.deleteObject(getCacheKey(config.getConfigKey()));
}
}
@ -172,7 +172,7 @@ public class SysConfigServiceImpl implements ISysConfigService
List<SysConfig> configsList = configMapper.selectConfigList(new SysConfig());
for (SysConfig config : configsList)
{
redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
redisUtils.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
}
}
@ -182,8 +182,8 @@ public class SysConfigServiceImpl implements ISysConfigService
@Override
public void clearConfigCache()
{
Collection<String> keys = redisCache.keys(Constants.SYS_CONFIG_KEY + "*");
redisCache.deleteObject(keys);
Collection<String> keys = redisUtils.keys(Constants.SYS_CONFIG_KEY + "*");
redisUtils.deleteObject(keys);
}
/**
@ -198,7 +198,7 @@ public class SysConfigServiceImpl implements ISysConfigService
/**
* 校验参数键名是否唯一
*
*
* @param config 参数配置信息
* @return 结果
*/
@ -216,7 +216,7 @@ public class SysConfigServiceImpl implements ISysConfigService
/**
* 设置cache key
*
*
* @param configKey 参数键
* @return 缓存键key
*/