|
@@ -13,6 +13,7 @@ import com.cpp.web.service.datafactory.ParsingLogService;
|
|
|
import com.cpp.web.utils.DateTimeUtil;
|
|
|
import com.cpp.web.utils.NumberUtils;
|
|
|
import com.cpp.web.utils.ParsingFileUtil;
|
|
|
+import com.cpp.web.utils.ParsingUtil;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.io.FileUtils;
|
|
@@ -64,7 +65,8 @@ public class CloudFileParsing {
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
- @Scheduled(fixedRate = 300000L)
|
|
|
+// @Scheduled(fixedRate = 300000L)
|
|
|
+ @Scheduled(fixedRate = 60000L)
|
|
|
public void parsingFile() {
|
|
|
{
|
|
|
log.info("-----------------开始执行预测文件解析任务----------------------");
|
|
@@ -168,6 +170,7 @@ public class CloudFileParsing {
|
|
|
|
|
|
if (flag) {
|
|
|
parsingLog.setParsingFileStatus("成功");
|
|
|
+ moveFile(file);
|
|
|
} else {
|
|
|
parsingLog.setParsingFileStatus("失败");
|
|
|
abnormalAlarms.add(new AbnormalAlarm(DataSourcesEnum.E2,AlarmEnum.E4,parsingLog.getParsingDescribe(),""));
|
|
@@ -220,10 +223,10 @@ public class CloudFileParsing {
|
|
|
//NWP文件按照Tab方式截取
|
|
|
String[] datas = lineTxt.split("\t");
|
|
|
|
|
|
- if (datas.length == 4 && datas[0].startsWith("<集中")) {
|
|
|
+ if (datas[0].startsWith("<集中")) {
|
|
|
+ stationCode = ParsingUtil.splitLineWithSpace(datas[0])[1].split("'")[1];
|
|
|
// 使用单引号分割字符串
|
|
|
- stationCode = datas[1].split("'")[1];
|
|
|
- forecastModel = datas[2].split("'")[1];
|
|
|
+ forecastModel = ParsingUtil.splitLineWithSpace(datas[0])[2].split("'")[1];
|
|
|
}
|
|
|
|
|
|
|
|
@@ -377,15 +380,13 @@ public class CloudFileParsing {
|
|
|
while ((stringLine = bufferedReader.readLine()) != null) {
|
|
|
|
|
|
String[] string_arr = stringLine.split("\t");
|
|
|
+ if (string_arr[0].startsWith("<集中")) {
|
|
|
+ stationCode = ParsingUtil.splitLineWithSpace(string_arr[0])[1].split("'")[1];
|
|
|
+ // 使用单引号分割字符串
|
|
|
+ forecastModel = ParsingUtil.splitLineWithSpace(string_arr[0])[2].split("'")[1];
|
|
|
+ }
|
|
|
|
|
|
if (string_arr.length == 4) {
|
|
|
-
|
|
|
- if (string_arr[0].startsWith("<集中")) {
|
|
|
- // 使用单引号分割字符串
|
|
|
- stationCode = string_arr[1].split("'")[1];
|
|
|
- forecastModel = string_arr[2].split("'")[1];
|
|
|
- }
|
|
|
-
|
|
|
if (!stationCode.equals("") && !forecastModel.equals("") && string_arr[0].startsWith("#")) {
|
|
|
if (StringUtils.isNotEmpty(string_arr[2])) {
|
|
|
Date time = sdf.parse(string_arr[2]);
|