Bläddra i källkod

taos库di点查询修改

wanghs 1 år sedan
förälder
incheckning
a510025f51

+ 5 - 2
dao/dao-taoscz/src/main/java/com/gyee/wisdom/dao/taoscz/TaosLatestDao.java

@@ -182,8 +182,9 @@ public class TaosLatestDao implements ILatestDao {
 //                tsDataMap.put(tag, new DoubleTsData(rs.getTimestamp(1).getTime(), (short) 0, rs.getDouble(2)));
 //            }
 //        }
+
             String inString = Arrays.stream(tagNames).map(s -> "'" + s + "'").collect(Collectors.joining(","));
-            ResultSet rs = st.executeQuery("select last_row(*) from by_fdc.windturbine  where point in (" + inString + ") group by tbname;");
+            ResultSet rs = st.executeQuery("select last_row(*) from by_fdc.windturbineai  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)));
@@ -207,11 +208,13 @@ public class TaosLatestDao implements ILatestDao {
         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 BooleanTsData(rs.getTimestamp(1).getTime(), (short) 0, rs.getBoolean(2)));
+                    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;