|
|
|
@ -161,7 +161,7 @@ public class TdEngineServiceImpl implements ITdEngineService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return Map<Map < Object>>
|
|
|
|
|
* @return List<Map < String, Object>>
|
|
|
|
|
* @param: tdSelectDto
|
|
|
|
|
* @description 根据tagsname获取超级表最新信息,适用于设备汇总页面,先分页获取设备信息,再获取所有此物模型下的最新信息(冗余,但每页只获取一次,不需要每个设备都获取一次
|
|
|
|
|
* * 如果需要根据时间周期获取最新的数据,则需要用select last_row()
|
|
|
|
@ -169,19 +169,27 @@ public class TdEngineServiceImpl implements ITdEngineService {
|
|
|
|
|
* @date 2023-08-29 14:47
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Map<String, Object>> getLatestDataByTags(TdSelectDto tdSelectDto) {
|
|
|
|
|
List<Map<String, Object>> latestMaps = this.tdEngineMapper.getLatestDataByTags(tdSelectDto);
|
|
|
|
|
Map<String, Map<String, Object>> tagsMap = new HashMap<>();
|
|
|
|
|
for (Map<String, Object> latestMap : latestMaps) {
|
|
|
|
|
Map<String, Object> filterMap = latestMap.entrySet()
|
|
|
|
|
public List<Map<String, Object>> getLatestDataByTags(TdSuperTableSelectVo tdSuperTableSelectVo) {
|
|
|
|
|
List<Map<String, Object>> latestMaps = this.tdEngineMapper.getLatestDataByTags(tdSuperTableSelectVo);
|
|
|
|
|
latestMaps.replaceAll(latestMap -> {
|
|
|
|
|
return latestMap.entrySet()
|
|
|
|
|
.stream()
|
|
|
|
|
.filter(entry -> entry.getValue() != null)
|
|
|
|
|
.collect(HashMap::new, (m, v) ->
|
|
|
|
|
m.put(v.getKey().substring(v.getKey().indexOf("(") + 1,
|
|
|
|
|
v.getKey().indexOf(")")), v.getValue()), HashMap::putAll);
|
|
|
|
|
tagsMap.put(filterMap.get(tdSelectDto.getTagsName()).toString(), filterMap);
|
|
|
|
|
}
|
|
|
|
|
return tagsMap;
|
|
|
|
|
});
|
|
|
|
|
// Map<String, Map<String, Object>> tagsMap = new HashMap<>();
|
|
|
|
|
// for (Map<String, Object> latestMap : latestMaps) {
|
|
|
|
|
// Map<String, Object> filterMap = latestMap.entrySet()
|
|
|
|
|
// .stream()
|
|
|
|
|
// .filter(entry -> entry.getValue() != null)
|
|
|
|
|
// .collect(HashMap::new, (m, v) ->
|
|
|
|
|
// m.put(v.getKey().substring(v.getKey().indexOf("(") + 1,
|
|
|
|
|
// v.getKey().indexOf(")")), v.getValue()), HashMap::putAll);
|
|
|
|
|
// tagsMap.put(filterMap.get(tdSuperTableSelectVo.getTagsName()).toString(), filterMap);
|
|
|
|
|
// }
|
|
|
|
|
return latestMaps;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|