|
@@ -78,8 +78,6 @@ public class DynamicSystemServiceImpl implements DynamicSystemService {
|
|
|
|
|
|
@Override
|
|
|
public List getContentTimeLimit(String hbaseTableName, Long start, Long end) {
|
|
|
-
|
|
|
-
|
|
|
Connection connection = null;
|
|
|
Table table = null;
|
|
|
// System.out.println(hbaseTableName);
|
|
@@ -99,14 +97,16 @@ public class DynamicSystemServiceImpl implements DynamicSystemService {
|
|
|
Cell cell = var8[var10];
|
|
|
String key = Bytes.toString(CellUtil.cloneQualifier(cell));
|
|
|
String value = Bytes.toString(CellUtil.cloneValue(cell));
|
|
|
- if (key.contains("after")) {
|
|
|
- map.put(key, value);
|
|
|
- }
|
|
|
- if (!map.containsKey("time")) {
|
|
|
- timestamp = cell.getTimestamp();
|
|
|
- String ss = format.format(timestamp);
|
|
|
- map.put("time", ss);
|
|
|
- }
|
|
|
+ if (key.contains("after")) {
|
|
|
+ map.put(key, value);
|
|
|
+ }
|
|
|
+ if (!map.containsKey("time")) {
|
|
|
+ timestamp = cell.getTimestamp();
|
|
|
+ String ss = format.format(timestamp);
|
|
|
+ map.put("time", ss);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|
|
|
equmentContextLists.add(map);
|
|
@@ -150,14 +150,16 @@ public class DynamicSystemServiceImpl implements DynamicSystemService {
|
|
|
Cell cell = var8[var10];
|
|
|
String key = Bytes.toString(CellUtil.cloneQualifier(cell));
|
|
|
String value = Bytes.toString(CellUtil.cloneValue(cell));
|
|
|
- if (key.contains("after")) {
|
|
|
- map.put(key, value);
|
|
|
- }
|
|
|
- if (!map.containsKey("time")) {
|
|
|
- timestamp = cell.getTimestamp();
|
|
|
- String ss = format.format(timestamp);
|
|
|
- map.put("time", ss);
|
|
|
- }
|
|
|
+ if (key.contains("after")) {
|
|
|
+ map.put(key, value);
|
|
|
+ }
|
|
|
+ if (!map.containsKey("time")) {
|
|
|
+ timestamp = cell.getTimestamp();
|
|
|
+ String ss = format.format(timestamp);
|
|
|
+ map.put("time", ss);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|
|
|
equmentContextLists.add(map);
|
|
@@ -180,14 +182,14 @@ public class DynamicSystemServiceImpl implements DynamicSystemService {
|
|
|
|
|
|
@Override
|
|
|
public List getEqumentHead_InMysql(Integer equipmentId) {
|
|
|
- System.out.println("getEqumentHead_InMysql");
|
|
|
+// System.out.println("getEqumentHead_InMysql");
|
|
|
final List<Map<String, String>> getcolumns = subsystemService.getcolumns(equipmentId);
|
|
|
- for (Map<String, String> getcolumn : getcolumns) {
|
|
|
- for (String o : getcolumn.keySet()) {
|
|
|
- System.out.println("key:" + o + " value : " + getcolumn.get(o));
|
|
|
- }
|
|
|
- }
|
|
|
- System.out.println(equipmentId);
|
|
|
+// for (Map<String, String> getcolumn : getcolumns) {
|
|
|
+// for (String o : getcolumn.keySet()) {
|
|
|
+// System.out.println("key:" + o + " value : " + getcolumn.get(o));
|
|
|
+// }
|
|
|
+// }
|
|
|
+// System.out.println(equipmentId);
|
|
|
return getcolumns;
|
|
|
|
|
|
}
|
|
@@ -212,7 +214,7 @@ public class DynamicSystemServiceImpl implements DynamicSystemService {
|
|
|
Cell cell = var8[var10];
|
|
|
String key = Bytes.toString(CellUtil.cloneQualifier(cell));
|
|
|
String value = Bytes.toString(CellUtil.cloneValue(cell));
|
|
|
- if (key.contains("after")) {
|
|
|
+ if (key.contains("after") ) {
|
|
|
map.put(key, value);
|
|
|
}
|
|
|
|
|
@@ -257,17 +259,19 @@ public class DynamicSystemServiceImpl implements DynamicSystemService {
|
|
|
Cell cell = var8[var10];
|
|
|
String key = Bytes.toString(CellUtil.cloneQualifier(cell));
|
|
|
String value = Bytes.toString(CellUtil.cloneValue(cell));
|
|
|
- if (key.contains("after")) {
|
|
|
- map.put(key, value);
|
|
|
- }
|
|
|
- if (!map.containsKey("time")){
|
|
|
- timestamp = cell.getTimestamp();
|
|
|
- String s = format.format(timestamp);
|
|
|
- map.put("time",s);
|
|
|
- }
|
|
|
+ if (key.contains("after") ) {
|
|
|
+ map.put(key, value);
|
|
|
+ }
|
|
|
+ if (!map.containsKey("time")){
|
|
|
+ timestamp = cell.getTimestamp();
|
|
|
+ String s = format.format(timestamp);
|
|
|
+ map.put("time",s);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|
|
|
- equmentContextLists.add(map);
|
|
|
+ if (!map.isEmpty()) equmentContextLists.add(map);
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
@@ -275,14 +279,16 @@ public class DynamicSystemServiceImpl implements DynamicSystemService {
|
|
|
if (table != null) {
|
|
|
try {
|
|
|
table.close();
|
|
|
+
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
+ return equmentContextLists;
|
|
|
}
|
|
|
|
|
|
-// equmentContextLists.forEach(System.out::println);
|
|
|
- return equmentContextLists;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -372,16 +378,17 @@ public class DynamicSystemServiceImpl implements DynamicSystemService {
|
|
|
final Map<String, List<String>> equmentOneColumn = getEqumentOneColumn(hbaseTableName, chosedatas, limit);
|
|
|
for (String chosedata : chosedatas) {
|
|
|
final List<String> strings = equmentOneColumn.get(chosedata);
|
|
|
- for (int i = 0; i < 10 && i < strings.size(); i++) {
|
|
|
+ int max = Math.min(10,strings.size());
|
|
|
+ for (int i = 0; i < max; i++) {
|
|
|
final String s = strings.get(i);
|
|
|
final HashMap<String, Object> clumData = new HashMap<>();
|
|
|
clumData.put(subEquipmentID + "_" + chosedata, s);
|
|
|
- if (sign < 10) {
|
|
|
+ if (sign < max) {
|
|
|
listMapSum.add(clumData);
|
|
|
} else {
|
|
|
- final Map map = listMapSum.get(sign % 10);
|
|
|
+ final Map map = listMapSum.get(sign % max);
|
|
|
map.putAll(clumData);
|
|
|
- listMapSum.set(sign % 10, map);
|
|
|
+ listMapSum.set(sign % max, map);
|
|
|
}
|
|
|
sign++;
|
|
|
}
|
|
@@ -403,16 +410,17 @@ public class DynamicSystemServiceImpl implements DynamicSystemService {
|
|
|
final Map<String, List<String>> equmentOneColumn = getEqumentOneColumnTimeLimit(hbaseTableName, chosedatas, limit,start,end);
|
|
|
for (String chosedata : chosedatas) {
|
|
|
final List<String> strings = equmentOneColumn.get(chosedata);
|
|
|
- for (int i = 0; i < 10; i++) {
|
|
|
+ int max = Math.min(10,strings.size());
|
|
|
+ for (int i = 0; i < max; i++) {
|
|
|
final String s = strings.get(i);
|
|
|
final HashMap<String, Object> clumData = new HashMap<>();
|
|
|
clumData.put(subEquipmentID + "_" + chosedata, s);
|
|
|
- if (sign < 10) {
|
|
|
+ if (sign < max) {
|
|
|
listMapSum.add(clumData);
|
|
|
} else {
|
|
|
- final Map map = listMapSum.get(sign % 10);
|
|
|
+ final Map map = listMapSum.get(sign % max);
|
|
|
map.putAll(clumData);
|
|
|
- listMapSum.set(sign % 10, map);
|
|
|
+ listMapSum.set(sign % max, map);
|
|
|
}
|
|
|
sign++;
|
|
|
}
|