|  | @@ -1,14 +1,5 @@
 | 
	
		
			
				|  |  |  package com.fs.system.service.impl;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import java.util.Collection;
 | 
	
		
			
				|  |  | -import java.util.List;
 | 
	
		
			
				|  |  | -import javax.annotation.PostConstruct;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -import com.fs.system.domain.SysConfig;
 | 
	
		
			
				|  |  | -import com.fs.system.mapper.SysConfigMapper;
 | 
	
		
			
				|  |  | -import com.fs.system.service.ISysConfigService;
 | 
	
		
			
				|  |  | -import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | -import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  import com.fs.common.annotation.DataSource;
 | 
	
		
			
				|  |  |  import com.fs.common.constant.Constants;
 | 
	
		
			
				|  |  |  import com.fs.common.constant.UserConstants;
 | 
	
	
		
			
				|  | @@ -17,11 +8,20 @@ import com.fs.common.core.text.Convert;
 | 
	
		
			
				|  |  |  import com.fs.common.enums.DataSourceType;
 | 
	
		
			
				|  |  |  import com.fs.common.exception.CustomException;
 | 
	
		
			
				|  |  |  import com.fs.common.utils.StringUtils;
 | 
	
		
			
				|  |  | +import com.fs.system.domain.SysConfig;
 | 
	
		
			
				|  |  | +import com.fs.system.mapper.SysConfigMapper;
 | 
	
		
			
				|  |  | +import com.fs.system.service.ISysConfigService;
 | 
	
		
			
				|  |  | +import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | +import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import javax.annotation.PostConstruct;
 | 
	
		
			
				|  |  | +import java.util.Collection;
 | 
	
		
			
				|  |  | +import java.util.List;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /**
 | 
	
		
			
				|  |  |   * 参数配置 服务层实现
 | 
	
		
			
				|  |  | - * 
 | 
	
		
			
				|  |  | - 
 | 
	
		
			
				|  |  | + *
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  |  @Service
 | 
	
		
			
				|  |  |  public class SysConfigServiceImpl implements ISysConfigService
 | 
	
	
		
			
				|  | @@ -47,7 +47,7 @@ public class SysConfigServiceImpl implements ISysConfigService
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 查询参数配置信息
 | 
	
		
			
				|  |  | -     * 
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  |       * @param configId 参数配置ID
 | 
	
		
			
				|  |  |       * @return 参数配置信息
 | 
	
		
			
				|  |  |       */
 | 
	
	
		
			
				|  | @@ -62,7 +62,7 @@ public class SysConfigServiceImpl implements ISysConfigService
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 根据键名查询参数配置信息
 | 
	
		
			
				|  |  | -     * 
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  |       * @param configKey 参数key
 | 
	
		
			
				|  |  |       * @return 参数键值
 | 
	
		
			
				|  |  |       */
 | 
	
	
		
			
				|  | @@ -87,7 +87,7 @@ public class SysConfigServiceImpl implements ISysConfigService
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 查询参数配置列表
 | 
	
		
			
				|  |  | -     * 
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  |       * @param config 参数配置信息
 | 
	
		
			
				|  |  |       * @return 参数配置集合
 | 
	
		
			
				|  |  |       */
 | 
	
	
		
			
				|  | @@ -99,7 +99,7 @@ public class SysConfigServiceImpl implements ISysConfigService
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 新增参数配置
 | 
	
		
			
				|  |  | -     * 
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  |       * @param config 参数配置信息
 | 
	
		
			
				|  |  |       * @return 结果
 | 
	
		
			
				|  |  |       */
 | 
	
	
		
			
				|  | @@ -116,7 +116,7 @@ public class SysConfigServiceImpl implements ISysConfigService
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 修改参数配置
 | 
	
		
			
				|  |  | -     * 
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  |       * @param config 参数配置信息
 | 
	
		
			
				|  |  |       * @return 结果
 | 
	
		
			
				|  |  |       */
 | 
	
	
		
			
				|  | @@ -126,15 +126,15 @@ public class SysConfigServiceImpl implements ISysConfigService
 | 
	
		
			
				|  |  |          int row = configMapper.updateConfig(config);
 | 
	
		
			
				|  |  |          if (row > 0)
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |              redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        this.resetConfigCache();
 | 
	
		
			
				|  |  |          return row;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 批量删除参数信息
 | 
	
		
			
				|  |  | -     * 
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  |       * @param configIds 需要删除的参数ID
 | 
	
		
			
				|  |  |       * @return 结果
 | 
	
		
			
				|  |  |       */
 | 
	
	
		
			
				|  | @@ -158,6 +158,15 @@ public class SysConfigServiceImpl implements ISysConfigService
 | 
	
		
			
				|  |  |          return count;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public void loadingConfigCache() {
 | 
	
		
			
				|  |  | +        List<SysConfig> configsList = configMapper.selectConfigList(new SysConfig());
 | 
	
		
			
				|  |  | +        for (SysConfig config : configsList)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 清空缓存数据
 | 
	
		
			
				|  |  |       */
 | 
	
	
		
			
				|  | @@ -168,9 +177,15 @@ public class SysConfigServiceImpl implements ISysConfigService
 | 
	
		
			
				|  |  |          redisCache.deleteObject(keys);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public void resetConfigCache() {
 | 
	
		
			
				|  |  | +        clearCache();
 | 
	
		
			
				|  |  | +        loadingConfigCache();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 校验参数键名是否唯一
 | 
	
		
			
				|  |  | -     * 
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  |       * @param config 参数配置信息
 | 
	
		
			
				|  |  |       * @return 结果
 | 
	
		
			
				|  |  |       */
 | 
	
	
		
			
				|  | @@ -195,7 +210,7 @@ public class SysConfigServiceImpl implements ISysConfigService
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 设置cache key
 | 
	
		
			
				|  |  | -     * 
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  |       * @param configKey 参数键
 | 
	
		
			
				|  |  |       * @return 缓存键key
 | 
	
		
			
				|  |  |       */
 |