|
@@ -320,6 +320,7 @@ public class DynamicSystemServiceImpl implements DynamicSystemService {
|
|
|
String[] fileds = needFileds;
|
|
|
final List<Map> equmentAll = getContentTimeLimit(hbaseTableName, limit,start,end);
|
|
|
Map<String, List<String>> needColumnMap = new HashMap<>();
|
|
|
+ if (equmentAll.size() == 0) return needColumnMap;
|
|
|
for (String filed : fileds) {
|
|
|
List<String> needOneLists = new ArrayList();
|
|
|
for (Map map : equmentAll) {
|
|
@@ -371,7 +372,7 @@ 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++) {
|
|
|
+ for (int i = 0; i < 10 && i < strings.size(); i++) {
|
|
|
final String s = strings.get(i);
|
|
|
final HashMap<String, Object> clumData = new HashMap<>();
|
|
|
clumData.put(subEquipmentID + "_" + chosedata, s);
|
|
@@ -423,19 +424,28 @@ public class DynamicSystemServiceImpl implements DynamicSystemService {
|
|
|
|
|
|
@Override
|
|
|
public String runSave(Map map) {
|
|
|
- runSave_coal(map);
|
|
|
+ String s = runSave_coal(map);
|
|
|
Date date = new Date();
|
|
|
SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
|
|
- String info = ft.format(date) + " 设备名称 :" + (String) map.get("equipment") + "." + map.get("subEquipment")
|
|
|
- + " 抽取字段:" + map.get("chosedata") + " 抽取成功!!";
|
|
|
+ String info = "";
|
|
|
+ if(s.equals("done")){
|
|
|
+ info = ft.format(date) + " 设备名称 :" + (String) map.get("equipment") + "." + map.get("subEquipment")
|
|
|
+ + " 抽取字段:" + map.get("chosedata") + " 抽取成功!!";
|
|
|
+ }else {
|
|
|
+ info = s;
|
|
|
+ }
|
|
|
+
|
|
|
Map<String, String> redata = new HashMap<>();
|
|
|
redata.put("info", info);
|
|
|
return JSON.toJSONString(redata);
|
|
|
}
|
|
|
|
|
|
- public void runSave_coal(Map map) {
|
|
|
+ public String runSave_coal(Map map) {
|
|
|
+ StringBuilder s = new StringBuilder();
|
|
|
String hbaseTableName = (String) map.get("hbaseTableName");
|
|
|
+ if (hbaseTableName.length()==0|| "".equals(hbaseTableName)) return "数据源为空!!!";
|
|
|
List choosedatas = (List<String>) map.get("chosedata");
|
|
|
+ if(choosedatas.size() ==0) return "请选择字段!!!";
|
|
|
String newFileName = (String) map.get("newFileName");
|
|
|
String oldFileName = (String) map.get("oldFileName");
|
|
|
// System.out.println(oldFileName+"--->"+newFileName);
|
|
@@ -453,6 +463,7 @@ public class DynamicSystemServiceImpl implements DynamicSystemService {
|
|
|
Long start = (Long) map.getOrDefault("start",0l);
|
|
|
Long end = (Long) map.getOrDefault("end",new Date().getTime());
|
|
|
final Map<String, List<String>> equmentOneColumn = getEqumentOneColumnTimeLimit(hbaseTableName, chooseDates, 1000,start,end);
|
|
|
+ if (equmentOneColumn.isEmpty()) return "数据为空,请检查数据源中是否有数据!!";
|
|
|
for (int i = 0; i < choosedatas.size(); i++) {
|
|
|
filed = (String) choosedatas.get(i);
|
|
|
// 添加表头
|
|
@@ -505,6 +516,7 @@ public class DynamicSystemServiceImpl implements DynamicSystemService {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
+ return "done";
|
|
|
}
|
|
|
|
|
|
// 首次创建csv文件
|