xusl hace 7 meses
padre
commit
7bcc70b9a3
Se han modificado 37 ficheros con 1705 adiciones y 843 borrados
  1. 11 6
      cpp-admin/src/main/java/com/cpp/web/controller/common/CaptchaController.java
  2. 121 121
      cpp-admin/src/main/java/com/cpp/web/controller/monitor/CacheController.java
  3. 16 7
      cpp-admin/src/main/java/com/cpp/web/controller/monitor/SysUserOnlineController.java
  4. 21 21
      cpp-admin/src/main/resources/application.yml
  5. 9 5
      cpp-common/pom.xml
  6. 84 0
      cpp-common/src/main/java/com/cpp/common/core/cache/LocalCache.java
  7. 0 156
      cpp-common/src/main/java/com/cpp/common/core/cache/Localcache.java
  8. 268 268
      cpp-common/src/main/java/com/cpp/common/core/redis/RedisCache.java
  9. 27 7
      cpp-common/src/main/java/com/cpp/common/utils/DictUtils.java
  10. 89 89
      cpp-framework/src/main/java/com/cpp/framework/aspectj/RateLimiterAspect.java
  11. 52 52
      cpp-framework/src/main/java/com/cpp/framework/config/FastJson2JsonRedisSerializer.java
  12. 69 69
      cpp-framework/src/main/java/com/cpp/framework/config/RedisConfig.java
  13. 10 5
      cpp-framework/src/main/java/com/cpp/framework/interceptor/impl/SameUrlDataInterceptor.java
  14. 13 5
      cpp-framework/src/main/java/com/cpp/framework/web/service/SysLoginService.java
  15. 22 9
      cpp-framework/src/main/java/com/cpp/framework/web/service/SysPasswordService.java
  16. 10 5
      cpp-framework/src/main/java/com/cpp/framework/web/service/SysRegisterService.java
  17. 8 6
      cpp-framework/src/main/java/com/cpp/framework/web/service/TokenService.java
  18. 27 12
      cpp-system/src/main/java/com/cpp/system/service/impl/SysConfigServiceImpl.java
  19. 22 0
      cpp-ui/.editorconfig
  20. 11 0
      cpp-ui/.env.development
  21. 8 0
      cpp-ui/.env.production
  22. 10 0
      cpp-ui/.env.staging
  23. 10 0
      cpp-ui/.eslintignore
  24. 199 0
      cpp-ui/.eslintrc.js
  25. 23 0
      cpp-ui/.gitignore
  26. 30 0
      cpp-ui/README.md
  27. 13 0
      cpp-ui/babel.config.js
  28. 12 0
      cpp-ui/bin/build.bat
  29. 12 0
      cpp-ui/bin/package.bat
  30. 12 0
      cpp-ui/bin/run-web.bat
  31. 35 0
      cpp-ui/build/index.js
  32. 90 0
      cpp-ui/package.json
  33. BIN
      cpp-ui/public/favicon.ico
  34. 21 0
      cpp-ui/public/html/ie.html
  35. 208 0
      cpp-ui/public/index.html
  36. 2 0
      cpp-ui/public/robots.txt
  37. 130 0
      cpp-ui/vue.config.js

+ 11 - 6
cpp-admin/src/main/java/com/cpp/web/controller/common/CaptchaController.java

@@ -2,10 +2,12 @@ package com.cpp.web.controller.common;
 
 import java.awt.image.BufferedImage;
 import java.io.IOException;
-import java.util.concurrent.TimeUnit;
+import java.util.List;
 import javax.annotation.Resource;
 import javax.imageio.ImageIO;
 import javax.servlet.http.HttpServletResponse;
+
+import com.cpp.common.core.cache.LocalCache;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.FastByteArrayOutputStream;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -13,9 +15,8 @@ import org.springframework.web.bind.annotation.RestController;
 import com.google.code.kaptcha.Producer;
 import com.cpp.common.config.RuoYiConfig;
 import com.cpp.common.constant.CacheConstants;
-import com.cpp.common.constant.Constants;
 import com.cpp.common.core.domain.AjaxResult;
-import com.cpp.common.core.redis.RedisCache;
+//import com.cpp.common.core.redis.RedisCache;
 import com.cpp.common.utils.sign.Base64;
 import com.cpp.common.utils.uuid.IdUtils;
 import com.cpp.system.service.ISysConfigService;
@@ -34,8 +35,8 @@ public class CaptchaController
     @Resource(name = "captchaProducerMath")
     private Producer captchaProducerMath;
 
-    @Autowired
-    private RedisCache redisCache;
+//    @Autowired
+//    private Localcache localcache;
 
     @Autowired
     private ISysConfigService configService;
@@ -75,7 +76,11 @@ public class CaptchaController
             image = captchaProducer.createImage(capStr);
         }
 
-        redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
+        // 验证码2分钟时效
+        LocalCache.set(verifyKey,code,120000);
+
+
+//        redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
         // 转换流信息写出
         FastByteArrayOutputStream os = new FastByteArrayOutputStream();
         try

+ 121 - 121
cpp-admin/src/main/java/com/cpp/web/controller/monitor/CacheController.java

@@ -1,121 +1,121 @@
-package com.cpp.web.controller.monitor;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.TreeSet;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.RedisCallback;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.security.access.prepost.PreAuthorize;
-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.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import com.cpp.common.constant.CacheConstants;
-import com.cpp.common.core.domain.AjaxResult;
-import com.cpp.common.utils.StringUtils;
-import com.cpp.system.domain.SysCache;
-
-/**
- * 缓存监控
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/monitor/cache")
-public class CacheController
-{
-    @Autowired
-    private RedisTemplate<String, String> redisTemplate;
-
-    private final static List<SysCache> caches = new ArrayList<SysCache>();
-    {
-        caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息"));
-        caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息"));
-        caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "数据字典"));
-        caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码"));
-        caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交"));
-        caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理"));
-        caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数"));
-    }
-
-    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
-    @GetMapping()
-    public AjaxResult getInfo() throws Exception
-    {
-        Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
-        Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
-        Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
-
-        Map<String, Object> result = new HashMap<>(3);
-        result.put("info", info);
-        result.put("dbSize", dbSize);
-
-        List<Map<String, String>> pieList = new ArrayList<>();
-        commandStats.stringPropertyNames().forEach(key -> {
-            Map<String, String> data = new HashMap<>(2);
-            String property = commandStats.getProperty(key);
-            data.put("name", StringUtils.removeStart(key, "cmdstat_"));
-            data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
-            pieList.add(data);
-        });
-        result.put("commandStats", pieList);
-        return AjaxResult.success(result);
-    }
-
-    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
-    @GetMapping("/getNames")
-    public AjaxResult cache()
-    {
-        return AjaxResult.success(caches);
-    }
-
-    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
-    @GetMapping("/getKeys/{cacheName}")
-    public AjaxResult getCacheKeys(@PathVariable String cacheName)
-    {
-        Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
-        return AjaxResult.success(new TreeSet<>(cacheKeys));
-    }
-
-    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
-    @GetMapping("/getValue/{cacheName}/{cacheKey}")
-    public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
-    {
-        String cacheValue = redisTemplate.opsForValue().get(cacheKey);
-        SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
-        return AjaxResult.success(sysCache);
-    }
-
-    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
-    @DeleteMapping("/clearCacheName/{cacheName}")
-    public AjaxResult clearCacheName(@PathVariable String cacheName)
-    {
-        Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
-        redisTemplate.delete(cacheKeys);
-        return AjaxResult.success();
-    }
-
-    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
-    @DeleteMapping("/clearCacheKey/{cacheKey}")
-    public AjaxResult clearCacheKey(@PathVariable String cacheKey)
-    {
-        redisTemplate.delete(cacheKey);
-        return AjaxResult.success();
-    }
-
-    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
-    @DeleteMapping("/clearCacheAll")
-    public AjaxResult clearCacheAll()
-    {
-        Collection<String> cacheKeys = redisTemplate.keys("*");
-        redisTemplate.delete(cacheKeys);
-        return AjaxResult.success();
-    }
-}
+//package com.cpp.web.controller.monitor;
+//
+//import java.util.ArrayList;
+//import java.util.Collection;
+//import java.util.HashMap;
+//import java.util.List;
+//import java.util.Map;
+//import java.util.Properties;
+//import java.util.Set;
+//import java.util.TreeSet;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.data.redis.core.RedisCallback;
+//import org.springframework.data.redis.core.RedisTemplate;
+//import org.springframework.security.access.prepost.PreAuthorize;
+//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.RequestMapping;
+//import org.springframework.web.bind.annotation.RestController;
+//import com.cpp.common.constant.CacheConstants;
+//import com.cpp.common.core.domain.AjaxResult;
+//import com.cpp.common.utils.StringUtils;
+//import com.cpp.system.domain.SysCache;
+//
+///**
+// * 缓存监控
+// *
+// * @author ruoyi
+// */
+//@RestController
+//@RequestMapping("/monitor/cache")
+//public class CacheController
+//{
+//    @Autowired
+//    private RedisTemplate<String, String> redisTemplate;
+//
+//    private final static List<SysCache> caches = new ArrayList<SysCache>();
+//    {
+//        caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息"));
+//        caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息"));
+//        caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "数据字典"));
+//        caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码"));
+//        caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交"));
+//        caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理"));
+//        caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数"));
+//    }
+//
+//    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
+//    @GetMapping()
+//    public AjaxResult getInfo() throws Exception
+//    {
+//        Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
+//        Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
+//        Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
+//
+//        Map<String, Object> result = new HashMap<>(3);
+//        result.put("info", info);
+//        result.put("dbSize", dbSize);
+//
+//        List<Map<String, String>> pieList = new ArrayList<>();
+//        commandStats.stringPropertyNames().forEach(key -> {
+//            Map<String, String> data = new HashMap<>(2);
+//            String property = commandStats.getProperty(key);
+//            data.put("name", StringUtils.removeStart(key, "cmdstat_"));
+//            data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
+//            pieList.add(data);
+//        });
+//        result.put("commandStats", pieList);
+//        return AjaxResult.success(result);
+//    }
+//
+//    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
+//    @GetMapping("/getNames")
+//    public AjaxResult cache()
+//    {
+//        return AjaxResult.success(caches);
+//    }
+//
+//    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
+//    @GetMapping("/getKeys/{cacheName}")
+//    public AjaxResult getCacheKeys(@PathVariable String cacheName)
+//    {
+//        Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
+//        return AjaxResult.success(new TreeSet<>(cacheKeys));
+//    }
+//
+//    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
+//    @GetMapping("/getValue/{cacheName}/{cacheKey}")
+//    public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
+//    {
+//        String cacheValue = redisTemplate.opsForValue().get(cacheKey);
+//        SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
+//        return AjaxResult.success(sysCache);
+//    }
+//
+//    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
+//    @DeleteMapping("/clearCacheName/{cacheName}")
+//    public AjaxResult clearCacheName(@PathVariable String cacheName)
+//    {
+//        Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
+//        redisTemplate.delete(cacheKeys);
+//        return AjaxResult.success();
+//    }
+//
+//    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
+//    @DeleteMapping("/clearCacheKey/{cacheKey}")
+//    public AjaxResult clearCacheKey(@PathVariable String cacheKey)
+//    {
+//        redisTemplate.delete(cacheKey);
+//        return AjaxResult.success();
+//    }
+//
+//    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
+//    @DeleteMapping("/clearCacheAll")
+//    public AjaxResult clearCacheAll()
+//    {
+//        Collection<String> cacheKeys = redisTemplate.keys("*");
+//        redisTemplate.delete(cacheKeys);
+//        return AjaxResult.success();
+//    }
+//}

+ 16 - 7
cpp-admin/src/main/java/com/cpp/web/controller/monitor/SysUserOnlineController.java

@@ -4,6 +4,8 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+
+import com.cpp.common.core.cache.LocalCache;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.DeleteMapping;
@@ -17,7 +19,7 @@ import com.cpp.common.core.controller.BaseController;
 import com.cpp.common.core.domain.AjaxResult;
 import com.cpp.common.core.domain.model.LoginUser;
 import com.cpp.common.core.page.TableDataInfo;
-import com.cpp.common.core.redis.RedisCache;
+//import com.cpp.common.core.redis.RedisCache;
 import com.cpp.common.enums.BusinessType;
 import com.cpp.common.utils.StringUtils;
 import com.cpp.system.domain.SysUserOnline;
@@ -35,18 +37,25 @@ public class SysUserOnlineController extends BaseController
     @Autowired
     private ISysUserOnlineService userOnlineService;
 
-    @Autowired
-    private RedisCache redisCache;
+//    @Autowired
+//    private RedisCache redisCache;
 
     @PreAuthorize("@ss.hasPermi('monitor:online:list')")
     @GetMapping("/list")
     public TableDataInfo list(String ipaddr, String userName)
     {
-        Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
+        Collection<String> keys = LocalCache.keySet();
+        Collection<String> tempkeys = new ArrayList<>();
+        for (String key : keys){
+            if (key.contains(CacheConstants.LOGIN_TOKEN_KEY)){
+                tempkeys.add(key);
+            }
+        }
+
         List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
-        for (String key : keys)
+        for (String key : tempkeys)
         {
-            LoginUser user = redisCache.getCacheObject(key);
+            LoginUser user = (LoginUser)LocalCache.get(key);
             if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
             {
                 userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
@@ -77,7 +86,7 @@ public class SysUserOnlineController extends BaseController
     @DeleteMapping("/{tokenId}")
     public AjaxResult forceLogout(@PathVariable String tokenId)
     {
-        redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
+        LocalCache.remove(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
         return success();
     }
 }

+ 21 - 21
cpp-admin/src/main/resources/application.yml

@@ -66,27 +66,27 @@ spring:
       # 热部署开关
       enabled: true
   # redis 配置
-  redis:
-    # 地址
-    host: localhost
-    # 端口,默认为6379
-    port: 6379
-    # 数据库索引
-    database: 0
-    # 密码
-    password:
-    # 连接超时时间
-    timeout: 10s
-    lettuce:
-      pool:
-        # 连接池中的最小空闲连接
-        min-idle: 0
-        # 连接池中的最大空闲连接
-        max-idle: 8
-        # 连接池的最大数据库连接数
-        max-active: 8
-        # #连接池最大阻塞等待时间(使用负值表示没有限制)
-        max-wait: -1ms
+#  redis:
+#    # 地址
+#    host: localhost
+#    # 端口,默认为6379
+#    port: 6379
+#    # 数据库索引
+#    database: 0
+#    # 密码
+#    password:
+#    # 连接超时时间
+#    timeout: 10s
+#    lettuce:
+#      pool:
+#        # 连接池中的最小空闲连接
+#        min-idle: 0
+#        # 连接池中的最大空闲连接
+#        max-idle: 8
+#        # 连接池的最大数据库连接数
+#        max-active: 8
+#        # #连接池最大阻塞等待时间(使用负值表示没有限制)
+#        max-wait: -1ms
 
 # token配置
 token:

+ 9 - 5
cpp-common/pom.xml

@@ -16,7 +16,11 @@
     </description>
 
     <dependencies>
-
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.8.12</version>
+        </dependency>
         <!-- Spring框架基本的核心工具 -->
         <dependency>
             <groupId>org.springframework</groupId>
@@ -96,10 +100,10 @@
         </dependency>
 
         <!-- redis 缓存操作 -->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-data-redis</artifactId>
-        </dependency>
+<!--        <dependency>-->
+<!--            <groupId>org.springframework.boot</groupId>-->
+<!--            <artifactId>spring-boot-starter-data-redis</artifactId>-->
+<!--        </dependency>-->
 
         <!-- pool 对象池 -->
         <dependency>

+ 84 - 0
cpp-common/src/main/java/com/cpp/common/core/cache/LocalCache.java

@@ -0,0 +1,84 @@
+package com.cpp.common.core.cache;
+
+import cn.hutool.cache.CacheUtil;
+import cn.hutool.cache.impl.TimedCache;
+import cn.hutool.core.date.DateUnit;
+
+import java.util.Set;
+
+/**
+* 缓存工具
+*
+* @author xsl
+* @since 2023/02/22
+*/
+public class LocalCache {
+    /**
+     * 默认缓存时长5分钟
+     */
+    private static final long DEFAULT_TIMEOUT = 5 * DateUnit.MINUTE.getMillis();
+    /**
+     * 默认清理间隔时间
+     */
+    private static final long CLEAN_TIMEOUT = 5 * DateUnit.MINUTE.getMillis();
+    /**
+     * 缓存对象
+     */
+    private static final TimedCache<String, Object> TIMED_CACHE = CacheUtil.newTimedCache(DEFAULT_TIMEOUT);
+
+    static {
+        //启动定时任务
+        TIMED_CACHE.schedulePrune(CLEAN_TIMEOUT);
+    }
+
+    public static void set(String key, Object value) {
+        TIMED_CACHE.put(key, value);
+    }
+
+    public static void set(String key, Object value, long expire) {
+        TIMED_CACHE.put(key, value, expire);
+    }
+
+    /**
+     * 获取并重新计算过期时间
+     */
+    public static Object getWithUpdateLastAccess(String key) {
+        return TIMED_CACHE.get(key);
+    }
+
+    /**
+     * 获取
+     *
+     * @param key
+     * @return
+     */
+    public static Object get(String key) {
+        return TIMED_CACHE.get(key, false);
+    }
+
+    public static Set<String> keySet() {
+        return TIMED_CACHE.keySet();
+    }
+
+
+    public static void remove(String key) {
+        TIMED_CACHE.remove(key);
+    }
+
+    public static void clear() {
+        TIMED_CACHE.clear();
+    }
+
+    public static long test() {
+        return TIMED_CACHE.timeout();
+
+    }
+
+    public static class Constants {
+        public static final String DICT_LIST_PREFIX = "dict:list:";
+        public static final String DICT_ONE_PREFIX = "dict:one:";
+        public static final String DICT_MAP_PREFIX = "dict:map:";
+
+        public static final String SCRIPT = "script:";
+    }
+}

+ 0 - 156
cpp-common/src/main/java/com/cpp/common/core/cache/Localcache.java

@@ -1,156 +0,0 @@
-package com.cpp.common.core.cache;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.TimeUnit;
-
-import javax.annotation.PostConstruct;
-
-import com.github.benmanes.caffeine.cache.Cache;
-import com.github.benmanes.caffeine.cache.Caffeine;
-import org.springframework.stereotype.Component;
-
-
-
-
-
-/**
- * 本地缓存方式
- *
- */
-@SuppressWarnings(value = { "unchecked" })
-@Component
-public class Localcache {
-
-    private Map<String,Object> persistentCache;
-
-    /**
-     * token认证cache - 会自动过期的map
-     */
-    private Cache<String, Object> tokenCache;
-
-    /**
-     * 防止重复提交
-     */
-    private Cache<String, Object> repeatSubmitCache;
-
-    /**
-     * 验证码服务
-     */
-    private Cache<String, Object> captchaCache;
-
-    @PostConstruct
-    public void init() {
-
-        persistentCache = new ConcurrentHashMap<String, Object>(1024);
-
-        tokenCache = Caffeine.newBuilder()
-                .expireAfterWrite(30, TimeUnit.MINUTES)		//30分钟
-                .initialCapacity(100)
-                .maximumSize(10000)
-                .build();
-
-
-        repeatSubmitCache = Caffeine.newBuilder()
-                .expireAfterWrite(10, TimeUnit.SECONDS)		//10秒
-                .initialCapacity(100)
-                .maximumSize(10000)
-                .build();
-
-        captchaCache = Caffeine.newBuilder()
-                .expireAfterWrite(2, TimeUnit.MINUTES)		//2分钟
-                .initialCapacity(100)
-                .maximumSize(10000)
-                .build();
-    }
-
-    /**
-     * Get方法, 转换结果类型并屏蔽异常, 仅返回Null.
-     */
-    public <T> T get(String key) {
-        try {
-            Object obj = persistentCache.get(key);
-
-            if( null == obj ) {
-                obj = tokenCache.getIfPresent(key);
-            }
-
-            if( null == obj ) {
-                obj = captchaCache.getIfPresent(key);
-            }
-
-            if( null == obj ) {
-                obj = repeatSubmitCache.getIfPresent(key);
-            }
-
-            return (T) obj;
-        } catch (RuntimeException e) {
-
-            return (T)null;
-        }
-    }
-
-    public List<String> keys(String key){
-        List<String> keyList = new ArrayList<String>();
-        List<String> keys = new ArrayList<String>(persistentCache.keySet());
-        for(int i=0;i<keys.size();i++){
-            if(keys.get(i).startsWith(key)){
-                keyList.add(keys.get(i));
-            }
-        }
-        return keyList;
-    }
-
-    /**
-     * 异步Set方法, 不考虑执行结果.
-     * @param key
-     * @param value
-     * @param expiredTime	单位:秒
-     */
-    public void set(String key, Object value, int expiredTime ) {
-        if( 0 == expiredTime ) {
-            persistentCache.put(key,value);
-        }else if( expiredTime <= 60 ) {		//TTL少于1分钟
-            repeatSubmitCache.put(key, value);
-        }else if( expiredTime <= 300 ) {	//TTL少于5分钟
-            captchaCache.put(key, value);
-        }else {
-            tokenCache.put(key, value);
-        }
-    }
-
-
-    /**
-     * 持久化保存
-     * @param key
-     * @param value
-     */
-    public void set(String key, Object value) {
-        try {
-            this.set(key, value, 0 );
-        } catch (Exception e) {
-
-        }
-    }
-
-    /**
-     * 异步 Delete方法, 不考虑执行结果.
-     */
-    public void delete(final String key) {
-        persistentCache.remove(key);
-        captchaCache.invalidate(key);
-        tokenCache.invalidate(key);
-        //防止重复提交和token过期,不存在删除的方法
-    }
-
-    public void delete(final Collection<String> keys) {
-        for( String key : keys ) {
-            delete(key);
-        }
-    }
-
-}
-

+ 268 - 268
cpp-common/src/main/java/com/cpp/common/core/redis/RedisCache.java

@@ -1,268 +1,268 @@
-package com.cpp.common.core.redis;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.BoundSetOperations;
-import org.springframework.data.redis.core.HashOperations;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.data.redis.core.ValueOperations;
-import org.springframework.stereotype.Component;
-
-/**
- * spring redis 工具类
- *
- * @author ruoyi
- **/
-@SuppressWarnings(value = { "unchecked", "rawtypes" })
-@Component
-public class RedisCache
-{
-    @Autowired
-    public RedisTemplate redisTemplate;
-
-    /**
-     * 缓存基本的对象,Integer、String、实体类等
-     *
-     * @param key 缓存的键值
-     * @param value 缓存的值
-     */
-    public <T> void setCacheObject(final String key, final T value)
-    {
-        redisTemplate.opsForValue().set(key, value);
-    }
-
-    /**
-     * 缓存基本的对象,Integer、String、实体类等
-     *
-     * @param key 缓存的键值
-     * @param value 缓存的值
-     * @param timeout 时间
-     * @param timeUnit 时间颗粒度
-     */
-    public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit)
-    {
-        redisTemplate.opsForValue().set(key, value, timeout, timeUnit);
-    }
-
-    /**
-     * 设置有效时间
-     *
-     * @param key Redis键
-     * @param timeout 超时时间
-     * @return true=设置成功;false=设置失败
-     */
-    public boolean expire(final String key, final long timeout)
-    {
-        return expire(key, timeout, TimeUnit.SECONDS);
-    }
-
-    /**
-     * 设置有效时间
-     *
-     * @param key Redis键
-     * @param timeout 超时时间
-     * @param unit 时间单位
-     * @return true=设置成功;false=设置失败
-     */
-    public boolean expire(final String key, final long timeout, final TimeUnit unit)
-    {
-        return redisTemplate.expire(key, timeout, unit);
-    }
-
-    /**
-     * 获取有效时间
-     *
-     * @param key Redis键
-     * @return 有效时间
-     */
-    public long getExpire(final String key)
-    {
-        return redisTemplate.getExpire(key);
-    }
-
-    /**
-     * 判断 key是否存在
-     *
-     * @param key 键
-     * @return true 存在 false不存在
-     */
-    public Boolean hasKey(String key)
-    {
-        return redisTemplate.hasKey(key);
-    }
-
-    /**
-     * 获得缓存的基本对象。
-     *
-     * @param key 缓存键值
-     * @return 缓存键值对应的数据
-     */
-    public <T> T getCacheObject(final String key)
-    {
-        ValueOperations<String, T> operation = redisTemplate.opsForValue();
-        return operation.get(key);
-    }
-
-    /**
-     * 删除单个对象
-     *
-     * @param key
-     */
-    public boolean deleteObject(final String key)
-    {
-        return redisTemplate.delete(key);
-    }
-
-    /**
-     * 删除集合对象
-     *
-     * @param collection 多个对象
-     * @return
-     */
-    public boolean deleteObject(final Collection collection)
-    {
-        return redisTemplate.delete(collection) > 0;
-    }
-
-    /**
-     * 缓存List数据
-     *
-     * @param key 缓存的键值
-     * @param dataList 待缓存的List数据
-     * @return 缓存的对象
-     */
-    public <T> long setCacheList(final String key, final List<T> dataList)
-    {
-        Long count = redisTemplate.opsForList().rightPushAll(key, dataList);
-        return count == null ? 0 : count;
-    }
-
-    /**
-     * 获得缓存的list对象
-     *
-     * @param key 缓存的键值
-     * @return 缓存键值对应的数据
-     */
-    public <T> List<T> getCacheList(final String key)
-    {
-        return redisTemplate.opsForList().range(key, 0, -1);
-    }
-
-    /**
-     * 缓存Set
-     *
-     * @param key 缓存键值
-     * @param dataSet 缓存的数据
-     * @return 缓存数据的对象
-     */
-    public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet)
-    {
-        BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
-        Iterator<T> it = dataSet.iterator();
-        while (it.hasNext())
-        {
-            setOperation.add(it.next());
-        }
-        return setOperation;
-    }
-
-    /**
-     * 获得缓存的set
-     *
-     * @param key
-     * @return
-     */
-    public <T> Set<T> getCacheSet(final String key)
-    {
-        return redisTemplate.opsForSet().members(key);
-    }
-
-    /**
-     * 缓存Map
-     *
-     * @param key
-     * @param dataMap
-     */
-    public <T> void setCacheMap(final String key, final Map<String, T> dataMap)
-    {
-        if (dataMap != null) {
-            redisTemplate.opsForHash().putAll(key, dataMap);
-        }
-    }
-
-    /**
-     * 获得缓存的Map
-     *
-     * @param key
-     * @return
-     */
-    public <T> Map<String, T> getCacheMap(final String key)
-    {
-        return redisTemplate.opsForHash().entries(key);
-    }
-
-    /**
-     * 往Hash中存入数据
-     *
-     * @param key Redis键
-     * @param hKey Hash键
-     * @param value 值
-     */
-    public <T> void setCacheMapValue(final String key, final String hKey, final T value)
-    {
-        redisTemplate.opsForHash().put(key, hKey, value);
-    }
-
-    /**
-     * 获取Hash中的数据
-     *
-     * @param key Redis键
-     * @param hKey Hash键
-     * @return Hash中的对象
-     */
-    public <T> T getCacheMapValue(final String key, final String hKey)
-    {
-        HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash();
-        return opsForHash.get(key, hKey);
-    }
-
-    /**
-     * 获取多个Hash中的数据
-     *
-     * @param key Redis键
-     * @param hKeys Hash键集合
-     * @return Hash对象集合
-     */
-    public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys)
-    {
-        return redisTemplate.opsForHash().multiGet(key, hKeys);
-    }
-
-    /**
-     * 删除Hash中的某条数据
-     *
-     * @param key Redis键
-     * @param hKey Hash键
-     * @return 是否成功
-     */
-    public boolean deleteCacheMapValue(final String key, final String hKey)
-    {
-        return redisTemplate.opsForHash().delete(key, hKey) > 0;
-    }
-
-    /**
-     * 获得缓存的基本对象列表
-     *
-     * @param pattern 字符串前缀
-     * @return 对象列表
-     */
-    public Collection<String> keys(final String pattern)
-    {
-        return redisTemplate.keys(pattern);
-    }
-}
+//package com.cpp.common.core.redis;
+//
+//import java.util.Collection;
+//import java.util.Iterator;
+//import java.util.List;
+//import java.util.Map;
+//import java.util.Set;
+//import java.util.concurrent.TimeUnit;
+////import org.springframework.beans.factory.annotation.Autowired;
+////import org.springframework.data.redis.core.BoundSetOperations;
+////import org.springframework.data.redis.core.HashOperations;
+////import org.springframework.data.redis.core.RedisTemplate;
+////import org.springframework.data.redis.core.ValueOperations;
+////import org.springframework.stereotype.Component;
+//
+///**
+// * spring redis 工具类
+// *
+// * @author ruoyi
+// **/
+//@SuppressWarnings(value = { "unchecked", "rawtypes" })
+////@Component
+//public class RedisCache
+//{
+////    @Autowired
+//    public RedisTemplate redisTemplate;
+//
+//    /**
+//     * 缓存基本的对象,Integer、String、实体类等
+//     *
+//     * @param key 缓存的键值
+//     * @param value 缓存的值
+//     */
+//    public <T> void setCacheObject(final String key, final T value)
+//    {
+//        redisTemplate.opsForValue().set(key, value);
+//    }
+//
+//    /**
+//     * 缓存基本的对象,Integer、String、实体类等
+//     *
+//     * @param key 缓存的键值
+//     * @param value 缓存的值
+//     * @param timeout 时间
+//     * @param timeUnit 时间颗粒度
+//     */
+//    public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit)
+//    {
+//        redisTemplate.opsForValue().set(key, value, timeout, timeUnit);
+//    }
+//
+//    /**
+//     * 设置有效时间
+//     *
+//     * @param key Redis键
+//     * @param timeout 超时时间
+//     * @return true=设置成功;false=设置失败
+//     */
+//    public boolean expire(final String key, final long timeout)
+//    {
+//        return expire(key, timeout, TimeUnit.SECONDS);
+//    }
+//
+//    /**
+//     * 设置有效时间
+//     *
+//     * @param key Redis键
+//     * @param timeout 超时时间
+//     * @param unit 时间单位
+//     * @return true=设置成功;false=设置失败
+//     */
+//    public boolean expire(final String key, final long timeout, final TimeUnit unit)
+//    {
+//        return redisTemplate.expire(key, timeout, unit);
+//    }
+//
+//    /**
+//     * 获取有效时间
+//     *
+//     * @param key Redis键
+//     * @return 有效时间
+//     */
+//    public long getExpire(final String key)
+//    {
+//        return redisTemplate.getExpire(key);
+//    }
+//
+//    /**
+//     * 判断 key是否存在
+//     *
+//     * @param key 键
+//     * @return true 存在 false不存在
+//     */
+//    public Boolean hasKey(String key)
+//    {
+//        return redisTemplate.hasKey(key);
+//    }
+//
+//    /**
+//     * 获得缓存的基本对象。
+//     *
+//     * @param key 缓存键值
+//     * @return 缓存键值对应的数据
+//     */
+//    public <T> T getCacheObject(final String key)
+//    {
+//        ValueOperations<String, T> operation = redisTemplate.opsForValue();
+//        return operation.get(key);
+//    }
+//
+//    /**
+//     * 删除单个对象
+//     *
+//     * @param key
+//     */
+//    public boolean deleteObject(final String key)
+//    {
+//        return redisTemplate.delete(key);
+//    }
+//
+//    /**
+//     * 删除集合对象
+//     *
+//     * @param collection 多个对象
+//     * @return
+//     */
+//    public boolean deleteObject(final Collection collection)
+//    {
+//        return redisTemplate.delete(collection) > 0;
+//    }
+//
+//    /**
+//     * 缓存List数据
+//     *
+//     * @param key 缓存的键值
+//     * @param dataList 待缓存的List数据
+//     * @return 缓存的对象
+//     */
+//    public <T> long setCacheList(final String key, final List<T> dataList)
+//    {
+//        Long count = redisTemplate.opsForList().rightPushAll(key, dataList);
+//        return count == null ? 0 : count;
+//    }
+//
+//    /**
+//     * 获得缓存的list对象
+//     *
+//     * @param key 缓存的键值
+//     * @return 缓存键值对应的数据
+//     */
+//    public <T> List<T> getCacheList(final String key)
+//    {
+//        return redisTemplate.opsForList().range(key, 0, -1);
+//    }
+//
+//    /**
+//     * 缓存Set
+//     *
+//     * @param key 缓存键值
+//     * @param dataSet 缓存的数据
+//     * @return 缓存数据的对象
+//     */
+//    public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet)
+//    {
+//        BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
+//        Iterator<T> it = dataSet.iterator();
+//        while (it.hasNext())
+//        {
+//            setOperation.add(it.next());
+//        }
+//        return setOperation;
+//    }
+//
+//    /**
+//     * 获得缓存的set
+//     *
+//     * @param key
+//     * @return
+//     */
+//    public <T> Set<T> getCacheSet(final String key)
+//    {
+//        return redisTemplate.opsForSet().members(key);
+//    }
+//
+//    /**
+//     * 缓存Map
+//     *
+//     * @param key
+//     * @param dataMap
+//     */
+//    public <T> void setCacheMap(final String key, final Map<String, T> dataMap)
+//    {
+//        if (dataMap != null) {
+//            redisTemplate.opsForHash().putAll(key, dataMap);
+//        }
+//    }
+//
+//    /**
+//     * 获得缓存的Map
+//     *
+//     * @param key
+//     * @return
+//     */
+//    public <T> Map<String, T> getCacheMap(final String key)
+//    {
+//        return redisTemplate.opsForHash().entries(key);
+//    }
+//
+//    /**
+//     * 往Hash中存入数据
+//     *
+//     * @param key Redis键
+//     * @param hKey Hash键
+//     * @param value 值
+//     */
+//    public <T> void setCacheMapValue(final String key, final String hKey, final T value)
+//    {
+//        redisTemplate.opsForHash().put(key, hKey, value);
+//    }
+//
+//    /**
+//     * 获取Hash中的数据
+//     *
+//     * @param key Redis键
+//     * @param hKey Hash键
+//     * @return Hash中的对象
+//     */
+//    public <T> T getCacheMapValue(final String key, final String hKey)
+//    {
+//        HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash();
+//        return opsForHash.get(key, hKey);
+//    }
+//
+//    /**
+//     * 获取多个Hash中的数据
+//     *
+//     * @param key Redis键
+//     * @param hKeys Hash键集合
+//     * @return Hash对象集合
+//     */
+//    public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys)
+//    {
+//        return redisTemplate.opsForHash().multiGet(key, hKeys);
+//    }
+//
+//    /**
+//     * 删除Hash中的某条数据
+//     *
+//     * @param key Redis键
+//     * @param hKey Hash键
+//     * @return 是否成功
+//     */
+//    public boolean deleteCacheMapValue(final String key, final String hKey)
+//    {
+//        return redisTemplate.opsForHash().delete(key, hKey) > 0;
+//    }
+//
+//    /**
+//     * 获得缓存的基本对象列表
+//     *
+//     * @param pattern 字符串前缀
+//     * @return 对象列表
+//     */
+//    public Collection<String> keys(final String pattern)
+//    {
+//        return redisTemplate.keys(pattern);
+//    }
+//}

+ 27 - 7
cpp-common/src/main/java/com/cpp/common/utils/DictUtils.java

@@ -1,12 +1,17 @@
 package com.cpp.common.utils;
 
 import java.util.Collection;
+import java.util.Iterator;
 import java.util.List;
+
+import cn.hutool.json.JSONUtil;
+import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONArray;
 import com.cpp.common.constant.CacheConstants;
+import com.cpp.common.core.cache.LocalCache;
 import com.cpp.common.core.domain.entity.SysDictData;
-import com.cpp.common.core.redis.RedisCache;
-import com.cpp.common.utils.spring.SpringUtils;
+//import com.cpp.common.core.redis.RedisCache;
+//import com.cpp.common.utils.spring.SpringUtils;
 
 /**
  * 字典工具类
@@ -28,7 +33,8 @@ public class DictUtils
      */
     public static void setDictCache(String key, List<SysDictData> dictDatas)
     {
-        SpringUtils.getBean(RedisCache.class).setCacheObject(getCacheKey(key), dictDatas);
+//        SpringUtils.getBean(RedisCache.class).setCacheObject(getCacheKey(key), dictDatas);
+        LocalCache.set(getCacheKey(key), dictDatas,0);
     }
 
     /**
@@ -39,7 +45,12 @@ public class DictUtils
      */
     public static List<SysDictData> getDictCache(String key)
     {
-        JSONArray arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
+//        JSONArray arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
+        JSONArray arrayCache = null;
+        if (LocalCache.get(getCacheKey(key))!=null){
+            arrayCache = JSONArray.parseArray(JSON.toJSONString(LocalCache.get(getCacheKey(key))));
+        }
+
         if (StringUtils.isNotNull(arrayCache))
         {
             return arrayCache.toList(SysDictData.class);
@@ -214,7 +225,8 @@ public class DictUtils
      */
     public static void removeDictCache(String key)
     {
-        SpringUtils.getBean(RedisCache.class).deleteObject(getCacheKey(key));
+//        SpringUtils.getBean(RedisCache.class).deleteObject(getCacheKey(key));
+        LocalCache.remove(getCacheKey(key));
     }
 
     /**
@@ -222,8 +234,16 @@ public class DictUtils
      */
     public static void clearDictCache()
     {
-        Collection<String> keys = SpringUtils.getBean(RedisCache.class).keys(CacheConstants.SYS_DICT_KEY + "*");
-        SpringUtils.getBean(RedisCache.class).deleteObject(keys);
+//        Collection<String> keys = SpringUtils.getBean(RedisCache.class).keys(CacheConstants.SYS_DICT_KEY + "*");
+//        SpringUtils.getBean(RedisCache.class).deleteObject(keys);
+
+        Iterator<String> iterator = LocalCache.keySet().iterator();
+        while (iterator.hasNext()){
+            String str = iterator.next();
+            if (str.contains(CacheConstants.SYS_DICT_KEY)){
+                iterator.remove();
+            }
+        }
     }
 
     /**

+ 89 - 89
cpp-framework/src/main/java/com/cpp/framework/aspectj/RateLimiterAspect.java

@@ -1,89 +1,89 @@
-package com.cpp.framework.aspectj;
-
-import java.lang.reflect.Method;
-import java.util.Collections;
-import java.util.List;
-import org.aspectj.lang.JoinPoint;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.Before;
-import org.aspectj.lang.reflect.MethodSignature;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.data.redis.core.script.RedisScript;
-import org.springframework.stereotype.Component;
-import com.cpp.common.annotation.RateLimiter;
-import com.cpp.common.enums.LimitType;
-import com.cpp.common.exception.ServiceException;
-import com.cpp.common.utils.StringUtils;
-import com.cpp.common.utils.ip.IpUtils;
-
-/**
- * 限流处理
- *
- * @author ruoyi
- */
-@Aspect
-@Component
-public class RateLimiterAspect
-{
-    private static final Logger log = LoggerFactory.getLogger(RateLimiterAspect.class);
-
-    private RedisTemplate<Object, Object> redisTemplate;
-
-    private RedisScript<Long> limitScript;
-
-    @Autowired
-    public void setRedisTemplate1(RedisTemplate<Object, Object> redisTemplate)
-    {
-        this.redisTemplate = redisTemplate;
-    }
-
-    @Autowired
-    public void setLimitScript(RedisScript<Long> limitScript)
-    {
-        this.limitScript = limitScript;
-    }
-
-    @Before("@annotation(rateLimiter)")
-    public void doBefore(JoinPoint point, RateLimiter rateLimiter) throws Throwable
-    {
-        int time = rateLimiter.time();
-        int count = rateLimiter.count();
-
-        String combineKey = getCombineKey(rateLimiter, point);
-        List<Object> keys = Collections.singletonList(combineKey);
-        try
-        {
-            Long number = redisTemplate.execute(limitScript, keys, count, time);
-            if (StringUtils.isNull(number) || number.intValue() > count)
-            {
-                throw new ServiceException("访问过于频繁,请稍候再试");
-            }
-            log.info("限制请求'{}',当前请求'{}',缓存key'{}'", count, number.intValue(), combineKey);
-        }
-        catch (ServiceException e)
-        {
-            throw e;
-        }
-        catch (Exception e)
-        {
-            throw new RuntimeException("服务器限流异常,请稍候再试");
-        }
-    }
-
-    public String getCombineKey(RateLimiter rateLimiter, JoinPoint point)
-    {
-        StringBuffer stringBuffer = new StringBuffer(rateLimiter.key());
-        if (rateLimiter.limitType() == LimitType.IP)
-        {
-            stringBuffer.append(IpUtils.getIpAddr()).append("-");
-        }
-        MethodSignature signature = (MethodSignature) point.getSignature();
-        Method method = signature.getMethod();
-        Class<?> targetClass = method.getDeclaringClass();
-        stringBuffer.append(targetClass.getName()).append("-").append(method.getName());
-        return stringBuffer.toString();
-    }
-}
+//package com.cpp.framework.aspectj;
+//
+//import java.lang.reflect.Method;
+//import java.util.Collections;
+//import java.util.List;
+//import org.aspectj.lang.JoinPoint;
+//import org.aspectj.lang.annotation.Aspect;
+//import org.aspectj.lang.annotation.Before;
+//import org.aspectj.lang.reflect.MethodSignature;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//import org.springframework.beans.factory.annotation.Autowired;
+////import org.springframework.data.redis.core.RedisTemplate;
+////import org.springframework.data.redis.core.script.RedisScript;
+//import org.springframework.stereotype.Component;
+//import com.cpp.common.annotation.RateLimiter;
+//import com.cpp.common.enums.LimitType;
+//import com.cpp.common.exception.ServiceException;
+//import com.cpp.common.utils.StringUtils;
+//import com.cpp.common.utils.ip.IpUtils;
+//
+///**
+// * 限流处理
+// *
+// * @author ruoyi
+// */
+////@Aspect
+////@Component
+//public class RateLimiterAspect
+//{
+//    private static final Logger log = LoggerFactory.getLogger(RateLimiterAspect.class);
+//
+//    private RedisTemplate<Object, Object> redisTemplate;
+//
+//    private RedisScript<Long> limitScript;
+//
+////    @Autowired
+//    public void setRedisTemplate1(RedisTemplate<Object, Object> redisTemplate)
+//    {
+//        this.redisTemplate = redisTemplate;
+//    }
+//
+////    @Autowired
+//    public void setLimitScript(RedisScript<Long> limitScript)
+//    {
+//        this.limitScript = limitScript;
+//    }
+//
+////    @Before("@annotation(rateLimiter)")
+//    public void doBefore(JoinPoint point, RateLimiter rateLimiter) throws Throwable
+//    {
+//        int time = rateLimiter.time();
+//        int count = rateLimiter.count();
+//
+//        String combineKey = getCombineKey(rateLimiter, point);
+//        List<Object> keys = Collections.singletonList(combineKey);
+//        try
+//        {
+//            Long number = redisTemplate.execute(limitScript, keys, count, time);
+//            if (StringUtils.isNull(number) || number.intValue() > count)
+//            {
+//                throw new ServiceException("访问过于频繁,请稍候再试");
+//            }
+//            log.info("限制请求'{}',当前请求'{}',缓存key'{}'", count, number.intValue(), combineKey);
+//        }
+//        catch (ServiceException e)
+//        {
+//            throw e;
+//        }
+//        catch (Exception e)
+//        {
+//            throw new RuntimeException("服务器限流异常,请稍候再试");
+//        }
+//    }
+//
+//    public String getCombineKey(RateLimiter rateLimiter, JoinPoint point)
+//    {
+//        StringBuffer stringBuffer = new StringBuffer(rateLimiter.key());
+//        if (rateLimiter.limitType() == LimitType.IP)
+//        {
+//            stringBuffer.append(IpUtils.getIpAddr()).append("-");
+//        }
+//        MethodSignature signature = (MethodSignature) point.getSignature();
+//        Method method = signature.getMethod();
+//        Class<?> targetClass = method.getDeclaringClass();
+//        stringBuffer.append(targetClass.getName()).append("-").append(method.getName());
+//        return stringBuffer.toString();
+//    }
+//}

+ 52 - 52
cpp-framework/src/main/java/com/cpp/framework/config/FastJson2JsonRedisSerializer.java

@@ -1,52 +1,52 @@
-package com.cpp.framework.config;
-
-import java.nio.charset.Charset;
-import org.springframework.data.redis.serializer.RedisSerializer;
-import org.springframework.data.redis.serializer.SerializationException;
-import com.alibaba.fastjson2.JSON;
-import com.alibaba.fastjson2.JSONReader;
-import com.alibaba.fastjson2.JSONWriter;
-import com.alibaba.fastjson2.filter.Filter;
-import com.cpp.common.constant.Constants;
-
-/**
- * Redis使用FastJson序列化
- *
- * @author ruoyi
- */
-public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T>
-{
-    public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
-
-    static final Filter AUTO_TYPE_FILTER = JSONReader.autoTypeFilter(Constants.JSON_WHITELIST_STR);
-
-    private Class<T> clazz;
-
-    public FastJson2JsonRedisSerializer(Class<T> clazz)
-    {
-        super();
-        this.clazz = clazz;
-    }
-
-    @Override
-    public byte[] serialize(T t) throws SerializationException
-    {
-        if (t == null)
-        {
-            return new byte[0];
-        }
-        return JSON.toJSONString(t, JSONWriter.Feature.WriteClassName).getBytes(DEFAULT_CHARSET);
-    }
-
-    @Override
-    public T deserialize(byte[] bytes) throws SerializationException
-    {
-        if (bytes == null || bytes.length <= 0)
-        {
-            return null;
-        }
-        String str = new String(bytes, DEFAULT_CHARSET);
-
-        return JSON.parseObject(str, clazz, AUTO_TYPE_FILTER);
-    }
-}
+//package com.cpp.framework.config;
+//
+//import java.nio.charset.Charset;
+////import org.springframework.data.redis.serializer.RedisSerializer;
+////import org.springframework.data.redis.serializer.SerializationException;
+//import com.alibaba.fastjson2.JSON;
+//import com.alibaba.fastjson2.JSONReader;
+//import com.alibaba.fastjson2.JSONWriter;
+//import com.alibaba.fastjson2.filter.Filter;
+//import com.cpp.common.constant.Constants;
+//
+///**
+// * Redis使用FastJson序列化
+// *
+// * @author ruoyi
+// */
+//public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T>
+//{
+//    public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
+//
+//    static final Filter AUTO_TYPE_FILTER = JSONReader.autoTypeFilter(Constants.JSON_WHITELIST_STR);
+//
+//    private Class<T> clazz;
+//
+//    public FastJson2JsonRedisSerializer(Class<T> clazz)
+//    {
+//        super();
+//        this.clazz = clazz;
+//    }
+//
+//    @Override
+//    public byte[] serialize(T t) throws SerializationException
+//    {
+//        if (t == null)
+//        {
+//            return new byte[0];
+//        }
+//        return JSON.toJSONString(t, JSONWriter.Feature.WriteClassName).getBytes(DEFAULT_CHARSET);
+//    }
+//
+//    @Override
+//    public T deserialize(byte[] bytes) throws SerializationException
+//    {
+//        if (bytes == null || bytes.length <= 0)
+//        {
+//            return null;
+//        }
+//        String str = new String(bytes, DEFAULT_CHARSET);
+//
+//        return JSON.parseObject(str, clazz, AUTO_TYPE_FILTER);
+//    }
+//}

+ 69 - 69
cpp-framework/src/main/java/com/cpp/framework/config/RedisConfig.java

@@ -1,69 +1,69 @@
-package com.cpp.framework.config;
-
-import org.springframework.cache.annotation.CachingConfigurerSupport;
-import org.springframework.cache.annotation.EnableCaching;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.data.redis.connection.RedisConnectionFactory;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.data.redis.core.script.DefaultRedisScript;
-import org.springframework.data.redis.serializer.StringRedisSerializer;
-
-/**
- * redis配置
- *
- * @author ruoyi
- */
-@Configuration
-@EnableCaching
-public class RedisConfig extends CachingConfigurerSupport
-{
-    @Bean
-    @SuppressWarnings(value = { "unchecked", "rawtypes" })
-    public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory)
-    {
-        RedisTemplate<Object, Object> template = new RedisTemplate<>();
-        template.setConnectionFactory(connectionFactory);
-
-        FastJson2JsonRedisSerializer serializer = new FastJson2JsonRedisSerializer(Object.class);
-
-        // 使用StringRedisSerializer来序列化和反序列化redis的key值
-        template.setKeySerializer(new StringRedisSerializer());
-        template.setValueSerializer(serializer);
-
-        // Hash的key也采用StringRedisSerializer的序列化方式
-        template.setHashKeySerializer(new StringRedisSerializer());
-        template.setHashValueSerializer(serializer);
-
-        template.afterPropertiesSet();
-        return template;
-    }
-
-    @Bean
-    public DefaultRedisScript<Long> limitScript()
-    {
-        DefaultRedisScript<Long> redisScript = new DefaultRedisScript<>();
-        redisScript.setScriptText(limitScriptText());
-        redisScript.setResultType(Long.class);
-        return redisScript;
-    }
-
-    /**
-     * 限流脚本
-     */
-    private String limitScriptText()
-    {
-        return "local key = KEYS[1]\n" +
-                "local count = tonumber(ARGV[1])\n" +
-                "local time = tonumber(ARGV[2])\n" +
-                "local current = redis.call('get', key);\n" +
-                "if current and tonumber(current) > count then\n" +
-                "    return tonumber(current);\n" +
-                "end\n" +
-                "current = redis.call('incr', key)\n" +
-                "if tonumber(current) == 1 then\n" +
-                "    redis.call('expire', key, time)\n" +
-                "end\n" +
-                "return tonumber(current);";
-    }
-}
+//package com.cpp.framework.config;
+//
+//import org.springframework.cache.annotation.CachingConfigurerSupport;
+//import org.springframework.cache.annotation.EnableCaching;
+//import org.springframework.context.annotation.Bean;
+//import org.springframework.context.annotation.Configuration;
+////import org.springframework.data.redis.connection.RedisConnectionFactory;
+////import org.springframework.data.redis.core.RedisTemplate;
+////import org.springframework.data.redis.core.script.DefaultRedisScript;
+////import org.springframework.data.redis.serializer.StringRedisSerializer;
+//
+///**
+// * redis配置
+// *
+// * @author ruoyi
+// */
+////@Configuration
+////@EnableCaching
+//public class RedisConfig extends CachingConfigurerSupport
+//{
+////    @Bean
+//    @SuppressWarnings(value = { "unchecked", "rawtypes" })
+//    public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory)
+//    {
+//        RedisTemplate<Object, Object> template = new RedisTemplate<>();
+//        template.setConnectionFactory(connectionFactory);
+//
+//        FastJson2JsonRedisSerializer serializer = new FastJson2JsonRedisSerializer(Object.class);
+//
+//        // 使用StringRedisSerializer来序列化和反序列化redis的key值
+//        template.setKeySerializer(new StringRedisSerializer());
+//        template.setValueSerializer(serializer);
+//
+//        // Hash的key也采用StringRedisSerializer的序列化方式
+//        template.setHashKeySerializer(new StringRedisSerializer());
+//        template.setHashValueSerializer(serializer);
+//
+//        template.afterPropertiesSet();
+//        return template;
+//    }
+//
+////    @Bean
+//    public DefaultRedisScript<Long> limitScript()
+//    {
+//        DefaultRedisScript<Long> redisScript = new DefaultRedisScript<>();
+//        redisScript.setScriptText(limitScriptText());
+//        redisScript.setResultType(Long.class);
+//        return redisScript;
+//    }
+//
+//    /**
+//     * 限流脚本
+//     */
+//    private String limitScriptText()
+//    {
+//        return "local key = KEYS[1]\n" +
+//                "local count = tonumber(ARGV[1])\n" +
+//                "local time = tonumber(ARGV[2])\n" +
+//                "local current = redis.call('get', key);\n" +
+//                "if current and tonumber(current) > count then\n" +
+//                "    return tonumber(current);\n" +
+//                "end\n" +
+//                "current = redis.call('incr', key)\n" +
+//                "if tonumber(current) == 1 then\n" +
+//                "    redis.call('expire', key, time)\n" +
+//                "end\n" +
+//                "return tonumber(current);";
+//    }
+//}

+ 10 - 5
cpp-framework/src/main/java/com/cpp/framework/interceptor/impl/SameUrlDataInterceptor.java

@@ -4,13 +4,15 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 import javax.servlet.http.HttpServletRequest;
+
+import com.cpp.common.core.cache.LocalCache;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 import com.alibaba.fastjson2.JSON;
 import com.cpp.common.annotation.RepeatSubmit;
 import com.cpp.common.constant.CacheConstants;
-import com.cpp.common.core.redis.RedisCache;
+//import com.cpp.common.core.redis.RedisCache;
 import com.cpp.common.filter.RepeatedlyRequestWrapper;
 import com.cpp.common.utils.StringUtils;
 import com.cpp.common.utils.http.HttpHelper;
@@ -33,8 +35,8 @@ public class SameUrlDataInterceptor extends RepeatSubmitInterceptor
     @Value("${token.header}")
     private String header;
 
-    @Autowired
-    private RedisCache redisCache;
+//    @Autowired
+//    private RedisCache redisCache;
 
     @SuppressWarnings("unchecked")
     @Override
@@ -64,8 +66,11 @@ public class SameUrlDataInterceptor extends RepeatSubmitInterceptor
 
         // 唯一标识(指定key + url + 消息头)
         String cacheRepeatKey = CacheConstants.REPEAT_SUBMIT_KEY + url + submitKey;
+        Object sessionObj = null;
+        if (LocalCache.get(cacheRepeatKey)!=null){
+            sessionObj = LocalCache.get(cacheRepeatKey);
+        }
 
-        Object sessionObj = redisCache.getCacheObject(cacheRepeatKey);
         if (sessionObj != null)
         {
             Map<String, Object> sessionMap = (Map<String, Object>) sessionObj;
@@ -80,7 +85,7 @@ public class SameUrlDataInterceptor extends RepeatSubmitInterceptor
         }
         Map<String, Object> cacheMap = new HashMap<String, Object>();
         cacheMap.put(url, nowDataMap);
-        redisCache.setCacheObject(cacheRepeatKey, cacheMap, annotation.interval(), TimeUnit.MILLISECONDS);
+        LocalCache.set(cacheRepeatKey, cacheMap, annotation.interval() * 1000);
         return false;
     }
 

+ 13 - 5
cpp-framework/src/main/java/com/cpp/framework/web/service/SysLoginService.java

@@ -1,6 +1,8 @@
 package com.cpp.framework.web.service;
 
 import javax.annotation.Resource;
+
+import com.cpp.common.core.cache.LocalCache;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.authentication.AuthenticationManager;
 import org.springframework.security.authentication.BadCredentialsException;
@@ -12,7 +14,7 @@ import com.cpp.common.constant.Constants;
 import com.cpp.common.constant.UserConstants;
 import com.cpp.common.core.domain.entity.SysUser;
 import com.cpp.common.core.domain.model.LoginUser;
-import com.cpp.common.core.redis.RedisCache;
+//import com.cpp.common.core.redis.RedisCache;
 import com.cpp.common.exception.ServiceException;
 import com.cpp.common.exception.user.BlackListException;
 import com.cpp.common.exception.user.CaptchaException;
@@ -43,8 +45,8 @@ public class SysLoginService
     @Resource
     private AuthenticationManager authenticationManager;
 
-    @Autowired
-    private RedisCache redisCache;
+//    @Autowired
+//    private Localcache localcache;
 
     @Autowired
     private ISysUserService userService;
@@ -114,13 +116,19 @@ public class SysLoginService
         if (captchaEnabled)
         {
             String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, "");
-            String captcha = redisCache.getCacheObject(verifyKey);
+//            String captcha = redisCache.getCacheObject(verifyKey);
+            String captcha = null;
+            if (LocalCache.get(verifyKey)!=null){
+                captcha = LocalCache.get(verifyKey).toString();
+            }
+
             if (captcha == null)
             {
                 AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire")));
                 throw new CaptchaExpireException();
             }
-            redisCache.deleteObject(verifyKey);
+//            redisCache.deleteObject(verifyKey);
+            LocalCache.remove(verifyKey);
             if (!code.equalsIgnoreCase(captcha))
             {
                 AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")));

+ 22 - 9
cpp-framework/src/main/java/com/cpp/framework/web/service/SysPasswordService.java

@@ -1,13 +1,16 @@
 package com.cpp.framework.web.service;
 
+import java.util.Iterator;
 import java.util.concurrent.TimeUnit;
+
+import com.cpp.common.core.cache.LocalCache;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.security.core.Authentication;
 import org.springframework.stereotype.Component;
 import com.cpp.common.constant.CacheConstants;
 import com.cpp.common.core.domain.entity.SysUser;
-import com.cpp.common.core.redis.RedisCache;
+//import com.cpp.common.core.redis.RedisCache;
 import com.cpp.common.exception.user.UserPasswordNotMatchException;
 import com.cpp.common.exception.user.UserPasswordRetryLimitExceedException;
 import com.cpp.common.utils.SecurityUtils;
@@ -21,8 +24,8 @@ import com.cpp.framework.security.context.AuthenticationContextHolder;
 @Component
 public class SysPasswordService
 {
-    @Autowired
-    private RedisCache redisCache;
+//    @Autowired
+//    private RedisCache redisCache;
 
     @Value(value = "${user.password.maxRetryCount}")
     private int maxRetryCount;
@@ -46,8 +49,10 @@ public class SysPasswordService
         Authentication usernamePasswordAuthenticationToken = AuthenticationContextHolder.getContext();
         String username = usernamePasswordAuthenticationToken.getName();
         String password = usernamePasswordAuthenticationToken.getCredentials().toString();
-
-        Integer retryCount = redisCache.getCacheObject(getCacheKey(username));
+        Integer retryCount = null;
+        if (LocalCache.get(getCacheKey(username))!=null){
+            retryCount = Integer.parseInt(LocalCache.get(getCacheKey(username)).toString());
+        }
 
         if (retryCount == null)
         {
@@ -62,7 +67,7 @@ public class SysPasswordService
         if (!matches(user, password))
         {
             retryCount = retryCount + 1;
-            redisCache.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
+            LocalCache.set(getCacheKey(username), retryCount, lockTime * 1000 * 60);
             throw new UserPasswordNotMatchException();
         }
         else
@@ -78,9 +83,17 @@ public class SysPasswordService
 
     public void clearLoginRecordCache(String loginName)
     {
-        if (redisCache.hasKey(getCacheKey(loginName)))
-        {
-            redisCache.deleteObject(getCacheKey(loginName));
+//        if (redisCache.hasKey(getCacheKey(loginName)))
+//        {
+//            redisCache.deleteObject(getCacheKey(loginName));
+//        }
+
+        Iterator<String> iterator = LocalCache.keySet().iterator();
+        while (iterator.hasNext()){
+            String str = iterator.next();
+            if (str.contains(getCacheKey(loginName))){
+                iterator.remove();
+            }
         }
     }
 }

+ 10 - 5
cpp-framework/src/main/java/com/cpp/framework/web/service/SysRegisterService.java

@@ -1,5 +1,6 @@
 package com.cpp.framework.web.service;
 
+import com.cpp.common.core.cache.LocalCache;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import com.cpp.common.constant.CacheConstants;
@@ -7,7 +8,7 @@ import com.cpp.common.constant.Constants;
 import com.cpp.common.constant.UserConstants;
 import com.cpp.common.core.domain.entity.SysUser;
 import com.cpp.common.core.domain.model.RegisterBody;
-import com.cpp.common.core.redis.RedisCache;
+//import com.cpp.common.core.redis.RedisCache;
 import com.cpp.common.exception.user.CaptchaException;
 import com.cpp.common.exception.user.CaptchaExpireException;
 import com.cpp.common.utils.MessageUtils;
@@ -32,8 +33,8 @@ public class SysRegisterService
     @Autowired
     private ISysConfigService configService;
 
-    @Autowired
-    private RedisCache redisCache;
+//    @Autowired
+//    private RedisCache redisCache;
 
     /**
      * 注册
@@ -101,8 +102,12 @@ public class SysRegisterService
     public void validateCaptcha(String username, String code, String uuid)
     {
         String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, "");
-        String captcha = redisCache.getCacheObject(verifyKey);
-        redisCache.deleteObject(verifyKey);
+        String captcha = null;
+        if (LocalCache.get(verifyKey)!=null){
+            captcha = LocalCache.get(verifyKey).toString();
+        }
+
+        LocalCache.remove(verifyKey);
         if (captcha == null)
         {
             throw new CaptchaExpireException();

+ 8 - 6
cpp-framework/src/main/java/com/cpp/framework/web/service/TokenService.java

@@ -4,6 +4,8 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 import javax.servlet.http.HttpServletRequest;
+
+import com.cpp.common.core.cache.LocalCache;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -12,7 +14,7 @@ import org.springframework.stereotype.Component;
 import com.cpp.common.constant.CacheConstants;
 import com.cpp.common.constant.Constants;
 import com.cpp.common.core.domain.model.LoginUser;
-import com.cpp.common.core.redis.RedisCache;
+//import com.cpp.common.core.redis.RedisCache;
 import com.cpp.common.utils.ServletUtils;
 import com.cpp.common.utils.StringUtils;
 import com.cpp.common.utils.ip.AddressUtils;
@@ -51,8 +53,8 @@ public class TokenService
 
     private static final Long MILLIS_MINUTE_TEN = 20 * 60 * 1000L;
 
-    @Autowired
-    private RedisCache redisCache;
+//    @Autowired
+//    private RedisCache redisCache;
 
     /**
      * 获取用户身份信息
@@ -71,7 +73,7 @@ public class TokenService
                 // 解析对应的权限以及用户信息
                 String uuid = (String) claims.get(Constants.LOGIN_USER_KEY);
                 String userKey = getTokenKey(uuid);
-                LoginUser user = redisCache.getCacheObject(userKey);
+                LoginUser user = (LoginUser)LocalCache.get(userKey);
                 return user;
             }
             catch (Exception e)
@@ -101,7 +103,7 @@ public class TokenService
         if (StringUtils.isNotEmpty(token))
         {
             String userKey = getTokenKey(token);
-            redisCache.deleteObject(userKey);
+            LocalCache.remove(userKey);
         }
     }
 
@@ -150,7 +152,7 @@ public class TokenService
         loginUser.setExpireTime(loginUser.getLoginTime() + expireTime * MILLIS_MINUTE);
         // 根据uuid将loginUser缓存
         String userKey = getTokenKey(loginUser.getToken());
-        redisCache.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES);
+        LocalCache.set(userKey, loginUser, expireTime * 1000 * 60);
     }
 
     /**

+ 27 - 12
cpp-system/src/main/java/com/cpp/system/service/impl/SysConfigServiceImpl.java

@@ -1,14 +1,17 @@
 package com.cpp.system.service.impl;
 
 import java.util.Collection;
+import java.util.Iterator;
 import java.util.List;
 import javax.annotation.PostConstruct;
+
+import com.cpp.common.core.cache.LocalCache;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.cpp.common.annotation.DataSource;
 import com.cpp.common.constant.CacheConstants;
 import com.cpp.common.constant.UserConstants;
-import com.cpp.common.core.redis.RedisCache;
+//import com.cpp.common.core.redis.RedisCache;
 import com.cpp.common.core.text.Convert;
 import com.cpp.common.enums.DataSourceType;
 import com.cpp.common.exception.ServiceException;
@@ -28,8 +31,8 @@ public class SysConfigServiceImpl implements ISysConfigService
     @Autowired
     private SysConfigMapper configMapper;
 
-    @Autowired
-    private RedisCache redisCache;
+//    @Autowired
+//    private RedisCache redisCache;
 
     /**
      * 项目启动时,初始化参数到缓存
@@ -64,7 +67,11 @@ public class SysConfigServiceImpl implements ISysConfigService
     @Override
     public String selectConfigByKey(String configKey)
     {
-        String configValue = Convert.toStr(redisCache.getCacheObject(getCacheKey(configKey)));
+        String configValue = null;
+        if (LocalCache.get(getCacheKey(configKey))!=null){
+            configValue = Convert.toStr(LocalCache.get(getCacheKey(configKey)));
+        }
+
         if (StringUtils.isNotEmpty(configValue))
         {
             return configValue;
@@ -74,7 +81,7 @@ public class SysConfigServiceImpl implements ISysConfigService
         SysConfig retConfig = configMapper.selectConfig(config);
         if (StringUtils.isNotNull(retConfig))
         {
-            redisCache.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue());
+            LocalCache.set(getCacheKey(configKey), retConfig.getConfigValue(),0);
             return retConfig.getConfigValue();
         }
         return StringUtils.EMPTY;
@@ -120,7 +127,7 @@ public class SysConfigServiceImpl implements ISysConfigService
         int row = configMapper.insertConfig(config);
         if (row > 0)
         {
-            redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
+            LocalCache.set(getCacheKey(config.getConfigKey()), config.getConfigValue(),0);
         }
         return row;
     }
@@ -137,13 +144,13 @@ public class SysConfigServiceImpl implements ISysConfigService
         SysConfig temp = configMapper.selectConfigById(config.getConfigId());
         if (!StringUtils.equals(temp.getConfigKey(), config.getConfigKey()))
         {
-            redisCache.deleteObject(getCacheKey(temp.getConfigKey()));
+            LocalCache.remove(getCacheKey(temp.getConfigKey()));
         }
 
         int row = configMapper.updateConfig(config);
         if (row > 0)
         {
-            redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
+            LocalCache.set(getCacheKey(config.getConfigKey()), config.getConfigValue(),0);
         }
         return row;
     }
@@ -164,7 +171,7 @@ public class SysConfigServiceImpl implements ISysConfigService
                 throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
             }
             configMapper.deleteConfigById(configId);
-            redisCache.deleteObject(getCacheKey(config.getConfigKey()));
+            LocalCache.remove(getCacheKey(config.getConfigKey()));
         }
     }
 
@@ -177,7 +184,7 @@ public class SysConfigServiceImpl implements ISysConfigService
         List<SysConfig> configsList = configMapper.selectConfigList(new SysConfig());
         for (SysConfig config : configsList)
         {
-            redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
+            LocalCache.set(getCacheKey(config.getConfigKey()), config.getConfigValue(),0);
         }
     }
 
@@ -187,8 +194,16 @@ public class SysConfigServiceImpl implements ISysConfigService
     @Override
     public void clearConfigCache()
     {
-        Collection<String> keys = redisCache.keys(CacheConstants.SYS_CONFIG_KEY + "*");
-        redisCache.deleteObject(keys);
+//        Collection<String> keys = redisCache.keys(CacheConstants.SYS_CONFIG_KEY + "*");
+//        redisCache.deleteObject(keys);
+
+        Iterator<String> iterator = LocalCache.keySet().iterator();
+        while (iterator.hasNext()){
+            String str = iterator.next();
+            if (str.contains(CacheConstants.SYS_CONFIG_KEY)){
+                iterator.remove();
+            }
+        }
     }
 
     /**

+ 22 - 0
cpp-ui/.editorconfig

@@ -0,0 +1,22 @@
+# 告诉EditorConfig插件,这是根文件,不用继续往上查找
+root = true
+
+# 匹配全部文件
+[*]
+# 设置字符集
+charset = utf-8
+# 缩进风格,可选space、tab
+indent_style = space
+# 缩进的空格数
+indent_size = 2
+# 结尾换行符,可选lf、cr、crlf
+end_of_line = lf
+# 在文件结尾插入新行
+insert_final_newline = true
+# 删除一行中的前后空格
+trim_trailing_whitespace = true
+
+# 匹配md结尾的文件
+[*.md]
+insert_final_newline = false
+trim_trailing_whitespace = false

+ 11 - 0
cpp-ui/.env.development

@@ -0,0 +1,11 @@
+# 页面标题
+VUE_APP_TITLE = 若依管理系统
+
+# 开发环境配置
+ENV = 'development'
+
+# 若依管理系统/开发环境
+VUE_APP_BASE_API = '/dev-api'
+
+# 路由懒加载
+VUE_CLI_BABEL_TRANSPILE_MODULES = true

+ 8 - 0
cpp-ui/.env.production

@@ -0,0 +1,8 @@
+# 页面标题
+VUE_APP_TITLE = 若依管理系统
+
+# 生产环境配置
+ENV = 'production'
+
+# 若依管理系统/生产环境
+VUE_APP_BASE_API = '/prod-api'

+ 10 - 0
cpp-ui/.env.staging

@@ -0,0 +1,10 @@
+# 页面标题
+VUE_APP_TITLE = 若依管理系统
+
+NODE_ENV = production
+
+# 测试环境配置
+ENV = 'staging'
+
+# 若依管理系统/测试环境
+VUE_APP_BASE_API = '/stage-api'

+ 10 - 0
cpp-ui/.eslintignore

@@ -0,0 +1,10 @@
+# 忽略build目录下类型为js的文件的语法检查
+build/*.js
+# 忽略src/assets目录下文件的语法检查
+src/assets
+# 忽略public目录下文件的语法检查
+public
+# 忽略当前目录下为js的文件的语法检查
+*.js
+# 忽略当前目录下为vue的文件的语法检查
+*.vue

+ 199 - 0
cpp-ui/.eslintrc.js

@@ -0,0 +1,199 @@
+// ESlint 检查配置
+module.exports = {
+  root: true,
+  parserOptions: {
+    parser: 'babel-eslint',
+    sourceType: 'module'
+  },
+  env: {
+    browser: true,
+    node: true,
+    es6: true,
+  },
+  extends: ['plugin:vue/recommended', 'eslint:recommended'],
+
+  // add your custom rules here
+  //it is base on https://github.com/vuejs/eslint-config-vue
+  rules: {
+    "vue/max-attributes-per-line": [2, {
+      "singleline": 10,
+      "multiline": {
+        "max": 1,
+        "allowFirstLine": false
+      }
+    }],
+    "vue/singleline-html-element-content-newline": "off",
+    "vue/multiline-html-element-content-newline":"off",
+    "vue/name-property-casing": ["error", "PascalCase"],
+    "vue/no-v-html": "off",
+    'accessor-pairs': 2,
+    'arrow-spacing': [2, {
+      'before': true,
+      'after': true
+    }],
+    'block-spacing': [2, 'always'],
+    'brace-style': [2, '1tbs', {
+      'allowSingleLine': true
+    }],
+    'camelcase': [0, {
+      'properties': 'always'
+    }],
+    'comma-dangle': [2, 'never'],
+    'comma-spacing': [2, {
+      'before': false,
+      'after': true
+    }],
+    'comma-style': [2, 'last'],
+    'constructor-super': 2,
+    'curly': [2, 'multi-line'],
+    'dot-location': [2, 'property'],
+    'eol-last': 2,
+    'eqeqeq': ["error", "always", {"null": "ignore"}],
+    'generator-star-spacing': [2, {
+      'before': true,
+      'after': true
+    }],
+    'handle-callback-err': [2, '^(err|error)$'],
+    'indent': [2, 2, {
+      'SwitchCase': 1
+    }],
+    'jsx-quotes': [2, 'prefer-single'],
+    'key-spacing': [2, {
+      'beforeColon': false,
+      'afterColon': true
+    }],
+    'keyword-spacing': [2, {
+      'before': true,
+      'after': true
+    }],
+    'new-cap': [2, {
+      'newIsCap': true,
+      'capIsNew': false
+    }],
+    'new-parens': 2,
+    'no-array-constructor': 2,
+    'no-caller': 2,
+    'no-console': 'off',
+    'no-class-assign': 2,
+    'no-cond-assign': 2,
+    'no-const-assign': 2,
+    'no-control-regex': 0,
+    'no-delete-var': 2,
+    'no-dupe-args': 2,
+    'no-dupe-class-members': 2,
+    'no-dupe-keys': 2,
+    'no-duplicate-case': 2,
+    'no-empty-character-class': 2,
+    'no-empty-pattern': 2,
+    'no-eval': 2,
+    'no-ex-assign': 2,
+    'no-extend-native': 2,
+    'no-extra-bind': 2,
+    'no-extra-boolean-cast': 2,
+    'no-extra-parens': [2, 'functions'],
+    'no-fallthrough': 2,
+    'no-floating-decimal': 2,
+    'no-func-assign': 2,
+    'no-implied-eval': 2,
+    'no-inner-declarations': [2, 'functions'],
+    'no-invalid-regexp': 2,
+    'no-irregular-whitespace': 2,
+    'no-iterator': 2,
+    'no-label-var': 2,
+    'no-labels': [2, {
+      'allowLoop': false,
+      'allowSwitch': false
+    }],
+    'no-lone-blocks': 2,
+    'no-mixed-spaces-and-tabs': 2,
+    'no-multi-spaces': 2,
+    'no-multi-str': 2,
+    'no-multiple-empty-lines': [2, {
+      'max': 1
+    }],
+    'no-native-reassign': 2,
+    'no-negated-in-lhs': 2,
+    'no-new-object': 2,
+    'no-new-require': 2,
+    'no-new-symbol': 2,
+    'no-new-wrappers': 2,
+    'no-obj-calls': 2,
+    'no-octal': 2,
+    'no-octal-escape': 2,
+    'no-path-concat': 2,
+    'no-proto': 2,
+    'no-redeclare': 2,
+    'no-regex-spaces': 2,
+    'no-return-assign': [2, 'except-parens'],
+    'no-self-assign': 2,
+    'no-self-compare': 2,
+    'no-sequences': 2,
+    'no-shadow-restricted-names': 2,
+    'no-spaced-func': 2,
+    'no-sparse-arrays': 2,
+    'no-this-before-super': 2,
+    'no-throw-literal': 2,
+    'no-trailing-spaces': 2,
+    'no-undef': 2,
+    'no-undef-init': 2,
+    'no-unexpected-multiline': 2,
+    'no-unmodified-loop-condition': 2,
+    'no-unneeded-ternary': [2, {
+      'defaultAssignment': false
+    }],
+    'no-unreachable': 2,
+    'no-unsafe-finally': 2,
+    'no-unused-vars': [2, {
+      'vars': 'all',
+      'args': 'none'
+    }],
+    'no-useless-call': 2,
+    'no-useless-computed-key': 2,
+    'no-useless-constructor': 2,
+    'no-useless-escape': 0,
+    'no-whitespace-before-property': 2,
+    'no-with': 2,
+    'one-var': [2, {
+      'initialized': 'never'
+    }],
+    'operator-linebreak': [2, 'after', {
+      'overrides': {
+        '?': 'before',
+        ':': 'before'
+      }
+    }],
+    'padded-blocks': [2, 'never'],
+    'quotes': [2, 'single', {
+      'avoidEscape': true,
+      'allowTemplateLiterals': true
+    }],
+    'semi': [2, 'never'],
+    'semi-spacing': [2, {
+      'before': false,
+      'after': true
+    }],
+    'space-before-blocks': [2, 'always'],
+    'space-before-function-paren': [2, 'never'],
+    'space-in-parens': [2, 'never'],
+    'space-infix-ops': 2,
+    'space-unary-ops': [2, {
+      'words': true,
+      'nonwords': false
+    }],
+    'spaced-comment': [2, 'always', {
+      'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']
+    }],
+    'template-curly-spacing': [2, 'never'],
+    'use-isnan': 2,
+    'valid-typeof': 2,
+    'wrap-iife': [2, 'any'],
+    'yield-star-spacing': [2, 'both'],
+    'yoda': [2, 'never'],
+    'prefer-const': 2,
+    'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
+    'object-curly-spacing': [2, 'always', {
+      objectsInObjects: false
+    }],
+    'array-bracket-spacing': [2, 'never']
+  }
+}

+ 23 - 0
cpp-ui/.gitignore

@@ -0,0 +1,23 @@
+.DS_Store
+node_modules/
+dist/
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+**/*.log
+
+tests/**/coverage/
+tests/e2e/reports
+selenium-debug.log
+
+# Editor directories and files
+.idea
+.vscode
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.local
+
+package-lock.json
+yarn.lock

+ 30 - 0
cpp-ui/README.md

@@ -0,0 +1,30 @@
+## 开发
+
+```bash
+# 克隆项目
+git clone https://gitee.com/y_project/RuoYi-Vue
+
+# 进入项目目录
+cd ruoyi-ui
+
+# 安装依赖
+npm install
+
+# 建议不要直接使用 cnpm 安装依赖,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题
+npm install --registry=https://registry.npmmirror.com
+
+# 启动服务
+npm run dev
+```
+
+浏览器访问 http://localhost:80
+
+## 发布
+
+```bash
+# 构建测试环境
+npm run build:stage
+
+# 构建生产环境
+npm run build:prod
+```

+ 13 - 0
cpp-ui/babel.config.js

@@ -0,0 +1,13 @@
+module.exports = {
+  presets: [
+    // https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app
+    '@vue/cli-plugin-babel/preset'
+  ],
+  'env': {
+    'development': {
+      // babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require().
+      // This plugin can significantly increase the speed of hot updates, when you have a large number of pages.
+      'plugins': ['dynamic-import-node']
+    }
+  }
+}

+ 12 - 0
cpp-ui/bin/build.bat

@@ -0,0 +1,12 @@
+@echo off
+echo.
+echo [信息] 打包Web工程,生成dist文件。
+echo.
+
+%~d0
+cd %~dp0
+
+cd ..
+npm run build:prod
+
+pause

+ 12 - 0
cpp-ui/bin/package.bat

@@ -0,0 +1,12 @@
+@echo off
+echo.
+echo [信息] 安装Web工程,生成node_modules文件。
+echo.
+
+%~d0
+cd %~dp0
+
+cd ..
+npm install --registry=https://registry.npmmirror.com
+
+pause

+ 12 - 0
cpp-ui/bin/run-web.bat

@@ -0,0 +1,12 @@
+@echo off
+echo.
+echo [信息] 使用 Vue CLI 命令运行 Web 工程。
+echo.
+
+%~d0
+cd %~dp0
+
+cd ..
+npm run dev
+
+pause

+ 35 - 0
cpp-ui/build/index.js

@@ -0,0 +1,35 @@
+const { run } = require('runjs')
+const chalk = require('chalk')
+const config = require('../vue.config.js')
+const rawArgv = process.argv.slice(2)
+const args = rawArgv.join(' ')
+
+if (process.env.npm_config_preview || rawArgv.includes('--preview')) {
+  const report = rawArgv.includes('--report')
+
+  run(`vue-cli-service build ${args}`)
+
+  const port = 9526
+  const publicPath = config.publicPath
+
+  var connect = require('connect')
+  var serveStatic = require('serve-static')
+  const app = connect()
+
+  app.use(
+    publicPath,
+    serveStatic('./dist', {
+      index: ['index.html', '/']
+    })
+  )
+
+  app.listen(port, function () {
+    console.log(chalk.green(`> Preview at  http://localhost:${port}${publicPath}`))
+    if (report) {
+      console.log(chalk.green(`> Report at  http://localhost:${port}${publicPath}report.html`))
+    }
+
+  })
+} else {
+  run(`vue-cli-service build ${args}`)
+}

+ 90 - 0
cpp-ui/package.json

@@ -0,0 +1,90 @@
+{
+  "name": "ruoyi",
+  "version": "3.8.8",
+  "description": "若依管理系统",
+  "author": "若依",
+  "license": "MIT",
+  "scripts": {
+    "dev": "vue-cli-service serve",
+    "build:prod": "vue-cli-service build",
+    "build:stage": "vue-cli-service build --mode staging",
+    "preview": "node build/index.js --preview",
+    "lint": "eslint --ext .js,.vue src"
+  },
+  "husky": {
+    "hooks": {
+      "pre-commit": "lint-staged"
+    }
+  },
+  "lint-staged": {
+    "src/**/*.{js,vue}": [
+      "eslint --fix",
+      "git add"
+    ]
+  },
+  "keywords": [
+    "vue",
+    "admin",
+    "dashboard",
+    "element-ui",
+    "boilerplate",
+    "admin-template",
+    "management-system"
+  ],
+  "repository": {
+    "type": "git",
+    "url": "https://gitee.com/y_project/RuoYi-Vue.git"
+  },
+  "dependencies": {
+    "@riophae/vue-treeselect": "0.4.0",
+    "axios": "0.28.1",
+    "clipboard": "2.0.8",
+    "core-js": "3.37.1",
+    "echarts": "5.4.0",
+    "element-ui": "2.15.14",
+    "file-saver": "2.0.5",
+    "fuse.js": "6.4.3",
+    "highlight.js": "9.18.5",
+    "js-beautify": "1.13.0",
+    "js-cookie": "3.0.1",
+    "jsencrypt": "3.0.0-rc.1",
+    "nprogress": "0.2.0",
+    "quill": "1.3.7",
+    "screenfull": "5.0.2",
+    "sortablejs": "1.10.2",
+    "vue": "2.6.12",
+    "vue-count-to": "1.0.13",
+    "vue-cropper": "0.5.5",
+    "vue-meta": "2.4.0",
+    "vue-router": "3.4.9",
+    "vuedraggable": "2.24.3",
+    "vuex": "3.6.0"
+  },
+  "devDependencies": {
+    "@vue/cli-plugin-babel": "4.4.6",
+    "@vue/cli-plugin-eslint": "4.4.6",
+    "@vue/cli-service": "4.4.6",
+    "babel-eslint": "10.1.0",
+    "babel-plugin-dynamic-import-node": "2.3.3",
+    "chalk": "4.1.0",
+    "compression-webpack-plugin": "6.1.2",
+    "connect": "3.6.6",
+    "eslint": "7.15.0",
+    "eslint-plugin-vue": "7.2.0",
+    "lint-staged": "10.5.3",
+    "runjs": "4.4.2",
+    "sass": "1.32.13",
+    "sass-loader": "10.1.1",
+    "script-ext-html-webpack-plugin": "2.1.5",
+    "svg-sprite-loader": "5.1.1",
+    "vue-template-compiler": "2.6.12"
+  },
+  "engines": {
+    "node": ">=8.9",
+    "npm": ">= 3.0.0"
+  },
+  "browserslist": [
+    "> 1%",
+    "last 2 versions"
+  ]
+}

BIN
cpp-ui/public/favicon.ico


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 21 - 0
cpp-ui/public/html/ie.html


+ 208 - 0
cpp-ui/public/index.html

@@ -0,0 +1,208 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="renderer" content="webkit">
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
+    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
+    <title><%= webpackConfig.name %></title>
+    <!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
+	  <style>
+    html,
+    body,
+    #app {
+      height: 100%;
+      margin: 0px;
+      padding: 0px;
+    }
+    .chromeframe {
+      margin: 0.2em 0;
+      background: #ccc;
+      color: #000;
+      padding: 0.2em 0;
+    }
+
+    #loader-wrapper {
+      position: fixed;
+      top: 0;
+      left: 0;
+      width: 100%;
+      height: 100%;
+      z-index: 999999;
+    }
+
+    #loader {
+      display: block;
+      position: relative;
+      left: 50%;
+      top: 50%;
+      width: 150px;
+      height: 150px;
+      margin: -75px 0 0 -75px;
+      border-radius: 50%;
+      border: 3px solid transparent;
+      border-top-color: #FFF;
+      -webkit-animation: spin 2s linear infinite;
+      -ms-animation: spin 2s linear infinite;
+      -moz-animation: spin 2s linear infinite;
+      -o-animation: spin 2s linear infinite;
+      animation: spin 2s linear infinite;
+      z-index: 1001;
+    }
+
+    #loader:before {
+      content: "";
+      position: absolute;
+      top: 5px;
+      left: 5px;
+      right: 5px;
+      bottom: 5px;
+      border-radius: 50%;
+      border: 3px solid transparent;
+      border-top-color: #FFF;
+      -webkit-animation: spin 3s linear infinite;
+      -moz-animation: spin 3s linear infinite;
+      -o-animation: spin 3s linear infinite;
+      -ms-animation: spin 3s linear infinite;
+      animation: spin 3s linear infinite;
+    }
+
+    #loader:after {
+      content: "";
+      position: absolute;
+      top: 15px;
+      left: 15px;
+      right: 15px;
+      bottom: 15px;
+      border-radius: 50%;
+      border: 3px solid transparent;
+      border-top-color: #FFF;
+      -moz-animation: spin 1.5s linear infinite;
+      -o-animation: spin 1.5s linear infinite;
+      -ms-animation: spin 1.5s linear infinite;
+      -webkit-animation: spin 1.5s linear infinite;
+      animation: spin 1.5s linear infinite;
+    }
+
+
+    @-webkit-keyframes spin {
+      0% {
+        -webkit-transform: rotate(0deg);
+        -ms-transform: rotate(0deg);
+        transform: rotate(0deg);
+      }
+      100% {
+        -webkit-transform: rotate(360deg);
+        -ms-transform: rotate(360deg);
+        transform: rotate(360deg);
+      }
+    }
+
+    @keyframes spin {
+      0% {
+        -webkit-transform: rotate(0deg);
+        -ms-transform: rotate(0deg);
+        transform: rotate(0deg);
+      }
+      100% {
+        -webkit-transform: rotate(360deg);
+        -ms-transform: rotate(360deg);
+        transform: rotate(360deg);
+      }
+    }
+
+
+    #loader-wrapper .loader-section {
+      position: fixed;
+      top: 0;
+      width: 51%;
+      height: 100%;
+      background: #7171C6;
+      z-index: 1000;
+      -webkit-transform: translateX(0);
+      -ms-transform: translateX(0);
+      transform: translateX(0);
+    }
+
+    #loader-wrapper .loader-section.section-left {
+      left: 0;
+    }
+
+    #loader-wrapper .loader-section.section-right {
+      right: 0;
+    }
+
+
+    .loaded #loader-wrapper .loader-section.section-left {
+      -webkit-transform: translateX(-100%);
+      -ms-transform: translateX(-100%);
+      transform: translateX(-100%);
+      -webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
+      transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
+    }
+
+    .loaded #loader-wrapper .loader-section.section-right {
+      -webkit-transform: translateX(100%);
+      -ms-transform: translateX(100%);
+      transform: translateX(100%);
+      -webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
+      transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
+    }
+
+    .loaded #loader {
+      opacity: 0;
+      -webkit-transition: all 0.3s ease-out;
+      transition: all 0.3s ease-out;
+    }
+
+    .loaded #loader-wrapper {
+      visibility: hidden;
+      -webkit-transform: translateY(-100%);
+      -ms-transform: translateY(-100%);
+      transform: translateY(-100%);
+      -webkit-transition: all 0.3s 1s ease-out;
+      transition: all 0.3s 1s ease-out;
+    }
+
+    .no-js #loader-wrapper {
+      display: none;
+    }
+
+    .no-js h1 {
+      color: #222222;
+    }
+
+    #loader-wrapper .load_title {
+      font-family: 'Open Sans';
+      color: #FFF;
+      font-size: 19px;
+      width: 100%;
+      text-align: center;
+      z-index: 9999999999999;
+      position: absolute;
+      top: 60%;
+      opacity: 1;
+      line-height: 30px;
+    }
+
+    #loader-wrapper .load_title span {
+      font-weight: normal;
+      font-style: italic;
+      font-size: 13px;
+      color: #FFF;
+      opacity: 0.5;
+    }
+  </style>
+  </head>
+  <body>
+    <div id="app">
+	    <div id="loader-wrapper">
+		    <div id="loader"></div>
+		    <div class="loader-section section-left"></div>
+		    <div class="loader-section section-right"></div>
+		    <div class="load_title">正在加载系统资源,请耐心等待</div>
+        </div>
+	</div>
+  </body>
+</html>

+ 2 - 0
cpp-ui/public/robots.txt

@@ -0,0 +1,2 @@
+User-agent: *
+Disallow: /

+ 130 - 0
cpp-ui/vue.config.js

@@ -0,0 +1,130 @@
+'use strict'
+const path = require('path')
+
+function resolve(dir) {
+  return path.join(__dirname, dir)
+}
+
+const CompressionPlugin = require('compression-webpack-plugin')
+
+const name = process.env.VUE_APP_TITLE || '若依管理系统' // 网页标题
+
+const port = process.env.port || process.env.npm_config_port || 80 // 端口
+
+// vue.config.js 配置说明
+//官方vue.config.js 参考文档 https://cli.vuejs.org/zh/config/#css-loaderoptions
+// 这里只列一部分,具体配置参考文档
+module.exports = {
+  // 部署生产环境和开发环境下的URL。
+  // 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上
+  // 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
+  publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
+  // 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
+  outputDir: 'dist',
+  // 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
+  assetsDir: 'static',
+  // 是否开启eslint保存检测,有效值:ture | false | 'error'
+  lintOnSave: process.env.NODE_ENV === 'development',
+  // 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
+  productionSourceMap: false,
+  // webpack-dev-server 相关配置
+  devServer: {
+    host: '0.0.0.0',
+    port: port,
+    open: true,
+    proxy: {
+      // detail: https://cli.vuejs.org/config/#devserver-proxy
+      [process.env.VUE_APP_BASE_API]: {
+        target: `http://localhost:8080`,
+        changeOrigin: true,
+        pathRewrite: {
+          ['^' + process.env.VUE_APP_BASE_API]: ''
+        }
+      }
+    },
+    disableHostCheck: true
+  },
+  css: {
+    loaderOptions: {
+      sass: {
+        sassOptions: { outputStyle: "expanded" }
+      }
+    }
+  },
+  configureWebpack: {
+    name: name,
+    resolve: {
+      alias: {
+        '@': resolve('src')
+      }
+    },
+    plugins: [
+      // http://doc.ruoyi.vip/ruoyi-vue/other/faq.html#使用gzip解压缩静态文件
+      new CompressionPlugin({
+        cache: false,                                  // 不启用文件缓存
+        test: /\.(js|css|html|jpe?g|png|gif|svg)?$/i,  // 压缩文件格式
+        filename: '[path][base].gz[query]',            // 压缩后的文件名
+        algorithm: 'gzip',                             // 使用gzip压缩
+        minRatio: 0.8,                                 // 压缩比例,小于 80% 的文件不会被压缩
+        deleteOriginalAssets: false                    // 压缩后删除原文件
+      })
+    ],
+  },
+  chainWebpack(config) {
+    config.plugins.delete('preload') // TODO: need test
+    config.plugins.delete('prefetch') // TODO: need test
+
+    // set svg-sprite-loader
+    config.module
+      .rule('svg')
+      .exclude.add(resolve('src/assets/icons'))
+      .end()
+    config.module
+      .rule('icons')
+      .test(/\.svg$/)
+      .include.add(resolve('src/assets/icons'))
+      .end()
+      .use('svg-sprite-loader')
+      .loader('svg-sprite-loader')
+      .options({
+        symbolId: 'icon-[name]'
+      })
+      .end()
+
+    config.when(process.env.NODE_ENV !== 'development', config => {
+          config
+            .plugin('ScriptExtHtmlWebpackPlugin')
+            .after('html')
+            .use('script-ext-html-webpack-plugin', [{
+            // `runtime` must same as runtimeChunk name. default is `runtime`
+              inline: /runtime\..*\.js$/
+            }])
+            .end()
+
+          config.optimization.splitChunks({
+            chunks: 'all',
+            cacheGroups: {
+              libs: {
+                name: 'chunk-libs',
+                test: /[\\/]node_modules[\\/]/,
+                priority: 10,
+                chunks: 'initial' // only package third parties that are initially dependent
+              },
+              elementUI: {
+                name: 'chunk-elementUI', // split elementUI into a single package
+                test: /[\\/]node_modules[\\/]_?element-ui(.*)/, // in order to adapt to cnpm
+                priority: 20 // the weight needs to be larger than libs and app or it will be packaged into libs or app
+              },
+              commons: {
+                name: 'chunk-commons',
+                test: resolve('src/components'), // can customize your rules
+                minChunks: 3, //  minimum common number
+                priority: 5,
+                reuseExistingChunk: true
+              }
+            }
+          })
+          config.optimization.runtimeChunk('single')
+    })
+  }
+}

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio