Bladeren bron

准确率计算和展示功能(初版)

tl 6 maanden geleden
bovenliggende
commit
5d71b9a8c8
46 gewijzigde bestanden met toevoegingen van 1939 en 1168 verwijderingen
  1. 18 0
      cpp-admin/pom.xml
  2. 27 0
      cpp-admin/src/main/java/com/cpp/web/controller/accuracy/AccuracyPassRateController.java
  3. 28 0
      cpp-admin/src/main/java/com/cpp/web/core/config/MyMetaObjectHandler.java
  4. 11 8
      cpp-admin/src/main/java/com/cpp/web/domain/BaseCppEntity.java
  5. 67 0
      cpp-admin/src/main/java/com/cpp/web/domain/accuracy/AccuracyPassRate.java
  6. 0 7
      cpp-admin/src/main/java/com/cpp/web/domain/cloud/ForecastPowerShortTermCloud.java
  7. 0 7
      cpp-admin/src/main/java/com/cpp/web/domain/cloud/ForecastPowerUltraShortTermCloud.java
  8. 0 8
      cpp-admin/src/main/java/com/cpp/web/domain/cloud/NwpCloud.java
  9. 3 2
      cpp-admin/src/main/java/com/cpp/web/domain/enums/DataSourcesEnum.java
  10. 20 0
      cpp-admin/src/main/java/com/cpp/web/domain/enums/ForecastTypeEnum.java
  11. 3 1
      cpp-admin/src/main/java/com/cpp/web/domain/station/ElectricField.java
  12. 15 0
      cpp-admin/src/main/java/com/cpp/web/mapper/accuracy/AccuracyPassRateMapper.java
  13. 19 0
      cpp-admin/src/main/java/com/cpp/web/service/accuracy/AccuracyPassRateService.java
  14. 79 0
      cpp-admin/src/main/java/com/cpp/web/service/accuracy/CalcAccuracy.java
  15. 14 0
      cpp-admin/src/main/java/com/cpp/web/service/accuracy/CalculateInterface.java
  16. 48 0
      cpp-admin/src/main/java/com/cpp/web/service/accuracy/impl/AccuracyPassRateServiceImpl.java
  17. 216 0
      cpp-admin/src/main/java/com/cpp/web/service/accuracy/impl/CalculateForecastPowerShortTermCloudImpl.java
  18. 202 0
      cpp-admin/src/main/java/com/cpp/web/service/accuracy/impl/CalculateForecastPowerShortTermRegulationImpl.java
  19. 202 0
      cpp-admin/src/main/java/com/cpp/web/service/accuracy/impl/CalculateForecastPowerShortTermStationImpl.java
  20. 26 0
      cpp-admin/src/main/java/com/cpp/web/service/accuracy/impl/CalculateForecastPowerUltraShortTermCloudImpl.java
  21. 26 0
      cpp-admin/src/main/java/com/cpp/web/service/accuracy/impl/CalculateForecastPowerUltraShortTermRegulationImpl.java
  22. 141 0
      cpp-admin/src/main/java/com/cpp/web/service/accuracy/impl/CalculateForecastPowerUltraShortTermStationImpl.java
  23. 99 100
      cpp-admin/src/main/java/com/cpp/web/service/cloud/CloudFileParsing.java
  24. 5 1
      cpp-admin/src/main/java/com/cpp/web/service/cloud/ForecastPowerShortTermCloudService.java
  25. 13 0
      cpp-admin/src/main/java/com/cpp/web/service/cloud/impl/ForecastPowerShortTermCloudServiceImpl.java
  26. 0 25
      cpp-admin/src/main/java/com/cpp/web/service/datafactory/ChannelStatusService.java
  27. 0 371
      cpp-admin/src/main/java/com/cpp/web/service/datafactory/CloudFileParsing.java
  28. 0 385
      cpp-admin/src/main/java/com/cpp/web/service/datafactory/DownloadService.java
  29. 0 130
      cpp-admin/src/main/java/com/cpp/web/service/datafactory/ParsingFileService.java
  30. 0 25
      cpp-admin/src/main/java/com/cpp/web/service/datafactory/ReportingRateRecordsService.java
  31. 0 47
      cpp-admin/src/main/java/com/cpp/web/service/datafactory/impl/ChannelStatusServiceImpl.java
  32. 2 2
      cpp-admin/src/main/java/com/cpp/web/service/datafactory/impl/ParsingFjServiceImpl.java
  33. 1 1
      cpp-admin/src/main/java/com/cpp/web/service/datafactory/impl/ParsingNbqServiceImpl.java
  34. 0 45
      cpp-admin/src/main/java/com/cpp/web/service/datafactory/impl/ReportingRateRecordsServiceImpl.java
  35. 2 0
      cpp-admin/src/main/java/com/cpp/web/service/station/ForecastPowerShortTermRegulationService.java
  36. 6 0
      cpp-admin/src/main/java/com/cpp/web/service/station/ForecastPowerShortTermStationService.java
  37. 3 0
      cpp-admin/src/main/java/com/cpp/web/service/station/ForecastPowerUltraShortTermRegulationService.java
  38. 2 0
      cpp-admin/src/main/java/com/cpp/web/service/station/ForecastPowerUltraShortTermStationService.java
  39. 2 0
      cpp-admin/src/main/java/com/cpp/web/service/station/PowerStationStatusDataService.java
  40. 11 0
      cpp-admin/src/main/java/com/cpp/web/service/station/impl/ForecastPowerShortTermRegulationServiceImpl.java
  41. 18 0
      cpp-admin/src/main/java/com/cpp/web/service/station/impl/ForecastPowerShortTermStationServiceImpl.java
  42. 11 3
      cpp-admin/src/main/java/com/cpp/web/service/station/impl/ForecastPowerUltraShortTermRegulationServiceImpl.java
  43. 10 0
      cpp-admin/src/main/java/com/cpp/web/service/station/impl/ForecastPowerUltraShortTermStationServiceImpl.java
  44. 13 0
      cpp-admin/src/main/java/com/cpp/web/service/station/impl/PowerStationStatusDataServiceImpl.java
  45. 6 0
      cpp-admin/src/main/resources/application.yml
  46. 570 0
      cpp-ui/src/views/statistics/stationAccuracy/index.vue

+ 18 - 0
cpp-admin/pom.xml

@@ -80,6 +80,24 @@
             <artifactId>hutool-all</artifactId>
             <version>5.8.12</version>
         </dependency>
+        <!--准确率计算-->
+        <dependency>
+            <groupId>com.syjy</groupId>
+            <artifactId>calculation-spring-boot-starter</artifactId>
+            <version>0.0.39</version>
+
+            <exclusions>
+                <exclusion>
+                    <groupId>com.alibaba.cloud</groupId>
+                    <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+            <version>3.17</version>
+        </dependency>
 
         <!-- SSH安全连接所使用的类库 -->
         <dependency>

+ 27 - 0
cpp-admin/src/main/java/com/cpp/web/controller/accuracy/AccuracyPassRateController.java

@@ -0,0 +1,27 @@
+package com.cpp.web.controller.accuracy;
+
+import com.cpp.common.core.domain.R;
+import com.cpp.web.domain.accuracy.AccuracyPassRate;
+import com.cpp.web.domain.enums.DataSourcesEnum;
+import com.cpp.web.domain.enums.ForecastTypeEnum;
+import com.cpp.web.service.accuracy.AccuracyPassRateService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Date;
+import java.util.List;
+
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("accuracyPassRate")
+public class AccuracyPassRateController {
+    private final AccuracyPassRateService accuracyPassRateService;
+
+    @GetMapping("/getByTimeBetweenAndForecastTypeAndDataSourcesAndForecastModelAndStationCode")
+    public R getByTimeBetweenAndForecastTypeAndDataSourcesAndForecastModelAndStationCode(Long startTime, Long endTime, ForecastTypeEnum forecastType, DataSourcesEnum dataSources,Integer ago, String forecastModel, String stationCode){
+        List<AccuracyPassRate> accuracyPassRateList = accuracyPassRateService.findByTimeBetweenAndForecastTypeAndDataSourcesAndAgoAndForecastModelAndStationCode(new Date(startTime),new Date(endTime),forecastType,dataSources,ago,forecastModel,stationCode);
+        return R.ok(accuracyPassRateList);
+    }
+}

+ 28 - 0
cpp-admin/src/main/java/com/cpp/web/core/config/MyMetaObjectHandler.java

@@ -0,0 +1,28 @@
+package com.cpp.web.core.config;
+
+import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
+import com.cpp.common.utils.SecurityUtils;
+import org.apache.ibatis.reflection.MetaObject;
+import org.springframework.stereotype.Component;
+
+import java.time.LocalDateTime;
+import java.util.Date;
+
+/**
+ *  MyMetaObjectHandler
+ */
+@Component
+public class MyMetaObjectHandler implements MetaObjectHandler {
+
+
+    @Override
+    public void insertFill(MetaObject metaObject) {
+        setFieldValByName("create_time", new Date(), metaObject);
+//        setFieldValByName("create_by", SecurityUtils.getLoginUser().getUsername(), metaObject);
+    }
+    @Override
+    public void updateFill(MetaObject metaObject) {
+//        setFieldValByName("update_time", LocalDateTime.now(), metaObject);
+//        setFieldValByName("update_by", SecurityUtils.getLoginUser().getUsername(), metaObject);
+    }
+}

+ 11 - 8
cpp-admin/src/main/java/com/cpp/web/domain/BaseCppEntity.java

@@ -33,19 +33,22 @@ public class BaseCppEntity implements Serializable {
     @ApiModelProperty(value = "场站编号")
     private String stationCode;
 
-    /** 创建者 */
-    private String createBy;
+//    /** 创建者 */
+//    private String createBy;
 
     /** 创建时间 */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @TableField(value = "create_time" , fill = FieldFill.INSERT)
     private Date createTime;
 
-    /** 更新者 */
-    private String updateBy;
-
-    /** 更新时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date updateTime;
+//    /** 更新者 */
+//    @TableField(value = "update_by" , fill = FieldFill.INSERT_UPDATE)
+//    private String updateBy;
+//
+//    /** 更新时间 */
+//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+//    @TableField(value = "update_time" , fill = FieldFill.INSERT_UPDATE)
+//    private Date updateTime;
 
 
 

+ 67 - 0
cpp-admin/src/main/java/com/cpp/web/domain/accuracy/AccuracyPassRate.java

@@ -0,0 +1,67 @@
+package com.cpp.web.domain.accuracy;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.cpp.web.domain.BaseCppEntity;
+import com.cpp.web.domain.datafactory.enums.FileTypeEnum;
+import com.cpp.web.domain.enums.DataSourcesEnum;
+import com.cpp.web.domain.enums.ForecastTypeEnum;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import java.util.Date;
+
+/**
+ * 准确率合格率(日)
+ *
+ * @author yh
+ * @version 1.0
+ * @since 2020/7/8 10:56
+ */
+@Data
+@TableName("cpp_accuracy_pass_rate")
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "cpp_accuracy_pass_rate")
+public class AccuracyPassRate extends BaseCppEntity {
+
+    //时间
+    @ApiModelProperty(value = "时间")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")
+    private Date time;
+
+    //准确率
+    @ApiModelProperty(value = "准确率")
+    private String accuracy;
+
+    //单点偏差累加
+    @ApiModelProperty(value = "单点偏差累加(cap*h)")
+    private String deviationSum;
+
+    //预测类型
+    @ApiModelProperty(value = "预测类型")
+    private ForecastTypeEnum forecastType;
+
+    //数据来源
+    @ApiModelProperty(value = "数据来源")
+    private DataSourcesEnum dataSources;
+
+    //预测模型(中心测)
+    @ApiModelProperty(value = "预测模型(中心测)")
+    private String forecastModel;
+
+    /**
+     * 提前多久预测
+     */
+    @ApiModelProperty(value = "提前多久预测")
+    private Integer forecastHowLongAgo;
+
+    /**
+     * 日
+     * 站端短期均方根准确率
+     * 站端短期单点偏差累加
+     * 站端超短期准确率
+     * 中心侧某模型短期均方根准确率
+     * 中心侧某模型短期单点偏差累加
+     */
+}

+ 0 - 7
cpp-admin/src/main/java/com/cpp/web/domain/cloud/ForecastPowerShortTermCloud.java

@@ -41,13 +41,6 @@ public class ForecastPowerShortTermCloud extends BaseCppEntity {
 
 
     /**
-     * 预测厂家
-     */
-    @ApiModelProperty(value = "预测厂家")
-    private String forecastManufacturers;
-
-
-    /**
      * 预测模型
      */
     @ApiModelProperty(value = "预测模型")

+ 0 - 7
cpp-admin/src/main/java/com/cpp/web/domain/cloud/ForecastPowerUltraShortTermCloud.java

@@ -27,13 +27,6 @@ public class ForecastPowerUltraShortTermCloud extends BaseCppEntity {
 
 
     /**
-     * 预测厂家
-     */
-    @ApiModelProperty(value = "预测厂家")
-    private String forecastManufacturers;
-
-
-    /**
      * 预测模型
      */
     @ApiModelProperty(value = "预测模型")

+ 0 - 8
cpp-admin/src/main/java/com/cpp/web/domain/cloud/NwpCloud.java

@@ -24,14 +24,6 @@ import javax.validation.constraints.Digits;
 @ApiModel(value = "cpp_nwp_cloud")
 public class NwpCloud extends BaseCppEntity {
 
-
-    /**
-     * 预测厂家
-     */
-    @ApiModelProperty(value = "预测厂家")
-    private String forecastManufacturers;
-
-
     /**
      * 预测模型
      */

+ 3 - 2
cpp-admin/src/main/java/com/cpp/web/domain/enums/DataSourcesEnum.java

@@ -4,7 +4,7 @@ import lombok.AllArgsConstructor;
 import lombok.Getter;
 
 /**
- * 解析通道类型
+ * 数据来源类型
  *
  * @Author: tl
  * @Date: 2023/6/2 14:24
@@ -15,7 +15,8 @@ public enum DataSourcesEnum {
 
     E1(1, "ftp(场站端)"),
     E2(2, "云端(中心端)"),
-    E3(2, "集中预测(控制端)");
+    E3(3, "集中预测(控制端)"),
+    E4(4, "ftp(场站端经集中调控)");
     private Integer code;
     private String message;
 }

+ 20 - 0
cpp-admin/src/main/java/com/cpp/web/domain/enums/ForecastTypeEnum.java

@@ -0,0 +1,20 @@
+package com.cpp.web.domain.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * 解析通道类型
+ *
+ * @Author: tl
+ * @Date: 2023/6/2 14:24
+ */
+@Getter
+@AllArgsConstructor
+public enum ForecastTypeEnum {
+
+    dq(1, "短期"),
+    cdq(2, "超短期");
+    private Integer code;
+    private String message;
+}

+ 3 - 1
cpp-admin/src/main/java/com/cpp/web/domain/station/ElectricField.java

@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.FieldStrategy;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.cpp.web.domain.BaseCppEntity;
+import com.cpp.web.domain.station.enums.ElectricFieldTypeEnum;
+import com.cpp.web.domain.station.enums.ProvinceEnum;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
@@ -62,7 +64,7 @@ public class ElectricField extends BaseCppEntity {
      */
 //    @Enumerated(EnumType.STRING)
     @ApiModelProperty(value = "省份")
-    private String provinceEnum;
+    private ProvinceEnum provinceEnum;
 
 
     /**

+ 15 - 0
cpp-admin/src/main/java/com/cpp/web/mapper/accuracy/AccuracyPassRateMapper.java

@@ -0,0 +1,15 @@
+package com.cpp.web.mapper.accuracy;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.cpp.web.domain.accuracy.AccuracyPassRate;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * idp_forecast_power_short_term
+ *
+ * @author tl
+ * @date 2024-09-23 15:28:33
+ */
+@Mapper
+public interface AccuracyPassRateMapper extends BaseMapper<AccuracyPassRate> {
+}

+ 19 - 0
cpp-admin/src/main/java/com/cpp/web/service/accuracy/AccuracyPassRateService.java

@@ -0,0 +1,19 @@
+package com.cpp.web.service.accuracy;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.cpp.web.domain.accuracy.AccuracyPassRate;
+import com.cpp.web.domain.enums.DataSourcesEnum;
+import com.cpp.web.domain.enums.ForecastTypeEnum;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * idp_forecast_power_short_term
+ *
+ * @author tl
+ * @date 2024-09-23 15:28:33
+ */
+public interface AccuracyPassRateService extends IService<AccuracyPassRate> {
+    List<AccuracyPassRate> findByTimeBetweenAndForecastTypeAndDataSourcesAndAgoAndForecastModelAndStationCode(Date startTime, Date endTime, ForecastTypeEnum forecastType, DataSourcesEnum dataSources,Integer ago, String forecastModel,String stationCode);
+}

+ 79 - 0
cpp-admin/src/main/java/com/cpp/web/service/accuracy/CalcAccuracy.java

@@ -0,0 +1,79 @@
+package com.cpp.web.service.accuracy;
+
+import com.cpp.common.utils.spring.SpringUtils;
+import com.cpp.system.service.ISysConfigService;
+import com.cpp.web.domain.accuracy.AccuracyPassRate;
+import com.cpp.web.domain.station.ElectricField;
+import com.cpp.web.domain.station.PowerStationStatusData;
+import com.cpp.web.domain.station.enums.ElectricFieldTypeEnum;
+import com.cpp.web.service.cloud.ForecastPowerShortTermCloudService;
+import com.cpp.web.service.cloud.ForecastPowerUltraShortTermCloudService;
+import com.cpp.web.service.station.*;
+import com.cpp.web.utils.DateTimeUtil;
+import com.syjy.calculate.entity.CalculateRequest;
+import com.syjy.calculate.entity.CalculateResult;
+import com.syjy.calculate.entity.CalculationFormula;
+import com.syjy.calculate.entity.CalculationInfo;
+import com.syjy.calculate.repository.CalculationFormulaRepository;
+import com.syjy.calculate.service.AccuracyPassRateCalculateService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.stream.Collectors;
+
+
+@Service
+@RequiredArgsConstructor
+public class CalcAccuracy {
+
+    public final AccuracyPassRateService accuracyPassRateService;
+    private final ElectricFieldService electricFieldService;
+    private final ISysConfigService sysConfigService;
+    private final PowerStationStatusDataService powerStationStatusDataService;
+    private final List<CalculateInterface> calculateInterfaces;
+
+    /**
+     * 计算方法
+     */
+//    @Scheduled(cron = "0 51 1 * * *")
+//    @Scheduled(fixedRate = 60000L)
+    public void calculate() {
+        Long day = 86400000L;
+        Long now = System.currentTimeMillis();
+
+        Date startTime = DateTimeUtil.getDayStartTime(now - day);
+        Date endTime = DateTimeUtil.getDayLastTime(now - day);
+        List<ElectricField> electricFieldList = electricFieldService.list();
+        List<AccuracyPassRate> accuracyPassRateList = new ArrayList<>();
+        String province = sysConfigService.selectConfigByKey("province");
+        if (province.equals("")) province = "E65";
+        if (!electricFieldList.isEmpty()) {
+            List<PowerStationStatusData> powerStationStatusDataList = powerStationStatusDataService.findByTimeBetween(startTime, endTime);
+            if (!powerStationStatusDataList.isEmpty()) {
+                List<String> formulaTypes = Arrays.asList("DAY_SHORT_ACCURACY", "POINT_SHORT_ACCURACY", "DAY_ULTRA_SHORT_ACCURACY");
+                for (CalculateInterface calculateInterface : calculateInterfaces) {
+                    if (listHasIntersection(calculateInterface.calculationTypes(), formulaTypes)) {
+                        accuracyPassRateList.addAll(calculateInterface.calc(startTime, endTime, powerStationStatusDataList, electricFieldList, formulaTypes, province));
+                    }
+                }
+            }
+        }
+        if (accuracyPassRateList.size() > 0) {
+            accuracyPassRateService.saveBatch(accuracyPassRateList);
+        }
+    }
+
+    public Boolean listHasIntersection(List<String> strings, List<String> stringList) {
+        for (String string : strings) {
+            for (String s : stringList) {
+                if (string.equals(s)) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+}

+ 14 - 0
cpp-admin/src/main/java/com/cpp/web/service/accuracy/CalculateInterface.java

@@ -0,0 +1,14 @@
+package com.cpp.web.service.accuracy;
+
+import com.cpp.web.domain.accuracy.AccuracyPassRate;
+import com.cpp.web.domain.station.ElectricField;
+import com.cpp.web.domain.station.PowerStationStatusData;
+import java.util.Date;
+import java.util.List;
+
+public interface CalculateInterface {
+    List<AccuracyPassRate> calc(Date startTime,Date endTime,List<PowerStationStatusData> powerStationStatusDataList, List<ElectricField> electricFieldList, List<String> formulaTypes, String province);
+
+   List<String> calculationTypes();
+
+}

+ 48 - 0
cpp-admin/src/main/java/com/cpp/web/service/accuracy/impl/AccuracyPassRateServiceImpl.java

@@ -0,0 +1,48 @@
+package com.cpp.web.service.accuracy.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.cpp.web.domain.accuracy.AccuracyPassRate;
+import com.cpp.web.domain.enums.DataSourcesEnum;
+import com.cpp.web.domain.enums.ForecastTypeEnum;
+import com.cpp.web.mapper.accuracy.AccuracyPassRateMapper;
+import com.cpp.web.service.accuracy.AccuracyPassRateService;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * idp_forecast_power_short_term
+ *
+ * @author tl
+ * @date 2024-09-23 15:28:33
+ */
+@Service
+public class AccuracyPassRateServiceImpl extends ServiceImpl<AccuracyPassRateMapper, AccuracyPassRate> implements AccuracyPassRateService {
+
+
+    @Override
+    public List<AccuracyPassRate> findByTimeBetweenAndForecastTypeAndDataSourcesAndAgoAndForecastModelAndStationCode(Date startTime, Date endTime, ForecastTypeEnum forecastType, DataSourcesEnum dataSources, Integer ago, String forecastModel, String stationCode) {
+        QueryWrapper<AccuracyPassRate> wrapper = new QueryWrapper<>();
+        if (stationCode != null && !stationCode.equals("")) {
+            wrapper.eq("station_code", stationCode);
+        }
+        if (startTime != null && endTime != null) {
+            wrapper.between("time", startTime, endTime);
+        }
+        if (forecastType != null && !forecastType.equals("")) {
+            wrapper.eq("forecast_type", forecastType);
+        }
+        if (dataSources != null && !dataSources.equals("")) {
+            wrapper.eq("data_sources", dataSources);
+        }
+        if (forecastModel != null && !forecastModel.equals("")) {
+            wrapper.eq("forecast_model", forecastModel);
+        }
+        if (ago != null && !ago.equals("")) {
+            wrapper.eq("forecast_how_long_ago", ago);
+        }
+        return baseMapper.selectList(wrapper);
+    }
+}

+ 216 - 0
cpp-admin/src/main/java/com/cpp/web/service/accuracy/impl/CalculateForecastPowerShortTermCloudImpl.java

@@ -0,0 +1,216 @@
+package com.cpp.web.service.accuracy.impl;
+
+import com.cpp.common.utils.spring.SpringUtils;
+import com.cpp.web.domain.accuracy.AccuracyPassRate;
+import com.cpp.web.domain.cloud.ForecastPowerShortTermCloud;
+import com.cpp.web.domain.enums.DataSourcesEnum;
+import com.cpp.web.domain.enums.ForecastTypeEnum;
+import com.cpp.web.domain.station.ElectricField;
+import com.cpp.web.domain.station.PowerStationStatusData;
+import com.cpp.web.service.accuracy.CalculateInterface;
+import com.cpp.web.service.cloud.ForecastPowerShortTermCloudService;
+import com.syjy.calculate.entity.CalculateRequest;
+import com.syjy.calculate.entity.CalculateResult;
+import com.syjy.calculate.entity.CalculationFormula;
+import com.syjy.calculate.entity.CalculationInfo;
+import com.syjy.calculate.service.AccuracyPassRateCalculateService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 计算中心测短期预测分析结果
+ */
+@Service
+@RequiredArgsConstructor
+public class CalculateForecastPowerShortTermCloudImpl implements CalculateInterface {
+    private final ForecastPowerShortTermCloudService forecastPowerShortTermCloudService;
+
+
+    @Override
+    public List<AccuracyPassRate> calc(Date startTime,Date endTime,List<PowerStationStatusData> powerStationStatusDataList, List<ElectricField> electricFieldList, List<String> formulaTypes, String province){
+
+        List<AccuracyPassRate> accuracyPassRates = new ArrayList<>();
+
+        List<ForecastPowerShortTermCloud> forecastPowerShortTermCloudList = forecastPowerShortTermCloudService.findByForecastTimeBetweenAndHowLongAgo(startTime, endTime, 1);
+
+        Map<Integer, List<ForecastPowerShortTermCloud>> agoListMap = forecastPowerShortTermCloudList.stream().collect(Collectors.groupingBy(ForecastPowerShortTermCloud::getForecastHowLongAgo, Collectors.toList()));
+
+        for (int ago = 1; ago < 11; ago++) {
+
+            if (agoListMap.containsKey(ago)) {
+                Map<String, List<ForecastPowerShortTermCloud>> listForecastModelMap = agoListMap.get(ago).stream().collect(Collectors.groupingBy(ForecastPowerShortTermCloud::getForecastModel, Collectors.toList()));
+
+                for (ElectricField electricField : electricFieldList) {
+                    // 获取装机容量
+                    BigDecimal capacity = electricField.getCapacity();
+                    // 获取场站编码
+                    String stationCode = electricField.getStationCode();
+                    // 场站类型
+                    String electricType = electricField.getElectricFieldTypeEnum();
+
+                    for (String forecastModel : listForecastModelMap.keySet()) {
+                        AccuracyPassRate accuracyPassRate = new AccuracyPassRate();
+                        accuracyPassRate.setTime(startTime);
+                        accuracyPassRate.setDataSources(DataSourcesEnum.E2);
+                        accuracyPassRate.setForecastModel(forecastModel);
+                        accuracyPassRate.setForecastType(ForecastTypeEnum.dq);
+                        accuracyPassRate.setForecastHowLongAgo(ago);
+                        List<CalculationInfo> calculationInfoList = new ArrayList<>();
+
+                        // 获取实际功率
+                        Map<Date, List<ForecastPowerShortTermCloud>> dateForecastListMap = forecastPowerShortTermCloudList.stream().filter(p -> p.getStationCode().equals(stationCode)).collect(Collectors.groupingBy(ForecastPowerShortTermCloud::getTime, Collectors.toList()));
+                        // 短期预测功率
+                        Map<Date, List<PowerStationStatusData>> datePowerListMap = powerStationStatusDataList.stream().filter(f -> f.getStationCode().equals(stationCode)).collect(Collectors.groupingBy(PowerStationStatusData::getTime, Collectors.toList()));
+                        //解析中目前不带 开机和装机容量,无法计算准确率,先用场站容量代替
+                        BigDecimal cap = electricField.getCapacity();
+
+                        if (formulaTypes.contains("DAY_SHORT_ACCURACY")) {//准确率计算
+
+                            // 从开始时间,每隔15分钟,一直循环到当前时间
+                            for (long stepTime = startTime.getTime(); stepTime <= endTime.getTime(); stepTime += 900000L) {
+                                Date finalTime = new Date(stepTime);
+                                // 组装数据
+                                CalculationInfo calculationInfo = new CalculationInfo();
+                                // 如果短期预测功率不为空且站场功率不为空
+                                if (dateForecastListMap.containsKey(finalTime) && datePowerListMap.containsKey(finalTime)) {
+                                    ForecastPowerShortTermCloud forecastPowerShortTermCloud = dateForecastListMap.get(finalTime).get(0);
+                                    // 短期预测功率
+                                    calculationInfo.setTime(stepTime);
+                                    calculationInfo.setForecastAbleValue(forecastPowerShortTermCloud.getFpValue());
+                                    calculationInfo.setForecastTheoryValue(forecastPowerShortTermCloud.getFpValue());
+                                    calculationInfo.setForecastCapacity(cap);
+                                    calculationInfo.setForecastSuCapacity(cap);
+
+                                    PowerStationStatusData powerStationStatusData = datePowerListMap.get(finalTime).get(0);
+                                    //实际
+                                    calculationInfo.setCapacity(cap);
+                                    calculationInfo.setOpenCapacity(cap);
+                                    calculationInfo.setAbleValue(powerStationStatusData.getAbleValue());
+                                    calculationInfo.setRealValue(powerStationStatusData.getRealValue());
+                                    calculationInfo.setTheoryValue(powerStationStatusData.getTheoryValue());
+                                }
+
+                                // 预测功率或实际功率为空的时候,不放入result中
+                                if (calculationInfo.getRealValue() != null && calculationInfo.getAbleValue() != null && calculationInfo.getForecastAbleValue() != null) {
+                                    calculationInfoList.add(calculationInfo);
+                                }
+                            }
+
+
+                            if (calculationInfoList == null || calculationInfoList.size() == 0) {
+                                accuracyPassRate.setAccuracy("无可用数据计算");
+                            }else {
+                                // 获取计算基础数据
+                                CalculateRequest calculateRequest = new CalculateRequest();
+                                calculateRequest.setCalculationInfoList(calculationInfoList);
+                                calculateRequest.setElectricCapacity(capacity);
+                                calculateRequest.setProvince(province);
+                                calculateRequest.setStationCode(stationCode);
+                                calculateRequest.setFormulaType("DAY_SHORT_ACCURACY");
+                                calculateRequest.setElectricType(electricType);
+                                calculateRequest.setSign(electricField.getStationCode());
+                                calculateRequest.setStationStatus("无");
+                                calculateRequest.setStationCode(electricField.getStationCode());
+                                CalculateResult resultMap = SpringUtils.getBean(AccuracyPassRateCalculateService.class).calculate(calculateRequest);
+                                // 如果计算成功,从结果中获取value
+                                if (String.valueOf(resultMap.get(CalculateResult.CODE_TAG)).
+                                        equals(CalculateResult.Type.SUCCESS.value())) {
+                                    accuracyPassRate.setAccuracy(String.valueOf(resultMap.get(CalculateResult.DATA_TAG)));
+                                }
+                                // 如果不成功,data不为空,则返回data中数据,否则返回msg
+                                if (resultMap.get(CalculateResult.DATA_TAG) != null) {
+                                    accuracyPassRate.setAccuracy(String.valueOf(resultMap.get(CalculateResult.DATA_TAG)));
+                                }
+                                accuracyPassRate.setAccuracy(String.valueOf(resultMap.get(CalculateResult.MSG_TAG)));
+                            }
+
+                        }
+                        if (formulaTypes.contains("POINT_SHORT_ACCURACY")) {//单点偏差计算
+                            List<String> results = new ArrayList<>();
+
+                            for (long stepTime = startTime.getTime(); stepTime <= endTime.getTime(); stepTime += 900000L) {
+                                Date finalTime = new Date(stepTime);
+                                // 组装数据
+                                CalculationInfo calculationInfo = new CalculationInfo();
+                                // 如果短期预测功率不为空且站场功率不为空
+                                if (dateForecastListMap.containsKey(finalTime) && datePowerListMap.containsKey(finalTime)) {
+                                    ForecastPowerShortTermCloud forecastPowerShortTermCloud = dateForecastListMap.get(finalTime).get(0);
+                                    // 短期预测功率
+                                    calculationInfo.setTime(stepTime);
+                                    calculationInfo.setForecastAbleValue(forecastPowerShortTermCloud.getFpValue());
+                                    calculationInfo.setForecastTheoryValue(forecastPowerShortTermCloud.getFpValue());
+                                    calculationInfo.setForecastCapacity(cap);
+                                    calculationInfo.setForecastSuCapacity(cap);
+
+                                    PowerStationStatusData powerStationStatusData = datePowerListMap.get(finalTime).get(0);
+                                    //实际
+                                    calculationInfo.setCapacity(cap);
+                                    calculationInfo.setOpenCapacity(cap);
+                                    calculationInfo.setAbleValue(powerStationStatusData.getAbleValue());
+                                    calculationInfo.setRealValue(powerStationStatusData.getRealValue());
+                                    calculationInfo.setTheoryValue(powerStationStatusData.getTheoryValue());
+                                }
+
+                                // 预测功率或实际功率为空的时候,不放入result中
+                                if (calculationInfo.getRealValue() != null && calculationInfo.getAbleValue() != null && calculationInfo.getForecastAbleValue() != null) {
+                                    // 获取计算基础数据
+                                    CalculateRequest calculateRequest = new CalculateRequest();
+                                    calculateRequest.setCalculationInfoList(calculationInfoList);
+                                    calculateRequest.setElectricCapacity(capacity);
+                                    calculateRequest.setProvince(province);
+                                    calculateRequest.setStationCode(stationCode);
+                                    calculateRequest.setFormulaType("POINT_SHORT_ACCURACY");
+                                    calculateRequest.setElectricType(electricType);
+                                    calculateRequest.setSign(electricField.getStationCode());
+                                    calculateRequest.setStationStatus("无");
+                                    calculateRequest.setStationCode(electricField.getStationCode());
+                                    CalculateResult resultMap = SpringUtils.getBean(AccuracyPassRateCalculateService.class).calculate(calculateRequest);
+                                    // 如果计算成功,从结果中获取value
+                                    if (String.valueOf(resultMap.get(CalculateResult.CODE_TAG)).
+                                            equals(CalculateResult.Type.SUCCESS.value())) {
+                                        results.add(String.valueOf(resultMap.get(CalculateResult.DATA_TAG)));
+                                    }
+                                    // 如果不成功,data不为空,则返回data中数据,否则返回msg
+                                    if (resultMap.get(CalculateResult.DATA_TAG) != null) {
+                                        results.add(String.valueOf(resultMap.get(CalculateResult.DATA_TAG)));
+                                    }
+                                    results.add(String.valueOf(resultMap.get(CalculateResult.MSG_TAG)));
+                                }
+                            }
+
+                            if (results.isEmpty()) {
+                                accuracyPassRate.setDeviationSum("无可用数据计算");
+                            } else {
+                                double sum = 0d;
+                                for (String result : results) {
+                                    if (result.indexOf("%") > -1 && result.length() < 7) {
+                                        sum += Double.parseDouble(result.replace("%", ""));
+                                    }
+                                }
+                                if (accuracyPassRate.getDeviationSum() == null) {
+                                    accuracyPassRate.setDeviationSum(BigDecimal.valueOf(sum / 100).setScale(2, BigDecimal.ROUND_HALF_UP) + "");
+                                }
+                            }
+                        }
+                        accuracyPassRates.add(accuracyPassRate);
+                    }
+                }
+            }
+        }
+
+        return accuracyPassRates;
+    }
+
+
+    @Override
+    public List<String> calculationTypes() {
+        return Arrays.asList("DAY_SHORT_ACCURACY", "POINT_SHORT_ACCURACY");
+    }
+
+
+}
+

+ 202 - 0
cpp-admin/src/main/java/com/cpp/web/service/accuracy/impl/CalculateForecastPowerShortTermRegulationImpl.java

@@ -0,0 +1,202 @@
+package com.cpp.web.service.accuracy.impl;
+
+import com.cpp.common.utils.spring.SpringUtils;
+import com.cpp.web.domain.accuracy.AccuracyPassRate;
+import com.cpp.web.domain.enums.DataSourcesEnum;
+import com.cpp.web.domain.enums.ForecastTypeEnum;
+import com.cpp.web.domain.station.*;
+import com.cpp.web.service.accuracy.CalculateInterface;
+import com.cpp.web.service.station.ForecastPowerShortTermRegulationService;
+import com.syjy.calculate.entity.CalculateRequest;
+import com.syjy.calculate.entity.CalculateResult;
+import com.syjy.calculate.entity.CalculationFormula;
+import com.syjy.calculate.entity.CalculationInfo;
+import com.syjy.calculate.service.AccuracyPassRateCalculateService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 计算调控后短期预测分析结果
+ */
+@Service
+@RequiredArgsConstructor
+public class CalculateForecastPowerShortTermRegulationImpl implements CalculateInterface {
+
+    private final ForecastPowerShortTermRegulationService forecastPowerShortTermRegulationService;
+
+    @Override
+    public List<AccuracyPassRate> calc(Date startTime,Date endTime,List<PowerStationStatusData> powerStationStatusDataList, List<ElectricField> electricFieldList, List<String> formulaTypes, String province){
+
+        List<AccuracyPassRate> accuracyPassRates = new ArrayList<>();
+
+        List<ForecastPowerShortTermRegulation> forecastPowerShortTermStationList = forecastPowerShortTermRegulationService.findByForecastTimeBetweenAndHowLongAgo(startTime, endTime, 1);
+
+        Map<Integer, List<ForecastPowerShortTermRegulation>> agoListMap = forecastPowerShortTermStationList.stream().collect(Collectors.groupingBy(ForecastPowerShortTermRegulation::getForecastHowLongAgo, Collectors.toList()));
+
+        for (int ago = 1; ago < 11; ago++) {
+            if (agoListMap.containsKey(ago)) {
+                for (ElectricField electricField : electricFieldList) {
+                    // 获取装机容量
+                    BigDecimal capacity = electricField.getCapacity();
+                    // 获取场站编码
+                    String stationCode = electricField.getStationCode();
+                    // 场站类型
+                    String electricType = electricField.getElectricFieldTypeEnum();
+
+                    AccuracyPassRate accuracyPassRate = new AccuracyPassRate();
+                    accuracyPassRate.setTime(startTime);
+                    accuracyPassRate.setDataSources(DataSourcesEnum.E4);
+                    accuracyPassRate.setForecastType(ForecastTypeEnum.dq);
+                    accuracyPassRate.setStationCode(stationCode);
+                    accuracyPassRate.setForecastHowLongAgo(ago);
+                    List<CalculationInfo> calculationInfoList = new ArrayList<>();
+
+                    // 获取实际功率
+                    Map<Date, List<ForecastPowerShortTermRegulation>> dateForecastListMap = agoListMap.get(ago).stream().filter(p -> p.getStationCode().equals(stationCode)).collect(Collectors.groupingBy(ForecastPowerShortTermRegulation::getTime, Collectors.toList()));
+                    // 短期预测功率
+                    Map<Date, List<PowerStationStatusData>> datePowerListMap = powerStationStatusDataList.stream().filter(f -> f.getStationCode().equals(stationCode)).collect(Collectors.groupingBy(PowerStationStatusData::getTime, Collectors.toList()));
+                    //解析中目前不带 开机和装机容量,无法计算准确率,先用场站容量代替
+                    BigDecimal cap = electricField.getCapacity();
+
+                    if (formulaTypes.contains("DAY_SHORT_ACCURACY")) {//准确率计算
+                        // 从开始时间,每隔15分钟,一直循环到当前时间
+                        for (long stepTime = startTime.getTime(); stepTime <= endTime.getTime(); stepTime += 900000L) {
+                            Date finalTime = new Date(stepTime);
+                            // 组装数据
+                            CalculationInfo calculationInfo = new CalculationInfo();
+                            // 如果短期预测功率不为空且站场功率不为空
+                            if (dateForecastListMap.containsKey(finalTime) && datePowerListMap.containsKey(finalTime)) {
+                                ForecastPowerShortTermRegulation forecastPowerShortTermRegulation = dateForecastListMap.get(finalTime).get(0);
+                                // 短期预测功率
+                                calculationInfo.setTime(stepTime);
+                                calculationInfo.setForecastAbleValue(forecastPowerShortTermRegulation.getFpValue());
+                                calculationInfo.setForecastTheoryValue(forecastPowerShortTermRegulation.getFpValue());
+                                calculationInfo.setForecastCapacity(cap);
+                                calculationInfo.setForecastSuCapacity(cap);
+
+                                PowerStationStatusData powerStationStatusData = datePowerListMap.get(finalTime).get(0);
+                                //实际
+                                calculationInfo.setCapacity(cap);
+                                calculationInfo.setOpenCapacity(cap);
+                                calculationInfo.setAbleValue(powerStationStatusData.getAbleValue());
+                                calculationInfo.setRealValue(powerStationStatusData.getRealValue());
+                                calculationInfo.setTheoryValue(powerStationStatusData.getTheoryValue());
+                            }
+
+                            // 预测功率或实际功率为空的时候,不放入result中
+                            if (calculationInfo.getRealValue() != null && calculationInfo.getAbleValue() != null && calculationInfo.getForecastAbleValue() != null) {
+                                calculationInfoList.add(calculationInfo);
+                            }
+                        }
+
+
+                        if (calculationInfoList == null || calculationInfoList.size() == 0) {
+                            accuracyPassRate.setAccuracy("无可用数据计算");
+                        }else {
+                            // 获取计算基础数据
+                            CalculateRequest calculateRequest = new CalculateRequest();
+                            calculateRequest.setCalculationInfoList(calculationInfoList);
+                            calculateRequest.setElectricCapacity(capacity);
+                            calculateRequest.setProvince(province);
+                            calculateRequest.setStationCode(stationCode);
+                            calculateRequest.setFormulaType("DAY_SHORT_ACCURACY");
+                            calculateRequest.setElectricType(electricType);
+                            calculateRequest.setSign(electricField.getStationCode());
+                            calculateRequest.setStationStatus("无");
+                            calculateRequest.setStationCode(electricField.getStationCode());
+                            CalculateResult resultMap = SpringUtils.getBean(AccuracyPassRateCalculateService.class).calculate(calculateRequest);
+                            // 如果计算成功,从结果中获取value
+                            if (String.valueOf(resultMap.get(CalculateResult.CODE_TAG)).
+                                    equals(CalculateResult.Type.SUCCESS.value())) {
+                                accuracyPassRate.setAccuracy(String.valueOf(resultMap.get(CalculateResult.DATA_TAG)));
+                            } else {
+                                accuracyPassRate.setAccuracy(String.valueOf(resultMap.get(CalculateResult.MSG_TAG)));
+                            }
+
+                        }
+                    }
+                    if (formulaTypes.contains("POINT_SHORT_ACCURACY")) {//单点偏差计算
+                        List<String> results = new ArrayList<>();
+
+                        for (long stepTime = startTime.getTime(); stepTime <= endTime.getTime(); stepTime += 900000L) {
+                            Date finalTime = new Date(stepTime);
+                            // 组装数据
+                            CalculationInfo calculationInfo = new CalculationInfo();
+                            // 如果短期预测功率不为空且站场功率不为空
+                            if (dateForecastListMap.containsKey(finalTime) && datePowerListMap.containsKey(finalTime)) {
+                                ForecastPowerShortTermRegulation forecastPowerShortTermRegulation = dateForecastListMap.get(finalTime).get(0);
+                                // 短期预测功率
+                                calculationInfo.setTime(stepTime);
+                                calculationInfo.setForecastAbleValue(forecastPowerShortTermRegulation.getFpValue());
+                                calculationInfo.setForecastTheoryValue(forecastPowerShortTermRegulation.getFpValue());
+                                calculationInfo.setForecastCapacity(cap);
+                                calculationInfo.setForecastSuCapacity(cap);
+
+                                PowerStationStatusData powerStationStatusData = datePowerListMap.get(finalTime).get(0);
+                                //实际
+                                calculationInfo.setCapacity(cap);
+                                calculationInfo.setOpenCapacity(cap);
+                                calculationInfo.setAbleValue(powerStationStatusData.getAbleValue());
+                                calculationInfo.setRealValue(powerStationStatusData.getRealValue());
+                                calculationInfo.setTheoryValue(powerStationStatusData.getTheoryValue());
+                            }
+
+                            // 预测功率或实际功率为空的时候,不放入result中
+                            if (calculationInfo.getRealValue() != null && calculationInfo.getAbleValue() != null && calculationInfo.getForecastAbleValue() != null) {
+                                // 获取计算基础数据
+                                CalculateRequest calculateRequest = new CalculateRequest();
+                                calculateRequest.setCalculationInfoList(Arrays.asList(calculationInfo));
+                                calculateRequest.setElectricCapacity(capacity);
+                                calculateRequest.setProvince(province);
+                                calculateRequest.setStationCode(stationCode);
+                                calculateRequest.setFormulaType("POINT_SHORT_ACCURACY");
+                                calculateRequest.setElectricType(electricType);
+                                calculateRequest.setSign(electricField.getStationCode());
+                                calculateRequest.setStationStatus("无");
+                                calculateRequest.setStationCode(electricField.getStationCode());
+                                CalculateResult resultMap = SpringUtils.getBean(AccuracyPassRateCalculateService.class).calculate(calculateRequest);
+                                // 如果计算成功,从结果中获取value
+                                if (String.valueOf(resultMap.get(CalculateResult.CODE_TAG)).
+                                        equals(CalculateResult.Type.SUCCESS.value())) {
+                                    results.add(String.valueOf(resultMap.get(CalculateResult.DATA_TAG)));
+                                } else {
+                                    results.add(String.valueOf(resultMap.get(CalculateResult.MSG_TAG)));
+                                }
+
+                            }
+                        }
+                        if (results.isEmpty()) {
+                            accuracyPassRate.setDeviationSum("无可用数据计算");
+                        } else {
+                            double sum = 0d;
+                            for (String result : results) {
+                                if (result.indexOf("%") > -1 && result.length() < 7) {
+                                    sum += Double.parseDouble(result.replace("%", ""));
+                                }
+                            }
+                            if (accuracyPassRate.getDeviationSum() == null) {
+                                accuracyPassRate.setDeviationSum(BigDecimal.valueOf(sum / 100).setScale(2, BigDecimal.ROUND_HALF_UP) + "");
+                            }
+                        }
+
+
+                    }
+
+                    accuracyPassRates.add(accuracyPassRate);
+                }
+            }
+
+        }
+
+        return accuracyPassRates;
+    }
+
+    @Override
+    public List<String> calculationTypes() {
+        return Arrays.asList("DAY_SHORT_ACCURACY", "POINT_SHORT_ACCURACY");
+    }
+}

+ 202 - 0
cpp-admin/src/main/java/com/cpp/web/service/accuracy/impl/CalculateForecastPowerShortTermStationImpl.java

@@ -0,0 +1,202 @@
+package com.cpp.web.service.accuracy.impl;
+
+import com.cpp.common.utils.spring.SpringUtils;
+import com.cpp.web.domain.accuracy.AccuracyPassRate;
+import com.cpp.web.domain.enums.DataSourcesEnum;
+import com.cpp.web.domain.enums.ForecastTypeEnum;
+import com.cpp.web.domain.station.ElectricField;
+import com.cpp.web.domain.station.ForecastPowerShortTermStation;
+import com.cpp.web.domain.station.PowerStationStatusData;
+import com.cpp.web.service.accuracy.CalculateInterface;
+import com.cpp.web.service.station.ForecastPowerShortTermStationService;
+import com.syjy.calculate.entity.CalculateRequest;
+import com.syjy.calculate.entity.CalculateResult;
+import com.syjy.calculate.entity.CalculationInfo;
+import com.syjy.calculate.service.AccuracyPassRateCalculateService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 计算站端短期预测分析结果
+ */
+@Service
+@RequiredArgsConstructor
+public class CalculateForecastPowerShortTermStationImpl implements CalculateInterface {
+
+    private final ForecastPowerShortTermStationService forecastPowerShortTermStationService;
+
+    @Override
+    public List<AccuracyPassRate> calc(Date startTime,Date endTime,List<PowerStationStatusData> powerStationStatusDataList, List<ElectricField> electricFieldList, List<String> formulaTypes, String province){
+
+        List<AccuracyPassRate> accuracyPassRates = new ArrayList<>();
+
+        List<ForecastPowerShortTermStation> forecastPowerShortTermStationList = forecastPowerShortTermStationService.findByForecastTimeBetween(startTime, endTime);
+
+
+        Map<Integer, List<ForecastPowerShortTermStation>> agoListMap = forecastPowerShortTermStationList.stream().collect(Collectors.groupingBy(ForecastPowerShortTermStation::getForecastHowLongAgo, Collectors.toList()));
+
+        //d1-10
+        for (int ago = 1; ago < 11; ago++) {
+            if (agoListMap.containsKey(ago)) {
+                for (ElectricField electricField : electricFieldList) {
+                    // 获取装机容量
+                    BigDecimal capacity = electricField.getCapacity();
+                    // 获取场站编码
+                    String stationCode = electricField.getStationCode();
+                    // 场站类型
+                    String electricType = electricField.getElectricFieldTypeEnum();
+
+                    AccuracyPassRate accuracyPassRate = new AccuracyPassRate();
+                    accuracyPassRate.setTime(startTime);
+                    accuracyPassRate.setDataSources(DataSourcesEnum.E1);
+                    accuracyPassRate.setForecastType(ForecastTypeEnum.dq);
+                    accuracyPassRate.setStationCode(stationCode);
+                    accuracyPassRate.setForecastHowLongAgo(ago);
+                    List<CalculationInfo> calculationInfoList = new ArrayList<>();
+
+                    // 短期预测功率
+                    Map<Date, List<ForecastPowerShortTermStation>> dateForecastListMap = agoListMap.get(ago).stream().filter(p -> p.getStationCode().equals(stationCode)).collect(Collectors.groupingBy(ForecastPowerShortTermStation::getTime, Collectors.toList()));
+                    // 获取实际功率
+                    Map<Date, List<PowerStationStatusData>> datePowerListMap = powerStationStatusDataList.stream().filter(f -> f.getStationCode().equals(stationCode)).collect(Collectors.groupingBy(PowerStationStatusData::getTime, Collectors.toList()));
+                    //解析中目前不带 开机和装机容量,无法计算准确率,先用场站容量代替
+                    BigDecimal cap = electricField.getCapacity();
+
+                    if (formulaTypes.contains("DAY_SHORT_ACCURACY")) {//准确率计算
+                        // 从开始时间,每隔15分钟,一直循环到当前时间
+                        for (long stepTime = startTime.getTime(); stepTime <= endTime.getTime(); stepTime += 900000L) {
+                            Date finalTime = new Date(stepTime);
+                            // 组装数据
+                            CalculationInfo calculationInfo = new CalculationInfo();
+                            // 如果短期预测功率不为空且站场功率不为空
+                            if (dateForecastListMap.containsKey(finalTime) && datePowerListMap.containsKey(finalTime)) {
+                                ForecastPowerShortTermStation forecastPowerShortTermStation = dateForecastListMap.get(finalTime).get(0);
+                                // 短期预测功率
+                                calculationInfo.setTime(stepTime);
+                                calculationInfo.setForecastAbleValue(forecastPowerShortTermStation.getFpValue());
+                                calculationInfo.setForecastTheoryValue(forecastPowerShortTermStation.getFpValue());
+                                calculationInfo.setForecastCapacity(cap);
+                                calculationInfo.setForecastSuCapacity(cap);
+
+                                PowerStationStatusData powerStationStatusData = datePowerListMap.get(finalTime).get(0);
+                                //实际
+                                calculationInfo.setCapacity(cap);
+                                calculationInfo.setOpenCapacity(cap);
+                                calculationInfo.setAbleValue(powerStationStatusData.getAbleValue());
+                                calculationInfo.setRealValue(powerStationStatusData.getRealValue());
+                                calculationInfo.setTheoryValue(powerStationStatusData.getTheoryValue());
+                            }
+
+                            // 预测功率或实际功率为空的时候,不放入result中
+                            if (calculationInfo.getRealValue() != null && calculationInfo.getAbleValue() != null && calculationInfo.getForecastAbleValue() != null) {
+                                calculationInfoList.add(calculationInfo);
+                            }
+                        }
+
+
+                        if (calculationInfoList == null || calculationInfoList.size() == 0) {
+                            accuracyPassRate.setAccuracy("无可用数据计算");
+                        }else {
+                            // 获取计算基础数据
+                            CalculateRequest calculateRequest = new CalculateRequest();
+                            calculateRequest.setCalculationInfoList(calculationInfoList);
+                            calculateRequest.setElectricCapacity(capacity);
+                            calculateRequest.setProvince(province);
+                            calculateRequest.setStationCode(stationCode);
+                            calculateRequest.setFormulaType("DAY_SHORT_ACCURACY");
+                            calculateRequest.setElectricType(electricType);
+                            calculateRequest.setSign(electricField.getStationCode());
+                            calculateRequest.setStationStatus("无");
+                            calculateRequest.setStationCode(electricField.getStationCode());
+                            CalculateResult resultMap = SpringUtils.getBean(AccuracyPassRateCalculateService.class).calculate(calculateRequest);
+                            // 如果计算成功,从结果中获取value
+                            if (String.valueOf(resultMap.get(CalculateResult.CODE_TAG)).
+                                    equals(CalculateResult.Type.SUCCESS.value())) {
+                                accuracyPassRate.setAccuracy(String.valueOf(resultMap.get(CalculateResult.DATA_TAG)));
+                            } else {
+                                accuracyPassRate.setAccuracy(String.valueOf(resultMap.get(CalculateResult.MSG_TAG)));
+                            }
+
+                        }
+                    }
+                    if (formulaTypes.contains("POINT_SHORT_ACCURACY")) {//单点偏差计算
+                        List<String> results = new ArrayList<>();
+
+                        for (long stepTime = startTime.getTime(); stepTime <= endTime.getTime(); stepTime += 900000L) {
+                            Date finalTime = new Date(stepTime);
+                            // 组装数据
+                            CalculationInfo calculationInfo = new CalculationInfo();
+                            // 如果短期预测功率不为空且站场功率不为空
+                            if (dateForecastListMap.containsKey(finalTime) && datePowerListMap.containsKey(finalTime)) {
+                                ForecastPowerShortTermStation forecastPowerShortTermStation = dateForecastListMap.get(finalTime).get(0);
+                                // 短期预测功率
+                                calculationInfo.setTime(stepTime);
+                                calculationInfo.setForecastAbleValue(forecastPowerShortTermStation.getFpValue());
+                                calculationInfo.setForecastTheoryValue(forecastPowerShortTermStation.getFpValue());
+                                calculationInfo.setForecastCapacity(cap);
+                                calculationInfo.setForecastSuCapacity(cap);
+
+                                PowerStationStatusData powerStationStatusData = datePowerListMap.get(finalTime).get(0);
+                                //实际
+                                calculationInfo.setCapacity(cap);
+                                calculationInfo.setOpenCapacity(cap);
+                                calculationInfo.setAbleValue(powerStationStatusData.getAbleValue());
+                                calculationInfo.setRealValue(powerStationStatusData.getRealValue());
+                                calculationInfo.setTheoryValue(powerStationStatusData.getTheoryValue());
+                            }
+
+                            // 预测功率或实际功率为空的时候,不放入result中
+                            if (calculationInfo.getRealValue() != null && calculationInfo.getAbleValue() != null && calculationInfo.getForecastAbleValue() != null) {
+                                // 获取计算基础数据
+                                CalculateRequest calculateRequest = new CalculateRequest();
+                                calculateRequest.setCalculationInfoList(Arrays.asList(calculationInfo));
+                                calculateRequest.setElectricCapacity(capacity);
+                                calculateRequest.setProvince(province);
+                                calculateRequest.setStationCode(stationCode);
+                                calculateRequest.setFormulaType("POINT_SHORT_ACCURACY");
+                                calculateRequest.setElectricType(electricType);
+                                calculateRequest.setSign(electricField.getStationCode());
+                                calculateRequest.setStationStatus("无");
+                                calculateRequest.setStationCode(electricField.getStationCode());
+                                CalculateResult resultMap = SpringUtils.getBean(AccuracyPassRateCalculateService.class).calculate(calculateRequest);
+                                // 如果计算成功,从结果中获取value
+                                if (String.valueOf(resultMap.get(CalculateResult.CODE_TAG)).
+                                        equals(CalculateResult.Type.SUCCESS.value())) {
+                                    results.add(String.valueOf(resultMap.get(CalculateResult.DATA_TAG)));
+                                } else {
+                                    results.add(String.valueOf(resultMap.get(CalculateResult.MSG_TAG)));
+                                }
+
+                            }
+                        }
+                        if (results.isEmpty()) {
+                            accuracyPassRate.setDeviationSum("无可用数据计算");
+                        } else {
+                            double sum = 0d;
+                            for (String result : results) {
+                                if (result.indexOf("%") > -1 && result.length() < 7) {
+                                    sum += Double.parseDouble(result.replace("%", ""));
+                                }
+                            }
+                            if (accuracyPassRate.getDeviationSum() == null) {
+                                accuracyPassRate.setDeviationSum(BigDecimal.valueOf(sum / 100).setScale(2, BigDecimal.ROUND_HALF_UP) + "");
+                            }
+                        }
+
+                    }
+                    accuracyPassRates.add(accuracyPassRate);
+                }
+            }
+        }
+
+        return accuracyPassRates;
+    }
+
+    @Override
+    public List<String> calculationTypes() {
+        return Arrays.asList("DAY_SHORT_ACCURACY", "POINT_SHORT_ACCURACY");
+    }
+}

+ 26 - 0
cpp-admin/src/main/java/com/cpp/web/service/accuracy/impl/CalculateForecastPowerUltraShortTermCloudImpl.java

@@ -0,0 +1,26 @@
+package com.cpp.web.service.accuracy.impl;
+
+import com.cpp.web.domain.accuracy.AccuracyPassRate;
+import com.cpp.web.domain.station.ElectricField;
+import com.cpp.web.domain.station.PowerStationStatusData;
+import com.cpp.web.service.accuracy.CalculateInterface;
+import com.syjy.calculate.entity.CalculationFormula;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 计算中心测超短期预测分析结果
+ */
+public class CalculateForecastPowerUltraShortTermCloudImpl implements CalculateInterface {
+
+    @Override
+    public List<AccuracyPassRate> calc(Date startTime,Date endTime,List<PowerStationStatusData> powerStationStatusDataList, List<ElectricField> electricFieldList, List<String> formulaTypes, String province){
+        return null;
+    }
+
+    @Override
+    public List<String> calculationTypes() {
+        return null;
+    }
+}

+ 26 - 0
cpp-admin/src/main/java/com/cpp/web/service/accuracy/impl/CalculateForecastPowerUltraShortTermRegulationImpl.java

@@ -0,0 +1,26 @@
+package com.cpp.web.service.accuracy.impl;
+
+import com.cpp.web.domain.accuracy.AccuracyPassRate;
+import com.cpp.web.domain.station.ElectricField;
+import com.cpp.web.domain.station.PowerStationStatusData;
+import com.cpp.web.service.accuracy.CalculateInterface;
+import com.syjy.calculate.entity.CalculationFormula;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 计算调控后超短期预测分析结果
+ */
+public class CalculateForecastPowerUltraShortTermRegulationImpl implements CalculateInterface {
+
+    @Override
+    public List<AccuracyPassRate> calc(Date startTime,Date endTime,List<PowerStationStatusData> powerStationStatusDataList, List<ElectricField> electricFieldList, List<String> formulaTypes, String province){
+        return null;
+    }
+
+    @Override
+    public List<String> calculationTypes() {
+        return null;
+    }
+}

+ 141 - 0
cpp-admin/src/main/java/com/cpp/web/service/accuracy/impl/CalculateForecastPowerUltraShortTermStationImpl.java

@@ -0,0 +1,141 @@
+package com.cpp.web.service.accuracy.impl;
+
+import com.cpp.common.utils.spring.SpringUtils;
+import com.cpp.system.service.ISysConfigService;
+import com.cpp.web.domain.accuracy.AccuracyPassRate;
+import com.cpp.web.domain.enums.DataSourcesEnum;
+import com.cpp.web.domain.enums.ForecastTypeEnum;
+import com.cpp.web.domain.station.ElectricField;
+import com.cpp.web.domain.station.ForecastPowerUltraShortTermStation;
+import com.cpp.web.domain.station.PowerStationStatusData;
+import com.cpp.web.service.accuracy.CalculateInterface;
+import com.cpp.web.service.station.ForecastPowerUltraShortTermStationService;
+import com.syjy.calculate.entity.CalculateRequest;
+import com.syjy.calculate.entity.CalculateResult;
+import com.syjy.calculate.entity.CalculationFormula;
+import com.syjy.calculate.entity.CalculationInfo;
+import com.syjy.calculate.service.AccuracyPassRateCalculateService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 计算站端超短期预测分析结果
+ */
+@Service
+@RequiredArgsConstructor
+public class CalculateForecastPowerUltraShortTermStationImpl implements CalculateInterface {
+    private final ForecastPowerUltraShortTermStationService forecastPowerUltraShortTermStationService;
+
+    private final ISysConfigService sysConfigService;
+
+    @Override
+    public List<AccuracyPassRate> calc(Date startTime,Date endTime,List<PowerStationStatusData> powerStationStatusDataList, List<ElectricField> electricFieldList, List<String> formulaTypes, String province){
+
+        List<AccuracyPassRate> accuracyPassRates = new ArrayList<>();
+        String cdq_ac_point = sysConfigService.selectConfigByKey("cdq_ac_point");
+        int ago = 1;
+        try {
+            ago = Integer.parseInt(cdq_ac_point);
+        } catch (Exception e) {
+//            e.printStackTrace();
+        }
+
+
+        List<ForecastPowerUltraShortTermStation> forecastPowerShortTermStationList = forecastPowerUltraShortTermStationService.findByForecastTimeBetweenAndHowLongAgo(startTime, endTime, ago);
+
+        for (ElectricField electricField : electricFieldList) {
+            // 获取装机容量
+            BigDecimal capacity = electricField.getCapacity();
+            // 获取场站编码
+            String stationCode = electricField.getStationCode();
+            // 场站类型
+            String electricType = electricField.getElectricFieldTypeEnum();
+
+            AccuracyPassRate accuracyPassRate = new AccuracyPassRate();
+            accuracyPassRate.setTime(startTime);
+            accuracyPassRate.setDataSources(DataSourcesEnum.E1);
+            accuracyPassRate.setForecastType(ForecastTypeEnum.cdq);
+            accuracyPassRate.setStationCode(stationCode);
+            accuracyPassRate.setForecastHowLongAgo(ago);
+            List<CalculationInfo> calculationInfoList = new ArrayList<>();
+
+            // 获取实际功率
+            Map<Date, List<ForecastPowerUltraShortTermStation>> dateForecastListMap = forecastPowerShortTermStationList.stream().filter(p -> p.getStationCode().equals(stationCode)).collect(Collectors.groupingBy(ForecastPowerUltraShortTermStation::getTime, Collectors.toList()));
+            // 短期预测功率
+            Map<Date, List<PowerStationStatusData>> datePowerListMap = powerStationStatusDataList.stream().filter(f -> f.getStationCode().equals(stationCode)).collect(Collectors.groupingBy(PowerStationStatusData::getTime, Collectors.toList()));
+            //解析中目前不带 开机和装机容量,无法计算准确率,先用场站容量代替
+            BigDecimal cap = electricField.getCapacity();
+
+            if (formulaTypes.contains("DAY_ULTRA_SHORT_ACCURACY")) {
+                // 从开始时间,每隔15分钟,一直循环到当前时间
+                for (long stepTime = startTime.getTime(); stepTime <= endTime.getTime(); stepTime += 900000L) {
+                    Date finalTime = new Date(stepTime);
+                    // 组装数据
+                    CalculationInfo calculationInfo = new CalculationInfo();
+                    // 如果短期预测功率不为空且站场功率不为空
+                    if (dateForecastListMap.containsKey(finalTime) && datePowerListMap.containsKey(finalTime)) {
+                        ForecastPowerUltraShortTermStation forecastPowerUltraShortTermStation = dateForecastListMap.get(finalTime).get(0);
+                        // 短期预测功率
+                        calculationInfo.setTime(stepTime);
+                        calculationInfo.setForecastAbleValue(forecastPowerUltraShortTermStation.getFpValue());
+                        calculationInfo.setForecastTheoryValue(forecastPowerUltraShortTermStation.getFpValue());
+                        calculationInfo.setForecastCapacity(cap);
+                        calculationInfo.setForecastSuCapacity(cap);
+
+                        PowerStationStatusData powerStationStatusData = datePowerListMap.get(finalTime).get(0);
+                        //实际
+                        calculationInfo.setCapacity(cap);
+                        calculationInfo.setOpenCapacity(cap);
+                        calculationInfo.setRealValue(powerStationStatusData.getRealValue());
+                        calculationInfo.setAbleValue(powerStationStatusData.getAbleValue());
+                        calculationInfo.setTheoryValue(powerStationStatusData.getTheoryValue());
+                    }
+
+                    // 预测功率或实际功率为空的时候,不放入result中
+                    if (calculationInfo.getRealValue() != null && calculationInfo.getAbleValue() != null && calculationInfo.getForecastAbleValue() != null) {
+                        calculationInfoList.add(calculationInfo);
+                    }
+                }
+
+
+                if (calculationInfoList == null || calculationInfoList.size() == 0) {
+                    accuracyPassRate.setAccuracy("无可用数据计算");
+                    accuracyPassRates.add(accuracyPassRate);
+                    continue;
+                }
+                // 获取计算基础数据
+                CalculateRequest calculateRequest = new CalculateRequest();
+                calculateRequest.setCalculationInfoList(calculationInfoList);
+                calculateRequest.setElectricCapacity(capacity);
+                calculateRequest.setProvince(province);
+                calculateRequest.setStationCode(stationCode);
+                calculateRequest.setFormulaType("DAY_ULTRA_SHORT_ACCURACY");
+                calculateRequest.setElectricType(electricType);
+                calculateRequest.setSign(electricField.getStationCode());
+                calculateRequest.setStationStatus("无");
+                calculateRequest.setStationCode(electricField.getStationCode());
+                CalculateResult resultMap = SpringUtils.getBean(AccuracyPassRateCalculateService.class).calculate(calculateRequest);
+                // 如果计算成功,从结果中获取value
+                if (String.valueOf(resultMap.get(CalculateResult.CODE_TAG)).
+                        equals(CalculateResult.Type.SUCCESS.value())) {
+                    accuracyPassRate.setAccuracy(String.valueOf(resultMap.get(CalculateResult.DATA_TAG)));
+                } else {
+                    accuracyPassRate.setAccuracy(String.valueOf(resultMap.get(CalculateResult.MSG_TAG)));
+                }
+
+                accuracyPassRates.add(accuracyPassRate);
+            }
+
+        }
+        return accuracyPassRates;
+    }
+
+    @Override
+    public List<String> calculationTypes() {
+        return Arrays.asList("DAY_ULTRA_SHORT_ACCURACY");
+    }
+}

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

@@ -68,129 +68,128 @@ public class CloudFileParsing {
 //    @Scheduled(fixedRate = 300000L)
     @Scheduled(fixedRate = 60000L)
     public void parsingFile() {
-        {
-            log.info("-----------------开始执行预测文件解析任务----------------------");
-            Long currentDate = DateTimeUtil.getMillisecondsSubDay();//今日凌晨
-            boolean flag = false;
-
-            //判断该目录是否存在,不存在时创建
-            if (!fileNewDir.exists()) {
-                fileNewDir.mkdirs();
-                log.info("【" + fileNewDir.getPath() + "】目录不存在,系统自动创建文件目录");
-            }
-            log.info("系统扫描路径【" + fileNewDir.getPath() + "】");
-            // 获取指定目录下的文件
-            Collection<File> files = FileUtils.listFiles(fileNewDir, new String[]{"RB", "txt"}, false);
-            //当前时间格式化为年月日
-            String dayStr = new SimpleDateFormat("yyyyMMdd").format(new Date());
 
+        log.info("-----------------开始执行预测文件解析任务----------------------");
+        Long currentDate = DateTimeUtil.getMillisecondsSubDay();//今日凌晨
+        boolean flag = false;
 
-            // 如果指定目录下有文件
-            if (files.size() > 0) {
+        //判断该目录是否存在,不存在时创建
+        if (!fileNewDir.exists()) {
+            fileNewDir.mkdirs();
+            log.info("【" + fileNewDir.getPath() + "】目录不存在,系统自动创建文件目录");
+        }
+        log.info("系统扫描路径【" + fileNewDir.getPath() + "】");
+        // 获取指定目录下的文件
+        Collection<File> files = FileUtils.listFiles(fileNewDir, new String[]{"RB", "txt"}, false);
+        //当前时间格式化为年月日
+        String dayStr = new SimpleDateFormat("yyyyMMdd").format(new Date());
 
-                List<ParsingLog> parsingLogs = new ArrayList<>();
-                List<AbnormalAlarm> abnormalAlarms = new ArrayList<>();
 
-                // 循环文件并解析
-                for (File file : files) {
-                    ParsingLog parsingLog = new ParsingLog();
-                    flag = false;
+        // 如果指定目录下有文件
+        if (files.size() > 0) {
 
-                    String fileName = file.getName();
+            List<ParsingLog> parsingLogs = new ArrayList<>();
+            List<AbnormalAlarm> abnormalAlarms = new ArrayList<>();
 
-                    parsingLog.setDataSources(DataSourcesEnum.E2);
-                    parsingLog.setParsingTime(new Date());
-                    parsingLog.setFileName(fileName);
+            // 循环文件并解析
+            for (File file : files) {
+                ParsingLog parsingLog = new ParsingLog();
+                flag = false;
 
-                    // 如果文件不是当然的,删除文件
-                    if (!fileName.contains(dayStr)) {
-                        file.delete();
-                        log.warn(fileName + "不是当天的文件,删除!");
-                        break;
-                    }
-                    // 如果文件名长度符合规则
-                    if (fileName.length() < 30) {
-                        // 如果是短期文件
-                        if (file.getName().startsWith("DQ")) {
-                            try {
-                                parsingLog.setFileType(FileTypeEnum.dq);
-                                // 解析短期文件
-                                List<ForecastPowerShortTermCloud> listDq = fileAnalysisShortTerm(file, new Date(currentDate));
-                                if (!listDq.isEmpty()) {
-                                    try {
-                                        parsingLog.setStationCode(listDq.get(0).getStationCode());
-                                        forecastPowerShortTermCloudService.saveBatch(listDq);
-                                        flag = true;
-                                    } catch (Exception e) {
-                                        log.error("保存短期数据报错:"+fileName, e);
-                                        parsingLog.setParsingDescribe("保存短期数据报错:"+fileName);
-                                        flag = false;
-                                    }
-                                } else {
-                                    log.info(file.getName() + "文件数据内容为空、不能正常解析 、移除该文件:"+fileName);
-                                    parsingLog.setParsingDescribe("文件数据内容为空、不能正常解析 、移除该文件:"+fileName);
-                                    flag = false;
-                                }
+                String fileName = file.getName();
 
+                parsingLog.setDataSources(DataSourcesEnum.E2);
+                parsingLog.setParsingTime(new Date());
+                parsingLog.setFileName(fileName);
 
-                            } catch (Exception e) {
+                // 如果文件不是当然的,删除文件
+                if (!fileName.contains(dayStr)) {
+                    file.delete();
+                    log.warn(fileName + "不是当天的文件,删除!");
+                    break;
+                }
+                // 如果文件名长度符合规则
+                if (fileName.length() < 30) {
+                    // 如果是短期文件
+                    if (file.getName().startsWith("DQ")) {
+                        try {
+                            parsingLog.setFileType(FileTypeEnum.dq);
+                            // 解析短期文件
+                            List<ForecastPowerShortTermCloud> listDq = fileAnalysisShortTerm(file, new Date(currentDate));
+                            if (!listDq.isEmpty()) {
+                                try {
+                                    parsingLog.setStationCode(listDq.get(0).getStationCode());
+                                    forecastPowerShortTermCloudService.saveBatch(listDq);
+                                    flag = true;
+                                } catch (Exception e) {
+                                    log.error("保存短期数据报错:" + fileName, e);
+                                    parsingLog.setParsingDescribe("保存短期数据报错:" + fileName);
+                                    flag = false;
+                                }
+                            } else {
+                                log.info(file.getName() + "文件数据内容为空、不能正常解析 、移除该文件:" + fileName);
+                                parsingLog.setParsingDescribe("文件数据内容为空、不能正常解析 、移除该文件:" + fileName);
                                 flag = false;
-                                parsingLog.setParsingDescribe("解析DQ文件异常:"+fileName);
-                                log.error("解析DQ文件失败:"+fileName, e);
                             }
+
+
+                        } catch (Exception e) {
+                            flag = false;
+                            parsingLog.setParsingDescribe("解析DQ文件异常:" + fileName);
+                            log.error("解析DQ文件失败:" + fileName, e);
                         }
+                    }
 
 
-                        if (file.getName().startsWith("NWP")) {
-                            try {
-                                parsingLog.setFileType(FileTypeEnum.nwp);
-                                List<NwpCloud> listNwp = fileAnalysisNwp(file,new Date(currentDate));
-                                if (!listNwp.isEmpty()) {
-                                    try {
-                                        parsingLog.setStationCode(listNwp.get(0).getStationCode());
-                                        nwpCloudService.saveBatch(listNwp);
-                                        flag = true;
-                                    } catch (Exception e) {
-                                        log.error("保存NWP数据报错:"+fileName, e);
-                                        parsingLog.setParsingDescribe("保存NWP数据报错:"+fileName);
-                                        flag = false;
-                                    }
-                                } else {
-                                    parsingLog.setParsingDescribe("文件数据内容为空、不能正常解析 、移除该文件:"+fileName);
-                                    log.info(file.getName() + "文件数据内容为空、不能正常解析 、移除该文件");
+                    if (file.getName().startsWith("NWP")) {
+                        try {
+                            parsingLog.setFileType(FileTypeEnum.nwp);
+                            List<NwpCloud> listNwp = fileAnalysisNwp(file, new Date(currentDate));
+                            if (!listNwp.isEmpty()) {
+                                try {
+                                    parsingLog.setStationCode(listNwp.get(0).getStationCode());
+                                    nwpCloudService.saveBatch(listNwp);
+                                    flag = true;
+                                } catch (Exception e) {
+                                    log.error("保存NWP数据报错:" + fileName, e);
+                                    parsingLog.setParsingDescribe("保存NWP数据报错:" + fileName);
                                     flag = false;
                                 }
-                            } catch (Exception e) {
-                                log.error("解析NWP文件失败:"+fileName, e);
-                                parsingLog.setParsingDescribe("解析NWP文件失败:"+fileName);
+                            } else {
+                                parsingLog.setParsingDescribe("文件数据内容为空、不能正常解析 、移除该文件:" + fileName);
+                                log.info(file.getName() + "文件数据内容为空、不能正常解析 、移除该文件");
                                 flag = false;
                             }
+                        } catch (Exception e) {
+                            log.error("解析NWP文件失败:" + fileName, e);
+                            parsingLog.setParsingDescribe("解析NWP文件失败:" + fileName);
+                            flag = false;
                         }
+                    }
 
 
-                        if (flag) {
-                            parsingLog.setParsingFileStatus("成功");
-                            moveFile(file);
-                        } else {
-                            parsingLog.setParsingFileStatus("失败");
-                            abnormalAlarms.add(new AbnormalAlarm(DataSourcesEnum.E2,AlarmEnum.E4,parsingLog.getParsingDescribe(),""));
-                            //移除文件备份到error文件下
-                            moveFileError(file);
-                        }
-                        parsingLogs.add(parsingLog);
+                    if (flag) {
+                        parsingLog.setParsingFileStatus("成功");
+                        moveFile(file);
+                    } else {
+                        parsingLog.setParsingFileStatus("失败");
+                        abnormalAlarms.add(new AbnormalAlarm(DataSourcesEnum.E2, AlarmEnum.E4, parsingLog.getParsingDescribe(), ""));
+                        //移除文件备份到error文件下
+                        moveFileError(file);
                     }
-                }
-                if (parsingLogs.size()>0){
-                    parsingLogService.saveBatch(parsingLogs);
-                }
-                if (abnormalAlarms.size()>0){
-                    abnormalAlarmService.saveBatch(abnormalAlarms);
+                    parsingLogs.add(parsingLog);
                 }
             }
+            if (parsingLogs.size() > 0) {
+                parsingLogService.saveBatch(parsingLogs);
+            }
+            if (abnormalAlarms.size() > 0) {
+                abnormalAlarmService.saveBatch(abnormalAlarms);
+            }
+        }
 
 
-            log.info("-----------------执行预测文件解析任务完成----------------------");
-        }
+        log.info("-----------------执行预测文件解析任务完成----------------------");
 
     }
 
@@ -226,11 +225,11 @@ public class CloudFileParsing {
                     if (datas[0].startsWith("<集中")) {
                         stationCode = ParsingUtil.splitLineWithSpace(datas[0])[1].split("'")[1];
                         // 使用单引号分割字符串
-                        forecastModel =  ParsingUtil.splitLineWithSpace(datas[0])[2].split("'")[1];
+                        forecastModel = ParsingUtil.splitLineWithSpace(datas[0])[2].split("'")[1];
                     }
 
 
-                    if (!stationCode.equals("")&&!forecastModel.equals("")&&datas.length >= 35 && datas[0].startsWith("#")) {
+                    if (!stationCode.equals("") && !forecastModel.equals("") && datas.length >= 35 && datas[0].startsWith("#")) {
                         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                         //过滤当天的数据
                         //if (sdf.parse(datas[5]).getTime() >= TimeUtils.getMillisecondsSubDay() + 24 * 60 * 60 *
@@ -383,7 +382,7 @@ public class CloudFileParsing {
                     if (string_arr[0].startsWith("<集中")) {
                         stationCode = ParsingUtil.splitLineWithSpace(string_arr[0])[1].split("'")[1];
                         // 使用单引号分割字符串
-                        forecastModel =  ParsingUtil.splitLineWithSpace(string_arr[0])[2].split("'")[1];
+                        forecastModel = ParsingUtil.splitLineWithSpace(string_arr[0])[2].split("'")[1];
                     }
 
                     if (string_arr.length == 4) {

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

@@ -2,6 +2,7 @@ package com.cpp.web.service.cloud;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.cpp.web.domain.cloud.ForecastPowerShortTermCloud;
+import com.cpp.web.domain.cloud.ForecastPowerUltraShortTermCloud;
 
 import java.util.Date;
 import java.util.List;
@@ -23,4 +24,7 @@ public interface ForecastPowerShortTermCloudService extends IService<ForecastPow
      */
     List<ForecastPowerShortTermCloud> findByStationCodeAndStartTimeAndEndTime(String stationCode, Date startTime, Date endTime);
 
-    List<ForecastPowerShortTermCloud> findByStationCodeAndStartTimeAndEndTimeAndForecastManufactor(String stationCode, Date startTime, Date endTime, String forecastManufactor);}
+    List<ForecastPowerShortTermCloud> findByStationCodeAndStartTimeAndEndTimeAndForecastManufactor(String stationCode, Date startTime, Date endTime, String forecastManufactor);
+
+    List<ForecastPowerShortTermCloud> findByForecastTimeBetweenAndHowLongAgo(Date startTime, Date endTime, Integer howLongAgo);
+}

+ 13 - 0
cpp-admin/src/main/java/com/cpp/web/service/cloud/impl/ForecastPowerShortTermCloudServiceImpl.java

@@ -3,6 +3,7 @@ package com.cpp.web.service.cloud.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.cpp.web.domain.cloud.ForecastPowerShortTermCloud;
+import com.cpp.web.domain.cloud.ForecastPowerUltraShortTermCloud;
 import com.cpp.web.mapper.cloud.ForecastPowerShortTermCloudMapper;
 import com.cpp.web.service.cloud.ForecastPowerShortTermCloudService;
 import org.springframework.stereotype.Service;
@@ -32,6 +33,7 @@ public class ForecastPowerShortTermCloudServiceImpl extends ServiceImpl<Forecast
 
         return baseMapper.selectList(wrapper);
     }
+
     @Override
     public List<ForecastPowerShortTermCloud> findByStationCodeAndStartTimeAndEndTimeAndForecastManufactor(String stationCode, Date startTime, Date endTime, String forecastManufactor) {
         QueryWrapper<ForecastPowerShortTermCloud> wrapper = new QueryWrapper<>();
@@ -47,4 +49,15 @@ public class ForecastPowerShortTermCloudServiceImpl extends ServiceImpl<Forecast
         return baseMapper.selectList(wrapper);
     }
 
+    @Override
+    public List<ForecastPowerShortTermCloud> findByForecastTimeBetweenAndHowLongAgo(Date startTime, Date endTime, Integer howLongAgo) {
+        QueryWrapper<ForecastPowerShortTermCloud> wrapper = new QueryWrapper<>();
+
+        if (startTime != null && !startTime.equals("") && endTime != null && !endTime.equals("")) {
+            wrapper.between("time", startTime, endTime);
+        }
+        wrapper.eq("forecast_how_long_ago", howLongAgo);
+        return baseMapper.selectList(wrapper);
+    }
+
 }

+ 0 - 25
cpp-admin/src/main/java/com/cpp/web/service/datafactory/ChannelStatusService.java

@@ -1,25 +0,0 @@
-//package com.cpp.web.service.datafactory;
-//
-//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-//import com.baomidou.mybatisplus.extension.service.IService;
-//import com.jiayue.ipp.common.data.entity.an.ChannelStatus;
-//
-///**
-// * 通道状态表
-// *
-// * @author csc code generator
-// * @date 2022-12-28 14:49:40
-// */
-//public interface ChannelStatusService extends IService<ChannelStatus> {
-//    /**
-//     * 根据上报时间 场站编号 通道状态 通道类型 构造查询条件
-//     *
-//     * @param stationCode       场站编号
-//     * @param startTime         上报时间
-//     * @param endTime           上报时间
-//     * @param channelStatusCode 通道状态
-//     * @param channelTypeCode   通道类型
-//     * @return 查询条件
-//     */
-//    QueryWrapper<ChannelStatus> findByStationCodeAndStartTimeBetweenAndChannelStatusAndChannelType(String stationCode, Long startTime, Long endTime, String channelStatusCode, String channelTypeCode);
-//}

+ 0 - 371
cpp-admin/src/main/java/com/cpp/web/service/datafactory/CloudFileParsing.java

@@ -1,371 +0,0 @@
-//package com.cpp.web.service.datafactory;
-//
-//import cn.hutool.core.date.DateUtil;
-//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-//import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-//import com.jiayue.ipfcst.common.core.util.DateMomentUtil;
-//import com.jiayue.ipfcst.common.core.util.NumberUtils;
-//import com.jiayue.ipp.common.data.entity.ForecastPowerShortTerm;
-//import com.jiayue.ipp.common.data.entity.ForecastPowerShortTermHis;
-//import com.jiayue.ipp.common.data.entity.Nwp;
-//import com.jiayue.ipp.common.data.entity.an.ParsingChannel;
-//import com.jiayue.ipp.common.data.entity.an.ParsingLog;
-//import com.jiayue.ipp.common.data.entity.an.ParsingUrl;
-//import lombok.AllArgsConstructor;
-//import lombok.extern.slf4j.Slf4j;
-//import org.apache.commons.io.FileUtils;
-//import org.apache.commons.lang.StringUtils;
-//import org.apache.commons.lang.time.DateFormatUtils;
-//import org.springframework.stereotype.Service;
-//import org.springframework.transaction.annotation.Transactional;
-//
-//import java.io.BufferedReader;
-//import java.io.File;
-//import java.io.IOException;
-//import java.io.InputStreamReader;
-//import java.math.BigDecimal;
-//import java.math.RoundingMode;
-//import java.nio.charset.StandardCharsets;
-//import java.nio.file.Files;
-//import java.text.ParseException;
-//import java.text.SimpleDateFormat;
-//import java.util.ArrayList;
-//import java.util.Date;
-//import java.util.List;
-//
-///**
-// * 云端文件解析
-// *
-// * @author tl
-// * @date 2022-05-11 09:51:21
-// */
-//@AllArgsConstructor
-//@Slf4j
-//@Service
-//@Transactional
-//public class CloudFileParsing {
-//
-//
-//    /**
-//     * 解析
-//     *
-//     * @param parsingChannel
-//     */
-//    public void parsing(ParsingChannel parsingChannel) {
-//
-//        //过滤出当前解析通道下在使用的《 解析路径 》
-//        List<ParsingUrl> parsingUrls = parsingUrlService.list(Wrappers.lambdaQuery(ParsingUrl.class).eq(ParsingUrl::getCId, parsingChannel.getId()).eq(ParsingUrl::getUrlStatus, "1"));
-//        String dateDir = DateFormatUtils.format(new Date(), "yyyyMMdd");
-//        String dayStr = new SimpleDateFormat("yyyyMMdd").format(new Date());
-//        //遍历解析路径,对文件进行解析
-//        for (ParsingUrl parsingUrl : parsingUrls) {
-//
-//            String failDir = parsingUrl.getUrl() + File.separator + "fail" + File.separator + dateDir;
-//
-//            String success = parsingUrl.getUrl() + File.separator + "success" + File.separator + dateDir;
-//
-//            String path = parsingUrl.getUrl() + File.separator + "new";
-//
-//            File dirFile = new File(path);
-//
-//            if (!dirFile.exists()) {
-//                dirFile.mkdirs();
-//            }
-//            File[] files = dirFile.listFiles();
-//            log.info("扫描路径:{},文件数:{}", path, files.length);
-//            //遍历文件
-//            for (File file : files) {
-//                String fileName = file.getName();
-//                ParsingLog parsingLog = new ParsingLog();
-//                parsingLog.setFileName(fileName);
-//                parsingLog.setStationCode(parsingUrl.getStationCode());
-//                parsingLog.setParsingTime(new Date());
-//
-//                if (!fileName.contains(dayStr)) {
-//                    file.delete();
-//                    log.warn(parsingUrl.getStationCode() + "下" + fileName + "云端文件不是当天的文件,删除!");
-//                    break;
-//                }
-//
-//                // 如果是短期文件
-//                if (file.getName().startsWith("DQ")) {
-//                    try {
-//                        // 解析短期文件
-//                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-//                        List<ForecastPowerShortTerm> forecastPowerShortTermList = new ArrayList<>();
-//                        List<ForecastPowerShortTermHis> forecastPowerShortTermHisList = new ArrayList<>();
-//                        // 当文件未被使用时,进行解析上报
-//                        if (file.renameTo(file)) {
-//                            InputStreamReader read = null;
-//                            BufferedReader bufferedReader = null;
-//                            String stringLine;
-//                            ForecastPowerShortTerm stf;
-//                            try {
-//                                read = new InputStreamReader(Files.newInputStream(file.toPath()), StandardCharsets.UTF_8);
-//                                bufferedReader = new BufferedReader(read);
-//                                Long systemTime = System.currentTimeMillis();
-//                                // 循环解析文件
-//                                while ((stringLine = bufferedReader.readLine()) != null) {
-//                                    String[] string_arr = stringLine.split("\t");
-//                                    if (string_arr.length == 4 && string_arr[0].startsWith("#")) {
-//                                        if (StringUtils.isNotEmpty(string_arr[2])) {
-//                                            // 实时表
-//                                            stf = new ForecastPowerShortTerm();
-//                                            stf.setFpValue(new BigDecimal(string_arr[3]));
-//                                            stf.setForecastTime(sdf.parse(string_arr[2]));
-//                                            stf.setGenDate(new Date());
-//                                            stf.setStationCode(parsingUrl.getStationCode());
-//                                            stf.setForecastManufactor(parsingUrl.getForecastManufactor());
-//                                            forecastPowerShortTermList.add(stf);
-//
-//                                            // 历史表
-//                                            //过滤当天的数据
-//                                            long secondDayTime = com.jiayue.ipp.idp.util.DateMomentUtil.getDayStartTime(systemTime) + 1000 * 60 * 60 * 24;
-//                                            if (sdf.parse(string_arr[2]).getTime() >= secondDayTime) {
-//                                                ForecastPowerShortTermHis forecastPowerShortTermHis = new ForecastPowerShortTermHis();
-//                                                forecastPowerShortTermHis.setGenDate(new Date());
-//                                                forecastPowerShortTermHis.setStationCode(parsingUrl.getStationCode());
-//                                                forecastPowerShortTermHis.setAbleValue(new BigDecimal(string_arr[3]));
-//                                                forecastPowerShortTermHis.setForecastTime(sdf.parse(string_arr[2]));
-//                                                forecastPowerShortTermHis.setForecastHowLongAgo(DateMomentUtil.getDaysBetweenTwoDate(systemTime, sdf.parse(string_arr[2]).getTime()));
-//                                                forecastPowerShortTermHis.setForecastManufactor(parsingUrl.getForecastManufactor());
-//                                                forecastPowerShortTermHisList.add(forecastPowerShortTermHis);
-//                                            }
-//                                        }
-//                                    }
-//                                }
-//
-//                                if (forecastPowerShortTermList.size() > 0 && forecastPowerShortTermHisList.size() > 0) {
-//                                    // 保存短期实时
-//                                    Date startTime = forecastPowerShortTermList.get(0).getForecastTime();
-//                                    Date endTime = forecastPowerShortTermList.get(forecastPowerShortTermList.size() - 1).getForecastTime();
-//                                    LambdaQueryWrapper<ForecastPowerShortTerm> lambdaQueryWrapper = new LambdaQueryWrapper<>();
-//                                    lambdaQueryWrapper.eq(ForecastPowerShortTerm::getStationCode, parsingUrl.getStationCode());
-//                                    lambdaQueryWrapper.eq(ForecastPowerShortTerm::getForecastManufactor, parsingUrl.getForecastManufactor());
-//                                    lambdaQueryWrapper.between(ForecastPowerShortTerm::getForecastTime, startTime, endTime);
-//                                    forecastPowerShortTermService.remove(lambdaQueryWrapper);
-//                                    forecastPowerShortTermService.saveBatch(forecastPowerShortTermList);
-//
-//                                    // 保存短期历史
-//                                    LambdaQueryWrapper<ForecastPowerShortTermHis> forecastPowerShortTermHisLambdaQueryWrapper = new LambdaQueryWrapper<>();
-//                                    forecastPowerShortTermHisLambdaQueryWrapper.eq(ForecastPowerShortTermHis::getStationCode, parsingUrl.getStationCode());
-//                                    forecastPowerShortTermHisLambdaQueryWrapper.eq(ForecastPowerShortTermHis::getForecastManufactor, parsingUrl.getForecastManufactor());
-//                                    forecastPowerShortTermHisLambdaQueryWrapper.eq(ForecastPowerShortTermHis::getGenDate, DateUtil.format(new Date(), "yyyy-MM-dd"));
-//                                    forecastPowerShortTermHisService.remove(forecastPowerShortTermHisLambdaQueryWrapper);
-//                                    forecastPowerShortTermHisService.saveBatch(forecastPowerShortTermHisList);
-//                                    log.info(parsingUrl.getStationCode() + "下" + fileName + "嘉越云端文件解析成功!");
-//                                    try {
-//                                        File file1 = new File(success + File.separator + fileName);
-//                                        if (file1.exists()) {
-//                                            file1.delete();
-//                                        }
-//                                        FileUtils.moveFile(file, new File(success + File.separator + fileName));
-//                                    } catch (IOException e) {
-//                                        e.printStackTrace();
-//                                    }
-//                                }
-//                            } catch (Exception e) {
-//                                log.error("嘉越云端文件解析失败:", e);
-//                                try {
-//                                    File file1 = new File(failDir + File.separator + fileName);
-//                                    if (file1.exists()) {
-//                                        file1.delete();
-//                                    }
-//                                    FileUtils.moveFile(file, new File(failDir + File.separator + fileName));
-//                                } catch (IOException ex) {
-//                                    log.error(parsingUrl.getStationCode() + "下" + fileName + "嘉越云端文件解析失败1", ex);
-//                                }
-//                            } finally {
-//                                close(bufferedReader, read);
-//                            }
-//                        }
-//                    } catch (Exception e) {
-//                        log.error(parsingUrl.getStationCode() + "下" + fileName + "解析嘉越云端DQ文件失败", e);
-//                        try {
-//                            File file1 = new File(failDir + File.separator + fileName);
-//                            if (file1.exists()) {
-//                                file1.delete();
-//                            }
-//                            FileUtils.moveFile(file, new File(failDir + File.separator + fileName));
-//                        } catch (IOException ex) {
-//                            log.error(parsingUrl.getStationCode() + "下" + fileName + "嘉越云端文件解析失败1", ex);
-//                        }
-//                    }
-//                }
-//
-//                if (file.getName().startsWith("NWP")) {
-//                    List<Nwp> listNwp = new ArrayList<>();
-//                    if (file.renameTo(file)) {
-//                        InputStreamReader readNwp = null;
-//                        BufferedReader bufferedReaderNwp = null;
-//                        try {
-//                            readNwp = new InputStreamReader(Files.newInputStream(file.toPath()), StandardCharsets.UTF_8);//考虑到编码格式
-//                            bufferedReaderNwp = new BufferedReader(readNwp);
-//                            String lineTxt;
-//                            Nwp nwpData;
-//                            BigDecimal nwpDirectRadiation = new BigDecimal("0.7"); //直接辐射
-//                            BigDecimal nwpDiffuseRadiation = new BigDecimal("0.3"); //散接辐射
-//
-//                            while ((lineTxt = bufferedReaderNwp.readLine()) != null) {
-//                                //NWP文件按照Tab方式截取
-//                                String[] datas = lineTxt.split("\t");
-//                                if (datas.length >= 35 && datas[0].startsWith("#")) {
-//                                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-//                                    //过滤当天的数据
-//                                    //if (sdf.parse(datas[5]).getTime() >= TimeUtils.getMillisecondsSubDay() + 24 * 60 * 60 *
-//                                    // 1000) {
-//                                    nwpData = new Nwp();
-//                                    nwpData.setForecastManufactor(parsingUrl.getForecastManufactor());
-//                                    //将截取的文件放入nwpData中
-//                                    nwpData.setStationCode(parsingUrl.getStationCode());
-////                                    nwpData.setScDate(datas[2]);
-////                                    nwpData.setScTime(datas[3]);
-////                                    nwpData.setPreDate(datas[4]);
-//                                    nwpData.setPreTime(sdf.parse(datas[5]));//采集时间 与 短期预测时间关联
-//                                    nwpData.setT(NumberUtils.subtract(new BigDecimal(datas[6]), new BigDecimal("273.15")));//温度
-//
-//                                    nwpData.setSenf(new BigDecimal(datas[11]).setScale(2, RoundingMode.HALF_UP));//感热
-//                                    nwpData.setSwr(new BigDecimal(datas[9]).setScale(2, RoundingMode.HALF_UP));//短波辐射(相当于总辐射)
-//                                    nwpData.setLwr(new BigDecimal(datas[10]).setScale(2, RoundingMode.HALF_UP));//短波辐射(相当于总辐射)
-//                                    nwpData.setPressure(new BigDecimal(datas[8]).setScale(2, RoundingMode.HALF_UP));//地表气压
-//                                    nwpData.setRh(new BigDecimal(datas[7]).setScale(2, RoundingMode.HALF_UP));//2m相对湿度
-//                                    nwpData.setDiffuseRadiation(new BigDecimal(datas[9]).multiply(nwpDiffuseRadiation).setScale(2, RoundingMode.HALF_UP));//散接辐射
-//                                    nwpData.setDirectRadiation(new BigDecimal(datas[9]).multiply(nwpDirectRadiation).setScale(2, RoundingMode.HALF_UP));//直接辐射
-//
-//                                    nwpData.setWs10(new BigDecimal(datas[19]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWs30(new BigDecimal(datas[20]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWs50(new BigDecimal(datas[21]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWs70(new BigDecimal(datas[22]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWs80(new BigDecimal(datas[23]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWs90(new BigDecimal(datas[24]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWs100(new BigDecimal(datas[25]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWs170(new BigDecimal(datas[26]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWd10(new BigDecimal(datas[27]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWd30(new BigDecimal(datas[28]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWd50(new BigDecimal(datas[29]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWd70(new BigDecimal(datas[30]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWd80(new BigDecimal(datas[31]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWd90(new BigDecimal(datas[32]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWd100(new BigDecimal(datas[33]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWd170(new BigDecimal(datas[34]).setScale(2, RoundingMode.HALF_UP));
-//                                    if (datas.length > 35) {
-//                                        //nwp 新增解析内容
-////                                        nwpData.setWs20(new BigDecimal(datas[35]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWs40(new BigDecimal(datas[36]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWs60(new BigDecimal(datas[37]).setScale(2, RoundingMode.HALF_UP));
-//                                        nwpData.setWs110(new BigDecimal(datas[38]).setScale(2, RoundingMode.HALF_UP));
-//                                        nwpData.setWs120(new BigDecimal(datas[39]).setScale(2, RoundingMode.HALF_UP));
-//                                        nwpData.setWs130(new BigDecimal(datas[40]).setScale(2, RoundingMode.HALF_UP));
-//                                        nwpData.setWs140(new BigDecimal(datas[41]).setScale(2, RoundingMode.HALF_UP));
-//                                        nwpData.setWs150(new BigDecimal(datas[42]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWs160(new BigDecimal(datas[43]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWs180(new BigDecimal(datas[44]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWs190(new BigDecimal(datas[45]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWs200(new BigDecimal(datas[46]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWd20(new BigDecimal(datas[47]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWd40(new BigDecimal(datas[48]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWd60(new BigDecimal(datas[49]).setScale(2, RoundingMode.HALF_UP));
-//                                        nwpData.setWd110(new BigDecimal(datas[50]).setScale(2, RoundingMode.HALF_UP));
-//                                        nwpData.setWd120(new BigDecimal(datas[51]).setScale(2, RoundingMode.HALF_UP));
-//                                        nwpData.setWd130(new BigDecimal(datas[52]).setScale(2, RoundingMode.HALF_UP));
-//                                        nwpData.setWd140(new BigDecimal(datas[53]).setScale(2, RoundingMode.HALF_UP));
-//                                        nwpData.setWd150(new BigDecimal(datas[54]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWd160(new BigDecimal(datas[55]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWd180(new BigDecimal(datas[56]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWd190(new BigDecimal(datas[57]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWd200(new BigDecimal(datas[58]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT10(new BigDecimal(datas[59]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT20(new BigDecimal(datas[60]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT30(new BigDecimal(datas[61]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT40(new BigDecimal(datas[62]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT50(new BigDecimal(datas[63]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT60(new BigDecimal(datas[64]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT70(new BigDecimal(datas[65]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT80(new BigDecimal(datas[66]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT90(new BigDecimal(datas[67]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT100(new BigDecimal(datas[68]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT110(new BigDecimal(datas[69]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT120(new BigDecimal(datas[70]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT130(new BigDecimal(datas[71]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT140(new BigDecimal(datas[72]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT150(new BigDecimal(datas[73]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT160(new BigDecimal(datas[74]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT170(new BigDecimal(datas[75]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT180(new BigDecimal(datas[76]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT190(new BigDecimal(datas[77]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT200(new BigDecimal(datas[78]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setDniCalcd(new BigDecimal(datas[79]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setSolarZenith(new BigDecimal(datas[80]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setClearskyGhi(new BigDecimal(datas[81]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setLcc(new BigDecimal(datas[82]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setMcc(new BigDecimal(datas[83]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setHcc(new BigDecimal(datas[84]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setTcc(new BigDecimal(datas[85]).setScale(2, RoundingMode.HALF_UP));
-//                                        nwpData.setTpr(new BigDecimal(datas[86]).setScale(2, RoundingMode.HALF_UP));
-//                                    }
-//                                    listNwp.add(nwpData);
-//                                }
-//                            }
-//                            if (listNwp.size() > 0 ) {
-//                                // 保存nwp实时
-//                                Date startTime = listNwp.get(0).getPreTime();
-//                                Date endTime = listNwp.get(listNwp.size() - 1).getPreTime();
-//                                LambdaQueryWrapper<Nwp> lambdaQueryWrapper = new LambdaQueryWrapper<>();
-//                                lambdaQueryWrapper.eq(Nwp::getStationCode, parsingUrl.getStationCode());
-//                                lambdaQueryWrapper.eq(Nwp::getForecastManufactor, parsingUrl.getForecastManufactor());
-//                                lambdaQueryWrapper.between(Nwp::getPreTime, startTime, endTime);
-//                                nwpService.remove(lambdaQueryWrapper);
-//                                nwpService.saveBatch(listNwp);
-//                                log.info(parsingUrl.getStationCode() + "下" + fileName + "嘉越云端NWP文件解析成功!");
-//                                try {
-//                                    File file1 = new File(success + File.separator + fileName);
-//                                    if (file1.exists()) {
-//                                        file1.delete();
-//                                    }
-//                                    FileUtils.moveFile(file, new File(success + File.separator + fileName));
-//                                } catch (IOException e) {
-//                                    e.printStackTrace();
-//                                }
-//                            }
-//                        } catch (IOException | ParseException | RuntimeException e) {
-//                            log.error("系统错误:", e);
-//                            File destFile = new File(file.getPath().replaceFirst("new", "error"));
-//                            if (destFile.exists()) {
-//                                destFile.delete();
-//                            }
-//                            try {
-//                                FileUtils.moveFile(file, destFile);
-//                            } catch (IOException e1) {
-//                                log.error(file.getName() + "文件解析失败", e);
-//                            }
-//                        } finally {
-//                            close(bufferedReaderNwp, readNwp);
-//                        }
-//                    }
-//
-//                }
-//            }
-//        }
-//        log.info("解析嘉越云端文件定时执行完成");
-//
-//    }
-//
-//    /**
-//     * 关闭文件流
-//     *
-//     * @param bufferedReader 字符数据
-//     * @param read           字节流
-//     */
-//    private void close(BufferedReader bufferedReader, InputStreamReader read) {
-//        try {
-//            if (bufferedReader != null) {
-//                bufferedReader.close();
-//            }
-//            if (read != null) {
-//                read.close();
-//            }
-//        } catch (IOException e) {
-//            log.error("关闭文件流失败:", e);
-//        }
-//    }
-//}

+ 0 - 385
cpp-admin/src/main/java/com/cpp/web/service/datafactory/DownloadService.java

@@ -1,385 +0,0 @@
-//package com.cpp.web.service.datafactory;
-//
-//import cn.hutool.core.date.DateUtil;
-//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-//import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-//import com.jiayue.ipfcst.common.core.util.DateMomentUtil;
-//import com.jiayue.ipfcst.common.core.util.NumberUtils;
-//import com.jiayue.ipp.common.data.entity.ForecastPowerShortTerm;
-//import com.jiayue.ipp.common.data.entity.ForecastPowerShortTermHis;
-//import com.jiayue.ipp.common.data.entity.Nwp;
-//import com.jiayue.ipp.common.data.entity.an.ParsingChannel;
-//import com.jiayue.ipp.common.data.entity.an.ParsingLog;
-//import com.jiayue.ipp.common.data.entity.an.ParsingUrl;
-//import com.jiayue.ipp.idp.service.ForecastPowerShortTermHisService;
-//import com.jiayue.ipp.idp.service.ForecastPowerShortTermService;
-//import com.jiayue.ipp.idp.service.NwpService;
-//import lombok.AllArgsConstructor;
-//import lombok.extern.slf4j.Slf4j;
-//import org.apache.commons.io.FileUtils;
-//import org.apache.commons.lang.StringUtils;
-//import org.apache.commons.lang.time.DateFormatUtils;
-//import org.springframework.stereotype.Service;
-//import org.springframework.transaction.annotation.Transactional;
-//
-//import java.io.BufferedReader;
-//import java.io.File;
-//import java.io.IOException;
-//import java.io.InputStreamReader;
-//import java.math.BigDecimal;
-//import java.math.RoundingMode;
-//import java.nio.charset.StandardCharsets;
-//import java.nio.file.Files;
-//import java.text.ParseException;
-//import java.text.SimpleDateFormat;
-//import java.util.ArrayList;
-//import java.util.Date;
-//import java.util.List;
-//
-///**
-// * ftp通信业务层
-// *
-// * @author tl
-// * @date 2022-05-11 09:51:21
-// */
-//@AllArgsConstructor
-//@Slf4j
-//@Service
-//@Transactional
-//public class DownloadService {
-//
-//    private final ParsingUrlService parsingUrlService;
-//
-//    private final ParsingFileService parsingFileService;
-//
-//    private final ParsingLogService parsingLogService;
-//
-//    private final ForecastPowerShortTermHisService forecastPowerShortTermHisService;
-//
-//    private final ForecastPowerShortTermService forecastPowerShortTermService;
-//
-//    private final NwpService nwpService;
-//
-//    /**
-//     * 解析
-//     *
-//     * @param parsingChannel
-//     */
-//    public void parsing(ParsingChannel parsingChannel) {
-//
-//        //过滤出当前解析通道下在使用的《 解析路径 》
-//        List<ParsingUrl> parsingUrls = parsingUrlService.list(Wrappers.lambdaQuery(ParsingUrl.class).eq(ParsingUrl::getCId, parsingChannel.getId()).eq(ParsingUrl::getUrlStatus, "1"));
-//        String dateDir = DateFormatUtils.format(new Date(), "yyyyMMdd");
-//        String dayStr = new SimpleDateFormat("yyyyMMdd").format(new Date());
-//        //遍历解析路径,对文件进行解析
-//        for (ParsingUrl parsingUrl : parsingUrls) {
-//
-//            String failDir = parsingUrl.getUrl() + File.separator + "fail" + File.separator + dateDir;
-//
-//            String success = parsingUrl.getUrl() + File.separator + "success" + File.separator + dateDir;
-//
-//            String path = parsingUrl.getUrl() + File.separator + "new";
-//
-//            File dirFile = new File(path);
-//
-//            if (!dirFile.exists()) {
-//                dirFile.mkdirs();
-//            }
-//            File[] files = dirFile.listFiles();
-//            log.info("扫描路径:{},文件数:{}", path, files.length);
-//            //遍历文件
-//            for (File file : files) {
-//                String fileName = file.getName();
-//                ParsingLog parsingLog = new ParsingLog();
-//                parsingLog.setFileName(fileName);
-//                parsingLog.setStationCode(parsingUrl.getStationCode());
-//                parsingLog.setParsingTime(new Date());
-//
-//                if (!fileName.contains(dayStr)) {
-//                    file.delete();
-//                    log.warn(parsingUrl.getStationCode() + "下" + fileName + "云端文件不是当天的文件,删除!");
-//                    break;
-//                }
-//
-//                // 如果是短期文件
-//                if (file.getName().startsWith("DQ")) {
-//                    try {
-//                        // 解析短期文件
-//                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-//                        List<ForecastPowerShortTerm> forecastPowerShortTermList = new ArrayList<>();
-//                        List<ForecastPowerShortTermHis> forecastPowerShortTermHisList = new ArrayList<>();
-//                        // 当文件未被使用时,进行解析上报
-//                        if (file.renameTo(file)) {
-//                            InputStreamReader read = null;
-//                            BufferedReader bufferedReader = null;
-//                            String stringLine;
-//                            ForecastPowerShortTerm stf;
-//                            try {
-//                                read = new InputStreamReader(Files.newInputStream(file.toPath()), StandardCharsets.UTF_8);
-//                                bufferedReader = new BufferedReader(read);
-//                                Long systemTime = System.currentTimeMillis();
-//                                // 循环解析文件
-//                                while ((stringLine = bufferedReader.readLine()) != null) {
-//                                    String[] string_arr = stringLine.split("\t");
-//                                    if (string_arr.length == 4 && string_arr[0].startsWith("#")) {
-//                                        if (StringUtils.isNotEmpty(string_arr[2])) {
-//                                            // 实时表
-//                                            stf = new ForecastPowerShortTerm();
-//                                            stf.setFpValue(new BigDecimal(string_arr[3]));
-//                                            stf.setForecastTime(sdf.parse(string_arr[2]));
-//                                            stf.setGenDate(new Date());
-//                                            stf.setStationCode(parsingUrl.getStationCode());
-//                                            stf.setForecastManufactor(parsingUrl.getForecastManufactor());
-//                                            forecastPowerShortTermList.add(stf);
-//
-//                                            // 历史表
-//                                            //过滤当天的数据
-//                                            long secondDayTime = com.jiayue.ipp.idp.util.DateMomentUtil.getDayStartTime(systemTime) + 1000 * 60 * 60 * 24;
-//                                            if (sdf.parse(string_arr[2]).getTime() >= secondDayTime) {
-//                                                ForecastPowerShortTermHis forecastPowerShortTermHis = new ForecastPowerShortTermHis();
-//                                                forecastPowerShortTermHis.setGenDate(new Date());
-//                                                forecastPowerShortTermHis.setStationCode(parsingUrl.getStationCode());
-//                                                forecastPowerShortTermHis.setAbleValue(new BigDecimal(string_arr[3]));
-//                                                forecastPowerShortTermHis.setForecastTime(sdf.parse(string_arr[2]));
-//                                                forecastPowerShortTermHis.setForecastHowLongAgo(DateMomentUtil.getDaysBetweenTwoDate(systemTime, sdf.parse(string_arr[2]).getTime()));
-//                                                forecastPowerShortTermHis.setForecastManufactor(parsingUrl.getForecastManufactor());
-//                                                forecastPowerShortTermHisList.add(forecastPowerShortTermHis);
-//                                            }
-//                                        }
-//                                    }
-//                                }
-//
-//                                if (forecastPowerShortTermList.size() > 0 && forecastPowerShortTermHisList.size() > 0) {
-//                                    // 保存短期实时
-//                                    Date startTime = forecastPowerShortTermList.get(0).getForecastTime();
-//                                    Date endTime = forecastPowerShortTermList.get(forecastPowerShortTermList.size() - 1).getForecastTime();
-//                                    LambdaQueryWrapper<ForecastPowerShortTerm> lambdaQueryWrapper = new LambdaQueryWrapper<>();
-//                                    lambdaQueryWrapper.eq(ForecastPowerShortTerm::getStationCode, parsingUrl.getStationCode());
-//                                    lambdaQueryWrapper.eq(ForecastPowerShortTerm::getForecastManufactor, parsingUrl.getForecastManufactor());
-//                                    lambdaQueryWrapper.between(ForecastPowerShortTerm::getForecastTime, startTime, endTime);
-//                                    forecastPowerShortTermService.remove(lambdaQueryWrapper);
-//                                    forecastPowerShortTermService.saveBatch(forecastPowerShortTermList);
-//
-//                                    // 保存短期历史
-//                                    LambdaQueryWrapper<ForecastPowerShortTermHis> forecastPowerShortTermHisLambdaQueryWrapper = new LambdaQueryWrapper<>();
-//                                    forecastPowerShortTermHisLambdaQueryWrapper.eq(ForecastPowerShortTermHis::getStationCode, parsingUrl.getStationCode());
-//                                    forecastPowerShortTermHisLambdaQueryWrapper.eq(ForecastPowerShortTermHis::getForecastManufactor, parsingUrl.getForecastManufactor());
-//                                    forecastPowerShortTermHisLambdaQueryWrapper.eq(ForecastPowerShortTermHis::getGenDate, DateUtil.format(new Date(), "yyyy-MM-dd"));
-//                                    forecastPowerShortTermHisService.remove(forecastPowerShortTermHisLambdaQueryWrapper);
-//                                    forecastPowerShortTermHisService.saveBatch(forecastPowerShortTermHisList);
-//                                    log.info(parsingUrl.getStationCode() + "下" + fileName + "嘉越云端文件解析成功!");
-//                                    try {
-//                                        File file1 = new File(success + File.separator + fileName);
-//                                        if (file1.exists()) {
-//                                            file1.delete();
-//                                        }
-//                                        FileUtils.moveFile(file, new File(success + File.separator + fileName));
-//                                    } catch (IOException e) {
-//                                        e.printStackTrace();
-//                                    }
-//                                }
-//                            } catch (Exception e) {
-//                                log.error("嘉越云端文件解析失败:", e);
-//                                try {
-//                                    File file1 = new File(failDir + File.separator + fileName);
-//                                    if (file1.exists()) {
-//                                        file1.delete();
-//                                    }
-//                                    FileUtils.moveFile(file, new File(failDir + File.separator + fileName));
-//                                } catch (IOException ex) {
-//                                    log.error(parsingUrl.getStationCode() + "下" + fileName + "嘉越云端文件解析失败1", ex);
-//                                }
-//                            } finally {
-//                                close(bufferedReader, read);
-//                            }
-//                        }
-//                    } catch (Exception e) {
-//                        log.error(parsingUrl.getStationCode() + "下" + fileName + "解析嘉越云端DQ文件失败", e);
-//                        try {
-//                            File file1 = new File(failDir + File.separator + fileName);
-//                            if (file1.exists()) {
-//                                file1.delete();
-//                            }
-//                            FileUtils.moveFile(file, new File(failDir + File.separator + fileName));
-//                        } catch (IOException ex) {
-//                            log.error(parsingUrl.getStationCode() + "下" + fileName + "嘉越云端文件解析失败1", ex);
-//                        }
-//                    }
-//                }
-//
-//                if (file.getName().startsWith("NWP")) {
-//                    List<Nwp> listNwp = new ArrayList<>();
-//                    if (file.renameTo(file)) {
-//                        InputStreamReader readNwp = null;
-//                        BufferedReader bufferedReaderNwp = null;
-//                        try {
-//                            readNwp = new InputStreamReader(Files.newInputStream(file.toPath()), StandardCharsets.UTF_8);//考虑到编码格式
-//                            bufferedReaderNwp = new BufferedReader(readNwp);
-//                            String lineTxt;
-//                            Nwp nwpData;
-//                            BigDecimal nwpDirectRadiation = new BigDecimal("0.7"); //直接辐射
-//                            BigDecimal nwpDiffuseRadiation = new BigDecimal("0.3"); //散接辐射
-//
-//                            while ((lineTxt = bufferedReaderNwp.readLine()) != null) {
-//                                //NWP文件按照Tab方式截取
-//                                String[] datas = lineTxt.split("\t");
-//                                if (datas.length >= 35 && datas[0].startsWith("#")) {
-//                                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-//                                    //过滤当天的数据
-//                                    //if (sdf.parse(datas[5]).getTime() >= TimeUtils.getMillisecondsSubDay() + 24 * 60 * 60 *
-//                                    // 1000) {
-//                                    nwpData = new Nwp();
-//                                    nwpData.setForecastManufactor(parsingUrl.getForecastManufactor());
-//                                    //将截取的文件放入nwpData中
-//                                    nwpData.setStationCode(parsingUrl.getStationCode());
-////                                    nwpData.setScDate(datas[2]);
-////                                    nwpData.setScTime(datas[3]);
-////                                    nwpData.setPreDate(datas[4]);
-//                                    nwpData.setPreTime(sdf.parse(datas[5]));//采集时间 与 短期预测时间关联
-//                                    nwpData.setT(NumberUtils.subtract(new BigDecimal(datas[6]), new BigDecimal("273.15")));//温度
-//
-//                                    nwpData.setSenf(new BigDecimal(datas[11]).setScale(2, RoundingMode.HALF_UP));//感热
-//                                    nwpData.setSwr(new BigDecimal(datas[9]).setScale(2, RoundingMode.HALF_UP));//短波辐射(相当于总辐射)
-//                                    nwpData.setLwr(new BigDecimal(datas[10]).setScale(2, RoundingMode.HALF_UP));//短波辐射(相当于总辐射)
-//                                    nwpData.setPressure(new BigDecimal(datas[8]).setScale(2, RoundingMode.HALF_UP));//地表气压
-//                                    nwpData.setRh(new BigDecimal(datas[7]).setScale(2, RoundingMode.HALF_UP));//2m相对湿度
-//                                    nwpData.setDiffuseRadiation(new BigDecimal(datas[9]).multiply(nwpDiffuseRadiation).setScale(2, RoundingMode.HALF_UP));//散接辐射
-//                                    nwpData.setDirectRadiation(new BigDecimal(datas[9]).multiply(nwpDirectRadiation).setScale(2, RoundingMode.HALF_UP));//直接辐射
-//
-//                                    nwpData.setWs10(new BigDecimal(datas[19]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWs30(new BigDecimal(datas[20]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWs50(new BigDecimal(datas[21]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWs70(new BigDecimal(datas[22]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWs80(new BigDecimal(datas[23]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWs90(new BigDecimal(datas[24]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWs100(new BigDecimal(datas[25]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWs170(new BigDecimal(datas[26]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWd10(new BigDecimal(datas[27]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWd30(new BigDecimal(datas[28]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWd50(new BigDecimal(datas[29]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWd70(new BigDecimal(datas[30]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWd80(new BigDecimal(datas[31]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWd90(new BigDecimal(datas[32]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWd100(new BigDecimal(datas[33]).setScale(2, RoundingMode.HALF_UP));
-//                                    nwpData.setWd170(new BigDecimal(datas[34]).setScale(2, RoundingMode.HALF_UP));
-//                                    if (datas.length > 35) {
-//                                        //nwp 新增解析内容
-////                                        nwpData.setWs20(new BigDecimal(datas[35]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWs40(new BigDecimal(datas[36]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWs60(new BigDecimal(datas[37]).setScale(2, RoundingMode.HALF_UP));
-//                                        nwpData.setWs110(new BigDecimal(datas[38]).setScale(2, RoundingMode.HALF_UP));
-//                                        nwpData.setWs120(new BigDecimal(datas[39]).setScale(2, RoundingMode.HALF_UP));
-//                                        nwpData.setWs130(new BigDecimal(datas[40]).setScale(2, RoundingMode.HALF_UP));
-//                                        nwpData.setWs140(new BigDecimal(datas[41]).setScale(2, RoundingMode.HALF_UP));
-//                                        nwpData.setWs150(new BigDecimal(datas[42]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWs160(new BigDecimal(datas[43]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWs180(new BigDecimal(datas[44]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWs190(new BigDecimal(datas[45]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWs200(new BigDecimal(datas[46]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWd20(new BigDecimal(datas[47]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWd40(new BigDecimal(datas[48]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWd60(new BigDecimal(datas[49]).setScale(2, RoundingMode.HALF_UP));
-//                                        nwpData.setWd110(new BigDecimal(datas[50]).setScale(2, RoundingMode.HALF_UP));
-//                                        nwpData.setWd120(new BigDecimal(datas[51]).setScale(2, RoundingMode.HALF_UP));
-//                                        nwpData.setWd130(new BigDecimal(datas[52]).setScale(2, RoundingMode.HALF_UP));
-//                                        nwpData.setWd140(new BigDecimal(datas[53]).setScale(2, RoundingMode.HALF_UP));
-//                                        nwpData.setWd150(new BigDecimal(datas[54]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWd160(new BigDecimal(datas[55]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWd180(new BigDecimal(datas[56]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWd190(new BigDecimal(datas[57]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setWd200(new BigDecimal(datas[58]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT10(new BigDecimal(datas[59]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT20(new BigDecimal(datas[60]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT30(new BigDecimal(datas[61]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT40(new BigDecimal(datas[62]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT50(new BigDecimal(datas[63]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT60(new BigDecimal(datas[64]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT70(new BigDecimal(datas[65]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT80(new BigDecimal(datas[66]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT90(new BigDecimal(datas[67]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT100(new BigDecimal(datas[68]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT110(new BigDecimal(datas[69]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT120(new BigDecimal(datas[70]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT130(new BigDecimal(datas[71]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT140(new BigDecimal(datas[72]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT150(new BigDecimal(datas[73]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT160(new BigDecimal(datas[74]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT170(new BigDecimal(datas[75]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT180(new BigDecimal(datas[76]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT190(new BigDecimal(datas[77]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setT200(new BigDecimal(datas[78]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setDniCalcd(new BigDecimal(datas[79]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setSolarZenith(new BigDecimal(datas[80]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setClearskyGhi(new BigDecimal(datas[81]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setLcc(new BigDecimal(datas[82]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setMcc(new BigDecimal(datas[83]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setHcc(new BigDecimal(datas[84]).setScale(2, RoundingMode.HALF_UP));
-////                                        nwpData.setTcc(new BigDecimal(datas[85]).setScale(2, RoundingMode.HALF_UP));
-//                                        nwpData.setTpr(new BigDecimal(datas[86]).setScale(2, RoundingMode.HALF_UP));
-//                                    }
-//                                    listNwp.add(nwpData);
-//                                }
-//                            }
-//                            if (listNwp.size() > 0 ) {
-//                                // 保存nwp实时
-//                                Date startTime = listNwp.get(0).getPreTime();
-//                                Date endTime = listNwp.get(listNwp.size() - 1).getPreTime();
-//                                LambdaQueryWrapper<Nwp> lambdaQueryWrapper = new LambdaQueryWrapper<>();
-//                                lambdaQueryWrapper.eq(Nwp::getStationCode, parsingUrl.getStationCode());
-//                                lambdaQueryWrapper.eq(Nwp::getForecastManufactor, parsingUrl.getForecastManufactor());
-//                                lambdaQueryWrapper.between(Nwp::getPreTime, startTime, endTime);
-//                                nwpService.remove(lambdaQueryWrapper);
-//                                nwpService.saveBatch(listNwp);
-//                                log.info(parsingUrl.getStationCode() + "下" + fileName + "嘉越云端NWP文件解析成功!");
-//                                try {
-//                                    File file1 = new File(success + File.separator + fileName);
-//                                    if (file1.exists()) {
-//                                        file1.delete();
-//                                    }
-//                                    FileUtils.moveFile(file, new File(success + File.separator + fileName));
-//                                } catch (IOException e) {
-//                                    e.printStackTrace();
-//                                }
-//                            }
-//                        } catch (IOException | ParseException | RuntimeException e) {
-//                            log.error("系统错误:", e);
-//                            File destFile = new File(file.getPath().replaceFirst("new", "error"));
-//                            if (destFile.exists()) {
-//                                destFile.delete();
-//                            }
-//                            try {
-//                                FileUtils.moveFile(file, destFile);
-//                            } catch (IOException e1) {
-//                                log.error(file.getName() + "文件解析失败", e);
-//                            }
-//                        } finally {
-//                            close(bufferedReaderNwp, readNwp);
-//                        }
-//                    }
-//
-//                }
-//            }
-//        }
-//        log.info("解析嘉越云端文件定时执行完成");
-//
-//    }
-//
-//    /**
-//     * 关闭文件流
-//     *
-//     * @param bufferedReader 字符数据
-//     * @param read           字节流
-//     */
-//    private void close(BufferedReader bufferedReader, InputStreamReader read) {
-//        try {
-//            if (bufferedReader != null) {
-//                bufferedReader.close();
-//            }
-//            if (read != null) {
-//                read.close();
-//            }
-//        } catch (IOException e) {
-//            log.error("关闭文件流失败:", e);
-//        }
-//    }
-//}

+ 0 - 130
cpp-admin/src/main/java/com/cpp/web/service/datafactory/ParsingFileService.java

@@ -1,130 +0,0 @@
-//package com.cpp.web.service.datafactory;
-//
-//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-//import com.jiayue.ipp.common.data.entity.an.ChannelStatus;
-//import com.jiayue.ipp.common.data.entity.an.ParsingUrl;
-//import com.jiayue.ipp.common.data.entity.an.ReportingRateRecords;
-//import com.jiayue.ipp.idp.dto.*;
-//import com.jiayue.ipp.idp.util.FileUtil;
-//import com.jiayue.ipp.idp.util.JsonBeanUtil;
-//import lombok.RequiredArgsConstructor;
-//import lombok.extern.slf4j.Slf4j;
-//import org.springframework.stereotype.Service;
-//import org.springframework.transaction.annotation.Transactional;
-//
-//import java.io.File;
-//import java.text.SimpleDateFormat;
-//import java.util.ArrayList;
-//import java.util.Date;
-//import java.util.List;
-//
-///**
-// * 解析文件业务层
-// *
-// * @author tl
-// * @date 2022-05-11 09:51:21
-// */
-//@Service
-//@RequiredArgsConstructor
-//@Slf4j
-//@Transactional
-//public class ParsingFileService {
-//
-//    private final com.jiayue.ipp.idp.service.an.ReportingRateRecordsService reportingRateRecordsService;
-//
-//    private final List<ParsingInterface> parsingInterfaces;
-//
-//    private final com.jiayue.ipp.idp.service.an.ChannelStatusService channelStatusService;
-//
-//    //文件解析
-//    /*
-//     * 解析配置格式规则:
-//     *   s=>>1=>>entity=
-//     *   s:单行标识
-//     *   1:取值在1行
-//     *   entity=:键标记标记
-//     *
-//     *   m=>>4-20=>>3
-//     *   m:多行标识
-//     *   4-20:取值在4-20行
-//     *   3:第三列
-//     * */
-//    public FileAnalysisStatusDto parsingFile(File file, ParsingUrl parsingUrl) {
-//        log.info("开始尝试解析【{}】的 {}",parsingUrl.getStationCode(),file.getName());
-//        FileAnalysisStatusDto fileAnalysisStatusDto=new FileAnalysisStatusDto();
-//        //因为并不知道当前文件属于哪种类型文件,所以遍历接口实现类来进行对应文件的解析
-//        for (ParsingInterface parsingInterface : parsingInterfaces) {
-//            fileAnalysisStatusDto = parsingInterface.parsing(file, parsingUrl);
-//            if (fileAnalysisStatusDto.getStatus()!=null) {
-//                return fileAnalysisStatusDto;
-//            }
-//        }
-//        if (fileAnalysisStatusDto.getStatus()==null){
-//            fileAnalysisStatusDto.setMessage("无配置符合文件解析失败!!!");
-//        }
-//        return fileAnalysisStatusDto;
-//    }
-//
-//
-//
-//    /**
-//     * 对于状态文件单独解析
-//     *
-//     * @param file
-//     * @param parsingUrl
-//     * @return
-//     */
-//    public String parsingStatusFile(File file, ParsingUrl parsingUrl) {
-//        SimpleDateFormat simpleDateTimeFormat = new SimpleDateFormat("yyyy-MM-dd_HH:mm");
-//
-//        String parsingStatus = ParsingConstant.FAIL;
-//        try {
-//            String str = FileUtil.getStr(file);
-//
-//            ParsingStatusFileDto parsingStatusFileDto = JsonBeanUtil.jsonToBean(str, ParsingStatusFileDto.class);
-//
-//            Date date = simpleDateTimeFormat.parse(parsingStatusFileDto.getDate());
-//
-//            List<ReportingRateRecords> reportingRateRecordsList = new ArrayList<>();
-//            for (ReportingRateDto reportingRateDto : parsingStatusFileDto.getReportingRates()) {
-//                ReportingRateRecords reportingRateRecords = new ReportingRateRecords();
-//
-//                reportingRateRecords.setFileType(reportingRateDto.getRateType());
-//                reportingRateRecords.setReportingRate(reportingRateDto.getReportrate());
-//                reportingRateRecords.setStationCode(parsingUrl.getStationCode());
-//                reportingRateRecords.setUploadTime(date);
-//
-//                reportingRateRecordsList.add(reportingRateRecords);
-//            }
-//
-//            reportingRateRecordsService.saveBatch(reportingRateRecordsList);
-//
-//
-//            List<ChannelStatus> channelStatusList = new ArrayList<>();
-//            for (ChannelStatusDto channelStatusDto : parsingStatusFileDto.getChannelStatus()) {
-//                ChannelStatus channelStatus = new ChannelStatus();
-//                channelStatus.setChannelName(channelStatusDto.getChannelName());
-//                channelStatus.setStationCode(parsingUrl.getStationCode());
-//                channelStatus.setStatus(channelStatusDto.getStatus());
-//                channelStatus.setType(channelStatusDto.getType());
-//                channelStatus.setUploadTime(date);
-//
-//                channelStatusList.add(channelStatus);
-//            }
-//
-//            LambdaQueryWrapper<ChannelStatus> lambdaQueryWrapper = new LambdaQueryWrapper<ChannelStatus>();
-//            lambdaQueryWrapper.eq(ChannelStatus::getStationCode, parsingUrl.getStationCode());
-//            channelStatusService.remove(lambdaQueryWrapper);
-//            channelStatusService.saveBatch(channelStatusList);
-//            parsingStatus = "status";
-//        } catch (Exception e) {
-//            parsingStatus += "status 解析失败";
-//            log.error("解析状态数据失败! /(ㄒoㄒ)/~~", e);
-//        }finally {
-//            return parsingStatus;
-//        }
-//
-//    }
-//
-//
-//}

+ 0 - 25
cpp-admin/src/main/java/com/cpp/web/service/datafactory/ReportingRateRecordsService.java

@@ -1,25 +0,0 @@
-//package com.cpp.web.service.datafactory;
-//
-//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-//import com.baomidou.mybatisplus.extension.service.IService;
-//import com.jiayue.ipp.common.data.entity.an.ReportingRateRecords;
-//
-///**
-// * 上报率记录表
-// *
-// * @author csc code generator
-// * @date 2022-12-28 14:49:14
-// */
-//public interface ReportingRateRecordsService extends IService<ReportingRateRecords> {
-//
-//    /**
-//     * 根据场站编号 时间范围 文件类型构造查询条件
-//     *
-//     * @param stationCode 场站类型
-//     * @param startTime   开始时间
-//     * @param endTime     结束时间
-//     * @param reportType  上报文件类型
-//     * @return
-//     */
-//    QueryWrapper<ReportingRateRecords> findByStationCodeAndTimeBetweenAndReportType(String stationCode, Long startTime, Long endTime, String reportType);
-//}

+ 0 - 47
cpp-admin/src/main/java/com/cpp/web/service/datafactory/impl/ChannelStatusServiceImpl.java

@@ -1,47 +0,0 @@
-//package com.cpp.web.service.datafactory.impl;
-//
-//import cn.hutool.core.date.DateTime;
-//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-//import com.jiayue.ipp.common.data.entity.an.ChannelStatus;
-//import com.jiayue.ipp.idp.mapper.an.ChannelStatusMapper;
-//import com.jiayue.ipp.idp.service.an.ChannelStatusService;
-//import org.springframework.stereotype.Service;
-//
-///**
-// * 通道状态表
-// *
-// * @author csc code generator
-// * @date 2022-12-28 14:49:40
-// */
-//@Service
-//public class ChannelStatusServiceImpl extends ServiceImpl<ChannelStatusMapper, ChannelStatus> implements ChannelStatusService {
-//
-//    /**
-//     * 根据上报时间 场站编号 通道状态 通道类型 构造查询条件
-//     *
-//     * @param stationCode       场站编号
-//     * @param startTime         上报时间
-//     * @param endTime           上报时间
-//     * @param channelStatusCode 通道状态
-//     * @param channelTypeCode   通道类型
-//     * @return 查询条件
-//     */
-//    @Override
-//    public QueryWrapper<ChannelStatus> findByStationCodeAndStartTimeBetweenAndChannelStatusAndChannelType(String stationCode, Long startTime, Long endTime, String channelStatusCode, String channelTypeCode) {
-//        QueryWrapper<ChannelStatus> wrapper = new QueryWrapper<>();
-//        if (stationCode != null && !stationCode.equals("")) {
-//            wrapper.eq("station_code", stationCode);
-//        }
-//        if (startTime != null && endTime != null) {
-//            wrapper.between("upload_time", new DateTime(startTime), new DateTime(endTime));
-//        }
-//        if (channelStatusCode != null && !channelStatusCode.equals("")) {
-//            wrapper.eq("status", channelStatusCode);
-//        }
-//        if (channelTypeCode != null && !channelTypeCode.equals("")) {
-//            wrapper.eq("type", channelTypeCode);
-//        }
-//        return wrapper;
-//    }
-//}

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

@@ -77,10 +77,10 @@ public class ParsingFjServiceImpl extends ServiceImpl<ParsingFjMapper, ParsingFj
                         if (time != null){
                             int number = Integer.parseInt(parsingFjInfo.getEquipmentName().split("-")[0]);
                             String replace1 = parsingFjInfo.getActivePower().split("<=>")[0] + "<=>";
-
+                            List<WindTurbineInfo> windTurbineInfoList = windTurbineInfos.stream().filter(i -> i.getStationCode().equals(stationCode)).collect(Collectors.toList());
                             for (String fjName : fjNames) {
 
-                                List<WindTurbineInfo> filterWindTurbineInfos = windTurbineInfos.stream().filter(i -> i.getName().equals(fjName)).collect(Collectors.toList());
+                                List<WindTurbineInfo> filterWindTurbineInfos = windTurbineInfoList.stream().filter(i -> i.getName().equals(fjName)).collect(Collectors.toList());
 
                                 if (filterWindTurbineInfos.size() > 0) {
                                     Long eqId = filterWindTurbineInfos.get(0).getId();

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

@@ -73,7 +73,6 @@ public class ParsingNbqServiceImpl extends ServiceImpl<ParsingNbqMapper, Parsing
                 //解析文件内容以行为单位的 List<String>
                 List<String> fileContent = ParsingFileUtil.getFileContent(file);
                 //查询对应该场站路径下的逆变器信息
-                List<InverterInfo> inverterInfoList = inverterInfos.stream().filter(i -> i.getStationCode().equals(stationCode)).collect(Collectors.toList());
                 //因为有可能该场站有多种解析配置,例如多个逆变器数据情况,需要循环解析信息
                 //判断数据类型是单行还是多行
                 if (parsingNbqInfo.getDataType().equals(ParsingFieldUtil.SINGLE)) {
@@ -87,6 +86,7 @@ public class ParsingNbqServiceImpl extends ServiceImpl<ParsingNbqMapper, Parsing
                         if (time != null) {
                             int number = Integer.parseInt(parsingNbqInfo.getEquipmentName().split("-")[0]);
                             String replace1 = parsingNbqInfo.getActivePower().split("<=>")[0] + "<=>";
+                            List<InverterInfo> inverterInfoList = inverterInfos.stream().filter(i -> i.getStationCode().equals(stationCode)).collect(Collectors.toList());
 
                             for (String nbqName : nbqNames) {
                                 List<InverterInfo> filterInverterInfos = inverterInfoList.stream().filter(i -> i.getName().equals(nbqName)).collect(Collectors.toList());

+ 0 - 45
cpp-admin/src/main/java/com/cpp/web/service/datafactory/impl/ReportingRateRecordsServiceImpl.java

@@ -1,45 +0,0 @@
-//package com.cpp.web.service.datafactory.impl;
-//
-//import cn.hutool.core.date.DateTime;
-//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-//import com.jiayue.ipp.common.data.entity.an.ReportingRateRecords;
-//import com.jiayue.ipp.idp.mapper.an.ReportingRateRecordsMapper;
-//import com.jiayue.ipp.idp.service.an.ReportingRateRecordsService;
-//import org.springframework.stereotype.Service;
-//
-///**
-// * 上报率记录表
-// *
-// * @author csc code generator
-// * @date 2022-12-28 14:49:14
-// */
-//@Service
-//public class ReportingRateRecordsServiceImpl extends ServiceImpl<ReportingRateRecordsMapper, ReportingRateRecords> implements ReportingRateRecordsService {
-//
-//
-//    /**
-//     * 根据场站编号 时间范围 文件类型构造查询条件
-//     *
-//     * @param stationCode 场站类型
-//     * @param startTime   开始时间
-//     * @param endTime     结束时间
-//     * @param reportType  上报文件类型
-//     * @return
-//     */
-//    @Override
-//    public QueryWrapper<ReportingRateRecords> findByStationCodeAndTimeBetweenAndReportType(String stationCode, Long startTime, Long endTime, String reportType) {
-//        QueryWrapper<ReportingRateRecords> wrapper = new QueryWrapper<>();
-//        if (stationCode != null && !stationCode.equals("")) {
-//            wrapper.eq("station_code", stationCode);
-//        }
-//        if (startTime != null && endTime != null) {
-//            wrapper.between("upload_time", new DateTime(startTime), new DateTime(endTime));
-//        }
-//        if (reportType != null && !reportType.equals("")) {
-//            wrapper.eq("file_type", reportType);
-//        }
-//        wrapper.orderByDesc("upload_time");
-//        return wrapper;
-//    }
-//}

+ 2 - 0
cpp-admin/src/main/java/com/cpp/web/service/station/ForecastPowerShortTermRegulationService.java

@@ -3,6 +3,7 @@ package com.cpp.web.service.station;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.cpp.web.domain.station.ForecastPowerShortTermRegulation;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -34,4 +35,5 @@ public interface ForecastPowerShortTermRegulationService extends IService<Foreca
      */
     List<ForecastPowerShortTermRegulation> findByForecastTimeBetweenAndForecastHowLongAgoAndStationCode(Long startTime, Long endTime, Integer howLongAgo, String stationCode);
 
+    List<ForecastPowerShortTermRegulation> findByForecastTimeBetweenAndHowLongAgo(Date startTime, Date endTime, Integer howLongAgo);
 }

+ 6 - 0
cpp-admin/src/main/java/com/cpp/web/service/station/ForecastPowerShortTermStationService.java

@@ -3,6 +3,7 @@ package com.cpp.web.service.station;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.cpp.web.domain.station.ForecastPowerShortTermStation;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -56,4 +57,9 @@ public interface ForecastPowerShortTermStationService extends IService<ForecastP
      * @return
      */
     List<ForecastPowerShortTermStation> findByForecastTimeBetweenAndForecastHowLongAgoAndStationCodeAndForecastManufactor(Long startTime, Long endTime, Integer howLongAgo, String stationCode, String forecastManufactor);
+
+    List<ForecastPowerShortTermStation> findByForecastTimeBetweenAndHowLongAgo(Date startTime, Date endTime, int howLongAgo);
+
+
+    List<ForecastPowerShortTermStation> findByForecastTimeBetween(Date startTime, Date endTime);
 }

+ 3 - 0
cpp-admin/src/main/java/com/cpp/web/service/station/ForecastPowerUltraShortTermRegulationService.java

@@ -1,6 +1,7 @@
 package com.cpp.web.service.station;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.cpp.web.domain.station.ForecastPowerShortTermStation;
 import com.cpp.web.domain.station.ForecastPowerUltraShortTermRegulation;
 
 import java.util.Date;
@@ -17,4 +18,6 @@ public interface ForecastPowerUltraShortTermRegulationService extends IService<F
     List<ForecastPowerUltraShortTermRegulation> findByForecastTimeBetweenAndForecastHowLongAgoAndStationCode(Long startTime, Long endTime, Integer howLongAgo, String stationCode);
 
     List<ForecastPowerUltraShortTermRegulation> findByForecastTimeAndStationCode(Long finalTime, String stationCode);
+
+    List<ForecastPowerUltraShortTermRegulation> findByForecastTimeBetweenAndHowLongAgo(Date startTime, Date endTime, Integer howLongAgo);
 }

+ 2 - 0
cpp-admin/src/main/java/com/cpp/web/service/station/ForecastPowerUltraShortTermStationService.java

@@ -28,4 +28,6 @@ public interface ForecastPowerUltraShortTermStationService extends IService<Fore
     List<ForecastPowerUltraShortTermStation> findByForecastTimeBetweenAndForecastHowLongAgoAndStationCode(Long startTime, Long endTime, Integer howLongAgo, String stationCode);
 
     List<ForecastPowerUltraShortTermStation> findByForecastTimeAndStationCode(Long finalTime, String stationCode);
+
+    List<ForecastPowerUltraShortTermStation> findByForecastTimeBetweenAndHowLongAgo(Date startTime, Date endTime,Integer howLongAgo);
 }

+ 2 - 0
cpp-admin/src/main/java/com/cpp/web/service/station/PowerStationStatusDataService.java

@@ -32,4 +32,6 @@ public interface PowerStationStatusDataService extends IService<PowerStationStat
     Map<String, List> getCenterData(Date startTime, Date endTime);
 
     List<PowerStationStatusData> findByTimeBetweenAndStationCode(Date pointStarTime, Date pointEndTime, String stationCode);
+
+    List<PowerStationStatusData> findByTimeBetween(Date starTime, Date endTime);
 }

+ 11 - 0
cpp-admin/src/main/java/com/cpp/web/service/station/impl/ForecastPowerShortTermRegulationServiceImpl.java

@@ -33,6 +33,17 @@ public class ForecastPowerShortTermRegulationServiceImpl extends ServiceImpl<For
     }
 
     @Override
+    public List<ForecastPowerShortTermRegulation> findByForecastTimeBetweenAndHowLongAgo(Date startTime, Date endTime, Integer howLongAgo) {
+        QueryWrapper<ForecastPowerShortTermRegulation> wrapper = new QueryWrapper<>();
+
+        if (startTime != null && endTime != null) {
+            wrapper.between("time", startTime, endTime);
+        }
+        wrapper.eq("forecast_how_long_ago", howLongAgo);
+        return baseMapper.selectList(wrapper);
+    }
+
+    @Override
     public ForecastPowerShortTermRegulation findByForecastTimeAndForecastHowLongAgoAndStationCode(Long time, int howLongAgo, String stationCode) {
         QueryWrapper<ForecastPowerShortTermRegulation> wrapper = new QueryWrapper<>();
 

+ 18 - 0
cpp-admin/src/main/java/com/cpp/web/service/station/impl/ForecastPowerShortTermStationServiceImpl.java

@@ -52,6 +52,24 @@ public class ForecastPowerShortTermStationServiceImpl extends ServiceImpl<Foreca
     }
 
     @Override
+    public List<ForecastPowerShortTermStation> findByForecastTimeBetweenAndHowLongAgo(Date startTime, Date endTime, int howLongAgo) {
+        QueryWrapper<ForecastPowerShortTermStation> wrapper = new QueryWrapper<>();
+
+        if (startTime != null && endTime != null) {
+            wrapper.between("time", startTime, endTime);
+        }
+        wrapper.eq("forecast_how_long_ago", howLongAgo);
+        return baseMapper.selectList(wrapper);
+    }
+
+    @Override
+    public List<ForecastPowerShortTermStation> findByForecastTimeBetween(Date startTime, Date endTime) {
+        QueryWrapper<ForecastPowerShortTermStation> wrapper = new QueryWrapper<>();
+        wrapper.between("time", startTime, endTime);
+        return baseMapper.selectList(wrapper);
+    }
+
+    @Override
     public ForecastPowerShortTermStation findByForecastTimeAndForecastHowLongAgoAndStationCode(Long time, int howLongAgo, String stationCode) {
         QueryWrapper<ForecastPowerShortTermStation> wrapper = new QueryWrapper<>();
 

+ 11 - 3
cpp-admin/src/main/java/com/cpp/web/service/station/impl/ForecastPowerUltraShortTermRegulationServiceImpl.java

@@ -3,11 +3,8 @@ package com.cpp.web.service.station.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.cpp.web.domain.station.ForecastPowerUltraShortTermRegulation;
-import com.cpp.web.domain.station.ForecastPowerUltraShortTermStation;
 import com.cpp.web.mapper.station.ForecastPowerUltraShortTermRegulationMapper;
-import com.cpp.web.mapper.station.ForecastPowerUltraShortTermStationMapper;
 import com.cpp.web.service.station.ForecastPowerUltraShortTermRegulationService;
-import com.cpp.web.service.station.ForecastPowerUltraShortTermStationService;
 import org.springframework.stereotype.Service;
 
 import java.util.Date;
@@ -48,4 +45,15 @@ public class ForecastPowerUltraShortTermRegulationServiceImpl extends ServiceImp
         }
         return baseMapper.selectList(wrapper);
     }
+
+    @Override
+    public List<ForecastPowerUltraShortTermRegulation> findByForecastTimeBetweenAndHowLongAgo(Date startTime, Date endTime, Integer howLongAgo) {
+        QueryWrapper<ForecastPowerUltraShortTermRegulation> wrapper = new QueryWrapper<>();
+
+        if (startTime != null && endTime != null) {
+            wrapper.between("time", startTime, endTime);
+        }
+        wrapper.eq("forecast_how_long_ago", howLongAgo);
+        return baseMapper.selectList(wrapper);
+    }
 }

+ 10 - 0
cpp-admin/src/main/java/com/cpp/web/service/station/impl/ForecastPowerUltraShortTermStationServiceImpl.java

@@ -62,4 +62,14 @@ public class ForecastPowerUltraShortTermStationServiceImpl extends ServiceImpl<F
         }
         return baseMapper.selectList(wrapper);
     }
+
+    @Override
+    public List<ForecastPowerUltraShortTermStation> findByForecastTimeBetweenAndHowLongAgo(Date startTime, Date endTime,Integer howLongAgo) {
+        QueryWrapper<ForecastPowerUltraShortTermStation> wrapper = new QueryWrapper<>();
+        if (startTime != null && !startTime.equals("") && endTime != null && !endTime.equals("")) {
+            wrapper.between("time", startTime, endTime);
+        }
+        wrapper.eq("forecast_how_long_ago", howLongAgo);
+        return baseMapper.selectList(wrapper);
+    }
 }

+ 13 - 0
cpp-admin/src/main/java/com/cpp/web/service/station/impl/PowerStationStatusDataServiceImpl.java

@@ -525,4 +525,17 @@ public class PowerStationStatusDataServiceImpl extends ServiceImpl<PowerStationS
 //
 //        return map;
 //    }
+
+
+
+    @Override
+    public List<PowerStationStatusData> findByTimeBetween(Date starTime, Date endTime) {
+        QueryWrapper<PowerStationStatusData> wrapper = new QueryWrapper<>();
+
+        if (starTime != null && endTime != null) {
+            wrapper.between("time", starTime, endTime);
+        }
+        return baseMapper.selectList(wrapper);
+    }
+
 }

+ 6 - 0
cpp-admin/src/main/resources/application.yml

@@ -133,3 +133,9 @@ xss:
   excludes: /system/notice
   # 匹配链接
   urlPatterns: /system/*,/monitor/*,/tool/*
+
+calculate:
+  service:
+    enabled: true
+    version: 0.0.39
+    dbType: mysql

+ 570 - 0
cpp-ui/src/views/statistics/stationAccuracy/index.vue

@@ -0,0 +1,570 @@
+<template>
+  <div class="app-container">
+    <el-form ref="queryForm" size="small" :inline="true">
+      <el-form-item label="时间">
+        <el-date-picker
+          :clearable="false"
+          v-model="dateTime"
+          type="datetimerange"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          :default-time="['00:00:00', '23:45:00']"
+        />
+      </el-form-item>
+      <el-form-item label="场站名称">
+        <el-select v-model="stationCode" placeholder="请选择">
+          <el-option
+            v-for="item in stationList"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value">
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="预测类型">
+        <el-select v-model="forecastType" placeholder="请选择">
+          <el-option
+            v-for="item in forecastTypeList"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value">
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item :label="this.forecastType=='dq'?'预测D+':'预测T+'">
+        <el-select v-model="ago" placeholder="请选择">
+          <el-option
+            v-for="item in this.points()"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value">
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" style="margin-left: 5px" icon="el-icon-search" @click="dataQuery">查询
+        </el-button>
+      </el-form-item>
+    </el-form>
+    <div style="padding-top: 10px">
+      <div>当前结果为:[<span style="color: #FF0000">{{ this.stationCodeInfo }}</span>发电站]-[预测<span
+        style="color: #FF0000">{{ this.forecastTypeInfo }}</span>]-[预测<span
+        style="color: #FF0000">{{ this.forecastTypeInfo == '短期' ? 'D+' : 'T+' }}{{ this.agoInfo }}</span>]-结果统计
+      </div>
+      <el-row :gutter="20">
+        <el-col :span="8">
+          <vxe-table
+            align="center"
+            :loading="loading"
+            ref="xTable"
+            auto-resize
+            border
+            resizable
+            highlight-current-row
+            show-overflow
+            height="790"
+            :data="tableData.slice((currentPage-1)*pageSize,currentPage*pageSize)"
+            :cell-class-name="cellClassName"
+          >
+
+            <vxe-table-column
+              v-for="(item, index) in fromHead"
+              :key="index"
+              align="center"
+              :title="item.label"
+              :field="item.field"
+            ></vxe-table-column>
+          </vxe-table>
+          <vxe-pager
+            perfect
+            :current-page.sync="currentPage"
+            :page-size.sync="pageSize"
+            :total="total"
+            :page-sizes=[10,50,100]
+            :layouts="['PrevJump', 'PrevPage','JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']"
+            @page-change="handlePageChange"
+          >
+          </vxe-pager>
+
+        </el-col>
+        <el-col :span="16">
+          <el-row>
+            <div style="float:left;width: 100%;height: 413px" id="zqlCharts"></div>
+          </el-row>
+          <el-row>
+            <div style="float:left;width: 100%;height: 413px" id="pcCharts"></div>
+
+          </el-row>
+
+
+        </el-col>
+      </el-row>
+    </div>
+  </div>
+</template>
+
+<script>
+import * as echarts from "echarts";
+
+export default {
+  name: 'inverterinfo',
+  data() {
+    return {
+      fromHead: [
+        {
+          label: "时间",
+          field: "time"
+        },
+        {
+          label: "准确率",
+          field: "accuracy"
+        },
+        {
+          label: "单点偏差累加(cap*h)",
+          field: "deviationSum"
+        },
+        {
+          label: "提前多久预测",
+          field: "forecastHowLongAgo"
+        }
+      ],
+      pcChart: null,
+      zqlChart: null,
+      activeName: 'first',
+      dateTime: [new Date(new Date().toLocaleDateString()).getTime() - 10 * 60 * 60 * 24 * 1000, new Date(new Date().toLocaleDateString()).getTime()],
+      total: 0,
+      sortOrder: 'asc',
+      pageSize: 10,
+      currentPage: 1,
+      stationList: [],
+      stationCode: [],
+      searchForm: {},
+      tableData: [],
+      nameList: [],
+      loading: false,
+      modId: '',//备用id
+      lineColor: '#3b3b3b',
+      forecastTypeList: [
+        {
+          label: "短期",
+          value: "dq"
+        },
+        {
+          label: "超短期",
+          value: "cdq"
+        }
+      ],
+      forecastType: "dq",
+      ago: 1,
+      forecastTypeInfo: "",
+      agoInfo: "",
+      stationCodeInfo: "",
+    }
+  },
+  created() {
+    this.getStationCode()
+  },
+  mounted() {
+  },
+  beforeDestroy() {
+    if (this.zqlChart) {
+      this.zqlChart.dispose()
+      this.zqlChart = null
+
+    }
+
+
+    if (this.pcChart) {
+      this.pcChart.dispose()
+      this.pcChart = null
+    }
+
+  },
+  computed: {},
+  methods: {
+    cellClassName({row, rowIndex, column, columnIndex}) {
+      if (columnIndex == 10) {
+        if (row.cz === '—') {
+          return "class-style-yellow"
+        }
+        if (row.cz != '' && row.cz != undefined && row.cz != 0) {
+          return "class-style-red"
+        }
+      }
+
+    },
+    tabClick(tab) {
+      if (this.activeName == 'second') {
+        this.$nextTick(function () {
+          this.wsChart.resize();
+        })
+      }
+    },
+    nameFormat({cellValue, row, column}) {
+      const item = this.nameList.find(item => item.value === cellValue)
+      return item ? item.label : ''
+    },
+    stationCodeFormat({cellValue, row, column}) {
+      const item = this.stationList.find(item => item.value === cellValue)
+      return item ? item.label : ''
+    },
+    handlePageChange({currentPage, pageSize}) {
+      this.currentPage = currentPage
+      this.pageSize = pageSize
+    },
+    async dataQuery() {
+      let startTime = Math.round(this.dateTime[0])
+      let endTime = Math.round(this.dateTime[1])
+      if (endTime <= startTime) {
+        this.$message.warning("开始时间不能大于结束时间")
+        return
+      }
+      if (endTime - startTime > 60 * 60 * 24 * 1000 * 15) {
+        this.$message.warning("查询数据不能超过15天!")
+        return
+      }
+      let queryParams = {
+        "stationCode": this.stationCode,
+        "startTime": startTime,
+        "endTime": endTime,
+        "forecastType": this.forecastType,
+        "dataSources": 'E1',
+        "forecastModel": '',
+        "ago": this.ago
+      }
+
+      this.loading = true
+      this.$axios.get('/accuracyPassRate/getByTimeBetweenAndForecastTypeAndDataSourcesAndForecastModelAndStationCode', {params: queryParams}).then(response => {
+
+        this.agoInfo = this.points().filter(s => s.value == this.ago)[0].label
+        this.forecastTypeInfo = this.forecastTypeList.filter(s => s.value == this.forecastType)[0].label
+        this.stationCodeInfo = this.stationList.filter(s => s.value == this.stationCode)[0].label
+        this.tableData = response.data
+        this.total = response.data.length
+
+        let times = []
+        let pcDatas = []
+        let zqlDatas = []
+
+        this.tableData.forEach(t => {
+          times.push(t.time)
+          zqlDatas.push(t.accuracy.replace("%", ""))
+          pcDatas.push(t.deviationSum)
+        })
+
+        this.pcDraw(times, pcDatas)
+        this.zqlDraw(times, zqlDatas)
+        this.loading = false
+      }).catch(() => {
+        this.loading = false
+      })
+    },
+    getStationCode() {
+      this.$axios({url: '/electricfield/all', method: 'get'}).then(response => {
+        this.stationList = response.data
+        if (this.stationList.length > 0) {
+          this.stationCode = this.stationList[0].value
+          this.dataQuery()
+        }
+      })
+    },
+    zqlDraw(times, datas) {
+      this.zqlChart = echarts.init(document.getElementById('zqlCharts'), null, {renderer: 'svg'})
+      let option = {
+        backgroundColor: 'transparent',
+        title: {
+          top: 20,
+          text: '准确率',
+          textStyle: {
+            fontWeight: 'normal',
+            fontSize: 16,
+            color: this.lineColor
+          },
+          left: '1%'
+        },
+        tooltip: {
+          trigger: 'axis',
+          axisPointer: {
+            lineStyle: {
+              color: '#57617B'
+            }
+          }
+        },
+        legend: {
+          top: 20,
+          width: '70%',
+          icon: 'rect',
+          itemWidth: 14,
+          itemHeight: 5,
+          itemGap: 13,
+          data: ["准确率"],
+          right: '4%',
+          textStyle: {
+            fontSize: 12,
+            color: this.lineColor
+          },
+          selected: {}
+        },
+        dataZoom: [{
+          show: true,
+          realtime: true,
+          start: 0,
+          end: 100,
+          top: "90%",
+          left: "15%",
+          right: "15%",
+          textStyle: {
+            color: this.lineColor
+          }
+        }, {
+          type: 'inside'
+        }],
+        grid: {
+          top: 100,
+          left: '2%',
+          right: '2%',
+          bottom: '10%',
+          containLabel: true
+        },
+        xAxis: [{
+          type: 'category',
+          boundaryGap: false,
+          axisLine: {
+            lineStyle: {
+              color: this.lineColor
+            }
+          },
+          data: times
+        }],
+        yAxis: [{
+          type: 'value',
+          name: '%',
+          max: 100,
+          min: 0,
+          axisTick: {
+            show: false
+          },
+          axisLine: {
+            lineStyle: {
+              color: this.lineColor
+            }
+          },
+
+          axisLabel: {
+            margin: 10,
+            textStyle: {
+              fontSize: 14,
+              color: this.lineColor
+            },
+            formatter: '{value}',
+          },
+          splitLine: {
+            lineStyle: {
+              color: '#57617B'
+            }
+          }
+        }],
+        series: [
+          {
+            name: '准确率',
+            type: 'line',
+            smooth: false,
+            symbol: 'circle',
+            symbolSize: 5,
+            showSymbol: true,
+            lineStyle: {
+              normal: {
+                width: 2
+              }
+            },
+            markLine: {
+              silent: true,
+              itemStyle: {
+                normal: {
+                  show: true,
+                  color: 'red'
+                }
+              },
+              data: [{
+                label: {
+                  position: 'start',
+                  formatter: "标准线"
+                },
+                yAxis: 75
+              }]
+            },
+            itemStyle: {
+              normal: {
+                color: 'rgb(213,219,50)',
+                borderColor: 'rgba(16,217,16,0.96)',
+                borderWidth: 12
+              }
+            },
+            data: datas
+          }
+        ]
+      }
+
+      this.zqlChart.setOption(option, true)
+      var _this = this
+      window.addEventListener("resize", function () {
+        _this.zqlChart.resize();
+      });
+    },
+    pcDraw(times, datas) {
+      this.pcChart = echarts.init(document.getElementById('pcCharts'), null, {renderer: 'svg'})
+      let option = {
+        backgroundColor: 'transparent',
+        title: {
+          top: 20,
+          text: '单点偏差累加',
+          textStyle: {
+            fontWeight: 'normal',
+            fontSize: 16,
+            color: this.lineColor
+          },
+          left: '1%'
+        },
+        tooltip: {
+          trigger: 'axis',
+          axisPointer: {
+            lineStyle: {
+              color: '#57617B'
+            }
+          }
+        },
+        legend: {
+          top: 20,
+          width: '70%',
+          icon: 'rect',
+          itemWidth: 14,
+          itemHeight: 5,
+          itemGap: 13,
+          data: ["单点偏差累加"],
+          right: '4%',
+          textStyle: {
+            fontSize: 12,
+            color: this.lineColor
+          },
+          selected: {}
+        },
+        dataZoom: [{
+          show: true,
+          realtime: true,
+          start: 0,
+          end: 100,
+          left: "15%",
+          right: "15%",
+          top: "90%",
+          textStyle: {
+            color: this.lineColor
+          }
+        }, {
+          type: 'inside'
+        }],
+        grid: {
+          top: 100,
+          left: '2%',
+          right: '2%',
+          bottom: '10%',
+          containLabel: true
+        },
+        xAxis: [{
+          type: 'category',
+          boundaryGap: false,
+          axisLine: {
+            lineStyle: {
+              color: this.lineColor
+            }
+          },
+          data: times
+        }],
+        yAxis: [{
+          type: 'value',
+          name: 'cap*h',
+          axisTick: {
+            show: false
+          },
+          axisLine: {
+            lineStyle: {
+              color: this.lineColor
+            }
+          },
+
+          axisLabel: {
+            margin: 10,
+            textStyle: {
+              fontSize: 14,
+              color: this.lineColor
+            },
+            formatter: '{value}',
+          },
+          splitLine: {
+            lineStyle: {
+              color: '#57617B'
+            }
+          }
+        }],
+        series: [
+          {
+            name: '单点偏差累加',
+            type: 'line',
+            smooth: false,
+            symbol: 'circle',
+            symbolSize: 5,
+            showSymbol: true,
+            lineStyle: {
+              normal: {
+                width: 2
+              }
+            },
+            itemStyle: {
+              normal: {
+                color: 'rgb(140,50,219)',
+                borderColor: 'rgba(140,50,219,0.2)',
+                borderWidth: 12
+              }
+            },
+            data: datas
+          }
+        ]
+      }
+
+
+      this.pcChart.setOption(option, true)
+      var _this = this
+      window.addEventListener("resize", function () {
+        _this.pcChart.resize();
+      });
+    },
+    points() {
+      let points = []
+      if (this.forecastType == 'dq') {
+        for (let i = 1; i < 11; i++) {
+          points.push({label: i + "", value: i})
+        }
+      } else {
+        for (let i = 1; i < 17; i++) {
+          points.push({label: i + "", value: i})
+        }
+      }
+      return points
+    }
+  },
+
+}
+</script>
+
+<style scoped>
+/* //然后给对应的单元格样式 */
+>>> .vxe-table .vxe-body--row .vxe-body--column.class-style-yellow {
+  background-color: #FFFF00;
+}
+
+>>> .vxe-table .vxe-body--row .vxe-body--column.class-style-red {
+  background-color: #FF0000;
+  color: #ffffff;
+}
+</style>
+<!--&gt;>>.vxe-table .vxe-body&#45;&#45;row .vxe-body&#45;&#45;column.class-style .vxe-cell .vxe-cell&#45;&#45;label{-->