Commit 24d25e90 by huangjy

fix: 睡眠问题

parent 95f3a451
......@@ -193,7 +193,7 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
Long sleepTimeActionDuration = getSleepTimeActionDuration();
Map<Object, Object> entries = redisTemplate.opsForHash().entries(DEVICE_BR_ANALYSIS + platDevice.getOriDeviceId());
Collection<Object> values = entries.values();
if (values.size() >= sleepTimeActionDuration * 60) {
if (values.size() >= sleepTimeActionDuration) {
Predicate<Object> predicate = entity -> {
JSONObject result = JSON.parseObject(entity.toString());
Integer bodymove = Integer.valueOf(result.getString("bodymove"));
......@@ -358,7 +358,7 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
redisTemplate.opsForValue().set(SLEEP_ANALYSIS_KEY,analysisModel.getSleepTimeActionDuration(),1,TimeUnit.DAYS);
sleepTimeActionDuration = analysisModel.getSleepTimeActionDuration();
}
BigDecimal s = new BigDecimal(sleepTimeActionDuration).multiply(new BigDecimal(60));
BigDecimal s = new BigDecimal(sleepTimeActionDuration).multiply(new BigDecimal(3600));
return s.longValue();
}
......
......@@ -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) {
redisTemplate.opsForHash().delete(DEVICE_BR_ANALYSIS + device.getDeviceId(),currentSecond - duration * 60);
}
redisTemplate.opsForValue().set(DEVICE_BR_DATA + device.getDeviceId(),JSON.toJSONString(device.getProperties()),
......@@ -227,7 +227,7 @@ public class PushCallback implements MqttCallback {
redisTemplate.opsForValue().set(SLEEP_ANALYSIS_KEY,analysisModel.getSleepTimeActionDuration(),1,TimeUnit.DAYS);
sleepTimeActionDuration = analysisModel.getSleepTimeActionDuration();
}
BigDecimal s = new BigDecimal(sleepTimeActionDuration).multiply(new BigDecimal(60));
BigDecimal s = new BigDecimal(sleepTimeActionDuration).multiply(new BigDecimal(3600));
return s.longValue();
}
......
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