【fix sonar】ActuatorRedisController文件

This commit is contained in:
梁琦涛
2023-03-08 16:16:20 +08:00
parent 936668d42b
commit 0ee403fcd9
@@ -1,11 +1,11 @@
package com.jero.modules.monitor.controller; package com.jero.modules.monitor.controller;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import lombok.extern.slf4j.Slf4j;
import com.jero.common.api.vo.Result; import com.jero.common.api.vo.Result;
import com.jero.modules.monitor.domain.RedisInfo; import com.jero.modules.monitor.domain.RedisInfo;
import com.jero.modules.monitor.exception.RedisConnectException;
import com.jero.modules.monitor.service.RedisService; import com.jero.modules.monitor.service.RedisService;
import org.apache.poi.ss.formula.functions.T; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@@ -34,14 +34,14 @@ public class ActuatorRedisController {
* @throws Exception * @throws Exception
*/ */
@GetMapping("/info") @GetMapping("/info")
public Result<List<RedisInfo>> getRedisInfo() throws Exception { public Result<List<RedisInfo>> getRedisInfo() throws RedisConnectException {
List<RedisInfo> infoList = this.redisService.getRedisInfo(); List<RedisInfo> infoList = this.redisService.getRedisInfo();
log.info(infoList.toString()); log.info(infoList.toString());
return Result.OK(infoList); return Result.OK(infoList);
} }
@GetMapping("/keysSize") @GetMapping("/keysSize")
public Map<String, Object> getKeysSize() throws Exception { public Map<String, Object> getKeysSize() throws RedisConnectException {
return redisService.getKeysSize(); return redisService.getKeysSize();
} }
@@ -51,7 +51,7 @@ public class ActuatorRedisController {
* @throws Exception * @throws Exception
*/ */
@GetMapping("/keysSizeForReport") @GetMapping("/keysSizeForReport")
public Map<String, JSONArray> getKeysSizeReport() throws Exception { public Map<String, JSONArray> getKeysSizeReport() throws RedisConnectException {
return redisService.getMapForReport("1"); return redisService.getMapForReport("1");
} }
/** /**
@@ -61,7 +61,7 @@ public class ActuatorRedisController {
* @throws Exception * @throws Exception
*/ */
@GetMapping("/memoryForReport") @GetMapping("/memoryForReport")
public Map<String, JSONArray> memoryForReport() throws Exception { public Map<String, JSONArray> memoryForReport() throws RedisConnectException {
return redisService.getMapForReport("2"); return redisService.getMapForReport("2");
} }
/** /**
@@ -70,12 +70,12 @@ public class ActuatorRedisController {
* @throws Exception * @throws Exception
*/ */
@GetMapping("/infoForReport") @GetMapping("/infoForReport")
public Map<String, JSONArray> infoForReport() throws Exception { public Map<String, JSONArray> infoForReport() throws RedisConnectException {
return redisService.getMapForReport("3"); return redisService.getMapForReport("3");
} }
@GetMapping("/memoryInfo") @GetMapping("/memoryInfo")
public Map<String, Object> getMemoryInfo() throws Exception { public Map<String, Object> getMemoryInfo() throws RedisConnectException {
return redisService.getMemoryInfo(); return redisService.getMemoryInfo();
} }