|
@@ -326,7 +326,14 @@ public class DynamicSystemServiceImpl implements DynamicSystemService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Map<String, List<String>> getEqumentOneColumnTimeLimit(String hbaseTableName, String[] needFileds, Integer limit,Long start,Long end) {
|
|
public Map<String, List<String>> getEqumentOneColumnTimeLimit(String hbaseTableName, String[] needFileds, Integer limit,Long start,Long end) {
|
|
- String[] fileds = needFileds;
|
|
|
|
|
|
+ String[] fileds = new String[needFileds.length];
|
|
|
|
+ for(int i = 0; i < fileds.length; i++){
|
|
|
|
+ if(!needFileds[i].equals("time") ){
|
|
|
|
+ fileds[i] = needFileds[i] + "_after";
|
|
|
|
+ }else{
|
|
|
|
+ fileds[i] = needFileds[i];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
final List<Map> equmentAll = getContentTimeLimit(hbaseTableName, limit,start,end);
|
|
final List<Map> equmentAll = getContentTimeLimit(hbaseTableName, limit,start,end);
|
|
Map<String, List<String>> needColumnMap = new HashMap<>();
|
|
Map<String, List<String>> needColumnMap = new HashMap<>();
|
|
if (equmentAll.size() == 0) return needColumnMap;
|
|
if (equmentAll.size() == 0) return needColumnMap;
|
|
@@ -452,11 +459,17 @@ public class DynamicSystemServiceImpl implements DynamicSystemService {
|
|
}
|
|
}
|
|
|
|
|
|
public String runSave_coal(Map map) {
|
|
public String runSave_coal(Map map) {
|
|
|
|
+ List choosedataZh = (List<String>)map.get("chosedataZh");
|
|
StringBuilder s = new StringBuilder();
|
|
StringBuilder s = new StringBuilder();
|
|
String hbaseTableName = (String) map.get("hbaseTableName");
|
|
String hbaseTableName = (String) map.get("hbaseTableName");
|
|
if (hbaseTableName.length()==0|| "".equals(hbaseTableName)) return "数据源为空!!!";
|
|
if (hbaseTableName.length()==0|| "".equals(hbaseTableName)) return "数据源为空!!!";
|
|
List choosedatas = (List<String>) map.get("chosedata");
|
|
List choosedatas = (List<String>) map.get("chosedata");
|
|
if(choosedatas.size() ==0) return "请选择字段!!!";
|
|
if(choosedatas.size() ==0) return "请选择字段!!!";
|
|
|
|
+ if(choosedataZh.size() == 0){
|
|
|
|
+ for(int i = 0; i < choosedatas.size(); i++){
|
|
|
|
+ choosedataZh.add(choosedatas.get(i));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
String newFileName = (String) map.get("newFileName");
|
|
String newFileName = (String) map.get("newFileName");
|
|
String oldFileName = (String) map.get("oldFileName");
|
|
String oldFileName = (String) map.get("oldFileName");
|
|
// System.out.println(oldFileName+"--->"+newFileName);
|
|
// System.out.println(oldFileName+"--->"+newFileName);
|
|
@@ -468,6 +481,7 @@ public class DynamicSystemServiceImpl implements DynamicSystemService {
|
|
FileUtil.mkdir(path);
|
|
FileUtil.mkdir(path);
|
|
}
|
|
}
|
|
String filed = new String();
|
|
String filed = new String();
|
|
|
|
+ String filedZh = new String();
|
|
List<String> fileds = new ArrayList<>();
|
|
List<String> fileds = new ArrayList<>();
|
|
|
|
|
|
String[] chooseDates = (String[]) choosedatas.toArray(new String[choosedatas.size()]);
|
|
String[] chooseDates = (String[]) choosedatas.toArray(new String[choosedatas.size()]);
|
|
@@ -476,12 +490,13 @@ public class DynamicSystemServiceImpl implements DynamicSystemService {
|
|
final Map<String, List<String>> equmentOneColumn = getEqumentOneColumnTimeLimit(hbaseTableName, chooseDates, 1000,start,end);
|
|
final Map<String, List<String>> equmentOneColumn = getEqumentOneColumnTimeLimit(hbaseTableName, chooseDates, 1000,start,end);
|
|
if (equmentOneColumn.isEmpty()) return "数据为空,请检查数据源中是否有数据!!";
|
|
if (equmentOneColumn.isEmpty()) return "数据为空,请检查数据源中是否有数据!!";
|
|
for (int i = 0; i < choosedatas.size(); i++) {
|
|
for (int i = 0; i < choosedatas.size(); i++) {
|
|
- filed = (String) choosedatas.get(i);
|
|
|
|
|
|
+ filed = choosedatas.get(i).equals("time")?(String) choosedatas.get(i):(String) choosedatas.get(i)+"_after";
|
|
|
|
+ filedZh = (String) choosedataZh.get(i);
|
|
// 添加表头
|
|
// 添加表头
|
|
if (i == 0) {
|
|
if (i == 0) {
|
|
- fileds.add(filed);
|
|
|
|
|
|
+ fileds.add(filedZh);
|
|
} else {
|
|
} else {
|
|
- fileds.set(0, fileds.get(0) + "," + filed);
|
|
|
|
|
|
+ fileds.set(0, fileds.get(0) + "," + filedZh);
|
|
}
|
|
}
|
|
final List<String> columns = equmentOneColumn.get(filed);
|
|
final List<String> columns = equmentOneColumn.get(filed);
|
|
// List<Subeqpdemo> subeqpdemos = subeqpdemoMapper.getSelectFiled(hbaseTableName, filed);
|
|
// List<Subeqpdemo> subeqpdemos = subeqpdemoMapper.getSelectFiled(hbaseTableName, filed);
|
|
@@ -529,7 +544,6 @@ public class DynamicSystemServiceImpl implements DynamicSystemService {
|
|
}
|
|
}
|
|
return "done";
|
|
return "done";
|
|
}
|
|
}
|
|
-
|
|
|
|
// 首次创建csv文件
|
|
// 首次创建csv文件
|
|
public String creatCSV(File creatFileName, List<String> fileds) throws IOException {
|
|
public String creatCSV(File creatFileName, List<String> fileds) throws IOException {
|
|
BufferedWriter bw = null;
|
|
BufferedWriter bw = null;
|