|
@@ -167,13 +167,13 @@ public class TaosLatestDao implements ILatestDao {
|
|
|
int count = writeLongLatest(pointDataList);
|
|
|
writeCount = writeCount + count;
|
|
|
}
|
|
|
- }
|
|
|
- return writeCount > 0 ? true : false;
|
|
|
}
|
|
|
+ return writeCount > 0 ? true : false;
|
|
|
+ }
|
|
|
|
|
|
- public Map<String, TsData> getDoubleTsDataSnapshots (String...tagNames) throws Exception {
|
|
|
- Map<String, TsData> tsDataMap = new HashMap<>();
|
|
|
- Statement st = config.getInstance().createStatement();
|
|
|
+ public Map<String, TsData> getDoubleTsDataSnapshots(String... tagNames) throws Exception {
|
|
|
+ Map<String, TsData> tsDataMap = new HashMap<>();
|
|
|
+ Statement st = config.getInstance().createStatement();
|
|
|
// for (String tag : tagNames) {
|
|
|
// String tableName = config.getTableName(tag);
|
|
|
//
|
|
@@ -183,41 +183,39 @@ public class TaosLatestDao implements ILatestDao {
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
- String inString = Arrays.stream(tagNames).map(s -> "'" + s + "'").collect(Collectors.joining(","));
|
|
|
- ResultSet rs = st.executeQuery("select last_row(*) from by_fdc.windturbineai where point in (" + inString + ") group by tbname;");
|
|
|
+ String inString = Arrays.stream(tagNames).map(s -> "'" + s + "'").collect(Collectors.joining(","));
|
|
|
+ ResultSet rs = st.executeQuery("select last_row(*) from " + config.getDbName() + "." + config.getAIStableName() + " where point in (" + inString + ") group by tbname;");
|
|
|
|
|
|
- while (rs.next()) {
|
|
|
- tsDataMap.put(rs.getString(3).toUpperCase(), new DoubleTsData(rs.getTimestamp(1).getTime(), (short) 0, rs.getDouble(2)));
|
|
|
- }
|
|
|
- return tsDataMap;
|
|
|
+ while (rs.next()) {
|
|
|
+ tsDataMap.put(rs.getString(3).toUpperCase(), new DoubleTsData(rs.getTimestamp(1).getTime(), (short) 0, rs.getDouble(2)));
|
|
|
}
|
|
|
+ return tsDataMap;
|
|
|
+ }
|
|
|
|
|
|
- public Map<String, TsData> getLongTsDataSnapshots (String...tagNames) throws Exception {
|
|
|
- Map<String, TsData> tsDataMap = new HashMap<>();
|
|
|
- Statement st = config.getInstance().createStatement();
|
|
|
- for (String tag : tagNames) {
|
|
|
- String tableName = config.getTableName(tag);
|
|
|
- ResultSet rs = st.executeQuery("select last_row(*) from " + tableName);
|
|
|
- while (rs.next()) {
|
|
|
- tsDataMap.put(tag, new LongTsData(rs.getTimestamp(1).getTime(), (short) 0, rs.getLong(2)));
|
|
|
- }
|
|
|
+ public Map<String, TsData> getLongTsDataSnapshots(String... tagNames) throws Exception {
|
|
|
+ Map<String, TsData> tsDataMap = new HashMap<>();
|
|
|
+ Statement st = config.getInstance().createStatement();
|
|
|
+ for (String tag : tagNames) {
|
|
|
+ String tableName = config.getTableName(tag);
|
|
|
+ ResultSet rs = st.executeQuery("select last_row(*) from " + tableName);
|
|
|
+ while (rs.next()) {
|
|
|
+ tsDataMap.put(tag, new LongTsData(rs.getTimestamp(1).getTime(), (short) 0, rs.getLong(2)));
|
|
|
}
|
|
|
- return tsDataMap;
|
|
|
}
|
|
|
+ return tsDataMap;
|
|
|
+ }
|
|
|
|
|
|
- public Map<String, TsData> getBooleanTsDataSnapshots (String...tagNames) throws Exception {
|
|
|
- Map<String, TsData> tsDataMap = new HashMap<>();
|
|
|
- Statement st = config.getInstance().createStatement();
|
|
|
-
|
|
|
- for (String tag : tagNames) {
|
|
|
- String tableName = config.getTableName(tag);
|
|
|
- ResultSet rs = st.executeQuery("select last_row(*) from " + tableName);
|
|
|
- while (rs.next()) {
|
|
|
- tsDataMap.put(tag, new LongTsData(rs.getTimestamp(1).getTime(), (short) 0, rs.getLong(2)));
|
|
|
- tsDataMap.put(rs.getString(3).toUpperCase(), new BooleanTsData(rs.getTimestamp(1).getTime(), (short) 0, rs.getBoolean(2)));
|
|
|
- }
|
|
|
- }
|
|
|
- return tsDataMap;
|
|
|
- }
|
|
|
+ public Map<String, TsData> getBooleanTsDataSnapshots(String... tagNames) throws Exception {
|
|
|
+ Map<String, TsData> tsDataMap = new HashMap<>();
|
|
|
+ Statement st = config.getInstance().createStatement();
|
|
|
|
|
|
+ String inString = Arrays.stream(tagNames).map(s -> "'" + s + "'").collect(Collectors.joining(","));
|
|
|
+ ResultSet rs = st.executeQuery("select last_row(*) from " + config.getDbName() + "." + config.getDIStableName() + " where point in (" + inString + ") group by tbname;");
|
|
|
+
|
|
|
+ while (rs.next()) {
|
|
|
+ tsDataMap.put(rs.getString(3).toUpperCase(), new BooleanTsData(rs.getTimestamp(1).getTime(), (short) 0, rs.getBoolean(2)));
|
|
|
+ }
|
|
|
+ return tsDataMap;
|
|
|
}
|
|
|
+
|
|
|
+}
|