فهرست منبع

修改可以解析不是当天的文件,修改超短期生成未来10个小时数据

fanxiaoyu 1 سال پیش
والد
کامیت
95a7a029c1

+ 5 - 5
ipp-client/pom.xml

@@ -8,11 +8,11 @@
         <version>2.2.1.RELEASE</version>
         <relativePath/> <!-- lookup parent from repository -->
     </parent>
-<!--    <parent>
-        <artifactId>ipp-ahhn</artifactId>
-        <groupId>com.jiayue</groupId>
-        <version>1.0.0</version>
-    </parent>-->
+    <!--    <parent>
+            <artifactId>ipp-ahhn</artifactId>
+            <groupId>com.jiayue</groupId>
+            <version>1.0.0</version>
+        </parent>-->
     <groupId>com.jiayue.ipp.ipp-client</groupId>
     <artifactId>ipp-client</artifactId>
     <version>1.0.0</version>

+ 1 - 1
ipp-client/src/main/java/com/jiayue/ipfcst/client/Schedule/Task.java

@@ -379,7 +379,7 @@ public class Task {
 
         //遍历已下载的文件list 筛选已成功传入内网服务器的文件,发送传入成功标识
         if (Constant.downLoadFilesStatusList == null || Constant.downLoadFilesStatusList.size() == 0) {
-            log.warn("当前无下载文件,不需要扫描向隔离路径");
+            log.warn("当前无下载文件,不需要扫描向隔离路径");
             return;
         }
 

+ 1 - 1
ipp-client/src/main/java/com/jiayue/ipfcst/client/mapper/JiaYueWindPowerDqResultCoverMapper.java

@@ -37,7 +37,7 @@ public interface JiaYueWindPowerDqResultCoverMapper extends BaseMapper<JiaYueWin
             "    FROM jiayue_zdata_wind_power_dq_result\n" +
             "    WHERE PRE_DATE_TIME BETWEEN #{startTime} AND #{endTime} AND OBJ_ID = #{objId}\n" +
             "    ORDER BY CREATE_TIME DESC\n" +
-            "    LIMIT 16\n" +
+            "    LIMIT 40\n" +
             ") AS subquery\n" +
             "ORDER BY PRE_DATE_TIME ASC;")
     List<JiaYueWindPowerDqResultCover> selectByTimeAndObjId(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("objId") String objId);

+ 4 - 3
ipp-client/src/main/java/com/jiayue/ipfcst/client/service/SysParameterService.java

@@ -12,9 +12,10 @@ import com.jiayue.ipp.common.data.entity.SysParameter;
 public interface SysParameterService extends IService<SysParameter> {
 
     /**
-     * @param accuracy_cdq_howlongago 参数
-     * @param s                       默认值
-     * @param stationCode             场站编号
+     * 获取系统参数
+     * @param sysKey 参数名
+     * @param defaultValue 默认值
+     * @param stationCode 场站编号
      * @return
      */
     String getSysParameterAndStationCode(String sysKey, String defaultValue, String stationCode);

+ 5 - 5
ipp-client/src/main/java/com/jiayue/ipfcst/client/service/an/DownloadService.java

@@ -105,11 +105,11 @@ public class DownloadService {
                 parsingLog.setStationCode(parsingUrl.getStationCode());
                 parsingLog.setParsingTime(new Date());
 
-                if (!fileName.contains(dayStr)) {
-                    file.delete();
-                    log.warn(fileName + "不是当天的文件,删除!");
-                    break;
-                }
+//                if (!fileName.contains(dayStr)) {
+//                    file.delete();
+//                    log.warn(fileName + "不是当天的文件,删除!");
+//                    break;
+//                }
 
                 //定义解析的类型,默认为错误(未知),成功后为文件类型,也会作为存储目录名
                 String type = parsingFileService.parsingFile(file, parsingUrl);

+ 1 - 1
ipp-client/src/main/java/com/jiayue/ipfcst/client/service/impl/JiaYueWindPowerCdqResultCoverServiceImpl.java

@@ -126,7 +126,7 @@ public class JiaYueWindPowerCdqResultCoverServiceImpl extends ServiceImpl<JiaYue
                 String cdqUpMin = sysParameterService.getSysParameterAndStationCode("CDQ_UP_MIN", "0", stationCode);
                 Long calTime = DateMomentUtil.getMomentTime(System.currentTimeMillis() + Integer.parseInt(cdqUpMin) * 1000 * 60, 1, 15 * 60 * 1000L);
                 Long startTime = calTime + 15 * 1000 * 60L;
-                String llcdq_point = sysParameterService.getSysParameterAndStationCode("FILE_LLCDQ_POINT", "16", stationCode);
+                String llcdq_point = sysParameterService.getSysParameterAndStationCode("FILE_LLCDQ_POINT", "40", stationCode);
                 Integer forecastPoints = Integer.parseInt(llcdq_point);
                 Integer forecastMinutes = (forecastPoints-1) * 15;
                 // 结束时间增加15分钟为了防止文件先生成,实时表中最后一个时间点没有点位的问题

+ 8 - 36
ipp-client/src/main/java/com/jiayue/ipfcst/client/service/impl/an/ParsingDqInfoServiceImpl.java

@@ -1,8 +1,7 @@
 package com.jiayue.ipfcst.client.service.impl.an;
 
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.jiayue.ipfcst.client.aop.WR;
 import com.jiayue.ipfcst.client.dto.FileParsingConfig;
 import com.jiayue.ipfcst.client.dto.ParsingConstant;
 import com.jiayue.ipfcst.client.mapper.JiaYueWindPowerDqResultCoverMapper;
@@ -17,7 +16,6 @@ import com.jiayue.ipfcst.client.utils.FieldUtil;
 import com.jiayue.ipfcst.client.utils.FileUtil;
 import com.jiayue.ipfcst.client.utils.PUtil;
 import com.jiayue.ipfcst.common.core.util.DateMomentUtil;
-import com.jiayue.ipp.common.data.entity.ForecastPowerShortTermHis;
 import com.jiayue.ipp.common.data.entity.JiaYueWindPowerDqResultCover;
 import com.jiayue.ipp.common.data.entity.an.ParsingDqInfo;
 import com.jiayue.ipp.common.data.entity.an.ParsingInfo;
@@ -25,7 +23,6 @@ import com.jiayue.ipp.common.data.entity.an.ParsingUrl;
 import com.jiayue.ipp.common.data.enums.FileTypeEnum;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import java.io.File;
@@ -55,8 +52,6 @@ public class ParsingDqInfoServiceImpl extends ServiceImpl<ParsingDqInfoMapper, P
 
     private final ElectricFieldService electricFieldService;
 
-    private final ParsingDqInfoMapper parsingDqInfoMapper;
-
     JiaYueWindPowerDqResultCoverMapper jiaYueWindPowerDqResultCoverMapper;
 
     @Override
@@ -126,27 +121,11 @@ public class ParsingDqInfoServiceImpl extends ServiceImpl<ParsingDqInfoMapper, P
                             Long forecastTime = parsingForecastTime(parsingDqInfo.getForecastTime(), fileContent);
 
                             if (forecastTime != 0l) {
-                                int ago = -1;
+
                                 for (BigDecimal bigDecimal : bigDecimals) {
                                     LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(forecastTime), ZoneId.systemDefault());
                                     forecastTime += Constant.INTERVALTIME;
-//                                    int n = ago / 96;
-//                                    if (n > 0) {
-//                                        ForecastPowerShortTermHis forecastPowerShortTermHis = new ForecastPowerShortTermHis();
-//                                        forecastPowerShortTermHis.setGenDate(genDate);
-//                                        forecastPowerShortTermHis.setStationCode(parsingUrl.getStationCode());
-//                                        forecastPowerShortTermHis.setAbleValue(bigDecimal);
-//                                        forecastPowerShortTermHis.setForecastTime(localDateTime);
-//                                        forecastPowerShortTermHis.setForecastHowLongAgo(n);
-//                                        forecastPowerShortTermHis.setForecastManufactor(parsingUrl.getForecastManufactor());
-//                                        forecastPowerShortTermHisList.add(forecastPowerShortTermHis);
-//                                    }
-                                    // LocalDate 转换为 Date
-                                    ZoneId zone = ZoneId.systemDefault();
-                                    Instant instant = genDate.atStartOfDay().atZone(zone).toInstant();
-                                    Date da = Date.from(instant);
-
-                                    // LocalDateTime转换为Date
+//
                                     ZoneId zoneId = ZoneId.systemDefault();
                                     ZonedDateTime zdt = localDateTime.atZone(zoneId);
                                     Date date = Date.from(zdt.toInstant());
@@ -156,19 +135,15 @@ public class ParsingDqInfoServiceImpl extends ServiceImpl<ParsingDqInfoMapper, P
                                     // 将文件名中的时间转换为time格式
                                     Time timeString = Time.valueOf(fileTime);
                                     LocalDateTime combinedDateTime = DateMomentUtil.mergeDateAndTime(date, time);
+                                    // LocalDateTime转换为date格式
+                                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+                                    Date da = simpleDateFormat.parse(fileDate);
 
                                     // 存入默认数据库(远端)
                                     jiaYueWindPowerDqResultCoverList.add(this.jiaYueWindPowerDqResultCover(combinedDateTime, electricFieldService.numberToIdentification(parsingUrl.getStationCode()), bigDecimal.floatValue(),
                                             new Date().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(), da, timeString));
-                                    ago++;
                                 }
 
-//                                LocalDate today = LocalDate.now();
-//                                LambdaQueryWrapper<ForecastPowerShortTermHis> forecastPowerShortTermHisLambdaQueryWrapper = new LambdaQueryWrapper<>();
-//                                forecastPowerShortTermHisLambdaQueryWrapper.eq(ForecastPowerShortTermHis::getStationCode, parsingUrl.getStationCode());
-//                                forecastPowerShortTermHisLambdaQueryWrapper.between(ForecastPowerShortTermHis::getGenDate, today.atStartOfDay(), today);
-//                                forecastPowerShortTermHisService.remove(forecastPowerShortTermHisLambdaQueryWrapper);
-//                                forecastPowerShortTermHisService.saveBatch(forecastPowerShortTermHisList);
                                 jiaYueWindPowerDqResultCoverService.saveDq(jiaYueWindPowerDqResultCoverList, electricFieldService.numberToIdentification(parsingUrl.getStationCode()));
 
                                 log.info("解析DQ文件:{} 成功! O(∩_∩)O", file.getName());
@@ -200,10 +175,6 @@ public class ParsingDqInfoServiceImpl extends ServiceImpl<ParsingDqInfoMapper, P
     }
 
 
-    private List<ParsingDqInfo> getParsingDqInfos(ParsingUrl parsingUrl) {
-        return parsingDqInfoMapper.selectParsingDqInfo(parsingUrl.getStationCode());
-    }
-
     //目前所知该类型在文件中只有s一种形式==》暂不支持m
     protected LocalDate parsingGenDate(String sign, List<String> fileContent) {
         LocalDate genDate = LocalDate.now();
@@ -310,7 +281,8 @@ public class ParsingDqInfoServiceImpl extends ServiceImpl<ParsingDqInfoMapper, P
     }
 
     /**
-     *  存入实体返回
+     * 存入实体返回
+     *
      * @param localDateTime
      * @param objId
      * @param bigDecimal

+ 4 - 27
ipp-client/src/main/java/com/jiayue/ipfcst/client/service/impl/an/ParsingNwpInfoServiceImpl.java

@@ -2,7 +2,6 @@ package com.jiayue.ipfcst.client.service.impl.an;
 
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.jiayue.ipfcst.client.aop.WR;
 import com.jiayue.ipfcst.client.dto.FileParsingConfig;
 import com.jiayue.ipfcst.client.dto.ParsingConstant;
 import com.jiayue.ipfcst.client.mapper.an.ParsingNwpInfoMapper;
@@ -14,7 +13,6 @@ import com.jiayue.ipfcst.client.utils.Constant;
 import com.jiayue.ipfcst.client.utils.FieldUtil;
 import com.jiayue.ipfcst.client.utils.FileUtil;
 import com.jiayue.ipfcst.client.utils.PUtil;
-import com.jiayue.ipfcst.common.core.util.DateMomentUtil;
 import com.jiayue.ipp.common.data.entity.*;
 import com.jiayue.ipp.common.data.entity.an.ParsingInfo;
 import com.jiayue.ipp.common.data.entity.an.ParsingNwpInfo;
@@ -32,7 +30,6 @@ import java.text.SimpleDateFormat;
 import java.time.Instant;
 import java.time.LocalDateTime;
 import java.time.ZoneId;
-import java.time.ZonedDateTime;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -169,36 +166,21 @@ public class ParsingNwpInfoServiceImpl extends ServiceImpl<ParsingNwpInfoMapper,
                                     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> 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> ts = parsingNwpValue(parsingNwpInfo.getT(), fileContent);
 
-                                    List<NwpHis> nwpHisList = new ArrayList<>();
 
                                     //以十米风速为基准
                                     for (int i = 0; i < ws10s.size(); i++) {
-                                        LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault());
-
-                                        // LocalDateTime转换为Date
-                                        ZoneId zoneId = ZoneId.systemDefault();
-                                        ZonedDateTime zdt = localDateTime.atZone(zoneId);
-                                        Date date = Date.from(zdt.toInstant());
-                                        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
-                                        String nowTime = sdf.format(date);
-
                                         // 将文件名中日期转换为time类型
                                         Time timeStr = Time.valueOf(fileTime);
-                                        // LocalDate 转换为 Date
-                                        ZoneId zone = ZoneId.systemDefault();
-                                        Instant instant = LocalDateTime.now().toLocalDate().atStartOfDay().atZone(zone).toInstant();
-                                        Date da = Date.from(instant);
-                                        // 时间戳转换为LocalDateTime
+                                        // 时间戳转换为时间戳转换为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
@@ -232,11 +214,6 @@ public class ParsingNwpInfoServiceImpl extends ServiceImpl<ParsingNwpInfoMapper,
     }
 
 
-    private List<ParsingNwpInfo> getParsingNwpInfos(ParsingUrl parsingUrl) {
-        return parsingNwpInfoMapper.selectParsingNwpInfo(parsingUrl.getStationCode());
-    }
-
-
     protected List<BigDecimal> parsingNwpValue(String sign, List<String> fileContent) {
         List<BigDecimal> fpValues = new ArrayList<>();
 

+ 50 - 50
ipp-common/pom.xml

@@ -23,11 +23,11 @@
         <maven.compiler.target>1.8</maven.compiler.target>
     </properties>
     <dependencies>
-<!--        &lt;!&ndash;必备:安全模块&ndash;&gt;-->
-<!--        <dependency>-->
-<!--            <groupId>com.jiayue</groupId>-->
-<!--            <artifactId>csc-common-security</artifactId>-->
-<!--        </dependency>-->
+        <!--        &lt;!&ndash;必备:安全模块&ndash;&gt;-->
+        <!--        <dependency>-->
+        <!--            <groupId>com.jiayue</groupId>-->
+        <!--            <artifactId>csc-common-security</artifactId>-->
+        <!--        </dependency>-->
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-databind</artifactId>
@@ -39,42 +39,42 @@
         </dependency>
 
 
-<!--        &lt;!&ndash;必备:日志处理&ndash;&gt;-->
-<!--        <dependency>-->
-<!--            <groupId>com.jiayue</groupId>-->
-<!--            <artifactId>csc-common-log</artifactId>-->
-<!--        </dependency>-->
-<!--        &lt;!&ndash;必备:swagger&ndash;&gt;-->
-<!--        <dependency>-->
-<!--            <groupId>com.jiayue</groupId>-->
-<!--            <artifactId>csc-common-swagger</artifactId>-->
-<!--        </dependency>-->
-<!--        &lt;!&ndash;必备: 注册中心客户端&ndash;&gt;-->
-<!--        <dependency>-->
-<!--            <groupId>com.alibaba.cloud</groupId>-->
-<!--            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>-->
-<!--        </dependency>-->
-<!--        &lt;!&ndash;必备: 配置中心客户端&ndash;&gt;-->
-<!--        <dependency>-->
-<!--            <groupId>com.alibaba.cloud</groupId>-->
-<!--            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>-->
-<!--        </dependency>-->
+        <!--        &lt;!&ndash;必备:日志处理&ndash;&gt;-->
+        <!--        <dependency>-->
+        <!--            <groupId>com.jiayue</groupId>-->
+        <!--            <artifactId>csc-common-log</artifactId>-->
+        <!--        </dependency>-->
+        <!--        &lt;!&ndash;必备:swagger&ndash;&gt;-->
+        <!--        <dependency>-->
+        <!--            <groupId>com.jiayue</groupId>-->
+        <!--            <artifactId>csc-common-swagger</artifactId>-->
+        <!--        </dependency>-->
+        <!--        &lt;!&ndash;必备: 注册中心客户端&ndash;&gt;-->
+        <!--        <dependency>-->
+        <!--            <groupId>com.alibaba.cloud</groupId>-->
+        <!--            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>-->
+        <!--        </dependency>-->
+        <!--        &lt;!&ndash;必备: 配置中心客户端&ndash;&gt;-->
+        <!--        <dependency>-->
+        <!--            <groupId>com.alibaba.cloud</groupId>-->
+        <!--            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>-->
+        <!--        </dependency>-->
 
         <!--必备:undertow容器-->
-<!--        <dependency>-->
-<!--            <groupId>org.springframework.boot</groupId>-->
-<!--            <artifactId>spring-boot-starter-undertow</artifactId>-->
-<!--        </dependency>-->
-<!--        <dependency>-->
-<!--            <groupId>com.alibaba</groupId>-->
-<!--            <artifactId>druid</artifactId>-->
-<!--            <version>1.1.18</version>-->
-<!--        </dependency>-->
-<!--        <dependency>-->
-<!--            <groupId>junit</groupId>-->
-<!--            <artifactId>junit</artifactId>-->
-<!--            <scope>test</scope>-->
-<!--        </dependency>-->
+        <!--        <dependency>-->
+        <!--            <groupId>org.springframework.boot</groupId>-->
+        <!--            <artifactId>spring-boot-starter-undertow</artifactId>-->
+        <!--        </dependency>-->
+        <!--        <dependency>-->
+        <!--            <groupId>com.alibaba</groupId>-->
+        <!--            <artifactId>druid</artifactId>-->
+        <!--            <version>1.1.18</version>-->
+        <!--        </dependency>-->
+        <!--        <dependency>-->
+        <!--            <groupId>junit</groupId>-->
+        <!--            <artifactId>junit</artifactId>-->
+        <!--            <scope>test</scope>-->
+        <!--        </dependency>-->
         <!--hutool-->
         <dependency>
             <groupId>cn.hutool</groupId>
@@ -111,17 +111,17 @@
             <version>1.13</version>
         </dependency>
         <!--任务调度-->
-<!--        <dependency>-->
-<!--            <groupId>org.quartz-scheduler</groupId>-->
-<!--            <artifactId>quartz</artifactId>-->
-<!--            <version>${quartz.version}</version>-->
-<!--            <exclusions>-->
-<!--                <exclusion>-->
-<!--                    <artifactId>slf4j//    @ApiModelProperty</artifactId>-->
-<!--                    <groupId>org.slf4j</groupId>-->
-<!--                </exclusion>-->
-<!--            </exclusions>-->
-<!--        </dependency>-->
+        <!--        <dependency>-->
+        <!--            <groupId>org.quartz-scheduler</groupId>-->
+        <!--            <artifactId>quartz</artifactId>-->
+        <!--            <version>${quartz.version}</version>-->
+        <!--            <exclusions>-->
+        <!--                <exclusion>-->
+        <!--                    <artifactId>slf4j//    @ApiModelProperty</artifactId>-->
+        <!--                    <groupId>org.slf4j</groupId>-->
+        <!--                </exclusion>-->
+        <!--            </exclusions>-->
+        <!--        </dependency>-->
     </dependencies>