|
@@ -106,7 +106,7 @@ public class CloudFileParsing {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
// 如果文件名长度符合规则
|
|
// 如果文件名长度符合规则
|
|
- if (fileName.length() < 31) {
|
|
|
|
|
|
+// if (fileName.length() < 31) {
|
|
String stationCode = findStationCode(fileName);
|
|
String stationCode = findStationCode(fileName);
|
|
if (!stationCode.equals("null")) {
|
|
if (!stationCode.equals("null")) {
|
|
// 如果是短期文件
|
|
// 如果是短期文件
|
|
@@ -202,7 +202,7 @@ public class CloudFileParsing {
|
|
moveFileError(file);
|
|
moveFileError(file);
|
|
}
|
|
}
|
|
parsingLogs.add(parsingLog);
|
|
parsingLogs.add(parsingLog);
|
|
- }
|
|
|
|
|
|
+// }
|
|
}
|
|
}
|
|
if (parsingLogs.size() > 0) {
|
|
if (parsingLogs.size() > 0) {
|
|
parsingLogService.saveBatch(parsingLogs);
|
|
parsingLogService.saveBatch(parsingLogs);
|
|
@@ -393,25 +393,26 @@ public class CloudFileParsing {
|
|
try {
|
|
try {
|
|
read = new InputStreamReader(Files.newInputStream(file.toPath()), StandardCharsets.UTF_8);
|
|
read = new InputStreamReader(Files.newInputStream(file.toPath()), StandardCharsets.UTF_8);
|
|
bufferedReader = new BufferedReader(read);
|
|
bufferedReader = new BufferedReader(read);
|
|
-
|
|
|
|
- String forecastModel = "";
|
|
|
|
|
|
+ String fileName = file.getName();
|
|
|
|
+ String forecastModel = fileName.split("_")[2];
|
|
|
|
|
|
// 循环解析文件
|
|
// 循环解析文件
|
|
while ((stringLine = bufferedReader.readLine()) != null) {
|
|
while ((stringLine = bufferedReader.readLine()) != null) {
|
|
|
|
|
|
String[] string_arr = stringLine.split("\t");
|
|
String[] string_arr = stringLine.split("\t");
|
|
- if (string_arr[0].startsWith("<集中")) {
|
|
|
|
- forecastModel = ParsingUtil.splitLineWithSpace(string_arr[0])[2].split("'")[1];
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (string_arr.length == 4) {
|
|
|
|
- if (!stationCode.equals("") && !forecastModel.equals("") && string_arr[0].startsWith("#")) {
|
|
|
|
- if (StringUtils.isNotEmpty(string_arr[2])) {
|
|
|
|
- Date time = sdf.parse(string_arr[2]);
|
|
|
|
|
|
+// if (string_arr[0].startsWith("<集中")) {
|
|
|
|
+// forecastModel = ParsingUtil.splitLineWithSpace(string_arr[0])[2].split("'")[1];
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+ if (string_arr.length == 3) {
|
|
|
|
+// if (!stationCode.equals("") && !forecastModel.equals("") && string_arr[0].startsWith("#")) {
|
|
|
|
+ if (!stationCode.equals("") && string_arr[0].startsWith("#")) {
|
|
|
|
+ if (StringUtils.isNotEmpty(string_arr[1])) {
|
|
|
|
+ Date time = sdf.parse(string_arr[1]);
|
|
Integer howLongAgo = calcHowLongAgo(currentDate, time);
|
|
Integer howLongAgo = calcHowLongAgo(currentDate, time);
|
|
if (howLongAgo > 0) {
|
|
if (howLongAgo > 0) {
|
|
stf = new ForecastPowerShortTermCloud();
|
|
stf = new ForecastPowerShortTermCloud();
|
|
- stf.setFpValue(new BigDecimal(string_arr[3]));
|
|
|
|
|
|
+ stf.setFpValue(new BigDecimal(string_arr[2]));
|
|
stf.setTime(time);
|
|
stf.setTime(time);
|
|
stf.setForecastHowLongAgo(howLongAgo);
|
|
stf.setForecastHowLongAgo(howLongAgo);
|
|
stf.setStationCode(stationCode);
|
|
stf.setStationCode(stationCode);
|
|
@@ -420,11 +421,8 @@ public class CloudFileParsing {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
} catch (IOException | ParseException | RuntimeException e) {
|
|
} catch (IOException | ParseException | RuntimeException e) {
|
|
log.error("系统错误:", e);
|
|
log.error("系统错误:", e);
|
|
File destFile = new File(file.getPath().replaceFirst("new", "error"));
|
|
File destFile = new File(file.getPath().replaceFirst("new", "error"));
|