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