Browse Source

短期数据生成类更名

songhaodong 2 years ago
parent
commit
8dda93aa27

+ 196 - 154
ipfcst/ipfcst-console/src/main/java/com/jiayue/ipfcst/fileupload/job/UploadFileMatoushanJob.java → ipfcst/ipfcst-console/src/main/java/com/jiayue/ipfcst/fileupload/job/ForecastPowerShortTermGeneratorJob.java

@@ -32,12 +32,14 @@ import java.util.function.Predicate;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
 /**
 /**
+ *短期数据生成定时任务
+ *
  * @author shd
  * @author shd
  * @since 2022-06-02
  * @since 2022-06-02
  */
  */
 @Service
 @Service
 @Slf4j
 @Slf4j
-public class UploadFileMatoushanJob extends BaseService {
+public class ForecastPowerShortTermGeneratorJob extends BaseService {
   @Autowired
   @Autowired
   NwpRepository nwpRepository;
   NwpRepository nwpRepository;
   @Autowired
   @Autowired
@@ -67,14 +69,9 @@ public class UploadFileMatoushanJob extends BaseService {
   public static Map<String,Map<Float,Float>> windTurbinePowerCurveMaps = new HashMap<>();
   public static Map<String,Map<Float,Float>> windTurbinePowerCurveMaps = new HashMap<>();
   //模板机ID
   //模板机ID
   public static String modleFanId = "";
   public static String modleFanId = "";
-
   public static int dayNum = 16;
   public static int dayNum = 16;
-
-  public static String stationCodeStr = "J00307";
-
   public static int shutDownNumber = 0;
   public static int shutDownNumber = 0;
 
 
-
   /**
   /**
    * 每天凌晨5点30执行  现场每日7点20开始执行文件生成定时任务
    * 每天凌晨5点30执行  现场每日7点20开始执行文件生成定时任务
    *
    *
@@ -82,31 +79,33 @@ public class UploadFileMatoushanJob extends BaseService {
    */
    */
   //@Scheduled(fixedRate = 1000*60)
   //@Scheduled(fixedRate = 1000*60)
   //  30 30 5 * * ? 0/1 * * * * ?
   //  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()) + "】 马头山短期文件生成开始");
+  //  30 10,25,30 5,17 * * ?  0/1 */2 * * * ?
+  @Scheduled(cron = "30 10,25,30 5,17 * * ?")
+  public void createDqFile() {
+    log.info("时间 【" + DateTimeUtil.dateToStrLong(new Date()) + "】 马头山短期数据生成开始");
     //1.读取配置
     //1.读取配置
-    readExcelForParams();
+    readDataForParams();
     //2.修改nwp数据
     //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);
+    //6.恶劣天气
+    yesOrNoStartIcingShutdown(forecastPowerShortTerms, nwpDatas);
+    log.info("时间 【" + DateTimeUtil.dateToStrLong(new Date()) + "】 马头山短期数据生成完成");
   }
   }
   /**
   /**
    * 读取excel中配置参数
    * 读取excel中配置参数
    */
    */
-  private void readExcelForParams() {
-    List<FanUnitInfo> fanUnitInfoList = readFanUnitInfo(); //机组信息读取
-    //读取风速点表到缓存map中
+  private void readDataForParams() {
+    // 机组信息读取
+    List<FanUnitInfo> fanUnitInfoList = readFanUnitInfo();
+    // 读取风速点表到缓存map中
     readWindTurbinePowerCurveMap();
     readWindTurbinePowerCurveMap();
-
-    //整理风机编码及信息
+    // 整理风机编码及信息
     for (FanUnitInfo fanUnitInfo:fanUnitInfoList
     for (FanUnitInfo fanUnitInfo:fanUnitInfoList
     ) {
     ) {
       String[] fanarrs = fanUnitInfo.getFanNumArrs().split("\\|");
       String[] fanarrs = fanUnitInfo.getFanNumArrs().split("\\|");
@@ -130,11 +129,11 @@ public class UploadFileMatoushanJob extends BaseService {
   private List<Nwp>  getNwpDatas() {
   private List<Nwp>  getNwpDatas() {
     long startTimes = getMillisecondsSubDay();
     long startTimes = getMillisecondsSubDay();
     long endTimes = startTimes + dayNum * 24 * 60 * 60 * 1000 - 15 * 60 * 1000;
     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<Nwp> listTemperature = nwpRepository.findByPreTimeBetween(startTimes, endTimes);
+    // //排序后根据预测时间过滤
+    // listTemperature = listTemperature.stream().sorted(Comparator.comparing(Nwp::getPreTime)).filter(distinctByKey(Nwp::getPreTime)).collect(Collectors.toList());
+    return nwpData;
   }
   }
 
 
   /**
   /**
@@ -142,19 +141,10 @@ public class UploadFileMatoushanJob extends BaseService {
    * @param listTemperature
    * @param listTemperature
    */
    */
   private List<ForecastPowerShortTerm> caculateDqs(List<Nwp> listTemperature) {
   private List<ForecastPowerShortTerm> caculateDqs(List<Nwp> listTemperature) {
-    // 是否开启了解冻开机 1开启
-    // String yesorno_start_thaw_boot = super.getSysParameter("YESORNO_START_THAW_BOOT", "1");
     // 层高
     // 层高
     String windHeight = super.getSysParameter("WIND_HEIGHT", "30");
     String windHeight = super.getSysParameter("WIND_HEIGHT", "30");
     List<ForecastPowerShortTerm> forecastPowerShortTermList = new ArrayList<>();
     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) {
     for (Nwp nwp: listTemperature) {
       Float speed = Convert.toFloat(getHeightWs(nwp,windHeight).setScale(1, RoundingMode.HALF_UP));
       Float speed = Convert.toFloat(getHeightWs(nwp,windHeight).setScale(1, RoundingMode.HALF_UP));
 
 
@@ -223,20 +213,15 @@ public class UploadFileMatoushanJob extends BaseService {
       forecastPowerShortTerm.setGenDate(new Date());
       forecastPowerShortTerm.setGenDate(new Date());
       forecastPowerShortTerm.setPredictionModelEnum(PredictionModelEnum.E1);
       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 ){
       if(forecastPowerShortTerm.getFpValue().compareTo(new BigDecimal(93))> 0 ){
         forecastPowerShortTerm.setFpValue(BigDecimal.valueOf(random()).setScale(2,RoundingMode.HALF_UP));
         forecastPowerShortTerm.setFpValue(BigDecimal.valueOf(random()).setScale(2,RoundingMode.HALF_UP));
       }
       }
       forecastPowerShortTermList.add(forecastPowerShortTerm);
       forecastPowerShortTermList.add(forecastPowerShortTerm);
     }
     }
     List<ForecastPowerShortTerm> forecastPowerShortTerms = modifyShorterData(forecastPowerShortTermList);
     List<ForecastPowerShortTerm> forecastPowerShortTerms = modifyShorterData(forecastPowerShortTermList);
+
+    forecastPowerShortTermRepository.saveAll(forecastPowerShortTerms);
     return forecastPowerShortTerms;
     return forecastPowerShortTerms;
   }
   }
 
 
@@ -270,21 +255,19 @@ public class UploadFileMatoushanJob extends BaseService {
    * 读取风速曲线点表
    * 读取风速曲线点表
    */
    */
   private void readWindTurbinePowerCurveMap() {
   private void readWindTurbinePowerCurveMap() {
-
-    //查询风功率曲线
+    // 查询风功率曲线
     List<WindTurbinePowerCurve> windTurbinePowerCurves = windTurbinePowerCurveRepository.findAll();
     List<WindTurbinePowerCurve> windTurbinePowerCurves = windTurbinePowerCurveRepository.findAll();
-    //并按照机组id区分不同map
+    // 并按照机组id区分不同map
     Map<Integer, List<WindTurbinePowerCurve>> windTurbineMap = windTurbinePowerCurves.stream().collect(Collectors.groupingBy(WindTurbinePowerCurve::getFanId));
     Map<Integer, List<WindTurbinePowerCurve>> windTurbineMap = windTurbinePowerCurves.stream().collect(Collectors.groupingBy(WindTurbinePowerCurve::getFanId));
     windTurbineMap.forEach((fanId, v) -> {
     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 -> {
       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 +478,33 @@ public class UploadFileMatoushanJob extends BaseService {
 
 
 
 
   /**
   /**
-   * 随机数80-90
+   * 随机数15到60
    * @return
    * @return
    */
    */
   public Float random(){
   public Float random(){
     Random r = new Random();
     Random r = new Random();
     DecimalFormat df= new DecimalFormat( "0.00");
     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);
     String format = df.format(randomFloat);
     return Float.parseFloat(format);
     return Float.parseFloat(format);
   }
   }
 
 
   /**
   /**
-   * 是否开启结冰停机功能
-   *
+   * 是否开启恶劣天气功能
+   * @param byForecastTimeBetween
    */
    */
-  public void yesOrNoStartIcingShutdown(){
+  public void yesOrNoStartIcingShutdown(List<ForecastPowerShortTerm> byForecastTimeBetween, List<Nwp> nwpDatas){
+
     // 是否开启了结冰停机 1开启 0未开启
     // 是否开启了结冰停机 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){
       for(IcingShutdown icingShutdown: icingShutdowns){
 
 
@@ -540,9 +520,10 @@ public class UploadFileMatoushanJob extends BaseService {
         }
         }
       }
       }
 
 
-
+      // 读取停机数量
       int shut_down_number = Integer.parseInt(super.getSysParameter("SHUT_DOWN_NUMBER", "0"));
       int shut_down_number = Integer.parseInt(super.getSysParameter("SHUT_DOWN_NUMBER", "0"));
 
 
+      long endTime = icingShutdowns.get(icingShutdowns.size() - 1).getEndTime();
       for(ForecastPowerShortTerm forecastPowerShortTerm: byForecastTimeBetween){
       for(ForecastPowerShortTerm forecastPowerShortTerm: byForecastTimeBetween){
         if(forecastPowerShortTerm.getForecastTime() >= endTime){
         if(forecastPowerShortTerm.getForecastTime() >= endTime){
           forecastPowerShortTerm.setFpValue(forecastPowerShortTerm.getFpValue().subtract( new BigDecimal(2 * shut_down_number)));
           forecastPowerShortTerm.setFpValue(forecastPowerShortTerm.getFpValue().subtract( new BigDecimal(2 * shut_down_number)));
@@ -558,7 +539,6 @@ public class UploadFileMatoushanJob extends BaseService {
       List<IcingShutdown> icingShutdowns1 = thawBoot(startTime, endTimes);
       List<IcingShutdown> icingShutdowns1 = thawBoot(startTime, endTimes);
 
 
       for(IcingShutdown icingShutdown: icingShutdowns1){
       for(IcingShutdown icingShutdown: icingShutdowns1){
-
         for(ForecastPowerShortTerm forecastPowerShortTerm: byForecastTimeBetween){
         for(ForecastPowerShortTerm forecastPowerShortTerm: byForecastTimeBetween){
           // 短期数据在停机数据时间内
           // 短期数据在停机数据时间内
           if(icingShutdown.getStartTime() <= forecastPowerShortTerm.getForecastTime() && forecastPowerShortTerm.getForecastTime() < icingShutdown.getEndTime()){
           if(icingShutdown.getStartTime() <= forecastPowerShortTerm.getForecastTime() && forecastPowerShortTerm.getForecastTime() < icingShutdown.getEndTime()){
@@ -580,9 +560,20 @@ public class UploadFileMatoushanJob extends BaseService {
   /**
   /**
    * 结冰停机
    * 结冰停机
    *
    *
+   * 遍历nwp数据 判断当前nwp是否满足结冰条件,满足则下雪时长加一, 不满足则下雪中断加1  如果中断次数大于一小时 则重新计算下雪时长
+   *
+   * 到达马头山结冰时间 则把当前nwp时间当作开始时间 加上间隔停机时间当作结束时间 并记录停机数量
+   *
+   * 将军山同
+   *
+   *
+   * 结冰需要满足的条件是温度低于 和 降水强度大于
+   *
+   *
+   * @param nwpDatas
    * @return
    * @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 down_the_temperature = new BigDecimal(super.getSysParameter("DOWN_THE_TEMPERATURE", "-4"));
     // 结冰降水量阈值
     // 结冰降水量阈值
@@ -595,16 +586,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_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");
     String shut_down_number_time_interval_j = super.getSysParameter("SHUT_DOWN_NUMBER_TIME_INTERVAL_J", "60");
-    // 强北风出现次数
+    // 降雪持续时长
     Integer snowHowLong = 0;
     Integer snowHowLong = 0;
-    // 强北风中断次数
+    // 降雪中断次数
     Integer snowHowLongCut = 0;
     Integer snowHowLongCut = 0;
     // 返回集合
     // 返回集合
     List<IcingShutdown> icingShutdowns = new ArrayList<>();
     List<IcingShutdown> icingShutdowns = new ArrayList<>();
 
 
-    // nwp数据
-    List<Nwp> nwpData = getNwpDatas();
-
     // 停机数量
     // 停机数量
     int iShutDownNumber = 0;
     int iShutDownNumber = 0;
 
 
@@ -613,12 +601,13 @@ public class UploadFileMatoushanJob extends BaseService {
     IcingShutdown tempISM = new IcingShutdown();
     IcingShutdown tempISM = new IcingShutdown();
 
 
     log.info("执行结冰停机方法开始,系统时间:"+ new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
     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){
       if(nwp.getT().compareTo(down_the_temperature) < 1 && nwp.getTpr().compareTo(tpr_threshold) > 0){
         snowHowLong += 1;
         snowHowLong += 1;
       }else{
       }else{
-        snowHowLongCut  += 1;
+        snowHowLongCut += 1;
         if(snowHowLongCut > 4){
         if(snowHowLongCut > 4){
           snowHowLong = 0;
           snowHowLong = 0;
         }
         }
@@ -678,6 +667,8 @@ public class UploadFileMatoushanJob extends BaseService {
   /**
   /**
    * 解冻开机
    * 解冻开机
    *
    *
+   * 根据nwp数据  如果当前时间点数据满足解冰条件 则判断接下来几个点位(根据开机间隔时间)的温度是否满足解冰条件, 如满足 则保存。
+   *
    * @return
    * @return
    */
    */
   public List<IcingShutdown> thawBoot(Long startTime, Long endTime){
   public List<IcingShutdown> thawBoot(Long startTime, Long endTime){
@@ -689,17 +680,13 @@ public class UploadFileMatoushanJob extends BaseService {
     String thawing_interval_temperature = super.getSysParameter("THAWING_INTERVAL_TEMPERATURE", "-1");
     String thawing_interval_temperature = super.getSysParameter("THAWING_INTERVAL_TEMPERATURE", "-1");
     // 停机数量
     // 停机数量
     int shut_down_number = Integer.parseInt(super.getSysParameter("SHUT_DOWN_NUMBER", "-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);
     List<Nwp> nwpData = nwpService.getNwpData(startTime, endTime);
-    // // 临时对象
-    // IcingShutdown icingShutdown = new IcingShutdown();
-    // IcingShutdown icingShutdownM = new IcingShutdown();
     // 返回集合
     // 返回集合
     List<IcingShutdown> icingShutdowns = new ArrayList<>();
     List<IcingShutdown> icingShutdowns = new ArrayList<>();
+    // 马头山集合
     List<IcingShutdown> icingShutdownsM = new ArrayList<>();
     List<IcingShutdown> icingShutdownsM = new ArrayList<>();
+    // 将军山集合
     List<IcingShutdown> icingShutdownsJ = new ArrayList<>();
     List<IcingShutdown> icingShutdownsJ = new ArrayList<>();
 
 
     Integer ifOfCount = 0;
     Integer ifOfCount = 0;
@@ -707,6 +694,7 @@ public class UploadFileMatoushanJob extends BaseService {
     Integer forM = 4;
     Integer forM = 4;
     Integer forJ = 4;
     Integer forJ = 4;
 
 
+    // 根据开机间隔时间 确定循环次数
     if(thawing_interval_m > 0 && thawing_interval_m <= 60){
     if(thawing_interval_m > 0 && thawing_interval_m <= 60){
       forM = 4;
       forM = 4;
     }else if(thawing_interval_m > 60 && thawing_interval_m <= 75){
     }else if(thawing_interval_m > 60 && thawing_interval_m <= 75){
@@ -826,71 +814,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){
         if(count > 0){
@@ -913,7 +837,6 @@ public class UploadFileMatoushanJob extends BaseService {
     return icingShutdowns;
     return icingShutdowns;
   }
   }
 
 
-
   /**
   /**
    * 判断风速是上升风还是下降风
    * 判断风速是上升风还是下降风
    *
    *
@@ -998,7 +921,7 @@ public class UploadFileMatoushanJob extends BaseService {
   /**
   /**
    * 修改nwp风速
    * 修改nwp风速
    */
    */
-  public void moldRepair(){
+  public List<Nwp> moldRepair(){
     log.info("执行修改nwp风速:" + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
     log.info("执行修改nwp风速:" + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
     List<Nwp> listTemperature = getNwpDatas();
     List<Nwp> listTemperature = getNwpDatas();
     List<Nwp> nwpList = new ArrayList<>();
     List<Nwp> nwpList = new ArrayList<>();
@@ -1025,10 +948,13 @@ public class UploadFileMatoushanJob extends BaseService {
       }
       }
     }
     }
     nwpService.saveAll(nwpList);
     nwpService.saveAll(nwpList);
+    if(nwpList.size() < 0){
+      nwpList = listTemperature;
+    }
     log.info("执行修改nwp风速结束 系统时间:" + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
     log.info("执行修改nwp风速结束 系统时间:" + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
+    return nwpList;
   }
   }
 
 
-
   /**
   /**
    * 判断风向是否发生改变
    * 判断风向是否发生改变
    *
    *
@@ -1165,6 +1091,122 @@ public class UploadFileMatoushanJob extends BaseService {
     }
     }
   }
   }
 
 
+  /**
+   * 持续强北风后 修改西南风风速值
+   */
+  public void beginWestWindUp(){
+    // 系统日期
+    Date systemTime = new Date();
+
+    // 今天开始
+    long beginOfDay = DateUtil.beginOfDay(systemTime).getTime();
+    // 今天结束
+    long endOfDay = DateUtil.endOfDay(systemTime).getTime() + 1;
+    // 获取今天nwp
+    List<Nwp> todayNwp = nwpRepository.findByPreTimeBetween(beginOfDay, endOfDay);
+    // 80米风向是西南风的点位预测时间
+    long preTime = 0l;
+
+    // 修改多长时间的西南风风速
+    Integer update_how_long_west_wind = Integer.parseInt(super.getSysParameter("UPDATE_HOW_LONG_WEST_WIND", "6"));
+
+    // 西南风list
+    List<Nwp> xnNwp = todayNwp.stream().filter(nwp -> nwp.getWd80().compareTo(new BigDecimal(202.5)) > -1 && nwp.getWd80().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);
+        log.info("时间:"+simpleDateFormat.format(new Date())+"->"+"西南风是否增强成功:" + aBoolean);
+      }
+      // 从计算结束的nwp开始
+      i= i + update_how_long_west_wind * 4;
+    }
+  }
+
+  /**
+   * 判断是不是连续强北风
+   *
+   * @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_WING_START", "10"));
+    // 获取西南风时间 的前 long_north_wing_start 小时的nwp
+    List<Nwp> lastNHourList = nwpRepository.findByPreTimeBetween(DateUtil.offsetHour(DateUtil.date(preTime), -long_north_wing_start).getTime(), preTime);
+
+    for(Nwp nwp: lastNHourList){
+      // 如果是北风
+      if(nwp.getWd80().compareTo(BigDecimal.ZERO) > -1 && nwp.getWd80().compareTo(new BigDecimal(45)) < -1  || nwp.getWd80().compareTo(new BigDecimal(315)) > -1 && nwp.getWd80().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){
+    Boolean b = false;
+    // 西南风增强系数
+    Integer west_wind_up_modulus = Integer.parseInt(super.getSysParameter("WEST_WIND_UP_MODULUS", "1.6"));
+
+    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(nwp1.getWs80().compareTo(new BigDecimal(10)) > -1){
+        nwp1.setWs80(nwp.getWs80().multiply(new BigDecimal(west_wind_up_modulus)));
+      }
+      tempNwp.add(nwp1);
+    }
+    List<Nwp> nwps = nwpRepository.saveAll(tempNwp);
+    if(nwps.size() > 0){
+      b = true;
+    }
+    return b;
+  }
 
 
   /**
   /**
    * 今日凌晨 毫秒
    * 今日凌晨 毫秒