|
@@ -130,79 +130,79 @@ public class ParsingNwpInfoServiceImpl extends ServiceImpl<ParsingNwpInfoMapper,
|
|
|
String fileMonth = fileName.substring(8, 10);
|
|
|
String fileDay = fileName.substring(10, 12);
|
|
|
String fileDate = fileYear + "-" + fileMonth + "-" + fileDay;
|
|
|
-
|
|
|
- List<JiaYueWindPowerNwpResultCover> jiaYueWindPowerNwpResultCovers = jiaYueWindPowerNwpResultCoverService.getByDataDateAndDateTime(fileDate, fileTime, electricFieldService.numberToIdentification(parsingUrl.getStationCode()));
|
|
|
- if (jiaYueWindPowerNwpResultCovers == null || jiaYueWindPowerNwpResultCovers.size() == 0) {
|
|
|
- if (!parsingNwpInfos.isEmpty()) {
|
|
|
- for (ParsingNwpInfo parsingNwpInfo : parsingNwpInfos) {
|
|
|
- //判断文件名是否符合配置
|
|
|
- if (file.getName().contains(parsingNwpInfo.getFileName())) {
|
|
|
- List<String> fileContent = FileUtil.getFileContent(file);
|
|
|
- if (parsingNwpInfo.getDataType().equals(FieldUtil.MULTI)) {
|
|
|
- Long time = parsingTime(parsingNwpInfo.getPreTime(), fileContent);
|
|
|
- if (fileNameHour.equals("05")){
|
|
|
- time = time +Constant.INTERVALTIME*24L;
|
|
|
- }
|
|
|
- if (fileNameHour.equals("13")){
|
|
|
- time = time +Constant.INTERVALTIME*48L;
|
|
|
- }
|
|
|
- if (fileNameHour.equals("17")){
|
|
|
- time = time +Constant.INTERVALTIME*72L;
|
|
|
- }
|
|
|
- if (time != 0l) {
|
|
|
- List<BigDecimal> ws10s = parsingNwpValue(parsingNwpInfo.getWs10(), fileContent);
|
|
|
- List<BigDecimal> wd10s = parsingNwpValue(parsingNwpInfo.getWd10(), fileContent);
|
|
|
- List<BigDecimal> ws30s = parsingNwpValue(parsingNwpInfo.getWs30(), fileContent);
|
|
|
- List<BigDecimal> wd30s = parsingNwpValue(parsingNwpInfo.getWd30(), fileContent);
|
|
|
- List<BigDecimal> ws50s = parsingNwpValue(parsingNwpInfo.getWs50(), fileContent);
|
|
|
- List<BigDecimal> wd50s = parsingNwpValue(parsingNwpInfo.getWd50(), fileContent);
|
|
|
- List<BigDecimal> ws70s = parsingNwpValue(parsingNwpInfo.getWs70(), fileContent);
|
|
|
- List<BigDecimal> wd70s = parsingNwpValue(parsingNwpInfo.getWd70(), fileContent);
|
|
|
- List<BigDecimal> ws80s = parsingNwpValue(parsingNwpInfo.getWs80(), fileContent);
|
|
|
- List<BigDecimal> wd80s = parsingNwpValue(parsingNwpInfo.getWd80(), fileContent);
|
|
|
- List<BigDecimal> ws90s = parsingNwpValue(parsingNwpInfo.getWs90(), fileContent);
|
|
|
- List<BigDecimal> wd90s = parsingNwpValue(parsingNwpInfo.getWd90(), fileContent);
|
|
|
- List<BigDecimal> ws100s = parsingNwpValue(parsingNwpInfo.getWs100(), fileContent);
|
|
|
- List<BigDecimal> wd100s = parsingNwpValue(parsingNwpInfo.getWd100(), fileContent);
|
|
|
- List<BigDecimal> ws170s = parsingNwpValue(parsingNwpInfo.getWs170(), fileContent);
|
|
|
- List<BigDecimal> wd170s = parsingNwpValue(parsingNwpInfo.getWd170(), fileContent);
|
|
|
- List<BigDecimal> rhs = parsingNwpValue(parsingNwpInfo.getRh(), fileContent);
|
|
|
- List<BigDecimal> pressures = parsingNwpValue(parsingNwpInfo.getPressure(), fileContent);
|
|
|
- List<BigDecimal> swrs = parsingNwpValue(parsingNwpInfo.getSwr(), fileContent);
|
|
|
- List<BigDecimal> ts = parsingNwpValue(parsingNwpInfo.getT(), fileContent);
|
|
|
-
|
|
|
-
|
|
|
- //以十米风速为基准
|
|
|
- for (int i = 0; i < ws10s.size(); i++) {
|
|
|
- // 将文件名中日期转换为time类型
|
|
|
- Time timeStr = Time.valueOf(fileTime);
|
|
|
- // 时间戳转换为时间戳转换为LocalDateTime
|
|
|
- LocalDateTime combinedDateTime = Instant.ofEpochMilli(time).atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
|
- // LocalDateTime转换为Date
|
|
|
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- Date da = simpleDateFormat.parse(fileDate);
|
|
|
-
|
|
|
- // 存入默认数据库(远端)
|
|
|
- jiaYueWindPowerNwpResultCoverList.add(this.jiaYueWindPowerNwpResultCover(combinedDateTime, electricFieldService.numberToIdentification(parsingUrl.getStationCode()), da, timeStr, pressures, rhs
|
|
|
- , swrs, ts, ws10s, wd10s, ws30s, wd30s, ws50s, wd50s, ws70s, wd70s, ws80s, wd80s, ws90s, wd90s, ws100s, wd100s, ws170s, wd170s, i));
|
|
|
- time += Constant.INTERVALTIME;
|
|
|
+ //判断文件名是否符合配置
|
|
|
+ if (file.getName().contains(parsingNwpInfo1.getFileName())) {
|
|
|
+ List<JiaYueWindPowerNwpResultCover> jiaYueWindPowerNwpResultCovers = jiaYueWindPowerNwpResultCoverService.getByDataDateAndDateTime(fileDate, fileTime, electricFieldService.numberToIdentification(parsingUrl.getStationCode()));
|
|
|
+ if (jiaYueWindPowerNwpResultCovers == null || jiaYueWindPowerNwpResultCovers.size() == 0) {
|
|
|
+
|
|
|
+ List<String> fileContent = FileUtil.getFileContent(file);
|
|
|
+ if (parsingNwpInfo1.getDataType().equals(FieldUtil.MULTI)) {
|
|
|
+ Long time = parsingTime(parsingNwpInfo1.getPreTime(), fileContent);
|
|
|
+ if (fileNameHour.equals("05")) {
|
|
|
+ time = time + Constant.INTERVALTIME * 24L;
|
|
|
+ }
|
|
|
+ if (fileNameHour.equals("13")) {
|
|
|
+ time = time + Constant.INTERVALTIME * 48L;
|
|
|
+ }
|
|
|
+ if (fileNameHour.equals("17")) {
|
|
|
+ time = time + Constant.INTERVALTIME * 72L;
|
|
|
+ }
|
|
|
+ if (time != 0l) {
|
|
|
+ List<BigDecimal> ws10s = parsingNwpValue(parsingNwpInfo1.getWs10(), fileContent);
|
|
|
+ List<BigDecimal> wd10s = parsingNwpValue(parsingNwpInfo1.getWd10(), fileContent);
|
|
|
+ List<BigDecimal> ws30s = parsingNwpValue(parsingNwpInfo1.getWs30(), fileContent);
|
|
|
+ List<BigDecimal> wd30s = parsingNwpValue(parsingNwpInfo1.getWd30(), fileContent);
|
|
|
+ List<BigDecimal> ws50s = parsingNwpValue(parsingNwpInfo1.getWs50(), fileContent);
|
|
|
+ List<BigDecimal> wd50s = parsingNwpValue(parsingNwpInfo1.getWd50(), fileContent);
|
|
|
+ List<BigDecimal> ws70s = parsingNwpValue(parsingNwpInfo1.getWs70(), fileContent);
|
|
|
+ List<BigDecimal> wd70s = parsingNwpValue(parsingNwpInfo1.getWd70(), fileContent);
|
|
|
+ List<BigDecimal> ws80s = parsingNwpValue(parsingNwpInfo1.getWs80(), fileContent);
|
|
|
+ List<BigDecimal> wd80s = parsingNwpValue(parsingNwpInfo1.getWd80(), fileContent);
|
|
|
+ List<BigDecimal> ws90s = parsingNwpValue(parsingNwpInfo1.getWs90(), fileContent);
|
|
|
+ List<BigDecimal> wd90s = parsingNwpValue(parsingNwpInfo1.getWd90(), fileContent);
|
|
|
+ List<BigDecimal> ws100s = parsingNwpValue(parsingNwpInfo1.getWs100(), fileContent);
|
|
|
+ List<BigDecimal> wd100s = parsingNwpValue(parsingNwpInfo1.getWd100(), fileContent);
|
|
|
+ List<BigDecimal> ws170s = parsingNwpValue(parsingNwpInfo1.getWs170(), fileContent);
|
|
|
+ List<BigDecimal> wd170s = parsingNwpValue(parsingNwpInfo1.getWd170(), fileContent);
|
|
|
+ List<BigDecimal> rhs = parsingNwpValue(parsingNwpInfo1.getRh(), fileContent);
|
|
|
+ List<BigDecimal> pressures = parsingNwpValue(parsingNwpInfo1.getPressure(), fileContent);
|
|
|
+ List<BigDecimal> swrs = parsingNwpValue(parsingNwpInfo1.getSwr(), fileContent);
|
|
|
+ List<BigDecimal> ts = parsingNwpValue(parsingNwpInfo1.getT(), fileContent);
|
|
|
+
|
|
|
+
|
|
|
+ //以十米风速为基准
|
|
|
+ for (int i = 0; i < ws10s.size(); i++) {
|
|
|
+ // 将文件名中日期转换为time类型
|
|
|
+ Time timeStr = Time.valueOf(fileTime);
|
|
|
+ // 时间戳转换为时间戳转换为LocalDateTime
|
|
|
+ LocalDateTime combinedDateTime = Instant.ofEpochMilli(time).atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
|
+ // LocalDateTime转换为Date
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date da = simpleDateFormat.parse(fileDate);
|
|
|
+
|
|
|
+ // 存入默认数据库(远端)
|
|
|
+ jiaYueWindPowerNwpResultCoverList.add(this.jiaYueWindPowerNwpResultCover(combinedDateTime, electricFieldService.numberToIdentification(parsingUrl.getStationCode()), da, timeStr, pressures, rhs
|
|
|
+ , swrs, ts, ws10s, wd10s, ws30s, wd30s, ws50s, wd50s, ws70s, wd70s, ws80s, wd80s, ws90s, wd90s, ws100s, wd100s, ws170s, wd170s, i));
|
|
|
+ time += Constant.INTERVALTIME;
|
|
|
// time1+= Constant.INTERVALTIME;
|
|
|
- }
|
|
|
-
|
|
|
- jiaYueWindPowerNwpResultCoverService.saveNwp(jiaYueWindPowerNwpResultCoverList, electricFieldService.numberToIdentification(parsingUrl.getStationCode()));
|
|
|
- parsingStatus = FileTypeEnum.NWP72.name();
|
|
|
- log.info("解析Nwp文件:{} 成功! O(∩_∩)O", file.getName());
|
|
|
- } else {
|
|
|
- parsingStatus += "解析Nwp文件时间错误";
|
|
|
- log.error("解析Nwp文件时间错误");
|
|
|
- }
|
|
|
- } else {
|
|
|
- parsingStatus += "nwp暂无单行解析方式";
|
|
|
- log.info("nwp暂无单行解析方式");
|
|
|
}
|
|
|
+
|
|
|
+ jiaYueWindPowerNwpResultCoverService.saveNwp(jiaYueWindPowerNwpResultCoverList, electricFieldService.numberToIdentification(parsingUrl.getStationCode()));
|
|
|
+ parsingStatus = FileTypeEnum.NWP72.name();
|
|
|
+ log.info("解析Nwp文件:{} 成功! O(∩_∩)O", file.getName());
|
|
|
+ } else {
|
|
|
+ parsingStatus += "解析Nwp文件时间错误";
|
|
|
+ log.error("解析Nwp文件时间错误");
|
|
|
}
|
|
|
+ } else {
|
|
|
+ parsingStatus += "nwp暂无单行解析方式";
|
|
|
+ log.info("nwp暂无单行解析方式");
|
|
|
}
|
|
|
+ }else {
|
|
|
+ parsingStatus += "该时间点文件已经解析过,无需再次解析";
|
|
|
+ log.info("已经解析过相同时间点的文件无需再次解析");
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
parsingStatus += "解析Nwp数据失败";
|
|
@@ -266,7 +266,8 @@ public class ParsingNwpInfoServiceImpl extends ServiceImpl<ParsingNwpInfoMapper,
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * nwp数据
|
|
|
+ * nwp数据
|
|
|
+ *
|
|
|
* @param localDateTime
|
|
|
* @param objId
|
|
|
* @param date
|