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