【fix sonar】 RedisServiceImpl.java 文件
This commit is contained in:
+7
-7
@@ -31,8 +31,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class RedisServiceImpl implements RedisService {
|
public class RedisServiceImpl implements RedisService {
|
||||||
|
|
||||||
private static String CREATE_TIME ="create_time";
|
private static final String CREATE_TIME ="create_time";
|
||||||
private static String USER_MEMORY ="used_memory";
|
private static final String USER_MEMORY ="used_memory";
|
||||||
@Resource
|
@Resource
|
||||||
private RedisConnectionFactory redisConnectionFactory;
|
private RedisConnectionFactory redisConnectionFactory;
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ public class RedisServiceImpl implements RedisService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map<String, JSONArray> getMapForReport(String type) throws RedisConnectException {
|
public Map<String, JSONArray> getMapForReport(String type) throws RedisConnectException {
|
||||||
Map<String,JSONArray> mapJson=new HashMap<String, JSONArray> ();
|
Map<String,JSONArray> mapJson=new HashMap<> ();
|
||||||
JSONArray json = new JSONArray();
|
JSONArray json = new JSONArray();
|
||||||
if("3".equals(type)){
|
if("3".equals(type)){
|
||||||
List<RedisInfo> redisInfo = getRedisInfo();
|
List<RedisInfo> redisInfo = getRedisInfo();
|
||||||
@@ -115,11 +115,11 @@ public class RedisServiceImpl implements RedisService {
|
|||||||
jo.put("value",map.get("dbSize"));
|
jo.put("value",map.get("dbSize"));
|
||||||
}else{
|
}else{
|
||||||
map = getMemoryInfo();
|
map = getMemoryInfo();
|
||||||
Integer used_memory = Integer.valueOf(map.get(USER_MEMORY).toString());
|
Integer usedMemory = Integer.valueOf(map.get(USER_MEMORY).toString());
|
||||||
jo.put("value",used_memory/1000);
|
jo.put("value",usedMemory/1000);
|
||||||
}
|
}
|
||||||
String create_time = DateUtil.formatTime(DateUtil.date((Long) map.get(CREATE_TIME)-(4-i)*1000));
|
String createTime = DateUtil.formatTime(DateUtil.date((Long) map.get(CREATE_TIME)-(4-i)*1000));
|
||||||
jo.put("name",create_time);
|
jo.put("name",createTime);
|
||||||
json.add(jo);
|
json.add(jo);
|
||||||
}
|
}
|
||||||
mapJson.put("data",json);
|
mapJson.put("data",json);
|
||||||
|
|||||||
Reference in New Issue
Block a user