Commit 79b434e8 authored by duanruiming's avatar duanruiming

[update] 微观大数据平台-行程时间日志打印

parent 728f850f
package net.wanji.opt.common; package net.wanji.opt.common;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import net.wanji.opt.dto.CrossEventDTO; import net.wanji.opt.dto.CrossEventDTO;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ZSetOperations; import org.springframework.data.redis.core.ZSetOperations;
...@@ -17,6 +17,7 @@ import java.util.Set; ...@@ -17,6 +17,7 @@ import java.util.Set;
* Created on 2019/4/29 20:34 * Created on 2019/4/29 20:34
*/ */
@Component @Component
@Slf4j
public class RedisUtils { public class RedisUtils {
@Resource @Resource
...@@ -25,7 +26,8 @@ public class RedisUtils { ...@@ -25,7 +26,8 @@ public class RedisUtils {
/** /**
* 7号库获取最大 score zset 元素 * 7号库获取最大 score zset 元素
*/ */
public Object getMaxScoreElement(String redisKey) throws JsonProcessingException { public Object getMaxScoreElement(String redisKey) throws Exception {
try {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
ZSetOperations<String, Object> zSetOps = redis7Template.opsForZSet(); ZSetOperations<String, Object> zSetOps = redis7Template.opsForZSet();
Set<Object> result = zSetOps.reverseRange(redisKey, 0, -1); Set<Object> result = zSetOps.reverseRange(redisKey, 0, -1);
...@@ -39,6 +41,10 @@ public class RedisUtils { ...@@ -39,6 +41,10 @@ public class RedisUtils {
} }
} }
} }
log.error("redis获取数据key:{}, 获取value:{}", redisKey, result);
} catch (Exception e) {
//throw new RuntimeException(e);
}
return null; return null;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment