|
@@ -34,7 +34,7 @@ public class TaosLatestDao implements ILatestDao {
|
|
|
Map<String, TsData> result = new HashMap<>();
|
|
|
Map<TsDataType, List<TsPoint>> pointGroup = tsPoints.stream().collect(Collectors.groupingBy(TsPoint::getTsDataType));
|
|
|
for (Map.Entry<TsDataType, List<TsPoint>> entry : pointGroup.entrySet()) {
|
|
|
- String[] tagNames = entry.getValue().stream().map(TsPoint::getId).toArray(String[]::new);
|
|
|
+ String[] tagNames = entry.getValue().stream().map(tp -> tp.getId().replaceFirst("\\.", "__")).toArray(String[]::new);
|
|
|
if (entry.getKey() == TsDataType.DOUBLE) {
|
|
|
result.putAll(getDoubleTsDataSnapshots(tagNames));
|
|
|
} else if (entry.getKey() == TsDataType.BOOLEAN) {
|
|
@@ -45,8 +45,11 @@ public class TaosLatestDao implements ILatestDao {
|
|
|
throw new WisdomException("Taos不支持数据类型:" + entry.getKey());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- return result;
|
|
|
+ Map<String, TsData> result2 = new HashMap<>();
|
|
|
+ for (Map.Entry<String, TsData> entry : result.entrySet()) {
|
|
|
+ result2.put(entry.getKey().replaceFirst("__", "."), entry.getValue());
|
|
|
+ }
|
|
|
+ return result2;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -60,7 +63,9 @@ public class TaosLatestDao implements ILatestDao {
|
|
|
String point = config.getTableName(obj.getTagName());
|
|
|
double value = obj.getTsData().getDoubleValue().get();
|
|
|
// sb.append(TaosCovertUtil.coverStationPrefix(point)).append(".");
|
|
|
- sb.append(point).append(" VALUES (");
|
|
|
+ sb.append(point).append(" USING ").append(config.getDbName())
|
|
|
+ .append(".").append(config.getAIStableName())
|
|
|
+ .append(" TAGS ('','','','','') VALUES (");
|
|
|
sb.append(time).append(",").append(value).append(") ");
|
|
|
}
|
|
|
sb.append(";");
|
|
@@ -144,7 +149,7 @@ public class TaosLatestDao implements ILatestDao {
|
|
|
@Override
|
|
|
public boolean writeLatest(List<TsPointData> dataList) throws Exception {
|
|
|
int writeCount = 0;
|
|
|
-
|
|
|
+ dataList = dataList.stream().peek(tpd -> tpd.setTagName(tpd.getTagName().replaceFirst("\\.", "__"))).collect(Collectors.toList());
|
|
|
Map<TsDataType, List<TsPointData>> pointGroup = dataList.stream().collect(Collectors.groupingBy(TsPointData::findDataType));
|
|
|
for (Map.Entry<TsDataType, List<TsPointData>> entry : pointGroup.entrySet()) {
|
|
|
List<TsPointData> pointDataList = entry.getValue();
|