Bläddra i källkod

测试解析功能后的调整

tl 7 månader sedan
förälder
incheckning
9dfff934a5

+ 1 - 1
cpp-admin/pom.xml

@@ -69,7 +69,7 @@
             <artifactId>lombok</artifactId>
         </dependency>
 
-        <!--        ftp-->
+        <!-- ftp-->
         <dependency>
             <groupId>commons-net</groupId>
             <artifactId>commons-net</artifactId>

+ 14 - 48
cpp-admin/src/main/java/com/cpp/web/domain/datafactory/ParsingNwp.java

@@ -6,7 +6,8 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
-import java.io.Serializable;
+import javax.validation.constraints.Digits;
+import java.math.BigDecimal;
 
 /**
  * nwp解析配置
@@ -25,28 +26,7 @@ public class ParsingNwp extends BaseParsing {
      * 预测时间
      */
     @ApiModelProperty(value = "预测时间")
-    private String preTime;
-
-
-    /**
-     * 生成日期
-     */
-    @ApiModelProperty(value = "生成日期")
-    private String scDate;
-
-
-    /**
-     * 生成时间
-     */
-    @ApiModelProperty(value = "生成时间")
-    private String scTime;
-
-
-    /**
-     * 预测日期
-     */
-    @ApiModelProperty(value = "预测日期")
-    private String preDate;
+    private String time;
 
 
     /**
@@ -69,19 +49,11 @@ public class ParsingNwp extends BaseParsing {
     @ApiModelProperty(value = "气压")
     private String pressure;
 
-
-    /**
-     * 短波辐射
-     */
-    @ApiModelProperty(value = "短波辐射")
-    private String swr;
-
-
     /**
-     * 长波辐射
+     * 总辐射
      */
-    @ApiModelProperty(value = "长波辐射")
-    private String lwr;
+    @ApiModelProperty(value = "总辐射")
+    private String globalRadiation;
 
 
     /**
@@ -98,12 +70,6 @@ public class ParsingNwp extends BaseParsing {
     private String diffuseRadiation;
 
 
-    /**
-     * 热感通量
-     */
-    @ApiModelProperty(value = "热感通量")
-    private String senf;
-
 
     /**
      * 10米风速
@@ -154,11 +120,6 @@ public class ParsingNwp extends BaseParsing {
     private String ws100;
 
 
-    /**
-     * 170米风速
-     */
-    @ApiModelProperty(value = "170米风速")
-    private String ws170;
 
 
     /**
@@ -209,11 +170,16 @@ public class ParsingNwp extends BaseParsing {
     @ApiModelProperty(value = "100米风向")
     private String wd100;
 
+    /**
+     * 轮毂高度风速
+     */
+    @ApiModelProperty(value = "轮毂高度风速")
+    private String wsHubHeight;
 
     /**
-     * 170米风向
+     * 风机轮毂高度风向瞬时值(°)
      */
-    @ApiModelProperty(value = "170米风向")
-    private String wd170;
+    @ApiModelProperty(value = "轮毂高度风向(°)")
+    private String wdHubHeight;
 
 }

+ 12 - 30
cpp-admin/src/main/java/com/cpp/web/domain/station/NwpStation.java

@@ -64,19 +64,11 @@ public class NwpStation extends BaseCppEntity {
 
 
     /**
-     * 短波辐射
+     * 辐射
      */
-    @ApiModelProperty(value = "短波辐射")
+    @ApiModelProperty(value = "辐射")
     @Digits(integer = 10, fraction = 2)
-    private BigDecimal swr = new BigDecimal(-99);
-
-
-    /**
-     * 长波辐射
-     */
-    @ApiModelProperty(value = "长波辐射")
-    @Digits(integer = 10, fraction = 2)
-    private BigDecimal lwr = new BigDecimal(-99);
+    private BigDecimal globalRadiation = new BigDecimal(-99);
 
 
     /**
@@ -96,14 +88,6 @@ public class NwpStation extends BaseCppEntity {
 
 
     /**
-     * 热感通量
-     */
-    @ApiModelProperty(value = "热感通量")
-    @Digits(integer = 10, fraction = 2)
-    private BigDecimal senf = new BigDecimal(-99);
-
-
-    /**
      * 10米风速
      */
     @ApiModelProperty(value = "10米风速")
@@ -160,14 +144,6 @@ public class NwpStation extends BaseCppEntity {
 
 
     /**
-     * 170米风速
-     */
-    @ApiModelProperty(value = "170米风速")
-    @Digits(integer = 10, fraction = 2)
-    private BigDecimal ws170 = new BigDecimal(-99);
-
-
-    /**
      * 10米风向
      */
     @ApiModelProperty(value = "10米风向")
@@ -222,12 +198,18 @@ public class NwpStation extends BaseCppEntity {
     @Digits(integer = 10, fraction = 2)
     private BigDecimal wd100 = new BigDecimal(-99);
 
+    /**
+     * 轮毂高度风速
+     */
+    @ApiModelProperty(value = "轮毂高度风速")
+    @Digits(integer = 10, fraction = 2)
+    private BigDecimal wsHubHeight = new BigDecimal(-99);
 
     /**
-     * 170米风向
+     * 风机轮毂高度风向瞬时值(°)
      */
-    @ApiModelProperty(value = "170米风向")
+    @ApiModelProperty(value = "轮毂高度风向(°)")
     @Digits(integer = 10, fraction = 2)
-    private BigDecimal wd170 = new BigDecimal(-99);
+    private BigDecimal wdHubHeight = new BigDecimal(-99);
 
 }

+ 1 - 1
cpp-admin/src/main/java/com/cpp/web/service/cloud/CloudFileParsing.java

@@ -453,7 +453,7 @@ public class CloudFileParsing {
      * @param time
      */
     public Integer calcHowLongAgo(Date baseTime, Date time) {
-        return ((int) (time.getTime() - baseTime.getTime() % 86400000L)) + 1;
+        return ((int) ((time.getTime() - baseTime.getTime()) / 86400000L)) + 1;
     }
 
 

+ 19 - 17
cpp-admin/src/main/java/com/cpp/web/service/datafactory/SftpFileParsing.java

@@ -17,6 +17,7 @@ import com.cpp.web.domain.station.ElectricField;
 import com.cpp.web.service.AbnormalAlarmService;
 import com.cpp.web.service.station.ElectricFieldService;
 import com.cpp.web.utils.MessageUtils;
+import com.cpp.web.utils.ParsingFileUtil;
 import com.jcraft.jsch.ChannelSftp;
 import com.jcraft.jsch.JSch;
 import com.jcraft.jsch.Session;
@@ -58,11 +59,9 @@ public class SftpFileParsing {
 
     private final AbnormalAlarmService abnormalAlarmService;
 
-    private final String PARSING_FILE_TEMP_DIR = "/";
-    private final String PARSING_FILE_SUCCESS_DIR = "/";
-    private final String PARSING_FILE_FAIL_DIR = "/";
-
-    private final File fileTempDir = new File(PARSING_FILE_TEMP_DIR);
+    private final File PARSING_FILE_TEMP_DIR = ParsingFileUtil.checkGetPath(ParsingFileUtil.getSftpDownload()+File.separator+"temp");
+    private final File PARSING_FILE_SUCCESS_DIR = ParsingFileUtil.checkGetPath(ParsingFileUtil.getSftpDownload()+File.separator+"success");
+    private final File PARSING_FILE_FAIL_DIR = ParsingFileUtil.checkGetPath(ParsingFileUtil.getSftpDownload()+File.separator+"fail");
 
     private final ThreadPoolTaskExecutor executor;
 
@@ -78,7 +77,8 @@ public class SftpFileParsing {
      * @param
      * @return
      */
-    @Scheduled(fixedRate = 300000L)
+//    @Scheduled(fixedRate = 300000L)
+    @Scheduled(fixedRate = 60000L)
     public void parsingFileJob() {
 
 
@@ -118,9 +118,9 @@ public class SftpFileParsing {
         List<ParsingLog> parsingLogs = new ArrayList<>();
         List<AbnormalAlarm> abnormalAlarms = new ArrayList<>();
         for (ParsingType parsingType : parsingTypes) {
-            executor.execute(new Runnable() {
-                @Override
-                public void run() {
+//            executor.execute(new Runnable() {
+//                @Override
+//                public void run() {
                     ParsingInterface parsingInterface = parsingInterfaceMap.get(parsingType.getFileType().name() + "Parsing");
                     parsingInterface.activationParsingConf();//初始化解析配置
                     for (ElectricField electricField : channelElectricFields) {
@@ -130,9 +130,11 @@ public class SftpFileParsing {
                         if (fileNames.size() > 0) {
                             for (String fileName : fileNames) {
                                 try {
+                                    String sftpFileNameDir = ftpUrl+"/"+fileName;
+                                    String destFileNameDir = PARSING_FILE_TEMP_DIR.getPath()+File.separator+fileName;
                                     //下载文件到临时目录
-                                    sftp.download(ftpUrl, fileTempDir,fileName);
-                                    File file = FileUtils.getFile(fileTempDir, fileName);
+                                    sftp.get(sftpFileNameDir, destFileNameDir);
+                                    File file = FileUtils.getFile(PARSING_FILE_TEMP_DIR, fileName);
                                     ParsingLog parsingLog = new ParsingLog();
                                     Date now = new Date();
                                     parsingLog.setParsingTime(now);
@@ -142,14 +144,14 @@ public class SftpFileParsing {
                                     parsingLog.setDataSources(DataSourcesEnum.E1);
                                     if (parsingResultDto.getStatus().equals("fail")) {
                                         try {
-                                            File failFileDir = new File(PARSING_FILE_FAIL_DIR + File.separator + DateFormatUtils.format(now, "yyyy-MM-DD"));
+                                            File failFileDir = new File(PARSING_FILE_FAIL_DIR.getPath() + File.separator + DateFormatUtils.format(now, "yyyy-MM-dd"));
                                             File failFile = new File(failFileDir.getPath() + File.separator + fileName);
                                             if (failFile.exists()) {
                                                 failFile.delete();
                                                 log.error("已有过解析失败文件,错误文件将覆盖!场站编号:{},文件名称:{}", electricField.getStationCode(), fileName);
                                             }
 
-                                            FileUtils.moveFile(file, failFileDir);
+                                            ParsingFileUtil.move(file.getAbsolutePath(), failFileDir.getAbsolutePath(),true);
                                         } catch (IOException e) {
                                             log.error("解析文件失败后文件移动失败!场站编号:{},文件名称:{}", electricField.getStationCode(), fileName, e);
                                             e.printStackTrace();
@@ -163,14 +165,14 @@ public class SftpFileParsing {
                                         sftp.delFile(ftpUrl + "/" + fileName);//成功删除ftp上的文件
 
                                         try {
-                                            File successFileDir = new File(PARSING_FILE_SUCCESS_DIR + File.separator + DateFormatUtils.format(now, "yyyy-MM-DD"));
+                                            File successFileDir = new File(PARSING_FILE_SUCCESS_DIR.getPath() + File.separator + DateFormatUtils.format(now, "yyyy-MM-dd"));
                                             File successFile = new File(successFileDir.getPath() + File.separator + fileName);
                                             if (successFile.exists()) {
                                                 successFile.delete();
                                                 log.error("已有过解析成功文件,成功文件将覆盖!场站编号:{},文件名称:{}", electricField.getStationCode(), fileName);
                                             }
 
-                                            FileUtils.moveFile(file, successFileDir);
+                                            ParsingFileUtil.move(file.getAbsolutePath(), successFileDir.getAbsolutePath(),true);
                                         } catch (IOException e) {
                                             log.error("解析文件成功后文件移动失败!场站编号:{},文件名称:{}", electricField.getStationCode(), fileName, e);
                                             e.printStackTrace();
@@ -187,8 +189,8 @@ public class SftpFileParsing {
                             }
                         }
                     }
-                }
-            });
+//                }
+//            });
 
         }
 

+ 1 - 1
cpp-admin/src/main/java/com/cpp/web/service/datafactory/impl/ParsingCdqServiceImpl.java

@@ -201,7 +201,7 @@ public class ParsingCdqServiceImpl extends ServiceImpl<ParsingCdqMapper, Parsing
      * @param time
      */
     public Integer calcHowLongAgo(Date baseTime, Date time) {
-        return ((int) (time.getTime() - baseTime.getTime() % 900000L)) + 1;
+        return ((int) ((time.getTime() - baseTime.getTime()) / 900000L)) + 1;
     }
 
 }

+ 2 - 13
cpp-admin/src/main/java/com/cpp/web/service/datafactory/impl/ParsingCftServiceImpl.java

@@ -6,7 +6,6 @@ import com.cpp.web.domain.datafactory.BaseParsing;
 import com.cpp.web.domain.datafactory.ParsingCft;
 import com.cpp.web.domain.datafactory.dto.ParsingResultDto;
 import com.cpp.web.domain.datafactory.enums.FileTypeEnum;
-import com.cpp.web.domain.station.WindTowerInfo;
 import com.cpp.web.domain.station.WindTowerStatusData;
 import com.cpp.web.mapper.datafactory.ParsingCftMapper;
 import com.cpp.web.service.datafactory.ParsingCftService;
@@ -41,13 +40,8 @@ public class ParsingCftServiceImpl extends ServiceImpl<ParsingCftMapper, Parsing
 
     private List<ParsingCft> parsingCfts = new ArrayList<>();
 
-    private List<WindTowerInfo> windTowerInfos = new ArrayList<>();
-
     private final WindTowerStatusDataService windTowerStatusDataService;
 
-    private final WindTowerInfoService windTowerInfoService;
-
-
     @Override
     public boolean save(BaseParsing parsingInfo) {
         return save((ParsingCft) parsingInfo);
@@ -67,10 +61,8 @@ public class ParsingCftServiceImpl extends ServiceImpl<ParsingCftMapper, Parsing
 
             try {
                 if (!this.parsingCfts.isEmpty()) {
-                    List<WindTowerInfo> windTowerInfoList = this.windTowerInfos.stream().filter(w -> w.getStationCode().equals(stationCode)).collect(Collectors.toList());
                     ParsingCft parsingCft = this.parsingCfts.get(0);
-                    if (windTowerInfoList.size() > 0) {
-                        Long eqId = windTowerInfoList.get(0).getId();//通常每个场站只上报一个测风塔数据,所有配置多个的情况下只取第一个存储
+
                         List<String> fileContent = ParsingFileUtil.getFileContent(file);
                             //判断文件名是否符合配置
                             if (parsingCft.getDataType().equals(ParsingFieldUtil.SINGLE)) {
@@ -101,7 +93,7 @@ public class ParsingCftServiceImpl extends ServiceImpl<ParsingCftMapper, Parsing
                                     windTowerStatusData.setWd90(parsingValue(parsingCft.getWd90(), fileContent));
                                     windTowerStatusData.setWd100(parsingValue(parsingCft.getWd100(), fileContent));
                                     windTowerStatusData.setWdHubHeight(parsingValue(parsingCft.getWdHubHeight(), fileContent));
-                                    windTowerStatusData.setStationCode(parsingCft.getStationCode());
+                                    windTowerStatusData.setStationCode(stationCode);
 
                                     windTowerStatusDataService.save(windTowerStatusData);
                                     parsingResultDto.setStatus("success");
@@ -116,8 +108,6 @@ public class ParsingCftServiceImpl extends ServiceImpl<ParsingCftMapper, Parsing
                             }
 
                         }
-
-                }
             } catch (Exception e) {
                 parsingResultDto.setMessage("解析测风塔数据失败!");
                 log.error("解析测风塔数据失败! /(ㄒoㄒ)/~~", e);
@@ -130,7 +120,6 @@ public class ParsingCftServiceImpl extends ServiceImpl<ParsingCftMapper, Parsing
     @Override
     public boolean activationParsingConf() {
         this.parsingCfts = list();
-        this.windTowerInfos = windTowerInfoService.list();
         return true;
     }
 

+ 4 - 4
cpp-admin/src/main/java/com/cpp/web/service/datafactory/impl/ParsingDqServiceImpl.java

@@ -98,15 +98,15 @@ public class ParsingDqServiceImpl extends ServiceImpl<ParsingDqMapper, ParsingDq
                                     }
                                 }
                                 forecastPowerShortTermStationService.saveBatch(forecastPowerShortTermStationList);
-                                log.info("解析DQ文件:{} 成功! O(∩_∩)O", file.getName());
+                                log.info("解析短期文件:{} 成功! O(∩_∩)O", file.getName());
                                 parsingResultDto.setStatus("success");
                             } else {
                                 parsingResultDto.setMessage("解析短期文件时间错误");
-                                log.error("解析DQ文件时间错误");
+                                log.error("解析短期文件时间错误");
                             }
                         } else {
                             parsingResultDto.setMessage("短期文件里日期不对");
-                            log.error("dq文件里日期不对");
+                            log.error("解析短期文件内时间错误");
                         }
 
                     } else {
@@ -230,6 +230,6 @@ public class ParsingDqServiceImpl extends ServiceImpl<ParsingDqMapper, ParsingDq
      * @param time
      */
     public Integer calcHowLongAgo(Date baseTime, Date time) {
-        return ((int) (time.getTime() - baseTime.getTime() % 86400000L)) + 1;
+        return ((int) ((time.getTime() - baseTime.getTime()) / 86400000L)) + 1;
     }
 }

+ 1 - 1
cpp-admin/src/main/java/com/cpp/web/service/datafactory/impl/ParsingFjServiceImpl.java

@@ -105,7 +105,7 @@ public class ParsingFjServiceImpl extends ServiceImpl<ParsingFjMapper, ParsingFj
 
                                     windTurbineStatusData.setStatus(parsingStatus(parsingFjInfo.getStatus().replace(replace1, replace2), fileContent));
                                     windTurbineStatusData.setIsSample(parsingStatus(parsingFjInfo.getIsSample().replace(replace1, replace2), fileContent));
-                                    windTurbineStatusData.setStationCode(parsingFjInfo.getStationCode());
+                                    windTurbineStatusData.setStationCode(stationCode);
 
                                     windTurbineStatusDataService.save(windTurbineStatusData);
                                     log.info("解析FJ文件:" + file.getName() + " 成功! O(∩_∩)O");

+ 8 - 12
cpp-admin/src/main/java/com/cpp/web/service/datafactory/impl/ParsingNwpServiceImpl.java

@@ -64,7 +64,7 @@ public class ParsingNwpServiceImpl extends ServiceImpl<ParsingNwpMapper, Parsing
                 ParsingNwp parsingNwpInfo = this.parsingNwps.get(0);
                 List<String> fileContent = ParsingFileUtil.getFileContent(file);
                 if (parsingNwpInfo.getDataType().equals(ParsingFieldUtil.MULTI)) {
-                    Date forecastTime = parsingTime(parsingNwpInfo.getPreTime(), fileContent);
+                    Date forecastTime = parsingTime(parsingNwpInfo.getTime(), fileContent);
                     Date time = forecastTime;
                     if (time != null) {
                         List<BigDecimal> ws10s = parsingNwpValue(parsingNwpInfo.getWs10(), fileContent);
@@ -81,15 +81,13 @@ public class ParsingNwpServiceImpl extends ServiceImpl<ParsingNwpMapper, Parsing
                         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> directRadiations = parsingNwpValue(parsingNwpInfo.getDirectRadiation(), fileContent);
-                        List<BigDecimal> lwrs = parsingNwpValue(parsingNwpInfo.getLwr(), fileContent);
+                        List<BigDecimal> lwrs = parsingNwpValue(parsingNwpInfo.getGlobalRadiation(), fileContent);
                         List<BigDecimal> diffuseRadiations = parsingNwpValue(parsingNwpInfo.getDiffuseRadiation(), fileContent);
                         List<BigDecimal> rhs = parsingNwpValue(parsingNwpInfo.getRh(), fileContent);
                         List<BigDecimal> pressures = parsingNwpValue(parsingNwpInfo.getPressure(), fileContent);
-                        List<BigDecimal> senfs = parsingNwpValue(parsingNwpInfo.getSenf(), fileContent);
-                        List<BigDecimal> swrs = parsingNwpValue(parsingNwpInfo.getSwr(), fileContent);
+//                        List<BigDecimal> senfs = parsingNwpValue(parsingNwpInfo.getSenf(), fileContent);
+//                        List<BigDecimal> swrs = parsingNwpValue(parsingNwpInfo.getSwr(), fileContent);
                         List<BigDecimal> ts = parsingNwpValue(parsingNwpInfo.getT(), fileContent);
 
                         List<NwpStation> nwpStationList = new ArrayList<>();
@@ -100,11 +98,11 @@ public class ParsingNwpServiceImpl extends ServiceImpl<ParsingNwpMapper, Parsing
                             nwpStation.setDirectRadiation(valueSet(directRadiations, i));
                             nwpStation.setDiffuseRadiation(valueSet(diffuseRadiations, i));
                             nwpStation.setForecastHowLongAgo(calcHowLongAgo(forecastTime, time));
-                            nwpStation.setLwr(valueSet(lwrs, i));
+                            nwpStation.setGlobalRadiation(valueSet(lwrs, i));
                             nwpStation.setPressure(valueSet(pressures, i));
                             nwpStation.setRh(valueSet(rhs, i));
-                            nwpStation.setSenf(valueSet(senfs, i));
-                            nwpStation.setSwr(valueSet(swrs, i));
+//                            nwpStation.setSenf(valueSet(senfs, i));
+//                            nwpStation.setSwr(valueSet(swrs, i));
                             nwpStation.setT(valueSet(ts, i));
                             nwpStation.setWs10(valueSet(ws10s, i));
                             nwpStation.setWd10(valueSet(wd10s, i));
@@ -120,8 +118,6 @@ public class ParsingNwpServiceImpl extends ServiceImpl<ParsingNwpMapper, Parsing
                             nwpStation.setWd90(valueSet(wd90s, i));
                             nwpStation.setWs100(valueSet(ws100s, i));
                             nwpStation.setWd100(valueSet(wd100s, i));
-                            nwpStation.setWs170(valueSet(ws170s, i));
-                            nwpStation.setWd170(valueSet(wd170s, i));
                             nwpStation.setStationCode(stationCode);
 
                             nwpStationList.add(nwpStation);
@@ -219,6 +215,6 @@ public class ParsingNwpServiceImpl extends ServiceImpl<ParsingNwpMapper, Parsing
      * @param time
      */
     public Integer calcHowLongAgo(Date baseTime, Date time) {
-        return ((int) (time.getTime() - baseTime.getTime() % 86400000L)) + 1;
+        return ((int) ((time.getTime() - baseTime.getTime()) / 86400000L)) + 1;
     }
 }

+ 26 - 36
cpp-admin/src/main/java/com/cpp/web/service/datafactory/impl/ParsingQxzServiceImpl.java

@@ -5,7 +5,6 @@ import com.cpp.web.domain.datafactory.BaseParsing;
 import com.cpp.web.domain.datafactory.ParsingQxz;
 import com.cpp.web.domain.datafactory.dto.ParsingResultDto;
 import com.cpp.web.domain.datafactory.enums.FileTypeEnum;
-import com.cpp.web.domain.station.WeatherStationInfo;
 import com.cpp.web.domain.station.WeatherStationStatusData;
 import com.cpp.web.mapper.datafactory.ParsingQxzMapper;
 import com.cpp.web.service.datafactory.ParsingInterface;
@@ -39,12 +38,8 @@ public class ParsingQxzServiceImpl extends ServiceImpl<ParsingQxzMapper, Parsing
 
     private final WeatherStationStatusDataService weatherStationStatusDataService;
 
-    private final WeatherStationInfoService weatherStationInfoService;
-
     private List<ParsingQxz> parsingQxzs = new ArrayList<>();
 
-    private List<WeatherStationInfo> weatherStationInfos = new ArrayList<>();
-
     @Override
     public boolean save(BaseParsing parsingInfo) {
         return save((ParsingQxz) parsingInfo);
@@ -64,38 +59,34 @@ public class ParsingQxzServiceImpl extends ServiceImpl<ParsingQxzMapper, Parsing
         try {
             if (!this.parsingQxzs.isEmpty()) {
                 ParsingQxz parsingQxzInfo = this.parsingQxzs.get(0);
-                List<WeatherStationInfo> weatherStationInfoList = weatherStationInfos.stream().filter(w -> w.getStationCode().equals(stationCode)).collect(Collectors.toList());
-                if (weatherStationInfoList.size() > 0) {
-                    Long eqId = weatherStationInfoList.get(0).getId();
-                    List<String> fileContent = ParsingFileUtil.getFileContent(file);
-                    //判断文件名是否符合配置
-                    if (parsingQxzInfo.getDataType().equals(ParsingFieldUtil.SINGLE)) {
-                        Date time = parsingTime(parsingQxzInfo.getTime(), fileContent);
-                        if (time != null) {
-                            WeatherStationStatusData w = new WeatherStationStatusData();
-                            w.setTime(time);
-                            w.setAirT(parsingValue(parsingQxzInfo.getAirT(), fileContent));
-                            w.setCellT(parsingValue(parsingQxzInfo.getCellT(), fileContent));
-                            w.setDiffuseR(parsingValue(parsingQxzInfo.getDiffuseR(), fileContent));
-                            w.setDirectR(parsingValue(parsingQxzInfo.getDirectR(), fileContent));
-                            w.setGlobalR(parsingValue(parsingQxzInfo.getGlobalR(), fileContent));
-                            w.setP(parsingValue(parsingQxzInfo.getP(), fileContent));
-                            w.setRh(parsingValue(parsingQxzInfo.getRh(), fileContent));
-                            w.setWd(parsingValue(parsingQxzInfo.getWd(), fileContent));
-                            w.setWs(parsingValue(parsingQxzInfo.getWs(), fileContent));
-                            w.setStationCode(parsingQxzInfo.getStationCode());
-                            weatherStationStatusDataService.save(w);
-                            parsingResultDto.setStatus("success");
-                            log.info("解析QXZ文件:{} 成功! O(∩_∩)O", file.getName());
-                        } else {
-                            parsingResultDto.setMessage("解析气象站文件时间错误");
-                            log.error("解析QXZ文件时间错误");
-                        }
+
+                List<String> fileContent = ParsingFileUtil.getFileContent(file);
+                //判断文件名是否符合配置
+                if (parsingQxzInfo.getDataType().equals(ParsingFieldUtil.SINGLE)) {
+                    Date time = parsingTime(parsingQxzInfo.getTime(), fileContent);
+                    if (time != null) {
+                        WeatherStationStatusData w = new WeatherStationStatusData();
+                        w.setTime(time);
+                        w.setAirT(parsingValue(parsingQxzInfo.getAirT(), fileContent));
+                        w.setCellT(parsingValue(parsingQxzInfo.getCellT(), fileContent));
+                        w.setDiffuseR(parsingValue(parsingQxzInfo.getDiffuseR(), fileContent));
+                        w.setDirectR(parsingValue(parsingQxzInfo.getDirectR(), fileContent));
+                        w.setGlobalR(parsingValue(parsingQxzInfo.getGlobalR(), fileContent));
+                        w.setP(parsingValue(parsingQxzInfo.getP(), fileContent));
+                        w.setRh(parsingValue(parsingQxzInfo.getRh(), fileContent));
+                        w.setWd(parsingValue(parsingQxzInfo.getWd(), fileContent));
+                        w.setWs(parsingValue(parsingQxzInfo.getWs(), fileContent));
+                        w.setStationCode(stationCode);
+                        weatherStationStatusDataService.save(w);
+                        parsingResultDto.setStatus("success");
+                        log.info("解析QXZ文件:{} 成功! O(∩_∩)O", file.getName());
                     } else {
-                        parsingResultDto.setMessage("气象站暂无多行解析方式");
-                        log.error("qxz暂无多行解析方式");
+                        parsingResultDto.setMessage("解析气象站文件时间错误");
+                        log.error("解析QXZ文件时间错误");
                     }
-
+                } else {
+                    parsingResultDto.setMessage("气象站暂无多行解析方式");
+                    log.error("qxz暂无多行解析方式");
                 }
             } else {
                 parsingResultDto.setMessage("气象站未配置作为解析使用设备");
@@ -113,7 +104,6 @@ public class ParsingQxzServiceImpl extends ServiceImpl<ParsingQxzMapper, Parsing
     @Override
     public boolean activationParsingConf() {
         this.parsingQxzs = list();
-        this.weatherStationInfos = weatherStationInfoService.list();
         return true;
     }
 

+ 1 - 1
cpp-admin/src/main/java/com/cpp/web/service/datafactory/impl/ParsingRcdqServiceImpl.java

@@ -202,7 +202,7 @@ public class ParsingRcdqServiceImpl implements ParsingInterface {
      * @param time
      */
     public Integer calcHowLongAgo(Date baseTime, Date time) {
-        return ((int) (time.getTime() - baseTime.getTime() % 900000L)) + 1;
+        return ((int) ((time.getTime() - baseTime.getTime()) / 900000L)) + 1;
     }
 
 }

+ 355 - 15
cpp-admin/src/main/java/com/cpp/web/utils/ParsingFileUtil.java

@@ -1,12 +1,23 @@
 package com.cpp.web.utils;
 
 
+import cn.hutool.core.util.CharsetUtil;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
 import org.springframework.util.ResourceUtils;
 
 import java.io.*;
 import java.net.URLDecoder;
+import java.nio.charset.Charset;
+import java.nio.file.*;
+import java.nio.file.attribute.BasicFileAttributeView;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.nio.file.attribute.PosixFileAttributeView;
+import java.nio.file.attribute.PosixFileAttributes;
+import java.security.MessageDigest;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -83,6 +94,158 @@ public class ParsingFileUtil {
         return path;
     }
 
+
+    //把一个文件中的内容读取成一个String字符串
+    public static String getStr(File jsonFile){
+        String jsonStr = "";
+        try {
+            FileReader fileReader = new FileReader(jsonFile);
+            Reader reader = new InputStreamReader(new FileInputStream(jsonFile),"utf-8");
+            int ch = 0;
+            StringBuffer sb = new StringBuffer();
+            while ((ch = reader.read()) != -1) {
+                sb.append((char) ch);
+            }
+            fileReader.close();
+            reader.close();
+            jsonStr = sb.toString();
+            return jsonStr;
+        } catch (IOException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+
+    /**
+     * 移动本地文件
+     *
+     * @param remoteAbsoluteFile 远程文件名(包括完整路径)
+     * @param localAbsoluteFile  本地文件名(包括完整路径)
+     * @return 成功时,返回true,失败返回false
+     * @throws Exception
+     */
+    public static void move(String localAbsoluteFile, String remoteAbsoluteFile) throws Exception {
+//    File srcFile = new File(localAbsoluteFile);
+//    File destDir = new File(remoteAbsoluteFile);
+//    try {
+//      if (!destDir.exists()) {// 如果目录不存在则创建目录
+//        boolean b = destDir.mkdirs();
+//        if (!b) // 如果创建失败则抛出异常
+//          throw new RuntimeException(destDir + " 目录创建失败");
+//      }
+//      FileUtils.moveFile(srcFile, new File(remoteAbsoluteFile + File.separator + srcFile.getName()));
+//    } catch (IOException e) {
+//      throw new Exception("文件:" + srcFile.getName() + "移动到" + destDir.getPath() + "失败。", e);
+//    }
+        move(localAbsoluteFile, remoteAbsoluteFile, true);
+    }
+
+    public static void move(String localAbsoluteFile, String remoteAbsoluteFile, boolean overwrite) throws Exception {
+        File srcFile = new File(localAbsoluteFile);
+        File destDir = new File(remoteAbsoluteFile);
+        StringBuilder opts = new StringBuilder();
+        try {
+            if (!destDir.exists()) {// 如果目录不存在则创建目录
+                boolean b = destDir.mkdirs();
+                if (!b) // 如果创建失败则抛出异常
+                    throw new RuntimeException(destDir + " 目录创建失败");
+            }
+            File desFile = new File(remoteAbsoluteFile + File.separator + srcFile.getName());
+            if (overwrite && desFile.exists()) {
+                FileUtils.deleteQuietly(desFile);
+                opts.append(" >> 覆盖 >> ");
+            } else {
+                opts.append(" >> 移动 >> ");
+            }
+            FileUtils.moveFile(srcFile, desFile);
+            log.info("文件:" + srcFile.getName() + opts + destDir.getPath());
+        } catch (IOException e) {
+            throw new Exception("文件:" + srcFile.getName() + opts + destDir.getPath() + "失败。", e);
+        }
+    }
+
+    public static void copy(String src, String des, boolean overwrite) throws Exception {
+        File srcFile = new File(src);
+        File desFile = new File(des);
+        copy(srcFile, desFile, overwrite);
+    }
+
+    public static void copy(File srcFile, File desFile, boolean overwrite) throws Exception {
+        if (overwrite && desFile.exists()) {
+            FileUtils.deleteQuietly(desFile);
+        }
+        FileUtils.copyFile(srcFile, desFile);
+    }
+
+    public static InputStream toInputStream(File file, Charset source, Charset target) {
+        InputStream inputStream = null;
+        try {
+            if (file.exists() && file.canRead()) {
+                String context = FileUtils.readFileToString(file, source);
+                inputStream = null == context ? null : IOUtils.toInputStream(context, target);
+            }
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+        return inputStream;
+    }
+
+    public static File convert(File file, Charset source, Charset target) {
+        if (file.exists() && file.canRead() && file.canWrite()) {
+            return CharsetUtil.convert(file, source, target);
+        }
+        return null;
+    }
+
+    //文件内容md5加密
+    public static String getMD5(byte[] fileByte) {
+        String md5 = new String();
+        try {
+            MessageDigest md = MessageDigest.getInstance("MD5");
+            md.update(fileByte);
+            byte b[] = md.digest();
+
+            int i;
+
+            StringBuffer buf = new StringBuffer("");
+            for (int offset = 0; offset < b.length; offset++) {
+                i = b[offset];
+                if (i < 0)
+                    i += 256;
+                if (i < 16)
+                    buf.append("0");
+                buf.append(Integer.toHexString(i));
+            }
+
+            md5 = buf.toString();
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return md5;
+    }
+
+    /**
+     * 获取文件创建时间
+     *
+     * @param fullFileName
+     * @return
+     */
+    public static Long getFileCreateTime(String fullFileName) {
+        Path path = Paths.get(fullFileName);
+        BasicFileAttributeView basicview = Files.getFileAttributeView(path, BasicFileAttributeView.class, LinkOption.NOFOLLOW_LINKS);
+        BasicFileAttributes attr;
+        try {
+            attr = basicview.readAttributes();
+            Date createDate = new Date(attr.creationTime().toMillis());
+            return createDate.getTime();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return new Date().getTime();
+    }
+
     /**
      * 获取项目根路径
      *
@@ -113,26 +276,203 @@ public class ParsingFileUtil {
         return pathStr;
     }
 
+    /**
+     * 获取上报文件目录相对路径
+     *
+     * @return
+     */
+    public static String getFileUploadPath() {
+        return createUploadAllDir("uploadFile");
+    }
+
+    /**
+     * 获取下载文件目录相对路径
+     *
+     * @return
+     */
+    public static String getDownloadFilePath() {
+        return createUploadAllDir("downloadFile");
+    }
+
+    /**
+     * 获取下载文件目录相对路径
+     *
+     * @return
+     */
+    public static String getZxglFilePath() {
+        return createUploadAllDir("zxgl");
+    }
+
+    /**
+     * 获取日志目录相对路径
+     *
+     * @return
+     */
+    public static String getLogsPath() {
+        return createUploadAllDir("logs");
+    }
+
+    /**
+     * 获取系统脚本相对路径
+     *
+     * @return
+     */
+    public static String getBinPath() {
+        return createUploadAllDir("bin");
+    }
+
+    /**
+     * 程序备份相对路径
+     *
+     * @return
+     */
+    public static String getOriginalPath() {
+        return createUploadAllDir("original");
+    }
+
+    /**
+     * 系统资料相对路径
+     *
+     * @return
+     */
+    public static String getSystemFilePath() {
+        return createUploadAllDir("systemFile");
+    }
+
+    /**
+     * 获取被删除文件目录
+     *
+     * @return 路径
+     */
+    public static String getDeleteFilePath() {
+        return createUploadAllDir("deleteFile");
+    }
+
+    /**
+     * 程序运行相对路径
+     *
+     * @return
+     */
+    public static String getProducePath() {
+        return createUploadAllDir("produce");
+    }
+
+
+    /**
+     * 配置信息路径
+     * @return
+     */
+    public static String getSettingsPath() {
+        return createUploadAllDir("settings");
+    }
+
+    /**
+     * 内网接收路径
+     * @return
+     */
+    public static String getReceivePath() {
+        return createUploadAllDir("receive");
+    }
+
+    /**
+     * 报表相对路径
+     *
+     * @return
+     */
+    public static String getreportFormPath() {
+        return createUploadAllDir("reportForm");
+    }
+
+    /**
+     * 获取临时文件目录相对路径
+     *
+     * @return
+     */
+    public static String getTempFilePath() {
+        return createUploadAllDir("tempFile");
+    }
+
+    public static String getSftpDownload() {
+        return createUploadAllDir("sftpDownload");
+    }
+
+
+    private static String createUploadAllDir(String dir) {
+        String path = "";
+        if (System.getProperties().getProperty("file.separator").equals("\\")) {
+            path = new File(getResourceBasePath()).getParentFile().getParentFile().getParentFile().getAbsolutePath() + File.separator + dir;
+            try {
+                path = URLDecoder.decode(path, "UTF-8");
+            } catch (UnsupportedEncodingException e) {
+                e.printStackTrace();
+            }
+            File file = new File(path);
+            if (!file.exists()) {
+                boolean b = file.mkdirs();
+                if (!b)
+                    log.error("目录创建失败" + path);
+            }
+        } else {
+            path = "/home/syjy/cpp/" + dir;
+        }
+        return path;
+    }
+
+    /**
+     * 获取环境数据导出文件目录相对路径
+     *
+     * @return
+     */
+    public static String getEnvironmentalDataFile() {
+        return createUploadAllDir("environmentalDataFile");
+    }
+
+
+    /**
+     * 设置用户和用户组
+     *
+     * @param filePath 文件路径
+     * @param owner    用户
+     * @param group    用户组
+     */
+    public static void setFileOwnerAndGroup(String filePath, String owner, String group) {
+        Path path = FileSystems.getDefault().getPath(filePath);
 
-    //把一个文件中的内容读取成一个String字符串
-    public static String getStr(File jsonFile){
-        String jsonStr = "";
         try {
-            FileReader fileReader = new FileReader(jsonFile);
-            Reader reader = new InputStreamReader(new FileInputStream(jsonFile),"utf-8");
-            int ch = 0;
-            StringBuffer sb = new StringBuffer();
-            while ((ch = reader.read()) != -1) {
-                sb.append((char) ch);
+            // 创建文件(如果不存在)
+            if (!Files.exists(path)) {
+                Files.createFile(path);
             }
-            fileReader.close();
-            reader.close();
-            jsonStr = sb.toString();
-            return jsonStr;
-        } catch (IOException e) {
+
+            // 获取文件属性视图
+            PosixFileAttributeView attributeView = Files.getFileAttributeView(
+                    path, PosixFileAttributeView.class);
+
+            // 获取当前的文件属性
+            PosixFileAttributes attributes = attributeView.readAttributes();
+
+            // 设置文件所有者和用户组
+            attributeView.setOwner(FileSystems.getDefault().getUserPrincipalLookupService().lookupPrincipalByName(owner));
+            attributeView.setGroup(FileSystems.getDefault().getUserPrincipalLookupService().lookupPrincipalByGroupName(group));
+
+            log.info("{}文件所有者设置为: {},用户组设置为:{}" + filePath, attributeView.getOwner(), attributes.group());
+
+        } catch (Exception e) {
             e.printStackTrace();
-            return null;
         }
     }
 
+
+
+    public static File checkGetPath(String path){
+        File file = new File(path);
+        if (!file.exists()){
+            file.mkdirs();
+        }
+
+        return file;
+    }
+
+
+
 }

+ 5 - 6
cpp-ui/src/views/configManager/parsingConf/index.vue

@@ -8,9 +8,9 @@
         <el-tab-pane label="超短期" name="cdq">
           <cdqparsing v-if="isCdq"/>
         </el-tab-pane>
-<!--        <el-tab-pane label="nwp" name="nwp">-->
-<!--          <nwpparsing v-if="isNwp"/>-->
-<!--        </el-tab-pane>-->
+        <el-tab-pane label="nwp" name="nwp">
+          <nwpparsing v-if="isNwp"/>
+        </el-tab-pane>
         <el-tab-pane label="实际功率" name="rp">
           <rpparsing v-if="isRp"/>
         </el-tab-pane>
@@ -35,13 +35,12 @@
 <script>
 import dqparsing from "./dqparsing";
 import cdqparsing from "./cdqparsing";
-import nwpparsing from "./nwpparsing";
 import qxzparsing from "./qxzparsing";
 import cftparsing from "./cftparsing";
 import nbqparsing from "./nbqparsing";
 import fjparsing from "./fjparsing";
 import rpparsing from "./rpparsing";
-
+import nwpparsing from "./nwpparsing"
 export default {
   data() {
     return {
@@ -65,7 +64,7 @@ export default {
     cftparsing,
     nbqparsing,
     fjparsing,
-    rpparsing
+    rpparsing,
   },
   methods:{
     handleClick(tab){

+ 144 - 136
cpp-ui/src/views/configManager/parsingConf/nwpparsing.vue

@@ -15,8 +15,7 @@
               <td>气压公式:{{ props.row.pressure }}</td>
             </tr>
             <tr>
-              <td>全波总辐射公式:{{ props.row.lwr }}</td>
-              <td>总辐射公式:{{ props.row.swr }}</td>
+              <td>总辐射公式:{{ props.row.globalRadiation }}</td>
               <td>直辐射公式:{{ props.row.directRadiation }}</td>
               <td>散辐射公式:{{ props.row.diffuseRadiation }}</td>
             </tr>
@@ -41,16 +40,14 @@
             <tr>
               <td>100米风速公式:{{ props.row.ws100 }}</td>
               <td>100米风向公式:{{ props.row.wd100 }}</td>
-              <td>170米风速公式:{{ props.row.ws170 }}</td>
-              <td>170米风向公式:{{ props.row.wd170 }}</td>
+              <td>轮毂高风速公式:{{ props.row.wsHubHeight }}</td>
+              <td>轮毂高风向公式:{{ props.row.wdHubHeight }}</td>
             </tr>
           </table>
         </template>
       </el-table-column>
-<!--      <el-table-column prop="fileName" align="center" label="文件名关键字" width="200px"></el-table-column>-->
-      <el-table-column prop="dataType" align="center" label="数据类型" width="100px"
-                       :formatter="formatDataType"></el-table-column>
-      <el-table-column prop="preTime" align="center" label="预测时间公式"></el-table-column>
+      <el-table-column prop="dataType" align="center" label="数据类型" width="100px" :formatter="formatDataType"></el-table-column>
+      <el-table-column prop="time" align="center" label="预测时间公式"></el-table-column>
 <!--      <el-table-column prop="stationCode" align="center" label="场站编号"></el-table-column>-->
       <el-table-column label="操作" align="center" width="150px">
         <template slot-scope="scope">
@@ -86,14 +83,6 @@
           <div class="grid-content bg-purple">
             <el-form v-model="form" ref="form" :key="timer">
               <el-row :gutter="16">
-<!--                <el-col :span="8">-->
-<!--                  <el-form-item prop="fileName" label-width="110px">-->
-<!--                    <span slot="label">-->
-<!--                      <font color="red">*</font>文件名关键字-->
-<!--                    </span>-->
-<!--                    <el-input v-model="form.fileName" @focus="clearformula"></el-input>-->
-<!--                  </el-form-item>-->
-<!--                </el-col>-->
                 <el-col :span="8">
                   <el-form-item prop="dataType" label-width="110px">
                     <span slot="label">
@@ -101,7 +90,7 @@
                     </span>
                     <el-select v-model="form.dataType" clearable @focus="clearformula">
                       <el-option
-                        v-for="item in this.dataType"
+                        v-for="item in this.dataTypes"
                         :key="item.value"
                         :label="item.label"
                         :value="item.value"/>
@@ -109,12 +98,12 @@
                   </el-form-item>
                 </el-col>
                 <el-col :span="8">
-                  <el-form-item prop="preTime" label-width="110px" class="formulaColor">
+                  <el-form-item prop="time" label-width="110px" class="formulaColor">
                     <span slot="label">
                       <font color="red">*</font>预测时间公式
                     </span>
-                    <el-input v-model="form.preTime" readonly
-                              @click.native="ftck(form.preTime,'form.preTime','(预测时间)')"></el-input>
+                    <el-input v-model="form.time" readonly
+                              @click.native="ftck(form.time,'form.time','(预测时间)')"></el-input>
                   </el-form-item>
                 </el-col>
               </el-row>
@@ -165,21 +154,12 @@
               </el-row>
               <el-row :gutter="16">
                 <el-col :span="8">
-                  <el-form-item prop="lwr" label-width="110px" class="formulaColor">
-                    <span slot="label">
-                     全波总辐射公式
-                    </span>
-                    <el-input v-model="form.lwr" readonly
-                              @click.native="ftck(form.lwr,'form.lwr','(全波总辐射)')"></el-input>
-                  </el-form-item>
-                </el-col>
-                <el-col :span="8">
-                  <el-form-item prop="swr" label-width="110px" class="formulaColor">
+                  <el-form-item prop="globalRadiation" label-width="110px" class="formulaColor">
                     <span slot="label">
                       总辐射公式
                     </span>
-                    <el-input v-model="form.swr" readonly
-                              @click.native="ftck(form.swr,'form.swr','(总辐射)')"></el-input>
+                    <el-input v-model="form.globalRadiation" readonly
+                              @click.native="ftck(form.globalRadiation,'form.globalRadiation','(总辐射)')"></el-input>
                   </el-form-item>
                 </el-col>
                 <el-col :span="8">
@@ -339,21 +319,21 @@
               </el-row>
               <el-row :gutter="16">
                 <el-col :span="8">
-                  <el-form-item prop="ws170" label-width="110px" class="formulaColor">
+                  <el-form-item prop="wsHubHeight" label-width="110px" class="formulaColor">
                     <span slot="label">
-                      170米风速
+                      100米风速
                     </span>
-                    <el-input v-model="form.ws170" readonly
-                              @click.native="ftck(form.ws170,'form.ws170','(170米风速)')"></el-input>
+                    <el-input v-model="form.wsHubHeight" readonly
+                              @click.native="ftck(form.wsHubHeight,'form.wsHubHeight','(轮毂高风速)')"></el-input>
                   </el-form-item>
                 </el-col>
                 <el-col :span="8">
-                  <el-form-item prop="wd170" label-width="110px" class="formulaColor">
+                  <el-form-item prop="wdHubHeight" label-width="110px" class="formulaColor">
                     <span slot="label">
-                      170米风向
+                      100米风向
                     </span>
-                    <el-input v-model="form.wd170" readonly
-                              @click.native="ftck(form.wd170,'form.wd170','(170米风向)')"></el-input>
+                    <el-input v-model="form.wdHubHeight" readonly
+                              @click.native="ftck(form.wdHubHeight,'form.wdHubHeight','(轮毂高风向)')"></el-input>
                   </el-form-item>
                 </el-col>
               </el-row>
@@ -430,13 +410,12 @@
 </template>
 
 <script>
-
 export default {
   name: "index",
   data() {
     return {
       // stationCodeList: [],
-      dataType: [
+      dataTypes: [
         {value: 's', label: '时间单行'},
         {value: 'm', label: '时间多行'}
       ],
@@ -460,15 +439,14 @@ export default {
       info: '',
       visible: false,
       form: {
-        fileName: '',
-        preTime: '',
+        // fileName: '',
+        time: '',
         dataType: 'm',
         // stationCode: '',
         t: '',
         rh: '',
         pressure: '',
-        lwr: '',
-        swr: '',
+        globalRadiation: '',
         directRadiation: '',
         diffuseRadiation: '',
         ws10: '',
@@ -485,8 +463,8 @@ export default {
         wd90: '',
         ws100: '',
         wd100: '',
-        ws170: '',
-        wd170: ''
+        wsHubHeight: '',
+        wdHubHeight: ''
       },
       pfform: {
         rownumber: '',
@@ -505,22 +483,19 @@ export default {
   methods: {
     formatDataType(row, column) {
       let belongTo = '未知类型'
-      for (let i = 0; i < this.dataType.length; i++) {
-        if (row.dataType === this.dataType[i].value) {
-          belongTo = this.dataType[i].label
+      for (let i = 0; i < this.dataTypes.length; i++) {
+        if (row.dataType === this.dataTypes[i].value) {
+          belongTo = this.dataTypes[i].label
         }
       }
       return belongTo
     },
     getTableList() {
       this.tableLoading = true
-      const page = this.page
-
-      // 获取列表
       this.$axios.get("/parsingNwp/page", {
         params: {
-          currentPage: page.currentPage,
-          pageSize: page.pageSize
+          currentPage: this.page.currentPage,
+          pageSize: this.page.pageSize
         }
       }).then(response => {
         this.tableData = response.data.records
@@ -532,7 +507,7 @@ export default {
     },
     // getElectricFieldList() {
     //   // 获取所有场站
-    //   this.$axios("/parsingInfo/getElectricField").then(response => {
+    //   fetchElectricFieldList().then(response => {
     //     this.stationCodeList = response.data
     //     this.tableLoading = false
     //   }).catch((e) => {
@@ -541,55 +516,77 @@ export default {
     // },
     destoryformula() {
       // 清空公式区字段
-      if (this.tempformulasign == 'form.preTime') {
-        this.form.preTime = ''
-      } else if (this.tempformulasign == 'form.t') {
+      if (this.tempformulasign == 'form.time') {
+        this.form.time = ''
+      }
+      else if (this.tempformulasign == 'form.t') {
         this.form.t = ''
-      } else if (this.tempformulasign == 'form.rh') {
+      }
+      else if (this.tempformulasign == 'form.rh') {
         this.form.rh = ''
-      } else if (this.tempformulasign == 'form.pressure') {
+      }
+      else if (this.tempformulasign == 'form.pressure') {
         this.form.pressure = ''
-      } else if (this.tempformulasign == 'form.lwr') {
-        this.form.lwr = ''
-      } else if (this.tempformulasign == 'form.swr') {
-        this.form.swr = ''
-      } else if (this.tempformulasign == 'form.directRadiation') {
+      }
+      else if (this.tempformulasign == 'form.globalRadiation') {
+        this.form.globalRadiation = ''
+      }
+      else if (this.tempformulasign == 'form.directRadiation') {
         this.form.directRadiation = ''
-      } else if (this.tempformulasign == 'form.diffuseRadiation') {
+      }
+      else if (this.tempformulasign == 'form.diffuseRadiation') {
         this.form.diffuseRadiation = ''
-      } else if (this.tempformulasign == 'form.ws10') {
+      }
+      else if (this.tempformulasign == 'form.ws10') {
         this.form.ws10 = ''
-      } else if (this.tempformulasign == 'form.wd10') {
+      }
+      else if (this.tempformulasign == 'form.wd10') {
         this.form.wd10 = ''
-      } else if (this.tempformulasign == 'form.ws30') {
+      }
+      else if (this.tempformulasign == 'form.ws30') {
         this.form.ws30 = ''
-      } else if (this.tempformulasign == 'form.wd30') {
+      }
+      else if (this.tempformulasign == 'form.wd30') {
         this.form.wd30 = ''
-      } else if (this.tempformulasign == 'form.ws50') {
+      }
+      else if (this.tempformulasign == 'form.ws50') {
         this.form.ws50 = ''
-      } else if (this.tempformulasign == 'form.wd50') {
+      }
+      else if (this.tempformulasign == 'form.wd50') {
         this.form.wd50 = ''
-      } else if (this.tempformulasign == 'form.ws70') {
+      }
+      else if (this.tempformulasign == 'form.ws70') {
         this.form.ws70 = ''
-      } else if (this.tempformulasign == 'form.wd70') {
+      }
+      else if (this.tempformulasign == 'form.wd70') {
         this.form.wd70 = ''
-      } else if (this.tempformulasign == 'form.ws80') {
+      }
+      else if (this.tempformulasign == 'form.ws80') {
         this.form.ws80 = ''
-      } else if (this.tempformulasign == 'form.wd80') {
+      }
+      else if (this.tempformulasign == 'form.wd80') {
         this.form.wd80 = ''
-      } else if (this.tempformulasign == 'form.ws90') {
+      }
+      else if (this.tempformulasign == 'form.ws90') {
         this.form.ws90 = ''
-      } else if (this.tempformulasign == 'form.wd90') {
+      }
+      else if (this.tempformulasign == 'form.wd90') {
         this.form.wd90 = ''
-      } else if (this.tempformulasign == 'form.ws100') {
+      }
+      else if (this.tempformulasign == 'form.ws100') {
         this.form.ws100 = ''
-      } else if (this.tempformulasign == 'form.wd100') {
+      }
+      else if (this.tempformulasign == 'form.wd100') {
         this.form.wd100 = ''
-      } else if (this.tempformulasign == 'form.ws170') {
-        this.form.ws170 = ''
-      } else if (this.tempformulasign == 'form.wd170') {
-        this.form.wd170 = ''
       }
+      else if (this.tempformulasign == 'form.wsHubHeight') {
+        this.form.wsHubHeight = ''
+      }
+      else if (this.tempformulasign == 'form.wdHubHeight') {
+        this.form.wdHubHeight = ''
+      }
+
+
       this.clearformula()
     },
     clearformula() {
@@ -623,7 +620,7 @@ export default {
       this.editinfo = editname
     },
     genformula() {
-      if (this.tempformulasign == '') {
+      if (this.tempformulasign==''){
         this.$message.warning('请先选定左侧公式项')
         return
       }
@@ -650,77 +647,89 @@ export default {
         resultStr = resultStr + '<=>' + this.pfform.timeformat
       }
       // 将生成的公式赋值到左侧表格中
-      if (this.tempformulasign == 'form.preTime') {
-        this.form.preTime = resultStr
-      } else if (this.tempformulasign == 'form.t') {
+      if (this.tempformulasign == 'form.time') {
+        this.form.time = resultStr
+      }
+      else if (this.tempformulasign == 'form.t') {
         this.form.t = resultStr
-      } else if (this.tempformulasign == 'form.rh') {
+      }
+      else if (this.tempformulasign == 'form.rh') {
         this.form.rh = resultStr
-      } else if (this.tempformulasign == 'form.pressure') {
+      }
+      else if (this.tempformulasign == 'form.pressure') {
         this.form.pressure = resultStr
-      } else if (this.tempformulasign == 'form.lwr') {
-        this.form.lwr = resultStr
-      } else if (this.tempformulasign == 'form.swr') {
-        this.form.swr = resultStr
-      } else if (this.tempformulasign == 'form.directRadiation') {
+      }
+      else if (this.tempformulasign == 'form.globalRadiation') {
+        this.form.globalRadiation = resultStr
+      }
+      else if (this.tempformulasign == 'form.directRadiation') {
         this.form.directRadiation = resultStr
-      } else if (this.tempformulasign == 'form.diffuseRadiation') {
+      }
+      else if (this.tempformulasign == 'form.diffuseRadiation') {
         this.form.diffuseRadiation = resultStr
-      } else if (this.tempformulasign == 'form.ws10') {
+      }
+      else if (this.tempformulasign == 'form.ws10') {
         this.form.ws10 = resultStr
-      } else if (this.tempformulasign == 'form.wd10') {
+      }
+      else if (this.tempformulasign == 'form.wd10') {
         this.form.wd10 = resultStr
-      } else if (this.tempformulasign == 'form.ws30') {
+      }
+      else if (this.tempformulasign == 'form.ws30') {
         this.form.ws30 = resultStr
-      } else if (this.tempformulasign == 'form.wd30') {
+      }
+      else if (this.tempformulasign == 'form.wd30') {
         this.form.wd30 = resultStr
-      } else if (this.tempformulasign == 'form.ws50') {
+      }
+      else if (this.tempformulasign == 'form.ws50') {
         this.form.ws50 = resultStr
-      } else if (this.tempformulasign == 'form.wd50') {
+      }
+      else if (this.tempformulasign == 'form.wd50') {
         this.form.wd50 = resultStr
-      } else if (this.tempformulasign == 'form.ws70') {
+      }
+      else if (this.tempformulasign == 'form.ws70') {
         this.form.ws70 = resultStr
-      } else if (this.tempformulasign == 'form.wd70') {
+      }
+      else if (this.tempformulasign == 'form.wd70') {
         this.form.wd70 = resultStr
-      } else if (this.tempformulasign == 'form.ws80') {
+      }
+      else if (this.tempformulasign == 'form.ws80') {
         this.form.ws80 = resultStr
-      } else if (this.tempformulasign == 'form.wd80') {
+      }
+      else if (this.tempformulasign == 'form.wd80') {
         this.form.wd80 = resultStr
-      } else if (this.tempformulasign == 'form.ws90') {
+      }
+      else if (this.tempformulasign == 'form.ws90') {
         this.form.ws90 = resultStr
-      } else if (this.tempformulasign == 'form.wd90') {
+      }
+      else if (this.tempformulasign == 'form.wd90') {
         this.form.wd90 = resultStr
-      } else if (this.tempformulasign == 'form.ws100') {
+      }
+      else if (this.tempformulasign == 'form.ws100') {
         this.form.ws100 = resultStr
-      } else if (this.tempformulasign == 'form.wd100') {
+      }
+      else if (this.tempformulasign == 'form.wd100') {
         this.form.wd100 = resultStr
-      } else if (this.tempformulasign == 'form.ws170') {
-        this.form.ws170 = resultStr
-      } else if (this.tempformulasign == 'form.wd170') {
-        this.form.wd170 = resultStr
       }
+      else if (this.tempformulasign == 'form.wsHubHeight') {
+        this.form.wsHubHeight = resultStr
+      }
+      else if (this.tempformulasign == 'form.wdHubHeight') {
+        this.form.wdHubHeight = resultStr
+      }
+
       this.timer = new Date().getTime()
       this.clearformula()
     },
     /*保存*/
     handleSave(formName) {
-      if (!this.form.preTime || !this.form.dataType
-        // !this.form.fileName || || this.form.stationCode == ""
+      if (
+        // !this.form.fileName ||
+        !this.form.time || !this.form.dataType
+        // || this.form.stationCode==""
       ) {
         this.$message.warning('填写必填项');
         return false;
       } else {
-        // const data = this.form.stationCode
-        // let data1 = "";
-        // for (let n = 0; n < data.length; n++) {
-        //   for (let j = 0; j < this.stationCodeList.length; j++) {
-        //     if (data[n] == this.stationCodeList[j]["stationCode"]) {
-        //       data1 = data1 + this.stationCodeList[j]["stationCode"] + ","
-        //     }
-        //   }
-        // }
-        // data1 = data1.substr(0, data1.length - 1)
-        // this.form.stationCode = data1
         if (this.saveFlag === 1) {
           this.$axios.post("/parsingNwp", this.form).then(response => {
             this.dialogVisible = false
@@ -748,15 +757,14 @@ export default {
       this.saveFlag = 1
       this.info = ''
       this.form = {
-        fileName: '',
-        preTime: '',
+        // fileName: '',
+        time: '',
         dataType: 'm',
         // stationCode: '',
         t: '',
         rh: '',
         pressure: '',
-        lwr: '',
-        swr: '',
+        globalRadiation: '',
         directRadiation: '',
         diffuseRadiation: '',
         ws10: '',
@@ -773,8 +781,8 @@ export default {
         wd90: '',
         ws100: '',
         wd100: '',
-        ws170: '',
-        wd170: ''
+        wsHubHeight: '',
+        wdHubHeight: ''
       }
       this.clearformula()
       this.visible = true
@@ -782,7 +790,7 @@ export default {
     /*上报对象编辑*/
     handleEdit(row) {
       this.saveFlag = 2
-      let newRow = Object.assign({}, row)
+      let newRow = Object.assign({},row)
       // let tempStationCode = newRow.stationCode.split(',')
       this.form = newRow
       // this.form.stationCode = tempStationCode