From 5a271b8fdec174a3a57d374bb250e890f6668b50 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期二, 30 十一月 2021 11:11:32 +0800
Subject: [PATCH] update 更改前端工程文件版本号
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java | 110 ++++++++++++++++++++++++++++--------------------------
1 files changed, 57 insertions(+), 53 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java
index fa9c623..255f0b1 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java
@@ -1,53 +1,57 @@
-package com.ruoyi.web.controller.monitor;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-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.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.utils.StringUtils;
-
-/**
- * 缂撳瓨鐩戞帶
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/monitor/cache")
-public class CacheController
-{
- @Autowired
- private RedisTemplate<String, String> redisTemplate;
-
- @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);
- }
-}
+package com.ruoyi.web.controller.monitor;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.utils.StringUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.connection.RedisServerCommands;
+import org.springframework.data.redis.core.RedisCallback;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.*;
+
+/**
+ * 缂撳瓨鐩戞帶
+ *
+ * @author Lion Li
+ */
+@Api(value = "缂撳瓨鐩戞帶", tags = {"缂撳瓨鐩戞帶绠$悊"})
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/monitor/cache")
+public class CacheController {
+
+ private final RedisTemplate<String, String> redisTemplate;
+
+ @ApiOperation("鑾峰彇缂撳瓨鐩戞帶璇︾粏淇℃伅")
+ @SaCheckPermission("monitor:cache:list")
+ @GetMapping()
+ public AjaxResult<Map<String, Object>> getInfo() throws Exception {
+ Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) RedisServerCommands::info);
+ Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
+ Object dbSize = redisTemplate.execute((RedisCallback<Object>) RedisServerCommands::dbSize);
+
+ Map<String, Object> result = new HashMap<>(3);
+ result.put("info", info);
+ result.put("dbSize", dbSize);
+
+ List<Map<String, String>> pieList = new ArrayList<>();
+ if (commandStats != null) {
+ 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);
+ }
+}
--
Gitblit v1.9.3