zyp 3 недель назад
Родитель
Сommit
e505e48dab

+ 8 - 14
fs-admin/src/main/java/com/fs/web/controller/system/SysConfigController.java

@@ -1,17 +1,5 @@
 package com.fs.web.controller.system;
 
-import java.util.List;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 import com.fs.common.annotation.Log;
 import com.fs.common.annotation.RepeatSubmit;
 import com.fs.common.constant.UserConstants;
@@ -19,14 +7,20 @@ import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
-import com.fs.core.security.SecurityUtils;
 import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.core.security.SecurityUtils;
 import com.fs.system.domain.SysConfig;
 import com.fs.system.service.ISysConfigService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
 
 /**
  * 参数配置 信息操作处理
- * 
+ *
 
  */
 @RestController

+ 2 - 0
fs-service-system/src/main/java/com/fs/his/param/WxSendRedPacketParam.java

@@ -12,5 +12,7 @@ public class WxSendRedPacketParam implements Serializable {
 
     private BigDecimal amount;
 
+    private Long companyId;
+
 
 }

+ 19 - 9
fs-service-system/src/main/java/com/fs/system/service/ISysConfigService.java

@@ -1,18 +1,19 @@
 package com.fs.system.service;
 
-import java.util.List;
 import com.fs.system.domain.SysConfig;
 
+import java.util.List;
+
 /**
  * 参数配置 服务层
- * 
+ *
 
  */
 public interface ISysConfigService
 {
     /**
      * 查询参数配置信息
-     * 
+     *
      * @param configId 参数配置ID
      * @return 参数配置信息
      */
@@ -20,7 +21,7 @@ public interface ISysConfigService
 
     /**
      * 根据键名查询参数配置信息
-     * 
+     *
      * @param configKey 参数键名
      * @return 参数键值
      */
@@ -28,7 +29,7 @@ public interface ISysConfigService
 
     /**
      * 查询参数配置列表
-     * 
+     *
      * @param config 参数配置信息
      * @return 参数配置集合
      */
@@ -36,7 +37,7 @@ public interface ISysConfigService
 
     /**
      * 新增参数配置
-     * 
+     *
      * @param config 参数配置信息
      * @return 结果
      */
@@ -44,7 +45,7 @@ public interface ISysConfigService
 
     /**
      * 修改参数配置
-     * 
+     *
      * @param config 参数配置信息
      * @return 结果
      */
@@ -52,20 +53,29 @@ public interface ISysConfigService
 
     /**
      * 批量删除参数信息
-     * 
+     *
      * @param configIds 需要删除的参数ID
      * @return 结果
      */
     public int deleteConfigByIds(Long[] configIds);
 
+    /**
+     * 加载参数缓存数据
+     */
+    public void loadingConfigCache();
     /**
      * 清空缓存数据
      */
     public void clearCache();
 
+    /**
+     * 重置参数缓存数据
+     */
+    public void resetConfigCache();
+
     /**
      * 校验参数键名是否唯一
-     * 
+     *
      * @param config 参数信息
      * @return 结果
      */

+ 35 - 20
fs-service-system/src/main/java/com/fs/system/service/impl/SysConfigServiceImpl.java

@@ -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
      */