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