Commit ba133a2c by 李小惠

Merge branch 'develop' of http://gitlab.sothing.top/843502640/jyzb_platformV2 into develop-lxh

parents f79bbe61 dbd8c2d0
......@@ -28,12 +28,12 @@ public interface JYZBConstant {
/**
* 缓存前缀
*/
String JYZB_CACHE_PREFIX = "jyzb:";
String JYZB_CACHE_PREFIX = "msg:";
/**
* 温度前缀
*/
String JYZB_TEMP_PREFIX = "temp";
String JYZB_TEMP_PREFIX = "temp:";
String JYZB_JWT_KEY = "JWT";
}
......@@ -17,7 +17,10 @@
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
......
package com.junmp.jyzb.cache;
import com.junmp.jyzb.api.constant.JYZBConstant;
import com.junmp.v2.cache.AbstractRedisCache;
import org.springframework.data.redis.core.RedisTemplate;
......
......@@ -9,12 +9,11 @@ import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@Component
public class TemperatureRedisCache extends AbstractRedisCache<HumidityAndtemperature> {
public TemperatureRedisCache(RedisTemplate<String, HumidityAndtemperature> redisTemplate) {
//@Component
public class TemperatureRedisCache extends AbstractRedisCache<Object> {
public TemperatureRedisCache(RedisTemplate<String, Object> redisTemplate) {
super(redisTemplate);
}
......@@ -35,10 +34,10 @@ public class TemperatureRedisCache extends AbstractRedisCache<HumidityAndtempera
put(key, data);
}
public List<HumidityAndtemperature> getDataByTimestampRange(String warehouseId, long startTimestamp, long endTimestamp) {
public List<Object> getDataByTimestampRange(String warehouseId, long startTimestamp, long endTimestamp) {
String key = warehouseId;
Set<HumidityAndtemperature> dataInRange = getRedisTemplate().opsForZSet().rangeByScore(key, startTimestamp, endTimestamp);
Set<Object> dataInRange = getRedisTemplate().opsForZSet().rangeByScore(key, startTimestamp, endTimestamp);
return new ArrayList<>(dataInRange);
}
}
package com.junmp.jyzb.entity.Temp;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.context.annotation.Configuration;
import java.io.Serializable;
import java.sql.Time;
import java.util.Date;
@Data
public class HumidityAndtemperature {
@Configuration
@NoArgsConstructor
public class HumidityAndtemperature implements Serializable {
//湿度
private Double humidity;
//温度
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论