Commit e5c3e16d by huangjy

fix:上报时间先取当作时间戳

parent 195740c6
......@@ -836,11 +836,11 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
public void active(BaseIdDTO dto) {
PlatDevice platDevice = getById(dto.getId());
Map<String, Object> resMap = new HashMap<>();
resMap.put("appid",shengwangProperties.getAppId());
/* resMap.put("appid",shengwangProperties.getAppId());
String AttrResult = devicePropertiesOperateService.deviceWriteAttr(platDevice.getOriDeviceId(), resMap);
if (StringUtils.isNotEmpty(AttrResult)) {
throw new RuntimeException(AttrResult);
}
}*/
SaasPidManage saasPidManage = saasPidManageService.getOne(new QueryWrapper<SaasPidManage>().lambda()
.eq(SaasPidManage::getStatus, "1")
.orderByAsc(BaseEntity::getCreateDate)
......
......@@ -232,7 +232,6 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
boolean spaceNoPersonFlag = false;
for (PlatDevice device : spaceDeviceList) {
// 无人
Set<String> dataSet = redisTemplate.opsForZSet().rangeByScore(DEVICE_SPACE_TEMP_DATA + platDevice.getOriDeviceId(), currentSecond - 10, currentSecond);
if (CollectionUtils.isEmpty(dataSet)) {
log.info("空间设备当前没有上报数据直接返回");
......@@ -279,7 +278,6 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
}
boolean fallNoPersonFlag = false;
for (PlatDevice device : fallDeviceList) {
// 无人
Set<String> dataSet = redisTemplate.opsForZSet().rangeByScore(DEVICE_FALL_TEMP_DATA + platDevice.getOriDeviceId(), currentSecond - 10, currentSecond);
if (CollectionUtils.isEmpty(dataSet)) {
log.info("跌倒设备当前没有上报数据直接返回");
......
......@@ -153,7 +153,7 @@ public class PushCallback implements MqttCallback {
List<HeaderInfo.Bind> bindings = headers.getBindings();
Long timestamp = device.getTimestamp();
long currentSecond = timestamp / 1000;
long currentSecond = System.currentTimeMillis() / 1000;
// 先通过产品名称判断
if (REPORT_PROPERTY.equals(device.getMessageType()) && headers.getProductName().contains("呼吸")) {
cacheBrDeviceData(device, currentSecond);
......@@ -235,7 +235,7 @@ public class PushCallback implements MqttCallback {
long maxSize = 10L;
String key = deviceSpaceTempData + device.getDeviceId();
redisTemplate.opsForZSet().add(key,JSON.toJSONString(device),currentSecond);
redisTemplate.expire(key,maxSize + 1,TimeUnit.MINUTES);
redisTemplate.expire(key,60,TimeUnit.SECONDS);
}
private void cacheBrDeviceData(DeviceInfo device, long currentSecond) {
......@@ -243,7 +243,7 @@ public class PushCallback implements MqttCallback {
String key = DEVICE_BR_ANALYSIS + device.getDeviceId();
long duration = getSleepTimeActionDuration();
redisTemplate.opsForZSet().add(key,JSON.toJSONString(device),currentSecond);
redisTemplate.expire(key,duration + 3,TimeUnit.MINUTES);
redisTemplate.expire(key,duration + 180,TimeUnit.SECONDS);
}
private Long getSleepTimeActionDuration() {
......
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