|
@@ -828,24 +828,26 @@ public class AnalysisDataImpl {
|
|
|
*/
|
|
|
public void acousticRadar(File file, String eqId) {
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
+ HashMap<String, ArrayList<Double>> wsStaMapList = new HashMap<>();
|
|
|
CsvReader reader = CsvUtil.getReader();
|
|
|
//解析csv文件设置编码为GBK
|
|
|
CsvData data = reader.read(file, Charset.forName("gbk"));
|
|
|
//获取到csv文件
|
|
|
List<CsvRow> rows = data.getRows();
|
|
|
//获取层高
|
|
|
- List<WindTowerInfo> equipmentNo = windTowerInfoService.getByEquipmentNo(eqId);
|
|
|
+ List<WindTowerInfo> equipmentNo = windTowerInfoService.lambdaQuery().eq(WindTowerInfo::getEquipmentNo,eqId).list();
|
|
|
String height = "";
|
|
|
if (equipmentNo.size() == 0) {
|
|
|
CsvRow csvRow = rows.get(0);
|
|
|
StringBuilder heights = new StringBuilder();
|
|
|
- for (String s : csvRow) {
|
|
|
- if (s.contains("高度")) {
|
|
|
+ for (int i = csvRow.size() - 1; i >= 0; i--) {
|
|
|
+ if (csvRow.get(i).contains("高度")) {
|
|
|
if (heights.length() != 0) {
|
|
|
heights.append(",");
|
|
|
}
|
|
|
- heights.append(CalculationUtil.getNumberFromString(s));
|
|
|
+ heights.append(CalculationUtil.getNumberFromString(csvRow.get(i)));
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
height = heights.toString();
|
|
|
WindTowerInfo windTowerInfo = new WindTowerInfo();
|
|
@@ -860,6 +862,7 @@ public class AnalysisDataImpl {
|
|
|
}
|
|
|
int total = 0;
|
|
|
String str = "";
|
|
|
+ boolean firstBoolean = true;
|
|
|
//遍历表头 设置表头
|
|
|
try {
|
|
|
for (String s : rows.get(0)) {
|
|
@@ -899,6 +902,7 @@ public class AnalysisDataImpl {
|
|
|
continue;
|
|
|
}
|
|
|
HashMap<String, Object> hashMap = new HashMap<>();
|
|
|
+// HashMap<String, Object> firstMap = new HashMap<>();
|
|
|
|
|
|
if (rows.get(0).contains("time")) {
|
|
|
int time = rows.get(0).indexOf("time");
|
|
@@ -908,43 +912,66 @@ public class AnalysisDataImpl {
|
|
|
if (time1.contains("000000000000")) {
|
|
|
continue;
|
|
|
}
|
|
|
- hashMap.put("time", time1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- BigDecimal tAve = conversion("t_ave", row, rows);
|
|
|
- hashMap.put("tAve", tAve);
|
|
|
- CheckDataRecode.map.put("tAve" + "DeadDataStartTime", new DateTime(sdf.parse(time1)));
|
|
|
+ for (String h : height.split(",")) {
|
|
|
|
|
|
- BigDecimal rhAve = conversion("rh_ave", row, rows);
|
|
|
- hashMap.put("rhAve", rhAve);
|
|
|
- CheckDataRecode.map.put("rhAve" + "DeadDataStartTime", new DateTime(sdf.parse(time1)));
|
|
|
+ BigDecimal wsAve = conversion("ws_Ave" + h, row, rows);
|
|
|
+ if (wsStaMapList.get(h) == null) {
|
|
|
+ ArrayList<Double> wsStaList = new ArrayList<>();
|
|
|
+ wsStaList.add(wsAve.doubleValue());
|
|
|
+ wsStaMapList.put(h, wsStaList);
|
|
|
+ } else {
|
|
|
+ wsStaMapList.get(h).add(wsAve.doubleValue());
|
|
|
+ }
|
|
|
|
|
|
- BigDecimal paAve = conversion("pa_ave", row, rows);
|
|
|
- hashMap.put("paAve", paAve);
|
|
|
- CheckDataRecode.map.put("paAve" + "DeadDataStartTime", new DateTime(sdf.parse(time1)));
|
|
|
|
|
|
- BigDecimal airDensity = BigDecimal.valueOf(1.293).multiply(new BigDecimal(273).divide(new BigDecimal(273).add(CalculationUtil.getBigDecimal(tAve)), 2, RoundingMode.HALF_UP)).multiply(CalculationUtil.getBigDecimal(paAve)).divide(new BigDecimal(1013), 2, RoundingMode.HALF_UP);
|
|
|
- hashMap.put("airDensity", airDensity);
|
|
|
- CheckDataRecode.map.put("airDensity" + "DeadDataStartTime", new DateTime(sdf.parse(time1)));
|
|
|
+ }
|
|
|
|
|
|
- for (String h : height.split(",")) {
|
|
|
+ if ((sdf.parse(time1).getMinutes() % 10) == 0) {
|
|
|
+ hashMap.put("time", time1);
|
|
|
+ BigDecimal tAve = conversion("t_ave", row, rows);
|
|
|
+ hashMap.put("tAve", tAve);
|
|
|
+ CheckDataRecode.map.put("tAve" + "DeadDataStartTime", new DateTime(sdf.parse(time1)));
|
|
|
|
|
|
- BigDecimal wsAve = conversion("ws_Ave" + h, row, rows);
|
|
|
- hashMap.put("wsAve_" + h, wsAve);
|
|
|
- CheckDataRecode.map.put("wsAve_" + h + "DeadDataStartTime", new DateTime(sdf.parse(time1)));
|
|
|
+ BigDecimal rhAve = conversion("rh_ave", row, rows);
|
|
|
+ hashMap.put("rhAve", rhAve);
|
|
|
+ CheckDataRecode.map.put("rhAve" + "DeadDataStartTime", new DateTime(sdf.parse(time1)));
|
|
|
+
|
|
|
+ BigDecimal paAve = conversion("pa_ave", row, rows);
|
|
|
+ hashMap.put("paAve", paAve);
|
|
|
+ CheckDataRecode.map.put("paAve" + "DeadDataStartTime", new DateTime(sdf.parse(time1)));
|
|
|
+
|
|
|
+ BigDecimal airDensity = BigDecimal.valueOf(1.293).multiply(new BigDecimal(273).divide(new BigDecimal(273).add(CalculationUtil.getBigDecimal(tAve)), 2, RoundingMode.HALF_UP)).multiply(CalculationUtil.getBigDecimal(paAve)).divide(new BigDecimal(1013), 2, RoundingMode.HALF_UP);
|
|
|
+ hashMap.put("airDensity", airDensity);
|
|
|
+ CheckDataRecode.map.put("airDensity" + "DeadDataStartTime", new DateTime(sdf.parse(time1)));
|
|
|
+
|
|
|
+ for (Map.Entry<String, ArrayList<Double>> entry : wsStaMapList.entrySet()) {
|
|
|
|
|
|
- BigDecimal wdAve = conversion("wd_Ave" + h, row, rows);
|
|
|
- hashMap.put("wdAve_" + h, wdAve);
|
|
|
- CheckDataRecode.map.put("wdAve_" + h + "DeadDataStartTime", new DateTime(sdf.parse(time1)));
|
|
|
+ BigDecimal wsAve = conversion("ws_Ave" + entry.getKey(), row, rows);
|
|
|
+ hashMap.put("wsAve_" + entry.getKey(), wsAve);
|
|
|
+ CheckDataRecode.map.put("wsAve_" + entry.getKey() + "DeadDataStartTime", new DateTime(sdf.parse(time1)));
|
|
|
|
|
|
+
|
|
|
+ BigDecimal wdAve = conversion("wd_Ave" + entry.getKey(), row, rows);
|
|
|
+ hashMap.put("wdAve_" + entry.getKey(), wdAve);
|
|
|
+ CheckDataRecode.map.put("wdAve_" + entry.getKey() + "DeadDataStartTime", new DateTime(sdf.parse(time1)));
|
|
|
+
|
|
|
+ hashMap.put("wsSta_" + entry.getKey(), CalculationUtil.calculateSD(entry.getValue()));
|
|
|
+ CheckDataRecode.map.put("wsSta_" + entry.getKey() + "DeadDataStartTime", new DateTime(sdf.parse(time1)));
|
|
|
+ }
|
|
|
+// if(firstBoolean){
|
|
|
+// firstMap = hashMap;
|
|
|
+// firstBoolean = false;
|
|
|
+// }
|
|
|
+ mapList.add(hashMap);
|
|
|
+ wsStaMapList = new HashMap<>();
|
|
|
}
|
|
|
- mapList.add(hashMap);
|
|
|
}
|
|
|
|
|
|
//过滤数据
|
|
|
List<Map<String, Object>> mapList1 = new CheckDataRecode().checkValue(mapList, "sld");
|
|
|
-
|
|
|
windTowerDataParentTableService.packageData(mapList1, eqId, time1, "sld", "");
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -1032,7 +1059,7 @@ public class AnalysisDataImpl {
|
|
|
if (file1.isDirectory()) {
|
|
|
File[] files1 = file1.listFiles();
|
|
|
//筛选包含.log后缀的文件
|
|
|
- List<File> fileNameList = Arrays.asList(files1).stream().filter(f -> !f.isDirectory() && f.getName().substring(f.getName().lastIndexOf(".")).contains(".log")).collect(Collectors.toList());
|
|
|
+ List<File> fileNameList = Arrays.asList(files1).stream().filter(f -> !f.isDirectory() && f.getName().substring(f.getName().lastIndexOf(".")).contains(".log")).collect(Collectors.toList());
|
|
|
//循环文件名
|
|
|
for (File fileNameForELog : fileNameList) {
|
|
|
String fileName = fileNameForELog.getName().substring(0, fileNameForELog.getName().indexOf(".log"));
|