Commit e1a25a53 by huangjy

fix: 状态问题

parent 45f352b3
......@@ -260,6 +260,9 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
}
Collection<Object> values = entries.values();
log.info("空间设备当前大小:{}",values.size());
if (values.size() < 10 || values.size() > 12) {
continue;
}
List<PlatElderCoordinateVO> voList = values.stream().map(entity -> {
PlatElderCoordinateVO vo = new PlatElderCoordinateVO();
JSONObject result = JSON.parseObject(entity.toString());
......@@ -303,6 +306,9 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
continue;
}
Collection<Object> values = entries.values();
if (values.size() < 10 || values.size() > 12) {
continue;
}
log.info("跌倒设备当前大小:{}",values.size());
List<PlatElderCoordinateVO> voList = values.stream().map(entity -> {
PlatElderCoordinateVO vo = new PlatElderCoordinateVO();
......
......@@ -127,7 +127,7 @@ public class PushCallback implements MqttCallback {
redisTemplate.opsForHash().put(DEVICE_BR_ANALYSIS + device.getDeviceId(), currentSecond,JSON.toJSONString(device.getProperties()));
redisTemplate.expire(DEVICE_BR_ANALYSIS + device.getDeviceId(),duration + 3,TimeUnit.MINUTES);
if (size > duration * 60) {
if (size >= duration * 60) {
redisTemplate.opsForHash().delete(DEVICE_BR_ANALYSIS + device.getDeviceId(),currentSecond - duration * 60);
}
redisTemplate.opsForValue().set(DEVICE_BR_DATA + device.getDeviceId(),JSON.toJSONString(device.getProperties()),
......@@ -138,7 +138,7 @@ public class PushCallback implements MqttCallback {
Long size = redisTemplate.opsForHash().size(DEVICE_SPACE_TEMP_DATA + device.getDeviceId());
redisTemplate.opsForHash().put(DEVICE_SPACE_TEMP_DATA + device.getDeviceId(), currentSecond,JSON.toJSONString(device.getProperties()));
redisTemplate.expire(DEVICE_SPACE_TEMP_DATA + device.getDeviceId(),maxSize + 1,TimeUnit.SECONDS);
if (size > maxSize) {
if (size == maxSize) {
redisTemplate.opsForHash().delete(DEVICE_SPACE_TEMP_DATA + device.getDeviceId(),currentSecond - maxSize);
}
......@@ -150,7 +150,7 @@ public class PushCallback implements MqttCallback {
Long size = redisTemplate.opsForHash().size(DEVICE_FALL_TEMP_DATA + device.getDeviceId());
redisTemplate.opsForHash().put(DEVICE_FALL_TEMP_DATA + device.getDeviceId(), currentSecond,JSON.toJSONString(device.getProperties()));
redisTemplate.expire(DEVICE_FALL_TEMP_DATA + device.getDeviceId(),maxSize + 1,TimeUnit.SECONDS);
if (size > maxSize) {
if (size == maxSize) {
redisTemplate.opsForHash().delete(DEVICE_FALL_TEMP_DATA + device.getDeviceId(),currentSecond - maxSize);
}
......
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 sign in to comment