#修改统计历史状态的接口

This commit is contained in:
2026-09-23 12:35:36 +08:00
parent 13acda2ddb
commit 33f8ce0b92

View File

@@ -419,7 +419,22 @@ public class DeviceServiceImpl implements IDeviceService {
queryWrapper.ge(DeviceRunningStatusHistory::getCreateTime, dto.getStartTime());
queryWrapper.le(DeviceRunningStatusHistory::getCreateTime, dto.getEndTime());
}
return deviceStatusHistoryMapper.selectList(queryWrapper);
List<DeviceRunningStatusHistory> list = deviceStatusHistoryMapper.selectList(queryWrapper);
String key = "running_status:" + dto.getDeviceId();
DeviceStatusRecordDTO recordDTO = redisCache.getCacheObject(key);
List<DeviceRunningStatusHistory> cacheList;
if (recordDTO != null) {
cacheList = recordDTO.getHistories();
if (!CollectionUtils.isEmpty(list)) {
if (!CollectionUtils.isEmpty(cacheList)) {
list.addAll(cacheList);
}
} else {
return cacheList;
}
}
return list;
}
}