Преглед на файлове

Merge remote-tracking branch 'origin/master'

wangt преди 2 години
родител
ревизия
8a3848fee1
променени са 22 файла, в които са добавени 453 реда и са изтрити 392 реда
  1. 1 0
      ipfcst/ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/IcingShutdown.java
  2. 2 2
      ipfcst/ipfcst-console/src/main/frontend/views/console/overHaulPlan/index.vue
  3. 32 0
      ipfcst/ipfcst-console/src/main/java/com/jiayue/ipfcst/console/job/ForecastPowerShortGeneratorJob.java
  4. 4 0
      ipfcst/ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/FileAnalysisService.java
  5. 281 172
      ipfcst/ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/mts/ForecastPowerShortTermGeneratorService.java
  6. 1 0
      ipfcst/ipfcst-console/src/main/resources/sql/t_init_job_class.sql
  7. 1 1
      ipfcst/ipfcst-reportquery/src/main/frontend/views/datav/index.vue
  8. 32 147
      ipfcst/ipfcst-reportquery/src/main/frontend/views/parameterConfiguration/WindTurbinePowerCurve/charts/index.vue
  9. 7 6
      ipfcst/ipfcst-reportquery/src/main/frontend/views/parameterConfiguration/WindTurbinePowerCurve/index.vue
  10. 4 4
      ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/controller/ExportToExcelController.java
  11. 1 0
      ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/controller/ReadToMysqlController.java
  12. 1 0
      ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/controller/WindSpeedPointInfoController.java
  13. 5 3
      ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/controller/WindTurbinePowerCurveController.java
  14. 1 0
      ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/CutOutSpeedSpecifyInfoService.java
  15. 28 17
      ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/DashboardService.java
  16. 24 14
      ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/ExportToExcelService.java
  17. 1 0
      ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/FanUnitInfoService.java
  18. 1 0
      ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/ModifyShorterDataService.java
  19. 1 0
      ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/ReadToMysqlService.java
  20. 1 1
      ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/WindSpeedPointInfoService.java
  21. 23 25
      ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/WindTurbinePowerCurveService.java
  22. 1 0
      ipfcst/ipfcst-reportquery/src/main/resources/db.setting

+ 1 - 0
ipfcst/ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/IcingShutdown.java

@@ -4,6 +4,7 @@ import lombok.Getter;
 import lombok.Setter;
 
 /**
+ * 恶劣天气启停机类
  * @author shd
  * @since 2022-07-05
  */

+ 2 - 2
ipfcst/ipfcst-console/src/main/frontend/views/console/overHaulPlan/index.vue

@@ -55,7 +55,7 @@
           <vxe-table-column title="检修计划信息">
             <vxe-table-column field="name" title="风机编号"
                               :edit-render="{name:'$input',attrs:{type:'text'}}"></vxe-table-column>
-            <vxe-table-column field="describe" title="描述"
+            <vxe-table-column field="describe" title="兆瓦数"
                               :edit-render="{name:'$input',attrs:{type:'text'}}"></vxe-table-column>
             <vxe-table-column width="14%" field="startTime" title="开始时间"
                               :edit-render="{name:'$input',attrs:{type:'text'}}">
@@ -202,7 +202,7 @@ export default {
           {min: 1, max: 9, message: '称长度在 1 到 9 个字符'}
         ],
         describe: [
-          {required: true, message: '请填写检修计划描述,原因等'},
+          {required: true, message: '请填写检修风机兆瓦数'},
           {min: 1, max: 9, message: '名称长度在 1 到 9 个字符'}
         ],
         startTime: [

+ 32 - 0
ipfcst/ipfcst-console/src/main/java/com/jiayue/ipfcst/console/job/ForecastPowerShortGeneratorJob.java

@@ -0,0 +1,32 @@
+package com.jiayue.ipfcst.console.job;
+
+import com.jiayue.ipfcst.common.data.job.BaseJob;
+import com.jiayue.ipfcst.console.service.mts.ForecastPowerShortTermGeneratorService;
+import lombok.extern.slf4j.Slf4j;
+import org.quartz.JobDataMap;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ *短期数据生成定时任务
+ *
+ * @author shd
+ * @since 2022-06-02
+ */
+@Slf4j
+public class ForecastPowerShortGeneratorJob extends BaseJob {
+
+  @Autowired
+  ForecastPowerShortTermGeneratorService forecastPowerShortTermGeneratorService;
+
+  @Override
+  public boolean execute(JobDataMap jobDataMap) {
+    log.info("开始执行短期数据生成定时任务");
+    try {
+      forecastPowerShortTermGeneratorService.createDqFile();
+    }catch (Exception e){
+      log.error("执行短期数据生成定时任务失败:", e);
+    }
+    log.info("执行短期数据生成定时任务结束");
+    return true;
+  }
+}

+ 4 - 0
ipfcst/ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/FileAnalysisService.java

@@ -279,6 +279,8 @@ public class FileAnalysisService extends BaseService {
 									nwpData.setWd90(listNwp.get(listNwp.size() - 96).getWd90());//90 m 风向
 									nwpData.setWd100(listNwp.get(listNwp.size() - 96).getWd100());//100 m 风向
 									nwpData.setWd170(listNwp.get(listNwp.size() - 96).getWd170());//170 m 风向
+
+                  nwpData.setTpr(listNwp.get(listNwp.size() - 96).getTpr());//降水量
 									listNwp.add(nwpData);
 								}
 							} else {
@@ -1170,6 +1172,8 @@ public class FileAnalysisService extends BaseService {
 							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));
+
+              nwpData.setTpr(new BigDecimal(datas[35]).setScale(2,RoundingMode.HALF_UP));
 							listNwp.add(nwpData);
 							//}
 						}

+ 281 - 172
ipfcst/ipfcst-console/src/main/java/com/jiayue/ipfcst/fileupload/job/UploadFileMatoushanJob.java → ipfcst/ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/mts/ForecastPowerShortTermGeneratorService.java

@@ -1,4 +1,4 @@
-package com.jiayue.ipfcst.fileupload.job;
+package com.jiayue.ipfcst.console.service.mts;
 
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.date.DateUtil;
@@ -32,12 +32,14 @@ import java.util.function.Predicate;
 import java.util.stream.Collectors;
 
 /**
+ *短期数据生成定时任务
+ *
  * @author shd
  * @since 2022-06-02
  */
 @Service
 @Slf4j
-public class UploadFileMatoushanJob extends BaseService {
+public class ForecastPowerShortTermGeneratorService extends BaseService {
   @Autowired
   NwpRepository nwpRepository;
   @Autowired
@@ -58,6 +60,8 @@ public class UploadFileMatoushanJob extends BaseService {
   ForecastPowerShortTermRepository forecastPowerShortTermRepository;
   @Autowired
   ModifyShorterDataRepository modifyShorterDataRepository;
+  @Autowired
+  NwpSpeedModifiedRespository nwpSpeedModifiedRespository;
 
   //模板风机为key,其它风机id及风速为value
   public static Map<String,List<String>> moduleFanMaps = new HashMap<>();
@@ -67,14 +71,9 @@ public class UploadFileMatoushanJob extends BaseService {
   public static Map<String,Map<Float,Float>> windTurbinePowerCurveMaps = new HashMap<>();
   //模板机ID
   public static String modleFanId = "";
-
   public static int dayNum = 16;
-
-  public static String stationCodeStr = "J00307";
-
   public static int shutDownNumber = 0;
 
-
   /**
    * 每天凌晨5点30执行  现场每日7点20开始执行文件生成定时任务
    *
@@ -82,31 +81,37 @@ public class UploadFileMatoushanJob extends BaseService {
    */
   //@Scheduled(fixedRate = 1000*60)
   //  30 30 5 * * ? 0/1 * * * * ?
-  //  30 10,25,30 5,17 * * ?
-  @Scheduled(cron = "0/1 */2 * * * ?")
-  public void createDqFile()  {
-    log.info("时间 【" + DateTimeUtil.dateToStrLong(new Date()) + "】 马头山短期文件生成开始");
-    //1.读取配置
-    readExcelForParams();
+  //  30 10,25,30 5,17 * * ?  0/1 */2 * * * ?
+  // @Scheduled(cron = "0/1 */1 * * * ?")
+  public void createDqFile() {
+    log.info("时间 【" + DateTimeUtil.dateToStrLong(new Date()) + "】 马头山短期数据生成开始");
+    // 用户主目录
+    String userHome = System.getProperties().getProperty("user.home");
+    System.out.println("用户主目录:"+userHome);
+    // 1.读取配置
+    readDataForParams();
     //2.修改nwp数据
-    moldRepair();
-    //3.查询nwp数据
-    List<Nwp> listTemperature = getNwpDatas();
-    //4.计算短期预测
-    List<ForecastPowerShortTerm> forecastPowerShortTerms = caculateDqs(listTemperature);
-    forecastPowerShortTermRepository.saveAll(forecastPowerShortTerms);
-    yesOrNoStartIcingShutdown();
-    log.info("时间 【" + DateTimeUtil.dateToStrLong(new Date()) + "】 马头山短期文件生成完成");
+    List<Nwp> nwpDatas = moldRepair();
+    //3.持续强北风
+    beginWestWindUp();
+    //4.查询nwp数据
+    // getNwpDatas();
+    //5.计算短期预测
+    List<ForecastPowerShortTerm> forecastPowerShortTerms = caculateDqs(nwpDatas);
+    // forecastPowerShortTermRepository.saveAll(forecastPowerShortTerms);
+    //6.恶劣天气
+    yesOrNoStartIcingShutdown(forecastPowerShortTerms, nwpDatas);
+    log.info("时间 【" + DateTimeUtil.dateToStrLong(new Date()) + "】 马头山短期数据生成完成");
   }
   /**
    * 读取excel中配置参数
    */
-  private void readExcelForParams() {
-    List<FanUnitInfo> fanUnitInfoList = readFanUnitInfo(); //机组信息读取
-    //读取风速点表到缓存map中
+  private void readDataForParams() {
+    // 机组信息读取
+    List<FanUnitInfo> fanUnitInfoList = readFanUnitInfo();
+    // 读取风速点表到缓存map中
     readWindTurbinePowerCurveMap();
-
-    //整理风机编码及信息
+    // 整理风机编码及信息
     for (FanUnitInfo fanUnitInfo:fanUnitInfoList
     ) {
       String[] fanarrs = fanUnitInfo.getFanNumArrs().split("\\|");
@@ -130,11 +135,26 @@ public class UploadFileMatoushanJob extends BaseService {
   private List<Nwp>  getNwpDatas() {
     long startTimes = getMillisecondsSubDay();
     long endTimes = startTimes + dayNum * 24 * 60 * 60 * 1000 - 15 * 60 * 1000;
-    List<Nwp> listTemperature = nwpRepository.findByPreTimeBetween(startTimes, endTimes);
-    //排序后根据预测时间过滤
-    listTemperature = listTemperature.stream().sorted(Comparator.comparing(Nwp::getPreTime)).filter(distinctByKey(Nwp::getPreTime)).collect(Collectors.toList());
-
-    return listTemperature;
+    List<Nwp> nwpData = nwpService.getNwpData(startTimes, endTimes);
+    List<NwpSpeedModified> nwpSpeedModifieds = nwpSpeedModifiedRespository.findByPreTimeBetween(startTimes, endTimes);
+    // 用修改后的风速值替换原值
+    if(nwpSpeedModifieds.size() > 0){
+      for(NwpSpeedModified nwpSpeedModified: nwpSpeedModifieds){
+        for(Nwp nwp:nwpData){
+          if(nwp.getPreTime() == nwpSpeedModified.getPreTime()){
+            nwp.setWs10(nwpSpeedModified.getWs10());
+            nwp.setWs30(nwpSpeedModified.getWs30());
+            nwp.setWs50(nwpSpeedModified.getWs50());
+            nwp.setWs70(nwpSpeedModified.getWs70());
+            nwp.setWs80(nwpSpeedModified.getWs80());
+            nwp.setWs90(nwpSpeedModified.getWs90());
+            nwp.setWs100(nwpSpeedModified.getWs100());
+            nwp.setWs170(nwpSpeedModified.getWs170());
+          }
+        }
+      }
+    }
+    return nwpData;
   }
 
   /**
@@ -142,19 +162,11 @@ public class UploadFileMatoushanJob extends BaseService {
    * @param listTemperature
    */
   private List<ForecastPowerShortTerm> caculateDqs(List<Nwp> listTemperature) {
-    // 是否开启了解冻开机 1开启
-    // String yesorno_start_thaw_boot = super.getSysParameter("YESORNO_START_THAW_BOOT", "1");
+    log.info("计算短期预测:" + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
     // 层高
     String windHeight = super.getSysParameter("WIND_HEIGHT", "30");
     List<ForecastPowerShortTerm> forecastPowerShortTermList = new ArrayList<>();
 
-    // List<IcingShutdown> icingShutdowns = new ArrayList<>();
-    // List<IcingShutdown> icingShutdownList = new ArrayList<>();
-    // // 是否开启了解冻开机
-    // if(yesorno_start_thaw_boot.equals("1")){
-    //   icingShutdownList = thawBoot();
-    // }
-
     for (Nwp nwp: listTemperature) {
       Float speed = Convert.toFloat(getHeightWs(nwp,windHeight).setScale(1, RoundingMode.HALF_UP));
 
@@ -223,20 +235,16 @@ public class UploadFileMatoushanJob extends BaseService {
       forecastPowerShortTerm.setGenDate(new Date());
       forecastPowerShortTerm.setPredictionModelEnum(PredictionModelEnum.E1);
 
-      // // 解冻开机
-      // for(IcingShutdown icingShutdown:icingShutdownList){
-      //   if(icingShutdown.getStartTime() < nwp.getPreTime() && nwp.getPreTime() < icingShutdown.getEndTime()){
-      //     forecastPowerShortTerm.setFpValue(NumberUtil.round(totalPower/1000 + 2 * icingShutdown.getShutDownNumber(),2).setScale(2,RoundingMode.HALF_UP));
-      //   }
-      // }
-
-      // 计算超装机容量设置为92.7
+      // 计算超装机容量
       if(forecastPowerShortTerm.getFpValue().compareTo(new BigDecimal(93))> 0 ){
         forecastPowerShortTerm.setFpValue(BigDecimal.valueOf(random()).setScale(2,RoundingMode.HALF_UP));
       }
       forecastPowerShortTermList.add(forecastPowerShortTerm);
     }
     List<ForecastPowerShortTerm> forecastPowerShortTerms = modifyShorterData(forecastPowerShortTermList);
+
+    forecastPowerShortTermRepository.saveAll(forecastPowerShortTerms);
+    log.info("计算短期预测结束:" + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
     return forecastPowerShortTerms;
   }
 
@@ -270,21 +278,19 @@ public class UploadFileMatoushanJob extends BaseService {
    * 读取风速曲线点表
    */
   private void readWindTurbinePowerCurveMap() {
-
-    //查询风功率曲线
+    // 查询风功率曲线
     List<WindTurbinePowerCurve> windTurbinePowerCurves = windTurbinePowerCurveRepository.findAll();
-    //并按照机组id区分不同map
+    // 并按照机组id区分不同map
     Map<Integer, List<WindTurbinePowerCurve>> windTurbineMap = windTurbinePowerCurves.stream().collect(Collectors.groupingBy(WindTurbinePowerCurve::getFanId));
     windTurbineMap.forEach((fanId, v) -> {
-      //遍历不同机组的风速发电曲线,已风速为key,功率为value构造map
-      Map<Float,Float> mapSpeed = new HashMap<>();
+      // 遍历不同机组的风速发电曲线,已风速为key,功率为value构造map
+      Map<Float, Float> mapSpeed = new HashMap<>();
       v.forEach(windTurbinePowerCurve -> {
-        mapSpeed.put(windTurbinePowerCurve.getSpeed(),windTurbinePowerCurve.getPower());
+        mapSpeed.put(windTurbinePowerCurve.getSpeed(), windTurbinePowerCurve.getPower());
       });
-      //缓存风功率数据
-      windTurbinePowerCurveMaps.put(String.valueOf(fanId),mapSpeed);
+      // 缓存风功率数据
+      windTurbinePowerCurveMaps.put(String.valueOf(fanId), mapSpeed);
     });
-
   }
 
   /**
@@ -495,36 +501,33 @@ public class UploadFileMatoushanJob extends BaseService {
 
 
   /**
-   * 随机数80-90
+   * 随机数15到60
    * @return
    */
   public Float random(){
     Random r = new Random();
     DecimalFormat df= new DecimalFormat( "0.00");
-    float randomFloat = r.nextFloat() * (90 - 80) + 80;
+    float randomFloat = r.nextFloat() * (60 - 15) + 15;
     String format = df.format(randomFloat);
     return Float.parseFloat(format);
   }
 
   /**
-   * 是否开启结冰停机功能
-   *
+   * 是否开启恶劣天气功能
+   * @param byForecastTimeBetween
    */
-  public void yesOrNoStartIcingShutdown(){
+  public void yesOrNoStartIcingShutdown(List<ForecastPowerShortTerm> byForecastTimeBetween, List<Nwp> nwpDatas){
+
     // 是否开启了结冰停机 1开启 0未开启
-    String yesorno_start_icing_shotdown = super.getSysParameter("YESORNO_START_ICING_SHOTDOWN", "0");
-    // 15天
-    long startTimes = getMillisecondsSubDay();
-    long endTimes = startTimes + dayNum * 24 * 60 * 60 * 1000 - 15 * 60 * 1000;
+    String yesorno_open_severe_weather = super.getSysParameter("YESORNO_OPEN_SEVERE_WEATHER", "0");
 
     // 是否开启了结冰停机
-    if(yesorno_start_icing_shotdown.equals("1")){
+    if(yesorno_open_severe_weather.equals("1")){
+      // 15天
+      long startTimes = getMillisecondsSubDay();
+      long endTimes = startTimes + dayNum * 24 * 60 * 60 * 1000 - 15 * 60 * 1000;
       // 停机数据
-      List<IcingShutdown> icingShutdowns = parkedWindTurbine();
-      long endTime = icingShutdowns.get(icingShutdowns.size() - 1).getEndTime();
-
-      // 短期数据
-      List<ForecastPowerShortTerm> byForecastTimeBetween = forecastPowerShortTermRepository.findByForecastTimeBetween(startTimes, endTimes);
+      List<IcingShutdown> icingShutdowns = parkedWindTurbine(nwpDatas);
 
       for(IcingShutdown icingShutdown: icingShutdowns){
 
@@ -540,9 +543,10 @@ public class UploadFileMatoushanJob extends BaseService {
         }
       }
 
-
+      // 读取停机数量
       int shut_down_number = Integer.parseInt(super.getSysParameter("SHUT_DOWN_NUMBER", "0"));
 
+      long endTime = icingShutdowns.get(icingShutdowns.size() - 1).getEndTime();
       for(ForecastPowerShortTerm forecastPowerShortTerm: byForecastTimeBetween){
         if(forecastPowerShortTerm.getForecastTime() >= endTime){
           forecastPowerShortTerm.setFpValue(forecastPowerShortTerm.getFpValue().subtract( new BigDecimal(2 * shut_down_number)));
@@ -554,22 +558,21 @@ public class UploadFileMatoushanJob extends BaseService {
       }
 
       // 解冰开机
-      long startTime = icingShutdowns.get(0).getStartTime();
-      List<IcingShutdown> icingShutdowns1 = thawBoot(startTime, endTimes);
-
-      for(IcingShutdown icingShutdown: icingShutdowns1){
-
-        for(ForecastPowerShortTerm forecastPowerShortTerm: byForecastTimeBetween){
-          // 短期数据在停机数据时间内
-          if(icingShutdown.getStartTime() <= forecastPowerShortTerm.getForecastTime() && forecastPowerShortTerm.getForecastTime() < icingShutdown.getEndTime()){
-            forecastPowerShortTerm.setFpValue(forecastPowerShortTerm.getFpValue().add(new BigDecimal(2 * icingShutdown.getShutDownNumber())));
-          }
-          // 计算超装机容量设置为92.7
-          if(forecastPowerShortTerm.getFpValue().compareTo(new BigDecimal(93))> 0 ){
-            forecastPowerShortTerm.setFpValue(BigDecimal.valueOf(random()).setScale(2,RoundingMode.HALF_UP));
-          }
-        }
-      }
+      // long startTime = icingShutdowns.get(0).getStartTime();
+      // List<IcingShutdown> icingShutdowns1 = thawBoot(startTime, endTimes);
+      //
+      // for(IcingShutdown icingShutdown: icingShutdowns1){
+      //   for(ForecastPowerShortTerm forecastPowerShortTerm: byForecastTimeBetween){
+      //     // 短期数据在停机数据时间内
+      //     if(icingShutdown.getStartTime() <= forecastPowerShortTerm.getForecastTime() && forecastPowerShortTerm.getForecastTime() < icingShutdown.getEndTime()){
+      //       forecastPowerShortTerm.setFpValue(forecastPowerShortTerm.getFpValue().add(new BigDecimal(2 * icingShutdown.getShutDownNumber())));
+      //     }
+      //     // 计算超装机容量设置为92.7
+      //     if(forecastPowerShortTerm.getFpValue().compareTo(new BigDecimal(93))> 0 ){
+      //       forecastPowerShortTerm.setFpValue(BigDecimal.valueOf(random()).setScale(2,RoundingMode.HALF_UP));
+      //     }
+      //   }
+      // }
 
       // 保存修改后短期数据
       forecastPowerShortTermRepository.saveAll(byForecastTimeBetween);
@@ -580,13 +583,24 @@ public class UploadFileMatoushanJob extends BaseService {
   /**
    * 结冰停机
    *
+   * 遍历nwp数据 判断当前nwp是否满足结冰条件,满足则下雪时长加一, 不满足则下雪中断加1  如果中断次数大于一小时 则重新计算下雪时长
+   *
+   * 到达马头山结冰时间 则把当前nwp时间当作开始时间 加上间隔停机时间当作结束时间 并记录停机数量
+   *
+   * 将军山同
+   *
+   *
+   * 结冰需要满足的条件是温度低于 和 降水强度大于
+   *
+   *
+   * @param nwpDatas
    * @return
    */
-  public List<IcingShutdown> parkedWindTurbine(){
+  public List<IcingShutdown> parkedWindTurbine(List<Nwp> nwpDatas){
     // 停机温度
     BigDecimal down_the_temperature = new BigDecimal(super.getSysParameter("DOWN_THE_TEMPERATURE", "-4"));
     // 结冰降水量阈值
-    BigDecimal tpr_threshold = new BigDecimal(super.getSysParameter("TPR_THRESHOLD", "1.0000"));
+    BigDecimal tpr_threshold = new BigDecimal(super.getSysParameter("TPR_THRESHOLD", "1.00"));
     // 持续降雪多长时间开始结冰 马头山
     String duration_of_snow_m = super.getSysParameter("DURATION_OF_SNOW_M", "30");
     // 持续降雪多长时间开始结冰 将军山
@@ -595,16 +609,13 @@ public class UploadFileMatoushanJob extends BaseService {
     String shut_down_number_time_interval_m = super.getSysParameter("SHUT_DOWN_NUMBER_TIME_INTERVAL_M", "60");
     // 停机间隔时间 将军山
     String shut_down_number_time_interval_j = super.getSysParameter("SHUT_DOWN_NUMBER_TIME_INTERVAL_J", "60");
-    // 强北风出现次数
+    // 降雪持续时长
     Integer snowHowLong = 0;
-    // 强北风中断次数
+    // 降雪中断次数
     Integer snowHowLongCut = 0;
     // 返回集合
     List<IcingShutdown> icingShutdowns = new ArrayList<>();
 
-    // nwp数据
-    List<Nwp> nwpData = getNwpDatas();
-
     // 停机数量
     int iShutDownNumber = 0;
 
@@ -613,12 +624,13 @@ public class UploadFileMatoushanJob extends BaseService {
     IcingShutdown tempISM = new IcingShutdown();
 
     log.info("执行结冰停机方法开始,系统时间:"+ new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
-    for(Nwp nwp: nwpData){
+
+    for(Nwp nwp: nwpDatas){
       // 判断是否结冰
       if(nwp.getT().compareTo(down_the_temperature) < 1 && nwp.getTpr().compareTo(tpr_threshold) > 0){
         snowHowLong += 1;
       }else{
-        snowHowLongCut  += 1;
+        snowHowLongCut += 1;
         if(snowHowLongCut > 4){
           snowHowLong = 0;
         }
@@ -678,6 +690,8 @@ public class UploadFileMatoushanJob extends BaseService {
   /**
    * 解冻开机
    *
+   * 根据nwp数据  如果当前时间点数据满足解冰条件 则判断接下来几个点位(根据开机间隔时间)的温度是否满足解冰条件, 如满足 则保存。
+   *
    * @return
    */
   public List<IcingShutdown> thawBoot(Long startTime, Long endTime){
@@ -689,17 +703,13 @@ public class UploadFileMatoushanJob extends BaseService {
     String thawing_interval_temperature = super.getSysParameter("THAWING_INTERVAL_TEMPERATURE", "-1");
     // 停机数量
     int shut_down_number = Integer.parseInt(super.getSysParameter("SHUT_DOWN_NUMBER", "-1"));
-    // 系统时间
-    Date systemDate = new Date();
-    long tomrrow = DateUtil.endOfDay(DateUtil.offsetDay(systemDate,1)).getTime() + 1;
-    // 获取两天nwp数据
+    // 获取nwp数据
     List<Nwp> nwpData = nwpService.getNwpData(startTime, endTime);
-    // // 临时对象
-    // IcingShutdown icingShutdown = new IcingShutdown();
-    // IcingShutdown icingShutdownM = new IcingShutdown();
     // 返回集合
     List<IcingShutdown> icingShutdowns = new ArrayList<>();
+    // 马头山集合
     List<IcingShutdown> icingShutdownsM = new ArrayList<>();
+    // 将军山集合
     List<IcingShutdown> icingShutdownsJ = new ArrayList<>();
 
     Integer ifOfCount = 0;
@@ -707,6 +717,7 @@ public class UploadFileMatoushanJob extends BaseService {
     Integer forM = 4;
     Integer forJ = 4;
 
+    // 根据开机间隔时间 确定循环次数
     if(thawing_interval_m > 0 && thawing_interval_m <= 60){
       forM = 4;
     }else if(thawing_interval_m > 60 && thawing_interval_m <= 75){
@@ -826,71 +837,7 @@ public class UploadFileMatoushanJob extends BaseService {
               }
             }
 
-
-
-
-
           }
-
-        //
-        //
-        //
-        //
-        //
-        //
-        //
-        //
-        //
-        //
-        //
-        //
-        //
-        //
-        //
-        //   for (int j = i; j <= i + forJ; j++){
-        //     if(nwpData.get(j).getT().compareTo(new BigDecimal(thawing_interval_temperature)) > 0) {
-        //
-        //       Long preTime = nwpData.get(j).getPreTime();
-        //       icingShutdown.setStartTime(preTime);
-        //       if(j == forJ + i){
-        //         Long preTimeJ =DateUtil.offsetMinute(new Date(preTime), thawing_interval_j).getTime();
-        //         icingShutdown.setEndTime(preTimeJ);
-        //       }else {
-        //         preTime = nwpData.get(j).getPreTime();
-        //         icingShutdown.setStartTime(preTime);
-        //       }
-        //     }
-        //   }
-        //
-        //
-        //
-        //   ifOfCount = ifOfCount + 1;
-        //   for (int j = i; j <= i + forJ; j++){
-        //     if(nwpData.get(j).getT().compareTo(new BigDecimal(thawing_interval_temperature)) > 0) {
-        //
-        //       Long preTime = nwpData.get(j).getPreTime();
-        //       Long preTimeJ =DateUtil.offsetMinute(new Date(preTime), thawing_interval_j).getTime();
-        //       icingShutdown.setStartTime(preTime);
-        //       icingShutdown.setEndTime(preTimeJ);
-        //       icingShutdown.setShutDownNumber(ifOfCount);
-        //       shutDownNumber -= 1;
-        //     }
-        //   }
-        //   count++;
-        //   ifOfCountM = ifOfCountM + 1;
-        //   for (int k = i; k <= i + forM; k++) {
-        //     if (nwpData.get(i).getT().compareTo(new BigDecimal(thawing_interval_temperature)) > 0) {
-        //
-        //       Long preTime = nwpData.get(k).getPreTime();
-        //       Long preTimeM = DateUtil.offsetMinute(new Date(preTime), thawing_interval_m).getTime();
-        //       icingShutdownM.setStartTime(preTime);
-        //       icingShutdownM.setEndTime(preTimeM);
-        //       icingShutdownM.setShutDownNumber(ifOfCountM);
-        //       shutDownNumber -= 1;
-        //
-        //     }
-        //   }
-        //   count++;
         }
 
         if(count > 0){
@@ -913,7 +860,6 @@ public class UploadFileMatoushanJob extends BaseService {
     return icingShutdowns;
   }
 
-
   /**
    * 判断风速是上升风还是下降风
    *
@@ -998,7 +944,7 @@ public class UploadFileMatoushanJob extends BaseService {
   /**
    * 修改nwp风速
    */
-  public void moldRepair(){
+  public List<Nwp> moldRepair(){
     log.info("执行修改nwp风速:" + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
     List<Nwp> listTemperature = getNwpDatas();
     List<Nwp> nwpList = new ArrayList<>();
@@ -1025,10 +971,13 @@ public class UploadFileMatoushanJob extends BaseService {
       }
     }
     nwpService.saveAll(nwpList);
+    if(nwpList.size() <= 0){
+      nwpList = listTemperature;
+    }
     log.info("执行修改nwp风速结束 系统时间:" + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
+    return nwpList;
   }
 
-
   /**
    * 判断风向是否发生改变
    *
@@ -1166,6 +1115,166 @@ public class UploadFileMatoushanJob extends BaseService {
   }
 
 
+  public BigDecimal getWd(Nwp nwp, String fieldName) {
+    BigDecimal wd = BigDecimal.ZERO;
+    switch (fieldName) {
+      case "10":
+        wd = nwp.getWd10();
+        break;
+      case "30":
+        wd = nwp.getWd30();
+        break;
+      case "50":
+        wd = nwp.getWd50();
+        break;
+      case "70":
+        wd = nwp.getWd70();
+        break;
+      case "80":
+        wd = nwp.getWd80();
+        break;
+      case "90":
+        wd = nwp.getWd90();
+        break;
+      case "100":
+        wd = nwp.getWd100();
+        break;
+      case "170":
+        wd = nwp.getWd170();
+        break;
+    }
+    return wd;
+  }
+
+
+  /**
+   * 持续强北风后 修改西南风风速值
+   */
+  public void beginWestWindUp(){
+    // 系统日期
+    Date systemTime = new Date();
+    // 层高
+    String windHeight = super.getSysParameter("WIND_HEIGHT", "30");
+
+    // 修改多长时间的西南风风速
+    Integer update_how_long_west_wind = Integer.parseInt(super.getSysParameter("UPDATE_HOW_LONG_WEST_WIND", "6"));
+
+    // 今天开始
+    long beginOfDay = DateUtil.beginOfDay(systemTime).getTime();
+    // 今天结束
+    long endOfDay = DateUtil.endOfDay(systemTime).getTime() + 1;
+
+    long startTimes = getMillisecondsSubDay();
+    long endTimes = startTimes + dayNum * 24 * 60 * 60 * 1000 - 15 * 60 * 1000;
+    log.info("执行西南风增强开始:" + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
+    // 获取今天nwp
+    List<Nwp> todayNwp = nwpRepository.findByPreTimeBetween(startTimes, endTimes);
+
+    // 西南风list
+    List<Nwp> xnNwp = todayNwp.stream().filter(nwp -> getWd(nwp, windHeight).compareTo(new BigDecimal(202.5)) > -1 && getWd(nwp, windHeight).compareTo(new BigDecimal(247.5)) < 1).collect(Collectors.toList());
+
+    // 格式化日志时间
+    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");
+
+    // 遍历西南风list
+    for (int i = 0; i < xnNwp.size(); i++) {
+      Nwp nwp = xnNwp.get(i);
+      // 判断当前风速前是否满足十小时强北风
+      Boolean isNorth = decideStrongNorthWind(nwp.getPreTime());
+
+      // 是连续强北风
+      if(isNorth){
+        // 执行西南风增强
+        Boolean aBoolean = westWindUp(xnNwp, nwp, update_how_long_west_wind,windHeight);
+        log.info("时间:"+simpleDateFormat.format(new Date())+"->"+"西南风是否增强成功:" + aBoolean);
+      }
+      // 从计算结束的nwp开始
+      i= i + update_how_long_west_wind * 4;
+    }
+    log.info("执行西南风增强结束:" + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
+  }
+
+  /**
+   * 判断是不是连续强北风
+   *
+   * @param preTime
+   * @return
+   */
+  public Boolean decideStrongNorthWind(Long preTime){
+    Boolean b = new Boolean(false);
+    // 强北风出现次数
+    Integer strongNorthWind = 0;
+    // 强北风中断次数
+    Integer strongNorthWindCut = 0;
+    // 允许不是北风的差值
+    Integer long_north_always = Integer.parseInt(super.getSysParameter("LONG_NORTH_ALWAYS", "5"));
+    // 强北风持续时间区间
+    Integer long_north_wing_start = Integer.parseInt(super.getSysParameter("LONG_NORTH_WIND_START", "10"));
+    // 获取西南风时间 的前 long_north_wing_start 小时的nwp
+    List<Nwp> lastNHourList = nwpRepository.findByPreTimeBetween(DateUtil.offsetHour(DateUtil.date(preTime), -long_north_wing_start).getTime(), preTime);
+
+    // 层高
+    String windHeight = super.getSysParameter("WIND_HEIGHT", "30");
+
+    for(Nwp nwp: lastNHourList){
+      // 如果是北风
+      if(getWd(nwp, windHeight).compareTo(BigDecimal.ZERO) > -1 && getWd(nwp, windHeight).compareTo(new BigDecimal(45)) < 1  || getWd(nwp, windHeight).compareTo(new BigDecimal(315)) > -1 && getWd(nwp, windHeight).compareTo(new BigDecimal(360)) < 1 ){
+        // //如果风速大于10 则是强北风
+        // if(nwp.getWs80().compareTo(new BigDecimal(10)) > -1){
+          // 统计强北风出现次数
+          strongNorthWind += 1;
+        // }
+      }else {
+        // 统计强北风中断次数
+        strongNorthWindCut += 1;
+        // 如果中断次数大于允许次数则把强北风出现次数置为0
+        if(strongNorthWindCut > long_north_always){
+          strongNorthWind = 0;
+        }
+      }
+    }
+
+    // 如果强北风出现次数 大于 前long_north_wing_start小时的总点位数 - 允许差值
+    if(strongNorthWind > long_north_wing_start * 4 - long_north_always){
+      b = true;
+    }
+
+    return b;
+  }
+
+  /**
+   * 西南风风速小于10米 则乘上西南风增强系数
+   *
+   * @param nwpList
+   * @param nwp 当前nwp
+   */
+  public Boolean westWindUp(List<Nwp> nwpList, Nwp nwp, Integer update_how_long_west_wind,String windHeight){
+    Boolean b = false;
+    // 西南风增强系数
+    // Integer west_wind_up_modulus = Integer.parseInt();
+    BigDecimal west_wind_up_modulus = new BigDecimal(super.getSysParameter("WEST_WIND_UP_MODULUS", "1.6"));
+    // 层高
+    // String windHeight = super.getSysParameter("WIND_HEIGHT", "30");
+    long endTime = 60 * 1000 * 60 * update_how_long_west_wind;
+    // 需要修改的时间区间nwp
+    List<Nwp> collect = nwpList.stream().filter(n -> n.getPreTime().compareTo(nwp.getPreTime()) > -1 && n.getPreTime().compareTo(nwp.getPreTime() + endTime) < 1).collect(Collectors.toList());
+
+    List<Nwp> tempNwp = new ArrayList<>();
+    for (Nwp nwp1 : collect) {
+      // 判断80风速是否小于10米
+      if(getHeightWs(nwp1, windHeight).compareTo(new BigDecimal(10)) < 0){
+        // nwp1.setWs80(nwp.getWs80().multiply(new BigDecimal(west_wind_up_modulus)));
+        setHeightWs(nwp1, windHeight, getHeightWs(nwp1, windHeight).multiply(west_wind_up_modulus).setScale(2,RoundingMode.HALF_UP));
+      }
+      tempNwp.add(nwp1);
+    }
+    List<Nwp> nwps = nwpRepository.saveAll(tempNwp);
+    if(nwps.size() > 0){
+      b = true;
+    }
+    return b;
+  }
+
   /**
    * 今日凌晨 毫秒
    *

+ 1 - 0
ipfcst/ipfcst-console/src/main/resources/sql/t_init_job_class.sql

@@ -257,3 +257,4 @@ INSERT INTO t_init_job_class  (C_JOB_CLASS_NAME, C_JOB_CLASS_PATH, C_JOB_CLASS_T
 INSERT INTO t_init_job_class  (C_JOB_CLASS_NAME, C_JOB_CLASS_PATH, C_JOB_CLASS_TYPE, C_STATION_CODE) select '冀北气象', 'com.jiayue.ipfcst.fileupload.job.UploadFileE207Job', 'fileCreate', '' from dual where not exists (select C_JOB_CLASS_NAME from t_init_job_class where C_JOB_CLASS_NAME = '冀北气象') ;
 
 INSERT INTO t_init_job_class  (C_JOB_CLASS_NAME, C_JOB_CLASS_PATH, C_JOB_CLASS_TYPE, C_STATION_CODE) select '西南风增强', 'com.jiayue.ipfcst.fileupload.job.WestWindUpJob', 'dataCreate', '' from dual where not exists (select C_JOB_CLASS_NAME from t_init_job_class where C_JOB_CLASS_NAME = '西南风增强') ;
+INSERT INTO t_init_job_class  (C_JOB_CLASS_NAME, C_JOB_CLASS_PATH, C_JOB_CLASS_TYPE, C_STATION_CODE) select '马头山短期数据生成', 'com.jiayue.ipfcst.console.job.ForecastPowerShortGeneratorJob', 'dataCreate', '' from dual where not exists (select C_JOB_CLASS_NAME from t_init_job_class where C_JOB_CLASS_NAME = '马头山短期数据生成') ;

+ 1 - 1
ipfcst/ipfcst-reportquery/src/main/frontend/views/datav/index.vue

@@ -462,7 +462,7 @@
         if (flag) {
           temp.push(waringLeft[i])
           if (waringLeft[i].channelStatus == '0') {
-            this.summaryAudioClick()
+            // this.summaryAudioClick()
             break
           }
         }

+ 32 - 147
ipfcst/ipfcst-reportquery/src/main/frontend/views/parameterConfiguration/WindTurbinePowerCurve/charts/index.vue

@@ -14,7 +14,7 @@
     watch: {
       drawData: {
         handler(newValue, oldValue) {
-          this.draw(newValue,newValue.Fan1, newValue.Fan2,newValue.Fan3,newValue.Fan4,newValue.Fan5, newValue.xData)
+          this.draw(newValue,newValue.title, newValue.data, newValue.xData)
         },
         deep: true
       },
@@ -53,7 +53,7 @@
       this.chart = null
     },
     methods: {
-      draw(newValue,Fan1, Fan2,Fan3,Fan4,Fan5,xData) {
+      draw(newValue,title,data,xData) {
         this.chart = echarts.init(document.getElementById('rpcharts'))
           var option = {
           backgroundColor: 'transparent',
@@ -142,153 +142,38 @@
               }
             }
           }],
-          series: [{
-            name: '机组1',
-            type: 'line',
-            smooth: true,
-            symbol: 'circle',
-            symbolSize: 5,
-            showSymbol: false,
-            lineStyle: {
-              normal: {
-                width: 2
-              }
-            },
-            itemStyle: {
-              normal: {
-
-                color: cc.sj,
-                borderColor: 'rgba(219,50,51,0.2)',
-                borderWidth: 12
-              }
-            },
-            data: Fan1
-          }]
+          series: []
         }
 
-          option.legend.data = ['机组1','机组2','机组3','机组4','机组5']
-          option.series.push({
-            name: '机组2',
-            type: 'line',
-            smooth: true,
-            symbol: 'circle',
-            symbolSize: 5,
-            showSymbol: false,
-            lineStyle: {
-              normal: {
-                width: 2
-              }
-            },
-            itemStyle: {
-              normal: {
-
-                color: cc.kygl,
-                borderColor: 'rgba(219,50,51,0.2)',
-                borderWidth: 12
-              }
-            },
-            data: Fan2
-          },{
-            name: '机组3',
-            type: 'line',
-            smooth: true,
-            symbol: 'circle',
-            symbolSize: 5,
-            showSymbol: false,
-            lineStyle: {
-              normal: {
-                width: 2
-              }
-            },
-            itemStyle: {
-              normal: {
-
-                color: cc.llgl,
-                borderColor: 'rgba(219,50,51,0.2)',
-                borderWidth: 12
-              }
-            },
-            data: Fan3
-          },{
-            name: '机组4',
-            type: 'line',
-            smooth: true,
-            symbol: 'circle',
-            symbolSize: 5,
-            showSymbol: false,
-            lineStyle: {
-              normal: {
-                width: 2
-              }
-            },
-
-            itemStyle: {
-              normal: {
-
-                color: cc.line6,
-                borderColor: 'rgba(219,50,51,0.2)',
-                borderWidth: 12
-              }
-            },
-            data: Fan4
-          },{
-            name: '机组5',
-            type: 'line',
-            smooth: true,
-            symbol: 'circle',
-            symbolSize: 5,
-            showSymbol: false,
-            lineStyle: {
-              normal: {
-                width: 2
-              }
-            },
-
-            itemStyle: {
-              normal: {
-
-                color: cc.ybjf,
-                borderColor: 'rgba(219,50,51,0.2)',
-                borderWidth: 12
-              }
-            },
-            data: Fan5
-          },)
-
-
-
-        // if(newValue.hasChartLine == 'true'){
-        //   var carr = ["#8A2BE2","#FF8C00","#0000E3","#85144b","#A8FF24"]
-        //
-        //   var arr = newValue.powerChartLine
-        //   for (let i = 0; i < arr.length; i++) {
-        //     option.legend.data.push(arr[i].title)
-        //     option.series.push({
-        //       name: arr[i].title,
-        //       type: 'line',
-        //       smooth: true,
-        //       symbol: 'circle',
-        //       symbolSize: 5,
-        //       showSymbol: false,
-        //       lineStyle: {
-        //         normal: {
-        //           width: 2
-        //         }
-        //       },
-        //
-        //       itemStyle: {
-        //         normal: {
-        //
-        //           color: carr[i],
-        //           borderColor: 'rgba(219,50,51,0.2)',
-        //           borderWidth: 12
-        //         }
-        //       },
-        //       data: newValue[arr[i].field]
-        //     })
-        //   }
-        //
-        // }
+        var titles = new Array();
+        titles = title;
+        var datas = new Array();
+        datas = data;
+        var carr = ["#8A2BE2","#FF8C00","#0000E3","#85144b","#A8FF24","#983680","#5cb3cc","#57c3c2","#2bae85","#bacf65"]
+             for (let i = 0; i < titles.length; i++) {
+               option.legend.data.push(titles[i])
+               option.series.push({
+                name: titles[i],
+                 type: 'line',
+                 smooth: true,
+                 symbol: 'circle',
+                 symbolSize: 5,
+                 showSymbol: false,
+                 lineStyle: {
+                   normal: {
+                     width: 2
+                   }
+                 },
+                 itemStyle: {
+                   normal: {
+                     color: carr[i],
+                     borderColor: 'rgba(219,50,51,0.2)',
+                     borderWidth: 12
+                   }
+                 },
+                 data: datas[i]
+               })
+             }
         this.chart.setOption(option,true)
       },
     }

+ 7 - 6
ipfcst/ipfcst-reportquery/src/main/frontend/views/parameterConfiguration/WindTurbinePowerCurve/index.vue

@@ -15,12 +15,12 @@
         </el-upload>
         <el-button size="small" type="primary" @click="exportToExcel">导出</el-button>
       </div>
-      <div class="toolbar" v-show="this.showToolBar"> <vxe-toolbar ref="fstToolBar" custom >
-        <template v-slot:buttons>
-          <vxe-button class="downloadButton" style="border:none;"  @click="exportDataEvent"><i class="vxe-icon--download" ></i></vxe-button>
-        </template>
-      </vxe-toolbar></div>
-      <div class="toolbar" v-show="this.showToolBar"> <vxe-toolbar ref="nwpToolBar" custom></vxe-toolbar></div>
+<!--      <div class="toolbar" v-show="this.showToolBar"> <vxe-toolbar ref="fstToolBar" custom >-->
+<!--        <template v-slot:buttons>-->
+<!--          <vxe-button class="downloadButton" style="border:none;"  @click="exportDataEvent"><i class="vxe-icon&#45;&#45;download" ></i></vxe-button>-->
+<!--        </template>-->
+<!--      </vxe-toolbar></div>-->
+<!--      <div class="toolbar" v-show="this.showToolBar"> <vxe-toolbar ref="nwpToolBar" custom></vxe-toolbar></div>-->
     </div>
 
     <div class="content">
@@ -196,6 +196,7 @@
         this.drawLoading = true
         this.$axios.get('/windTurbinePowerCurve/new/').then((res) => {
 
+          console.log(res.data+"-------------");
           this.drawData = res.data
           this.drawLoading = false
           if(!this.drawLoading && !this.tableLoading){

+ 4 - 4
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/controller/ExportToExcelController.java

@@ -11,6 +11,8 @@ import org.springframework.web.bind.annotation.RestController;
 import java.io.IOException;
 
 /**
+ * 导出到excel restful接口
+ *
  * @author shd
  * @since 2022-07-25
  */
@@ -37,8 +39,7 @@ public class ExportToExcelController {
    */
   @GetMapping("/fanUnitInfoExport")
   public ResponseVO fanUnitInfoExport() {
-    exportToExcelService.fanUnitInfoExport();
-    return ResponseVO.success("导出结束");
+    return exportToExcelService.fanUnitInfoExport();
   }
 
   /**
@@ -47,8 +48,7 @@ public class ExportToExcelController {
    */
   @GetMapping("/cutOutSpeedSpecifyInfoExport")
   public ResponseVO cutOutSpeedSpecifyInfoExport() {
-    exportToExcelService.cutOutSpeedSpecifyInfoExport();
-    return ResponseVO.success("导出结束");
+    return exportToExcelService.cutOutSpeedSpecifyInfoExport();
   }
   /**
    * 功率曲线导出

+ 1 - 0
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/controller/ReadToMysqlController.java

@@ -12,6 +12,7 @@ import java.io.IOException;
 import java.sql.SQLException;
 
 /**
+ * 读取excel到数据库restful接口
  * @author shd
  * @since 2022-06-02
  */

+ 1 - 0
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/controller/WindSpeedPointInfoController.java

@@ -13,6 +13,7 @@ import java.util.List;
 import java.util.Map;
 
 /**
+ * 风速点表restful接口
  * @author shd
  * @since 2022-06-01
  */

+ 5 - 3
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/controller/WindTurbinePowerCurveController.java

@@ -13,6 +13,8 @@ import java.util.List;
 import java.util.Map;
 
 /**
+ * 风机曲线restful接口
+ *
  * @author shd
  * @since 2022-06-01
  */
@@ -72,9 +74,9 @@ public class WindTurbinePowerCurveController {
    */
   @GetMapping(value = "/new")
   public ResponseVO getBySpeedBetweenForPage(){
-    Map<String, Object> map;
-    map = this.windTurbinePowerCurveService.getByFanId();
-    return ResponseVO.success(map);
+    // Map<String, Object> map;
+    // map = this.windTurbinePowerCurveService.getByFanId();
+    return ResponseVO.success(windTurbinePowerCurveService.getByFanId());
   }
   /**
    * 获取风机编号

+ 1 - 0
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/CutOutSpeedSpecifyInfoService.java

@@ -20,6 +20,7 @@ import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
+ * 切出停机业务层
  * @author shd
  * @since 2022-05-31
  */

+ 28 - 17
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/DashboardService.java

@@ -1278,37 +1278,48 @@ public class DashboardService extends BaseService {
     SimpleDateFormat sdf = new SimpleDateFormat("mm");
     Calendar calendar = Calendar.getInstance();
     calendar.setTime(sysDate);
+    calendar.set(Calendar.SECOND,0);
+    calendar.set(Calendar.MILLISECOND,0);
     int minutes = calendar.get(Calendar.MINUTE); // 分
-    calendar.set(Calendar.SECOND,00);
+    calendar.set(Calendar.SECOND,0);
     if(minutes > 00 && minutes <= 15){
-      calendar.set(Calendar.MINUTE,00);
-    }else if(minutes > 15 && minutes <= 30){
       calendar.set(Calendar.MINUTE,15);
-    }else if(minutes > 30 && minutes <= 45){
+    }else if(minutes > 15 && minutes <= 30){
       calendar.set(Calendar.MINUTE,30);
-    }else if(minutes > 45 && minutes <= 59){
+    }else if(minutes > 30 && minutes <= 45){
       calendar.set(Calendar.MINUTE,45);
+    }else if(minutes > 45 && minutes <= 59){
+      calendar.set(Calendar.HOUR_OF_DAY, calendar.get(calendar.HOUR_OF_DAY) + 1);
+      calendar.set(Calendar.MINUTE,00);
+    }
+    Date time = calendar.getTime();
+
+    System.out.println( "time+++++++++++++++++"+time);
+    Date startTime = new Date(calendar.getTime().getTime() - 1000l);
+    Date endTime = new Date(calendar.getTime().getTime() + 60 * 1000l);
+    long time1 = calendar.getTimeInMillis();
+    System.out.println( "time11111111111111111111+++++++++++"+time1);
+
+    List<PowerStationStatusData> byTimeBetween = powerStationStatusDataRepository.findByTimeBetween(startTime, endTime);
+    PowerStationStatusData powerStationStatusData = new PowerStationStatusData();
+    if(byTimeBetween.size() > 0){
+      powerStationStatusData = byTimeBetween.get(0);
     }
-    PowerStationStatusData powerStationStatusData = powerStationStatusDataRepository.findByTime(calendar.getTime());
-    ForecastPowerShortTermHis forecastPowerShortTermHis = forecastPowerShortTermHisRepository.findByGenDate(calendar.getTime());
+    ForecastPowerShortTermHis forecastPowerShortTermHis = forecastPowerShortTermHisRepository.findByForecastTime(calendar.getTime().getTime());
+
     BigDecimal realValue = BigDecimal.ZERO;
     BigDecimal ableValue = BigDecimal.ZERO;
-    if(powerStationStatusData != null && forecastPowerShortTermHis != null){
+    if(powerStationStatusData.getId() != null && forecastPowerShortTermHis.getId() != null){
       realValue = powerStationStatusData.getRealValue();
       ableValue = forecastPowerShortTermHis.getAbleValue();
     }
 
     float abs = 0f;
-    if(realValue.compareTo(ableValue) > 0){
-      if(realValue.compareTo(BigDecimal.ZERO) != 0 && ableValue.compareTo(BigDecimal.ZERO) !=0 ){
-        abs = Math.abs(ableValue.subtract(realValue).divide(realValue).floatValue());
-      }
-    }else{
-      if(realValue.compareTo(BigDecimal.ZERO) != 0 && ableValue.compareTo(BigDecimal.ZERO) !=0 ) {
-        abs = ableValue.subtract(realValue).divide(realValue).floatValue();
-      }
+    if(realValue.compareTo(BigDecimal.ZERO) == 1 && ableValue.compareTo(BigDecimal.ZERO) ==1 ){
+        abs = Math.abs(ableValue.subtract(realValue).divide(realValue).multiply(new BigDecimal(100)).floatValue());
     }
-    if(abs > 20){
+
+    if(abs >= 20){
       boom = true;
     }
     map.put("boom", boom);

+ 24 - 14
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/ExportToExcelService.java

@@ -2,6 +2,7 @@ package com.jiayue.ipfcst.service;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.poi.excel.ExcelWriter;
+import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
 import com.jiayue.ipfcst.common.data.entity.CutOutSpeedSpecifyInfo;
 import com.jiayue.ipfcst.common.data.entity.FanUnitInfo;
 import com.jiayue.ipfcst.common.data.entity.WindSpeedPointInfo;
@@ -20,6 +21,7 @@ import java.util.*;
 import java.util.stream.Collectors;
 
 /**
+ * 导出到excel业务层
  * @author shd
  * @since 2022-07-25
  */
@@ -211,8 +213,8 @@ public class ExportToExcelService extends BaseService {
   /**
    * 机组信息导出
    */
-  public void fanUnitInfoExport(){
-    ExcelWriter writer = new ExcelWriter("d:/baa.xls", "机组信息");
+  public ResponseVO fanUnitInfoExport(){
+    try (ExcelWriter writer = new ExcelWriter("d:/baa.xls", "机组信息")) {
     List<String> list = new ArrayList<>();
     List<List<String>> lists = new ArrayList<>();
     List<FanUnitInfo> fanUnitInfoList = fanUnitInfoRepository.findAll();
@@ -233,23 +235,31 @@ public class ExportToExcelService extends BaseService {
     writer.write(lists, true);
     //关闭writer,释放内存
     writer.close();
+    } catch (cn.hutool.poi.exceptions.POIException e) {
+      return ResponseVO.error(e);
+    }
+    return ResponseVO.success();
   }
 
   /**
    * 切出风速导出
    */
-  public void cutOutSpeedSpecifyInfoExport(){
-    ExcelWriter writer = new ExcelWriter("d:/baa.xls", "应切出未停机发电");
-    List<CutOutSpeedSpecifyInfo> cutOutSpeedSpecifyInfos = cutOutSpeedSpecifyInfoRepository.findAll();
-    writer.addHeaderAlias("id", "序号");
-    writer.addHeaderAlias("lowerWindSpeedLimit", "风速下限(包含)m/s");
-    writer.addHeaderAlias("highWindSpeedLimit", "风速上限(不包含)m/s");
-    writer.addHeaderAlias("powerGeneration", "发电功率kW");
-    writer.addHeaderAlias("fanId", "所属机组");
-    //一次性写出内容,强制输出标题
-    writer.write(cutOutSpeedSpecifyInfos, true);
-    //关闭writer,释放内存
-    writer.close();
+  public ResponseVO cutOutSpeedSpecifyInfoExport() {
+    try (ExcelWriter writer = new ExcelWriter("d:/baa.xls", "应切出未停机发电")) {
+      List<CutOutSpeedSpecifyInfo> cutOutSpeedSpecifyInfos = cutOutSpeedSpecifyInfoRepository.findAll();
+      writer.addHeaderAlias("id", "序号");
+      writer.addHeaderAlias("lowerWindSpeedLimit", "风速下限(包含)m/s");
+      writer.addHeaderAlias("highWindSpeedLimit", "风速上限(不包含)m/s");
+      writer.addHeaderAlias("powerGeneration", "发电功率kW");
+      writer.addHeaderAlias("fanId", "所属机组");
+      //一次性写出内容,强制输出标题
+      writer.write(cutOutSpeedSpecifyInfos, true);
+      //关闭writer,释放内存
+      writer.close();
+    } catch (cn.hutool.poi.exceptions.POIException e) {
+      return ResponseVO.error(e);
+    }
+    return ResponseVO.success();
   }
 
   public void windTurbinePowerCurveExport(){

+ 1 - 0
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/FanUnitInfoService.java

@@ -17,6 +17,7 @@ import java.util.List;
 import java.util.Map;
 
 /**
+ * 风机信息业务层
  * @author shd
  * @since 2022-05-31
  */

+ 1 - 0
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/ModifyShorterDataService.java

@@ -17,6 +17,7 @@ import java.util.List;
 import java.util.Map;
 
 /**
+ * 修改短期数据业务层
  * @author shd
  * @since 2022-06-15
  */

+ 1 - 0
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/ReadToMysqlService.java

@@ -29,6 +29,7 @@ import java.text.DecimalFormat;
 import java.util.*;
 
 /**
+ * 读取excel到数据库业务层
  * @author shd
  * @since 2022-07-25
  */

+ 1 - 1
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/WindSpeedPointInfoService.java

@@ -17,7 +17,7 @@ import java.util.*;
 import java.util.stream.Collectors;
 
 /**
- *
+ * 风速点表业务层
  *
  * @author shd
  * @since 2022-06-01

+ 23 - 25
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/WindTurbinePowerCurveService.java

@@ -19,6 +19,7 @@ import java.util.*;
 import java.util.stream.Collectors;
 
 /**
+ * 风机曲线业务层
  * @author shd
  * @since 2022-06-01
  */
@@ -120,39 +121,36 @@ public class WindTurbinePowerCurveService {
    */
   public Map<String, Object> getByFanId() {
     Map<String, Object> map = new HashMap<>();
+    Map<String, List<Float>> map2 = new HashMap<>();
+
+    List<String> title = new ArrayList<>();
+    List<List<Float>> datas = new ArrayList<>();
 
     DecimalFormat df1 = new DecimalFormat("#.00");
     List<String> xData = new ArrayList<>();
     List<WindTurbinePowerCurve> wList = this.getAll();
-    List<Float> w1List = new ArrayList<>();
-    List<Float> w2List = new ArrayList<>();
-    List<Float> w3List = new ArrayList<>();
-    List<Float> w4List = new ArrayList<>();
-    List<Float> w5List = new ArrayList<>();
-    for(WindTurbinePowerCurve w: wList){
-      if(w.getFanId() == 1){
-        w1List.add(w.getPower());
-      }else if(w.getFanId() == 2){
-        w2List.add(w.getPower());
-      }else if(w.getFanId() == 3){
-        w3List.add(w.getPower());
-      }else if(w.getFanId() == 4){
-        w4List.add(w.getPower());
-      }else {
-        w5List.add(w.getPower());
-      }
-    }
-    float j = 1;
-    for(int i = 0; i <= 190; i++){
+    Map<Integer, List<WindTurbinePowerCurve>> collect = wList.stream().collect(Collectors.groupingBy(WindTurbinePowerCurve::getFanId));
+
+    collect.forEach((fanId,v)->{
+      List<WindTurbinePowerCurve> collect2 = v.stream().sorted(Comparator.comparing(WindTurbinePowerCurve::getSpeed)).collect(Collectors.toList());
+      List<Float> collect1 = collect2.stream().map(WindTurbinePowerCurve::getPower).collect(Collectors.toList());
+      map2.put(String.valueOf(fanId),collect1);
+    });
+
+    map2.forEach((k,v) -> {
+      title.add("机组"+k);
+      datas.add(v);
+    });
+
+    // x轴风速
+    float j = 1.1f;
+    for(int i = 0; i < 190; i++){
       xData.add(df1.format(j));
       j = j + 0.1f;
     }
 
-    map.put("Fan1",w1List);
-    map.put("Fan2",w2List);
-    map.put("Fan3",w3List);
-    map.put("Fan4",w4List);
-    map.put("Fan5",w5List);
+    map.put("title",title);
+    map.put("data",datas);
     map.put("xData", xData);
     return map;
   }

+ 1 - 0
ipfcst/ipfcst-reportquery/src/main/resources/db.setting

@@ -1,4 +1,5 @@
 ## db.setting文件
+## hutool导入导出配置
 
 url = jdbc:mysql://localhost:3306/ipfcst-v3?useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&autoReconnect=true&rewriteBatchedStatements=true&serverTimezone=Asia/Shanghai
 user = root