redis添加字符串存储类型支持
This commit is contained in:
@@ -2,10 +2,12 @@ package com.njcn.redis.utils;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisCallback;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -351,4 +353,17 @@ public class RedisUtil {
|
||||
return database;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取value为字符串的
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public String getRawValue(String key) {
|
||||
return redisTemplate.execute((RedisCallback<String>) connection -> {
|
||||
byte[] data = connection.get(key.getBytes());
|
||||
return data == null ? null : new String(data, StandardCharsets.UTF_8);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class AreaInfoServiceImpl implements AreaInfoService {
|
||||
}
|
||||
|
||||
}else{
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalRunDeviceInfo(deviceInfoParam).getData();
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData();
|
||||
lineIds.addAll(generalDeviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user